@angular/cdk 7.0.4 → 7.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) 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/a11y/typings/live-announcer/live-announcer.d.ts +34 -3
  7. package/bundles/cdk-a11y.umd.js +477 -216
  8. package/bundles/cdk-a11y.umd.js.map +1 -1
  9. package/bundles/cdk-a11y.umd.min.js +1 -1
  10. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  11. package/bundles/cdk-accordion.umd.js +16 -9
  12. package/bundles/cdk-accordion.umd.js.map +1 -1
  13. package/bundles/cdk-accordion.umd.min.js.map +1 -1
  14. package/bundles/cdk-bidi.umd.js +11 -6
  15. package/bundles/cdk-bidi.umd.js.map +1 -1
  16. package/bundles/cdk-bidi.umd.min.js.map +1 -1
  17. package/bundles/cdk-coercion.umd.js +25 -9
  18. package/bundles/cdk-coercion.umd.js.map +1 -1
  19. package/bundles/cdk-coercion.umd.min.js +1 -1
  20. package/bundles/cdk-coercion.umd.min.js.map +1 -1
  21. package/bundles/cdk-collections.umd.js +28 -5
  22. package/bundles/cdk-collections.umd.js.map +1 -1
  23. package/bundles/cdk-collections.umd.min.js.map +1 -1
  24. package/bundles/cdk-drag-drop.umd.js +2177 -915
  25. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  26. package/bundles/cdk-drag-drop.umd.min.js +2 -1
  27. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  28. package/bundles/cdk-keycodes.umd.js +33 -1
  29. package/bundles/cdk-keycodes.umd.js.map +1 -1
  30. package/bundles/cdk-keycodes.umd.min.js +1 -1
  31. package/bundles/cdk-keycodes.umd.min.js.map +1 -1
  32. package/bundles/cdk-layout.umd.js +29 -22
  33. package/bundles/cdk-layout.umd.js.map +1 -1
  34. package/bundles/cdk-layout.umd.min.js +1 -1
  35. package/bundles/cdk-layout.umd.min.js.map +1 -1
  36. package/bundles/cdk-observers.umd.js +26 -7
  37. package/bundles/cdk-observers.umd.js.map +1 -1
  38. package/bundles/cdk-observers.umd.min.js +1 -1
  39. package/bundles/cdk-observers.umd.min.js.map +1 -1
  40. package/bundles/cdk-overlay.umd.js +605 -258
  41. package/bundles/cdk-overlay.umd.js.map +1 -1
  42. package/bundles/cdk-overlay.umd.min.js +2 -2
  43. package/bundles/cdk-overlay.umd.min.js.map +1 -1
  44. package/bundles/cdk-platform.umd.js +50 -28
  45. package/bundles/cdk-platform.umd.js.map +1 -1
  46. package/bundles/cdk-platform.umd.min.js.map +1 -1
  47. package/bundles/cdk-portal.umd.js +14 -7
  48. package/bundles/cdk-portal.umd.js.map +1 -1
  49. package/bundles/cdk-portal.umd.min.js.map +1 -1
  50. package/bundles/cdk-scrolling.umd.js +139 -44
  51. package/bundles/cdk-scrolling.umd.js.map +1 -1
  52. package/bundles/cdk-scrolling.umd.min.js +1 -1
  53. package/bundles/cdk-scrolling.umd.min.js.map +1 -1
  54. package/bundles/cdk-stepper.umd.js +103 -19
  55. package/bundles/cdk-stepper.umd.js.map +1 -1
  56. package/bundles/cdk-stepper.umd.min.js +1 -1
  57. package/bundles/cdk-stepper.umd.min.js.map +1 -1
  58. package/bundles/cdk-table.umd.js +182 -48
  59. package/bundles/cdk-table.umd.js.map +1 -1
  60. package/bundles/cdk-table.umd.min.js.map +1 -1
  61. package/bundles/cdk-text-field.umd.js +76 -38
  62. package/bundles/cdk-text-field.umd.js.map +1 -1
  63. package/bundles/cdk-text-field.umd.min.js +1 -1
  64. package/bundles/cdk-text-field.umd.min.js.map +1 -1
  65. package/bundles/cdk-tree.umd.js +71 -34
  66. package/bundles/cdk-tree.umd.js.map +1 -1
  67. package/bundles/cdk-tree.umd.min.js +1 -1
  68. package/bundles/cdk-tree.umd.min.js.map +1 -1
  69. package/bundles/cdk.umd.js +5 -4
  70. package/bundles/cdk.umd.js.map +1 -1
  71. package/bundles/cdk.umd.min.js +1 -1
  72. package/bundles/cdk.umd.min.js.map +1 -1
  73. package/coercion/typings/element.d.ts +13 -0
  74. package/coercion/typings/index.metadata.json +1 -1
  75. package/coercion/typings/public-api.d.ts +1 -0
  76. package/drag-drop/typings/{drag-handle.d.ts → directives/drag-handle.d.ts} +3 -0
  77. package/drag-drop/typings/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  78. package/drag-drop/typings/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  79. package/drag-drop/typings/directives/drag.d.ts +109 -0
  80. package/{typings/drag-drop → drag-drop/typings/directives}/drop-list-group.d.ts +3 -0
  81. package/drag-drop/typings/directives/drop-list.d.ts +135 -0
  82. package/drag-drop/typings/drag-drop-registry.d.ts +8 -3
  83. package/drag-drop/typings/drag-events.d.ts +14 -7
  84. package/{typings/esm5/drag-drop/drag.d.ts → drag-drop/typings/drag-ref.d.ts} +152 -82
  85. package/drag-drop/typings/drop-list-container.d.ts +21 -3
  86. package/drag-drop/typings/{drop-list.d.ts → drop-list-ref.d.ts} +132 -81
  87. package/drag-drop/typings/index.d.ts +1 -0
  88. package/drag-drop/typings/index.metadata.json +1 -1
  89. package/drag-drop/typings/public-api.d.ts +13 -6
  90. package/esm2015/a11y.js +337 -190
  91. package/esm2015/a11y.js.map +1 -1
  92. package/esm2015/accordion.js +16 -11
  93. package/esm2015/accordion.js.map +1 -1
  94. package/esm2015/bidi.js +13 -8
  95. package/esm2015/bidi.js.map +1 -1
  96. package/esm2015/cdk.js +7 -6
  97. package/esm2015/cdk.js.map +1 -1
  98. package/esm2015/coercion.js +25 -8
  99. package/esm2015/coercion.js.map +1 -1
  100. package/esm2015/collections.js +22 -7
  101. package/esm2015/collections.js.map +1 -1
  102. package/esm2015/drag-drop.js +1587 -691
  103. package/esm2015/drag-drop.js.map +1 -1
  104. package/esm2015/keycodes.js +31 -4
  105. package/esm2015/keycodes.js.map +1 -1
  106. package/esm2015/layout.js +29 -19
  107. package/esm2015/layout.js.map +1 -1
  108. package/esm2015/observers.js +15 -10
  109. package/esm2015/observers.js.map +1 -1
  110. package/esm2015/overlay.js +393 -232
  111. package/esm2015/overlay.js.map +1 -1
  112. package/esm2015/platform.js +53 -31
  113. package/esm2015/platform.js.map +1 -1
  114. package/esm2015/portal.js +13 -9
  115. package/esm2015/portal.js.map +1 -1
  116. package/esm2015/scrolling.js +102 -45
  117. package/esm2015/scrolling.js.map +1 -1
  118. package/esm2015/stepper.js +93 -24
  119. package/esm2015/stepper.js.map +1 -1
  120. package/esm2015/table.js +89 -45
  121. package/esm2015/table.js.map +1 -1
  122. package/esm2015/text-field.js +54 -37
  123. package/esm2015/text-field.js.map +1 -1
  124. package/esm2015/tree.js +55 -36
  125. package/esm2015/tree.js.map +1 -1
  126. package/esm5/a11y.es5.js +481 -220
  127. package/esm5/a11y.es5.js.map +1 -1
  128. package/esm5/accordion.es5.js +18 -11
  129. package/esm5/accordion.es5.js.map +1 -1
  130. package/esm5/bidi.es5.js +13 -8
  131. package/esm5/bidi.es5.js.map +1 -1
  132. package/esm5/cdk.es5.js +7 -6
  133. package/esm5/cdk.es5.js.map +1 -1
  134. package/esm5/coercion.es5.js +25 -8
  135. package/esm5/coercion.es5.js.map +1 -1
  136. package/esm5/collections.es5.js +35 -7
  137. package/esm5/collections.es5.js.map +1 -1
  138. package/esm5/drag-drop.es5.js +2233 -972
  139. package/esm5/drag-drop.es5.js.map +1 -1
  140. package/esm5/keycodes.es5.js +35 -4
  141. package/esm5/keycodes.es5.js.map +1 -1
  142. package/esm5/layout.es5.js +31 -24
  143. package/esm5/layout.es5.js.map +1 -1
  144. package/esm5/observers.es5.js +29 -10
  145. package/esm5/observers.es5.js.map +1 -1
  146. package/esm5/overlay.es5.js +609 -262
  147. package/esm5/overlay.es5.js.map +1 -1
  148. package/esm5/platform.es5.js +52 -30
  149. package/esm5/platform.es5.js.map +1 -1
  150. package/esm5/portal.es5.js +16 -9
  151. package/esm5/portal.es5.js.map +1 -1
  152. package/esm5/scrolling.es5.js +141 -46
  153. package/esm5/scrolling.es5.js.map +1 -1
  154. package/esm5/stepper.es5.js +106 -24
  155. package/esm5/stepper.es5.js.map +1 -1
  156. package/esm5/table.es5.js +184 -50
  157. package/esm5/table.es5.js.map +1 -1
  158. package/esm5/text-field.es5.js +75 -37
  159. package/esm5/text-field.es5.js.map +1 -1
  160. package/esm5/tree.es5.js +74 -37
  161. package/esm5/tree.es5.js.map +1 -1
  162. package/keycodes/typings/index.metadata.json +1 -1
  163. package/keycodes/typings/modifiers.d.ts +14 -0
  164. package/keycodes/typings/public-api.d.ts +1 -0
  165. package/overlay/typings/index.metadata.json +1 -1
  166. package/overlay/typings/overlay-directives.d.ts +0 -2
  167. package/package.json +4 -4
  168. package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts +2 -2
  169. package/schematics/ng-update/upgrade-data.js +2 -1
  170. package/schematics/ng-update/upgrade-data.js.map +1 -1
  171. package/schematics/ng-update/upgrade-rules/index.js +3 -2
  172. package/schematics/ng-update/upgrade-rules/index.js.map +1 -1
  173. package/schematics/utils/ast/ng-module-imports.d.ts +1 -1
  174. package/schematics/utils/ast/ng-module-imports.js +25 -13
  175. package/schematics/utils/ast/ng-module-imports.js.map +1 -1
  176. package/schematics/utils/get-project.js +2 -1
  177. package/schematics/utils/get-project.js.map +1 -1
  178. package/schematics/utils/parse5-element.js +3 -2
  179. package/schematics/utils/parse5-element.js.map +1 -1
  180. package/schematics/utils/project-targets.js +2 -1
  181. package/schematics/utils/project-targets.js.map +1 -1
  182. package/schematics/utils/version-agnostic-typescript.js +3 -2
  183. package/schematics/utils/version-agnostic-typescript.js.map +1 -1
  184. package/scrolling/typings/index.metadata.json +1 -1
  185. package/stepper/typings/index.metadata.json +1 -1
  186. package/stepper/typings/public-api.d.ts +1 -0
  187. package/stepper/typings/step-header.d.ts +15 -0
  188. package/stepper/typings/stepper.d.ts +11 -1
  189. package/text-field/typings/autosize.d.ts +6 -0
  190. package/text-field/typings/index.metadata.json +1 -1
  191. package/tree/typings/control/base-tree-control.d.ts +1 -1
  192. package/tree/typings/control/nested-tree-control.d.ts +2 -2
  193. package/tree/typings/control/tree-control.d.ts +1 -1
  194. package/tree/typings/nested-node.d.ts +5 -5
  195. package/typings/a11y/focus-monitor/focus-monitor.d.ts +20 -5
  196. package/typings/a11y/focus-trap/focus-trap.d.ts +2 -0
  197. package/typings/a11y/index.metadata.json +1 -1
  198. package/typings/a11y/live-announcer/live-announcer.d.ts +34 -3
  199. package/typings/coercion/element.d.ts +13 -0
  200. package/typings/coercion/index.metadata.json +1 -1
  201. package/typings/coercion/public-api.d.ts +1 -0
  202. package/typings/{esm5/drag-drop → drag-drop/directives}/drag-handle.d.ts +3 -0
  203. package/typings/drag-drop/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  204. package/typings/drag-drop/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  205. package/typings/drag-drop/directives/drag.d.ts +109 -0
  206. package/typings/{esm5/drag-drop → drag-drop/directives}/drop-list-group.d.ts +3 -0
  207. package/typings/drag-drop/directives/drop-list.d.ts +135 -0
  208. package/typings/drag-drop/drag-drop-registry.d.ts +8 -3
  209. package/typings/drag-drop/drag-events.d.ts +14 -7
  210. package/typings/drag-drop/{drag.d.ts → drag-ref.d.ts} +152 -82
  211. package/typings/drag-drop/drop-list-container.d.ts +21 -3
  212. package/typings/{esm5/drag-drop/drop-list.d.ts → drag-drop/drop-list-ref.d.ts} +132 -81
  213. package/typings/drag-drop/index.d.ts +1 -0
  214. package/typings/drag-drop/index.metadata.json +1 -1
  215. package/typings/drag-drop/public-api.d.ts +13 -6
  216. package/typings/esm5/a11y/focus-monitor/focus-monitor.d.ts +20 -5
  217. package/typings/esm5/a11y/focus-trap/focus-trap.d.ts +2 -0
  218. package/typings/esm5/a11y/index.metadata.json +1 -1
  219. package/typings/esm5/a11y/live-announcer/live-announcer.d.ts +34 -3
  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/{drag-drop → esm5/drag-drop/directives}/drag-handle.d.ts +3 -0
  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 +109 -0
  227. package/{drag-drop/typings → typings/esm5/drag-drop/directives}/drop-list-group.d.ts +3 -0
  228. package/typings/esm5/drag-drop/directives/drop-list.d.ts +135 -0
  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 -82
  232. package/typings/esm5/drag-drop/drop-list-container.d.ts +21 -3
  233. package/typings/{drag-drop/drop-list.d.ts → esm5/drag-drop/drop-list-ref.d.ts} +132 -81
  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/keycodes/index.metadata.json +1 -1
  239. package/typings/esm5/keycodes/modifiers.d.ts +14 -0
  240. package/typings/esm5/keycodes/public-api.d.ts +1 -0
  241. package/typings/esm5/overlay/index.metadata.json +1 -1
  242. package/typings/esm5/overlay/overlay-directives.d.ts +0 -2
  243. package/typings/esm5/scrolling/index.metadata.json +1 -1
  244. package/typings/esm5/stepper/index.metadata.json +1 -1
  245. package/typings/esm5/stepper/public-api.d.ts +1 -0
  246. package/typings/esm5/stepper/step-header.d.ts +15 -0
  247. package/typings/esm5/stepper/stepper.d.ts +11 -1
  248. package/typings/esm5/text-field/autosize.d.ts +6 -0
  249. package/typings/esm5/text-field/index.metadata.json +1 -1
  250. package/typings/esm5/tree/control/base-tree-control.d.ts +1 -1
  251. package/typings/esm5/tree/control/nested-tree-control.d.ts +2 -2
  252. package/typings/esm5/tree/control/tree-control.d.ts +1 -1
  253. package/typings/esm5/tree/nested-node.d.ts +5 -5
  254. package/typings/index.metadata.json +1 -1
  255. package/typings/keycodes/index.metadata.json +1 -1
  256. package/typings/keycodes/modifiers.d.ts +14 -0
  257. package/typings/keycodes/public-api.d.ts +1 -0
  258. package/typings/overlay/index.metadata.json +1 -1
  259. package/typings/overlay/overlay-directives.d.ts +0 -2
  260. package/typings/schematics/utils/ast/ng-module-imports.d.ts +1 -1
  261. package/typings/scrolling/index.metadata.json +1 -1
  262. package/typings/stepper/index.metadata.json +1 -1
  263. package/typings/stepper/public-api.d.ts +1 -0
  264. package/typings/stepper/step-header.d.ts +15 -0
  265. package/typings/stepper/stepper.d.ts +11 -1
  266. package/typings/text-field/autosize.d.ts +6 -0
  267. package/typings/text-field/index.metadata.json +1 -1
  268. package/typings/tree/control/base-tree-control.d.ts +1 -1
  269. package/typings/tree/control/nested-tree-control.d.ts +2 -2
  270. package/typings/tree/control/tree-control.d.ts +1 -1
  271. package/typings/tree/nested-node.d.ts +5 -5
@@ -42,12 +42,13 @@ function __extends(d, b) {
42
42
 
43
43
  /**
44
44
  * @fileoverview added by tsickle
45
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
45
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
46
46
  */
47
47
 
48
- /** *
48
+ /**
49
49
  * IDs are deliminated by an empty space, as per the spec.
50
- @type {?} */
50
+ * @type {?}
51
+ */
51
52
  var ID_DELIMINATOR = ' ';
52
53
  /**
53
54
  * Adds the given ID to the specified ARIA attribute on an element.
@@ -95,31 +96,37 @@ function getAriaReferenceIds(el, attr) {
95
96
 
96
97
  /**
97
98
  * @fileoverview added by tsickle
98
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
99
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
99
100
  */
100
- /** *
101
+ /**
101
102
  * ID used for the body container where all messages are appended.
102
- @type {?} */
103
+ * @type {?}
104
+ */
103
105
  var MESSAGES_CONTAINER_ID = 'cdk-describedby-message-container';
104
- /** *
106
+ /**
105
107
  * ID prefix used for each created message element.
106
- @type {?} */
108
+ * @type {?}
109
+ */
107
110
  var CDK_DESCRIBEDBY_ID_PREFIX = 'cdk-describedby-message';
108
- /** *
111
+ /**
109
112
  * Attribute given to each host element that is described by a message element.
110
- @type {?} */
113
+ * @type {?}
114
+ */
111
115
  var CDK_DESCRIBEDBY_HOST_ATTRIBUTE = 'cdk-describedby-host';
112
- /** *
116
+ /**
113
117
  * Global incremental identifier for each registered message element.
114
- @type {?} */
118
+ * @type {?}
119
+ */
115
120
  var nextId = 0;
116
- /** *
121
+ /**
117
122
  * Global map of all registered message elements that have been placed into the document.
118
- @type {?} */
123
+ * @type {?}
124
+ */
119
125
  var messageRegistry = new Map();
120
- /** *
126
+ /**
121
127
  * Container for all registered messages.
122
- @type {?} */
128
+ * @type {?}
129
+ */
123
130
  var messagesContainer = null;
124
131
  /**
125
132
  * Utility that creates visually hidden elements with a message content. Useful for elements that
@@ -216,12 +223,18 @@ var AriaDescriber = /** @class */ (function () {
216
223
  /**
217
224
  * Creates a new element in the visually hidden message container element with the message
218
225
  * as its content and adds it to the message registry.
226
+ */
227
+ /**
228
+ * Creates a new element in the visually hidden message container element with the message
229
+ * as its content and adds it to the message registry.
230
+ * @private
219
231
  * @param {?} message
220
232
  * @return {?}
221
233
  */
222
234
  AriaDescriber.prototype._createMessageElement = /**
223
235
  * Creates a new element in the visually hidden message container element with the message
224
236
  * as its content and adds it to the message registry.
237
+ * @private
225
238
  * @param {?} message
226
239
  * @return {?}
227
240
  */
@@ -229,18 +242,21 @@ var AriaDescriber = /** @class */ (function () {
229
242
  /** @type {?} */
230
243
  var messageElement = this._document.createElement('div');
231
244
  messageElement.setAttribute('id', CDK_DESCRIBEDBY_ID_PREFIX + "-" + nextId++);
232
- messageElement.appendChild(/** @type {?} */ ((this._document.createTextNode(message))));
233
- this._createMessagesContainer(); /** @type {?} */
234
- ((messagesContainer)).appendChild(messageElement);
245
+ messageElement.appendChild((/** @type {?} */ (this._document.createTextNode(message))));
246
+ this._createMessagesContainer();
247
+ (/** @type {?} */ (messagesContainer)).appendChild(messageElement);
235
248
  messageRegistry.set(message, { messageElement: messageElement, referenceCount: 0 });
236
249
  };
250
+ /** Deletes the message element from the global messages container. */
237
251
  /**
238
252
  * Deletes the message element from the global messages container.
253
+ * @private
239
254
  * @param {?} message
240
255
  * @return {?}
241
256
  */
242
257
  AriaDescriber.prototype._deleteMessageElement = /**
243
258
  * Deletes the message element from the global messages container.
259
+ * @private
244
260
  * @param {?} message
245
261
  * @return {?}
246
262
  */
@@ -254,12 +270,15 @@ var AriaDescriber = /** @class */ (function () {
254
270
  }
255
271
  messageRegistry.delete(message);
256
272
  };
273
+ /** Creates the global container for all aria-describedby messages. */
257
274
  /**
258
275
  * Creates the global container for all aria-describedby messages.
276
+ * @private
259
277
  * @return {?}
260
278
  */
261
279
  AriaDescriber.prototype._createMessagesContainer = /**
262
280
  * Creates the global container for all aria-describedby messages.
281
+ * @private
263
282
  * @return {?}
264
283
  */
265
284
  function () {
@@ -271,7 +290,7 @@ var AriaDescriber = /** @class */ (function () {
271
290
  // old container so we don't get duplicates. Doing this, instead of emptying the previous
272
291
  // container, should be slightly faster.
273
292
  if (preExistingContainer) {
274
- /** @type {?} */ ((preExistingContainer.parentNode)).removeChild(preExistingContainer);
293
+ (/** @type {?} */ (preExistingContainer.parentNode)).removeChild(preExistingContainer);
275
294
  }
276
295
  messagesContainer = this._document.createElement('div');
277
296
  messagesContainer.id = MESSAGES_CONTAINER_ID;
@@ -280,12 +299,15 @@ var AriaDescriber = /** @class */ (function () {
280
299
  this._document.body.appendChild(messagesContainer);
281
300
  }
282
301
  };
302
+ /** Deletes the global messages container. */
283
303
  /**
284
304
  * Deletes the global messages container.
305
+ * @private
285
306
  * @return {?}
286
307
  */
287
308
  AriaDescriber.prototype._deleteMessagesContainer = /**
288
309
  * Deletes the global messages container.
310
+ * @private
289
311
  * @return {?}
290
312
  */
291
313
  function () {
@@ -294,17 +316,21 @@ var AriaDescriber = /** @class */ (function () {
294
316
  messagesContainer = null;
295
317
  }
296
318
  };
319
+ /** Removes all cdk-describedby messages that are hosted through the element. */
297
320
  /**
298
321
  * Removes all cdk-describedby messages that are hosted through the element.
322
+ * @private
299
323
  * @param {?} element
300
324
  * @return {?}
301
325
  */
302
326
  AriaDescriber.prototype._removeCdkDescribedByReferenceIds = /**
303
327
  * Removes all cdk-describedby messages that are hosted through the element.
328
+ * @private
304
329
  * @param {?} element
305
330
  * @return {?}
306
331
  */
307
332
  function (element) {
333
+ // Remove all aria-describedby reference IDs that are prefixed by CDK_DESCRIBEDBY_ID_PREFIX
308
334
  /** @type {?} */
309
335
  var originalReferenceIds = getAriaReferenceIds(element, 'aria-describedby')
310
336
  .filter(function (id) { return id.indexOf(CDK_DESCRIBEDBY_ID_PREFIX) != 0; });
@@ -313,6 +339,11 @@ var AriaDescriber = /** @class */ (function () {
313
339
  /**
314
340
  * Adds a message reference to the element using aria-describedby and increments the registered
315
341
  * message's reference count.
342
+ */
343
+ /**
344
+ * Adds a message reference to the element using aria-describedby and increments the registered
345
+ * message's reference count.
346
+ * @private
316
347
  * @param {?} element
317
348
  * @param {?} message
318
349
  * @return {?}
@@ -320,13 +351,14 @@ var AriaDescriber = /** @class */ (function () {
320
351
  AriaDescriber.prototype._addMessageReference = /**
321
352
  * Adds a message reference to the element using aria-describedby and increments the registered
322
353
  * message's reference count.
354
+ * @private
323
355
  * @param {?} element
324
356
  * @param {?} message
325
357
  * @return {?}
326
358
  */
327
359
  function (element, message) {
328
360
  /** @type {?} */
329
- var registeredMessage = /** @type {?} */ ((messageRegistry.get(message)));
361
+ var registeredMessage = (/** @type {?} */ (messageRegistry.get(message)));
330
362
  // Add the aria-describedby reference and set the
331
363
  // describedby_host attribute to mark the element.
332
364
  addAriaReferencedId(element, 'aria-describedby', registeredMessage.messageElement.id);
@@ -336,6 +368,11 @@ var AriaDescriber = /** @class */ (function () {
336
368
  /**
337
369
  * Removes a message reference from the element using aria-describedby
338
370
  * and decrements the registered message's reference count.
371
+ */
372
+ /**
373
+ * Removes a message reference from the element using aria-describedby
374
+ * and decrements the registered message's reference count.
375
+ * @private
339
376
  * @param {?} element
340
377
  * @param {?} message
341
378
  * @return {?}
@@ -343,25 +380,29 @@ var AriaDescriber = /** @class */ (function () {
343
380
  AriaDescriber.prototype._removeMessageReference = /**
344
381
  * Removes a message reference from the element using aria-describedby
345
382
  * and decrements the registered message's reference count.
383
+ * @private
346
384
  * @param {?} element
347
385
  * @param {?} message
348
386
  * @return {?}
349
387
  */
350
388
  function (element, message) {
351
389
  /** @type {?} */
352
- var registeredMessage = /** @type {?} */ ((messageRegistry.get(message)));
390
+ var registeredMessage = (/** @type {?} */ (messageRegistry.get(message)));
353
391
  registeredMessage.referenceCount--;
354
392
  removeAriaReferencedId(element, 'aria-describedby', registeredMessage.messageElement.id);
355
393
  element.removeAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE);
356
394
  };
395
+ /** Returns true if the element has been described by the provided message ID. */
357
396
  /**
358
397
  * Returns true if the element has been described by the provided message ID.
398
+ * @private
359
399
  * @param {?} element
360
400
  * @param {?} message
361
401
  * @return {?}
362
402
  */
363
403
  AriaDescriber.prototype._isElementDescribedByMessage = /**
364
404
  * Returns true if the element has been described by the provided message ID.
405
+ * @private
365
406
  * @param {?} element
366
407
  * @param {?} message
367
408
  * @return {?}
@@ -375,14 +416,17 @@ var AriaDescriber = /** @class */ (function () {
375
416
  var messageId = registeredMessage && registeredMessage.messageElement.id;
376
417
  return !!messageId && referenceIds.indexOf(messageId) != -1;
377
418
  };
419
+ /** Determines whether a message can be described on a particular element. */
378
420
  /**
379
421
  * Determines whether a message can be described on a particular element.
422
+ * @private
380
423
  * @param {?} element
381
424
  * @param {?} message
382
425
  * @return {?}
383
426
  */
384
427
  AriaDescriber.prototype._canBeDescribed = /**
385
428
  * Determines whether a message can be described on a particular element.
429
+ * @private
386
430
  * @param {?} element
387
431
  * @param {?} message
388
432
  * @return {?}
@@ -410,32 +454,30 @@ var AriaDescriber = /** @class */ (function () {
410
454
  function ARIA_DESCRIBER_PROVIDER_FACTORY(parentDispatcher, _document) {
411
455
  return parentDispatcher || new AriaDescriber(_document);
412
456
  }
413
- /** *
457
+ /**
414
458
  * \@docs-private \@deprecated \@breaking-change 8.0.0
415
- @type {?} */
459
+ * @type {?}
460
+ */
416
461
  var ARIA_DESCRIBER_PROVIDER = {
417
462
  // If there is already an AriaDescriber available, use that. Otherwise, provide a new one.
418
463
  provide: AriaDescriber,
419
464
  deps: [
420
465
  [new core.Optional(), new core.SkipSelf(), AriaDescriber],
421
- /** @type {?} */ (common.DOCUMENT)
466
+ (/** @type {?} */ (common.DOCUMENT))
422
467
  ],
423
468
  useFactory: ARIA_DESCRIBER_PROVIDER_FACTORY
424
469
  };
425
470
 
426
471
  /**
427
472
  * @fileoverview added by tsickle
428
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
473
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
429
474
  */
430
- // unsupported: template constraints.
431
475
  /**
432
476
  * This class manages keyboard events for selectable lists. If you pass it a query list
433
477
  * of items, it will set the active item correctly when arrow events occur.
434
478
  * @template T
435
479
  */
436
- var
437
- // unsupported: template constraints.
438
- /**
480
+ var /**
439
481
  * This class manages keyboard events for selectable lists. If you pass it a query list
440
482
  * of items, it will set the active item correctly when arrow events occur.
441
483
  * @template T
@@ -445,6 +487,7 @@ ListKeyManager = /** @class */ (function () {
445
487
  var _this = this;
446
488
  this._items = _items;
447
489
  this._activeItemIndex = -1;
490
+ this._activeItem = null;
448
491
  this._wrap = false;
449
492
  this._letterKeyStream = new rxjs.Subject();
450
493
  this._typeaheadSubscription = rxjs.Subscription.EMPTY;
@@ -455,6 +498,7 @@ ListKeyManager = /** @class */ (function () {
455
498
  * by the key manager. By default, disabled items are skipped.
456
499
  */
457
500
  this._skipPredicateFn = function (item) { return item.disabled; };
501
+ // Buffer for the letters that the user has pressed when the typeahead option is turned on.
458
502
  this._pressedLetters = [];
459
503
  /**
460
504
  * Stream that emits any time the TAB key is pressed, so components can react
@@ -490,18 +534,22 @@ ListKeyManager = /** @class */ (function () {
490
534
  /**
491
535
  * Sets the predicate function that determines which items should be skipped by the
492
536
  * list key manager.
537
+ * @template THIS
538
+ * @this {THIS}
493
539
  * @param {?} predicate Function that determines whether the given item should be skipped.
494
- * @return {?}
540
+ * @return {THIS}
495
541
  */
496
542
  ListKeyManager.prototype.skipPredicate = /**
497
543
  * Sets the predicate function that determines which items should be skipped by the
498
544
  * list key manager.
545
+ * @template THIS
546
+ * @this {THIS}
499
547
  * @param {?} predicate Function that determines whether the given item should be skipped.
500
- * @return {?}
548
+ * @return {THIS}
501
549
  */
502
550
  function (predicate) {
503
- this._skipPredicateFn = predicate;
504
- return this;
551
+ (/** @type {?} */ (this))._skipPredicateFn = predicate;
552
+ return (/** @type {?} */ (this));
505
553
  };
506
554
  /**
507
555
  * Configures wrapping mode, which determines whether the active item will wrap to
@@ -511,19 +559,23 @@ ListKeyManager = /** @class */ (function () {
511
559
  /**
512
560
  * Configures wrapping mode, which determines whether the active item will wrap to
513
561
  * the other end of list when there are no more items in the given direction.
562
+ * @template THIS
563
+ * @this {THIS}
514
564
  * @param {?=} shouldWrap Whether the list should wrap when reaching the end.
515
- * @return {?}
565
+ * @return {THIS}
516
566
  */
517
567
  ListKeyManager.prototype.withWrap = /**
518
568
  * Configures wrapping mode, which determines whether the active item will wrap to
519
569
  * the other end of list when there are no more items in the given direction.
570
+ * @template THIS
571
+ * @this {THIS}
520
572
  * @param {?=} shouldWrap Whether the list should wrap when reaching the end.
521
- * @return {?}
573
+ * @return {THIS}
522
574
  */
523
575
  function (shouldWrap) {
524
576
  if (shouldWrap === void 0) { shouldWrap = true; }
525
- this._wrap = shouldWrap;
526
- return this;
577
+ (/** @type {?} */ (this))._wrap = shouldWrap;
578
+ return (/** @type {?} */ (this));
527
579
  };
528
580
  /**
529
581
  * Configures whether the key manager should be able to move the selection vertically.
@@ -531,18 +583,22 @@ ListKeyManager = /** @class */ (function () {
531
583
  */
532
584
  /**
533
585
  * Configures whether the key manager should be able to move the selection vertically.
586
+ * @template THIS
587
+ * @this {THIS}
534
588
  * @param {?=} enabled Whether vertical selection should be enabled.
535
- * @return {?}
589
+ * @return {THIS}
536
590
  */
537
591
  ListKeyManager.prototype.withVerticalOrientation = /**
538
592
  * Configures whether the key manager should be able to move the selection vertically.
593
+ * @template THIS
594
+ * @this {THIS}
539
595
  * @param {?=} enabled Whether vertical selection should be enabled.
540
- * @return {?}
596
+ * @return {THIS}
541
597
  */
542
598
  function (enabled) {
543
599
  if (enabled === void 0) { enabled = true; }
544
- this._vertical = enabled;
545
- return this;
600
+ (/** @type {?} */ (this))._vertical = enabled;
601
+ return (/** @type {?} */ (this));
546
602
  };
547
603
  /**
548
604
  * Configures the key manager to move the selection horizontally.
@@ -552,18 +608,22 @@ ListKeyManager = /** @class */ (function () {
552
608
  /**
553
609
  * Configures the key manager to move the selection horizontally.
554
610
  * Passing in `null` will disable horizontal movement.
611
+ * @template THIS
612
+ * @this {THIS}
555
613
  * @param {?} direction Direction in which the selection can be moved.
556
- * @return {?}
614
+ * @return {THIS}
557
615
  */
558
616
  ListKeyManager.prototype.withHorizontalOrientation = /**
559
617
  * Configures the key manager to move the selection horizontally.
560
618
  * Passing in `null` will disable horizontal movement.
619
+ * @template THIS
620
+ * @this {THIS}
561
621
  * @param {?} direction Direction in which the selection can be moved.
562
- * @return {?}
622
+ * @return {THIS}
563
623
  */
564
624
  function (direction) {
565
- this._horizontal = direction;
566
- return this;
625
+ (/** @type {?} */ (this))._horizontal = direction;
626
+ return (/** @type {?} */ (this));
567
627
  };
568
628
  /**
569
629
  * Modifier keys which are allowed to be held down and whose default actions will be prevented
@@ -572,18 +632,22 @@ ListKeyManager = /** @class */ (function () {
572
632
  /**
573
633
  * Modifier keys which are allowed to be held down and whose default actions will be prevented
574
634
  * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys.
635
+ * @template THIS
636
+ * @this {THIS}
575
637
  * @param {?} keys
576
- * @return {?}
638
+ * @return {THIS}
577
639
  */
578
640
  ListKeyManager.prototype.withAllowedModifierKeys = /**
579
641
  * Modifier keys which are allowed to be held down and whose default actions will be prevented
580
642
  * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys.
643
+ * @template THIS
644
+ * @this {THIS}
581
645
  * @param {?} keys
582
- * @return {?}
646
+ * @return {THIS}
583
647
  */
584
648
  function (keys) {
585
- this._allowedModifierKeys = keys;
586
- return this;
649
+ (/** @type {?} */ (this))._allowedModifierKeys = keys;
650
+ return (/** @type {?} */ (this));
587
651
  };
588
652
  /**
589
653
  * Turns on typeahead mode which allows users to set the active item by typing.
@@ -591,42 +655,47 @@ ListKeyManager = /** @class */ (function () {
591
655
  */
592
656
  /**
593
657
  * Turns on typeahead mode which allows users to set the active item by typing.
658
+ * @template THIS
659
+ * @this {THIS}
594
660
  * @param {?=} debounceInterval Time to wait after the last keystroke before setting the active item.
595
- * @return {?}
661
+ * @return {THIS}
596
662
  */
597
663
  ListKeyManager.prototype.withTypeAhead = /**
598
664
  * Turns on typeahead mode which allows users to set the active item by typing.
665
+ * @template THIS
666
+ * @this {THIS}
599
667
  * @param {?=} debounceInterval Time to wait after the last keystroke before setting the active item.
600
- * @return {?}
668
+ * @return {THIS}
601
669
  */
602
670
  function (debounceInterval) {
603
671
  var _this = this;
604
672
  if (debounceInterval === void 0) { debounceInterval = 200; }
605
- if (this._items.length && this._items.some(function (item) { return typeof item.getLabel !== 'function'; })) {
673
+ if ((/** @type {?} */ (this))._items.length && (/** @type {?} */ (this))._items.some(function (item) { return typeof item.getLabel !== 'function'; })) {
606
674
  throw Error('ListKeyManager items in typeahead mode must implement the `getLabel` method.');
607
675
  }
608
- this._typeaheadSubscription.unsubscribe();
676
+ (/** @type {?} */ (this))._typeaheadSubscription.unsubscribe();
609
677
  // Debounce the presses of non-navigational keys, collect the ones that correspond to letters
610
678
  // and convert those letters back into a string. Afterwards find the first item that starts
611
679
  // with that string and select it.
612
- this._typeaheadSubscription = this._letterKeyStream.pipe(operators.tap(function (keyCode) { return _this._pressedLetters.push(keyCode); }), operators.debounceTime(debounceInterval), operators.filter(function () { return _this._pressedLetters.length > 0; }), operators.map(function () { return _this._pressedLetters.join(''); })).subscribe(function (inputString) {
680
+ (/** @type {?} */ (this))._typeaheadSubscription = (/** @type {?} */ (this))._letterKeyStream.pipe(operators.tap(function (keyCode) { return (/** @type {?} */ (_this))._pressedLetters.push(keyCode); }), operators.debounceTime(debounceInterval), operators.filter(function () { return (/** @type {?} */ (_this))._pressedLetters.length > 0; }), operators.map(function () { return (/** @type {?} */ (_this))._pressedLetters.join(''); })).subscribe(function (inputString) {
613
681
  /** @type {?} */
614
- var items = _this._getItemsArray();
682
+ var items = (/** @type {?} */ (_this))._getItemsArray();
615
683
  // Start at 1 because we want to start searching at the item immediately
616
684
  // following the current active item.
617
685
  for (var i = 1; i < items.length + 1; i++) {
618
686
  /** @type {?} */
619
- var index = (_this._activeItemIndex + i) % items.length;
687
+ var index = ((/** @type {?} */ (_this))._activeItemIndex + i) % items.length;
620
688
  /** @type {?} */
621
689
  var item = items[index];
622
- if (!_this._skipPredicateFn(item) && /** @type {?} */ ((item.getLabel))().toUpperCase().trim().indexOf(inputString) === 0) {
623
- _this.setActiveItem(index);
690
+ if (!(/** @type {?} */ (_this))._skipPredicateFn(item) &&
691
+ (/** @type {?} */ (item.getLabel))().toUpperCase().trim().indexOf(inputString) === 0) {
692
+ (/** @type {?} */ (_this)).setActiveItem(index);
624
693
  break;
625
694
  }
626
695
  }
627
- _this._pressedLetters = [];
696
+ (/** @type {?} */ (_this))._pressedLetters = [];
628
697
  });
629
- return this;
698
+ return (/** @type {?} */ (this));
630
699
  };
631
700
  /**
632
701
  * @param {?} item
@@ -705,13 +774,15 @@ ListKeyManager = /** @class */ (function () {
705
774
  return;
706
775
  }
707
776
  default:
708
- // Attempt to use the `event.key` which also maps it to the user's keyboard language,
709
- // otherwise fall back to resolving alphanumeric characters via the keyCode.
710
- if (event.key && event.key.length === 1) {
711
- this._letterKeyStream.next(event.key.toLocaleUpperCase());
712
- }
713
- else if ((keyCode >= keycodes.A && keyCode <= keycodes.Z) || (keyCode >= keycodes.ZERO && keyCode <= keycodes.NINE)) {
714
- this._letterKeyStream.next(String.fromCharCode(keyCode));
777
+ if (isModifierAllowed || keycodes.hasModifierKey(event, 'shiftKey')) {
778
+ // Attempt to use the `event.key` which also maps it to the user's keyboard language,
779
+ // otherwise fall back to resolving alphanumeric characters via the keyCode.
780
+ if (event.key && event.key.length === 1) {
781
+ this._letterKeyStream.next(event.key.toLocaleUpperCase());
782
+ }
783
+ else if ((keyCode >= keycodes.A && keyCode <= keycodes.Z) || (keyCode >= keycodes.ZERO && keyCode <= keycodes.NINE)) {
784
+ this._letterKeyStream.next(String.fromCharCode(keyCode));
785
+ }
715
786
  }
716
787
  // Note that we return here, in order to avoid preventing
717
788
  // the default action of non-navigational keys.
@@ -806,8 +877,11 @@ ListKeyManager = /** @class */ (function () {
806
877
  var itemArray = this._getItemsArray();
807
878
  /** @type {?} */
808
879
  var index = typeof item === 'number' ? item : itemArray.indexOf(item);
880
+ /** @type {?} */
881
+ var activeItem = itemArray[index];
882
+ // Explicitly check for `null` and `undefined` because other falsy values are valid.
883
+ this._activeItem = activeItem == null ? null : activeItem;
809
884
  this._activeItemIndex = index;
810
- this._activeItem = itemArray[index];
811
885
  };
812
886
  /**
813
887
  * Allows setting of the activeItemIndex without any other effects.
@@ -836,6 +910,12 @@ ListKeyManager = /** @class */ (function () {
836
910
  * This method sets the active item, given a list of items and the delta between the
837
911
  * currently active item and the new active item. It will calculate differently
838
912
  * depending on whether wrap mode is turned on.
913
+ */
914
+ /**
915
+ * This method sets the active item, given a list of items and the delta between the
916
+ * currently active item and the new active item. It will calculate differently
917
+ * depending on whether wrap mode is turned on.
918
+ * @private
839
919
  * @param {?} delta
840
920
  * @return {?}
841
921
  */
@@ -843,6 +923,7 @@ ListKeyManager = /** @class */ (function () {
843
923
  * This method sets the active item, given a list of items and the delta between the
844
924
  * currently active item and the new active item. It will calculate differently
845
925
  * depending on whether wrap mode is turned on.
926
+ * @private
846
927
  * @param {?} delta
847
928
  * @return {?}
848
929
  */
@@ -853,6 +934,12 @@ ListKeyManager = /** @class */ (function () {
853
934
  * Sets the active item properly given "wrap" mode. In other words, it will continue to move
854
935
  * down the list until it finds an item that is not disabled, and it will wrap if it
855
936
  * encounters either end of the list.
937
+ */
938
+ /**
939
+ * Sets the active item properly given "wrap" mode. In other words, it will continue to move
940
+ * down the list until it finds an item that is not disabled, and it will wrap if it
941
+ * encounters either end of the list.
942
+ * @private
856
943
  * @param {?} delta
857
944
  * @return {?}
858
945
  */
@@ -860,6 +947,7 @@ ListKeyManager = /** @class */ (function () {
860
947
  * Sets the active item properly given "wrap" mode. In other words, it will continue to move
861
948
  * down the list until it finds an item that is not disabled, and it will wrap if it
862
949
  * encounters either end of the list.
950
+ * @private
863
951
  * @param {?} delta
864
952
  * @return {?}
865
953
  */
@@ -881,6 +969,12 @@ ListKeyManager = /** @class */ (function () {
881
969
  * Sets the active item properly given the default mode. In other words, it will
882
970
  * continue to move down the list until it finds an item that is not disabled. If
883
971
  * it encounters either end of the list, it will stop and not wrap.
972
+ */
973
+ /**
974
+ * Sets the active item properly given the default mode. In other words, it will
975
+ * continue to move down the list until it finds an item that is not disabled. If
976
+ * it encounters either end of the list, it will stop and not wrap.
977
+ * @private
884
978
  * @param {?} delta
885
979
  * @return {?}
886
980
  */
@@ -888,6 +982,7 @@ ListKeyManager = /** @class */ (function () {
888
982
  * Sets the active item properly given the default mode. In other words, it will
889
983
  * continue to move down the list until it finds an item that is not disabled. If
890
984
  * it encounters either end of the list, it will stop and not wrap.
985
+ * @private
891
986
  * @param {?} delta
892
987
  * @return {?}
893
988
  */
@@ -898,6 +993,12 @@ ListKeyManager = /** @class */ (function () {
898
993
  * Sets the active item to the first enabled item starting at the index specified. If the
899
994
  * item is disabled, it will move in the fallbackDelta direction until it either
900
995
  * finds an enabled item or encounters the end of the list.
996
+ */
997
+ /**
998
+ * Sets the active item to the first enabled item starting at the index specified. If the
999
+ * item is disabled, it will move in the fallbackDelta direction until it either
1000
+ * finds an enabled item or encounters the end of the list.
1001
+ * @private
901
1002
  * @param {?} index
902
1003
  * @param {?} fallbackDelta
903
1004
  * @return {?}
@@ -906,6 +1007,7 @@ ListKeyManager = /** @class */ (function () {
906
1007
  * Sets the active item to the first enabled item starting at the index specified. If the
907
1008
  * item is disabled, it will move in the fallbackDelta direction until it either
908
1009
  * finds an enabled item or encounters the end of the list.
1010
+ * @private
909
1011
  * @param {?} index
910
1012
  * @param {?} fallbackDelta
911
1013
  * @return {?}
@@ -924,12 +1026,15 @@ ListKeyManager = /** @class */ (function () {
924
1026
  }
925
1027
  this.setActiveItem(index);
926
1028
  };
1029
+ /** Returns the items as an array. */
927
1030
  /**
928
1031
  * Returns the items as an array.
1032
+ * @private
929
1033
  * @return {?}
930
1034
  */
931
1035
  ListKeyManager.prototype._getItemsArray = /**
932
1036
  * Returns the items as an array.
1037
+ * @private
933
1038
  * @return {?}
934
1039
  */
935
1040
  function () {
@@ -940,7 +1045,7 @@ ListKeyManager = /** @class */ (function () {
940
1045
 
941
1046
  /**
942
1047
  * @fileoverview added by tsickle
943
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1048
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
944
1049
  */
945
1050
  /**
946
1051
  * @template T
@@ -975,7 +1080,7 @@ ActiveDescendantKeyManager = /** @class */ (function (_super) {
975
1080
 
976
1081
  /**
977
1082
  * @fileoverview added by tsickle
978
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1083
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
979
1084
  */
980
1085
  /**
981
1086
  * @template T
@@ -996,17 +1101,21 @@ FocusKeyManager = /** @class */ (function (_super) {
996
1101
  */
997
1102
  /**
998
1103
  * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls.
1104
+ * @template THIS
1105
+ * @this {THIS}
999
1106
  * @param {?} origin Focus origin to be used when focusing items.
1000
- * @return {?}
1107
+ * @return {THIS}
1001
1108
  */
1002
1109
  FocusKeyManager.prototype.setFocusOrigin = /**
1003
1110
  * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls.
1111
+ * @template THIS
1112
+ * @this {THIS}
1004
1113
  * @param {?} origin Focus origin to be used when focusing items.
1005
- * @return {?}
1114
+ * @return {THIS}
1006
1115
  */
1007
1116
  function (origin) {
1008
- this._origin = origin;
1009
- return this;
1117
+ (/** @type {?} */ (this))._origin = origin;
1118
+ return (/** @type {?} */ (this));
1010
1119
  };
1011
1120
  /**
1012
1121
  * @param {?} item
@@ -1027,8 +1136,11 @@ FocusKeyManager = /** @class */ (function (_super) {
1027
1136
 
1028
1137
  /**
1029
1138
  * @fileoverview added by tsickle
1030
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1139
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1031
1140
  */
1141
+ // The InteractivityChecker leans heavily on the ally.js accessibility utilities.
1142
+ // Methods like `isTabbable` are only covering specific edge-cases for the browsers which are
1143
+ // supported.
1032
1144
  /**
1033
1145
  * Utility for checking the interactivity of an element, such as whether is is focusable or
1034
1146
  * tabbable.
@@ -1217,7 +1329,7 @@ var InteractivityChecker = /** @class */ (function () {
1217
1329
  */
1218
1330
  function getFrameElement(window) {
1219
1331
  try {
1220
- return /** @type {?} */ (window.frameElement);
1332
+ return (/** @type {?} */ (window.frameElement));
1221
1333
  }
1222
1334
  catch (_a) {
1223
1335
  return null;
@@ -1306,6 +1418,7 @@ function getTabIndexValue(element) {
1306
1418
  if (!hasValidTabIndex(element)) {
1307
1419
  return null;
1308
1420
  }
1421
+ // See browser issue in Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054
1309
1422
  /** @type {?} */
1310
1423
  var tabIndex = parseInt(element.getAttribute('tabindex') || '', 10);
1311
1424
  return isNaN(tabIndex) ? -1 : tabIndex;
@@ -1319,7 +1432,7 @@ function isPotentiallyTabbableIOS(element) {
1319
1432
  /** @type {?} */
1320
1433
  var nodeName = element.nodeName.toLowerCase();
1321
1434
  /** @type {?} */
1322
- var inputType = nodeName === 'input' && (/** @type {?} */ (element)).type;
1435
+ var inputType = nodeName === 'input' && ((/** @type {?} */ (element))).type;
1323
1436
  return inputType === 'text'
1324
1437
  || inputType === 'password'
1325
1438
  || nodeName === 'select'
@@ -1353,7 +1466,7 @@ function getWindow(node) {
1353
1466
 
1354
1467
  /**
1355
1468
  * @fileoverview added by tsickle
1356
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1469
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1357
1470
  */
1358
1471
  /**
1359
1472
  * Class that allows for trapping focus within a DOM element.
@@ -1372,11 +1485,15 @@ var /**
1372
1485
  FocusTrap = /** @class */ (function () {
1373
1486
  function FocusTrap(_element, _checker, _ngZone, _document, deferAnchors) {
1374
1487
  if (deferAnchors === void 0) { deferAnchors = false; }
1488
+ var _this = this;
1375
1489
  this._element = _element;
1376
1490
  this._checker = _checker;
1377
1491
  this._ngZone = _ngZone;
1378
1492
  this._document = _document;
1379
1493
  this._hasAttached = false;
1494
+ // Event listeners for the anchors. Need to be regular functions so that we can unbind them later.
1495
+ this._startAnchorListener = function () { return _this.focusLastTabbableElement(); };
1496
+ this._endAnchorListener = function () { return _this.focusFirstTabbableElement(); };
1380
1497
  this._enabled = true;
1381
1498
  if (!deferAnchors) {
1382
1499
  this.attachAnchors();
@@ -1413,11 +1530,21 @@ FocusTrap = /** @class */ (function () {
1413
1530
  * @return {?}
1414
1531
  */
1415
1532
  function () {
1416
- if (this._startAnchor && this._startAnchor.parentNode) {
1417
- this._startAnchor.parentNode.removeChild(this._startAnchor);
1533
+ /** @type {?} */
1534
+ var startAnchor = this._startAnchor;
1535
+ /** @type {?} */
1536
+ var endAnchor = this._endAnchor;
1537
+ if (startAnchor) {
1538
+ startAnchor.removeEventListener('focus', this._startAnchorListener);
1539
+ if (startAnchor.parentNode) {
1540
+ startAnchor.parentNode.removeChild(startAnchor);
1541
+ }
1418
1542
  }
1419
- if (this._endAnchor && this._endAnchor.parentNode) {
1420
- this._endAnchor.parentNode.removeChild(this._endAnchor);
1543
+ if (endAnchor) {
1544
+ endAnchor.removeEventListener('focus', this._endAnchorListener);
1545
+ if (endAnchor.parentNode) {
1546
+ endAnchor.parentNode.removeChild(endAnchor);
1547
+ }
1421
1548
  }
1422
1549
  this._startAnchor = this._endAnchor = null;
1423
1550
  };
@@ -1447,17 +1574,17 @@ FocusTrap = /** @class */ (function () {
1447
1574
  }
1448
1575
  this._ngZone.runOutsideAngular(function () {
1449
1576
  if (!_this._startAnchor) {
1450
- _this._startAnchor = _this._createAnchor(); /** @type {?} */
1451
- ((_this._startAnchor)).addEventListener('focus', function () { return _this.focusLastTabbableElement(); });
1577
+ _this._startAnchor = _this._createAnchor();
1578
+ (/** @type {?} */ (_this._startAnchor)).addEventListener('focus', _this._startAnchorListener);
1452
1579
  }
1453
1580
  if (!_this._endAnchor) {
1454
- _this._endAnchor = _this._createAnchor(); /** @type {?} */
1455
- ((_this._endAnchor)).addEventListener('focus', function () { return _this.focusFirstTabbableElement(); });
1581
+ _this._endAnchor = _this._createAnchor();
1582
+ (/** @type {?} */ (_this._endAnchor)).addEventListener('focus', _this._endAnchorListener);
1456
1583
  }
1457
1584
  });
1458
1585
  if (this._element.parentNode) {
1459
- this._element.parentNode.insertBefore(/** @type {?} */ ((this._startAnchor)), this._element);
1460
- this._element.parentNode.insertBefore(/** @type {?} */ ((this._endAnchor)), this._element.nextSibling);
1586
+ this._element.parentNode.insertBefore((/** @type {?} */ (this._startAnchor)), this._element);
1587
+ this._element.parentNode.insertBefore((/** @type {?} */ (this._endAnchor)), this._element.nextSibling);
1461
1588
  this._hasAttached = true;
1462
1589
  }
1463
1590
  return this._hasAttached;
@@ -1536,19 +1663,27 @@ FocusTrap = /** @class */ (function () {
1536
1663
  };
1537
1664
  /**
1538
1665
  * Get the specified boundary element of the trapped region.
1666
+ * @param bound The boundary to get (start or end of trapped region).
1667
+ * @returns The boundary element.
1668
+ */
1669
+ /**
1670
+ * Get the specified boundary element of the trapped region.
1671
+ * @private
1539
1672
  * @param {?} bound The boundary to get (start or end of trapped region).
1540
1673
  * @return {?} The boundary element.
1541
1674
  */
1542
1675
  FocusTrap.prototype._getRegionBoundary = /**
1543
1676
  * Get the specified boundary element of the trapped region.
1677
+ * @private
1544
1678
  * @param {?} bound The boundary to get (start or end of trapped region).
1545
1679
  * @return {?} The boundary element.
1546
1680
  */
1547
1681
  function (bound) {
1682
+ // Contains the deprecated version of selector, for temporary backwards comparability.
1548
1683
  /** @type {?} */
1549
- var markers = /** @type {?} */ (this._element.querySelectorAll("[cdk-focus-region-" + bound + "], " +
1684
+ var markers = (/** @type {?} */ (this._element.querySelectorAll("[cdk-focus-region-" + bound + "], " +
1550
1685
  ("[cdkFocusRegion" + bound + "], ") +
1551
- ("[cdk-focus-" + bound + "]")));
1686
+ ("[cdk-focus-" + bound + "]"))));
1552
1687
  for (var i = 0; i < markers.length; i++) {
1553
1688
  // @breaking-change 8.0.0
1554
1689
  if (markers[i].hasAttribute("cdk-focus-" + bound)) {
@@ -1581,9 +1716,10 @@ FocusTrap = /** @class */ (function () {
1581
1716
  * @return {?} Whether focus was moved successfuly.
1582
1717
  */
1583
1718
  function () {
1719
+ // Contains the deprecated version of selector, for temporary backwards comparability.
1584
1720
  /** @type {?} */
1585
- var redirectToElement = /** @type {?} */ (this._element.querySelector("[cdk-focus-initial], " +
1586
- "[cdkFocusInitial]"));
1721
+ var redirectToElement = (/** @type {?} */ (this._element.querySelector("[cdk-focus-initial], " +
1722
+ "[cdkFocusInitial]")));
1587
1723
  if (redirectToElement) {
1588
1724
  // @breaking-change 8.0.0
1589
1725
  if (redirectToElement.hasAttribute("cdk-focus-initial")) {
@@ -1655,13 +1791,16 @@ FocusTrap = /** @class */ (function () {
1655
1791
  function () {
1656
1792
  return this._hasAttached;
1657
1793
  };
1794
+ /** Get the first tabbable element from a DOM subtree (inclusive). */
1658
1795
  /**
1659
1796
  * Get the first tabbable element from a DOM subtree (inclusive).
1797
+ * @private
1660
1798
  * @param {?} root
1661
1799
  * @return {?}
1662
1800
  */
1663
1801
  FocusTrap.prototype._getFirstTabbableElement = /**
1664
1802
  * Get the first tabbable element from a DOM subtree (inclusive).
1803
+ * @private
1665
1804
  * @param {?} root
1666
1805
  * @return {?}
1667
1806
  */
@@ -1669,12 +1808,14 @@ FocusTrap = /** @class */ (function () {
1669
1808
  if (this._checker.isFocusable(root) && this._checker.isTabbable(root)) {
1670
1809
  return root;
1671
1810
  }
1811
+ // Iterate in DOM order. Note that IE doesn't have `children` for SVG so we fall
1812
+ // back to `childNodes` which includes text nodes, comments etc.
1672
1813
  /** @type {?} */
1673
1814
  var children = root.children || root.childNodes;
1674
1815
  for (var i = 0; i < children.length; i++) {
1675
1816
  /** @type {?} */
1676
1817
  var tabbableChild = children[i].nodeType === this._document.ELEMENT_NODE ?
1677
- this._getFirstTabbableElement(/** @type {?} */ (children[i])) :
1818
+ this._getFirstTabbableElement((/** @type {?} */ (children[i]))) :
1678
1819
  null;
1679
1820
  if (tabbableChild) {
1680
1821
  return tabbableChild;
@@ -1682,13 +1823,16 @@ FocusTrap = /** @class */ (function () {
1682
1823
  }
1683
1824
  return null;
1684
1825
  };
1826
+ /** Get the last tabbable element from a DOM subtree (inclusive). */
1685
1827
  /**
1686
1828
  * Get the last tabbable element from a DOM subtree (inclusive).
1829
+ * @private
1687
1830
  * @param {?} root
1688
1831
  * @return {?}
1689
1832
  */
1690
1833
  FocusTrap.prototype._getLastTabbableElement = /**
1691
1834
  * Get the last tabbable element from a DOM subtree (inclusive).
1835
+ * @private
1692
1836
  * @param {?} root
1693
1837
  * @return {?}
1694
1838
  */
@@ -1696,12 +1840,13 @@ FocusTrap = /** @class */ (function () {
1696
1840
  if (this._checker.isFocusable(root) && this._checker.isTabbable(root)) {
1697
1841
  return root;
1698
1842
  }
1843
+ // Iterate in reverse DOM order.
1699
1844
  /** @type {?} */
1700
1845
  var children = root.children || root.childNodes;
1701
1846
  for (var i = children.length - 1; i >= 0; i--) {
1702
1847
  /** @type {?} */
1703
1848
  var tabbableChild = children[i].nodeType === this._document.ELEMENT_NODE ?
1704
- this._getLastTabbableElement(/** @type {?} */ (children[i])) :
1849
+ this._getLastTabbableElement((/** @type {?} */ (children[i]))) :
1705
1850
  null;
1706
1851
  if (tabbableChild) {
1707
1852
  return tabbableChild;
@@ -1709,12 +1854,15 @@ FocusTrap = /** @class */ (function () {
1709
1854
  }
1710
1855
  return null;
1711
1856
  };
1857
+ /** Creates an anchor element. */
1712
1858
  /**
1713
1859
  * Creates an anchor element.
1860
+ * @private
1714
1861
  * @return {?}
1715
1862
  */
1716
1863
  FocusTrap.prototype._createAnchor = /**
1717
1864
  * Creates an anchor element.
1865
+ * @private
1718
1866
  * @return {?}
1719
1867
  */
1720
1868
  function () {
@@ -1727,12 +1875,19 @@ FocusTrap = /** @class */ (function () {
1727
1875
  };
1728
1876
  /**
1729
1877
  * Toggles the `tabindex` of an anchor, based on the enabled state of the focus trap.
1878
+ * @param isEnabled Whether the focus trap is enabled.
1879
+ * @param anchor Anchor on which to toggle the tabindex.
1880
+ */
1881
+ /**
1882
+ * Toggles the `tabindex` of an anchor, based on the enabled state of the focus trap.
1883
+ * @private
1730
1884
  * @param {?} isEnabled Whether the focus trap is enabled.
1731
1885
  * @param {?} anchor Anchor on which to toggle the tabindex.
1732
1886
  * @return {?}
1733
1887
  */
1734
1888
  FocusTrap.prototype._toggleAnchorTabIndex = /**
1735
1889
  * Toggles the `tabindex` of an anchor, based on the enabled state of the focus trap.
1890
+ * @private
1736
1891
  * @param {?} isEnabled Whether the focus trap is enabled.
1737
1892
  * @param {?} anchor Anchor on which to toggle the tabindex.
1738
1893
  * @return {?}
@@ -1742,13 +1897,16 @@ FocusTrap = /** @class */ (function () {
1742
1897
  // element has a tabindex, the user might still hit it when navigating with the arrow keys.
1743
1898
  isEnabled ? anchor.setAttribute('tabindex', '0') : anchor.removeAttribute('tabindex');
1744
1899
  };
1900
+ /** Executes a function when the zone is stable. */
1745
1901
  /**
1746
1902
  * Executes a function when the zone is stable.
1903
+ * @private
1747
1904
  * @param {?} fn
1748
1905
  * @return {?}
1749
1906
  */
1750
1907
  FocusTrap.prototype._executeOnStable = /**
1751
1908
  * Executes a function when the zone is stable.
1909
+ * @private
1752
1910
  * @param {?} fn
1753
1911
  * @return {?}
1754
1912
  */
@@ -1880,7 +2038,7 @@ var CdkTrapFocus = /** @class */ (function () {
1880
2038
  function () {
1881
2039
  this.focusTrap.attachAnchors();
1882
2040
  if (this.autoCapture) {
1883
- this._previouslyFocusedElement = /** @type {?} */ (this._document.activeElement);
2041
+ this._previouslyFocusedElement = (/** @type {?} */ (this._document.activeElement));
1884
2042
  this.focusTrap.focusInitialElementWhenReady();
1885
2043
  }
1886
2044
  };
@@ -1916,8 +2074,10 @@ var CdkTrapFocus = /** @class */ (function () {
1916
2074
 
1917
2075
  /**
1918
2076
  * @fileoverview added by tsickle
1919
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2077
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1920
2078
  */
2079
+ // The token for the live announcer element is defined in a separate file from LiveAnnouncer
2080
+ // as a workaround for https://github.com/angular/angular/issues/22559
1921
2081
  /** @type {?} */
1922
2082
  var LIVE_ANNOUNCER_ELEMENT_TOKEN = new core.InjectionToken('liveAnnouncerElement', {
1923
2083
  providedIn: 'root',
@@ -1933,7 +2093,7 @@ function LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY() {
1933
2093
 
1934
2094
  /**
1935
2095
  * @fileoverview added by tsickle
1936
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2096
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1937
2097
  */
1938
2098
  var LiveAnnouncer = /** @class */ (function () {
1939
2099
  function LiveAnnouncer(elementToken, _ngZone, _document) {
@@ -1945,29 +2105,35 @@ var LiveAnnouncer = /** @class */ (function () {
1945
2105
  this._liveElement = elementToken || this._createLiveElement();
1946
2106
  }
1947
2107
  /**
1948
- * Announces a message to screenreaders.
1949
- * @param message Message to be announced to the screenreader
1950
- * @param politeness The politeness of the announcer element
1951
- * @returns Promise that will be resolved when the message is added to the DOM.
1952
- */
1953
- /**
1954
- * Announces a message to screenreaders.
1955
- * @param {?} message Message to be announced to the screenreader
1956
- * @param {?=} politeness The politeness of the announcer element
1957
- * @return {?} Promise that will be resolved when the message is added to the DOM.
2108
+ * @param {?} message
2109
+ * @param {...?} args
2110
+ * @return {?}
1958
2111
  */
1959
2112
  LiveAnnouncer.prototype.announce = /**
1960
- * Announces a message to screenreaders.
1961
- * @param {?} message Message to be announced to the screenreader
1962
- * @param {?=} politeness The politeness of the announcer element
1963
- * @return {?} Promise that will be resolved when the message is added to the DOM.
2113
+ * @param {?} message
2114
+ * @param {...?} args
2115
+ * @return {?}
1964
2116
  */
1965
- function (message, politeness) {
2117
+ function (message) {
1966
2118
  var _this = this;
1967
- if (politeness === void 0) { politeness = 'polite'; }
1968
- this._liveElement.textContent = '';
2119
+ var args = [];
2120
+ for (var _i = 1; _i < arguments.length; _i++) {
2121
+ args[_i - 1] = arguments[_i];
2122
+ }
2123
+ /** @type {?} */
2124
+ var politeness;
2125
+ /** @type {?} */
2126
+ var duration;
2127
+ if (args.length === 1 && typeof args[0] === 'number') {
2128
+ duration = args[0];
2129
+ }
2130
+ else {
2131
+ politeness = args[0], duration = args[1];
2132
+ }
2133
+ this.clear();
2134
+ clearTimeout(this._previousTimeout);
1969
2135
  // TODO: ensure changing the politeness works on all environments we support.
1970
- this._liveElement.setAttribute('aria-live', politeness);
2136
+ this._liveElement.setAttribute('aria-live', (/** @type {?} */ (politeness)) || 'polite');
1971
2137
  // This 100ms timeout is necessary for some browser + screen-reader combinations:
1972
2138
  // - Both JAWS and NVDA over IE11 will not announce anything without a non-zero timeout.
1973
2139
  // - With Chrome and IE11 with NVDA or JAWS, a repeated (identical) message won't be read a
@@ -1979,10 +2145,35 @@ var LiveAnnouncer = /** @class */ (function () {
1979
2145
  _this._previousTimeout = setTimeout(function () {
1980
2146
  _this._liveElement.textContent = message;
1981
2147
  resolve();
2148
+ if (typeof duration === 'number') {
2149
+ _this._previousTimeout = setTimeout(function () { return _this.clear(); }, duration);
2150
+ }
1982
2151
  }, 100);
1983
2152
  });
1984
2153
  });
1985
2154
  };
2155
+ /**
2156
+ * Clears the current text from the announcer element. Can be used to prevent
2157
+ * screen readers from reading the text out again while the user is going
2158
+ * through the page landmarks.
2159
+ */
2160
+ /**
2161
+ * Clears the current text from the announcer element. Can be used to prevent
2162
+ * screen readers from reading the text out again while the user is going
2163
+ * through the page landmarks.
2164
+ * @return {?}
2165
+ */
2166
+ LiveAnnouncer.prototype.clear = /**
2167
+ * Clears the current text from the announcer element. Can be used to prevent
2168
+ * screen readers from reading the text out again while the user is going
2169
+ * through the page landmarks.
2170
+ * @return {?}
2171
+ */
2172
+ function () {
2173
+ if (this._liveElement) {
2174
+ this._liveElement.textContent = '';
2175
+ }
2176
+ };
1986
2177
  /**
1987
2178
  * @return {?}
1988
2179
  */
@@ -1993,13 +2184,15 @@ var LiveAnnouncer = /** @class */ (function () {
1993
2184
  clearTimeout(this._previousTimeout);
1994
2185
  if (this._liveElement && this._liveElement.parentNode) {
1995
2186
  this._liveElement.parentNode.removeChild(this._liveElement);
1996
- this._liveElement = /** @type {?} */ ((null));
2187
+ this._liveElement = (/** @type {?} */ (null));
1997
2188
  }
1998
2189
  };
1999
2190
  /**
2191
+ * @private
2000
2192
  * @return {?}
2001
2193
  */
2002
2194
  LiveAnnouncer.prototype._createLiveElement = /**
2195
+ * @private
2003
2196
  * @return {?}
2004
2197
  */
2005
2198
  function () {
@@ -2011,7 +2204,7 @@ var LiveAnnouncer = /** @class */ (function () {
2011
2204
  var liveEl = this._document.createElement('div');
2012
2205
  // Remove any old containers. This can happen when coming in from a server-side-rendered page.
2013
2206
  for (var i = 0; i < previousElements.length; i++) {
2014
- /** @type {?} */ ((previousElements[i].parentNode)).removeChild(previousElements[i]);
2207
+ (/** @type {?} */ (previousElements[i].parentNode)).removeChild(previousElements[i]);
2015
2208
  }
2016
2209
  liveEl.classList.add(elementClass);
2017
2210
  liveEl.classList.add('cdk-visually-hidden');
@@ -2069,6 +2262,7 @@ var CdkAriaLive = /** @class */ (function () {
2069
2262
  return _this._contentObserver
2070
2263
  .observe(_this._elementRef)
2071
2264
  .subscribe(function () {
2265
+ // Note that we use textContent here, rather than innerText, in order to avoid a reflow.
2072
2266
  /** @type {?} */
2073
2267
  var elementText = _this._elementRef.nativeElement.textContent;
2074
2268
  // The `MutationObserver` fires also for attribute
@@ -2115,18 +2309,19 @@ var CdkAriaLive = /** @class */ (function () {
2115
2309
  }());
2116
2310
  /**
2117
2311
  * \@docs-private \@deprecated \@breaking-change 8.0.0
2118
- * @param {?} parentDispatcher
2312
+ * @param {?} parentAnnouncer
2119
2313
  * @param {?} liveElement
2120
2314
  * @param {?} _document
2121
2315
  * @param {?} ngZone
2122
2316
  * @return {?}
2123
2317
  */
2124
- function LIVE_ANNOUNCER_PROVIDER_FACTORY(parentDispatcher, liveElement, _document, ngZone) {
2125
- return parentDispatcher || new LiveAnnouncer(liveElement, _document, ngZone);
2318
+ function LIVE_ANNOUNCER_PROVIDER_FACTORY(parentAnnouncer, liveElement, _document, ngZone) {
2319
+ return parentAnnouncer || new LiveAnnouncer(liveElement, ngZone, _document);
2126
2320
  }
2127
- /** *
2321
+ /**
2128
2322
  * \@docs-private \@deprecated \@breaking-change 8.0.0
2129
- @type {?} */
2323
+ * @type {?}
2324
+ */
2130
2325
  var LIVE_ANNOUNCER_PROVIDER = {
2131
2326
  // If there is already a LiveAnnouncer available, use that. Otherwise, provide a new one.
2132
2327
  provide: LiveAnnouncer,
@@ -2141,15 +2336,27 @@ var LIVE_ANNOUNCER_PROVIDER = {
2141
2336
 
2142
2337
  /**
2143
2338
  * @fileoverview added by tsickle
2144
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2339
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2145
2340
  */
2341
+ // This is the value used by AngularJS Material. Through trial and error (on iPhone 6S) they found
2342
+ // that a value of around 650ms seems appropriate.
2146
2343
  /** @type {?} */
2147
2344
  var TOUCH_BUFFER_MS = 650;
2345
+ /**
2346
+ * Event listener options that enable capturing and also
2347
+ * mark the the listener as passive if the browser supports it.
2348
+ * @type {?}
2349
+ */
2350
+ var captureEventListenerOptions = platform.normalizePassiveListenerOptions({
2351
+ passive: true,
2352
+ capture: true
2353
+ });
2148
2354
  /**
2149
2355
  * Monitors mouse and keyboard events to determine the cause of focus events.
2150
2356
  */
2151
2357
  var FocusMonitor = /** @class */ (function () {
2152
2358
  function FocusMonitor(_ngZone, _platform) {
2359
+ var _this = this;
2153
2360
  this._ngZone = _ngZone;
2154
2361
  this._platform = _platform;
2155
2362
  /**
@@ -2164,14 +2371,54 @@ var FocusMonitor = /** @class */ (function () {
2164
2371
  * Map of elements being monitored to their info.
2165
2372
  */
2166
2373
  this._elementInfo = new Map();
2167
- /**
2168
- * A map of global objects to lists of current listeners.
2169
- */
2170
- this._unregisterGlobalListeners = function () { };
2171
2374
  /**
2172
2375
  * The number of elements currently being monitored.
2173
2376
  */
2174
2377
  this._monitoredElementCount = 0;
2378
+ /**
2379
+ * Event listener for `keydown` events on the document.
2380
+ * Needs to be an arrow function in order to preserve the context when it gets bound.
2381
+ */
2382
+ this._documentKeydownListener = function () {
2383
+ // On keydown record the origin and clear any touch event that may be in progress.
2384
+ _this._lastTouchTarget = null;
2385
+ _this._setOriginForCurrentEventQueue('keyboard');
2386
+ };
2387
+ /**
2388
+ * Event listener for `mousedown` events on the document.
2389
+ * Needs to be an arrow function in order to preserve the context when it gets bound.
2390
+ */
2391
+ this._documentMousedownListener = function () {
2392
+ // On mousedown record the origin only if there is not touch
2393
+ // target, since a mousedown can happen as a result of a touch event.
2394
+ if (!_this._lastTouchTarget) {
2395
+ _this._setOriginForCurrentEventQueue('mouse');
2396
+ }
2397
+ };
2398
+ /**
2399
+ * Event listener for `touchstart` events on the document.
2400
+ * Needs to be an arrow function in order to preserve the context when it gets bound.
2401
+ */
2402
+ this._documentTouchstartListener = function (event) {
2403
+ // When the touchstart event fires the focus event is not yet in the event queue. This means
2404
+ // we can't rely on the trick used above (setting timeout of 1ms). Instead we wait 650ms to
2405
+ // see if a focus happens.
2406
+ if (_this._touchTimeoutId != null) {
2407
+ clearTimeout(_this._touchTimeoutId);
2408
+ }
2409
+ _this._lastTouchTarget = event.target;
2410
+ _this._touchTimeoutId = setTimeout(function () { return _this._lastTouchTarget = null; }, TOUCH_BUFFER_MS);
2411
+ };
2412
+ /**
2413
+ * Event listener for `focus` events on the window.
2414
+ * Needs to be an arrow function in order to preserve the context when it gets bound.
2415
+ */
2416
+ this._windowFocusListener = function () {
2417
+ // Make a note of when the window regains focus, so we can
2418
+ // restore the origin info for the focused element.
2419
+ _this._windowFocused = true;
2420
+ _this._windowFocusTimeoutId = setTimeout(function () { return _this._windowFocused = false; });
2421
+ };
2175
2422
  }
2176
2423
  /**
2177
2424
  * @param {?} element
@@ -2191,14 +2438,15 @@ var FocusMonitor = /** @class */ (function () {
2191
2438
  return rxjs.of(null);
2192
2439
  }
2193
2440
  /** @type {?} */
2194
- var nativeElement = this._getNativeElement(element);
2441
+ var nativeElement = coercion.coerceElement(element);
2195
2442
  // Check if we're already monitoring this element.
2196
2443
  if (this._elementInfo.has(nativeElement)) {
2197
2444
  /** @type {?} */
2198
- var cachedInfo = this._elementInfo.get(nativeElement); /** @type {?} */
2199
- ((cachedInfo)).checkChildren = checkChildren;
2200
- return /** @type {?} */ ((cachedInfo)).subject.asObservable();
2445
+ var cachedInfo = this._elementInfo.get(nativeElement);
2446
+ (/** @type {?} */ (cachedInfo)).checkChildren = checkChildren;
2447
+ return (/** @type {?} */ (cachedInfo)).subject.asObservable();
2201
2448
  }
2449
+ // Create monitored element info.
2202
2450
  /** @type {?} */
2203
2451
  var info = {
2204
2452
  unlisten: function () { },
@@ -2207,6 +2455,7 @@ var FocusMonitor = /** @class */ (function () {
2207
2455
  };
2208
2456
  this._elementInfo.set(nativeElement, info);
2209
2457
  this._incrementMonitoredElementCount();
2458
+ // Start listening. We need to listen in capture phase since focus events don't bubble.
2210
2459
  /** @type {?} */
2211
2460
  var focusListener = function (event) { return _this._onFocus(event, nativeElement); };
2212
2461
  /** @type {?} */
@@ -2232,7 +2481,7 @@ var FocusMonitor = /** @class */ (function () {
2232
2481
  */
2233
2482
  function (element) {
2234
2483
  /** @type {?} */
2235
- var nativeElement = this._getNativeElement(element);
2484
+ var nativeElement = coercion.coerceElement(element);
2236
2485
  /** @type {?} */
2237
2486
  var elementInfo = this._elementInfo.get(nativeElement);
2238
2487
  if (elementInfo) {
@@ -2257,12 +2506,12 @@ var FocusMonitor = /** @class */ (function () {
2257
2506
  */
2258
2507
  function (element, origin, options) {
2259
2508
  /** @type {?} */
2260
- var nativeElement = this._getNativeElement(element);
2509
+ var nativeElement = coercion.coerceElement(element);
2261
2510
  this._setOriginForCurrentEventQueue(origin);
2262
2511
  // `focus` isn't available on the server
2263
2512
  if (typeof nativeElement.focus === 'function') {
2264
2513
  // Cast the element to `any`, because the TS typings don't have the `options` parameter yet.
2265
- (/** @type {?} */ (nativeElement)).focus(options);
2514
+ ((/** @type {?} */ (nativeElement))).focus(options);
2266
2515
  }
2267
2516
  };
2268
2517
  /**
@@ -2276,74 +2525,14 @@ var FocusMonitor = /** @class */ (function () {
2276
2525
  this._elementInfo.forEach(function (_info, element) { return _this.stopMonitoring(element); });
2277
2526
  };
2278
2527
  /**
2279
- * Register necessary event listeners on the document and window.
2280
- * @return {?}
2281
- */
2282
- FocusMonitor.prototype._registerGlobalListeners = /**
2283
- * Register necessary event listeners on the document and window.
2284
- * @return {?}
2285
- */
2286
- function () {
2287
- var _this = this;
2288
- // Do nothing if we're not on the browser platform.
2289
- if (!this._platform.isBrowser) {
2290
- return;
2291
- }
2292
- /** @type {?} */
2293
- var documentKeydownListener = function () {
2294
- _this._lastTouchTarget = null;
2295
- _this._setOriginForCurrentEventQueue('keyboard');
2296
- };
2297
- /** @type {?} */
2298
- var documentMousedownListener = function () {
2299
- if (!_this._lastTouchTarget) {
2300
- _this._setOriginForCurrentEventQueue('mouse');
2301
- }
2302
- };
2303
- /** @type {?} */
2304
- var documentTouchstartListener = function (event) {
2305
- if (_this._touchTimeoutId != null) {
2306
- clearTimeout(_this._touchTimeoutId);
2307
- }
2308
- _this._lastTouchTarget = event.target;
2309
- _this._touchTimeoutId = setTimeout(function () { return _this._lastTouchTarget = null; }, TOUCH_BUFFER_MS);
2310
- };
2311
- /** @type {?} */
2312
- var windowFocusListener = function () {
2313
- _this._windowFocused = true;
2314
- _this._windowFocusTimeoutId = setTimeout(function () { return _this._windowFocused = false; });
2315
- };
2316
- /** @type {?} */
2317
- var captureEventListenerOptions = platform.normalizePassiveListenerOptions({
2318
- passive: true,
2319
- capture: true
2320
- });
2321
- // Note: we listen to events in the capture phase so we can detect them even if the user stops
2322
- // propagation.
2323
- this._ngZone.runOutsideAngular(function () {
2324
- document.addEventListener('keydown', documentKeydownListener, captureEventListenerOptions);
2325
- document.addEventListener('mousedown', documentMousedownListener, captureEventListenerOptions);
2326
- document.addEventListener('touchstart', documentTouchstartListener, captureEventListenerOptions);
2327
- window.addEventListener('focus', windowFocusListener);
2328
- });
2329
- this._unregisterGlobalListeners = function () {
2330
- document.removeEventListener('keydown', documentKeydownListener, captureEventListenerOptions);
2331
- document.removeEventListener('mousedown', documentMousedownListener, captureEventListenerOptions);
2332
- document.removeEventListener('touchstart', documentTouchstartListener, captureEventListenerOptions);
2333
- window.removeEventListener('focus', windowFocusListener);
2334
- // Clear timeouts for all potentially pending timeouts to prevent the leaks.
2335
- clearTimeout(_this._windowFocusTimeoutId);
2336
- clearTimeout(_this._touchTimeoutId);
2337
- clearTimeout(_this._originTimeoutId);
2338
- };
2339
- };
2340
- /**
2528
+ * @private
2341
2529
  * @param {?} element
2342
2530
  * @param {?} className
2343
2531
  * @param {?} shouldSet
2344
2532
  * @return {?}
2345
2533
  */
2346
2534
  FocusMonitor.prototype._toggleClass = /**
2535
+ * @private
2347
2536
  * @param {?} element
2348
2537
  * @param {?} className
2349
2538
  * @param {?} shouldSet
@@ -2359,12 +2548,19 @@ var FocusMonitor = /** @class */ (function () {
2359
2548
  };
2360
2549
  /**
2361
2550
  * Sets the focus classes on the element based on the given focus origin.
2551
+ * @param element The element to update the classes on.
2552
+ * @param origin The focus origin.
2553
+ */
2554
+ /**
2555
+ * Sets the focus classes on the element based on the given focus origin.
2556
+ * @private
2362
2557
  * @param {?} element The element to update the classes on.
2363
2558
  * @param {?=} origin The focus origin.
2364
2559
  * @return {?}
2365
2560
  */
2366
2561
  FocusMonitor.prototype._setClasses = /**
2367
2562
  * Sets the focus classes on the element based on the given focus origin.
2563
+ * @private
2368
2564
  * @param {?} element The element to update the classes on.
2369
2565
  * @param {?=} origin The focus origin.
2370
2566
  * @return {?}
@@ -2382,11 +2578,17 @@ var FocusMonitor = /** @class */ (function () {
2382
2578
  };
2383
2579
  /**
2384
2580
  * Sets the origin and schedules an async function to clear it at the end of the event queue.
2581
+ * @param origin The origin to set.
2582
+ */
2583
+ /**
2584
+ * Sets the origin and schedules an async function to clear it at the end of the event queue.
2585
+ * @private
2385
2586
  * @param {?} origin The origin to set.
2386
2587
  * @return {?}
2387
2588
  */
2388
2589
  FocusMonitor.prototype._setOriginForCurrentEventQueue = /**
2389
2590
  * Sets the origin and schedules an async function to clear it at the end of the event queue.
2591
+ * @private
2390
2592
  * @param {?} origin The origin to set.
2391
2593
  * @return {?}
2392
2594
  */
@@ -2402,15 +2604,39 @@ var FocusMonitor = /** @class */ (function () {
2402
2604
  };
2403
2605
  /**
2404
2606
  * Checks whether the given focus event was caused by a touchstart event.
2607
+ * @param event The focus event to check.
2608
+ * @returns Whether the event was caused by a touch.
2609
+ */
2610
+ /**
2611
+ * Checks whether the given focus event was caused by a touchstart event.
2612
+ * @private
2405
2613
  * @param {?} event The focus event to check.
2406
2614
  * @return {?} Whether the event was caused by a touch.
2407
2615
  */
2408
2616
  FocusMonitor.prototype._wasCausedByTouch = /**
2409
2617
  * Checks whether the given focus event was caused by a touchstart event.
2618
+ * @private
2410
2619
  * @param {?} event The focus event to check.
2411
2620
  * @return {?} Whether the event was caused by a touch.
2412
2621
  */
2413
2622
  function (event) {
2623
+ // Note(mmalerba): This implementation is not quite perfect, there is a small edge case.
2624
+ // Consider the following dom structure:
2625
+ //
2626
+ // <div #parent tabindex="0" cdkFocusClasses>
2627
+ // <div #child (click)="#parent.focus()"></div>
2628
+ // </div>
2629
+ //
2630
+ // If the user touches the #child element and the #parent is programmatically focused as a
2631
+ // result, this code will still consider it to have been caused by the touch event and will
2632
+ // apply the cdk-touch-focused class rather than the cdk-program-focused class. This is a
2633
+ // relatively small edge-case that can be worked around by using
2634
+ // focusVia(parentEl, 'program') to focus the parent element.
2635
+ //
2636
+ // If we decide that we absolutely must handle this case correctly, we can do so by listening
2637
+ // for the first focus event after the touchstart, and then the first blur event after that
2638
+ // focus event. When that blur event fires we know that whatever follows is not a result of the
2639
+ // touchstart.
2414
2640
  /** @type {?} */
2415
2641
  var focusTarget = event.target;
2416
2642
  return this._lastTouchTarget instanceof Node && focusTarget instanceof Node &&
@@ -2418,22 +2644,45 @@ var FocusMonitor = /** @class */ (function () {
2418
2644
  };
2419
2645
  /**
2420
2646
  * Handles focus events on a registered element.
2647
+ * @param event The focus event.
2648
+ * @param element The monitored element.
2649
+ */
2650
+ /**
2651
+ * Handles focus events on a registered element.
2652
+ * @private
2421
2653
  * @param {?} event The focus event.
2422
2654
  * @param {?} element The monitored element.
2423
2655
  * @return {?}
2424
2656
  */
2425
2657
  FocusMonitor.prototype._onFocus = /**
2426
2658
  * Handles focus events on a registered element.
2659
+ * @private
2427
2660
  * @param {?} event The focus event.
2428
2661
  * @param {?} element The monitored element.
2429
2662
  * @return {?}
2430
2663
  */
2431
2664
  function (event, element) {
2665
+ // NOTE(mmalerba): We currently set the classes based on the focus origin of the most recent
2666
+ // focus event affecting the monitored element. If we want to use the origin of the first event
2667
+ // instead we should check for the cdk-focused class here and return if the element already has
2668
+ // it. (This only matters for elements that have includesChildren = true).
2669
+ // NOTE(mmalerba): We currently set the classes based on the focus origin of the most recent
2670
+ // focus event affecting the monitored element. If we want to use the origin of the first event
2671
+ // instead we should check for the cdk-focused class here and return if the element already has
2672
+ // it. (This only matters for elements that have includesChildren = true).
2673
+ // If we are not counting child-element-focus as focused, make sure that the event target is the
2674
+ // monitored element itself.
2432
2675
  /** @type {?} */
2433
2676
  var elementInfo = this._elementInfo.get(element);
2434
2677
  if (!elementInfo || (!elementInfo.checkChildren && element !== event.target)) {
2435
2678
  return;
2436
2679
  }
2680
+ // If we couldn't detect a cause for the focus event, it's due to one of three reasons:
2681
+ // 1) The window has just regained focus, in which case we want to restore the focused state of
2682
+ // the element from before the window blurred.
2683
+ // 2) It was caused by a touch event, in which case we mark the origin as 'touch'.
2684
+ // 3) The element was programmatically focused, in which case we should mark the origin as
2685
+ // 'program'.
2437
2686
  /** @type {?} */
2438
2687
  var origin = this._origin;
2439
2688
  if (!origin) {
@@ -2469,6 +2718,8 @@ var FocusMonitor = /** @class */ (function () {
2469
2718
  * @return {?}
2470
2719
  */
2471
2720
  function (event, element) {
2721
+ // If we are counting child-element-focus as focused, make sure that we aren't just blurring in
2722
+ // order to focus another child of the monitored element.
2472
2723
  /** @type {?} */
2473
2724
  var elementInfo = this._elementInfo.get(element);
2474
2725
  if (!elementInfo || (elementInfo.checkChildren && event.relatedTarget instanceof Node &&
@@ -2479,11 +2730,13 @@ var FocusMonitor = /** @class */ (function () {
2479
2730
  this._emitOrigin(elementInfo.subject, null);
2480
2731
  };
2481
2732
  /**
2733
+ * @private
2482
2734
  * @param {?} subject
2483
2735
  * @param {?} origin
2484
2736
  * @return {?}
2485
2737
  */
2486
2738
  FocusMonitor.prototype._emitOrigin = /**
2739
+ * @private
2487
2740
  * @param {?} subject
2488
2741
  * @param {?} origin
2489
2742
  * @return {?}
@@ -2492,41 +2745,48 @@ var FocusMonitor = /** @class */ (function () {
2492
2745
  this._ngZone.run(function () { return subject.next(origin); });
2493
2746
  };
2494
2747
  /**
2748
+ * @private
2495
2749
  * @return {?}
2496
2750
  */
2497
2751
  FocusMonitor.prototype._incrementMonitoredElementCount = /**
2752
+ * @private
2498
2753
  * @return {?}
2499
2754
  */
2500
2755
  function () {
2756
+ var _this = this;
2501
2757
  // Register global listeners when first element is monitored.
2502
- if (++this._monitoredElementCount == 1) {
2503
- this._registerGlobalListeners();
2758
+ if (++this._monitoredElementCount == 1 && this._platform.isBrowser) {
2759
+ // Note: we listen to events in the capture phase so we
2760
+ // can detect them even if the user stops propagation.
2761
+ this._ngZone.runOutsideAngular(function () {
2762
+ document.addEventListener('keydown', _this._documentKeydownListener, captureEventListenerOptions);
2763
+ document.addEventListener('mousedown', _this._documentMousedownListener, captureEventListenerOptions);
2764
+ document.addEventListener('touchstart', _this._documentTouchstartListener, captureEventListenerOptions);
2765
+ window.addEventListener('focus', _this._windowFocusListener);
2766
+ });
2504
2767
  }
2505
2768
  };
2506
2769
  /**
2770
+ * @private
2507
2771
  * @return {?}
2508
2772
  */
2509
2773
  FocusMonitor.prototype._decrementMonitoredElementCount = /**
2774
+ * @private
2510
2775
  * @return {?}
2511
2776
  */
2512
2777
  function () {
2513
2778
  // Unregister global listeners when last element is unmonitored.
2514
2779
  if (!--this._monitoredElementCount) {
2515
- this._unregisterGlobalListeners();
2516
- this._unregisterGlobalListeners = function () { };
2780
+ document.removeEventListener('keydown', this._documentKeydownListener, captureEventListenerOptions);
2781
+ document.removeEventListener('mousedown', this._documentMousedownListener, captureEventListenerOptions);
2782
+ document.removeEventListener('touchstart', this._documentTouchstartListener, captureEventListenerOptions);
2783
+ window.removeEventListener('focus', this._windowFocusListener);
2784
+ // Clear timeouts for all potentially pending timeouts to prevent the leaks.
2785
+ clearTimeout(this._windowFocusTimeoutId);
2786
+ clearTimeout(this._touchTimeoutId);
2787
+ clearTimeout(this._originTimeoutId);
2517
2788
  }
2518
2789
  };
2519
- /**
2520
- * @param {?} element
2521
- * @return {?}
2522
- */
2523
- FocusMonitor.prototype._getNativeElement = /**
2524
- * @param {?} element
2525
- * @return {?}
2526
- */
2527
- function (element) {
2528
- return element instanceof core.ElementRef ? element.nativeElement : element;
2529
- };
2530
2790
  FocusMonitor.decorators = [
2531
2791
  { type: core.Injectable, args: [{ providedIn: 'root' },] },
2532
2792
  ];
@@ -2591,9 +2851,10 @@ var CdkMonitorFocus = /** @class */ (function () {
2591
2851
  function FOCUS_MONITOR_PROVIDER_FACTORY(parentDispatcher, ngZone, platform$$1) {
2592
2852
  return parentDispatcher || new FocusMonitor(ngZone, platform$$1);
2593
2853
  }
2594
- /** *
2854
+ /**
2595
2855
  * \@docs-private \@deprecated \@breaking-change 8.0.0
2596
- @type {?} */
2856
+ * @type {?}
2857
+ */
2597
2858
  var FOCUS_MONITOR_PROVIDER = {
2598
2859
  // If there is already a FocusMonitor available, use that. Otherwise, provide a new one.
2599
2860
  provide: FocusMonitor,
@@ -2603,7 +2864,7 @@ var FOCUS_MONITOR_PROVIDER = {
2603
2864
 
2604
2865
  /**
2605
2866
  * @fileoverview added by tsickle
2606
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2867
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2607
2868
  */
2608
2869
 
2609
2870
  /**
@@ -2621,7 +2882,7 @@ function isFakeMousedownFromScreenReader(event) {
2621
2882
 
2622
2883
  /**
2623
2884
  * @fileoverview added by tsickle
2624
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2885
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2625
2886
  */
2626
2887
  var A11yModule = /** @class */ (function () {
2627
2888
  function A11yModule() {