@kato-lee/cdk 14.2.7

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 (374) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +8 -0
  3. package/_index.scss +8 -0
  4. package/a11y/_index.import.scss +2 -0
  5. package/a11y/_index.scss +102 -0
  6. package/a11y/index.d.ts +1212 -0
  7. package/a11y-prebuilt.css +1 -0
  8. package/accordion/index.d.ts +140 -0
  9. package/bidi/index.d.ts +80 -0
  10. package/clipboard/index.d.ts +115 -0
  11. package/coercion/index.d.ts +67 -0
  12. package/collections/index.d.ts +374 -0
  13. package/dialog/index.d.ts +469 -0
  14. package/drag-drop/index.d.ts +1614 -0
  15. package/esm2020/a11y/a11y-module.mjs +32 -0
  16. package/esm2020/a11y/a11y_public_index.mjs +5 -0
  17. package/esm2020/a11y/aria-describer/aria-describer.mjs +232 -0
  18. package/esm2020/a11y/aria-describer/aria-reference.mjs +44 -0
  19. package/esm2020/a11y/fake-event-detection.mjs +31 -0
  20. package/esm2020/a11y/focus-monitor/focus-monitor.mjs +451 -0
  21. package/esm2020/a11y/focus-trap/configurable-focus-trap-config.mjs +9 -0
  22. package/esm2020/a11y/focus-trap/configurable-focus-trap-factory.mjs +53 -0
  23. package/esm2020/a11y/focus-trap/configurable-focus-trap.mjs +51 -0
  24. package/esm2020/a11y/focus-trap/event-listener-inert-strategy.mjs +61 -0
  25. package/esm2020/a11y/focus-trap/focus-trap-inert-strategy.mjs +11 -0
  26. package/esm2020/a11y/focus-trap/focus-trap-manager.mjs +53 -0
  27. package/esm2020/a11y/focus-trap/focus-trap.mjs +402 -0
  28. package/esm2020/a11y/high-contrast-mode/high-contrast-mode-detector.mjs +109 -0
  29. package/esm2020/a11y/index.mjs +9 -0
  30. package/esm2020/a11y/input-modality/input-modality-detector.mjs +176 -0
  31. package/esm2020/a11y/interactivity-checker/interactivity-checker.mjs +238 -0
  32. package/esm2020/a11y/key-manager/activedescendant-key-manager.mjs +20 -0
  33. package/esm2020/a11y/key-manager/focus-key-manager.mjs +29 -0
  34. package/esm2020/a11y/key-manager/list-key-manager.mjs +321 -0
  35. package/esm2020/a11y/live-announcer/live-announcer-tokens.mjs +19 -0
  36. package/esm2020/a11y/live-announcer/live-announcer.mjs +178 -0
  37. package/esm2020/a11y/public-api.mjs +26 -0
  38. package/esm2020/accordion/accordion-item.mjs +167 -0
  39. package/esm2020/accordion/accordion-module.mjs +24 -0
  40. package/esm2020/accordion/accordion.mjs +70 -0
  41. package/esm2020/accordion/accordion_public_index.mjs +5 -0
  42. package/esm2020/accordion/index.mjs +9 -0
  43. package/esm2020/accordion/public-api.mjs +11 -0
  44. package/esm2020/bidi/bidi-module.mjs +23 -0
  45. package/esm2020/bidi/bidi_public_index.mjs +5 -0
  46. package/esm2020/bidi/dir-document-token.mjs +33 -0
  47. package/esm2020/bidi/dir.mjs +69 -0
  48. package/esm2020/bidi/directionality.mjs +52 -0
  49. package/esm2020/bidi/index.mjs +9 -0
  50. package/esm2020/bidi/public-api.mjs +12 -0
  51. package/esm2020/clipboard/clipboard-module.mjs +23 -0
  52. package/esm2020/clipboard/clipboard.mjs +53 -0
  53. package/esm2020/clipboard/clipboard_public_index.mjs +5 -0
  54. package/esm2020/clipboard/copy-to-clipboard.mjs +99 -0
  55. package/esm2020/clipboard/index.mjs +9 -0
  56. package/esm2020/clipboard/pending-copy.mjs +69 -0
  57. package/esm2020/clipboard/public-api.mjs +12 -0
  58. package/esm2020/coercion/array.mjs +11 -0
  59. package/esm2020/coercion/boolean-property.mjs +12 -0
  60. package/esm2020/coercion/css-pixel-value.mjs +15 -0
  61. package/esm2020/coercion/element.mjs +16 -0
  62. package/esm2020/coercion/index.mjs +9 -0
  63. package/esm2020/coercion/number-property.mjs +21 -0
  64. package/esm2020/coercion/public-api.mjs +14 -0
  65. package/esm2020/coercion/string-array.mjs +38 -0
  66. package/esm2020/collections/array-data-source.mjs +21 -0
  67. package/esm2020/collections/collection-viewer.mjs +9 -0
  68. package/esm2020/collections/collections_public_index.mjs +5 -0
  69. package/esm2020/collections/data-source.mjs +19 -0
  70. package/esm2020/collections/dispose-view-repeater-strategy.mjs +47 -0
  71. package/esm2020/collections/index.mjs +9 -0
  72. package/esm2020/collections/public-api.mjs +17 -0
  73. package/esm2020/collections/recycle-view-repeater-strategy.mjs +128 -0
  74. package/esm2020/collections/selection-model.mjs +216 -0
  75. package/esm2020/collections/tree-adapter.mjs +9 -0
  76. package/esm2020/collections/unique-selection-dispatcher.mjs +55 -0
  77. package/esm2020/collections/view-repeater.mjs +14 -0
  78. package/esm2020/dialog/dialog-config.mjs +63 -0
  79. package/esm2020/dialog/dialog-container.mjs +278 -0
  80. package/esm2020/dialog/dialog-injectors.mjs +26 -0
  81. package/esm2020/dialog/dialog-module.mjs +42 -0
  82. package/esm2020/dialog/dialog-ref.mjs +76 -0
  83. package/esm2020/dialog/dialog.mjs +301 -0
  84. package/esm2020/dialog/dialog_public_index.mjs +5 -0
  85. package/esm2020/dialog/index.mjs +9 -0
  86. package/esm2020/dialog/public-api.mjs +14 -0
  87. package/esm2020/drag-drop/directives/assertions.mjs +18 -0
  88. package/esm2020/drag-drop/directives/config.mjs +14 -0
  89. package/esm2020/drag-drop/directives/drag-handle.mjs +66 -0
  90. package/esm2020/drag-drop/directives/drag-placeholder.mjs +36 -0
  91. package/esm2020/drag-drop/directives/drag-preview.mjs +47 -0
  92. package/esm2020/drag-drop/directives/drag.mjs +487 -0
  93. package/esm2020/drag-drop/directives/drop-list-group.mjs +53 -0
  94. package/esm2020/drag-drop/directives/drop-list.mjs +345 -0
  95. package/esm2020/drag-drop/dom/client-rect.mjs +64 -0
  96. package/esm2020/drag-drop/dom/clone-node.mjs +65 -0
  97. package/esm2020/drag-drop/dom/parent-position-tracker.mjs +76 -0
  98. package/esm2020/drag-drop/dom/styling.mjs +69 -0
  99. package/esm2020/drag-drop/dom/transition-duration.mjs +36 -0
  100. package/esm2020/drag-drop/drag-drop-module.mjs +57 -0
  101. package/esm2020/drag-drop/drag-drop-registry.mjs +231 -0
  102. package/esm2020/drag-drop/drag-drop.mjs +57 -0
  103. package/esm2020/drag-drop/drag-drop_public_index.mjs +5 -0
  104. package/esm2020/drag-drop/drag-events.mjs +9 -0
  105. package/esm2020/drag-drop/drag-parent.mjs +16 -0
  106. package/esm2020/drag-drop/drag-ref.mjs +1146 -0
  107. package/esm2020/drag-drop/drag-utils.mjs +60 -0
  108. package/esm2020/drag-drop/drop-list-ref.mjs +577 -0
  109. package/esm2020/drag-drop/index.mjs +9 -0
  110. package/esm2020/drag-drop/public-api.mjs +23 -0
  111. package/esm2020/drag-drop/sorting/drop-list-sort-strategy.mjs +9 -0
  112. package/esm2020/drag-drop/sorting/single-axis-sort-strategy.mjs +341 -0
  113. package/esm2020/index.mjs +9 -0
  114. package/esm2020/keycodes/index.mjs +9 -0
  115. package/esm2020/keycodes/keycodes.mjs +127 -0
  116. package/esm2020/keycodes/keycodes_public_index.mjs +5 -0
  117. package/esm2020/keycodes/modifiers.mjs +18 -0
  118. package/esm2020/keycodes/public-api.mjs +10 -0
  119. package/esm2020/layout/breakpoints-observer.mjs +105 -0
  120. package/esm2020/layout/breakpoints.mjs +29 -0
  121. package/esm2020/layout/index.mjs +9 -0
  122. package/esm2020/layout/layout-module.mjs +19 -0
  123. package/esm2020/layout/layout_public_index.mjs +5 -0
  124. package/esm2020/layout/media-matcher.mjs +85 -0
  125. package/esm2020/layout/public-api.mjs +12 -0
  126. package/esm2020/listbox/index.mjs +9 -0
  127. package/esm2020/listbox/listbox-module.mjs +24 -0
  128. package/esm2020/listbox/listbox.mjs +872 -0
  129. package/esm2020/listbox/listbox_public_index.mjs +5 -0
  130. package/esm2020/listbox/public-api.mjs +10 -0
  131. package/esm2020/menu/context-menu-trigger.mjs +212 -0
  132. package/esm2020/menu/index.mjs +9 -0
  133. package/esm2020/menu/menu-aim.mjs +203 -0
  134. package/esm2020/menu/menu-bar.mjs +133 -0
  135. package/esm2020/menu/menu-base.mjs +187 -0
  136. package/esm2020/menu/menu-errors.mjs +22 -0
  137. package/esm2020/menu/menu-group.mjs +30 -0
  138. package/esm2020/menu/menu-interface.mjs +11 -0
  139. package/esm2020/menu/menu-item-checkbox.mjs +49 -0
  140. package/esm2020/menu/menu-item-radio.mjs +71 -0
  141. package/esm2020/menu/menu-item-selectable.mjs +42 -0
  142. package/esm2020/menu/menu-item.mjs +267 -0
  143. package/esm2020/menu/menu-module.mjs +62 -0
  144. package/esm2020/menu/menu-stack.mjs +156 -0
  145. package/esm2020/menu/menu-trigger-base.mjs +107 -0
  146. package/esm2020/menu/menu-trigger.mjs +291 -0
  147. package/esm2020/menu/menu.mjs +134 -0
  148. package/esm2020/menu/menu_public_index.mjs +5 -0
  149. package/esm2020/menu/pointer-focus-tracker.mjs +51 -0
  150. package/esm2020/menu/public-api.mjs +24 -0
  151. package/esm2020/observers/index.mjs +9 -0
  152. package/esm2020/observers/observe-content.mjs +187 -0
  153. package/esm2020/observers/observers_public_index.mjs +5 -0
  154. package/esm2020/observers/public-api.mjs +9 -0
  155. package/esm2020/overlay/dispatchers/base-overlay-dispatcher.mjs +52 -0
  156. package/esm2020/overlay/dispatchers/index.mjs +10 -0
  157. package/esm2020/overlay/dispatchers/overlay-keyboard-dispatcher.mjs +81 -0
  158. package/esm2020/overlay/dispatchers/overlay-outside-click-dispatcher.mjs +138 -0
  159. package/esm2020/overlay/fullscreen-overlay-container.mjs +94 -0
  160. package/esm2020/overlay/index.mjs +9 -0
  161. package/esm2020/overlay/overlay-config.mjs +45 -0
  162. package/esm2020/overlay/overlay-container.mjs +81 -0
  163. package/esm2020/overlay/overlay-directives.mjs +427 -0
  164. package/esm2020/overlay/overlay-module.mjs +29 -0
  165. package/esm2020/overlay/overlay-ref.mjs +427 -0
  166. package/esm2020/overlay/overlay-reference.mjs +9 -0
  167. package/esm2020/overlay/overlay.mjs +125 -0
  168. package/esm2020/overlay/overlay_public_index.mjs +5 -0
  169. package/esm2020/overlay/position/connected-position.mjs +88 -0
  170. package/esm2020/overlay/position/flexible-connected-position-strategy.mjs +985 -0
  171. package/esm2020/overlay/position/global-position-strategy.mjs +237 -0
  172. package/esm2020/overlay/position/overlay-position-builder.mjs +50 -0
  173. package/esm2020/overlay/position/position-strategy.mjs +9 -0
  174. package/esm2020/overlay/position/scroll-clip.mjs +40 -0
  175. package/esm2020/overlay/public-api.mjs +22 -0
  176. package/esm2020/overlay/scroll/block-scroll-strategy.mjs +80 -0
  177. package/esm2020/overlay/scroll/close-scroll-strategy.mjs +61 -0
  178. package/esm2020/overlay/scroll/index.mjs +14 -0
  179. package/esm2020/overlay/scroll/noop-scroll-strategy.mjs +17 -0
  180. package/esm2020/overlay/scroll/reposition-scroll-strategy.mjs +61 -0
  181. package/esm2020/overlay/scroll/scroll-strategy-options.mjs +55 -0
  182. package/esm2020/overlay/scroll/scroll-strategy.mjs +14 -0
  183. package/esm2020/platform/features/input-types.mjs +59 -0
  184. package/esm2020/platform/features/passive-listeners.mjs +36 -0
  185. package/esm2020/platform/features/scrolling.mjs +85 -0
  186. package/esm2020/platform/features/shadow-dom.mjs +54 -0
  187. package/esm2020/platform/features/test-environment.mjs +24 -0
  188. package/esm2020/platform/index.mjs +9 -0
  189. package/esm2020/platform/platform-module.mjs +19 -0
  190. package/esm2020/platform/platform.mjs +85 -0
  191. package/esm2020/platform/platform_public_index.mjs +5 -0
  192. package/esm2020/platform/public-api.mjs +15 -0
  193. package/esm2020/portal/dom-portal-outlet.mjs +158 -0
  194. package/esm2020/portal/index.mjs +9 -0
  195. package/esm2020/portal/portal-directives.mjs +246 -0
  196. package/esm2020/portal/portal-errors.mjs +51 -0
  197. package/esm2020/portal/portal-injector.mjs +28 -0
  198. package/esm2020/portal/portal.mjs +188 -0
  199. package/esm2020/portal/portal_public_index.mjs +5 -0
  200. package/esm2020/portal/public-api.mjs +12 -0
  201. package/esm2020/public-api.mjs +9 -0
  202. package/esm2020/scrolling/fixed-size-virtual-scroll.mjs +217 -0
  203. package/esm2020/scrolling/index.mjs +9 -0
  204. package/esm2020/scrolling/public-api.mjs +20 -0
  205. package/esm2020/scrolling/scroll-dispatcher.mjs +163 -0
  206. package/esm2020/scrolling/scrollable.mjs +176 -0
  207. package/esm2020/scrolling/scrolling-module.mjs +67 -0
  208. package/esm2020/scrolling/scrolling_public_index.mjs +5 -0
  209. package/esm2020/scrolling/viewport-ruler.mjs +146 -0
  210. package/esm2020/scrolling/virtual-for-of.mjs +298 -0
  211. package/esm2020/scrolling/virtual-scroll-repeater.mjs +9 -0
  212. package/esm2020/scrolling/virtual-scroll-strategy.mjs +11 -0
  213. package/esm2020/scrolling/virtual-scroll-viewport.mjs +437 -0
  214. package/esm2020/scrolling/virtual-scrollable-element.mjs +41 -0
  215. package/esm2020/scrolling/virtual-scrollable-window.mjs +40 -0
  216. package/esm2020/scrolling/virtual-scrollable.mjs +40 -0
  217. package/esm2020/stepper/index.mjs +9 -0
  218. package/esm2020/stepper/public-api.mjs +13 -0
  219. package/esm2020/stepper/step-header.mjs +30 -0
  220. package/esm2020/stepper/step-label.mjs +23 -0
  221. package/esm2020/stepper/stepper-button.mjs +56 -0
  222. package/esm2020/stepper/stepper-module.mjs +40 -0
  223. package/esm2020/stepper/stepper.mjs +458 -0
  224. package/esm2020/stepper/stepper_public_index.mjs +5 -0
  225. package/esm2020/table/can-stick.mjs +44 -0
  226. package/esm2020/table/cell.mjs +217 -0
  227. package/esm2020/table/coalesced-style-scheduler.mjs +91 -0
  228. package/esm2020/table/index.mjs +9 -0
  229. package/esm2020/table/public-api.mjs +20 -0
  230. package/esm2020/table/row.mjs +262 -0
  231. package/esm2020/table/sticky-position-listener.mjs +11 -0
  232. package/esm2020/table/sticky-styler.mjs +345 -0
  233. package/esm2020/table/table-errors.mjs +67 -0
  234. package/esm2020/table/table-module.mjs +94 -0
  235. package/esm2020/table/table.mjs +1065 -0
  236. package/esm2020/table/table_public_index.mjs +5 -0
  237. package/esm2020/table/text-column.mjs +153 -0
  238. package/esm2020/table/tokens.mjs +16 -0
  239. package/esm2020/text-field/autofill.mjs +113 -0
  240. package/esm2020/text-field/autosize.mjs +309 -0
  241. package/esm2020/text-field/index.mjs +9 -0
  242. package/esm2020/text-field/public-api.mjs +11 -0
  243. package/esm2020/text-field/text-field-module.mjs +24 -0
  244. package/esm2020/text-field/text-field_public_index.mjs +5 -0
  245. package/esm2020/tree/control/base-tree-control.mjs +57 -0
  246. package/esm2020/tree/control/flat-tree-control.mjs +51 -0
  247. package/esm2020/tree/control/nested-tree-control.mjs +58 -0
  248. package/esm2020/tree/control/tree-control.mjs +2 -0
  249. package/esm2020/tree/index.mjs +9 -0
  250. package/esm2020/tree/nested-node.mjs +112 -0
  251. package/esm2020/tree/node.mjs +35 -0
  252. package/esm2020/tree/outlet.mjs +39 -0
  253. package/esm2020/tree/padding.mjs +131 -0
  254. package/esm2020/tree/public-api.mjs +20 -0
  255. package/esm2020/tree/toggle.mjs +50 -0
  256. package/esm2020/tree/tree-errors.mjs +43 -0
  257. package/esm2020/tree/tree-module.mjs +49 -0
  258. package/esm2020/tree/tree.mjs +347 -0
  259. package/esm2020/tree/tree_public_index.mjs +5 -0
  260. package/esm2020/version.mjs +11 -0
  261. package/fesm2015/a11y.mjs +2473 -0
  262. package/fesm2015/a11y.mjs.map +1 -0
  263. package/fesm2015/accordion.mjs +414 -0
  264. package/fesm2015/accordion.mjs.map +1 -0
  265. package/fesm2015/bidi.mjs +194 -0
  266. package/fesm2015/bidi.mjs.map +1 -0
  267. package/fesm2015/cdk.mjs +30 -0
  268. package/fesm2015/cdk.mjs.map +1 -0
  269. package/fesm2015/clipboard.mjs +263 -0
  270. package/fesm2015/clipboard.mjs.map +1 -0
  271. package/fesm2015/coercion.mjs +132 -0
  272. package/fesm2015/coercion.mjs.map +1 -0
  273. package/fesm2015/collections.mjs +519 -0
  274. package/fesm2015/collections.mjs.map +1 -0
  275. package/fesm2015/dialog.mjs +1050 -0
  276. package/fesm2015/dialog.mjs.map +1 -0
  277. package/fesm2015/drag-drop.mjs +3812 -0
  278. package/fesm2015/drag-drop.mjs.map +1 -0
  279. package/fesm2015/keycodes.mjs +167 -0
  280. package/fesm2015/keycodes.mjs.map +1 -0
  281. package/fesm2015/layout.mjs +337 -0
  282. package/fesm2015/layout.mjs.map +1 -0
  283. package/fesm2015/listbox.mjs +1200 -0
  284. package/fesm2015/listbox.mjs.map +1 -0
  285. package/fesm2015/menu.mjs +2719 -0
  286. package/fesm2015/menu.mjs.map +1 -0
  287. package/fesm2015/observers.mjs +326 -0
  288. package/fesm2015/observers.mjs.map +1 -0
  289. package/fesm2015/overlay.mjs +3137 -0
  290. package/fesm2015/overlay.mjs.map +1 -0
  291. package/fesm2015/platform.mjs +385 -0
  292. package/fesm2015/platform.mjs.map +1 -0
  293. package/fesm2015/portal.mjs +691 -0
  294. package/fesm2015/portal.mjs.map +1 -0
  295. package/fesm2015/scrolling.mjs +1558 -0
  296. package/fesm2015/scrolling.mjs.map +1 -0
  297. package/fesm2015/stepper.mjs +989 -0
  298. package/fesm2015/stepper.mjs.map +1 -0
  299. package/fesm2015/table.mjs +2356 -0
  300. package/fesm2015/table.mjs.map +1 -0
  301. package/fesm2015/testing.mjs +833 -0
  302. package/fesm2015/testing.mjs.map +1 -0
  303. package/fesm2015/text-field.mjs +461 -0
  304. package/fesm2015/text-field.mjs.map +1 -0
  305. package/fesm2015/tree.mjs +1303 -0
  306. package/fesm2015/tree.mjs.map +1 -0
  307. package/fesm2020/a11y.mjs +2476 -0
  308. package/fesm2020/a11y.mjs.map +1 -0
  309. package/fesm2020/accordion.mjs +414 -0
  310. package/fesm2020/accordion.mjs.map +1 -0
  311. package/fesm2020/bidi.mjs +192 -0
  312. package/fesm2020/bidi.mjs.map +1 -0
  313. package/fesm2020/cdk.mjs +30 -0
  314. package/fesm2020/cdk.mjs.map +1 -0
  315. package/fesm2020/clipboard.mjs +259 -0
  316. package/fesm2020/clipboard.mjs.map +1 -0
  317. package/fesm2020/coercion.mjs +132 -0
  318. package/fesm2020/coercion.mjs.map +1 -0
  319. package/fesm2020/collections.mjs +535 -0
  320. package/fesm2020/collections.mjs.map +1 -0
  321. package/fesm2020/dialog.mjs +787 -0
  322. package/fesm2020/dialog.mjs.map +1 -0
  323. package/fesm2020/drag-drop.mjs +3808 -0
  324. package/fesm2020/drag-drop.mjs.map +1 -0
  325. package/fesm2020/keycodes.mjs +167 -0
  326. package/fesm2020/keycodes.mjs.map +1 -0
  327. package/fesm2020/layout.mjs +337 -0
  328. package/fesm2020/layout.mjs.map +1 -0
  329. package/fesm2020/listbox.mjs +1164 -0
  330. package/fesm2020/listbox.mjs.map +1 -0
  331. package/fesm2020/menu.mjs +2615 -0
  332. package/fesm2020/menu.mjs.map +1 -0
  333. package/fesm2020/observers.mjs +325 -0
  334. package/fesm2020/observers.mjs.map +1 -0
  335. package/fesm2020/overlay.mjs +3145 -0
  336. package/fesm2020/overlay.mjs.map +1 -0
  337. package/fesm2020/platform.mjs +383 -0
  338. package/fesm2020/platform.mjs.map +1 -0
  339. package/fesm2020/portal.mjs +689 -0
  340. package/fesm2020/portal.mjs.map +1 -0
  341. package/fesm2020/scrolling.mjs +1591 -0
  342. package/fesm2020/scrolling.mjs.map +1 -0
  343. package/fesm2020/stepper.mjs +985 -0
  344. package/fesm2020/stepper.mjs.map +1 -0
  345. package/fesm2020/table.mjs +2348 -0
  346. package/fesm2020/table.mjs.map +1 -0
  347. package/fesm2020/testing.mjs +797 -0
  348. package/fesm2020/testing.mjs.map +1 -0
  349. package/fesm2020/text-field.mjs +459 -0
  350. package/fesm2020/text-field.mjs.map +1 -0
  351. package/fesm2020/tree.mjs +1305 -0
  352. package/fesm2020/tree.mjs.map +1 -0
  353. package/index.d.ts +6 -0
  354. package/keycodes/index.d.ts +249 -0
  355. package/layout/index.d.ts +90 -0
  356. package/listbox/index.d.ts +419 -0
  357. package/menu/index.d.ts +1013 -0
  358. package/observers/index.d.ts +109 -0
  359. package/overlay/_index-deprecated.scss +13 -0
  360. package/overlay/_index.import.scss +13 -0
  361. package/overlay/_index.scss +152 -0
  362. package/overlay/index.d.ts +1343 -0
  363. package/overlay-prebuilt.css +1 -0
  364. package/package.json +232 -0
  365. package/platform/index.d.ts +106 -0
  366. package/portal/index.d.ts +328 -0
  367. package/scrolling/index.d.ts +849 -0
  368. package/stepper/index.d.ts +419 -0
  369. package/table/index.d.ts +1483 -0
  370. package/text-field/_index.import.scss +2 -0
  371. package/text-field/_index.scss +89 -0
  372. package/text-field/index.d.ts +203 -0
  373. package/text-field-prebuilt.css +1 -0
  374. package/tree/index.d.ts +593 -0
@@ -0,0 +1,833 @@
1
+ import { __awaiter } from 'tslib';
2
+ import { BehaviorSubject } from 'rxjs';
3
+
4
+ /** Subject used to dispatch and listen for changes to the auto change detection status . */
5
+ const autoChangeDetectionSubject = new BehaviorSubject({
6
+ isDisabled: false,
7
+ });
8
+ /** The current subscription to `autoChangeDetectionSubject`. */
9
+ let autoChangeDetectionSubscription;
10
+ /**
11
+ * The default handler for auto change detection status changes. This handler will be used if the
12
+ * specific environment does not install its own.
13
+ * @param status The new auto change detection status.
14
+ */
15
+ function defaultAutoChangeDetectionHandler(status) {
16
+ var _a;
17
+ (_a = status.onDetectChangesNow) === null || _a === void 0 ? void 0 : _a.call(status);
18
+ }
19
+ /**
20
+ * Allows a test `HarnessEnvironment` to install its own handler for auto change detection status
21
+ * changes.
22
+ * @param handler The handler for the auto change detection status.
23
+ */
24
+ function handleAutoChangeDetectionStatus(handler) {
25
+ stopHandlingAutoChangeDetectionStatus();
26
+ autoChangeDetectionSubscription = autoChangeDetectionSubject.subscribe(handler);
27
+ }
28
+ /** Allows a `HarnessEnvironment` to stop handling auto change detection status changes. */
29
+ function stopHandlingAutoChangeDetectionStatus() {
30
+ autoChangeDetectionSubscription === null || autoChangeDetectionSubscription === void 0
31
+ ? void 0
32
+ : autoChangeDetectionSubscription.unsubscribe();
33
+ autoChangeDetectionSubscription = null;
34
+ }
35
+ /**
36
+ * Batches together triggering of change detection over the duration of the given function.
37
+ * @param fn The function to call with batched change detection.
38
+ * @param triggerBeforeAndAfter Optionally trigger change detection once before and after the batch
39
+ * operation. If false, change detection will not be triggered.
40
+ * @return The result of the given function.
41
+ */
42
+ function batchChangeDetection(fn, triggerBeforeAndAfter) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ // If change detection batching is already in progress, just run the function.
45
+ if (autoChangeDetectionSubject.getValue().isDisabled) {
46
+ return yield fn();
47
+ }
48
+ // If nothing is handling change detection batching, install the default handler.
49
+ if (!autoChangeDetectionSubscription) {
50
+ handleAutoChangeDetectionStatus(defaultAutoChangeDetectionHandler);
51
+ }
52
+ if (triggerBeforeAndAfter) {
53
+ yield new Promise(resolve =>
54
+ autoChangeDetectionSubject.next({
55
+ isDisabled: true,
56
+ onDetectChangesNow: resolve,
57
+ })
58
+ );
59
+ // The function passed in may throw (e.g. if the user wants to make an expectation of an error
60
+ // being thrown. If this happens, we need to make sure we still re-enable change detection, so
61
+ // we wrap it in a `finally` block.
62
+ try {
63
+ return yield fn();
64
+ } finally {
65
+ yield new Promise(resolve =>
66
+ autoChangeDetectionSubject.next({
67
+ isDisabled: false,
68
+ onDetectChangesNow: resolve,
69
+ })
70
+ );
71
+ }
72
+ } else {
73
+ autoChangeDetectionSubject.next({ isDisabled: true });
74
+ // The function passed in may throw (e.g. if the user wants to make an expectation of an error
75
+ // being thrown. If this happens, we need to make sure we still re-enable change detection, so
76
+ // we wrap it in a `finally` block.
77
+ try {
78
+ return yield fn();
79
+ } finally {
80
+ autoChangeDetectionSubject.next({ isDisabled: false });
81
+ }
82
+ }
83
+ });
84
+ }
85
+ /**
86
+ * Disables the harness system's auto change detection for the duration of the given function.
87
+ * @param fn The function to disable auto change detection for.
88
+ * @return The result of the given function.
89
+ */
90
+ function manualChangeDetection(fn) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ return batchChangeDetection(fn, false);
93
+ });
94
+ }
95
+ /**
96
+ * Resolves the given list of async values in parallel (i.e. via Promise.all) while batching change
97
+ * detection over the entire operation such that change detection occurs exactly once before
98
+ * resolving the values and once after.
99
+ * @param values A getter for the async values to resolve in parallel with batched change detection.
100
+ * @return The resolved values.
101
+ */
102
+ function parallel(values) {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ return batchChangeDetection(() => Promise.all(values()), true);
105
+ });
106
+ }
107
+
108
+ /**
109
+ * Base class for component harnesses that all component harness authors should extend. This base
110
+ * component harness provides the basic ability to locate element and sub-component harness. It
111
+ * should be inherited when defining user's own harness.
112
+ */
113
+ class ComponentHarness {
114
+ constructor(locatorFactory) {
115
+ this.locatorFactory = locatorFactory;
116
+ }
117
+ /** Gets a `Promise` for the `TestElement` representing the host element of the component. */
118
+ host() {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ return this.locatorFactory.rootElement;
121
+ });
122
+ }
123
+ /**
124
+ * Gets a `LocatorFactory` for the document root element. This factory can be used to create
125
+ * locators for elements that a component creates outside of its own root element. (e.g. by
126
+ * appending to document.body).
127
+ */
128
+ documentRootLocatorFactory() {
129
+ return this.locatorFactory.documentRootLocatorFactory();
130
+ }
131
+ /**
132
+ * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance
133
+ * or element under the host element of this `ComponentHarness`.
134
+ * @param queries A list of queries specifying which harnesses and elements to search for:
135
+ * - A `string` searches for elements matching the CSS selector specified by the string.
136
+ * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the
137
+ * given class.
138
+ * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given
139
+ * predicate.
140
+ * @return An asynchronous locator function that searches for and returns a `Promise` for the
141
+ * first element or harness matching the given search criteria. Matches are ordered first by
142
+ * order in the DOM, and second by order in the queries list. If no matches are found, the
143
+ * `Promise` rejects. The type that the `Promise` resolves to is a union of all result types for
144
+ * each query.
145
+ *
146
+ * e.g. Given the following DOM: `<div id="d1" /><div id="d2" />`, and assuming
147
+ * `DivHarness.hostSelector === 'div'`:
148
+ * - `await ch.locatorFor(DivHarness, 'div')()` gets a `DivHarness` instance for `#d1`
149
+ * - `await ch.locatorFor('div', DivHarness)()` gets a `TestElement` instance for `#d1`
150
+ * - `await ch.locatorFor('span')()` throws because the `Promise` rejects.
151
+ */
152
+ locatorFor(...queries) {
153
+ return this.locatorFactory.locatorFor(...queries);
154
+ }
155
+ /**
156
+ * Creates an asynchronous locator function that can be used to find a `ComponentHarness` instance
157
+ * or element under the host element of this `ComponentHarness`.
158
+ * @param queries A list of queries specifying which harnesses and elements to search for:
159
+ * - A `string` searches for elements matching the CSS selector specified by the string.
160
+ * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the
161
+ * given class.
162
+ * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given
163
+ * predicate.
164
+ * @return An asynchronous locator function that searches for and returns a `Promise` for the
165
+ * first element or harness matching the given search criteria. Matches are ordered first by
166
+ * order in the DOM, and second by order in the queries list. If no matches are found, the
167
+ * `Promise` is resolved with `null`. The type that the `Promise` resolves to is a union of all
168
+ * result types for each query or null.
169
+ *
170
+ * e.g. Given the following DOM: `<div id="d1" /><div id="d2" />`, and assuming
171
+ * `DivHarness.hostSelector === 'div'`:
172
+ * - `await ch.locatorForOptional(DivHarness, 'div')()` gets a `DivHarness` instance for `#d1`
173
+ * - `await ch.locatorForOptional('div', DivHarness)()` gets a `TestElement` instance for `#d1`
174
+ * - `await ch.locatorForOptional('span')()` gets `null`.
175
+ */
176
+ locatorForOptional(...queries) {
177
+ return this.locatorFactory.locatorForOptional(...queries);
178
+ }
179
+ /**
180
+ * Creates an asynchronous locator function that can be used to find `ComponentHarness` instances
181
+ * or elements under the host element of this `ComponentHarness`.
182
+ * @param queries A list of queries specifying which harnesses and elements to search for:
183
+ * - A `string` searches for elements matching the CSS selector specified by the string.
184
+ * - A `ComponentHarness` constructor searches for `ComponentHarness` instances matching the
185
+ * given class.
186
+ * - A `HarnessPredicate` searches for `ComponentHarness` instances matching the given
187
+ * predicate.
188
+ * @return An asynchronous locator function that searches for and returns a `Promise` for all
189
+ * elements and harnesses matching the given search criteria. Matches are ordered first by
190
+ * order in the DOM, and second by order in the queries list. If an element matches more than
191
+ * one `ComponentHarness` class, the locator gets an instance of each for the same element. If
192
+ * an element matches multiple `string` selectors, only one `TestElement` instance is returned
193
+ * for that element. The type that the `Promise` resolves to is an array where each element is
194
+ * the union of all result types for each query.
195
+ *
196
+ * e.g. Given the following DOM: `<div id="d1" /><div id="d2" />`, and assuming
197
+ * `DivHarness.hostSelector === 'div'` and `IdIsD1Harness.hostSelector === '#d1'`:
198
+ * - `await ch.locatorForAll(DivHarness, 'div')()` gets `[
199
+ * DivHarness, // for #d1
200
+ * TestElement, // for #d1
201
+ * DivHarness, // for #d2
202
+ * TestElement // for #d2
203
+ * ]`
204
+ * - `await ch.locatorForAll('div', '#d1')()` gets `[
205
+ * TestElement, // for #d1
206
+ * TestElement // for #d2
207
+ * ]`
208
+ * - `await ch.locatorForAll(DivHarness, IdIsD1Harness)()` gets `[
209
+ * DivHarness, // for #d1
210
+ * IdIsD1Harness, // for #d1
211
+ * DivHarness // for #d2
212
+ * ]`
213
+ * - `await ch.locatorForAll('span')()` gets `[]`.
214
+ */
215
+ locatorForAll(...queries) {
216
+ return this.locatorFactory.locatorForAll(...queries);
217
+ }
218
+ /**
219
+ * Flushes change detection and async tasks in the Angular zone.
220
+ * In most cases it should not be necessary to call this manually. However, there may be some edge
221
+ * cases where it is needed to fully flush animation events.
222
+ */
223
+ forceStabilize() {
224
+ return __awaiter(this, void 0, void 0, function* () {
225
+ return this.locatorFactory.forceStabilize();
226
+ });
227
+ }
228
+ /**
229
+ * Waits for all scheduled or running async tasks to complete. This allows harness
230
+ * authors to wait for async tasks outside of the Angular zone.
231
+ */
232
+ waitForTasksOutsideAngular() {
233
+ return __awaiter(this, void 0, void 0, function* () {
234
+ return this.locatorFactory.waitForTasksOutsideAngular();
235
+ });
236
+ }
237
+ }
238
+ /**
239
+ * Base class for component harnesses that authors should extend if they anticipate that consumers
240
+ * of the harness may want to access other harnesses within the `<ng-content>` of the component.
241
+ */
242
+ class ContentContainerComponentHarness extends ComponentHarness {
243
+ getChildLoader(selector) {
244
+ return __awaiter(this, void 0, void 0, function* () {
245
+ return (yield this.getRootHarnessLoader()).getChildLoader(selector);
246
+ });
247
+ }
248
+ getAllChildLoaders(selector) {
249
+ return __awaiter(this, void 0, void 0, function* () {
250
+ return (yield this.getRootHarnessLoader()).getAllChildLoaders(selector);
251
+ });
252
+ }
253
+ getHarness(query) {
254
+ return __awaiter(this, void 0, void 0, function* () {
255
+ return (yield this.getRootHarnessLoader()).getHarness(query);
256
+ });
257
+ }
258
+ getHarnessOrNull(query) {
259
+ return __awaiter(this, void 0, void 0, function* () {
260
+ return (yield this.getRootHarnessLoader()).getHarnessOrNull(query);
261
+ });
262
+ }
263
+ getAllHarnesses(query) {
264
+ return __awaiter(this, void 0, void 0, function* () {
265
+ return (yield this.getRootHarnessLoader()).getAllHarnesses(query);
266
+ });
267
+ }
268
+ hasHarness(query) {
269
+ return __awaiter(this, void 0, void 0, function* () {
270
+ return (yield this.getRootHarnessLoader()).hasHarness(query);
271
+ });
272
+ }
273
+ /**
274
+ * Gets the root harness loader from which to start
275
+ * searching for content contained by this harness.
276
+ */
277
+ getRootHarnessLoader() {
278
+ return __awaiter(this, void 0, void 0, function* () {
279
+ return this.locatorFactory.rootHarnessLoader();
280
+ });
281
+ }
282
+ }
283
+ /**
284
+ * A class used to associate a ComponentHarness class with predicates functions that can be used to
285
+ * filter instances of the class.
286
+ */
287
+ class HarnessPredicate {
288
+ constructor(harnessType, options) {
289
+ this.harnessType = harnessType;
290
+ this._predicates = [];
291
+ this._descriptions = [];
292
+ this._addBaseOptions(options);
293
+ }
294
+ /**
295
+ * Checks if the specified nullable string value matches the given pattern.
296
+ * @param value The nullable string value to check, or a Promise resolving to the
297
+ * nullable string value.
298
+ * @param pattern The pattern the value is expected to match. If `pattern` is a string,
299
+ * `value` is expected to match exactly. If `pattern` is a regex, a partial match is
300
+ * allowed. If `pattern` is `null`, the value is expected to be `null`.
301
+ * @return Whether the value matches the pattern.
302
+ */
303
+ static stringMatches(value, pattern) {
304
+ return __awaiter(this, void 0, void 0, function* () {
305
+ value = yield value;
306
+ if (pattern === null) {
307
+ return value === null;
308
+ } else if (value === null) {
309
+ return false;
310
+ }
311
+ return typeof pattern === 'string' ? value === pattern : pattern.test(value);
312
+ });
313
+ }
314
+ /**
315
+ * Adds a predicate function to be run against candidate harnesses.
316
+ * @param description A description of this predicate that may be used in error messages.
317
+ * @param predicate An async predicate function.
318
+ * @return this (for method chaining).
319
+ */
320
+ add(description, predicate) {
321
+ this._descriptions.push(description);
322
+ this._predicates.push(predicate);
323
+ return this;
324
+ }
325
+ /**
326
+ * Adds a predicate function that depends on an option value to be run against candidate
327
+ * harnesses. If the option value is undefined, the predicate will be ignored.
328
+ * @param name The name of the option (may be used in error messages).
329
+ * @param option The option value.
330
+ * @param predicate The predicate function to run if the option value is not undefined.
331
+ * @return this (for method chaining).
332
+ */
333
+ addOption(name, option, predicate) {
334
+ if (option !== undefined) {
335
+ this.add(`${name} = ${_valueAsString(option)}`, item => predicate(item, option));
336
+ }
337
+ return this;
338
+ }
339
+ /**
340
+ * Filters a list of harnesses on this predicate.
341
+ * @param harnesses The list of harnesses to filter.
342
+ * @return A list of harnesses that satisfy this predicate.
343
+ */
344
+ filter(harnesses) {
345
+ return __awaiter(this, void 0, void 0, function* () {
346
+ if (harnesses.length === 0) {
347
+ return [];
348
+ }
349
+ const results = yield parallel(() => harnesses.map(h => this.evaluate(h)));
350
+ return harnesses.filter((_, i) => results[i]);
351
+ });
352
+ }
353
+ /**
354
+ * Evaluates whether the given harness satisfies this predicate.
355
+ * @param harness The harness to check
356
+ * @return A promise that resolves to true if the harness satisfies this predicate,
357
+ * and resolves to false otherwise.
358
+ */
359
+ evaluate(harness) {
360
+ return __awaiter(this, void 0, void 0, function* () {
361
+ const results = yield parallel(() => this._predicates.map(p => p(harness)));
362
+ return results.reduce((combined, current) => combined && current, true);
363
+ });
364
+ }
365
+ /** Gets a description of this predicate for use in error messages. */
366
+ getDescription() {
367
+ return this._descriptions.join(', ');
368
+ }
369
+ /** Gets the selector used to find candidate elements. */
370
+ getSelector() {
371
+ // We don't have to go through the extra trouble if there are no ancestors.
372
+ if (!this._ancestor) {
373
+ return (this.harnessType.hostSelector || '').trim();
374
+ }
375
+ const [ancestors, ancestorPlaceholders] = _splitAndEscapeSelector(this._ancestor);
376
+ const [selectors, selectorPlaceholders] = _splitAndEscapeSelector(
377
+ this.harnessType.hostSelector || ''
378
+ );
379
+ const result = [];
380
+ // We have to add the ancestor to each part of the host compound selector, otherwise we can get
381
+ // incorrect results. E.g. `.ancestor .a, .ancestor .b` vs `.ancestor .a, .b`.
382
+ ancestors.forEach(escapedAncestor => {
383
+ const ancestor = _restoreSelector(escapedAncestor, ancestorPlaceholders);
384
+ return selectors.forEach(escapedSelector =>
385
+ result.push(`${ancestor} ${_restoreSelector(escapedSelector, selectorPlaceholders)}`)
386
+ );
387
+ });
388
+ return result.join(', ');
389
+ }
390
+ /** Adds base options common to all harness types. */
391
+ _addBaseOptions(options) {
392
+ this._ancestor = options.ancestor || '';
393
+ if (this._ancestor) {
394
+ this._descriptions.push(`has ancestor matching selector "${this._ancestor}"`);
395
+ }
396
+ const selector = options.selector;
397
+ if (selector !== undefined) {
398
+ this.add(`host matches selector "${selector}"`, item =>
399
+ __awaiter(this, void 0, void 0, function* () {
400
+ return (yield item.host()).matchesSelector(selector);
401
+ })
402
+ );
403
+ }
404
+ }
405
+ }
406
+ /** Represent a value as a string for the purpose of logging. */
407
+ function _valueAsString(value) {
408
+ if (value === undefined) {
409
+ return 'undefined';
410
+ }
411
+ try {
412
+ // `JSON.stringify` doesn't handle RegExp properly, so we need a custom replacer.
413
+ // Use a character that is unlikely to appear in real strings to denote the start and end of
414
+ // the regex. This allows us to strip out the extra quotes around the value added by
415
+ // `JSON.stringify`. Also do custom escaping on `"` characters to prevent `JSON.stringify`
416
+ // from escaping them as if they were part of a string.
417
+ const stringifiedValue = JSON.stringify(value, (_, v) =>
418
+ v instanceof RegExp
419
+ ? `◬MAT_RE_ESCAPE◬${v.toString().replace(/"/g, '◬MAT_RE_ESCAPE◬')}◬MAT_RE_ESCAPE◬`
420
+ : v
421
+ );
422
+ // Strip out the extra quotes around regexes and put back the manually escaped `"` characters.
423
+ return stringifiedValue
424
+ .replace(/"◬MAT_RE_ESCAPE◬|◬MAT_RE_ESCAPE◬"/g, '')
425
+ .replace(/◬MAT_RE_ESCAPE◬/g, '"');
426
+ } catch (_a) {
427
+ // `JSON.stringify` will throw if the object is cyclical,
428
+ // in this case the best we can do is report the value as `{...}`.
429
+ return '{...}';
430
+ }
431
+ }
432
+ /**
433
+ * Splits up a compound selector into its parts and escapes any quoted content. The quoted content
434
+ * has to be escaped, because it can contain commas which will throw throw us off when trying to
435
+ * split it.
436
+ * @param selector Selector to be split.
437
+ * @returns The escaped string where any quoted content is replaced with a placeholder. E.g.
438
+ * `[foo="bar"]` turns into `[foo=__cdkPlaceholder-0__]`. Use `_restoreSelector` to restore
439
+ * the placeholders.
440
+ */
441
+ function _splitAndEscapeSelector(selector) {
442
+ const placeholders = [];
443
+ // Note that the regex doesn't account for nested quotes so something like `"ab'cd'e"` will be
444
+ // considered as two blocks. It's a bit of an edge case, but if we find that it's a problem,
445
+ // we can make it a bit smarter using a loop. Use this for now since it's more readable and
446
+ // compact. More complete implementation:
447
+ // https://github.com/angular/angular/blob/bd34bc9e89f18a/packages/compiler/src/shadow_css.ts#L655
448
+ const result = selector.replace(/(["'][^["']*["'])/g, (_, keep) => {
449
+ const replaceBy = `__cdkPlaceholder-${placeholders.length}__`;
450
+ placeholders.push(keep);
451
+ return replaceBy;
452
+ });
453
+ return [result.split(',').map(part => part.trim()), placeholders];
454
+ }
455
+ /** Restores a selector whose content was escaped in `_splitAndEscapeSelector`. */
456
+ function _restoreSelector(selector, placeholders) {
457
+ return selector.replace(/__cdkPlaceholder-(\d+)__/g, (_, index) => placeholders[+index]);
458
+ }
459
+
460
+ /**
461
+ * Base harness environment class that can be extended to allow `ComponentHarness`es to be used in
462
+ * different test environments (e.g. testbed, protractor, etc.). This class implements the
463
+ * functionality of both a `HarnessLoader` and `LocatorFactory`. This class is generic on the raw
464
+ * element type, `E`, used by the particular test environment.
465
+ */
466
+ class HarnessEnvironment {
467
+ constructor(rawRootElement) {
468
+ this.rawRootElement = rawRootElement;
469
+ }
470
+ // Implemented as part of the `LocatorFactory` interface.
471
+ get rootElement() {
472
+ this._rootElement = this._rootElement || this.createTestElement(this.rawRootElement);
473
+ return this._rootElement;
474
+ }
475
+ set rootElement(element) {
476
+ this._rootElement = element;
477
+ }
478
+ // Implemented as part of the `LocatorFactory` interface.
479
+ documentRootLocatorFactory() {
480
+ return this.createEnvironment(this.getDocumentRoot());
481
+ }
482
+ // Implemented as part of the `LocatorFactory` interface.
483
+ locatorFor(...queries) {
484
+ return () =>
485
+ _assertResultFound(
486
+ this._getAllHarnessesAndTestElements(queries),
487
+ _getDescriptionForLocatorForQueries(queries)
488
+ );
489
+ }
490
+ // Implemented as part of the `LocatorFactory` interface.
491
+ locatorForOptional(...queries) {
492
+ return () =>
493
+ __awaiter(this, void 0, void 0, function* () {
494
+ return (yield this._getAllHarnessesAndTestElements(queries))[0] || null;
495
+ });
496
+ }
497
+ // Implemented as part of the `LocatorFactory` interface.
498
+ locatorForAll(...queries) {
499
+ return () => this._getAllHarnessesAndTestElements(queries);
500
+ }
501
+ // Implemented as part of the `LocatorFactory` interface.
502
+ rootHarnessLoader() {
503
+ return __awaiter(this, void 0, void 0, function* () {
504
+ return this;
505
+ });
506
+ }
507
+ // Implemented as part of the `LocatorFactory` interface.
508
+ harnessLoaderFor(selector) {
509
+ return __awaiter(this, void 0, void 0, function* () {
510
+ return this.createEnvironment(
511
+ yield _assertResultFound(this.getAllRawElements(selector), [
512
+ _getDescriptionForHarnessLoaderQuery(selector),
513
+ ])
514
+ );
515
+ });
516
+ }
517
+ // Implemented as part of the `LocatorFactory` interface.
518
+ harnessLoaderForOptional(selector) {
519
+ return __awaiter(this, void 0, void 0, function* () {
520
+ const elements = yield this.getAllRawElements(selector);
521
+ return elements[0] ? this.createEnvironment(elements[0]) : null;
522
+ });
523
+ }
524
+ // Implemented as part of the `LocatorFactory` interface.
525
+ harnessLoaderForAll(selector) {
526
+ return __awaiter(this, void 0, void 0, function* () {
527
+ const elements = yield this.getAllRawElements(selector);
528
+ return elements.map(element => this.createEnvironment(element));
529
+ });
530
+ }
531
+ // Implemented as part of the `HarnessLoader` interface.
532
+ getHarness(query) {
533
+ return this.locatorFor(query)();
534
+ }
535
+ // Implemented as part of the `HarnessLoader` interface.
536
+ getHarnessOrNull(query) {
537
+ return this.locatorForOptional(query)();
538
+ }
539
+ // Implemented as part of the `HarnessLoader` interface.
540
+ getAllHarnesses(query) {
541
+ return this.locatorForAll(query)();
542
+ }
543
+ // Implemented as part of the `HarnessLoader` interface.
544
+ hasHarness(query) {
545
+ return __awaiter(this, void 0, void 0, function* () {
546
+ return (yield this.locatorForOptional(query)()) !== null;
547
+ });
548
+ }
549
+ // Implemented as part of the `HarnessLoader` interface.
550
+ getChildLoader(selector) {
551
+ return __awaiter(this, void 0, void 0, function* () {
552
+ return this.createEnvironment(
553
+ yield _assertResultFound(this.getAllRawElements(selector), [
554
+ _getDescriptionForHarnessLoaderQuery(selector),
555
+ ])
556
+ );
557
+ });
558
+ }
559
+ // Implemented as part of the `HarnessLoader` interface.
560
+ getAllChildLoaders(selector) {
561
+ return __awaiter(this, void 0, void 0, function* () {
562
+ return (yield this.getAllRawElements(selector)).map(e => this.createEnvironment(e));
563
+ });
564
+ }
565
+ /** Creates a `ComponentHarness` for the given harness type with the given raw host element. */
566
+ createComponentHarness(harnessType, element) {
567
+ return new harnessType(this.createEnvironment(element));
568
+ }
569
+ /**
570
+ * Matches the given raw elements with the given list of element and harness queries to produce a
571
+ * list of matched harnesses and test elements.
572
+ */
573
+ _getAllHarnessesAndTestElements(queries) {
574
+ return __awaiter(this, void 0, void 0, function* () {
575
+ if (!queries.length) {
576
+ throw Error('CDK Component harness query must contain at least one element.');
577
+ }
578
+ const { allQueries, harnessQueries, elementQueries, harnessTypes } = _parseQueries(queries);
579
+ // Combine all of the queries into one large comma-delimited selector and use it to get all raw
580
+ // elements matching any of the individual queries.
581
+ const rawElements = yield this.getAllRawElements(
582
+ [...elementQueries, ...harnessQueries.map(predicate => predicate.getSelector())].join(',')
583
+ );
584
+ // If every query is searching for the same harness subclass, we know every result corresponds
585
+ // to an instance of that subclass. Likewise, if every query is for a `TestElement`, we know
586
+ // every result corresponds to a `TestElement`. Otherwise we need to verify which result was
587
+ // found by which selector so it can be matched to the appropriate instance.
588
+ const skipSelectorCheck =
589
+ (elementQueries.length === 0 && harnessTypes.size === 1) || harnessQueries.length === 0;
590
+ const perElementMatches = yield parallel(() =>
591
+ rawElements.map(rawElement =>
592
+ __awaiter(this, void 0, void 0, function* () {
593
+ const testElement = this.createTestElement(rawElement);
594
+ const allResultsForElement = yield parallel(
595
+ // For each query, get `null` if it doesn't match, or a `TestElement` or
596
+ // `ComponentHarness` as appropriate if it does match. This gives us everything that
597
+ // matches the current raw element, but it may contain duplicate entries (e.g.
598
+ // multiple `TestElement` or multiple `ComponentHarness` of the same type).
599
+ () =>
600
+ allQueries.map(query =>
601
+ this._getQueryResultForElement(query, rawElement, testElement, skipSelectorCheck)
602
+ )
603
+ );
604
+ return _removeDuplicateQueryResults(allResultsForElement);
605
+ })
606
+ )
607
+ );
608
+ return [].concat(...perElementMatches);
609
+ });
610
+ }
611
+ /**
612
+ * Check whether the given query matches the given element, if it does return the matched
613
+ * `TestElement` or `ComponentHarness`, if it does not, return null. In cases where the caller
614
+ * knows for sure that the query matches the element's selector, `skipSelectorCheck` can be used
615
+ * to skip verification and optimize performance.
616
+ */
617
+ _getQueryResultForElement(query, rawElement, testElement, skipSelectorCheck = false) {
618
+ return __awaiter(this, void 0, void 0, function* () {
619
+ if (typeof query === 'string') {
620
+ return skipSelectorCheck || (yield testElement.matchesSelector(query)) ? testElement : null;
621
+ }
622
+ if (skipSelectorCheck || (yield testElement.matchesSelector(query.getSelector()))) {
623
+ const harness = this.createComponentHarness(query.harnessType, rawElement);
624
+ return (yield query.evaluate(harness)) ? harness : null;
625
+ }
626
+ return null;
627
+ });
628
+ }
629
+ }
630
+ /**
631
+ * Parses a list of queries in the format accepted by the `locatorFor*` methods into an easier to
632
+ * work with format.
633
+ */
634
+ function _parseQueries(queries) {
635
+ const allQueries = [];
636
+ const harnessQueries = [];
637
+ const elementQueries = [];
638
+ const harnessTypes = new Set();
639
+ for (const query of queries) {
640
+ if (typeof query === 'string') {
641
+ allQueries.push(query);
642
+ elementQueries.push(query);
643
+ } else {
644
+ const predicate = query instanceof HarnessPredicate ? query : new HarnessPredicate(query, {});
645
+ allQueries.push(predicate);
646
+ harnessQueries.push(predicate);
647
+ harnessTypes.add(predicate.harnessType);
648
+ }
649
+ }
650
+ return { allQueries, harnessQueries, elementQueries, harnessTypes };
651
+ }
652
+ /**
653
+ * Removes duplicate query results for a particular element. (e.g. multiple `TestElement`
654
+ * instances or multiple instances of the same `ComponentHarness` class.
655
+ */
656
+ function _removeDuplicateQueryResults(results) {
657
+ return __awaiter(this, void 0, void 0, function* () {
658
+ let testElementMatched = false;
659
+ let matchedHarnessTypes = new Set();
660
+ const dedupedMatches = [];
661
+ for (const result of results) {
662
+ if (!result) {
663
+ continue;
664
+ }
665
+ if (result instanceof ComponentHarness) {
666
+ if (!matchedHarnessTypes.has(result.constructor)) {
667
+ matchedHarnessTypes.add(result.constructor);
668
+ dedupedMatches.push(result);
669
+ }
670
+ } else if (!testElementMatched) {
671
+ testElementMatched = true;
672
+ dedupedMatches.push(result);
673
+ }
674
+ }
675
+ return dedupedMatches;
676
+ });
677
+ }
678
+ /** Verifies that there is at least one result in an array. */
679
+ function _assertResultFound(results, queryDescriptions) {
680
+ return __awaiter(this, void 0, void 0, function* () {
681
+ const result = (yield results)[0];
682
+ if (result == undefined) {
683
+ throw Error(
684
+ `Failed to find element matching one of the following queries:\n` +
685
+ queryDescriptions.map(desc => `(${desc})`).join(',\n')
686
+ );
687
+ }
688
+ return result;
689
+ });
690
+ }
691
+ /** Gets a list of description strings from a list of queries. */
692
+ function _getDescriptionForLocatorForQueries(queries) {
693
+ return queries.map(query =>
694
+ typeof query === 'string'
695
+ ? _getDescriptionForTestElementQuery(query)
696
+ : _getDescriptionForComponentHarnessQuery(query)
697
+ );
698
+ }
699
+ /** Gets a description string for a `ComponentHarness` query. */
700
+ function _getDescriptionForComponentHarnessQuery(query) {
701
+ const harnessPredicate =
702
+ query instanceof HarnessPredicate ? query : new HarnessPredicate(query, {});
703
+ const { name, hostSelector } = harnessPredicate.harnessType;
704
+ const description = `${name} with host element matching selector: "${hostSelector}"`;
705
+ const constraints = harnessPredicate.getDescription();
706
+ return (
707
+ description +
708
+ (constraints ? ` satisfying the constraints: ${harnessPredicate.getDescription()}` : '')
709
+ );
710
+ }
711
+ /** Gets a description string for a `TestElement` query. */
712
+ function _getDescriptionForTestElementQuery(selector) {
713
+ return `TestElement for element matching selector: "${selector}"`;
714
+ }
715
+ /** Gets a description string for a `HarnessLoader` query. */
716
+ function _getDescriptionForHarnessLoaderQuery(selector) {
717
+ return `HarnessLoader for element matching selector: "${selector}"`;
718
+ }
719
+
720
+ /**
721
+ * @license
722
+ * Copyright Google LLC All Rights Reserved.
723
+ *
724
+ * Use of this source code is governed by an MIT-style license that can be
725
+ * found in the LICENSE file at https://angular.io/license
726
+ */
727
+ /** An enum of non-text keys that can be used with the `sendKeys` method. */
728
+ // NOTE: This is a separate enum from `@kato-lee/cdk/keycodes` because we don't necessarily want to
729
+ // support every possible keyCode. We also can't rely on Protractor's `Key` because we don't want a
730
+ // dependency on any particular testing framework here. Instead we'll just maintain this supported
731
+ // list of keys and let individual concrete `HarnessEnvironment` classes map them to whatever key
732
+ // representation is used in its respective testing framework.
733
+ // tslint:disable-next-line:prefer-const-enum Seems like this causes some issues with System.js
734
+ var TestKey;
735
+ (function (TestKey) {
736
+ TestKey[(TestKey['BACKSPACE'] = 0)] = 'BACKSPACE';
737
+ TestKey[(TestKey['TAB'] = 1)] = 'TAB';
738
+ TestKey[(TestKey['ENTER'] = 2)] = 'ENTER';
739
+ TestKey[(TestKey['SHIFT'] = 3)] = 'SHIFT';
740
+ TestKey[(TestKey['CONTROL'] = 4)] = 'CONTROL';
741
+ TestKey[(TestKey['ALT'] = 5)] = 'ALT';
742
+ TestKey[(TestKey['ESCAPE'] = 6)] = 'ESCAPE';
743
+ TestKey[(TestKey['PAGE_UP'] = 7)] = 'PAGE_UP';
744
+ TestKey[(TestKey['PAGE_DOWN'] = 8)] = 'PAGE_DOWN';
745
+ TestKey[(TestKey['END'] = 9)] = 'END';
746
+ TestKey[(TestKey['HOME'] = 10)] = 'HOME';
747
+ TestKey[(TestKey['LEFT_ARROW'] = 11)] = 'LEFT_ARROW';
748
+ TestKey[(TestKey['UP_ARROW'] = 12)] = 'UP_ARROW';
749
+ TestKey[(TestKey['RIGHT_ARROW'] = 13)] = 'RIGHT_ARROW';
750
+ TestKey[(TestKey['DOWN_ARROW'] = 14)] = 'DOWN_ARROW';
751
+ TestKey[(TestKey['INSERT'] = 15)] = 'INSERT';
752
+ TestKey[(TestKey['DELETE'] = 16)] = 'DELETE';
753
+ TestKey[(TestKey['F1'] = 17)] = 'F1';
754
+ TestKey[(TestKey['F2'] = 18)] = 'F2';
755
+ TestKey[(TestKey['F3'] = 19)] = 'F3';
756
+ TestKey[(TestKey['F4'] = 20)] = 'F4';
757
+ TestKey[(TestKey['F5'] = 21)] = 'F5';
758
+ TestKey[(TestKey['F6'] = 22)] = 'F6';
759
+ TestKey[(TestKey['F7'] = 23)] = 'F7';
760
+ TestKey[(TestKey['F8'] = 24)] = 'F8';
761
+ TestKey[(TestKey['F9'] = 25)] = 'F9';
762
+ TestKey[(TestKey['F10'] = 26)] = 'F10';
763
+ TestKey[(TestKey['F11'] = 27)] = 'F11';
764
+ TestKey[(TestKey['F12'] = 28)] = 'F12';
765
+ TestKey[(TestKey['META'] = 29)] = 'META';
766
+ })(TestKey || (TestKey = {}));
767
+
768
+ /**
769
+ * @license
770
+ * Copyright Google LLC All Rights Reserved.
771
+ *
772
+ * Use of this source code is governed by an MIT-style license that can be
773
+ * found in the LICENSE file at https://angular.io/license
774
+ */
775
+ /**
776
+ * Returns an error which reports that no keys have been specified.
777
+ * @docs-private
778
+ */
779
+ function getNoKeysSpecifiedError() {
780
+ return Error('No keys have been specified.');
781
+ }
782
+
783
+ /**
784
+ * @license
785
+ * Copyright Google LLC All Rights Reserved.
786
+ *
787
+ * Use of this source code is governed by an MIT-style license that can be
788
+ * found in the LICENSE file at https://angular.io/license
789
+ */
790
+ /**
791
+ * Gets text of element excluding certain selectors within the element.
792
+ * @param element Element to get text from,
793
+ * @param excludeSelector Selector identifying which elements to exclude,
794
+ */
795
+ function _getTextWithExcludedElements(element, excludeSelector) {
796
+ const clone = element.cloneNode(true);
797
+ const exclusions = clone.querySelectorAll(excludeSelector);
798
+ for (let i = 0; i < exclusions.length; i++) {
799
+ exclusions[i].remove();
800
+ }
801
+ return (clone.textContent || '').trim();
802
+ }
803
+
804
+ /**
805
+ * @license
806
+ * Copyright Google LLC All Rights Reserved.
807
+ *
808
+ * Use of this source code is governed by an MIT-style license that can be
809
+ * found in the LICENSE file at https://angular.io/license
810
+ */
811
+
812
+ /**
813
+ * @license
814
+ * Copyright Google LLC All Rights Reserved.
815
+ *
816
+ * Use of this source code is governed by an MIT-style license that can be
817
+ * found in the LICENSE file at https://angular.io/license
818
+ */
819
+
820
+ export {
821
+ ComponentHarness,
822
+ ContentContainerComponentHarness,
823
+ HarnessEnvironment,
824
+ HarnessPredicate,
825
+ TestKey,
826
+ _getTextWithExcludedElements,
827
+ getNoKeysSpecifiedError,
828
+ handleAutoChangeDetectionStatus,
829
+ manualChangeDetection,
830
+ parallel,
831
+ stopHandlingAutoChangeDetectionStatus,
832
+ };
833
+ //# sourceMappingURL=testing.mjs.map