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