frontile 0.18.0-alpha.2 → 0.18.0-alpha.20

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 (499) hide show
  1. package/declarations/-private/control-blur.d.ts +63 -0
  2. package/declarations/-private/dialog.d.ts +15 -0
  3. package/declarations/-private/dom.d.ts +3 -0
  4. package/declarations/-private/get-config.d.ts +2 -0
  5. package/declarations/-private/intent-icons.d.ts +9 -0
  6. package/declarations/-private/manager.d.ts +20 -0
  7. package/declarations/-private/notification-stack.d.ts +76 -0
  8. package/declarations/-private/notification.d.ts +40 -0
  9. package/declarations/-private/timer.d.ts +12 -0
  10. package/declarations/-private/types.d.ts +126 -0
  11. package/declarations/buttons.d.ts +1 -0
  12. package/declarations/collections.d.ts +1 -0
  13. package/declarations/components/buttons/button-group.d.ts +24 -0
  14. package/declarations/components/buttons/button.d.ts +88 -0
  15. package/declarations/components/buttons/chip.d.ts +85 -0
  16. package/declarations/components/buttons/close-button.d.ts +55 -0
  17. package/declarations/components/buttons/index.d.ts +6 -0
  18. package/declarations/components/buttons/segmented-control/item.d.ts +50 -0
  19. package/declarations/components/buttons/segmented-control/segmented-control.d.ts +210 -0
  20. package/declarations/components/buttons/segmented-control.d.ts +3 -0
  21. package/declarations/components/buttons/toggle-button.d.ts +28 -0
  22. package/declarations/components/collections/calendar/calendar.d.ts +585 -0
  23. package/declarations/components/collections/calendar/day-cell.d.ts +19 -0
  24. package/declarations/components/collections/calendar/header.d.ts +56 -0
  25. package/declarations/components/collections/calendar/icons.d.ts +14 -0
  26. package/declarations/components/collections/calendar/month-grid.d.ts +36 -0
  27. package/declarations/components/collections/calendar/types.d.ts +94 -0
  28. package/declarations/components/collections/calendar/utils.d.ts +51 -0
  29. package/declarations/components/collections/calendar/year-grid.d.ts +32 -0
  30. package/declarations/components/collections/calendar.d.ts +3 -0
  31. package/declarations/components/collections/command/command.d.ts +195 -0
  32. package/declarations/components/collections/command/dialog.d.ts +44 -0
  33. package/declarations/components/collections/command/footer.d.ts +61 -0
  34. package/declarations/components/collections/command/index.d.ts +6 -0
  35. package/declarations/components/collections/command/input.d.ts +131 -0
  36. package/declarations/components/collections/command/list.d.ts +135 -0
  37. package/declarations/components/collections/command.d.ts +2 -0
  38. package/declarations/components/collections/dropdown/dropdown.d.ts +190 -0
  39. package/declarations/components/collections/dropdown/menu-context.d.ts +64 -0
  40. package/declarations/components/collections/dropdown/sub.d.ts +195 -0
  41. package/declarations/components/collections/dropdown.d.ts +2 -0
  42. package/declarations/components/collections/index.d.ts +5 -0
  43. package/declarations/components/collections/listbox/group.d.ts +62 -0
  44. package/declarations/components/collections/listbox/item.d.ts +140 -0
  45. package/declarations/components/collections/listbox/listbox.d.ts +102 -0
  46. package/declarations/components/collections/listbox.d.ts +2 -0
  47. package/declarations/components/collections/simple-table/body.d.ts +481 -0
  48. package/declarations/components/collections/simple-table/cell.d.ts +479 -0
  49. package/declarations/components/collections/simple-table/column.d.ts +471 -0
  50. package/declarations/components/collections/simple-table/footer.d.ts +482 -0
  51. package/declarations/components/collections/simple-table/header.d.ts +482 -0
  52. package/declarations/components/collections/simple-table/index.d.ts +498 -0
  53. package/declarations/components/collections/simple-table/row.d.ts +483 -0
  54. package/declarations/components/collections/table/cell-default.d.ts +43 -0
  55. package/declarations/components/collections/table/cell-for.d.ts +38 -0
  56. package/declarations/components/collections/table/cell-rendering-context.d.ts +24 -0
  57. package/declarations/components/collections/table/checkbox.d.ts +50 -0
  58. package/declarations/components/collections/table/column-visibility.d.ts +468 -0
  59. package/declarations/components/collections/table/icons.d.ts +11 -0
  60. package/declarations/components/collections/table/index.d.ts +4 -0
  61. package/declarations/components/collections/table/sort-button.d.ts +465 -0
  62. package/declarations/components/collections/table/table.d.ts +627 -0
  63. package/declarations/components/collections/table/types.d.ts +58 -0
  64. package/declarations/components/collections/table/utils.d.ts +6 -0
  65. package/declarations/components/collections/table.d.ts +2 -0
  66. package/declarations/components/disclosure/accordion/accordion.d.ts +247 -0
  67. package/declarations/components/disclosure/accordion/item.d.ts +96 -0
  68. package/declarations/components/disclosure/accordion.d.ts +3 -0
  69. package/declarations/components/disclosure/icons.d.ts +9 -0
  70. package/declarations/components/disclosure/index.d.ts +1 -0
  71. package/declarations/components/forms/autocomplete.d.ts +446 -0
  72. package/declarations/components/forms/checkbox-group.d.ts +62 -0
  73. package/declarations/components/forms/checkbox.d.ts +62 -0
  74. package/declarations/components/forms/field-types.d.ts +14 -0
  75. package/declarations/components/forms/field.d.ts +87 -0
  76. package/declarations/components/forms/form-control.d.ts +101 -0
  77. package/declarations/components/forms/form-description.d.ts +30 -0
  78. package/declarations/components/forms/form-feedback.d.ts +64 -0
  79. package/declarations/components/forms/form.d.ts +255 -0
  80. package/declarations/components/forms/icons.d.ts +7 -0
  81. package/declarations/components/forms/index.d.ts +20 -0
  82. package/declarations/components/forms/input-otp.d.ts +321 -0
  83. package/declarations/components/forms/input.d.ts +188 -0
  84. package/declarations/components/forms/label.d.ts +53 -0
  85. package/declarations/components/forms/native-select.d.ts +251 -0
  86. package/declarations/components/forms/radio-group.d.ts +64 -0
  87. package/declarations/components/forms/radio.d.ts +68 -0
  88. package/declarations/components/forms/select/end-content.d.ts +31 -0
  89. package/declarations/components/forms/select/native-mirror.d.ts +44 -0
  90. package/declarations/components/forms/select/select.d.ts +454 -0
  91. package/declarations/components/forms/select/selected-items.d.ts +80 -0
  92. package/declarations/components/forms/select/trigger.d.ts +81 -0
  93. package/declarations/components/forms/select/types.d.ts +431 -0
  94. package/declarations/components/forms/select.d.ts +2 -0
  95. package/declarations/components/forms/switch.d.ts +152 -0
  96. package/declarations/components/forms/textarea.d.ts +104 -0
  97. package/declarations/components/navigation/external-link.d.ts +94 -0
  98. package/declarations/components/navigation/index.d.ts +4 -0
  99. package/declarations/components/navigation/pagination/icons.d.ts +13 -0
  100. package/declarations/components/navigation/pagination/pagination.d.ts +279 -0
  101. package/declarations/components/navigation/pagination/range.d.ts +34 -0
  102. package/declarations/components/navigation/pagination.d.ts +3 -0
  103. package/declarations/components/navigation/tab-nav/item.d.ts +79 -0
  104. package/declarations/components/navigation/tab-nav/tab-nav.d.ts +165 -0
  105. package/declarations/components/navigation/tab-nav.d.ts +3 -0
  106. package/declarations/components/navigation/tabs/panel.d.ts +28 -0
  107. package/declarations/components/navigation/tabs/tab.d.ts +46 -0
  108. package/declarations/components/navigation/tabs/tabs.d.ts +227 -0
  109. package/declarations/components/navigation/tabs.d.ts +4 -0
  110. package/declarations/components/notifications/icons.d.ts +9 -0
  111. package/declarations/components/notifications/index.d.ts +12 -0
  112. package/declarations/components/notifications/notification-card.d.ts +100 -0
  113. package/declarations/components/notifications/notifications-container.d.ts +148 -0
  114. package/declarations/components/overlays/backdrop.d.ts +39 -0
  115. package/declarations/components/overlays/drawer/body.d.ts +17 -0
  116. package/declarations/components/overlays/drawer/drag-handle.d.ts +26 -0
  117. package/declarations/components/overlays/drawer/footer.d.ts +17 -0
  118. package/declarations/components/overlays/drawer/header.d.ts +140 -0
  119. package/declarations/components/overlays/drawer/selectors.d.ts +22 -0
  120. package/declarations/components/overlays/drawer.d.ts +293 -0
  121. package/declarations/components/overlays/index.d.ts +14 -0
  122. package/declarations/components/overlays/modal/body.d.ts +17 -0
  123. package/declarations/components/overlays/modal/footer.d.ts +17 -0
  124. package/declarations/components/overlays/modal/header.d.ts +35 -0
  125. package/declarations/components/overlays/modal.d.ts +146 -0
  126. package/declarations/components/overlays/mount-animation.d.ts +81 -0
  127. package/declarations/components/overlays/overlay.d.ts +218 -0
  128. package/declarations/components/overlays/popover.d.ts +452 -0
  129. package/declarations/components/overlays/portal-target.d.ts +19 -0
  130. package/declarations/components/overlays/portal.d.ts +38 -0
  131. package/declarations/components/overlays/tooltip.d.ts +401 -0
  132. package/declarations/components/status/alert.d.ts +134 -0
  133. package/declarations/components/status/index.d.ts +2 -0
  134. package/declarations/components/status/progress-bar.d.ts +115 -0
  135. package/declarations/components/utilities/avatar.d.ts +90 -0
  136. package/declarations/components/utilities/collapsible.d.ts +64 -0
  137. package/declarations/components/utilities/divider.d.ts +25 -0
  138. package/declarations/components/utilities/index.d.ts +15 -0
  139. package/declarations/components/utilities/kbd.d.ts +92 -0
  140. package/declarations/components/utilities/skeleton.d.ts +31 -0
  141. package/declarations/components/utilities/spinner.d.ts +26 -0
  142. package/declarations/components/utilities/visually-hidden.d.ts +9 -0
  143. package/declarations/disclosure.d.ts +1 -0
  144. package/declarations/forms.d.ts +1 -0
  145. package/declarations/index.d.ts +9 -7
  146. package/declarations/modifiers/drag-to-dismiss.d.ts +22 -0
  147. package/declarations/modifiers/press.d.ts +55 -0
  148. package/declarations/navigation.d.ts +1 -0
  149. package/declarations/notifications.d.ts +1 -0
  150. package/declarations/overlays.d.ts +1 -0
  151. package/declarations/services/notifications.d.ts +20 -0
  152. package/declarations/status.d.ts +1 -0
  153. package/declarations/template-registry.d.ts +55 -2
  154. package/declarations/test-support.d.ts +3 -0
  155. package/declarations/utilities.d.ts +1 -0
  156. package/declarations/utils/deferred-work.d.ts +24 -0
  157. package/declarations/utils/filter.d.ts +87 -0
  158. package/declarations/utils/forms-utils-index.d.ts +3 -0
  159. package/declarations/utils/keys.d.ts +52 -0
  160. package/declarations/utils/listManager.d.ts +158 -0
  161. package/declarations/utils/nested-data.d.ts +44 -0
  162. package/declarations/utils/prefers-reduced-motion.d.ts +3 -0
  163. package/declarations/utils/ref.d.ts +14 -0
  164. package/declarations/utils/roving-focus.d.ts +66 -0
  165. package/declarations/utils/safe-area.d.ts +52 -0
  166. package/declarations/utils/safe-styles.d.ts +2 -0
  167. package/declarations/utils/selection-indicator.d.ts +65 -0
  168. package/declarations/utils/standard-validator.d.ts +176 -0
  169. package/declarations/utils/toggle.d.ts +9 -0
  170. package/dist/_app_/services/notifications.js +1 -0
  171. package/dist/buttons.js +8 -0
  172. package/dist/buttons.js.map +1 -0
  173. package/dist/collections.js +13 -0
  174. package/dist/collections.js.map +1 -0
  175. package/dist/components/buttons/button-group.js +31 -0
  176. package/dist/components/buttons/button-group.js.map +1 -0
  177. package/dist/components/buttons/button.js +120 -0
  178. package/dist/components/buttons/button.js.map +1 -0
  179. package/dist/components/buttons/chip.js +44 -0
  180. package/dist/components/buttons/chip.js.map +1 -0
  181. package/dist/components/buttons/close-button.js +84 -0
  182. package/dist/components/buttons/close-button.js.map +1 -0
  183. package/dist/components/buttons/index.js +8 -0
  184. package/dist/components/buttons/index.js.map +1 -0
  185. package/dist/components/buttons/segmented-control/item.js +55 -0
  186. package/dist/components/buttons/segmented-control/item.js.map +1 -0
  187. package/dist/components/buttons/segmented-control/segmented-control.js +175 -0
  188. package/dist/components/buttons/segmented-control/segmented-control.js.map +1 -0
  189. package/dist/components/buttons/segmented-control.js +3 -0
  190. package/dist/components/buttons/segmented-control.js.map +1 -0
  191. package/dist/components/buttons/toggle-button.js +40 -0
  192. package/dist/components/buttons/toggle-button.js.map +1 -0
  193. package/dist/components/collections/calendar/calendar.js +808 -0
  194. package/dist/components/collections/calendar/calendar.js.map +1 -0
  195. package/dist/components/collections/calendar/day-cell.js +16 -0
  196. package/dist/components/collections/calendar/day-cell.js.map +1 -0
  197. package/dist/components/collections/calendar/header.js +48 -0
  198. package/dist/components/collections/calendar/header.js.map +1 -0
  199. package/dist/components/collections/calendar/icons.js +23 -0
  200. package/dist/components/collections/calendar/icons.js.map +1 -0
  201. package/dist/components/collections/calendar/month-grid.js +14 -0
  202. package/dist/components/collections/calendar/month-grid.js.map +1 -0
  203. package/dist/components/collections/calendar/types.js +2 -0
  204. package/dist/components/collections/calendar/types.js.map +1 -0
  205. package/dist/components/collections/calendar/utils.js +199 -0
  206. package/dist/components/collections/calendar/utils.js.map +1 -0
  207. package/dist/components/collections/calendar/year-grid.js +117 -0
  208. package/dist/components/collections/calendar/year-grid.js.map +1 -0
  209. package/dist/components/collections/calendar.js +2 -0
  210. package/dist/components/collections/calendar.js.map +1 -0
  211. package/dist/components/collections/command/command.js +263 -0
  212. package/dist/components/collections/command/command.js.map +1 -0
  213. package/dist/components/collections/command/dialog.js +100 -0
  214. package/dist/components/collections/command/dialog.js.map +1 -0
  215. package/dist/components/collections/command/footer.js +60 -0
  216. package/dist/components/collections/command/footer.js.map +1 -0
  217. package/dist/components/collections/command/index.js +6 -0
  218. package/dist/components/collections/command/index.js.map +1 -0
  219. package/dist/components/collections/command/input.js +45 -0
  220. package/dist/components/collections/command/input.js.map +1 -0
  221. package/dist/components/collections/command/list.js +70 -0
  222. package/dist/components/collections/command/list.js.map +1 -0
  223. package/dist/components/collections/command.js +6 -0
  224. package/dist/components/collections/command.js.map +1 -0
  225. package/dist/components/collections/dropdown/dropdown.js +206 -0
  226. package/dist/components/collections/dropdown/dropdown.js.map +1 -0
  227. package/dist/components/collections/dropdown/menu-context.js +62 -0
  228. package/dist/components/collections/dropdown/menu-context.js.map +1 -0
  229. package/dist/components/collections/dropdown/sub.js +256 -0
  230. package/dist/components/collections/dropdown/sub.js.map +1 -0
  231. package/dist/components/collections/dropdown.js +2 -0
  232. package/dist/components/collections/dropdown.js.map +1 -0
  233. package/dist/components/collections/index.js +13 -0
  234. package/dist/components/collections/index.js.map +1 -0
  235. package/dist/components/collections/listbox/group.js +60 -0
  236. package/dist/components/collections/listbox/group.js.map +1 -0
  237. package/dist/components/collections/listbox/item.js +197 -0
  238. package/dist/components/collections/listbox/item.js.map +1 -0
  239. package/dist/components/collections/listbox/listbox.js +187 -0
  240. package/dist/components/collections/listbox/listbox.js.map +1 -0
  241. package/dist/components/collections/listbox.js +4 -0
  242. package/dist/components/collections/listbox.js.map +1 -0
  243. package/dist/components/collections/simple-table/body.js +32 -0
  244. package/dist/components/collections/simple-table/body.js.map +1 -0
  245. package/dist/components/collections/simple-table/cell.js +27 -0
  246. package/dist/components/collections/simple-table/cell.js.map +1 -0
  247. package/dist/components/collections/simple-table/column.js +26 -0
  248. package/dist/components/collections/simple-table/column.js.map +1 -0
  249. package/dist/components/collections/simple-table/footer.js +44 -0
  250. package/dist/components/collections/simple-table/footer.js.map +1 -0
  251. package/dist/components/collections/simple-table/header.js +44 -0
  252. package/dist/components/collections/simple-table/header.js.map +1 -0
  253. package/dist/components/collections/simple-table/index.js +60 -0
  254. package/dist/components/collections/simple-table/index.js.map +1 -0
  255. package/dist/components/collections/simple-table/row.js +33 -0
  256. package/dist/components/collections/simple-table/row.js.map +1 -0
  257. package/dist/components/collections/table/cell-default.js +39 -0
  258. package/dist/components/collections/table/cell-default.js.map +1 -0
  259. package/dist/components/collections/table/cell-for.js +34 -0
  260. package/dist/components/collections/table/cell-for.js.map +1 -0
  261. package/dist/components/collections/table/cell-rendering-context.js +39 -0
  262. package/dist/components/collections/table/cell-rendering-context.js.map +1 -0
  263. package/dist/components/collections/table/checkbox.js +53 -0
  264. package/dist/components/collections/table/checkbox.js.map +1 -0
  265. package/dist/components/collections/table/column-visibility.js +58 -0
  266. package/dist/components/collections/table/column-visibility.js.map +1 -0
  267. package/dist/components/collections/table/icons.js +19 -0
  268. package/dist/components/collections/table/icons.js.map +1 -0
  269. package/dist/components/collections/table/index.js +3 -0
  270. package/dist/components/collections/table/index.js.map +1 -0
  271. package/dist/components/collections/table/sort-button.js +32 -0
  272. package/dist/components/collections/table/sort-button.js.map +1 -0
  273. package/dist/components/collections/table/table.js +488 -0
  274. package/dist/components/collections/table/table.js.map +1 -0
  275. package/dist/components/collections/table/types.js +2 -0
  276. package/dist/components/collections/table/types.js.map +1 -0
  277. package/dist/components/collections/table/utils.js +19 -0
  278. package/dist/components/collections/table/utils.js.map +1 -0
  279. package/dist/components/collections/table.js +3 -0
  280. package/dist/components/collections/table.js.map +1 -0
  281. package/dist/components/disclosure/accordion/accordion.js +225 -0
  282. package/dist/components/disclosure/accordion/accordion.js.map +1 -0
  283. package/dist/components/disclosure/accordion/item.js +86 -0
  284. package/dist/components/disclosure/accordion/item.js.map +1 -0
  285. package/dist/components/disclosure/accordion.js +3 -0
  286. package/dist/components/disclosure/accordion.js.map +1 -0
  287. package/dist/components/disclosure/icons.js +13 -0
  288. package/dist/components/disclosure/icons.js.map +1 -0
  289. package/dist/components/disclosure/index.js +3 -0
  290. package/dist/components/disclosure/index.js.map +1 -0
  291. package/dist/components/forms/autocomplete.js +351 -0
  292. package/dist/components/forms/autocomplete.js.map +1 -0
  293. package/dist/components/forms/checkbox-group.js +29 -0
  294. package/dist/components/forms/checkbox-group.js.map +1 -0
  295. package/dist/components/forms/checkbox.js +50 -0
  296. package/dist/components/forms/checkbox.js.map +1 -0
  297. package/dist/components/forms/field-types.js +2 -0
  298. package/dist/components/forms/field-types.js.map +1 -0
  299. package/dist/components/forms/field.js +105 -0
  300. package/dist/components/forms/field.js.map +1 -0
  301. package/dist/components/forms/form-control.js +70 -0
  302. package/dist/components/forms/form-control.js.map +1 -0
  303. package/dist/components/forms/form-description.js +24 -0
  304. package/dist/components/forms/form-description.js.map +1 -0
  305. package/dist/components/forms/form-feedback.js +53 -0
  306. package/dist/components/forms/form-feedback.js.map +1 -0
  307. package/dist/components/forms/form.js +397 -0
  308. package/dist/components/forms/form.js.map +1 -0
  309. package/dist/components/forms/icons.js +13 -0
  310. package/dist/components/forms/icons.js.map +1 -0
  311. package/dist/components/forms/index.js +20 -0
  312. package/dist/components/forms/index.js.map +1 -0
  313. package/dist/components/forms/input-otp.js +407 -0
  314. package/dist/components/forms/input-otp.js.map +1 -0
  315. package/dist/components/forms/input.js +137 -0
  316. package/dist/components/forms/input.js.map +1 -0
  317. package/dist/components/forms/label.js +23 -0
  318. package/dist/components/forms/label.js.map +1 -0
  319. package/dist/components/forms/native-select.js +134 -0
  320. package/dist/components/forms/native-select.js.map +1 -0
  321. package/dist/components/forms/radio-group.js +29 -0
  322. package/dist/components/forms/radio-group.js.map +1 -0
  323. package/dist/components/forms/radio.js +49 -0
  324. package/dist/components/forms/radio.js.map +1 -0
  325. package/dist/components/forms/select/end-content.js +24 -0
  326. package/dist/components/forms/select/end-content.js.map +1 -0
  327. package/dist/components/forms/select/native-mirror.js +29 -0
  328. package/dist/components/forms/select/native-mirror.js.map +1 -0
  329. package/dist/components/forms/select/select.js +629 -0
  330. package/dist/components/forms/select/select.js.map +1 -0
  331. package/dist/components/forms/select/selected-items.js +63 -0
  332. package/dist/components/forms/select/selected-items.js.map +1 -0
  333. package/dist/components/forms/select/trigger.js +30 -0
  334. package/dist/components/forms/select/trigger.js.map +1 -0
  335. package/dist/components/forms/select/types.js +2 -0
  336. package/dist/components/forms/select/types.js.map +1 -0
  337. package/dist/components/forms/select.js +2 -0
  338. package/dist/components/forms/select.js.map +1 -0
  339. package/dist/components/forms/switch.js +63 -0
  340. package/dist/components/forms/switch.js.map +1 -0
  341. package/dist/components/forms/textarea.js +53 -0
  342. package/dist/components/forms/textarea.js.map +1 -0
  343. package/dist/components/navigation/external-link.js +107 -0
  344. package/dist/components/navigation/external-link.js.map +1 -0
  345. package/dist/components/navigation/index.js +9 -0
  346. package/dist/components/navigation/index.js.map +1 -0
  347. package/dist/components/navigation/pagination/icons.js +23 -0
  348. package/dist/components/navigation/pagination/icons.js.map +1 -0
  349. package/dist/components/navigation/pagination/pagination.js +216 -0
  350. package/dist/components/navigation/pagination/pagination.js.map +1 -0
  351. package/dist/components/navigation/pagination/range.js +58 -0
  352. package/dist/components/navigation/pagination/range.js.map +1 -0
  353. package/dist/components/navigation/pagination.js +3 -0
  354. package/dist/components/navigation/pagination.js.map +1 -0
  355. package/dist/components/navigation/tab-nav/item.js +90 -0
  356. package/dist/components/navigation/tab-nav/item.js.map +1 -0
  357. package/dist/components/navigation/tab-nav/tab-nav.js +79 -0
  358. package/dist/components/navigation/tab-nav/tab-nav.js.map +1 -0
  359. package/dist/components/navigation/tab-nav.js +3 -0
  360. package/dist/components/navigation/tab-nav.js.map +1 -0
  361. package/dist/components/navigation/tabs/panel.js +23 -0
  362. package/dist/components/navigation/tabs/panel.js.map +1 -0
  363. package/dist/components/navigation/tabs/tab.js +45 -0
  364. package/dist/components/navigation/tabs/tab.js.map +1 -0
  365. package/dist/components/navigation/tabs/tabs.js +156 -0
  366. package/dist/components/navigation/tabs/tabs.js.map +1 -0
  367. package/dist/components/navigation/tabs.js +4 -0
  368. package/dist/components/navigation/tabs.js.map +1 -0
  369. package/dist/components/notifications/index.js +5 -0
  370. package/dist/components/notifications/index.js.map +1 -0
  371. package/dist/components/notifications/notification-card.js +16 -0
  372. package/dist/components/notifications/notification-card.js.map +1 -0
  373. package/dist/components/notifications/notifications-container.js +269 -0
  374. package/dist/components/notifications/notifications-container.js.map +1 -0
  375. package/dist/components/overlays/backdrop.js +44 -0
  376. package/dist/components/overlays/backdrop.js.map +1 -0
  377. package/dist/components/overlays/drawer/body.js +18 -0
  378. package/dist/components/overlays/drawer/body.js.map +1 -0
  379. package/dist/components/overlays/drawer/drag-handle.js +18 -0
  380. package/dist/components/overlays/drawer/drag-handle.js.map +1 -0
  381. package/dist/components/overlays/drawer/footer.js +18 -0
  382. package/dist/components/overlays/drawer/footer.js.map +1 -0
  383. package/dist/components/overlays/drawer/header.js +61 -0
  384. package/dist/components/overlays/drawer/header.js.map +1 -0
  385. package/dist/components/overlays/drawer/selectors.js +29 -0
  386. package/dist/components/overlays/drawer/selectors.js.map +1 -0
  387. package/dist/components/overlays/drawer.js +175 -0
  388. package/dist/components/overlays/drawer.js.map +1 -0
  389. package/dist/components/overlays/index.js +15 -0
  390. package/dist/components/overlays/index.js.map +1 -0
  391. package/dist/components/overlays/modal/body.js +18 -0
  392. package/dist/components/overlays/modal/body.js.map +1 -0
  393. package/dist/components/overlays/modal/footer.js +18 -0
  394. package/dist/components/overlays/modal/footer.js.map +1 -0
  395. package/dist/components/overlays/modal/header.js +25 -0
  396. package/dist/components/overlays/modal/header.js.map +1 -0
  397. package/dist/components/overlays/modal.js +129 -0
  398. package/dist/components/overlays/modal.js.map +1 -0
  399. package/dist/components/overlays/mount-animation.js +146 -0
  400. package/dist/components/overlays/mount-animation.js.map +1 -0
  401. package/dist/components/overlays/overlay.js +321 -0
  402. package/dist/components/overlays/overlay.js.map +1 -0
  403. package/dist/components/overlays/popover.js +647 -0
  404. package/dist/components/overlays/popover.js.map +1 -0
  405. package/dist/components/overlays/portal-target.js +10 -0
  406. package/dist/components/overlays/portal-target.js.map +1 -0
  407. package/dist/components/overlays/portal.js +111 -0
  408. package/dist/components/overlays/portal.js.map +1 -0
  409. package/dist/components/overlays/tooltip.js +377 -0
  410. package/dist/components/overlays/tooltip.js.map +1 -0
  411. package/dist/components/status/alert.js +146 -0
  412. package/dist/components/status/alert.js.map +1 -0
  413. package/dist/components/status/index.js +3 -0
  414. package/dist/components/status/index.js.map +1 -0
  415. package/dist/components/status/progress-bar.js +126 -0
  416. package/dist/components/status/progress-bar.js.map +1 -0
  417. package/dist/components/utilities/avatar.js +48 -0
  418. package/dist/components/utilities/avatar.js.map +1 -0
  419. package/dist/components/utilities/collapsible.js +210 -0
  420. package/dist/components/utilities/collapsible.js.map +1 -0
  421. package/dist/components/utilities/divider.js +37 -0
  422. package/dist/components/utilities/divider.js.map +1 -0
  423. package/dist/components/utilities/index.js +16 -0
  424. package/dist/components/utilities/index.js.map +1 -0
  425. package/dist/components/utilities/kbd.js +88 -0
  426. package/dist/components/utilities/kbd.js.map +1 -0
  427. package/dist/components/utilities/skeleton.js +14 -0
  428. package/dist/components/utilities/skeleton.js.map +1 -0
  429. package/dist/components/utilities/spinner.js +14 -0
  430. package/dist/components/utilities/spinner.js.map +1 -0
  431. package/dist/components/utilities/visually-hidden.js +10 -0
  432. package/dist/components/utilities/visually-hidden.js.map +1 -0
  433. package/dist/control-blur-C8OnSQR5.js +124 -0
  434. package/dist/control-blur-C8OnSQR5.js.map +1 -0
  435. package/dist/dialog-CreV7aPQ.js +27 -0
  436. package/dist/dialog-CreV7aPQ.js.map +1 -0
  437. package/dist/disclosure.js +3 -0
  438. package/dist/disclosure.js.map +1 -0
  439. package/dist/dom-cKWVvtkd.js +116 -0
  440. package/dist/dom-cKWVvtkd.js.map +1 -0
  441. package/dist/forms.js +20 -0
  442. package/dist/forms.js.map +1 -0
  443. package/dist/index.js +83 -7
  444. package/dist/index.js.map +1 -1
  445. package/dist/intent-icons-DpEViO8C.js +19 -0
  446. package/dist/intent-icons-DpEViO8C.js.map +1 -0
  447. package/dist/manager-CDIZzrQ9.js +388 -0
  448. package/dist/manager-CDIZzrQ9.js.map +1 -0
  449. package/dist/modifiers/drag-to-dismiss.js +392 -0
  450. package/dist/modifiers/drag-to-dismiss.js.map +1 -0
  451. package/dist/modifiers/press.js +321 -0
  452. package/dist/modifiers/press.js.map +1 -0
  453. package/dist/navigation.js +9 -0
  454. package/dist/navigation.js.map +1 -0
  455. package/dist/notification-card-D5fd-Sxa.js +330 -0
  456. package/dist/notification-card-D5fd-Sxa.js.map +1 -0
  457. package/dist/notifications.js +5 -0
  458. package/dist/notifications.js.map +1 -0
  459. package/dist/overlays.js +15 -0
  460. package/dist/overlays.js.map +1 -0
  461. package/dist/runtime--fcdnjmJ-BOdRhmsS.js +67 -0
  462. package/dist/runtime--fcdnjmJ-BOdRhmsS.js.map +1 -0
  463. package/dist/services/notifications.js +38 -0
  464. package/dist/services/notifications.js.map +1 -0
  465. package/dist/status.js +3 -0
  466. package/dist/status.js.map +1 -0
  467. package/dist/test-support.js +1316 -0
  468. package/dist/test-support.js.map +1 -0
  469. package/dist/utilities.js +16 -0
  470. package/dist/utilities.js.map +1 -0
  471. package/dist/utils/deferred-work.js +66 -0
  472. package/dist/utils/deferred-work.js.map +1 -0
  473. package/dist/utils/filter.js +166 -0
  474. package/dist/utils/filter.js.map +1 -0
  475. package/dist/utils/forms-utils-index.js +24 -0
  476. package/dist/utils/forms-utils-index.js.map +1 -0
  477. package/dist/utils/keys.js +259 -0
  478. package/dist/utils/keys.js.map +1 -0
  479. package/dist/utils/listManager.js +759 -0
  480. package/dist/utils/listManager.js.map +1 -0
  481. package/dist/utils/nested-data.js +196 -0
  482. package/dist/utils/nested-data.js.map +1 -0
  483. package/dist/utils/prefers-reduced-motion.js +21 -0
  484. package/dist/utils/prefers-reduced-motion.js.map +1 -0
  485. package/dist/utils/ref.js +32 -0
  486. package/dist/utils/ref.js.map +1 -0
  487. package/dist/utils/roving-focus.js +206 -0
  488. package/dist/utils/roving-focus.js.map +1 -0
  489. package/dist/utils/safe-area.js +133 -0
  490. package/dist/utils/safe-area.js.map +1 -0
  491. package/dist/utils/safe-styles.js +15 -0
  492. package/dist/utils/safe-styles.js.map +1 -0
  493. package/dist/utils/selection-indicator.js +189 -0
  494. package/dist/utils/selection-indicator.js.map +1 -0
  495. package/dist/utils/standard-validator.js +232 -0
  496. package/dist/utils/standard-validator.js.map +1 -0
  497. package/dist/utils/toggle.js +46 -0
  498. package/dist/utils/toggle.js.map +1 -0
  499. package/package.json +77 -21
@@ -0,0 +1,1316 @@
1
+ import '@ember/application';
2
+ import { VERSION } from '@ember/version';
3
+ import { _backburner } from '@ember/runloop';
4
+ import EmberObject from '@ember/object';
5
+ import '@ember/application/instance';
6
+ import '@ember/-internals/container';
7
+ import { RegistryProxyMixin, ContainerProxyMixin } from '@ember/-internals/runtime';
8
+ import { Test } from 'ember-testing';
9
+ import '@ember/-internals/error-handling';
10
+ import { registerDeprecationHandler, registerWarnHandler } from '@ember/debug';
11
+ import { getPendingWaiterState, hasPendingWaiters } from '@ember/test-waiters';
12
+ import '@ember/destroyable';
13
+ import '@ember/-internals/views';
14
+ import '@glimmer/manager';
15
+ import { precompileTemplate } from '@ember/template-compilation';
16
+ import { macroCondition, dependencySatisfies, importSync } from '@embroider/macros';
17
+ export { setPrefersReducedMotion } from './utils/prefers-reduced-motion.js';
18
+
19
+ // @ts-ignore
20
+
21
+ /**
22
+ Checks if the currently running Ember version is greater than or equal to the
23
+ specified major and minor version numbers.
24
+
25
+ @private
26
+ @param {number} major the major version number to compare
27
+ @param {number} minor the minor version number to compare
28
+ @returns {boolean} true if the Ember version is >= MAJOR.MINOR specified, false otherwise
29
+ */
30
+ function hasEmberVersion(major, minor) {
31
+ const numbers = VERSION.split('-')[0]?.split('.');
32
+ if (!numbers || !numbers[0] || !numbers[1]) {
33
+ throw new Error('`Ember.VERSION` is not set.');
34
+ }
35
+ const actualMajor = parseInt(numbers[0], 10);
36
+ const actualMinor = parseInt(numbers[1], 10);
37
+ return actualMajor > major || actualMajor === major && actualMinor >= minor;
38
+ }
39
+
40
+ // NOTE: this is the same as what `EngineInstance`/`ApplicationInstance`
41
+ // implement, and is thus a superset of the `InternalOwner` contract from Ember
42
+ // itself.
43
+
44
+ EmberObject.extend(RegistryProxyMixin, ContainerProxyMixin, {
45
+ _emberTestHelpersMockOwner: true,
46
+ /* eslint-disable valid-jsdoc */
47
+ /**
48
+ * Unregister a factory and its instance.
49
+ *
50
+ * Overrides `RegistryProxy#unregister` in order to clear any cached instances
51
+ * of the unregistered factory.
52
+ *
53
+ * @param {string} fullName Name of the factory to unregister.
54
+ *
55
+ * @see {@link https://github.com/emberjs/ember.js/pull/12680}
56
+ * @see {@link https://github.com/emberjs/ember.js/blob/v4.5.0-alpha.5/packages/%40ember/engine/instance.ts#L152-L167}
57
+ */
58
+ /* eslint-enable valid-jsdoc */
59
+ unregister(fullName) {
60
+ // SAFETY: this is always present, but only the stable type definitions from
61
+ // Ember actually preserve it, since it is private API.
62
+ this['__container__'].reset(fullName);
63
+
64
+ // We overwrote this method from RegistryProxyMixin.
65
+ // SAFETY: this is always present, but only the stable type definitions from
66
+ // Ember actually preserve it, since it is private API.
67
+ this['__registry__'].unregister(fullName);
68
+ }
69
+ });
70
+
71
+ // eslint-disable-next-line require-jsdoc
72
+ function isElement(target) {
73
+ return target !== null && typeof target === 'object' && Reflect.get(target, 'nodeType') === Node.ELEMENT_NODE;
74
+ }
75
+
76
+ // eslint-disable-next-line require-jsdoc
77
+ function isWindow(target) {
78
+ return target instanceof Window;
79
+ }
80
+
81
+ // eslint-disable-next-line require-jsdoc
82
+ function isDocument(target) {
83
+ return target !== null && typeof target === 'object' && Reflect.get(target, 'nodeType') === Node.DOCUMENT_NODE;
84
+ }
85
+
86
+ const FORM_CONTROL_TAGS = ['INPUT', 'BUTTON', 'SELECT', 'TEXTAREA'];
87
+ /**
88
+ @private
89
+ @param {Element} element the element to check
90
+ @returns {boolean} `true` when the element is a form control, `false` otherwise
91
+ */
92
+ function isFormControl(element) {
93
+ return !isWindow(element) && !isDocument(element) && FORM_CONTROL_TAGS.indexOf(element.tagName) > -1 && element.type !== 'hidden';
94
+ }
95
+
96
+ const futureTick = setTimeout;
97
+
98
+ const TIMEOUTS = [0, 1, 2, 5, 7];
99
+ const MAX_TIMEOUT = 10;
100
+ /**
101
+ Wait for the provided callback to return a truthy value.
102
+
103
+ This does not leverage `settled()`, and as such can be used to manage async
104
+ while _not_ settled (e.g. "loading" or "pending" states).
105
+
106
+ @public
107
+ @param {Function} callback the callback to use for testing when waiting should stop
108
+ @param {Object} [options] options used to override defaults
109
+ @param {number} [options.timeout=1000] the maximum amount of time to wait
110
+ @param {string} [options.timeoutMessage='waitUntil timed out'] the message to use in the reject on timeout
111
+ @returns {Promise} resolves with the callback value when it returns a truthy value
112
+
113
+ @example
114
+ <caption>
115
+ Waiting until a selected element displays text:
116
+ </caption>
117
+ await waitUntil(function() {
118
+ return find('.my-selector').textContent.includes('something')
119
+ }, { timeout: 2000 })
120
+ */
121
+ function waitUntil(callback, options = {}) {
122
+ const timeout = 'timeout' in options ? options.timeout : 1000;
123
+ const timeoutMessage = 'timeoutMessage' in options ? options.timeoutMessage : 'waitUntil timed out';
124
+
125
+ // creating this error eagerly so it has the proper invocation stack
126
+ const waitUntilTimedOut = new Error(timeoutMessage);
127
+ return new Promise(function (resolve, reject) {
128
+ let time = 0;
129
+
130
+ // eslint-disable-next-line require-jsdoc
131
+ function scheduleCheck(timeoutsIndex) {
132
+ const knownTimeout = TIMEOUTS[timeoutsIndex];
133
+ const interval = knownTimeout === undefined ? MAX_TIMEOUT : knownTimeout;
134
+ futureTick(function () {
135
+ time += interval;
136
+ let value;
137
+ try {
138
+ value = callback();
139
+ } catch (error) {
140
+ reject(error);
141
+ return;
142
+ }
143
+ if (value) {
144
+ resolve(value);
145
+ } else if (time < timeout) {
146
+ scheduleCheck(timeoutsIndex + 1);
147
+ } else {
148
+ reject(waitUntilTimedOut);
149
+ return;
150
+ }
151
+ }, interval);
152
+ }
153
+ scheduleCheck(0);
154
+ });
155
+ }
156
+
157
+ /* globals global */
158
+
159
+ var global$1 = (() => {
160
+ if (typeof self !== 'undefined') {
161
+ return self;
162
+ } else if (typeof window !== 'undefined') {
163
+ return window;
164
+ // @ts-ignore -- global does not exist
165
+ } else if (typeof global !== 'undefined') {
166
+ // @ts-ignore -- global does not exist
167
+ return global;
168
+ } else {
169
+ return Function('return this')();
170
+ }
171
+ })();
172
+
173
+ const DEPRECATIONS = new WeakMap();
174
+
175
+ /**
176
+ *
177
+ * Provides the list of deprecation failures associated with a given base context;
178
+ *
179
+ * @private
180
+ * @param {BaseContext} [context] the test context
181
+ * @return {Array<DeprecationFailure>} the Deprecation Failures associated with the corresponding BaseContext;
182
+ */
183
+ function getDeprecationsForContext(context) {
184
+ if (!context) {
185
+ throw new TypeError(`[@ember/test-helpers] could not get deprecations for an invalid test context: '${context}'`);
186
+ }
187
+ let deprecations = DEPRECATIONS.get(context);
188
+ if (!Array.isArray(deprecations)) {
189
+ deprecations = [];
190
+ DEPRECATIONS.set(context, deprecations);
191
+ }
192
+ return deprecations;
193
+ }
194
+
195
+ // This provides (when the environment supports) queryParam support for deprecations:
196
+ // * squelch deprecations by name via: `/tests/index.html?disabledDeprecations=this-property-fallback,some-other-thing`
197
+ // * enable a debuggger when a deprecation by a specific name is encountered via: `/tests/index.html?debugDeprecations=some-other-thing` when the
198
+ if (typeof URLSearchParams !== 'undefined') {
199
+ const queryParams = new URLSearchParams(document.location.search.substring(1));
200
+ const disabledDeprecations = queryParams.get('disabledDeprecations');
201
+ const debugDeprecations = queryParams.get('debugDeprecations');
202
+
203
+ // When using `/tests/index.html?disabledDeprecations=this-property-fallback,some-other-thing`
204
+ // those deprecations will be squelched
205
+ if (disabledDeprecations) {
206
+ registerDeprecationHandler((message, options, next) => {
207
+ if (!options || !disabledDeprecations.includes(options.id)) {
208
+ next.apply(null, [message, options]);
209
+ }
210
+ });
211
+ }
212
+
213
+ // When using `/tests/index.html?debugDeprecations=some-other-thing` when the
214
+ // `some-other-thing` deprecation is triggered, this `debugger` will be hit`
215
+ if (debugDeprecations) {
216
+ registerDeprecationHandler((message, options, next) => {
217
+ if (options && debugDeprecations.includes(options.id)) {
218
+ debugger; // eslint-disable-line no-debugger
219
+ }
220
+ next.apply(null, [message, options]);
221
+ });
222
+ }
223
+ }
224
+
225
+ // the WARNINGS data structure which is used to weakly associated warnings with
226
+ // the test context their occurred within
227
+ const WARNINGS = new WeakMap();
228
+
229
+ /**
230
+ *
231
+ * Provides the list of warnings associated with a given base context;
232
+ *
233
+ * @private
234
+ * @param {BaseContext} [context] the test context
235
+ * @return {Array<Warning>} the warnings associated with the corresponding BaseContext;
236
+ */
237
+ function getWarningsForContext(context) {
238
+ if (!context) {
239
+ throw new TypeError(`[@ember/test-helpers] could not get warnings for an invalid test context: '${context}'`);
240
+ }
241
+ let warnings = WARNINGS.get(context);
242
+ if (!Array.isArray(warnings)) {
243
+ warnings = [];
244
+ WARNINGS.set(context, warnings);
245
+ }
246
+ return warnings;
247
+ }
248
+
249
+ // This provides (when the environment supports) queryParam support for warnings:
250
+ // * squelch warnings by name via: `/tests/index.html?disabledWarnings=this-property-fallback,some-other-thing`
251
+ // * enable a debuggger when a warning by a specific name is encountered via: `/tests/index.html?debugWarnings=some-other-thing` when the
252
+ if (typeof URLSearchParams !== 'undefined') {
253
+ const queryParams = new URLSearchParams(document.location.search.substring(1));
254
+ const disabledWarnings = queryParams.get('disabledWarnings');
255
+ const debugWarnings = queryParams.get('debugWarnings');
256
+
257
+ // When using `/tests/index.html?disabledWarnings=this-property-fallback,some-other-thing`
258
+ // those warnings will be squelched
259
+ if (disabledWarnings) {
260
+ registerWarnHandler((message, options, next) => {
261
+ if (!options || !disabledWarnings.includes(options.id)) {
262
+ next.apply(null, [message, options]);
263
+ }
264
+ });
265
+ }
266
+
267
+ // When using `/tests/index.html?debugWarnings=some-other-thing` when the
268
+ // `some-other-thing` warning is triggered, this `debugger` will be hit`
269
+ if (debugWarnings) {
270
+ registerWarnHandler((message, options, next) => {
271
+ if (options && debugWarnings.includes(options.id)) {
272
+ debugger; // eslint-disable-line no-debugger
273
+ }
274
+ next.apply(null, [message, options]);
275
+ });
276
+ }
277
+ }
278
+
279
+ const registeredHooks = new Map();
280
+
281
+ /**
282
+ * @private
283
+ * @param {string} helperName The name of the test helper in which to run the hook.
284
+ * @param {string} label A label to help identify the hook.
285
+ * @returns {string} The compound key for the helper.
286
+ */
287
+ function getHelperKey(helperName, label) {
288
+ return `${helperName}:${label}`;
289
+ }
290
+
291
+ /**
292
+ * Registers a function to be run during the invocation of a test helper.
293
+ *
294
+ * @param {string} helperName The name of the test helper in which to run the hook.
295
+ * Test helper names include `blur`, `click`, `doubleClick`, `fillIn`,
296
+ * `fireEvent`, `focus`, `render`, `scrollTo`, `select`, `tab`, `tap`, `triggerEvent`,
297
+ * `triggerKeyEvent`, `typeIn`, and `visit`.
298
+ * @param {string} label A label to help identify the hook. Built-in labels include `start`, `end`,
299
+ * and `targetFound`, the former designating either the start or end of
300
+ * the helper invocation.
301
+ * @param {Function} hook The hook function to run when the test helper is invoked.
302
+ * @returns {HookUnregister} An object containing an `unregister` function that unregisters
303
+ * the specific hook initially registered to the helper.
304
+ * @example
305
+ * <caption>
306
+ * Registering a hook for the `end` point of the `click` test helper invocation
307
+ * </caption>
308
+ *
309
+ * const hook = registerHook('click', 'end', () => {
310
+ * console.log('Running `click:end` test helper hook');
311
+ * });
312
+ *
313
+ * // Unregister the hook at some later point in time
314
+ * hook.unregister();
315
+ */
316
+ function registerHook(helperName, label, hook) {
317
+ const helperKey = getHelperKey(helperName, label);
318
+ let hooksForHelper = registeredHooks.get(helperKey);
319
+ if (hooksForHelper === undefined) {
320
+ hooksForHelper = new Set();
321
+ registeredHooks.set(helperKey, hooksForHelper);
322
+ }
323
+ hooksForHelper.add(hook);
324
+ return {
325
+ unregister() {
326
+ hooksForHelper.delete(hook);
327
+ }
328
+ };
329
+ }
330
+
331
+ /**
332
+ * Runs all hooks registered for a specific test helper.
333
+ *
334
+ * @param {string} helperName The name of the test helper in which to run the hook.
335
+ * Test helper names include `blur`, `click`, `doubleClick`, `fillIn`,
336
+ * `fireEvent`, `focus`, `render`, `scrollTo`, `select`, `tab`, `tap`, `triggerEvent`,
337
+ * `triggerKeyEvent`, `typeIn`, and `visit`.
338
+ * @param {string} label A label to help identify the hook. Built-in labels include `start`, `end`,
339
+ * and `targetFound`, the former designating either the start or end of
340
+ * the helper invocation.
341
+ * @param {unknown[]} args Any arguments originally passed to the test helper.
342
+ * @returns {Promise<void>} A promise representing the serial invocation of the hooks.
343
+ */
344
+ function runHooks(helperName, label, ...args) {
345
+ const hooks = registeredHooks.get(getHelperKey(helperName, label)) || new Set();
346
+ const promises = [];
347
+ hooks.forEach(hook => {
348
+ const hookResult = hook(...args);
349
+ promises.push(hookResult);
350
+ });
351
+ return Promise.all(promises).then(() => {});
352
+ }
353
+
354
+ const debugInfoHelpers = new Set();
355
+
356
+ // @ts-ignore: this is private API. This import will work Ember 5.1+ since it
357
+ // "provides" this public API, but does not for earlier versions. As a result,
358
+ // this type will be `any`.
359
+ const PENDING_AJAX_REQUESTS = 'Pending AJAX requests';
360
+ const PENDING_TEST_WAITERS = 'Pending test waiters';
361
+ const SCHEDULED_ASYNC = 'Scheduled async';
362
+ const SCHEDULED_AUTORUN = 'Scheduled autorun';
363
+
364
+ /**
365
+ * The base functionality which may be present on the `SettledState` interface
366
+ * in the `settled` module (**not** the one in this module).
367
+ */
368
+
369
+ /**
370
+ * Determines if the `getDebugInfo` method is available in the
371
+ * running verison of backburner.
372
+ *
373
+ * @returns {boolean} True if `getDebugInfo` is present in backburner, otherwise false.
374
+ */
375
+ function backburnerDebugInfoAvailable() {
376
+ return typeof _backburner.getDebugInfo === 'function';
377
+ }
378
+
379
+ /**
380
+ * Retrieves debug information from backburner's current deferred actions queue (runloop instance).
381
+ * If the `getDebugInfo` method isn't available, it returns `null`.
382
+ *
383
+ * @public
384
+ * @returns {MaybeDebugInfo | null} Backburner debugInfo or, if the getDebugInfo method is not present, null
385
+ */
386
+ function getDebugInfo() {
387
+ return _backburner.DEBUG === true && backburnerDebugInfoAvailable() ? _backburner.getDebugInfo() : null;
388
+ }
389
+
390
+ /**
391
+ * Encapsulates debug information for an individual test. Aggregates information
392
+ * from:
393
+ * - info provided by getSettledState
394
+ * - hasPendingTimers
395
+ * - hasRunLoop
396
+ * - hasPendingWaiters
397
+ * - hasPendingRequests
398
+ * - info provided by backburner's getDebugInfo method (timers, schedules, and stack trace info)
399
+ *
400
+ */
401
+ class TestDebugInfo {
402
+ _settledState;
403
+ _debugInfo;
404
+ _summaryInfo = undefined;
405
+ constructor(settledState, debugInfo = getDebugInfo()) {
406
+ this._settledState = settledState;
407
+ this._debugInfo = debugInfo;
408
+ }
409
+ get summary() {
410
+ if (!this._summaryInfo) {
411
+ this._summaryInfo = {
412
+ ...this._settledState
413
+ };
414
+ if (this._debugInfo) {
415
+ this._summaryInfo.autorunStackTrace = this._debugInfo.autorun && this._debugInfo.autorun.stack;
416
+ this._summaryInfo.pendingTimersCount = this._debugInfo.timers.length;
417
+ this._summaryInfo.hasPendingTimers = this._settledState.hasPendingTimers && this._summaryInfo.pendingTimersCount > 0;
418
+ this._summaryInfo.pendingTimersStackTraces = this._debugInfo.timers.map(timer => timer.stack);
419
+ this._summaryInfo.pendingScheduledQueueItemCount = this._debugInfo.instanceStack.filter(isNotNullable).reduce((total, item) => {
420
+ Object.values(item).forEach(queueItems => {
421
+ // SAFETY: this cast is required for versions of Ember which do
422
+ // not supply a correct definition of these types. It should
423
+ // also be compatible with the version where Ember *does* supply
424
+ // the types correctly.
425
+ total += queueItems?.length ?? 0;
426
+ });
427
+ return total;
428
+ }, 0);
429
+ this._summaryInfo.pendingScheduledQueueItemStackTraces = this._debugInfo.instanceStack.filter(isNotNullable).reduce((stacks, deferredActionQueues) => {
430
+ Object.values(deferredActionQueues).forEach(queueItems => {
431
+ // SAFETY: this cast is required for versions of Ember which do
432
+ // not supply a correct definition of these types. It should
433
+ // also be compatible with the version where Ember *does* supply
434
+ // the types correctly.
435
+ queueItems?.forEach(queueItem => queueItem.stack && stacks.push(queueItem.stack));
436
+ });
437
+ return stacks;
438
+ }, []);
439
+ }
440
+ if (this._summaryInfo.hasPendingTestWaiters) {
441
+ this._summaryInfo.pendingTestWaiterInfo = getPendingWaiterState();
442
+ }
443
+ }
444
+ return this._summaryInfo;
445
+ }
446
+ toConsole(_console = console) {
447
+ const summary = this.summary;
448
+ if (summary.hasPendingRequests) {
449
+ _console.log(PENDING_AJAX_REQUESTS);
450
+ }
451
+ if (summary.hasPendingLegacyWaiters) {
452
+ _console.log(PENDING_TEST_WAITERS);
453
+ }
454
+ if (summary.hasPendingTestWaiters) {
455
+ if (!summary.hasPendingLegacyWaiters) {
456
+ _console.log(PENDING_TEST_WAITERS);
457
+ }
458
+ Object.keys(summary.pendingTestWaiterInfo.waiters).forEach(waiterName => {
459
+ const waiterDebugInfo = summary.pendingTestWaiterInfo.waiters[waiterName];
460
+ if (Array.isArray(waiterDebugInfo)) {
461
+ _console.group(waiterName);
462
+ waiterDebugInfo.forEach(debugInfo => {
463
+ _console.log(`${debugInfo.label ? debugInfo.label : 'stack'}: ${debugInfo.stack}`);
464
+ });
465
+ _console.groupEnd();
466
+ } else {
467
+ _console.log(waiterName);
468
+ }
469
+ });
470
+ }
471
+ if (summary.hasPendingTimers || summary.pendingScheduledQueueItemCount > 0) {
472
+ _console.group(SCHEDULED_ASYNC);
473
+ summary.pendingTimersStackTraces.forEach(timerStack => {
474
+ _console.log(timerStack);
475
+ });
476
+ summary.pendingScheduledQueueItemStackTraces.forEach(scheduleQueueItemStack => {
477
+ _console.log(scheduleQueueItemStack);
478
+ });
479
+ _console.groupEnd();
480
+ }
481
+ if (summary.hasRunLoop && summary.pendingTimersCount === 0 && summary.pendingScheduledQueueItemCount === 0) {
482
+ _console.log(SCHEDULED_AUTORUN);
483
+ if (summary.autorunStackTrace) {
484
+ _console.log(summary.autorunStackTrace);
485
+ }
486
+ }
487
+ debugInfoHelpers.forEach(helper => {
488
+ helper.log();
489
+ });
490
+ }
491
+ _formatCount(title, count) {
492
+ return `${title}: ${count}`;
493
+ }
494
+ }
495
+
496
+ // eslint-disable-next-line require-jsdoc, @typescript-eslint/no-empty-object-type
497
+ function isNotNullable(value) {
498
+ return value != null;
499
+ }
500
+
501
+ const CAN_USE_ROUTER_EVENTS = hasEmberVersion(3, 6);
502
+ let routerTransitionsPending = null;
503
+ const ROUTER = new WeakMap();
504
+
505
+ /**
506
+ Determines if we have any pending router transitions (used to determine `settled` state)
507
+
508
+ @public
509
+ @returns {(boolean|null)} if there are pending transitions
510
+ */
511
+ function hasPendingTransitions() {
512
+ if (CAN_USE_ROUTER_EVENTS) {
513
+ return routerTransitionsPending;
514
+ }
515
+ const context = getContext();
516
+
517
+ // there is no current context, we cannot check
518
+ if (context === undefined) {
519
+ return null;
520
+ }
521
+ const router = ROUTER.get(context);
522
+ if (router === undefined) {
523
+ // if there is no router (e.g. no `visit` calls made yet), we cannot
524
+ // check for pending transitions but this is explicitly not an error
525
+ // condition
526
+ return null;
527
+ }
528
+ const routerMicrolib = router._routerMicrolib || router.router;
529
+ if (routerMicrolib === undefined) {
530
+ return null;
531
+ }
532
+ return !!routerMicrolib.activeTransition;
533
+ }
534
+ hasEmberVersion(2, 13);
535
+ const checkWaiters = Test.checkWaiters;
536
+
537
+ /**
538
+ @private
539
+ @returns {number} the count of pending requests
540
+ */
541
+ function pendingRequests() {
542
+ return 0;
543
+ }
544
+ /**
545
+ Check various settledness metrics, and return an object with the following properties:
546
+
547
+ - `hasRunLoop` - Checks if a run-loop has been started. If it has, this will
548
+ be `true` otherwise it will be `false`.
549
+ - `hasPendingTimers` - Checks if there are scheduled timers in the run-loop.
550
+ These pending timers are primarily registered by `Ember.run.schedule`. If
551
+ there are pending timers, this will be `true`, otherwise `false`.
552
+ - `hasPendingWaiters` - Checks if any registered test waiters are still
553
+ pending (e.g. the waiter returns `true`). If there are pending waiters,
554
+ this will be `true`, otherwise `false`.
555
+ - `hasPendingRequests` - Checks if there are pending AJAX requests (based on
556
+ `ajaxSend` / `ajaxComplete` events triggered by `jQuery.ajax`). If there
557
+ are pending requests, this will be `true`, otherwise `false`.
558
+ - `hasPendingTransitions` - Checks if there are pending route transitions. If the
559
+ router has not been instantiated / setup for the test yet this will return `null`,
560
+ if there are pending transitions, this will be `true`, otherwise `false`.
561
+ - `pendingRequestCount` - The count of pending AJAX requests.
562
+ - `debugInfo` - Debug information that's combined with info return from backburner's
563
+ getDebugInfo method.
564
+ - `isRenderPending` - Checks if there are any pending render operations. This will be true as long
565
+ as there are tracked values in the template that have not been rerendered yet.
566
+
567
+ @public
568
+ @returns {Object} object with properties for each of the metrics used to determine settledness
569
+ */
570
+ function getSettledState() {
571
+ const hasPendingTimers = _backburner.hasTimers();
572
+ const hasRunLoop = Boolean(_backburner.currentInstance);
573
+ const hasPendingLegacyWaiters = checkWaiters();
574
+ const hasPendingTestWaiters = hasPendingWaiters();
575
+ const pendingRequestCount = pendingRequests();
576
+ const hasPendingRequests = pendingRequestCount > 0;
577
+ // TODO: Ideally we'd have a function in Ember itself that can synchronously identify whether
578
+ // or not there are any pending render operations, but this will have to suffice for now
579
+ const isRenderPending = !!hasRunLoop;
580
+ return {
581
+ hasPendingTimers,
582
+ hasRunLoop,
583
+ hasPendingWaiters: hasPendingLegacyWaiters || hasPendingTestWaiters,
584
+ hasPendingRequests,
585
+ hasPendingTransitions: hasPendingTransitions(),
586
+ isRenderPending,
587
+ pendingRequestCount,
588
+ debugInfo: new TestDebugInfo({
589
+ hasPendingTimers,
590
+ hasRunLoop,
591
+ hasPendingLegacyWaiters,
592
+ hasPendingTestWaiters,
593
+ hasPendingRequests,
594
+ isRenderPending
595
+ })
596
+ };
597
+ }
598
+
599
+ /**
600
+ Checks various settledness metrics (via `getSettledState()`) to determine if things are settled or not.
601
+
602
+ Settled generally means that there are no pending timers, no pending waiters,
603
+ no pending AJAX requests, and no current run loop. However, new settledness
604
+ metrics may be added and used as they become available.
605
+
606
+ @public
607
+ @returns {boolean} `true` if settled, `false` otherwise
608
+ */
609
+ function isSettled() {
610
+ const {
611
+ hasPendingTimers,
612
+ hasRunLoop,
613
+ hasPendingRequests,
614
+ hasPendingWaiters,
615
+ hasPendingTransitions,
616
+ isRenderPending
617
+ } = getSettledState();
618
+ if (hasPendingTimers || hasRunLoop || hasPendingRequests || hasPendingWaiters || hasPendingTransitions || isRenderPending) {
619
+ return false;
620
+ }
621
+ return true;
622
+ }
623
+
624
+ /**
625
+ Returns a promise that resolves when in a settled state (see `isSettled` for
626
+ a definition of "settled state").
627
+
628
+ @public
629
+ @returns {Promise<void>} resolves when settled
630
+ */
631
+ function settled() {
632
+ return waitUntil(isSettled, {
633
+ timeout: Infinity
634
+ }).then(() => {});
635
+ }
636
+
637
+ // @ts-ignore: this is private API. This import will work Ember 5.1+ since it
638
+ // "provides" this public API, but does not for earlier versions. As a result,
639
+ // this type will be `any`.
640
+ // This handler exists to provide the underlying data to enable the following methods:
641
+ // * getDeprecations()
642
+ // * getDeprecationsDuringCallback()
643
+ // * getDeprecationsDuringCallbackForContext()
644
+ registerDeprecationHandler((message, options, next) => {
645
+ const context = getContext();
646
+ if (context === undefined) {
647
+ next.apply(null, [message, options]);
648
+ return;
649
+ }
650
+ getDeprecationsForContext(context).push({
651
+ message,
652
+ options
653
+ });
654
+ next.apply(null, [message, options]);
655
+ });
656
+
657
+ // This handler exists to provide the underlying data to enable the following methods:
658
+ // * getWarnings()
659
+ // * getWarningsDuringCallback()
660
+ // * getWarningsDuringCallbackForContext()
661
+ registerWarnHandler((message, options, next) => {
662
+ const context = getContext();
663
+ if (context === undefined) {
664
+ next.apply(null, [message, options]);
665
+ return;
666
+ }
667
+ getWarningsForContext(context).push({
668
+ message,
669
+ options
670
+ });
671
+ next.apply(null, [message, options]);
672
+ });
673
+
674
+ /**
675
+ * The public API for the test context, which test authors can depend on being
676
+ * available.
677
+ *
678
+ * Note: this is *not* user-constructible; it becomes available by calling
679
+ * `setupContext()` with a base context object.
680
+ */
681
+
682
+ // eslint-disable-next-line require-jsdoc
683
+ function isTestContext(context) {
684
+ const maybeContext = context;
685
+ return typeof maybeContext['pauseTest'] === 'function' && typeof maybeContext['resumeTest'] === 'function';
686
+ }
687
+
688
+ /**
689
+ @private
690
+ @param {Object} it the global object to test
691
+ @returns {Boolean} it exists
692
+ */
693
+ function check(it) {
694
+ // Math is known to exist as a global in every environment.
695
+ return it && it.Math === Math && it;
696
+ }
697
+ const globalObject = check(typeof globalThis == 'object' && globalThis) || check(typeof window === 'object' && window) || check(typeof self === 'object' && self) ||
698
+ // @ts-ignore -- global does not exist
699
+ check(typeof global$1 === 'object' && global$1);
700
+
701
+ /**
702
+ Retrieve the "global testing context" as stored by `setContext`.
703
+
704
+ @public
705
+ @returns {Object} the previously stored testing context
706
+ */
707
+ function getContext() {
708
+ return globalObject.__test_context__;
709
+ }
710
+
711
+ /**
712
+ Get the root element of the application under test (usually `#ember-testing`)
713
+
714
+ @public
715
+ @returns {Element} the root element
716
+
717
+ @example
718
+ <caption>
719
+ Getting the root element of the application and checking that it is equal
720
+ to the element with id 'ember-testing'.
721
+ </caption>
722
+ assert.equal(getRootElement(), document.querySelector('#ember-testing'));
723
+ */
724
+ function getRootElement() {
725
+ const context = getContext();
726
+ if (!context || !isTestContext(context) || !context.owner) {
727
+ throw new Error('Must setup rendering context before attempting to interact with elements.');
728
+ }
729
+ const owner = context.owner;
730
+ let rootElement;
731
+ // When the host app uses `setApplication` (instead of `setResolver`) the owner has
732
+ // a `rootElement` set on it with the element or id to be used
733
+ if (owner && owner._emberTestHelpersMockOwner === undefined) {
734
+ rootElement = owner.rootElement;
735
+ } else {
736
+ rootElement = '#ember-testing';
737
+ }
738
+ if (rootElement instanceof Window) {
739
+ rootElement = rootElement.document;
740
+ }
741
+ if (isElement(rootElement) || isDocument(rootElement)) {
742
+ return rootElement;
743
+ } else if (typeof rootElement === 'string') {
744
+ const _rootElement = document.querySelector(rootElement);
745
+ if (_rootElement) {
746
+ return _rootElement;
747
+ }
748
+ throw new Error(`Application.rootElement (${rootElement}) not found`);
749
+ } else {
750
+ throw new Error('Application.rootElement must be an element or a selector string');
751
+ }
752
+ }
753
+
754
+ precompileTemplate("{{outlet}}", {
755
+ strictMode: false
756
+ });
757
+ precompileTemplate("", {
758
+ strictMode: false
759
+ });
760
+ precompileTemplate("<this.ProvidedComponent />", {
761
+ strictMode: false
762
+ });
763
+
764
+ if (macroCondition(dependencySatisfies('ember-source', '>=4.5.0-beta.1'))) {
765
+ //@ts-ignore
766
+ importSync('@ember/renderer').renderSettled;
767
+ } else {
768
+ //@ts-ignore
769
+ importSync('@ember/-internals/glimmer').renderSettled;
770
+ }
771
+
772
+ const IS_DESCRIPTOR = '__dom_element_descriptor_is_descriptor__';
773
+
774
+ /**
775
+ * Determine if the argument is an {@link IDOMElementDescriptor}.
776
+ *
777
+ * This does not check if the argument is registered, just that it's type is
778
+ * {@link IDOMElementDescriptor}.
779
+ */
780
+ function isDescriptor(target) {
781
+ return Boolean(typeof target === 'object' && target && IS_DESCRIPTOR in target);
782
+ }
783
+
784
+ /**
785
+ * Get the registry instance.
786
+ *
787
+ * We store it on the window to ensure that if some dependency/hoisting horkage
788
+ * results in the presence of multiple copies of this library, they are all
789
+ * using the same registry.
790
+ *
791
+ * @returns the registry
792
+ */
793
+ function getRegistry() {
794
+ const win = window;
795
+ win.domElementDescriptorsRegistry = win.domElementDescriptorsRegistry || new WeakMap();
796
+ return win.domElementDescriptorsRegistry;
797
+ }
798
+ /**
799
+ * Look up registered descriptor data
800
+ *
801
+ * @param descriptor the descriptor
802
+ * @returns the descriptor's data, or null if none is set
803
+ */
804
+ function lookupDescriptorData(descriptor) {
805
+ return getRegistry().get(descriptor) || null;
806
+ }
807
+
808
+ /**
809
+ * Given a descriptor or descriptor data, get the single/first element it would
810
+ * match.
811
+ *
812
+ * This is analogous to `querySelector()`, and is meant to be used by DOM helper
813
+ * libraries to resolve the targets of single-element operations.
814
+ *
815
+ * @param target the descriptor or descriptor data
816
+ * @returns the resolved DOM element, or null if no element matched
817
+ */
818
+ function resolveDOMElement(target) {
819
+ let data = isDescriptor(target) ? lookupDescriptorData(target) : target;
820
+ if (!data) {
821
+ return null;
822
+ }
823
+ if (data.element !== undefined) {
824
+ return data.element;
825
+ } else {
826
+ for (let element of data.elements || []) {
827
+ return element;
828
+ }
829
+ return null;
830
+ }
831
+ }
832
+
833
+ /**
834
+ Used internally by the DOM interaction helpers to find one element.
835
+
836
+ @private
837
+ @param {string|Element} target the element or selector to retrieve
838
+ @returns {Element} the target or selector
839
+ */
840
+ function getElement(target) {
841
+ if (typeof target === 'string') {
842
+ const rootElement = getRootElement();
843
+ return rootElement.querySelector(target);
844
+ } else if (isElement(target) || isDocument(target)) {
845
+ return target;
846
+ } else if (target instanceof Window) {
847
+ return target.document;
848
+ } else {
849
+ const descriptorData = lookupDescriptorData(target);
850
+ if (descriptorData) {
851
+ return resolveDOMElement(descriptorData);
852
+ } else {
853
+ throw new Error('Must use an element, selector string, or DOM element descriptor');
854
+ }
855
+ }
856
+ }
857
+
858
+ /**
859
+ Used internally by the DOM interaction helpers to find either window or an element.
860
+
861
+ @private
862
+ @param {string|Element} target the window, an element or selector to retrieve
863
+ @returns {Element|Window} the target or selector
864
+ */
865
+ function getWindowOrElement(target) {
866
+ if (isWindow(target)) {
867
+ return target;
868
+ }
869
+ return getElement(target);
870
+ }
871
+
872
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
873
+
874
+ // eslint-disable-next-line require-jsdoc
875
+ function tuple(...args) {
876
+ return args;
877
+ }
878
+
879
+ /**
880
+ * Logs a debug message to the console if the `testHelperLogging` query
881
+ * parameter is set.
882
+ *
883
+ * @private
884
+ * @param {string} helperName Name of the helper
885
+ * @param {string|Element} target The target element or selector
886
+ */
887
+ function log(helperName, target, ...args) {
888
+ if (loggingEnabled()) {
889
+ // eslint-disable-next-line no-console
890
+ console.log(`${helperName}(${[elementToString(target), ...args.filter(Boolean)].join(', ')})`);
891
+ }
892
+ }
893
+
894
+ /**
895
+ * Returns whether the test helper logging is enabled or not via the
896
+ * `testHelperLogging` query parameter.
897
+ *
898
+ * @private
899
+ * @returns {boolean} true if enabled
900
+ */
901
+ function loggingEnabled() {
902
+ return typeof location !== 'undefined' && location.search.indexOf('testHelperLogging') !== -1;
903
+ }
904
+
905
+ /**
906
+ * This generates a human-readable description to a DOM element.
907
+ *
908
+ * @private
909
+ * @param {*} el The element that should be described
910
+ * @returns {string} A human-readable description
911
+ */
912
+ function elementToString(el) {
913
+ let desc;
914
+ if (el instanceof NodeList) {
915
+ if (el.length === 0) {
916
+ return 'empty NodeList';
917
+ }
918
+ desc = Array.prototype.slice.call(el, 0, 5).map(elementToString).join(', ');
919
+ return el.length > 5 ? `${desc}... (+${el.length - 5} more)` : desc;
920
+ }
921
+ if (!(el instanceof HTMLElement || el instanceof SVGElement)) {
922
+ return String(el);
923
+ }
924
+ desc = el.tagName.toLowerCase();
925
+ if (el.id) {
926
+ desc += `#${el.id}`;
927
+ }
928
+ if (el.className && !(el.className instanceof SVGAnimatedString)) {
929
+ desc += `.${String(el.className).replace(/\s+/g, '.')}`;
930
+ }
931
+ Array.prototype.forEach.call(el.attributes, function (attr) {
932
+ if (attr.name !== 'class' && attr.name !== 'id') {
933
+ desc += `[${attr.name}${attr.value ? `="${attr.value}"]` : ']'}`;
934
+ }
935
+ });
936
+ return desc;
937
+ }
938
+
939
+ registerHook('fireEvent', 'start', target => {
940
+ log('fireEvent', target);
941
+ });
942
+
943
+ // eslint-disable-next-line require-jsdoc
944
+ const MOUSE_EVENT_CONSTRUCTOR = (() => {
945
+ try {
946
+ new MouseEvent('test');
947
+ return true;
948
+ } catch {
949
+ return false;
950
+ }
951
+ })();
952
+ const DEFAULT_EVENT_OPTIONS = {
953
+ bubbles: true,
954
+ cancelable: true
955
+ };
956
+ const KEYBOARD_EVENT_TYPES = tuple('keydown', 'keypress', 'keyup');
957
+ // eslint-disable-next-line require-jsdoc
958
+ function isKeyboardEventType(eventType) {
959
+ return KEYBOARD_EVENT_TYPES.indexOf(eventType) > -1;
960
+ }
961
+ const MOUSE_EVENT_TYPES = tuple('click', 'mousedown', 'mouseup', 'dblclick', 'mouseenter', 'mouseleave', 'mousemove', 'mouseout', 'mouseover');
962
+ // eslint-disable-next-line require-jsdoc
963
+ function isMouseEventType(eventType) {
964
+ return MOUSE_EVENT_TYPES.indexOf(eventType) > -1;
965
+ }
966
+ const FILE_SELECTION_EVENT_TYPES = tuple('change');
967
+ // eslint-disable-next-line require-jsdoc
968
+ function isFileSelectionEventType(eventType) {
969
+ return FILE_SELECTION_EVENT_TYPES.indexOf(eventType) > -1;
970
+ }
971
+
972
+ // eslint-disable-next-line require-jsdoc
973
+ function isFileSelectionInput(element) {
974
+ return element.files;
975
+ }
976
+ /**
977
+ Internal helper used to build and dispatch events throughout the other DOM helpers.
978
+
979
+ @private
980
+ @param {Element} element the element to dispatch the event to
981
+ @param {string} eventType the type of event
982
+ @param {Object} [options] additional properties to be set on the event
983
+ @returns {Event} the event that was dispatched
984
+ */
985
+ function fireEvent(element, eventType, options = {}) {
986
+ return Promise.resolve().then(() => runHooks('fireEvent', 'start', element)).then(() => runHooks(`fireEvent:${eventType}`, 'start', element)).then(() => {
987
+ if (!element) {
988
+ throw new Error('Must pass an element to `fireEvent`');
989
+ }
990
+ let event;
991
+ if (isKeyboardEventType(eventType)) {
992
+ event = _buildKeyboardEvent(eventType, options);
993
+ } else if (isMouseEventType(eventType)) {
994
+ let rect;
995
+ if (element instanceof Window && element.document.documentElement) {
996
+ rect = element.document.documentElement.getBoundingClientRect();
997
+ } else if (isDocument(element)) {
998
+ rect = element.documentElement.getBoundingClientRect();
999
+ } else if (isElement(element)) {
1000
+ rect = element.getBoundingClientRect();
1001
+ } else {
1002
+ return;
1003
+ }
1004
+ const x = rect.left + 1;
1005
+ const y = rect.top + 1;
1006
+ const simulatedCoordinates = {
1007
+ screenX: x + 5,
1008
+ // Those numbers don't really mean anything.
1009
+ screenY: y + 95,
1010
+ // They're just to make the screenX/Y be different of clientX/Y..
1011
+ clientX: x,
1012
+ clientY: y,
1013
+ ...options
1014
+ };
1015
+ event = buildMouseEvent(eventType, simulatedCoordinates);
1016
+ } else if (isFileSelectionEventType(eventType) && isFileSelectionInput(element)) {
1017
+ event = buildFileEvent(eventType, element, options);
1018
+ } else {
1019
+ event = buildBasicEvent(eventType, options);
1020
+ }
1021
+ element.dispatchEvent(event);
1022
+ return event;
1023
+ }).then(event => runHooks(`fireEvent:${eventType}`, 'end', element).then(() => event)).then(event => runHooks('fireEvent', 'end', element).then(() => event));
1024
+ }
1025
+
1026
+ // eslint-disable-next-line require-jsdoc
1027
+ function buildBasicEvent(type, options = {}) {
1028
+ const event = document.createEvent('Events');
1029
+ const bubbles = options.bubbles !== undefined ? options.bubbles : true;
1030
+ const cancelable = options.cancelable !== undefined ? options.cancelable : true;
1031
+ delete options.bubbles;
1032
+ delete options.cancelable;
1033
+
1034
+ // bubbles and cancelable are readonly, so they can be
1035
+ // set when initializing event
1036
+ event.initEvent(type, bubbles, cancelable);
1037
+ for (const prop in options) {
1038
+ event[prop] = options[prop];
1039
+ }
1040
+ return event;
1041
+ }
1042
+
1043
+ // eslint-disable-next-line require-jsdoc
1044
+ function buildMouseEvent(type, options = {}) {
1045
+ let event;
1046
+ const eventOpts = {
1047
+ view: window,
1048
+ ...DEFAULT_EVENT_OPTIONS,
1049
+ ...options
1050
+ };
1051
+ if (MOUSE_EVENT_CONSTRUCTOR) {
1052
+ event = new MouseEvent(type, eventOpts);
1053
+ } else {
1054
+ try {
1055
+ event = document.createEvent('MouseEvents');
1056
+ event.initMouseEvent(type, eventOpts.bubbles, eventOpts.cancelable, window, eventOpts.detail, eventOpts.screenX, eventOpts.screenY, eventOpts.clientX, eventOpts.clientY, eventOpts.ctrlKey, eventOpts.altKey, eventOpts.shiftKey, eventOpts.metaKey, eventOpts.button, eventOpts.relatedTarget);
1057
+ } catch {
1058
+ event = buildBasicEvent(type, options);
1059
+ }
1060
+ }
1061
+ return event;
1062
+ }
1063
+
1064
+ // @private
1065
+ // eslint-disable-next-line require-jsdoc
1066
+ function _buildKeyboardEvent(type, options = {}) {
1067
+ const eventOpts = {
1068
+ ...DEFAULT_EVENT_OPTIONS,
1069
+ ...options
1070
+ };
1071
+ let event;
1072
+ let eventMethodName;
1073
+ try {
1074
+ event = new KeyboardEvent(type, eventOpts);
1075
+
1076
+ // Property definitions are required for B/C for keyboard event usage
1077
+ // If this properties are not defined, when listening for key events
1078
+ // keyCode/which will be 0. Also, keyCode and which now are string
1079
+ // and if app compare it with === with integer key definitions,
1080
+ // there will be a fail.
1081
+ //
1082
+ // https://w3c.github.io/uievents/#interface-keyboardevent
1083
+ // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
1084
+ Object.defineProperty(event, 'keyCode', {
1085
+ get() {
1086
+ return parseInt(eventOpts.keyCode);
1087
+ }
1088
+ });
1089
+ Object.defineProperty(event, 'which', {
1090
+ get() {
1091
+ return parseInt(eventOpts.which);
1092
+ }
1093
+ });
1094
+ return event;
1095
+ } catch {
1096
+ // left intentionally blank
1097
+ }
1098
+ try {
1099
+ event = document.createEvent('KeyboardEvents');
1100
+ eventMethodName = 'initKeyboardEvent';
1101
+ } catch {
1102
+ // left intentionally blank
1103
+ }
1104
+ if (!event) {
1105
+ try {
1106
+ event = document.createEvent('KeyEvents');
1107
+ eventMethodName = 'initKeyEvent';
1108
+ } catch {
1109
+ // left intentionally blank
1110
+ }
1111
+ }
1112
+ if (event && eventMethodName) {
1113
+ event[eventMethodName](type, eventOpts.bubbles, eventOpts.cancelable, window, eventOpts.ctrlKey, eventOpts.altKey, eventOpts.shiftKey, eventOpts.metaKey, eventOpts.keyCode, eventOpts.charCode);
1114
+ } else {
1115
+ event = buildBasicEvent(type, options);
1116
+ }
1117
+ return event;
1118
+ }
1119
+
1120
+ // eslint-disable-next-line require-jsdoc
1121
+ function buildFileEvent(type, element, options = {}) {
1122
+ const event = buildBasicEvent(type);
1123
+ const files = options.files;
1124
+ if (Array.isArray(options)) {
1125
+ throw new Error('Please pass an object with a files array to `triggerEvent` instead of passing the `options` param as an array to.');
1126
+ }
1127
+ if (Array.isArray(files)) {
1128
+ Object.defineProperty(files, 'item', {
1129
+ value(index) {
1130
+ return typeof index === 'number' ? this[index] : null;
1131
+ },
1132
+ configurable: true
1133
+ });
1134
+ Object.defineProperty(element, 'files', {
1135
+ value: files,
1136
+ configurable: true
1137
+ });
1138
+ const elementProto = Object.getPrototypeOf(element);
1139
+ const valueProp = Object.getOwnPropertyDescriptor(elementProto, 'value');
1140
+ Object.defineProperty(element, 'value', {
1141
+ configurable: true,
1142
+ get() {
1143
+ return valueProp.get.call(element);
1144
+ },
1145
+ set(value) {
1146
+ valueProp.set.call(element, value);
1147
+
1148
+ // We are sure that the value is empty here.
1149
+ // For a non-empty value the original setter must raise an exception.
1150
+ Object.defineProperty(element, 'files', {
1151
+ configurable: true,
1152
+ value: []
1153
+ });
1154
+ }
1155
+ });
1156
+ }
1157
+ Object.defineProperty(event, 'target', {
1158
+ value: element
1159
+ });
1160
+ return event;
1161
+ }
1162
+
1163
+ /**
1164
+ Used internally by the DOM interaction helpers to get a description of a
1165
+ target for debug/error messaging.
1166
+
1167
+ @private
1168
+ @param {Target} target the target
1169
+ @returns {string} a description of the target
1170
+ */
1171
+ function getDescription(target) {
1172
+ const data = isDescriptor(target) ? lookupDescriptorData(target) : null;
1173
+ if (data) {
1174
+ return data.description || '<unknown descriptor>';
1175
+ } else {
1176
+ return `${target}`;
1177
+ }
1178
+ }
1179
+
1180
+ registerHook('blur', 'start', target => {
1181
+ log('blur', target);
1182
+ });
1183
+
1184
+ registerHook('focus', 'start', target => {
1185
+ log('focus', target);
1186
+ });
1187
+
1188
+ registerHook('click', 'start', target => {
1189
+ log('click', target);
1190
+ });
1191
+
1192
+ registerHook('doubleClick', 'start', target => {
1193
+ log('doubleClick', target);
1194
+ });
1195
+
1196
+ registerHook('tab', 'start', target => {
1197
+ log('tab', target);
1198
+ });
1199
+
1200
+ registerHook('tap', 'start', target => {
1201
+ log('tap', target);
1202
+ });
1203
+
1204
+ registerHook('triggerEvent', 'start', (target, eventType) => {
1205
+ log('triggerEvent', target, eventType);
1206
+ });
1207
+
1208
+ /**
1209
+ * Triggers an event on the specified target.
1210
+ *
1211
+ * @public
1212
+ * @param {string|Element|IDOMElementDescriptor} target the element, selector, or descriptor to trigger the event on
1213
+ * @param {string} eventType the type of event to trigger
1214
+ * @param {Object} options additional properties to be set on the event
1215
+ * @param {boolean} force if true, will bypass availability checks (false by default)
1216
+ * @return {Promise<void>} resolves when the application is settled
1217
+ *
1218
+ * @example
1219
+ * <caption>
1220
+ * Using `triggerEvent` to upload a file
1221
+ *
1222
+ * When using `triggerEvent` to upload a file the `eventType` must be `change` and you must pass the
1223
+ * `options` param as an object with a key `files` containing an array of
1224
+ * [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob).
1225
+ * </caption>
1226
+ *
1227
+ * triggerEvent(
1228
+ * 'input.fileUpload',
1229
+ * 'change',
1230
+ * { files: [new Blob(['Ember Rules!'])] }
1231
+ * );
1232
+ *
1233
+ *
1234
+ * @example
1235
+ * <caption>
1236
+ * Using `triggerEvent` to upload a dropped file
1237
+ *
1238
+ * When using `triggerEvent` to handle a dropped (via drag-and-drop) file, the `eventType` must be `drop`. Assuming your `drop` event handler uses the [DataTransfer API](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer),
1239
+ * you must pass the `options` param as an object with a key of `dataTransfer`. The `options.dataTransfer` object should have a `files` key, containing an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File).
1240
+ * </caption>
1241
+ *
1242
+ * triggerEvent(
1243
+ * '[data-test-drop-zone]',
1244
+ * 'drop',
1245
+ * {
1246
+ * dataTransfer: {
1247
+ * files: [new File(['Ember Rules!'], 'ember-rules.txt')]
1248
+ * }
1249
+ * }
1250
+ * )
1251
+ */
1252
+ function triggerEvent(target, eventType, options, force = false) {
1253
+ return Promise.resolve().then(() => {
1254
+ return runHooks('triggerEvent', 'start', target, eventType, options);
1255
+ }).then(() => {
1256
+ if (!target) {
1257
+ throw new Error('Must pass an element, selector, or descriptor to `triggerEvent`.');
1258
+ }
1259
+ const element = getWindowOrElement(target);
1260
+ if (!element) {
1261
+ const description = getDescription(target);
1262
+ throw new Error(`Element not found when calling \`triggerEvent('${description}', ...)\`.`);
1263
+ }
1264
+ if (!force && isFormControl(element) && element.disabled) {
1265
+ throw new Error(`Can not \`triggerEvent\` on disabled ${element}`);
1266
+ }
1267
+ return fireEvent(element, eventType, options).then(settled);
1268
+ }).then(() => {
1269
+ return runHooks('triggerEvent', 'end', target, eventType, options);
1270
+ });
1271
+ }
1272
+
1273
+ registerHook('triggerKeyEvent', 'start', (target, eventType, key) => {
1274
+ log('triggerKeyEvent', target, eventType, key);
1275
+ });
1276
+
1277
+ registerHook('fillIn', 'start', (target, text) => {
1278
+ log('fillIn', target, text);
1279
+ });
1280
+
1281
+ registerHook('typeIn', 'start', (target, text) => {
1282
+ log('typeIn', target, text);
1283
+ });
1284
+
1285
+ function selectOptionByKey(selectSelector, key) {
1286
+ return changeOption('selectOptionByKey', selectSelector, key, false);
1287
+ }
1288
+ function toggleOptionByKey(selectSelector, key) {
1289
+ return changeOption('toggleOptionByKey', selectSelector, key, true);
1290
+ }
1291
+ function changeOption(functionName, selectSelector, key, toggle) {
1292
+ const container = document.querySelector(selectSelector);
1293
+ if (!container) {
1294
+ throw new Error(`You called "${functionName}('${selectSelector}', '${key}')" but no select was found using selector "${selectSelector}"`);
1295
+ }
1296
+ let select = container;
1297
+ if (container.tagName !== 'SELECT') {
1298
+ select = container.querySelector('[data-component="native-select"]');
1299
+ }
1300
+ if (!select) {
1301
+ throw new Error(`You called "${functionName}('${selectSelector}', '${key}')" but no select was found inside container using selector "${selectSelector}"`);
1302
+ }
1303
+ const option = select.querySelector(`[data-key="${key}"]`);
1304
+ if (!option) {
1305
+ throw new Error(`You called "${functionName}('${selectSelector}', '${key}')" but no option with key "${key}" was found`);
1306
+ }
1307
+ if (toggle && option.selected) {
1308
+ option.selected = false;
1309
+ } else {
1310
+ option.selected = true;
1311
+ }
1312
+ return triggerEvent(select, 'change');
1313
+ }
1314
+
1315
+ export { selectOptionByKey, toggleOptionByKey };
1316
+ //# sourceMappingURL=test-support.js.map