@astryxdesign/core 0.7.6-canary.f73623d → 0.7.6-canary.f77aaf2

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 (1395) hide show
  1. package/dist/AppShell/AppShell.d.ts.map +1 -1
  2. package/dist/AppShell/AppShell.js +0 -6
  3. package/dist/Badge/Badge.d.ts.map +1 -1
  4. package/dist/Badge/Badge.js +2 -1
  5. package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
  6. package/dist/BottomSheet/BottomSheet.js +6 -2
  7. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  8. package/dist/BottomSheet/BottomSheetPanel.js +36 -9
  9. package/dist/BottomSheet/BottomSheetSwitcher.d.ts +1 -1
  10. package/dist/BottomSheet/BottomSheetSwitcher.js +1 -1
  11. package/dist/BottomSheet/useMobileKeyboard.d.ts.map +1 -1
  12. package/dist/BottomSheet/useMobileKeyboard.js +44 -8
  13. package/dist/BottomSheet/useSheetGestures.d.ts +36 -6
  14. package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
  15. package/dist/BottomSheet/useSheetGestures.js +67 -10
  16. package/dist/Breadcrumbs/BreadcrumbItem.js +4 -2
  17. package/dist/Center/Center.d.ts +1 -1
  18. package/dist/Center/Center.js +1 -1
  19. package/dist/Chat/ChatComposer.d.ts.map +1 -1
  20. package/dist/Chat/ChatComposer.js +10 -5
  21. package/dist/Chat/ChatComposerDrawer.d.ts +1 -1
  22. package/dist/Chat/ChatComposerDrawer.js +1 -1
  23. package/dist/Chat/ChatComposerInput.d.ts +1 -1
  24. package/dist/Chat/ChatComposerInput.js +1 -1
  25. package/dist/Chat/ChatLayout.d.ts.map +1 -1
  26. package/dist/Chat/ChatLayout.js +1 -1
  27. package/dist/Chat/ChatMessageList.d.ts.map +1 -1
  28. package/dist/Chat/ChatMessageList.js +3 -1
  29. package/dist/Chat/ChatPastedTextToken.d.ts.map +1 -1
  30. package/dist/Chat/ChatPastedTextToken.js +15 -4
  31. package/dist/Chat/ChatSystemMessage.d.ts.map +1 -1
  32. package/dist/Chat/ChatSystemMessage.js +2 -1
  33. package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
  34. package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
  35. package/dist/CheckboxList/CheckboxList.js +5 -2
  36. package/dist/CheckboxList/CheckboxListContext.d.ts +8 -0
  37. package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
  38. package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
  39. package/dist/CheckboxList/CheckboxListItem.js +5 -2
  40. package/dist/Code/Code.d.ts +1 -1
  41. package/dist/Code/Code.js +1 -1
  42. package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
  43. package/dist/CommandPalette/CommandPaletteInput.js +8 -5
  44. package/dist/ComplexSelector/ComplexSelector.d.ts +2 -2
  45. package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
  46. package/dist/ComplexSelector/ComplexSelector.js +7 -2
  47. package/dist/DateInput/DateInput.d.ts +3 -2
  48. package/dist/DateInput/DateInput.d.ts.map +1 -1
  49. package/dist/DateInput/MonthScroller.d.ts.map +1 -1
  50. package/dist/DateInput/MonthScroller.js +17 -18
  51. package/dist/DateRangeInput/DateRangeInput.d.ts +3 -2
  52. package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
  53. package/dist/DateRangeInput/DateRangeInput.js +8 -4
  54. package/dist/Dialog/Dialog.d.ts.map +1 -1
  55. package/dist/Dialog/Dialog.js +10 -15
  56. package/dist/Drawer/Drawer.d.ts +1 -1
  57. package/dist/Drawer/Drawer.js +1 -1
  58. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  59. package/dist/DropdownMenu/DropdownMenu.js +19 -8
  60. package/dist/DropdownMenu/DropdownMenuGroup.d.ts.map +1 -1
  61. package/dist/DropdownMenu/DropdownMenuGroup.js +2 -1
  62. package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
  63. package/dist/DropdownMenu/DropdownMenuSubMenu.js +1 -1
  64. package/dist/DropdownMenu/MenuBottomSheetActionList.d.ts.map +1 -1
  65. package/dist/DropdownMenu/MenuBottomSheetActionList.js +9 -3
  66. package/dist/Field/Field.d.ts +2 -2
  67. package/dist/Field/Field.d.ts.map +1 -1
  68. package/dist/Field/FieldLabel.d.ts.map +1 -1
  69. package/dist/Field/FieldLabel.js +19 -2
  70. package/dist/Field/PanelSearchInput.d.ts.map +1 -1
  71. package/dist/Field/PanelSearchInput.js +10 -5
  72. package/dist/Field/fieldStatusPlacement.d.ts +15 -0
  73. package/dist/Field/fieldStatusPlacement.d.ts.map +1 -0
  74. package/dist/Field/fieldStatusPlacement.js +1 -0
  75. package/dist/FieldStatus/FieldStatus.d.ts +16 -28
  76. package/dist/FieldStatus/FieldStatus.d.ts.map +1 -1
  77. package/dist/FieldStatus/FieldStatus.js +25 -3
  78. package/dist/FieldStatus/index.d.ts +7 -0
  79. package/dist/FieldStatus/index.d.ts.map +1 -1
  80. package/dist/FileInput/FileInput.d.ts +10 -2
  81. package/dist/FileInput/FileInput.d.ts.map +1 -1
  82. package/dist/FileInput/FileInput.js +86 -35
  83. package/dist/Item/Item.js +5 -5
  84. package/dist/Item/ItemSwipeLayer.d.ts.map +1 -1
  85. package/dist/Item/ItemSwipeLayer.js +8 -2
  86. package/dist/Layer/useTouchTrigger.d.ts +35 -3
  87. package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
  88. package/dist/Layer/useTouchTrigger.js +80 -11
  89. package/dist/Link/Link.d.ts.map +1 -1
  90. package/dist/Link/Link.js +10 -1
  91. package/dist/Markdown/Markdown.d.ts.map +1 -1
  92. package/dist/Markdown/Markdown.js +1 -0
  93. package/dist/MetadataList/MetadataList.d.ts.map +1 -1
  94. package/dist/MetadataList/MetadataList.js +2 -1
  95. package/dist/MetadataList/MetadataListItem.d.ts.map +1 -1
  96. package/dist/MetadataList/MetadataListItem.js +2 -1
  97. package/dist/MultiSelector/MultiSelector.d.ts +2 -2
  98. package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
  99. package/dist/MultiSelector/MultiSelector.js +35 -25
  100. package/dist/MultiSelector/hooks.d.ts.map +1 -1
  101. package/dist/MultiSelector/hooks.js +4 -2
  102. package/dist/NumberInput/NumberInput.d.ts +3 -2
  103. package/dist/NumberInput/NumberInput.d.ts.map +1 -1
  104. package/dist/NumberInput/NumberInput.js +11 -15
  105. package/dist/OverflowList/OverflowList.d.ts.map +1 -1
  106. package/dist/OverflowList/OverflowList.js +2 -1
  107. package/dist/Pagination/Pagination.d.ts.map +1 -1
  108. package/dist/Popover/Popover.js +2 -2
  109. package/dist/Popover/usePopover.d.ts +7 -1
  110. package/dist/Popover/usePopover.d.ts.map +1 -1
  111. package/dist/Popover/usePopover.js +8 -2
  112. package/dist/PowerSearch/PowerSearch.d.ts +3 -2
  113. package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
  114. package/dist/PowerSearch/PowerSearch.js +4 -2
  115. package/dist/RadioList/RadioList.d.ts.map +1 -1
  116. package/dist/RadioList/RadioList.js +7 -2
  117. package/dist/RadioList/RadioListItem.d.ts.map +1 -1
  118. package/dist/RadioList/RadioListItem.js +8 -2
  119. package/dist/RadioList/RadioListReasonContext.d.ts +2 -0
  120. package/dist/RadioList/RadioListReasonContext.d.ts.map +1 -0
  121. package/dist/RadioList/RadioListReasonContext.js +22 -0
  122. package/dist/Resizable/useResizable.d.ts.map +1 -1
  123. package/dist/Resizable/useResizable.js +53 -10
  124. package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  125. package/dist/SegmentedControl/SegmentedControl.js +22 -5
  126. package/dist/SegmentedControl/SegmentedControlContext.d.ts +6 -0
  127. package/dist/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
  128. package/dist/SegmentedControl/SegmentedControlItem.d.ts +1 -1
  129. package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
  130. package/dist/SegmentedControl/SegmentedControlItem.js +16 -3
  131. package/dist/Selector/Selector.d.ts +3 -3
  132. package/dist/Selector/Selector.d.ts.map +1 -1
  133. package/dist/Selector/Selector.js +14 -8
  134. package/dist/Selector/hooks.js +2 -2
  135. package/dist/Selector/useSelectorPresentation.d.ts +7 -1
  136. package/dist/Selector/useSelectorPresentation.d.ts.map +1 -1
  137. package/dist/Selector/useSelectorPresentation.js +2 -1
  138. package/dist/SideNav/railMotion.d.ts +5 -5
  139. package/dist/SideNav/railMotion.d.ts.map +1 -1
  140. package/dist/SideNav/railMotion.js +69 -177
  141. package/dist/Slider/Slider.d.ts.map +1 -1
  142. package/dist/Slider/Slider.js +100 -17
  143. package/dist/Table/BaseTable.d.ts.map +1 -1
  144. package/dist/Table/BaseTable.js +7 -6
  145. package/dist/Table/glidingDivider.d.ts +8 -1
  146. package/dist/Table/glidingDivider.d.ts.map +1 -1
  147. package/dist/Table/glidingDivider.js +8 -3
  148. package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
  149. package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
  150. package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +1 -2
  151. package/dist/TextArea/TextArea.d.ts +2 -2
  152. package/dist/TextArea/TextArea.d.ts.map +1 -1
  153. package/dist/TextInput/TextInput.d.ts +3 -2
  154. package/dist/TextInput/TextInput.d.ts.map +1 -1
  155. package/dist/TimeInput/TimeInput.d.ts +3 -2
  156. package/dist/TimeInput/TimeInput.d.ts.map +1 -1
  157. package/dist/Timer/Timer.js +1 -1
  158. package/dist/Toast/useToast.d.ts.map +1 -1
  159. package/dist/Toast/useToast.js +8 -2
  160. package/dist/ToggleButton/ToggleButton.d.ts.map +1 -1
  161. package/dist/ToggleButton/ToggleButton.js +11 -3
  162. package/dist/Token/Token.d.ts +1 -1
  163. package/dist/Token/Token.d.ts.map +1 -1
  164. package/dist/Token/Token.js +15 -0
  165. package/dist/Tokenizer/Tokenizer.d.ts +3 -2
  166. package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
  167. package/dist/Tokenizer/Tokenizer.js +73 -50
  168. package/dist/Tokenizer/TokenizerBottomSheet.d.ts +1 -1
  169. package/dist/Tokenizer/TokenizerBottomSheet.d.ts.map +1 -1
  170. package/dist/Tokenizer/TokenizerBottomSheet.js +9 -15
  171. package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
  172. package/dist/TopNav/TopNavMegaMenu.js +4 -3
  173. package/dist/TreeList/TreeList.d.ts.map +1 -1
  174. package/dist/TreeList/TreeList.js +6 -3
  175. package/dist/TreeList/TreeListItem.d.ts.map +1 -1
  176. package/dist/TreeList/TreeListItem.js +4 -3
  177. package/dist/Typeahead/BaseTypeahead.d.ts +4 -1
  178. package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
  179. package/dist/Typeahead/BaseTypeahead.js +262 -43
  180. package/dist/Typeahead/Typeahead.d.ts +3 -2
  181. package/dist/Typeahead/Typeahead.d.ts.map +1 -1
  182. package/dist/Typeahead/Typeahead.js +36 -10
  183. package/dist/Typeahead/index.d.ts +1 -1
  184. package/dist/Typeahead/index.d.ts.map +1 -1
  185. package/dist/Typeahead/types.d.ts +26 -3
  186. package/dist/Typeahead/types.d.ts.map +1 -1
  187. package/dist/astryx.css +1 -2
  188. package/dist/gestures/haptics.d.ts.map +1 -1
  189. package/dist/gestures/haptics.js +1 -5
  190. package/dist/hooks/menuPressMarker.d.ts +13 -0
  191. package/dist/hooks/menuPressMarker.d.ts.map +1 -0
  192. package/dist/hooks/menuPressMarker.js +15 -0
  193. package/dist/hooks/useClickableContainer.d.ts +24 -4
  194. package/dist/hooks/useClickableContainer.d.ts.map +1 -1
  195. package/dist/hooks/useClickableContainer.js +41 -14
  196. package/dist/hooks/useFocusReturnVisibility.d.ts +8 -1
  197. package/dist/hooks/useFocusReturnVisibility.d.ts.map +1 -1
  198. package/dist/hooks/useFocusReturnVisibility.js +14 -8
  199. package/dist/hooks/useInputStatusIcon.d.ts +2 -2
  200. package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
  201. package/dist/hooks/useInputStatusIcon.js +1 -2
  202. package/dist/hooks/useListFocus.d.ts +19 -0
  203. package/dist/hooks/useListFocus.d.ts.map +1 -1
  204. package/dist/hooks/useListFocus.js +26 -1
  205. package/dist/hooks/useMenuPress.d.ts +2 -2
  206. package/dist/hooks/useMenuPress.d.ts.map +1 -1
  207. package/dist/hooks/useMenuPress.js +5 -6
  208. package/dist/hooks/useTreeFocus.d.ts.map +1 -1
  209. package/dist/hooks/useTreeFocus.js +13 -5
  210. package/dist/hooks/useTypeahead.d.ts +3 -1
  211. package/dist/hooks/useTypeahead.d.ts.map +1 -1
  212. package/dist/hooks/useTypeahead.js +21 -15
  213. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  214. package/dist/i18n/generated-locales/en.generated.js +6 -0
  215. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  216. package/dist/i18n/generated-locales/pseudo.generated.js +6 -0
  217. package/dist/i18n/useListFormatter.d.ts +9 -0
  218. package/dist/i18n/useListFormatter.d.ts.map +1 -0
  219. package/dist/i18n/useListFormatter.js +41 -0
  220. package/dist/motion/animatedLayout.d.ts +130 -5
  221. package/dist/motion/animatedLayout.d.ts.map +1 -1
  222. package/dist/motion/animatedLayout.js +771 -44
  223. package/dist/motion/animator.d.ts.map +1 -1
  224. package/dist/motion/animator.js +38 -2
  225. package/dist/privateAttributes/segmentDisabled.stylex.d.ts +5 -0
  226. package/dist/privateAttributes/segmentDisabled.stylex.d.ts.map +1 -0
  227. package/dist/privateAttributes/segmentDisabled.stylex.js +28 -0
  228. package/dist/theme/Theme.d.ts +10 -0
  229. package/dist/theme/Theme.d.ts.map +1 -1
  230. package/dist/theme/Theme.js +8 -4
  231. package/dist/theme/useTheme.d.ts.map +1 -1
  232. package/dist/theme/useTheme.js +7 -1
  233. package/dist/utils/focusReturn.d.ts +5 -3
  234. package/dist/utils/focusReturn.d.ts.map +1 -1
  235. package/dist/utils/focusReturn.js +6 -4
  236. package/dist/utils/getNodeText.d.ts.map +1 -1
  237. package/dist/utils/getNodeText.js +2 -1
  238. package/dist/utils/interactionModality.d.ts +78 -7
  239. package/dist/utils/interactionModality.d.ts.map +1 -1
  240. package/dist/utils/interactionModality.js +125 -42
  241. package/dist/utils/pressDisabled.d.ts +21 -0
  242. package/dist/utils/pressDisabled.d.ts.map +1 -0
  243. package/dist/utils/pressDisabled.js +32 -0
  244. package/dist/utils/pressFeedback.d.ts.map +1 -1
  245. package/dist/utils/pressFeedback.js +5 -3
  246. package/dist/utils/typeaheadMatch.d.ts +24 -0
  247. package/dist/utils/typeaheadMatch.d.ts.map +1 -0
  248. package/dist/utils/typeaheadMatch.js +112 -0
  249. package/locales/en.json +25 -1
  250. package/locales/pseudo.json +18 -0
  251. package/package.json +19 -5
  252. package/src/AppShell/AppShell.tsx +0 -9
  253. package/src/Badge/Badge.tsx +2 -1
  254. package/src/BottomSheet/BottomSheet.tsx +4 -2
  255. package/src/BottomSheet/BottomSheetPanel.tsx +39 -8
  256. package/src/BottomSheet/BottomSheetSwitcher.tsx +1 -1
  257. package/src/BottomSheet/useMobileKeyboard.ts +51 -10
  258. package/src/BottomSheet/useSheetGestures.ts +92 -15
  259. package/src/Breadcrumbs/BreadcrumbItem.tsx +2 -1
  260. package/src/Center/Center.tsx +1 -1
  261. package/src/Chat/ChatComposer.tsx +7 -10
  262. package/src/Chat/ChatComposerDrawer.tsx +1 -1
  263. package/src/Chat/ChatComposerInput.tsx +1 -1
  264. package/src/Chat/ChatLayout.tsx +1 -6
  265. package/src/Chat/ChatMessageList.tsx +1 -0
  266. package/src/Chat/ChatPastedTextToken.tsx +14 -4
  267. package/src/Chat/ChatSystemMessage.tsx +4 -1
  268. package/src/Chat/ChatToolCalls.tsx +5 -0
  269. package/src/CheckboxList/CheckboxList.tsx +7 -1
  270. package/src/CheckboxList/CheckboxListContext.tsx +8 -0
  271. package/src/CheckboxList/CheckboxListItem.tsx +8 -2
  272. package/src/Code/Code.tsx +1 -1
  273. package/src/CommandPalette/CommandPaletteInput.tsx +5 -8
  274. package/src/ComplexSelector/ComplexSelector.tsx +22 -4
  275. package/src/DateInput/DateInput.tsx +2 -2
  276. package/src/DateInput/MonthScroller.tsx +15 -17
  277. package/src/DateRangeInput/DateRangeInput.tsx +20 -5
  278. package/src/Dialog/Dialog.tsx +9 -25
  279. package/src/Drawer/Drawer.tsx +1 -1
  280. package/src/DropdownMenu/DropdownMenu.tsx +24 -9
  281. package/src/DropdownMenu/DropdownMenuGroup.tsx +2 -1
  282. package/src/DropdownMenu/DropdownMenuSubMenu.tsx +3 -1
  283. package/src/DropdownMenu/MenuBottomSheetActionList.tsx +6 -3
  284. package/src/Field/Field.doc.mjs +2 -1
  285. package/src/Field/Field.tsx +2 -2
  286. package/src/Field/FieldLabel.doc.mjs +4 -2
  287. package/src/Field/FieldLabel.tsx +18 -2
  288. package/src/Field/PanelSearchInput.tsx +7 -8
  289. package/src/Field/fieldStatusPlacement.ts +18 -0
  290. package/src/FieldStatus/FieldStatus.tsx +33 -3
  291. package/src/FieldStatus/index.ts +7 -0
  292. package/src/FileInput/FileInput.doc.mjs +3 -3
  293. package/src/FileInput/FileInput.tsx +103 -36
  294. package/src/HoverCard/HoverCard.doc.mjs +3 -3
  295. package/src/HoverCard/useHoverCard.doc.mjs +1 -1
  296. package/src/Item/Item.tsx +5 -5
  297. package/src/Item/ItemSwipeLayer.tsx +8 -1
  298. package/src/Layer/useTouchTrigger.ts +107 -18
  299. package/src/Link/Link.tsx +9 -2
  300. package/src/Markdown/Markdown.tsx +1 -0
  301. package/src/MetadataList/MetadataList.tsx +4 -2
  302. package/src/MetadataList/MetadataListItem.tsx +2 -1
  303. package/src/MultiSelector/MultiSelector.tsx +57 -36
  304. package/src/MultiSelector/hooks.ts +7 -5
  305. package/src/NumberInput/NumberInput.tsx +13 -20
  306. package/src/OverflowList/OverflowList.tsx +2 -1
  307. package/src/Pagination/Pagination.tsx +1 -0
  308. package/src/Popover/Popover.tsx +2 -2
  309. package/src/Popover/usePopover.tsx +7 -2
  310. package/src/PowerSearch/PowerSearch.tsx +4 -2
  311. package/src/RadioList/RadioList.tsx +13 -2
  312. package/src/RadioList/RadioListItem.tsx +9 -1
  313. package/src/RadioList/RadioListReasonContext.ts +25 -0
  314. package/src/Resizable/useResizable.ts +50 -7
  315. package/src/SegmentedControl/SegmentedControl.tsx +43 -8
  316. package/src/SegmentedControl/SegmentedControlContext.ts +6 -0
  317. package/src/SegmentedControl/SegmentedControlItem.tsx +12 -1
  318. package/src/Selector/Selector.tsx +23 -9
  319. package/src/Selector/hooks.ts +2 -2
  320. package/src/Selector/useSelectorPresentation.ts +8 -1
  321. package/src/SideNav/railMotion.ts +73 -179
  322. package/src/Slider/Slider.tsx +116 -19
  323. package/src/Table/BaseTable.tsx +10 -6
  324. package/src/Table/glidingDivider.ts +8 -3
  325. package/src/Table/plugins/sortable/useTableSortable.tsx +2 -0
  326. package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +1 -2
  327. package/src/TextArea/TextArea.tsx +3 -2
  328. package/src/TextInput/TextInput.tsx +2 -2
  329. package/src/TimeInput/TimeInput.tsx +2 -2
  330. package/src/Timer/Timer.tsx +1 -1
  331. package/src/Toast/useToast.tsx +8 -3
  332. package/src/ToggleButton/ToggleButton.tsx +10 -3
  333. package/src/Token/Token.tsx +15 -0
  334. package/src/Tokenizer/Tokenizer.doc.mjs +12 -8
  335. package/src/Tokenizer/Tokenizer.tsx +81 -53
  336. package/src/Tokenizer/TokenizerBottomSheet.tsx +9 -15
  337. package/src/Tooltip/Tooltip.doc.mjs +3 -3
  338. package/src/Tooltip/useTooltip.doc.mjs +1 -1
  339. package/src/TopNav/TopNavMegaMenu.tsx +4 -3
  340. package/src/TreeList/TreeList.tsx +6 -3
  341. package/src/TreeList/TreeListItem.tsx +5 -3
  342. package/src/Typeahead/BaseTypeahead.doc.mjs +7 -4
  343. package/src/Typeahead/BaseTypeahead.tsx +314 -40
  344. package/src/Typeahead/Typeahead.doc.mjs +21 -4
  345. package/src/Typeahead/Typeahead.tsx +42 -11
  346. package/src/Typeahead/TypeaheadItem.doc.mjs +6 -3
  347. package/src/Typeahead/index.ts +1 -1
  348. package/src/Typeahead/types.ts +27 -3
  349. package/src/gestures/haptics.ts +1 -8
  350. package/src/hooks/menuPressMarker.ts +15 -0
  351. package/src/hooks/useClickableContainer.ts +48 -17
  352. package/src/hooks/useFocusReturnVisibility.ts +15 -12
  353. package/src/hooks/useInputStatusIcon.tsx +2 -2
  354. package/src/hooks/useListFocus.ts +38 -1
  355. package/src/hooks/useMenuPress.ts +5 -5
  356. package/src/hooks/useTreeFocus.doc.mjs +2 -2
  357. package/src/hooks/useTreeFocus.ts +16 -10
  358. package/src/hooks/useTypeahead.doc.mjs +2 -2
  359. package/src/hooks/useTypeahead.ts +21 -20
  360. package/src/i18n/generated-locales/en.generated.ts +8 -0
  361. package/src/i18n/generated-locales/pseudo.generated.ts +8 -0
  362. package/src/i18n/useListFormatter.ts +42 -0
  363. package/src/motion/animatedLayout.ts +977 -45
  364. package/src/motion/animator.ts +55 -2
  365. package/src/privateAttributes/segmentDisabled.stylex.ts +28 -0
  366. package/src/theme/Theme.tsx +8 -4
  367. package/src/theme/useTheme.ts +6 -1
  368. package/src/utils/focusReturn.ts +6 -4
  369. package/src/utils/getNodeText.ts +2 -1
  370. package/src/utils/interactionModality.ts +165 -44
  371. package/src/utils/pressDisabled.ts +32 -0
  372. package/src/utils/pressFeedback.ts +5 -3
  373. package/src/utils/typeaheadMatch.ts +141 -0
  374. package/dist/Item/ItemMarkerColumns.a11y.chromium.spec.d.ts +0 -2
  375. package/dist/Item/ItemMarkerColumns.a11y.chromium.spec.js +0 -132
  376. package/dist/Lightbox/LightboxKeyboard.a11y.browser.spec.d.ts +0 -2
  377. package/dist/Lightbox/LightboxKeyboard.a11y.browser.spec.js +0 -78
  378. package/dist/Lightbox/LightboxViewport.a11y.browser.spec.d.ts +0 -2
  379. package/dist/Lightbox/LightboxViewport.a11y.browser.spec.js +0 -66
  380. package/dist/List/ListMarkers.a11y.chromium.spec.d.ts +0 -2
  381. package/dist/List/ListMarkers.a11y.chromium.spec.js +0 -677
  382. package/dist/Markdown/Markdown.fr23.bench.d.ts +0 -2
  383. package/dist/Markdown/Markdown.fr23.bench.d.ts.map +0 -1
  384. package/dist/Markdown/Markdown.fr23.bench.js +0 -152
  385. package/dist/Markdown/MarkdownTable.a11y.chromium.spec.d.ts +0 -2
  386. package/dist/Markdown/MarkdownTable.a11y.chromium.spec.js +0 -590
  387. package/dist/Markdown/plugins/headingLinks.a11y.chromium.spec.d.ts +0 -2
  388. package/dist/Markdown/plugins/headingLinks.a11y.chromium.spec.js +0 -657
  389. package/dist/MobileNav/MobileNavPinchZoom.a11y.chromium.spec.d.ts +0 -2
  390. package/dist/MobileNav/MobileNavPinchZoom.a11y.chromium.spec.js +0 -153
  391. package/dist/MultiSelector/CreateRow.a11y.chromium.spec.d.ts +0 -2
  392. package/dist/MultiSelector/CreateRow.a11y.chromium.spec.js +0 -117
  393. package/dist/MultiSelector/MultiSelector.disabledFocus.a11y.chromium.spec.d.ts +0 -2
  394. package/dist/MultiSelector/MultiSelector.disabledFocus.a11y.chromium.spec.js +0 -49
  395. package/dist/MultiSelector/OptionActions.a11y.chromium.spec.d.ts +0 -2
  396. package/dist/MultiSelector/OptionActions.a11y.chromium.spec.js +0 -273
  397. package/dist/Outline/OutlineFocus.a11y.chromium.spec.d.ts +0 -2
  398. package/dist/Outline/OutlineFocus.a11y.chromium.spec.js +0 -421
  399. package/dist/Typeahead/BaseTypeahead.emptyState.a11y.chromium.spec.d.ts +0 -2
  400. package/dist/Typeahead/BaseTypeahead.emptyState.a11y.chromium.spec.js +0 -118
  401. package/dist/reset.a11y.chromium.spec.d.ts +0 -2
  402. package/dist/reset.a11y.chromium.spec.js +0 -231
  403. package/dist/reset.until-found.a11y.browser.spec.d.ts +0 -2
  404. package/dist/reset.until-found.a11y.browser.spec.js +0 -72
  405. package/src/AlertDialog/AlertDialog.spec.md +0 -259
  406. package/src/AlertDialog/AlertDialog.test.tsx +0 -519
  407. package/src/AlertDialog/__tests__/AlertDialog.a11y.chromium.spec.ts +0 -128
  408. package/src/AlertDialog/__tests__/AlertDialog.a11y.renders.tsx +0 -52
  409. package/src/AlertDialog/__tests__/AlertDialog.a11y.states.ts +0 -68
  410. package/src/AlertDialog/__tests__/AlertDialog.a11y.test.tsx +0 -144
  411. package/src/AlertDialog/useImperativeAlertDialog.test.tsx +0 -163
  412. package/src/AppShell/AppShell.spec.md +0 -331
  413. package/src/AppShell/AppShell.test.tsx +0 -1310
  414. package/src/AppShell/__tests__/AppShellMainKeyboard.a11y.browser.spec.ts +0 -534
  415. package/src/AppShell/observeMainOverflow.test.ts +0 -173
  416. package/src/AspectRatio/AspectRatio.spec.md +0 -179
  417. package/src/AspectRatio/AspectRatio.test.tsx +0 -398
  418. package/src/AspectRatio/__tests__/AspectRatioFitLayers.a11y.browser.spec.ts +0 -158
  419. package/src/Avatar/Avatar.spec.md +0 -253
  420. package/src/Avatar/Avatar.test.tsx +0 -867
  421. package/src/Avatar/AvatarStatusDot.spec.md +0 -208
  422. package/src/Avatar/AvatarStatusDot.test.tsx +0 -306
  423. package/src/Avatar/__tests__/AvatarForcedColors.a11y.chromium.spec.ts +0 -126
  424. package/src/AvatarGroup/AvatarGroup.spec.md +0 -205
  425. package/src/AvatarGroup/AvatarGroup.test.tsx +0 -313
  426. package/src/AvatarGroup/AvatarGroupOverflow.spec.md +0 -210
  427. package/src/AvatarGroup/AvatarGroupOverflow.test.tsx +0 -263
  428. package/src/Badge/Badge.spec.md +0 -207
  429. package/src/Badge/Badge.test.tsx +0 -125
  430. package/src/Badge/__tests__/BadgeLargerText.a11y.chromium.spec.ts +0 -260
  431. package/src/Banner/Banner.spec.md +0 -282
  432. package/src/Banner/Banner.test.tsx +0 -879
  433. package/src/Blockquote/Blockquote.spec.md +0 -171
  434. package/src/Blockquote/Blockquote.test.tsx +0 -121
  435. package/src/BottomSheet/BottomSheet.spec.md +0 -457
  436. package/src/BottomSheet/BottomSheet.test.tsx +0 -3154
  437. package/src/BottomSheet/BottomSheetEdgeTint.test.tsx +0 -248
  438. package/src/BottomSheet/BottomSheetKeyboard.test.tsx +0 -195
  439. package/src/BottomSheet/BottomSheetPanel.test.tsx +0 -549
  440. package/src/BottomSheet/BottomSheetReplace.test.tsx +0 -1638
  441. package/src/BottomSheet/BottomSheetStacking.announce.test.tsx +0 -246
  442. package/src/BottomSheet/BottomSheetStacking.test.tsx +0 -3184
  443. package/src/BottomSheet/BottomSheetSwitcher.spec.md +0 -367
  444. package/src/BottomSheet/BottomSheetSwitcher.test.tsx +0 -2010
  445. package/src/BottomSheet/__tests__/BottomSheetDrag.a11y.chromium.spec.ts +0 -129
  446. package/src/BottomSheet/__tests__/BottomSheetFocusReturn.a11y.browser.spec.ts +0 -97
  447. package/src/BottomSheet/__tests__/BottomSheetKeyboard.a11y.browser.spec.ts +0 -415
  448. package/src/BottomSheet/__tests__/BottomSheetNativeModal.a11y.browser.spec.ts +0 -462
  449. package/src/BottomSheet/__tests__/BottomSheetPinchZoom.a11y.chromium.spec.ts +0 -247
  450. package/src/BottomSheet/__tests__/BottomSheetToastOutlet.a11y.chromium.spec.ts +0 -83
  451. package/src/BottomSheet/snapOffsets.test.ts +0 -254
  452. package/src/BottomSheet/useSheetGestures.test.ts +0 -1690
  453. package/src/Breadcrumbs/BreadcrumbItem.spec.md +0 -269
  454. package/src/Breadcrumbs/Breadcrumbs.spec.md +0 -165
  455. package/src/Breadcrumbs/Breadcrumbs.test.tsx +0 -921
  456. package/src/Breadcrumbs/__tests__/Breadcrumbs.a11y.chromium.spec.ts +0 -132
  457. package/src/Breadcrumbs/__tests__/Breadcrumbs.a11y.renders.tsx +0 -45
  458. package/src/Breadcrumbs/__tests__/Breadcrumbs.a11y.states.ts +0 -81
  459. package/src/Breadcrumbs/__tests__/Breadcrumbs.a11y.test.tsx +0 -125
  460. package/src/Button/Button.spec.md +0 -322
  461. package/src/Button/Button.test.tsx +0 -864
  462. package/src/Button/__tests__/Button.a11y.chromium.spec.ts +0 -355
  463. package/src/Button/__tests__/Button.a11y.harnesses.tsx +0 -47
  464. package/src/Button/__tests__/Button.a11y.known-failures.ts +0 -25
  465. package/src/Button/__tests__/Button.a11y.renders.tsx +0 -139
  466. package/src/Button/__tests__/Button.a11y.states.ts +0 -317
  467. package/src/Button/__tests__/Button.a11y.test.tsx +0 -187
  468. package/src/ButtonGroup/ButtonGroup.spec.md +0 -220
  469. package/src/ButtonGroup/ButtonGroup.test.tsx +0 -1025
  470. package/src/Calendar/Calendar.spec.md +0 -248
  471. package/src/Calendar/Calendar.test.tsx +0 -2186
  472. package/src/Calendar/__tests__/Calendar.a11y.chromium.spec.ts +0 -141
  473. package/src/Calendar/__tests__/Calendar.a11y.known-failures.ts +0 -12
  474. package/src/Calendar/__tests__/Calendar.a11y.renders.tsx +0 -57
  475. package/src/Calendar/__tests__/Calendar.a11y.states.ts +0 -139
  476. package/src/Calendar/__tests__/Calendar.a11y.test.tsx +0 -137
  477. package/src/Calendar/dayCellUtils.test.ts +0 -520
  478. package/src/Calendar/getInitialFocusDate.test.ts +0 -94
  479. package/src/Calendar/getStandaloneShortWeekdayNames.test.ts +0 -54
  480. package/src/Calendar/hooks/useCalendarConstraints.test.ts +0 -153
  481. package/src/Calendar/hooks/useCalendarDays.test.ts +0 -265
  482. package/src/Calendar/hooks/useCalendarNavigation.test.ts +0 -252
  483. package/src/Card/Card.spec.md +0 -205
  484. package/src/Card/Card.test.tsx +0 -202
  485. package/src/Carousel/Carousel.spec.md +0 -146
  486. package/src/Carousel/Carousel.test.tsx +0 -1036
  487. package/src/Carousel/__tests__/Carousel.a11y.chromium.spec.ts +0 -207
  488. package/src/Carousel/__tests__/Carousel.a11y.known-failures.ts +0 -12
  489. package/src/Carousel/__tests__/Carousel.a11y.renders.tsx +0 -39
  490. package/src/Carousel/__tests__/Carousel.a11y.states.ts +0 -139
  491. package/src/Carousel/__tests__/Carousel.a11y.test.tsx +0 -127
  492. package/src/Center/Center.spec.md +0 -205
  493. package/src/Center/Center.test.tsx +0 -406
  494. package/src/Chat/ChatComposer.spec.md +0 -246
  495. package/src/Chat/ChatComposer.test.tsx +0 -364
  496. package/src/Chat/ChatComposerDrawer.spec.md +0 -267
  497. package/src/Chat/ChatComposerDrawer.test.tsx +0 -130
  498. package/src/Chat/ChatComposerInput.spec.md +0 -224
  499. package/src/Chat/ChatComposerInput.test.tsx +0 -2136
  500. package/src/Chat/ChatComposerTokenElement.spec.md +0 -164
  501. package/src/Chat/ChatComposerTokenElement.test.tsx +0 -85
  502. package/src/Chat/ChatDictationButton.spec.md +0 -205
  503. package/src/Chat/ChatDictationButton.test.tsx +0 -108
  504. package/src/Chat/ChatLayout.spec.md +0 -276
  505. package/src/Chat/ChatLayout.test.tsx +0 -311
  506. package/src/Chat/ChatLayoutScrollButton.spec.md +0 -322
  507. package/src/Chat/ChatLayoutScrollButton.test.tsx +0 -99
  508. package/src/Chat/ChatMessage.spec.md +0 -265
  509. package/src/Chat/ChatMessage.test.tsx +0 -344
  510. package/src/Chat/ChatMessageBubble.spec.md +0 -263
  511. package/src/Chat/ChatMessageBubble.test.tsx +0 -294
  512. package/src/Chat/ChatMessageList.spec.md +0 -222
  513. package/src/Chat/ChatMessageList.test.tsx +0 -198
  514. package/src/Chat/ChatMessageMetadata.spec.md +0 -220
  515. package/src/Chat/ChatMessageMetadata.test.tsx +0 -66
  516. package/src/Chat/ChatPastedTextToken.test.tsx +0 -71
  517. package/src/Chat/ChatSendButton.spec.md +0 -238
  518. package/src/Chat/ChatSendButton.test.tsx +0 -309
  519. package/src/Chat/ChatSystemMessage.spec.md +0 -224
  520. package/src/Chat/ChatSystemMessage.test.tsx +0 -189
  521. package/src/Chat/ChatTokenizedText.spec.md +0 -190
  522. package/src/Chat/ChatTokenizedText.test.tsx +0 -163
  523. package/src/Chat/ChatToolCalls.spec.md +0 -194
  524. package/src/Chat/ChatToolCalls.test.tsx +0 -413
  525. package/src/Chat/__tests__/ChatLayoutScrollButton.a11y.chromium.spec.ts +0 -577
  526. package/src/Chat/__tests__/ChatLayoutScrollButtonSurface.a11y.chromium.spec.ts +0 -740
  527. package/src/Chat/__tests__/ChatMessageBubble.a11y.chromium.spec.ts +0 -457
  528. package/src/Chat/__tests__/ChatMessageBubble.auditProvenance.test.ts +0 -91
  529. package/src/Chat/__tests__/ChatMessageBubble.auditProvenance.ts +0 -91
  530. package/src/Chat/__tests__/ChatMessageList.a11y.chromium.spec.ts +0 -465
  531. package/src/Chat/__tests__/ChatMessageMetadata.a11y.chromium.spec.ts +0 -416
  532. package/src/Chat/__tests__/ChatSendButton.a11y.chromium.spec.ts +0 -1523
  533. package/src/Chat/__tests__/ChatSystemMessage.a11y.chromium.spec.ts +0 -1004
  534. package/src/Chat/__tests__/ChatTokenizedText.a11y.chromium.spec.ts +0 -574
  535. package/src/Chat/__tests__/useChatStreamScroll.a11y.chromium.spec.ts +0 -263
  536. package/src/Chat/__tests__/useChatStreamScroll.fixture.tsx +0 -61
  537. package/src/Chat/useChatDictation.test.tsx +0 -369
  538. package/src/Chat/useChatNewMessages.test.tsx +0 -209
  539. package/src/Chat/useChatPasteAsToken.test.ts +0 -191
  540. package/src/Chat/useChatStreamScroll.test.tsx +0 -381
  541. package/src/Chat/useTriggerMenu.test.tsx +0 -994
  542. package/src/CheckboxInput/CheckboxInput.spec.md +0 -218
  543. package/src/CheckboxInput/CheckboxInput.test.tsx +0 -926
  544. package/src/CheckboxInput/__tests__/Checkbox.a11y.chromium.spec.ts +0 -354
  545. package/src/CheckboxInput/__tests__/Checkbox.a11y.known-failures.ts +0 -54
  546. package/src/CheckboxInput/__tests__/Checkbox.a11y.renders.tsx +0 -310
  547. package/src/CheckboxInput/__tests__/Checkbox.a11y.states.ts +0 -404
  548. package/src/CheckboxInput/__tests__/Checkbox.a11y.test.tsx +0 -128
  549. package/src/CheckboxList/CheckboxList.fr10.test.tsx +0 -51
  550. package/src/CheckboxList/CheckboxList.spec.md +0 -332
  551. package/src/CheckboxList/CheckboxList.test.tsx +0 -1159
  552. package/src/CheckboxList/CheckboxListItem.spec.md +0 -302
  553. package/src/CheckboxList/__tests__/CheckboxList.a11y.chromium.spec.ts +0 -1998
  554. package/src/Citation/Citation.spec.md +0 -179
  555. package/src/Citation/Citation.test.tsx +0 -361
  556. package/src/ClickableCard/ClickableCard.spec.md +0 -241
  557. package/src/ClickableCard/ClickableCard.test.tsx +0 -382
  558. package/src/Code/Code.spec.md +0 -170
  559. package/src/Code/Code.test.tsx +0 -75
  560. package/src/CodeBlock/CodeBlock.highlightStyles.test.tsx +0 -87
  561. package/src/CodeBlock/CodeBlock.spec.md +0 -243
  562. package/src/CodeBlock/CodeBlock.test.tsx +0 -752
  563. package/src/CodeBlock/CodeLanguage.test.tsx +0 -173
  564. package/src/CodeBlock/__tests__/CodeBlockCopyClearance.a11y.chromium.spec.ts +0 -325
  565. package/src/CodeBlock/__tests__/CodeBlockLanguages.a11y.chromium.spec.ts +0 -64
  566. package/src/CodeBlock/__tests__/CodeBlockOverflowStop.a11y.chromium.spec.ts +0 -126
  567. package/src/CodeBlock/__tests__/DiffRowPaint.a11y.chromium.spec.ts +0 -94
  568. package/src/CodeBlock/highlightRanges.test.ts +0 -253
  569. package/src/CodeBlock/languages.test.ts +0 -402
  570. package/src/CodeBlock/tokenizer.test.ts +0 -280
  571. package/src/CodeBlock/tokenizerBudget.test.ts +0 -112
  572. package/src/Collapsible/Collapsible.spec.md +0 -247
  573. package/src/Collapsible/Collapsible.test.tsx +0 -620
  574. package/src/Collapsible/CollapsibleGroup.spec.md +0 -229
  575. package/src/Collapsible/CollapsibleGroup.test.tsx +0 -656
  576. package/src/Collapsible/__tests__/Collapsible.a11y.chromium.spec.ts +0 -194
  577. package/src/Collapsible/__tests__/Collapsible.a11y.states.ts +0 -117
  578. package/src/Collapsible/__tests__/Collapsible.a11y.test.tsx +0 -140
  579. package/src/Collapsible/__tests__/CollapsibleGroup.a11y.chromium.spec.ts +0 -559
  580. package/src/Collapsible/__tests__/CollapsibleGroup.a11y.renders.tsx +0 -45
  581. package/src/Collapsible/__tests__/CollapsibleGroup.a11y.states.ts +0 -139
  582. package/src/Collapsible/__tests__/CollapsibleGroup.a11y.test.tsx +0 -135
  583. package/src/Collapsible/__tests__/CollapsibleGroupAccordion.a11y.chromium.spec.ts +0 -141
  584. package/src/Collapsible/useCollapsible.test.tsx +0 -236
  585. package/src/CommandPalette/CommandPalette.perf.test.ts +0 -100
  586. package/src/CommandPalette/CommandPalette.spec.md +0 -278
  587. package/src/CommandPalette/CommandPalette.test.tsx +0 -750
  588. package/src/CommandPalette/CommandPaletteEmpty.spec.md +0 -190
  589. package/src/CommandPalette/CommandPaletteEmpty.test.tsx +0 -101
  590. package/src/CommandPalette/CommandPaletteFooter.test.tsx +0 -122
  591. package/src/CommandPalette/CommandPaletteGroup.test.tsx +0 -129
  592. package/src/CommandPalette/CommandPaletteInput.spec.md +0 -215
  593. package/src/CommandPalette/CommandPaletteInput.test.tsx +0 -539
  594. package/src/CommandPalette/CommandPaletteItem.spec.md +0 -223
  595. package/src/CommandPalette/CommandPaletteItem.test.tsx +0 -417
  596. package/src/CommandPalette/CommandPaletteList.spec.md +0 -194
  597. package/src/CommandPalette/CommandPaletteList.test.tsx +0 -184
  598. package/src/CommandPalette/__tests__/CommandPalette.a11y.chromium.spec.ts +0 -600
  599. package/src/CommandPalette/__tests__/CommandPaletteEmptyAudit.a11y.chromium.spec.ts +0 -715
  600. package/src/CommandPalette/__tests__/CommandPaletteFooter.a11y.chromium.spec.ts +0 -582
  601. package/src/CommandPalette/__tests__/CommandPaletteInputAudit.a11y.chromium.spec.ts +0 -336
  602. package/src/CommandPalette/__tests__/CommandPaletteItemAudit.a11y.chromium.spec.ts +0 -523
  603. package/src/ComplexSelector/ComplexSelector.focusableDisabled.test.tsx +0 -76
  604. package/src/ComplexSelector/ComplexSelector.fr10.test.tsx +0 -262
  605. package/src/ComplexSelector/ComplexSelector.spec.md +0 -266
  606. package/src/ComplexSelector/ComplexSelector.test.tsx +0 -1171
  607. package/src/ComplexSelector/__tests__/ComplexSelector.a11y.chromium.spec.ts +0 -965
  608. package/src/ContextMenu/ContextMenu.spec.md +0 -279
  609. package/src/ContextMenu/ContextMenu.test.tsx +0 -1617
  610. package/src/ContextMenu/ContextMenu.triggerProps.test.tsx +0 -54
  611. package/src/ContextMenu/ContextMenuItem.spec.md +0 -132
  612. package/src/ContextMenu/__tests__/ContextMenuAudit.a11y.chromium.spec.ts +0 -439
  613. package/src/ContextMenu/__tests__/ContextMenuCursorAnchor.a11y.browser.spec.ts +0 -154
  614. package/src/ContextMenu/__tests__/ContextMenuLongPress.a11y.chromium.spec.ts +0 -117
  615. package/src/DateInput/DateInput.fr10.test.tsx +0 -283
  616. package/src/DateInput/DateInput.spec.md +0 -319
  617. package/src/DateInput/DateInput.test.tsx +0 -1571
  618. package/src/DateInput/DateInputTouch.test.tsx +0 -2948
  619. package/src/DateInput/MonthScrollerSettle.test.tsx +0 -165
  620. package/src/DateInput/NativeDateField.test.tsx +0 -741
  621. package/src/DateInput/Presentation.test.tsx +0 -121
  622. package/src/DateInput/__tests__/DateInputAudit.a11y.chromium.spec.ts +0 -577
  623. package/src/DateInput/__tests__/MonthScrollerSteps.interaction.browser.spec.ts +0 -312
  624. package/src/DateInput/__tests__/WheelPinchZoom.a11y.chromium.spec.ts +0 -171
  625. package/src/DateRangeInput/DateRangeInput.fr10.test.tsx +0 -165
  626. package/src/DateRangeInput/DateRangeInput.spec.md +0 -203
  627. package/src/DateRangeInput/DateRangeInput.test.tsx +0 -1151
  628. package/src/DateTimeInput/DateTimeInput.fr10.test.tsx +0 -319
  629. package/src/DateTimeInput/DateTimeInput.spec.md +0 -270
  630. package/src/DateTimeInput/DateTimeInput.test.tsx +0 -2656
  631. package/src/DateTimeInput/DateTimeInputTouch.test.tsx +0 -1071
  632. package/src/DateTimeInput/NativePickerSegments.test.tsx +0 -657
  633. package/src/DateTimeInput/Presentation.test.tsx +0 -89
  634. package/src/Dialog/Dialog.source-build.test.mjs +0 -43
  635. package/src/Dialog/Dialog.spec.md +0 -189
  636. package/src/Dialog/Dialog.test.tsx +0 -1599
  637. package/src/Dialog/DialogHeader.test.tsx +0 -477
  638. package/src/Dialog/__tests__/Dialog.a11y.browser.spec.ts +0 -111
  639. package/src/Dialog/__tests__/Dialog.a11y.chromium.spec.ts +0 -218
  640. package/src/Dialog/__tests__/Dialog.a11y.known-failures.ts +0 -28
  641. package/src/Dialog/__tests__/Dialog.a11y.renders.tsx +0 -107
  642. package/src/Dialog/__tests__/Dialog.a11y.states.ts +0 -104
  643. package/src/Dialog/__tests__/Dialog.a11y.test.tsx +0 -102
  644. package/src/Dialog/__tests__/Dialog.reduced-motion.a11y.browser.spec.ts +0 -252
  645. package/src/Dialog/__tests__/DialogSecondDocument.a11y.browser.spec.ts +0 -202
  646. package/src/Dialog/modules/DialogHeader.spec.md +0 -211
  647. package/src/Dialog/useImperativeDialog.test.tsx +0 -78
  648. package/src/Divider/Divider.spec.md +0 -252
  649. package/src/Divider/Divider.test.tsx +0 -155
  650. package/src/Drawer/Drawer.spec.md +0 -388
  651. package/src/Drawer/Drawer.test.tsx +0 -1335
  652. package/src/Drawer/DrawerDirection.test.tsx +0 -127
  653. package/src/Drawer/DrawerHeader.spec.md +0 -181
  654. package/src/Drawer/DrawerHeader.test.tsx +0 -102
  655. package/src/Drawer/__tests__/DrawerAudit.a11y.chromium.spec.ts +0 -402
  656. package/src/Drawer/__tests__/DrawerHeaderAudit.a11y.chromium.spec.ts +0 -298
  657. package/src/Drawer/__tests__/DrawerNonModalPageScroll.a11y.chromium.spec.ts +0 -267
  658. package/src/DropdownMenu/DropdownMenu.spec.md +0 -562
  659. package/src/DropdownMenu/DropdownMenu.ssr.test.tsx +0 -93
  660. package/src/DropdownMenu/DropdownMenu.test.tsx +0 -4498
  661. package/src/DropdownMenu/DropdownMenuCheckboxItem.spec.md +0 -192
  662. package/src/DropdownMenu/DropdownMenuContext.public.test.ts +0 -22
  663. package/src/DropdownMenu/DropdownMenuDivider.spec.md +0 -186
  664. package/src/DropdownMenu/DropdownMenuGroup.spec.md +0 -145
  665. package/src/DropdownMenu/DropdownMenuItem.spec.md +0 -215
  666. package/src/DropdownMenu/DropdownMenuLazySheet.test.tsx +0 -126
  667. package/src/DropdownMenu/DropdownMenuRadioGroup.spec.md +0 -187
  668. package/src/DropdownMenu/DropdownMenuRadioItem.spec.md +0 -227
  669. package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +0 -635
  670. package/src/DropdownMenu/DropdownMenuSheetFirstOpen.test.tsx +0 -72
  671. package/src/DropdownMenu/DropdownMenuSubMenu.spec.md +0 -231
  672. package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +0 -2442
  673. package/src/DropdownMenu/__tests__/DropdownMenuDividerAudit.a11y.chromium.spec.ts +0 -281
  674. package/src/DropdownMenu/__tests__/DropdownMenuDrillIn.a11y.chromium.spec.ts +0 -175
  675. package/src/DropdownMenu/__tests__/DropdownMenuFocusReturn.a11y.browser.spec.ts +0 -74
  676. package/src/DropdownMenu/__tests__/DropdownMenuGroupAudit.a11y.chromium.spec.ts +0 -335
  677. package/src/DropdownMenu/__tests__/DropdownMenuItemAudit.a11y.chromium.spec.ts +0 -367
  678. package/src/DropdownMenu/__tests__/DropdownMenuRadioGroupAudit.a11y.chromium.spec.ts +0 -328
  679. package/src/DropdownMenu/__tests__/DropdownMenuRadioItemAudit.a11y.chromium.spec.ts +0 -540
  680. package/src/DropdownMenu/__tests__/DropdownMenuSubMenuAudit.a11y.chromium.spec.ts +0 -671
  681. package/src/DropdownMenu/__tests__/Menu.a11y.chromium.spec.ts +0 -158
  682. package/src/DropdownMenu/__tests__/Menu.a11y.known-failures.ts +0 -26
  683. package/src/DropdownMenu/__tests__/Menu.a11y.renders.tsx +0 -65
  684. package/src/DropdownMenu/__tests__/Menu.a11y.states.ts +0 -138
  685. package/src/DropdownMenu/__tests__/Menu.a11y.test.tsx +0 -136
  686. package/src/DropdownMenu/__tests__/MenuButton.a11y.chromium.spec.ts +0 -149
  687. package/src/DropdownMenu/__tests__/MenuButton.a11y.known-failures.ts +0 -12
  688. package/src/DropdownMenu/__tests__/MenuButton.a11y.renders.tsx +0 -67
  689. package/src/DropdownMenu/__tests__/MenuButton.a11y.states.ts +0 -141
  690. package/src/DropdownMenu/__tests__/MenuButton.a11y.test.tsx +0 -138
  691. package/src/DropdownMenu/__tests__/MenuHeaderFooter.a11y.chromium.spec.ts +0 -231
  692. package/src/DropdownMenu/__tests__/MenuHoverFocus.a11y.chromium.spec.ts +0 -238
  693. package/src/DropdownMenu/__tests__/MenuPinchZoom.a11y.chromium.spec.ts +0 -173
  694. package/src/DropdownMenu/__tests__/MenuPress.a11y.chromium.spec.ts +0 -503
  695. package/src/DropdownMenu/__tests__/SubMenuHeaderFooter.a11y.chromium.spec.ts +0 -268
  696. package/src/DropdownMenu/__tests__/warmMenuBottomSheet.tsx +0 -43
  697. package/src/DropdownMenu/lazyMenuBottomSheet.test.ts +0 -60
  698. package/src/DropdownMenu/modules/useMenuHover.spec.md +0 -283
  699. package/src/DropdownMenu/modules/useMenuPress.spec.md +0 -348
  700. package/src/EmptyState/EmptyState.announce.test.tsx +0 -227
  701. package/src/EmptyState/EmptyState.spec.md +0 -203
  702. package/src/EmptyState/EmptyState.test.tsx +0 -284
  703. package/src/Field/Field.spec.md +0 -226
  704. package/src/Field/Field.test.tsx +0 -800
  705. package/src/Field/FieldLabel.spec.md +0 -183
  706. package/src/Field/FieldLabel.test.tsx +0 -244
  707. package/src/Field/InputClearButton.test.tsx +0 -395
  708. package/src/Field/__tests__/FieldLabelAudit.a11y.chromium.spec.ts +0 -297
  709. package/src/Field/fieldInputFamily.test.tsx +0 -160
  710. package/src/FieldStatus/FieldStatus.spec.md +0 -224
  711. package/src/FieldStatus/FieldStatus.test.tsx +0 -482
  712. package/src/FieldStatus/__tests__/StatusMessage.a11y.chromium.spec.ts +0 -206
  713. package/src/FieldStatus/__tests__/StatusMessage.a11y.known-failures.ts +0 -13
  714. package/src/FieldStatus/__tests__/StatusMessage.a11y.renders.tsx +0 -287
  715. package/src/FieldStatus/__tests__/StatusMessage.a11y.states.ts +0 -302
  716. package/src/FieldStatus/__tests__/StatusMessage.a11y.test.tsx +0 -154
  717. package/src/FileInput/FileInput.fr10.test.tsx +0 -21
  718. package/src/FileInput/FileInput.spec.md +0 -199
  719. package/src/FileInput/FileInput.test.tsx +0 -1291
  720. package/src/FormLayout/FormLayout.spec.md +0 -209
  721. package/src/FormLayout/FormLayout.test.tsx +0 -444
  722. package/src/FormLayout/__snapshots__/FormLayout.test.tsx.snap +0 -46
  723. package/src/Grid/Grid.spec.md +0 -193
  724. package/src/Grid/Grid.test.tsx +0 -509
  725. package/src/Grid/GridSpan.spec.md +0 -158
  726. package/src/HStack/HStack.test.tsx +0 -129
  727. package/src/Heading/Heading.spec.md +0 -198
  728. package/src/Heading/Heading.test.tsx +0 -328
  729. package/src/HoverCard/HoverCard.spec.md +0 -244
  730. package/src/HoverCard/HoverCard.test.tsx +0 -1339
  731. package/src/Icon/Icon.spec.md +0 -244
  732. package/src/Icon/Icon.test.tsx +0 -990
  733. package/src/Icon/globalIconRegistry.test.tsx +0 -613
  734. package/src/IconButton/IconButton.spec.md +0 -197
  735. package/src/IconButton/IconButton.test.tsx +0 -156
  736. package/src/Indicator/CheckIndicator.spec.md +0 -164
  737. package/src/Indicator/CheckboxIndicator.spec.md +0 -164
  738. package/src/Indicator/Indicator.spec.md +0 -188
  739. package/src/Indicator/Indicator.test.tsx +0 -389
  740. package/src/Indicator/indicatorRegistry.test.tsx +0 -106
  741. package/src/InputGroup/InputGroup.spec.md +0 -199
  742. package/src/InputGroup/InputGroup.test.tsx +0 -502
  743. package/src/InputGroup/InputGroupText.spec.md +0 -139
  744. package/src/InteractiveRoleContext/InteractiveRoleContext.test.tsx +0 -185
  745. package/src/Item/Item.source-build.test.mjs +0 -88
  746. package/src/Item/Item.spec.md +0 -226
  747. package/src/Item/Item.swipeLayer.test.tsx +0 -74
  748. package/src/Item/Item.test.tsx +0 -1515
  749. package/src/Item/ItemMarkerColumns.a11y.chromium.spec.ts +0 -211
  750. package/src/Item/__tests__/ItemSwipeActions.a11y.chromium.spec.ts +0 -337
  751. package/src/Item/__tests__/ItemSwipePinchZoom.a11y.chromium.spec.ts +0 -186
  752. package/src/Kbd/Kbd.spec.md +0 -185
  753. package/src/Kbd/Kbd.test.tsx +0 -299
  754. package/src/Layer/LayerProvider.spec.md +0 -149
  755. package/src/Layer/LayerProvider.test.tsx +0 -143
  756. package/src/Layer/__tests__/LayerBrowserHide.a11y.chromium.spec.ts +0 -126
  757. package/src/Layer/__tests__/LayerReducedMotion.a11y.chromium.spec.ts +0 -176
  758. package/src/Layer/__tests__/TouchTrigger.a11y.chromium.spec.ts +0 -200
  759. package/src/Layer/anchorName.test.ts +0 -146
  760. package/src/Layer/layerDismissalFamilies.test.tsx +0 -487
  761. package/src/Layer/layerDismissalInvariants.test.tsx +0 -501
  762. package/src/Layer/layerHost.test.ts +0 -117
  763. package/src/Layer/layerScopedContext.test.tsx +0 -499
  764. package/src/Layer/layerViewportInset.source-build.test.mjs +0 -90
  765. package/src/Layer/layerViewportInset.test.ts +0 -120
  766. package/src/Layer/popoverOperations.test.ts +0 -205
  767. package/src/Layer/useLayer.test.tsx +0 -2845
  768. package/src/Layer/useLayerDismissal.test.tsx +0 -580
  769. package/src/Layer/useTouchTrigger.test.ts +0 -70
  770. package/src/Layout/Layout.spec.md +0 -243
  771. package/src/Layout/Layout.test.tsx +0 -375
  772. package/src/Layout/LayoutContent.spec.md +0 -205
  773. package/src/Layout/LayoutFooter.spec.md +0 -190
  774. package/src/Layout/LayoutHeader.spec.md +0 -193
  775. package/src/Layout/LayoutPanel.spec.md +0 -194
  776. package/src/Layout/LayoutSlots.test.tsx +0 -376
  777. package/src/Layout/__tests__/Layout.a11y.chromium.spec.ts +0 -134
  778. package/src/Layout/__tests__/Layout.a11y.renders.tsx +0 -110
  779. package/src/Layout/__tests__/Layout.a11y.states.ts +0 -93
  780. package/src/Layout/__tests__/Layout.a11y.test.tsx +0 -142
  781. package/src/Layout/__tests__/childrenAsContent.test.tsx +0 -59
  782. package/src/Layout/__tests__/contentWidth.test.tsx +0 -303
  783. package/src/Layout/__tests__/edgeCompensation.test.tsx +0 -191
  784. package/src/Layout/__tests__/nestedPadding.test.tsx +0 -264
  785. package/src/Layout/overlayPaddingReset.test.tsx +0 -224
  786. package/src/Lightbox/Lightbox.spec.md +0 -199
  787. package/src/Lightbox/Lightbox.test.tsx +0 -837
  788. package/src/Lightbox/LightboxKeyboard.a11y.browser.spec.ts +0 -78
  789. package/src/Lightbox/LightboxViewport.a11y.browser.spec.ts +0 -74
  790. package/src/Lightbox/useLightbox.test.tsx +0 -263
  791. package/src/Link/Link.spec.md +0 -230
  792. package/src/Link/Link.test.tsx +0 -457
  793. package/src/Link/LinkProvider.spec.md +0 -167
  794. package/src/Link/__tests__/Link.a11y.chromium.spec.ts +0 -153
  795. package/src/Link/__tests__/Link.a11y.renders.tsx +0 -97
  796. package/src/Link/__tests__/Link.a11y.states.ts +0 -104
  797. package/src/Link/__tests__/Link.a11y.test.tsx +0 -127
  798. package/src/Link/__tests__/Link.navigation.a11y.chromium.spec.ts +0 -262
  799. package/src/Link/__tests__/Link.truncation.a11y.chromium.spec.ts +0 -58
  800. package/src/Link/useLinkComponent.test.tsx +0 -572
  801. package/src/Link/useLinkify.test.tsx +0 -146
  802. package/src/List/List.spec.md +0 -336
  803. package/src/List/List.test.tsx +0 -1052
  804. package/src/List/ListItem.source-build.test.mjs +0 -41
  805. package/src/List/ListItem.spec.md +0 -205
  806. package/src/List/ListMarkers.a11y.chromium.spec.ts +0 -904
  807. package/src/Markdown/Markdown.codeLanguages.test.tsx +0 -137
  808. package/src/Markdown/Markdown.fr23.bench.ts +0 -176
  809. package/src/Markdown/Markdown.fr23.perf.test.ts +0 -484
  810. package/src/Markdown/Markdown.helpers.perf.test.ts +0 -495
  811. package/src/Markdown/Markdown.public.test.ts +0 -309
  812. package/src/Markdown/Markdown.renderBoundary.test.tsx +0 -72
  813. package/src/Markdown/Markdown.rerender.test.tsx +0 -143
  814. package/src/Markdown/Markdown.spec.md +0 -595
  815. package/src/Markdown/Markdown.test.tsx +0 -1383
  816. package/src/Markdown/MarkdownTable.a11y.chromium.spec.ts +0 -727
  817. package/src/Markdown/__tests__/MarkdownNesting.a11y.chromium.spec.ts +0 -102
  818. package/src/Markdown/angleDestinations.test.tsx +0 -104
  819. package/src/Markdown/ast.test.ts +0 -374
  820. package/src/Markdown/atxHeadingIndentation.test.tsx +0 -53
  821. package/src/Markdown/blockNesting.test.tsx +0 -124
  822. package/src/Markdown/blockquoteMarkers.test.tsx +0 -69
  823. package/src/Markdown/characterReferences.test.ts +0 -47
  824. package/src/Markdown/codeSpans.test.tsx +0 -65
  825. package/src/Markdown/emphasis.test.tsx +0 -214
  826. package/src/Markdown/fenceInfo.test.tsx +0 -47
  827. package/src/Markdown/imageAlt.test.tsx +0 -84
  828. package/src/Markdown/incremental.test.ts +0 -1198
  829. package/src/Markdown/incrementalIndentation.test.tsx +0 -36
  830. package/src/Markdown/indentedFences.test.tsx +0 -374
  831. package/src/Markdown/indentedTables.test.tsx +0 -53
  832. package/src/Markdown/linkBrackets.test.tsx +0 -116
  833. package/src/Markdown/linkDestinationLinear.test.tsx +0 -54
  834. package/src/Markdown/linkDestinations.test.tsx +0 -127
  835. package/src/Markdown/linkTextCode.test.tsx +0 -65
  836. package/src/Markdown/listBullets.test.tsx +0 -55
  837. package/src/Markdown/listContinuation.test.tsx +0 -94
  838. package/src/Markdown/listThematicBreak.test.tsx +0 -49
  839. package/src/Markdown/longLinkLabels.test.tsx +0 -49
  840. package/src/Markdown/modules/headingLinks.spec.md +0 -262
  841. package/src/Markdown/modules/remark.spec.md +0 -269
  842. package/src/Markdown/modules/softBreaks.spec.md +0 -137
  843. package/src/Markdown/modules/sourceLines.spec.md +0 -162
  844. package/src/Markdown/openFenceFinalNewline.test.tsx +0 -85
  845. package/src/Markdown/parser.perf.test.ts +0 -398
  846. package/src/Markdown/parser.public.test.ts +0 -144
  847. package/src/Markdown/parser.test.ts +0 -1925
  848. package/src/Markdown/plugin-renderer/MarkdownPluginNodeRenderer.test.tsx +0 -300
  849. package/src/Markdown/plugins/frontmatter.test.tsx +0 -150
  850. package/src/Markdown/plugins/headingLinks.a11y.chromium.spec.ts +0 -856
  851. package/src/Markdown/plugins/headingLinks.ssr.test.tsx +0 -143
  852. package/src/Markdown/plugins/headingLinks.test.tsx +0 -637
  853. package/src/Markdown/plugins/protocol.test.tsx +0 -1083
  854. package/src/Markdown/plugins/semanticFence.test.tsx +0 -655
  855. package/src/Markdown/plugins/softBreaks.test.tsx +0 -172
  856. package/src/Markdown/plugins/sourceDecoration.test.tsx +0 -799
  857. package/src/Markdown/plugins/sourceLines.test.tsx +0 -715
  858. package/src/Markdown/plugins/textTransform.test.ts +0 -467
  859. package/src/Markdown/remark.test.tsx +0 -1877
  860. package/src/Markdown/streaming.test.ts +0 -148
  861. package/src/Markdown/streamingListShapes.test.tsx +0 -93
  862. package/src/Markdown/trailingSpaces.test.tsx +0 -45
  863. package/src/MetadataList/MetadataList.spec.md +0 -187
  864. package/src/MetadataList/MetadataList.test.tsx +0 -383
  865. package/src/MetadataList/MetadataListItem.spec.md +0 -165
  866. package/src/MobileNav/MobileNav.spec.md +0 -306
  867. package/src/MobileNav/MobileNav.test.tsx +0 -296
  868. package/src/MobileNav/MobileNavCloseEdgeCases.test.tsx +0 -584
  869. package/src/MobileNav/MobileNavCloseTiming.test.ts +0 -58
  870. package/src/MobileNav/MobileNavCloseVisibility.test.tsx +0 -172
  871. package/src/MobileNav/MobileNavEntryAnimation.test.tsx +0 -212
  872. package/src/MobileNav/MobileNavFocus.test.tsx +0 -553
  873. package/src/MobileNav/MobileNavPinchZoom.a11y.chromium.spec.ts +0 -147
  874. package/src/MobileNav/MobileNavReopen.test.tsx +0 -118
  875. package/src/MobileNav/MobileNavScrollbarGutter.test.tsx +0 -109
  876. package/src/MobileNav/MobileNavToggle.test.tsx +0 -179
  877. package/src/MobileNav/__tests__/MobileNavHeader.a11y.chromium.spec.ts +0 -89
  878. package/src/MobileNav/__tests__/MobileNavWidth.a11y.chromium.spec.ts +0 -103
  879. package/src/MoreMenu/MoreMenu.spec.md +0 -268
  880. package/src/MoreMenu/MoreMenu.test.tsx +0 -367
  881. package/src/MultiSelector/CreateRow.a11y.chromium.spec.ts +0 -148
  882. package/src/MultiSelector/MultiSelector.disabledFocus.a11y.chromium.spec.ts +0 -72
  883. package/src/MultiSelector/MultiSelector.focusableDisabled.test.tsx +0 -121
  884. package/src/MultiSelector/MultiSelector.fr10.test.tsx +0 -221
  885. package/src/MultiSelector/MultiSelector.spec.md +0 -357
  886. package/src/MultiSelector/MultiSelector.test.tsx +0 -4971
  887. package/src/MultiSelector/OptionActions.a11y.chromium.spec.ts +0 -310
  888. package/src/MultiSelector/__tests__/MultiSelector.a11y.chromium.spec.ts +0 -46
  889. package/src/MultiSelector/__tests__/MultiSelector.listbox.a11y.test.tsx +0 -135
  890. package/src/NavIcon/NavIcon.spec.md +0 -158
  891. package/src/NavIcon/NavIcon.test.tsx +0 -41
  892. package/src/NavMenu/NavHeadingMenu.spec.md +0 -264
  893. package/src/NavMenu/NavHeadingMenu.test.tsx +0 -714
  894. package/src/NavMenu/__tests__/NavMenusSlideSelection.a11y.chromium.spec.ts +0 -137
  895. package/src/NumberInput/NumberInput.fr10.test.tsx +0 -21
  896. package/src/NumberInput/NumberInput.spec.md +0 -270
  897. package/src/NumberInput/NumberInput.test.tsx +0 -2697
  898. package/src/NumberInput/__tests__/NumberInput.a11y.chromium.spec.ts +0 -124
  899. package/src/NumberInput/__tests__/NumberInput.a11y.known-failures.ts +0 -26
  900. package/src/NumberInput/__tests__/NumberInput.a11y.renders.tsx +0 -77
  901. package/src/NumberInput/__tests__/NumberInput.a11y.states.ts +0 -116
  902. package/src/NumberInput/__tests__/NumberInput.a11y.test.tsx +0 -154
  903. package/src/NumberInput/__tests__/NumberInput.coarse-pointer.a11y.chromium.spec.ts +0 -102
  904. package/src/NumberInput/numberInputCommit.test.ts +0 -72
  905. package/src/NumberInput/numberParser.docblock.test.ts +0 -234
  906. package/src/NumberInput/numberParser.test.ts +0 -222
  907. package/src/Outline/Outline.spec.md +0 -258
  908. package/src/Outline/Outline.test.tsx +0 -1134
  909. package/src/Outline/OutlineFocus.a11y.chromium.spec.ts +0 -551
  910. package/src/Outline/modules/parseOutlineFromMarkdown.spec.md +0 -150
  911. package/src/Outline/parseOutlineFromMarkdown.test.ts +0 -104
  912. package/src/OverflowList/OverflowList.spec.md +0 -204
  913. package/src/OverflowList/OverflowList.test.tsx +0 -1073
  914. package/src/Overlay/Overlay.spec.md +0 -304
  915. package/src/Overlay/Overlay.test.tsx +0 -424
  916. package/src/Pagination/Pagination.spec.md +0 -300
  917. package/src/Pagination/Pagination.test.tsx +0 -1754
  918. package/src/Popover/Popover.spec.md +0 -525
  919. package/src/Popover/Popover.test.tsx +0 -1508
  920. package/src/Popover/PopoverPresentation.test.tsx +0 -952
  921. package/src/Popover/__tests__/PopoverSecondDocument.a11y.chromium.spec.ts +0 -267
  922. package/src/PowerSearch/PowerSearch.spec.md +0 -661
  923. package/src/PowerSearch/PowerSearch.test.tsx +0 -1027
  924. package/src/PowerSearch/PowerSearchEditPopover.test.tsx +0 -1190
  925. package/src/PowerSearch/PowerSearchFilterEditor.test.tsx +0 -377
  926. package/src/PowerSearch/PowerSearchToken.test.tsx +0 -230
  927. package/src/PowerSearch/PowerSearchValueEditor.test.tsx +0 -754
  928. package/src/PowerSearch/formatFilterValue.test.ts +0 -339
  929. package/src/PowerSearch/resolveDateTimeRangePart.test.ts +0 -40
  930. package/src/PowerSearch/usePowerSearchConfig.test.ts +0 -832
  931. package/src/PowerSearch/usePowerSearchSource.test.ts +0 -621
  932. package/src/ProgressBar/ProgressBar.spec.md +0 -261
  933. package/src/ProgressBar/ProgressBar.test.tsx +0 -928
  934. package/src/ProgressBar/__tests__/ProgressBar.a11y.chromium.spec.ts +0 -127
  935. package/src/ProgressBar/__tests__/ProgressBar.a11y.known-failures.ts +0 -12
  936. package/src/ProgressBar/__tests__/ProgressBar.a11y.renders.tsx +0 -38
  937. package/src/ProgressBar/__tests__/ProgressBar.a11y.states.ts +0 -123
  938. package/src/ProgressBar/__tests__/ProgressBar.a11y.test.tsx +0 -107
  939. package/src/ProgressBar/__tests__/ProgressBarMotion.a11y.chromium.spec.ts +0 -831
  940. package/src/RadioList/RadioList.fr10.test.tsx +0 -67
  941. package/src/RadioList/RadioList.spec.md +0 -227
  942. package/src/RadioList/RadioList.test.tsx +0 -1051
  943. package/src/RadioList/RadioListItem.press.source-build.test.mjs +0 -80
  944. package/src/RadioList/RadioListItem.spec.md +0 -223
  945. package/src/RadioList/__tests__/RadioGroup.a11y.chromium.spec.ts +0 -274
  946. package/src/RadioList/__tests__/RadioGroup.a11y.known-failures.ts +0 -12
  947. package/src/RadioList/__tests__/RadioGroup.a11y.renders.tsx +0 -232
  948. package/src/RadioList/__tests__/RadioGroup.a11y.states.ts +0 -503
  949. package/src/RadioList/__tests__/RadioGroup.a11y.test.tsx +0 -217
  950. package/src/Resizable/Resizable.spec.md +0 -298
  951. package/src/Resizable/ResizeHandle.test.tsx +0 -1067
  952. package/src/Resizable/__tests__/ResizeHandle.a11y.chromium.spec.ts +0 -127
  953. package/src/Resizable/__tests__/ResizeHandle.a11y.known-failures.ts +0 -39
  954. package/src/Resizable/__tests__/ResizeHandle.a11y.renders.tsx +0 -80
  955. package/src/Resizable/__tests__/ResizeHandle.a11y.states.ts +0 -197
  956. package/src/Resizable/__tests__/ResizeHandle.a11y.test.tsx +0 -123
  957. package/src/Resizable/shippedDirections.test.ts +0 -462
  958. package/src/Resizable/useResizable.test.ts +0 -1725
  959. package/src/Resizable/utils.test.ts +0 -74
  960. package/src/ScrollableArea/ScrollableArea.spec.md +0 -190
  961. package/src/ScrollableArea/ScrollableArea.test.tsx +0 -304
  962. package/src/ScrollableArea/modules/useScrollableArea.spec.md +0 -149
  963. package/src/Section/Section.spec.md +0 -197
  964. package/src/Section/Section.test.tsx +0 -376
  965. package/src/SegmentedControl/SegmentedControl.spec.md +0 -261
  966. package/src/SegmentedControl/SegmentedControl.test.tsx +0 -981
  967. package/src/SegmentedControl/SegmentedControlItem.spec.md +0 -206
  968. package/src/SelectableCard/SelectableCard.spec.md +0 -230
  969. package/src/SelectableCard/SelectableCard.test.tsx +0 -216
  970. package/src/Selector/Selector.focusableDisabled.test.tsx +0 -127
  971. package/src/Selector/Selector.fr10.test.tsx +0 -149
  972. package/src/Selector/Selector.sheetActiveDescendant.test.tsx +0 -95
  973. package/src/Selector/Selector.source-build.test.mjs +0 -79
  974. package/src/Selector/Selector.spec.md +0 -379
  975. package/src/Selector/Selector.test.tsx +0 -5117
  976. package/src/Selector/__tests__/Combobox.a11y.known-failures.ts +0 -27
  977. package/src/Selector/__tests__/Combobox.a11y.states.ts +0 -145
  978. package/src/Selector/__tests__/ComboboxField.a11y.chromium.spec.ts +0 -458
  979. package/src/Selector/__tests__/EmptyStateAnnouncement.a11y.chromium.spec.ts +0 -91
  980. package/src/Selector/__tests__/Listbox.a11y.chromium.spec.ts +0 -131
  981. package/src/Selector/__tests__/Listbox.a11y.dom.ts +0 -38
  982. package/src/Selector/__tests__/Listbox.a11y.inventory.test.ts +0 -63
  983. package/src/Selector/__tests__/Listbox.a11y.known-failures.ts +0 -12
  984. package/src/Selector/__tests__/Listbox.a11y.states.ts +0 -232
  985. package/src/Selector/__tests__/Selector.a11y.chromium.spec.ts +0 -46
  986. package/src/Selector/__tests__/Selector.combobox.a11y.chromium.spec.ts +0 -109
  987. package/src/Selector/__tests__/Selector.combobox.a11y.test.tsx +0 -133
  988. package/src/Selector/__tests__/Selector.listbox.a11y.test.tsx +0 -128
  989. package/src/Selector/useCombobox.public.test.tsx +0 -89
  990. package/src/Selector/useCombobox.test.tsx +0 -444
  991. package/src/SideNav/SideNav.spec.md +0 -247
  992. package/src/SideNav/SideNav.test.tsx +0 -4275
  993. package/src/SideNav/SideNavCollapseButton.spec.md +0 -161
  994. package/src/SideNav/SideNavHeading.spec.md +0 -226
  995. package/src/SideNav/SideNavItem.spec.md +0 -236
  996. package/src/SideNav/SideNavRailMotion.test.tsx +0 -620
  997. package/src/SideNav/SideNavSection.spec.md +0 -153
  998. package/src/SideNav/__tests__/SideNavRailMotion.interaction.browser.spec.ts +0 -542
  999. package/src/SizeContext/SizeContext.test.tsx +0 -226
  1000. package/src/Skeleton/Skeleton.spec.md +0 -184
  1001. package/src/Skeleton/Skeleton.test.tsx +0 -148
  1002. package/src/Slider/Slider.fr10.test.tsx +0 -93
  1003. package/src/Slider/Slider.spec.md +0 -285
  1004. package/src/Slider/Slider.test.tsx +0 -1661
  1005. package/src/Slider/__tests__/Slider.a11y.chromium.spec.ts +0 -125
  1006. package/src/Slider/__tests__/Slider.a11y.known-failures.ts +0 -12
  1007. package/src/Slider/__tests__/Slider.a11y.renders.tsx +0 -42
  1008. package/src/Slider/__tests__/Slider.a11y.states.ts +0 -106
  1009. package/src/Slider/__tests__/Slider.a11y.test.tsx +0 -105
  1010. package/src/Spinner/Spinner.spec.md +0 -231
  1011. package/src/Spinner/Spinner.test.tsx +0 -484
  1012. package/src/Stack/Stack.spec.md +0 -203
  1013. package/src/Stack/Stack.test.tsx +0 -473
  1014. package/src/Stack/StackItem.test.tsx +0 -105
  1015. package/src/StatusDot/StatusDot.spec.md +0 -224
  1016. package/src/StatusDot/StatusDot.test.tsx +0 -213
  1017. package/src/Stepper/Step.spec.md +0 -200
  1018. package/src/Stepper/Stepper.public.test.ts +0 -91
  1019. package/src/Stepper/Stepper.spec.md +0 -327
  1020. package/src/Stepper/Stepper.test.tsx +0 -2130
  1021. package/src/Switch/Switch.focusRing.source-build.test.mjs +0 -81
  1022. package/src/Switch/Switch.spec.md +0 -277
  1023. package/src/Switch/Switch.test.tsx +0 -1136
  1024. package/src/Switch/__tests__/Switch.a11y.chromium.spec.ts +0 -211
  1025. package/src/Switch/__tests__/Switch.a11y.known-failures.ts +0 -28
  1026. package/src/Switch/__tests__/Switch.a11y.states.ts +0 -275
  1027. package/src/Switch/__tests__/Switch.a11y.test.tsx +0 -144
  1028. package/src/TabList/Tab.spec.md +0 -201
  1029. package/src/TabList/TabList.spec.md +0 -217
  1030. package/src/TabList/TabList.test.tsx +0 -1755
  1031. package/src/TabList/TabMenu.spec.md +0 -198
  1032. package/src/TabList/__tests__/TabListOverflow.interaction.browser.spec.ts +0 -99
  1033. package/src/TabList/__tests__/TabPressPointer.interaction.browser.spec.ts +0 -163
  1034. package/src/TabList/__tests__/Tabs.a11y.chromium.spec.ts +0 -199
  1035. package/src/TabList/__tests__/Tabs.a11y.known-failures.ts +0 -12
  1036. package/src/TabList/__tests__/Tabs.a11y.renders.tsx +0 -92
  1037. package/src/TabList/__tests__/Tabs.a11y.states.ts +0 -247
  1038. package/src/TabList/__tests__/Tabs.a11y.test.tsx +0 -153
  1039. package/src/Table/Table.perf.test.tsx +0 -569
  1040. package/src/Table/Table.spec.md +0 -395
  1041. package/src/Table/Table.test.tsx +0 -1883
  1042. package/src/Table/TableHeaderCell.test.tsx +0 -291
  1043. package/src/Table/TableSelectionToolbar.test.tsx +0 -109
  1044. package/src/Table/__tests__/Table.a11y.chromium.spec.ts +0 -141
  1045. package/src/Table/__tests__/Table.a11y.contracts.ts +0 -35
  1046. package/src/Table/__tests__/Table.a11y.renders.tsx +0 -112
  1047. package/src/Table/__tests__/Table.a11y.states.ts +0 -136
  1048. package/src/Table/__tests__/Table.a11y.test.tsx +0 -198
  1049. package/src/Table/__tests__/TableMinWidth.a11y.chromium.spec.ts +0 -75
  1050. package/src/Table/__tests__/TableRowGlide.a11y.browser.spec.ts +0 -382
  1051. package/src/Table/__tests__/TableScroll.a11y.chromium.spec.ts +0 -138
  1052. package/src/Table/__tests__/TableStickyDividers.a11y.browser.spec.ts +0 -560
  1053. package/src/Table/plugins/activation/useTableActivation.spec.md +0 -254
  1054. package/src/Table/plugins/columnResize/useTableColumnResize.spec.md +0 -373
  1055. package/src/Table/plugins/columnResize/useTableColumnResize.test.tsx +0 -941
  1056. package/src/Table/plugins/columnSettings/useTableColumnSettings.test.tsx +0 -175
  1057. package/src/Table/plugins/columnSettings/useTableColumnSettingsState.test.tsx +0 -296
  1058. package/src/Table/plugins/filtering/useTableFilterState.test.tsx +0 -143
  1059. package/src/Table/plugins/filtering/useTableFiltering.test.tsx +0 -357
  1060. package/src/Table/plugins/groupedRows/useTableGroupedRows-perf.test.tsx +0 -112
  1061. package/src/Table/plugins/groupedRows/useTableGroupedRows.test.tsx +0 -409
  1062. package/src/Table/plugins/infiniteScroll/useTableInfiniteScroll.spec.md +0 -244
  1063. package/src/Table/plugins/pagination/useTablePagination-perf.test.tsx +0 -232
  1064. package/src/Table/plugins/pagination/useTablePagination.test.tsx +0 -666
  1065. package/src/Table/plugins/rowExpansion/useTableRowExpansion.glide.test.tsx +0 -280
  1066. package/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx +0 -681
  1067. package/src/Table/plugins/rowIndex/useTableRowIndex.test.tsx +0 -132
  1068. package/src/Table/plugins/rowStatus/useTableRowStatus.public.test.ts +0 -92
  1069. package/src/Table/plugins/rowStatus/useTableRowStatus.spec.md +0 -355
  1070. package/src/Table/plugins/rowStatus/useTableRowStatus.test.tsx +0 -519
  1071. package/src/Table/plugins/selection/useTableSelection-perf.test.tsx +0 -258
  1072. package/src/Table/plugins/selection/useTableSelection.test.tsx +0 -424
  1073. package/src/Table/plugins/selection/useTableSelectionState.test.tsx +0 -451
  1074. package/src/Table/plugins/sortable/__tests__/useTableSortable.a11y.test.tsx +0 -174
  1075. package/src/Table/plugins/sortable/__tests__/useTableSortable.a11y.ts +0 -86
  1076. package/src/Table/plugins/sortable/useTableSortable.test.tsx +0 -786
  1077. package/src/Table/plugins/sortable/useTableSortableState.test.tsx +0 -580
  1078. package/src/Table/plugins/stickyColumns/useTableStickyColumns.test.tsx +0 -334
  1079. package/src/Table/plugins/tree/useTableTreeData-perf.test.tsx +0 -163
  1080. package/src/Table/plugins/tree/useTableTreeData.test.tsx +0 -992
  1081. package/src/Table/plugins/tree/useTableTreeState.test.tsx +0 -740
  1082. package/src/Table/plugins/virtualization/useTableVirtualization.spec.md +0 -266
  1083. package/src/Table/tableContextMenu.test.tsx +0 -208
  1084. package/src/Text/Text.spec.md +0 -193
  1085. package/src/Text/Text.test.tsx +0 -405
  1086. package/src/Text/useTruncation.test.tsx +0 -196
  1087. package/src/TextArea/TextArea.fr10.test.tsx +0 -21
  1088. package/src/TextArea/TextArea.spec.md +0 -300
  1089. package/src/TextArea/TextArea.test.tsx +0 -1317
  1090. package/src/TextInput/TextInput.fr10.test.tsx +0 -21
  1091. package/src/TextInput/TextInput.spec.md +0 -260
  1092. package/src/TextInput/TextInput.test.tsx +0 -1280
  1093. package/src/TextInput/__tests__/TextInput.a11y.chromium.spec.ts +0 -214
  1094. package/src/TextInput/__tests__/TextInput.a11y.known-failures.ts +0 -40
  1095. package/src/TextInput/__tests__/TextInput.a11y.renders.tsx +0 -202
  1096. package/src/TextInput/__tests__/TextInput.a11y.states.ts +0 -384
  1097. package/src/TextInput/__tests__/TextInput.a11y.test.tsx +0 -130
  1098. package/src/Thumbnail/Thumbnail.spec.md +0 -244
  1099. package/src/Thumbnail/Thumbnail.test.tsx +0 -384
  1100. package/src/TimeInput/NativeTimeInput.test.tsx +0 -343
  1101. package/src/TimeInput/Presentation.test.tsx +0 -192
  1102. package/src/TimeInput/TimeInput.fr10.test.tsx +0 -312
  1103. package/src/TimeInput/TimeInput.spec.md +0 -270
  1104. package/src/TimeInput/TimeInput.test.tsx +0 -907
  1105. package/src/Timer/Timer.spec.md +0 -215
  1106. package/src/Timer/Timer.test.tsx +0 -302
  1107. package/src/Timestamp/Timestamp.spec.md +0 -246
  1108. package/src/Timestamp/Timestamp.test.tsx +0 -1661
  1109. package/src/Timestamp/tooltipEntries.test.ts +0 -566
  1110. package/src/Toast/Toast.spec.md +0 -291
  1111. package/src/Toast/ToastViewport.modalHost.test.tsx +0 -891
  1112. package/src/Toast/ToastViewport.test.tsx +0 -3130
  1113. package/src/Toast/useToast.test.tsx +0 -258
  1114. package/src/ToggleButton/ToggleButton.spec.md +0 -256
  1115. package/src/ToggleButton/ToggleButton.test.tsx +0 -1000
  1116. package/src/ToggleButton/ToggleButtonGroup.spec.md +0 -195
  1117. package/src/ToggleButton/__tests__/ToggleButton.a11y.chromium.spec.ts +0 -177
  1118. package/src/ToggleButton/__tests__/ToggleButton.a11y.renders.tsx +0 -133
  1119. package/src/ToggleButton/__tests__/ToggleButton.a11y.states.ts +0 -167
  1120. package/src/ToggleButton/__tests__/ToggleButton.a11y.test.tsx +0 -103
  1121. package/src/Token/Token.spec.md +0 -261
  1122. package/src/Token/Token.test.tsx +0 -707
  1123. package/src/Token/__tests__/TokenRemoveTarget.a11y.chromium.spec.ts +0 -87
  1124. package/src/Tokenizer/Tokenizer.fr10.test.tsx +0 -28
  1125. package/src/Tokenizer/Tokenizer.props-type.test.tsx +0 -126
  1126. package/src/Tokenizer/Tokenizer.spec.md +0 -615
  1127. package/src/Tokenizer/Tokenizer.ssr.test.tsx +0 -196
  1128. package/src/Tokenizer/Tokenizer.test.tsx +0 -2216
  1129. package/src/Tokenizer/TokenizerBottomSheet.test.tsx +0 -2738
  1130. package/src/Tokenizer/__tests__/TokenizerEndLane.a11y.chromium.spec.ts +0 -505
  1131. package/src/Toolbar/Toolbar.spec.md +0 -227
  1132. package/src/Toolbar/Toolbar.test.tsx +0 -600
  1133. package/src/Toolbar/__tests__/Toolbar.a11y.chromium.spec.ts +0 -176
  1134. package/src/Toolbar/__tests__/Toolbar.a11y.renders.tsx +0 -63
  1135. package/src/Toolbar/__tests__/Toolbar.a11y.states.ts +0 -142
  1136. package/src/Toolbar/__tests__/Toolbar.a11y.test.tsx +0 -126
  1137. package/src/Tooltip/Tooltip.spec.md +0 -267
  1138. package/src/Tooltip/Tooltip.test.tsx +0 -819
  1139. package/src/Tooltip/__tests__/Tooltip.a11y.chromium.spec.ts +0 -141
  1140. package/src/Tooltip/__tests__/Tooltip.a11y.renders.tsx +0 -86
  1141. package/src/Tooltip/__tests__/Tooltip.a11y.states.ts +0 -132
  1142. package/src/Tooltip/__tests__/Tooltip.a11y.test.tsx +0 -126
  1143. package/src/Tooltip/__tests__/TooltipFocusReturn.a11y.chromium.spec.ts +0 -130
  1144. package/src/Tooltip/__tests__/TooltipHoverBridge.a11y.chromium.spec.ts +0 -75
  1145. package/src/Tooltip/__tests__/TooltipTallContent.a11y.browser.spec.ts +0 -673
  1146. package/src/Tooltip/__tests__/TooltipTallContentTracking.a11y.browser.spec.ts +0 -1162
  1147. package/src/Tooltip/useTooltip.test.tsx +0 -483
  1148. package/src/TopNav/TopNav.spec.md +0 -190
  1149. package/src/TopNav/TopNav.test.tsx +0 -863
  1150. package/src/TopNav/TopNavHeading.spec.md +0 -211
  1151. package/src/TopNav/TopNavItem.spec.md +0 -189
  1152. package/src/TopNav/TopNavMegaMenu.reduced-motion.source-build.test.mjs +0 -83
  1153. package/src/TopNav/TopNavMegaMenu.spec.md +0 -190
  1154. package/src/TopNav/TopNavMegaMenu.test.tsx +0 -1153
  1155. package/src/TopNav/TopNavMegaMenuFeaturedCard.spec.md +0 -150
  1156. package/src/TopNav/TopNavMegaMenuItem.spec.md +0 -155
  1157. package/src/TopNav/TopNavMenu.spec.md +0 -202
  1158. package/src/TopNav/TopNavMenu.test.tsx +0 -502
  1159. package/src/TopNav/__tests__/TopNavMobileLongHeading.a11y.chromium.spec.ts +0 -75
  1160. package/src/TreeList/TreeList.spec.md +0 -328
  1161. package/src/TreeList/TreeList.test.tsx +0 -1737
  1162. package/src/TreeList/__tests__/TreeList.a11y.chromium.spec.ts +0 -138
  1163. package/src/TreeList/__tests__/TreeList.a11y.renders.tsx +0 -44
  1164. package/src/TreeList/__tests__/TreeList.a11y.states.ts +0 -164
  1165. package/src/TreeList/__tests__/TreeList.a11y.test.tsx +0 -138
  1166. package/src/TreeList/__tests__/TreeListGuideAlignment.interaction.browser.spec.ts +0 -127
  1167. package/src/TreeList/__tests__/TreeListRowNames.a11y.chromium.spec.ts +0 -83
  1168. package/src/Typeahead/BaseTypeahead.emptyState.a11y.chromium.spec.ts +0 -138
  1169. package/src/Typeahead/BaseTypeahead.spec.md +0 -270
  1170. package/src/Typeahead/BaseTypeahead.test.tsx +0 -553
  1171. package/src/Typeahead/Typeahead.fr10.test.tsx +0 -28
  1172. package/src/Typeahead/Typeahead.spec.md +0 -257
  1173. package/src/Typeahead/Typeahead.test.tsx +0 -2984
  1174. package/src/Typeahead/TypeaheadItem.test.tsx +0 -134
  1175. package/src/VStack/VStack.test.tsx +0 -128
  1176. package/src/VisuallyHidden/VisuallyHidden.spec.md +0 -170
  1177. package/src/VisuallyHidden/VisuallyHidden.test.tsx +0 -115
  1178. package/src/__tests__/BusyOwnerAnnouncement.test.tsx +0 -853
  1179. package/src/__tests__/CardPress.a11y.chromium.spec.ts +0 -353
  1180. package/src/__tests__/DisabledTriggerFocus.a11y.chromium.spec.ts +0 -87
  1181. package/src/__tests__/PressModality.a11y.chromium.spec.ts +0 -392
  1182. package/src/__tests__/PressedState.a11y.chromium.spec.ts +0 -814
  1183. package/src/__tests__/TestIcon.tsx +0 -26
  1184. package/src/__tests__/babelPluginAddExtensions.test.ts +0 -190
  1185. package/src/__tests__/fastRoleQueries.ts +0 -66
  1186. package/src/__tests__/forcedColors.ts +0 -60
  1187. package/src/__tests__/internalModulesNotExperimental.test.ts +0 -88
  1188. package/src/__tests__/pressState.ts +0 -216
  1189. package/src/__tests__/stubMatchMedia.test.ts +0 -79
  1190. package/src/__tests__/stubMatchMedia.ts +0 -95
  1191. package/src/__tests__/stylexDeclarations.ts +0 -51
  1192. package/src/__tests__/unthemedLength.ts +0 -34
  1193. package/src/docPropLiterals.test.ts +0 -964
  1194. package/src/docPropReferences.test.ts +0 -178
  1195. package/src/docs-script.test.mjs +0 -55
  1196. package/src/gestures/__tests__/GestureHost.test.ts +0 -2136
  1197. package/src/gestures/__tests__/LongPressGestureRecognizer.test.ts +0 -141
  1198. package/src/gestures/__tests__/PanGestureRecognizer.test.ts +0 -327
  1199. package/src/gestures/__tests__/PinchGestureRecognizer.test.ts +0 -74
  1200. package/src/gestures/__tests__/PressTracker.test.ts +0 -275
  1201. package/src/gestures/__tests__/ScreenEdgePanGestureRecognizer.test.ts +0 -498
  1202. package/src/gestures/__tests__/SwipeGestureRecognizer.test.ts +0 -108
  1203. package/src/gestures/__tests__/TapGestureRecognizer.test.ts +0 -154
  1204. package/src/gestures/__tests__/VelocityTracker.streams.test.ts +0 -243
  1205. package/src/gestures/__tests__/VelocityTracker.test.ts +0 -261
  1206. package/src/gestures/__tests__/arena.test.ts +0 -864
  1207. package/src/gestures/__tests__/arenaContinuous.test.ts +0 -207
  1208. package/src/gestures/__tests__/arenaPinchSwipeEdge.test.ts +0 -193
  1209. package/src/gestures/__tests__/arenaTapLongPress.test.ts +0 -211
  1210. package/src/gestures/__tests__/browser/build-fixture.mjs +0 -46
  1211. package/src/gestures/__tests__/browser/fixture.ts +0 -307
  1212. package/src/gestures/__tests__/browser/gestures.interaction.browser.spec.ts +0 -1137
  1213. package/src/gestures/__tests__/browserNegotiation.test.ts +0 -293
  1214. package/src/gestures/__tests__/fixtures/pointer-streams/README.md +0 -82
  1215. package/src/gestures/__tests__/fixtures/pointer-streams/android-chromium-fling.json +0 -130
  1216. package/src/gestures/__tests__/fixtures/pointer-streams/android-chromium-slow.json +0 -860
  1217. package/src/gestures/__tests__/fixtures/pointer-streams/android-chromium-stop-release.json +0 -357
  1218. package/src/gestures/__tests__/fixtures/pointer-streams/android-firefox-fling.json +0 -66
  1219. package/src/gestures/__tests__/fixtures/pointer-streams/android-firefox-slow.json +0 -268
  1220. package/src/gestures/__tests__/fixtures/pointer-streams/android-firefox-stop-release.json +0 -128
  1221. package/src/gestures/__tests__/fixtures/pointer-streams/capture.html +0 -123
  1222. package/src/gestures/__tests__/fixtures/pointer-streams/desktop-chromium-mouse-fling.json +0 -64
  1223. package/src/gestures/__tests__/fixtures/pointer-streams/desktop-chromium-mouse-slow.json +0 -268
  1224. package/src/gestures/__tests__/fixtures/pointer-streams/desktop-chromium-mouse-stop-release.json +0 -124
  1225. package/src/gestures/__tests__/fixtures/pointer-streams/desktop-chromium-pen-fling.json +0 -64
  1226. package/src/gestures/__tests__/fixtures/pointer-streams/desktop-chromium-pen-slow.json +0 -268
  1227. package/src/gestures/__tests__/fixtures/pointer-streams/desktop-chromium-pen-stop-release.json +0 -124
  1228. package/src/gestures/__tests__/fixtures/pointer-streams/desktop-chromium-touch-fling.json +0 -84
  1229. package/src/gestures/__tests__/fixtures/pointer-streams/desktop-chromium-touch-slow.json +0 -381
  1230. package/src/gestures/__tests__/fixtures/pointer-streams/desktop-chromium-touch-stop-release.json +0 -171
  1231. package/src/gestures/__tests__/fixtures/pointer-streams/ios-safari-fling.json +0 -45
  1232. package/src/gestures/__tests__/fixtures/pointer-streams/ios-safari-slow.json +0 -101
  1233. package/src/gestures/__tests__/fixtures/pointer-streams/ios-safari-stop-release.json +0 -130
  1234. package/src/gestures/__tests__/haptics.test.ts +0 -187
  1235. package/src/gestures/__tests__/harness.ts +0 -252
  1236. package/src/gestures/__tests__/pressTrackerFactory.test.ts +0 -59
  1237. package/src/gestures/__tests__/recognizerKind.test.ts +0 -78
  1238. package/src/gestures/__tests__/touchActionRule.test.ts +0 -54
  1239. package/src/gestures/__tests__/useGestureRecognizer.test.tsx +0 -570
  1240. package/src/hooks/__tests__/MenuPressShadowRoot.a11y.chromium.spec.ts +0 -144
  1241. package/src/hooks/__tests__/menuLinkClicks.ts +0 -71
  1242. package/src/hooks/actionGroupTracker.exports.test.ts +0 -28
  1243. package/src/hooks/actionGroupTracker.test.ts +0 -510
  1244. package/src/hooks/computeOverflow.test.ts +0 -422
  1245. package/src/hooks/deprecatedApis.public.test.ts +0 -33
  1246. package/src/hooks/menuPressGesture.test.ts +0 -253
  1247. package/src/hooks/scrollKeyboardDelegation.test.ts +0 -188
  1248. package/src/hooks/scrollbarGutter.test.ts +0 -167
  1249. package/src/hooks/useAnnounce.modal.test.tsx +0 -1291
  1250. package/src/hooks/useAnnounce.replace.test.tsx +0 -516
  1251. package/src/hooks/useAnnounce.test.tsx +0 -293
  1252. package/src/hooks/useAnnounceRenderedText.adopters.test.tsx +0 -235
  1253. package/src/hooks/useAutoMediaMode.test.ts +0 -109
  1254. package/src/hooks/useBusyAnnouncement.adopters.test.tsx +0 -69
  1255. package/src/hooks/useBusyAnnouncement.test.tsx +0 -112
  1256. package/src/hooks/useClickableContainer.test.tsx +0 -236
  1257. package/src/hooks/useClipboard.test.tsx +0 -151
  1258. package/src/hooks/useContainerReveal.test.tsx +0 -163
  1259. package/src/hooks/useDevWarning.test.tsx +0 -45
  1260. package/src/hooks/useEntryAnimation.ssr.test.tsx +0 -143
  1261. package/src/hooks/useFocusTrap.test.tsx +0 -635
  1262. package/src/hooks/useFocusTrapEscapeShim.test.tsx +0 -166
  1263. package/src/hooks/useGridFocus.test.tsx +0 -165
  1264. package/src/hooks/useHotkeys.test.ts +0 -265
  1265. package/src/hooks/useImageMode.test.ts +0 -133
  1266. package/src/hooks/useInputContainer.test.tsx +0 -180
  1267. package/src/hooks/useInputStatusIcon.test.tsx +0 -240
  1268. package/src/hooks/useIsHydrating.test.tsx +0 -70
  1269. package/src/hooks/useKeyboardHint.test.tsx +0 -92
  1270. package/src/hooks/useListFocus.test.tsx +0 -664
  1271. package/src/hooks/useLongPress.test.tsx +0 -152
  1272. package/src/hooks/useMediaQuery.test.ts +0 -165
  1273. package/src/hooks/useMenuHover.test.tsx +0 -536
  1274. package/src/hooks/useMenuPress.test.tsx +0 -565
  1275. package/src/hooks/useMergedRefs.test.tsx +0 -62
  1276. package/src/hooks/useOverflow.test.ts +0 -504
  1277. package/src/hooks/useRenamedProp.test.tsx +0 -95
  1278. package/src/hooks/useScrollLock.test.ts +0 -248
  1279. package/src/hooks/useScrollOverflow.test.tsx +0 -323
  1280. package/src/hooks/useScrollableArea.test.tsx +0 -836
  1281. package/src/hooks/useStreamingText.test.ts +0 -237
  1282. package/src/hooks/useTreeFocus.test.tsx +0 -351
  1283. package/src/hooks/useTypeahead.test.tsx +0 -351
  1284. package/src/i18n/InternationalizationProvider.spec.md +0 -252
  1285. package/src/i18n/__tests__/InternationalizationProvider.test.tsx +0 -128
  1286. package/src/i18n/__tests__/e2e-pagination.test.tsx +0 -172
  1287. package/src/i18n/__tests__/e2e-powersearch.test.tsx +0 -166
  1288. package/src/i18n/__tests__/getLocaleDirection.test.ts +0 -40
  1289. package/src/i18n/__tests__/resolve.test.ts +0 -325
  1290. package/src/i18n/__tests__/useCollator.test.tsx +0 -115
  1291. package/src/i18n/__tests__/useDirection.test.tsx +0 -66
  1292. package/src/i18n/__tests__/useLocale.test.tsx +0 -52
  1293. package/src/i18n/useTranslator.test.tsx +0 -267
  1294. package/src/inputFontFloor.test.ts +0 -106
  1295. package/src/internal/tokenizer-presentation.test.ts +0 -29
  1296. package/src/internal/touch.test.ts +0 -44
  1297. package/src/motion/__tests__/animatedLayout.interaction.browser.spec.ts +0 -1613
  1298. package/src/motion/__tests__/animatedLayoutAdopters.interaction.browser.spec.ts +0 -217
  1299. package/src/motion/__tests__/animatedLayoutBundle.ts +0 -17
  1300. package/src/motion/__tests__/animator.interaction.browser.spec.ts +0 -843
  1301. package/src/motion/__tests__/motionBundle.ts +0 -14
  1302. package/src/motion/animatedLayout.boundary.test.ts +0 -155
  1303. package/src/motion/animatedLayout.swap.test.ts +0 -827
  1304. package/src/motion/animatedLayout.test.ts +0 -1154
  1305. package/src/motion/animatedLayoutAdopters.test.tsx +0 -500
  1306. package/src/motion/animator.test.ts +0 -3746
  1307. package/src/motion/bezier.test.ts +0 -52
  1308. package/src/motion/coast.test.ts +0 -99
  1309. package/src/motion/decay.test.ts +0 -120
  1310. package/src/motion/projection.test.ts +0 -107
  1311. package/src/motion/reducedMotion.test.ts +0 -129
  1312. package/src/motion/reducedMotionPlan.test.ts +0 -208
  1313. package/src/motion/resolveMotion.test.ts +0 -123
  1314. package/src/motion/resolveSnapPoint.test.ts +0 -189
  1315. package/src/motion/roles.test.ts +0 -273
  1316. package/src/motion/rubberBand.test.ts +0 -88
  1317. package/src/motion/selectPage.test.ts +0 -31
  1318. package/src/motion/spring.test.ts +0 -650
  1319. package/src/motion/uikit/gestures.test.ts +0 -89
  1320. package/src/motion/uikit/springRows.test.ts +0 -71
  1321. package/src/motion/uikit/tableImports.test.ts +0 -293
  1322. package/src/motion/uikit/uikit.test.ts +0 -364
  1323. package/src/motion/uikit/values.test.ts +0 -121
  1324. package/src/naming.test.ts +0 -44
  1325. package/src/postinstall.test.mjs +0 -216
  1326. package/src/reset.a11y.chromium.spec.ts +0 -238
  1327. package/src/reset.test.ts +0 -205
  1328. package/src/reset.until-found.a11y.browser.spec.ts +0 -76
  1329. package/src/reset.until-found.test.ts +0 -32
  1330. package/src/serverSafeComponents.test.ts +0 -675
  1331. package/src/stylexValidation.source-build.test.mjs +0 -42
  1332. package/src/tailwind-theme.test.ts +0 -153
  1333. package/src/theme/MediaTheme.dom.test.tsx +0 -97
  1334. package/src/theme/Theme.test.tsx +0 -337
  1335. package/src/theme/__tests__/SpacingRootFontSize.a11y.chromium.spec.ts +0 -199
  1336. package/src/theme/contrast.test.ts +0 -94
  1337. package/src/theme/declarationBoundary.test.ts +0 -126
  1338. package/src/theme/defineTheme.test.ts +0 -2028
  1339. package/src/theme/derivedVarRegistry.test.ts +0 -592
  1340. package/src/theme/expandColorScale.test.ts +0 -651
  1341. package/src/theme/expandMotionScale.test.ts +0 -145
  1342. package/src/theme/expandRadiusScale.test.ts +0 -59
  1343. package/src/theme/expandTypeScale.test.ts +0 -351
  1344. package/src/theme/extensibleAxes.test.ts +0 -432
  1345. package/src/theme/generateThemeRules.test.ts +0 -1870
  1346. package/src/theme/hct.test.ts +0 -93
  1347. package/src/theme/onMediaTokens.test.ts +0 -431
  1348. package/src/theme/publicThemeHelperContract.test.ts +0 -67
  1349. package/src/theme/syntax/defineSyntaxTheme.diff.test.ts +0 -91
  1350. package/src/theme/syntax/serverSafeSyntax.test.ts +0 -68
  1351. package/src/theme/syntax/useSyntaxTheme.diff.test.tsx +0 -40
  1352. package/src/theme/themeAdaptations.test.ts +0 -1795
  1353. package/src/theme/themeMotion.test.ts +0 -620
  1354. package/src/theme/themeRegistry.test.ts +0 -59
  1355. package/src/theme/themingTargets.test.ts +0 -589
  1356. package/src/theme/tokenValueCompat.test.ts +0 -204
  1357. package/src/theme/tokens.test.ts +0 -441
  1358. package/src/theme/useTheme.test.tsx +0 -322
  1359. package/src/unicodePropertyEscapes.source-build.test.mjs +0 -69
  1360. package/src/utils/chainEventHandlers.test.ts +0 -39
  1361. package/src/utils/characters.test.ts +0 -141
  1362. package/src/utils/color.test.ts +0 -233
  1363. package/src/utils/composeEventHandlers.test.ts +0 -71
  1364. package/src/utils/customPropertyArmLayering.test.ts +0 -131
  1365. package/src/utils/dateParser.test.ts +0 -402
  1366. package/src/utils/dateTypes.test.ts +0 -40
  1367. package/src/utils/devWarning.test.ts +0 -56
  1368. package/src/utils/edgeAutoscroll.test.ts +0 -192
  1369. package/src/utils/focusReturn.test.ts +0 -119
  1370. package/src/utils/getKey.test.ts +0 -25
  1371. package/src/utils/getNodeText.test.ts +0 -24
  1372. package/src/utils/hitArea.test.ts +0 -628
  1373. package/src/utils/ime.test.ts +0 -32
  1374. package/src/utils/inputAria.test.ts +0 -39
  1375. package/src/utils/interactionModality.test.ts +0 -144
  1376. package/src/utils/isApplePlatform.test.ts +0 -61
  1377. package/src/utils/mergeProps.test.ts +0 -166
  1378. package/src/utils/mergeRefs.test.ts +0 -48
  1379. package/src/utils/parseStyleKey.test.ts +0 -56
  1380. package/src/utils/plainDate.test.ts +0 -938
  1381. package/src/utils/presentation.test.ts +0 -380
  1382. package/src/utils/pressFeedback.test.ts +0 -1012
  1383. package/src/utils/pressGesture.test.ts +0 -332
  1384. package/src/utils/pressPaintPriority.test.ts +0 -80
  1385. package/src/utils/pressPaintSource.test.ts +0 -65
  1386. package/src/utils/pressableCoverage.test.ts +0 -192
  1387. package/src/utils/primaryClick.test.ts +0 -38
  1388. package/src/utils/safeUrl.test.ts +0 -101
  1389. package/src/utils/sharedMutationObserver.test.ts +0 -106
  1390. package/src/utils/sharedResizeObserver.test.ts +0 -283
  1391. package/src/utils/themeProps.test.ts +0 -62
  1392. package/src/utils/timeFormat.test.ts +0 -204
  1393. package/src/utils/timeParser.test.ts +0 -295
  1394. package/src/utils/touchPresentation.test.ts +0 -462
  1395. package/src/utils/unicodeDigits.test.ts +0 -44
@@ -1,3746 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- /**
4
- * @file animator.test.ts
5
- * @input vitest (jsdom), the animator, a recording stand-in for
6
- * Element.animate (jsdom runs no animations)
7
- * @output Checks what the animator hands the browser: keyframes that follow
8
- * the analytic curves, the clock, the inline end state; and what it reads
9
- * back: presentation values and velocities, retarget continuity, stop,
10
- * completion, Reduced Motion substitutions, momentum curves (a coast with
11
- * edges), late attach
12
- * @position Testing; the compositor itself is proven in
13
- * __tests__/animator.interaction.browser.spec.ts
14
- */
15
-
16
- import {execFileSync} from 'node:child_process';
17
- import fs from 'node:fs';
18
- import path from 'node:path';
19
- import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest';
20
- import {
21
- animatorFor,
22
- createAnimator,
23
- END_HOLD_MS,
24
- PROMOTION_LINGER_MS,
25
- type AnimatorOptions,
26
- } from './animator';
27
- import {cubicBezier} from './bezier';
28
- import {coast} from './coast';
29
- import {solveDecay} from './decay';
30
- import {solveSpring, solveSpringTowardRamp, toSpring} from './spring';
31
- import {scroll} from './uikit/scroll';
32
- import {springs} from './uikit/springs';
33
- import {timing} from './uikit/timing';
34
-
35
- interface Recorded {
36
- element: Element;
37
- keyframes: Keyframe[];
38
- options: KeyframeAnimationOptions;
39
- startTime: number | null;
40
- /** The fake clock when it was created (a pending start reads from it). */
41
- createdAt: number;
42
- cancelled: boolean;
43
- /** A sampler holding it (the interaction harness pauses to seek). */
44
- paused: boolean;
45
- /** Frames a resumed (play()) animation still waits for its start. */
46
- startDelayFrames: number;
47
- /** Finished from outside (a sampler's `finish()`), keeping its start. */
48
- finished: boolean;
49
- readonly playState: 'idle' | 'paused' | 'running' | 'finished';
50
- ready: Promise<Recorded>;
51
- commit(at: number): void;
52
- finish(): void;
53
- cancel(): void;
54
- }
55
-
56
- let clock = 1000;
57
- let recorded: Recorded[] = [];
58
- /** Callbacks waiting for the next animation frame (`requestFrame`). */
59
- let frameQueue: (() => void)[] = [];
60
- const requestFrame = (callback: () => void) => {
61
- frameQueue.push(callback);
62
- };
63
- /**
64
- * What the page's stylesheet sets, by property. Computed style reads it
65
- * under the inline value (jsdom keeps stale computed values for these
66
- * properties, so the page is modeled here).
67
- */
68
- let stylesheet: Record<string, string> = {};
69
- /** The stylesheet's values for a pseudo-element of the element. */
70
- let pseudoStylesheet: Record<string, string> = {};
71
-
72
- beforeEach(() => {
73
- clock = 1000;
74
- recorded = [];
75
- frameQueue = [];
76
- stylesheet = {};
77
- pseudoStylesheet = {};
78
- vi.spyOn(window, 'getComputedStyle').mockImplementation(
79
- (element, pseudo) =>
80
- ({
81
- getPropertyValue: (property: string) => {
82
- if (pseudo != null) {
83
- return pseudoStylesheet[property] ?? '';
84
- }
85
- // A live animation wins over the inline value, holding its last
86
- // keyframe (the end-state tail) until it is cancelled.
87
- const held = recorded
88
- .filter(
89
- animation =>
90
- animation.element === element &&
91
- !animation.cancelled &&
92
- animation.keyframes.some(frame => property in frame),
93
- )
94
- .at(-1);
95
- const last = held?.keyframes
96
- .filter(frame => property in frame)
97
- .at(-1) as Record<string, unknown> | undefined;
98
- if (last != null) {
99
- return String(last[property]);
100
- }
101
- return (
102
- (element as HTMLElement).style.getPropertyValue(property) ||
103
- (stylesheet[property] ?? '')
104
- );
105
- },
106
- }) as unknown as CSSStyleDeclaration,
107
- );
108
- vi.useFakeTimers();
109
- HTMLElement.prototype.animate = function (keyframes, options) {
110
- let resolveReady: (a: Recorded) => void = () => {};
111
- let rejectReady: (e: Error) => void = () => {};
112
- const ready = new Promise<Recorded>((resolve, reject) => {
113
- resolveReady = resolve;
114
- rejectReady = reject;
115
- });
116
- // Like a browser: a pending animation (no start time) starts at the next
117
- // committed frame; setting a start time, or a cancel, settles `ready`.
118
- let start: number | null = null;
119
- const animation: Recorded = {
120
- element: this,
121
- keyframes: keyframes as Keyframe[],
122
- options: options as KeyframeAnimationOptions,
123
- get startTime() {
124
- return start;
125
- },
126
- set startTime(value) {
127
- start = value;
128
- resolveReady(animation);
129
- },
130
- createdAt: clock,
131
- cancelled: false,
132
- paused: false,
133
- finished: false,
134
- get playState() {
135
- return this.cancelled
136
- ? 'idle'
137
- : this.finished
138
- ? 'finished'
139
- : this.paused
140
- ? 'paused'
141
- : 'running';
142
- },
143
- ready,
144
- commit(at) {
145
- // A paused animation's pending pause completes without a start; one
146
- // resumed with play() gets its start a frame later.
147
- if (this.startDelayFrames > 0) {
148
- this.startDelayFrames -= 1;
149
- } else if (!this.cancelled && start == null && !this.paused) {
150
- start = at;
151
- }
152
- resolveReady(this);
153
- },
154
- startDelayFrames: 0,
155
- finish() {
156
- this.finished = true;
157
- },
158
- cancel() {
159
- this.cancelled = true;
160
- rejectReady(new Error('AbortError'));
161
- },
162
- };
163
- recorded.push(animation);
164
- return animation as unknown as Animation;
165
- };
166
- });
167
-
168
- afterEach(() => {
169
- vi.unstubAllGlobals();
170
- Reflect.deleteProperty(HTMLElement.prototype, 'animate');
171
- vi.useRealTimers();
172
- vi.restoreAllMocks();
173
- });
174
-
175
- /**
176
- * The person's settings, through `matchMedia` as the animator reads them: no
177
- * option overrides them.
178
- */
179
- function stubMedia(reduced: boolean, coarse: boolean) {
180
- vi.stubGlobal('matchMedia', (query: string) => ({
181
- matches: query.includes('prefers-reduced-motion')
182
- ? reduced
183
- : query.includes('pointer: coarse')
184
- ? coarse
185
- : false,
186
- media: query,
187
- onchange: null,
188
- addEventListener: () => {},
189
- removeEventListener: () => {},
190
- addListener: () => {},
191
- removeListener: () => {},
192
- dispatchEvent: () => false,
193
- }));
194
- }
195
-
196
- function setup({
197
- reduced = false,
198
- coarse = false,
199
- ...options
200
- }: AnimatorOptions & {reduced?: boolean; coarse?: boolean} = {}) {
201
- stubMedia(reduced, coarse);
202
- const element = document.createElement('div');
203
- const animator = createAnimator(element, {
204
- now: () => clock,
205
- requestFrame,
206
- ...options,
207
- });
208
- return {element, animator};
209
- }
210
-
211
- /** The browser commits a frame at `at`: pending animations start there. */
212
- async function commitFrame(at: number) {
213
- for (const animation of recorded) {
214
- if (animation.startTime == null && !animation.cancelled) {
215
- animation.commit(at);
216
- }
217
- }
218
- const frames = frameQueue;
219
- frameQueue = [];
220
- for (const callback of frames) {
221
- callback();
222
- }
223
- await Promise.resolve();
224
- await Promise.resolve();
225
- }
226
-
227
- /**
228
- * Advances the injected clock and the timers together. The browser commits
229
- * pending animations at the next frame, here at once.
230
- */
231
- async function advance(ms: number) {
232
- await commitFrame(clock);
233
- clock += ms;
234
- await vi.advanceTimersByTimeAsync(ms);
235
- }
236
-
237
- function live(channel: string): Recorded[] {
238
- return recorded.filter(
239
- a => !a.cancelled && channel in (a.keyframes[0] ?? {}),
240
- );
241
- }
242
-
243
- function parse(value: string | number | null | undefined): number[] {
244
- return String(value)
245
- .split(/\s+/)
246
- .map(part => Number.parseFloat(part));
247
- }
248
-
249
- /** What the browser would show: the keyframes interpolated linearly at `time`. */
250
- function sampleAt(
251
- animation: Recorded,
252
- channel: string,
253
- time: number,
254
- ): number[] {
255
- const duration = Number(animation.options.duration);
256
- const offset = Math.min(
257
- 1,
258
- Math.max(
259
- 0,
260
- (time - (animation.startTime ?? animation.createdAt)) / duration,
261
- ),
262
- );
263
- const frames = animation.keyframes;
264
- for (let i = 0; i + 1 < frames.length; i++) {
265
- const a = frames[i];
266
- const b = frames[i + 1];
267
- const oa = Number(a.offset);
268
- const ob = Number(b.offset);
269
- if (
270
- offset >= oa &&
271
- offset <= ob &&
272
- !(
273
- offset === ob &&
274
- i + 2 < frames.length &&
275
- Number(frames[i + 2].offset) === ob
276
- )
277
- ) {
278
- const va = parse(a[channel]);
279
- const vb = parse(b[channel]);
280
- const f = ob === oa ? 1 : (offset - oa) / (ob - oa);
281
- return va.map((v, k) => v + (vb[k] - v) * f);
282
- }
283
- }
284
- return parse(frames[frames.length - 1][channel]);
285
- }
286
-
287
- describe('animate: keyframes on the compositor', () => {
288
- it('bakes the spring into keyframes within a quarter of a pixel of the curve', async () => {
289
- const {animator} = setup();
290
- animator.animate({x: 300}, {spring: springs.settle});
291
- const [animation] = live('translate');
292
- expect(animation).toBeDefined();
293
- expect(animation.options).toMatchObject({
294
- fill: 'both',
295
- easing: 'linear',
296
- });
297
- // From rest, the browser sets the start when it commits the first frame.
298
- expect(animation.startTime).toBeNull();
299
- await commitFrame(1000);
300
- expect(animation.startTime).toBe(1000);
301
- const curve = solveSpring(toSpring(springs.settle), {from: 0, to: 300});
302
- // The curve, then the end state held (END_HOLD_MS).
303
- const duration = Number(animation.options.duration) - END_HOLD_MS;
304
- expect(duration).toBeCloseTo(curve.settleTime(0.05) * 1000, 6);
305
- for (let t = 0; t <= duration; t += 0.5) {
306
- const [x, y] = sampleAt(animation, 'translate', 1000 + t);
307
- expect(Math.abs(x - curve.value(t / 1000))).toBeLessThan(0.26);
308
- expect(y).toBe(0);
309
- expect(animator.get('x', 1000 + t)).toBeCloseTo(curve.value(t / 1000), 9);
310
- }
311
- // Then the end state, held through a main-thread block.
312
- expect(
313
- sampleAt(animation, 'translate', 1000 + duration + END_HOLD_MS / 2),
314
- ).toEqual([300, 0]);
315
- });
316
-
317
- it('on a 3x screen, bakes the spring within a quarter of a device pixel', async () => {
318
- vi.stubGlobal('devicePixelRatio', 3);
319
- const {animator} = setup();
320
- animator.animate({x: 300}, {spring: springs.settle});
321
- const [animation] = live('translate');
322
- await commitFrame(1000);
323
- const curve = solveSpring(toSpring(springs.settle), {from: 0, to: 300});
324
- const duration = Number(animation.options.duration) - END_HOLD_MS;
325
- let worst = 0;
326
- for (let t = 0; t <= duration; t += 0.5) {
327
- const [x] = sampleAt(animation, 'translate', 1000 + t);
328
- worst = Math.max(worst, Math.abs(x - curve.value(t / 1000)));
329
- }
330
- // In device pixels, as the curve's chords are checked at their quarters.
331
- expect(worst * 3).toBeLessThan(0.26);
332
- });
333
-
334
- it('on a 1x screen, bakes no more keyframes than a quarter of a CSS pixel needs', () => {
335
- const count = (ratio: number) => {
336
- vi.stubGlobal('devicePixelRatio', ratio);
337
- recorded = [];
338
- const {animator} = setup();
339
- animator.animate({x: 300}, {spring: springs.settle});
340
- return live('translate')[0].keyframes.length;
341
- };
342
- const desktop = count(1);
343
- expect(desktop).toBeLessThan(count(3));
344
- // A ratio below 1 (a zoomed-out page) bakes as 1, never coarser.
345
- expect(count(0.5)).toBe(desktop);
346
- });
347
-
348
- it('keeps the keyframe count modest (adaptive sampling)', () => {
349
- const {animator} = setup();
350
- animator.animate({x: 300}, {spring: springs.settle});
351
- expect(live('translate')[0].keyframes.length).toBeLessThan(60);
352
- });
353
-
354
- it('clears an identity transform at rest, so a fixed child stays fixed', async () => {
355
- const {animator, element} = setup();
356
- animator.animate(
357
- {x: 100, scale: 0.9, rotate: 10},
358
- {spring: springs.quickChange},
359
- );
360
- // While the curve runs, the inline value is where it starts.
361
- expect(['', 'none']).toContain(element.style.translate);
362
- await advance(100);
363
- animator.animate(
364
- {x: 0, scale: 1, rotate: 0},
365
- {spring: springs.quickChange},
366
- );
367
- // While the motion back runs, the inline value is where it starts.
368
- expect(live('translate')).toHaveLength(1);
369
- expect(parse(element.style.translate)[0]).toBeCloseTo(animator.get('x'), 2);
370
- await advance(5000);
371
- // At rest the identity leaves the element: translate 0px 0px would make
372
- // the element a fixed child's containing block, and scale 1 stops a
373
- // finger scrolling inside it on Mobile Safari.
374
- expect(element.style.translate).toBe('');
375
- expect(element.style.scale).toBe('');
376
- expect(element.style.rotate).toBe('');
377
- // The keyframes stay numeric, so the curve still interpolates.
378
- animator.animate({x: 50}, {spring: springs.quickChange});
379
- expect(live('translate')[0].keyframes[0].translate).toBe('0px 0px');
380
- });
381
-
382
- it('clears opacity back at 1, and an identity set at rest, and keeps any other value', async () => {
383
- const {animator, element} = setup();
384
- animator.set({opacity: 0});
385
- animator.animate({opacity: 1}, {spring: springs.quickChange});
386
- await advance(5000);
387
- expect(element.style.opacity).toBe('');
388
- animator.set({x: 12});
389
- animator.set({x: 0});
390
- expect(element.style.translate).toBe('');
391
- animator.animate({opacity: 0.5, x: 20}, {spring: springs.quickChange});
392
- await advance(5000);
393
- expect(element.style.opacity).toBe('0.5');
394
- expect(element.style.translate).toBe('20px 0px');
395
- });
396
-
397
- it('keeps an identity inline where the stylesheet would move the element', async () => {
398
- const {animator, element} = setup();
399
- stylesheet.scale = '0.5';
400
- animator.animate({scale: 0.9}, {spring: springs.quickChange});
401
- animator.animate({scale: 1}, {spring: springs.quickChange});
402
- await advance(5000);
403
- expect(element.style.scale).toBe('none');
404
- });
405
-
406
- it('keeps a fade to 1 inline where the stylesheet rests at 0', async () => {
407
- const {animator, element} = setup();
408
- // A scroll edge layer: transparent in its stylesheet, faded in on a
409
- // spring. At retire the end-state tail still holds 1, so the end can only
410
- // be judged against the stylesheet once the animation is gone.
411
- stylesheet.opacity = '0';
412
- animator.set({opacity: 0});
413
- animator.animate({opacity: 1}, {spring: springs.quickChange});
414
- await advance(5000);
415
- expect(live('opacity')).toHaveLength(0);
416
- expect(element.style.opacity).toBe('1');
417
- });
418
-
419
- it('holds the value on screen inline while a curve runs, and the end once it retires', async () => {
420
- const {animator, element} = setup();
421
- animator.set({x: 10, opacity: 0.5});
422
- animator.animate(
423
- {x: 120, y: -40, scale: 1.1, rotate: 12, opacity: 0.25},
424
- {spring: springs.quickChange},
425
- );
426
- // A frame painted before the compositor has the curve shows where the
427
- // element is, never where it is going.
428
- expect(element.style.translate).toBe('10px 0px');
429
- expect(element.style.opacity).toBe('0.5');
430
- const animations = ['translate', 'scale', 'rotate', 'opacity'].map(
431
- channel => live(channel)[0],
432
- );
433
- await commitFrame(clock);
434
- await advance(5000);
435
- expect(element.style.translate).toBe('120px -40px');
436
- expect(element.style.scale).toBe('1.1 1.1');
437
- expect(element.style.rotate).toBe('12deg');
438
- expect(element.style.opacity).toBe('0.25');
439
- for (const animation of animations) {
440
- expect(animation.cancelled).toBe(true);
441
- }
442
- });
443
-
444
- it('keeps the end state in effect until the main thread drops the finished animation', async () => {
445
- const {animator, element} = setup();
446
- animator.animate({x: 120}, {spring: springs.quickChange});
447
- const [animation] = live('translate');
448
- expect(animation.options.fill).toBe('both');
449
- // The animation outlasts its curve by END_HOLD_MS; the main thread drops
450
- // it as soon as it runs after the curve's end.
451
- const duration = Number(animation.options.duration) - END_HOLD_MS;
452
- await advance(duration - 1);
453
- expect(animation.cancelled).toBe(false);
454
- await advance(2);
455
- expect(animation.cancelled).toBe(true);
456
- expect(element.style.translate).toBe(
457
- animation.keyframes[animation.keyframes.length - 1].translate,
458
- );
459
- });
460
-
461
- it('looks for its end again on the next frame when the engine dates animations per frame (WebKit), not in a spin', async () => {
462
- // WebKit moves an animation's currentTime once per frame. A retire that
463
- // looks within a frame reads the frame's time, a fraction of a ms short of
464
- // the end, and a timer set to that fraction fires again before anything
465
- // moved: dozens of timers on the main thread after every motion.
466
- const {animator} = setup();
467
- const handle = animator.animate({x: 100}, {spring: springs.settle});
468
- const [animation] = live('translate');
469
- await commitFrame(clock);
470
- const start = animation.startTime as number;
471
- const curve = Number(animation.options.duration) - END_HOLD_MS;
472
- let frameTime = start;
473
- Object.defineProperty(animation, 'currentTime', {
474
- configurable: true,
475
- get: () => frameTime - start,
476
- });
477
- Object.defineProperty(animation, 'effect', {
478
- configurable: true,
479
- value: {getTiming: () => ({duration: animation.options.duration})},
480
- });
481
- // The last frame before the end dates the animation 0.5 ms short of it.
482
- frameTime = start + curve - 0.5;
483
- // Up to just before the retire is due (the injected clock and the timers
484
- // move together).
485
- clock += curve - 1;
486
- await vi.advanceTimersByTimeAsync(curve - 1);
487
- const timers = vi.spyOn(globalThis, 'setTimeout');
488
- // A frame's worth of main-thread time with no frame in between.
489
- for (let ms = 0; ms < 16; ms++) {
490
- clock += 1;
491
- await vi.advanceTimersByTimeAsync(1);
492
- }
493
- expect(timers.mock.calls.length).toBeLessThanOrEqual(2);
494
- // The next frame: the engine's time passes the end, and it retires.
495
- frameTime = start + curve + 16;
496
- clock += 1;
497
- await vi.advanceTimersByTimeAsync(17);
498
- expect(animation.cancelled).toBe(true);
499
- await expect(handle.finished).resolves.toBe(true);
500
- });
501
-
502
- it('never retires an animation a sampler has paused', async () => {
503
- const {animator} = setup();
504
- animator.animate({x: 120}, {spring: springs.quickChange});
505
- const [animation] = live('translate');
506
- await commitFrame(1000);
507
- const duration = Number(animation.options.duration) - END_HOLD_MS;
508
- animation.paused = true;
509
- await advance(duration + 500);
510
- expect(animation.cancelled).toBe(false);
511
- // Resumed: it leaves once the main thread looks again.
512
- animation.paused = false;
513
- await advance(150);
514
- expect(animation.cancelled).toBe(true);
515
- });
516
-
517
- it('puts everything one call starts on one clock', async () => {
518
- const {animator} = setup();
519
- animator.animate({x: 100, opacity: 0.5}, {spring: springs.settle});
520
- await commitFrame(1000);
521
- const starts = recorded.map(a => a.startTime);
522
- expect(starts).toEqual([1000, 1000]);
523
- animator.animate({rotate: 90}, {spring: springs.settle}, {at: 1234.5});
524
- expect(live('rotate')[0].startTime).toBe(1234.5);
525
- });
526
-
527
- it('expands scale onto both axes and reads it back', async () => {
528
- const {animator} = setup();
529
- animator.animate({scale: 0.5}, {spring: springs.settle});
530
- await commitFrame(clock); // the browser starts it
531
- clock += 5000;
532
- expect(animator.get('scale')).toBe(0.5);
533
- expect(animator.get('scaleY')).toBe(0.5);
534
- });
535
-
536
- it('does nothing for a value already at its target and at rest', async () => {
537
- const {animator} = setup();
538
- const handle = animator.animate({x: 0}, {spring: springs.settle});
539
- expect(live('translate')).toHaveLength(0);
540
- await expect(handle.finished).resolves.toBe(true);
541
- });
542
- });
543
-
544
- describe('a call from rest starts at the commit, as Core Animation does', () => {
545
- const curve = solveSpring(toSpring(springs.settle), {from: 0, to: 300});
546
-
547
- it('a block before the first frame delays the motion instead of skipping into it', async () => {
548
- const {animator} = setup();
549
- const handle = animator.animate({x: 300}, {spring: springs.settle});
550
- const [animation] = live('translate');
551
- expect(animation.startTime).toBeNull();
552
- // Until the commit the curve reads from the call time.
553
- expect(animator.get('x', 1000)).toBe(0);
554
- // The main thread was blocked for 300 ms: the first frame commits at 1300.
555
- clock = 1300;
556
- await commitFrame(1300);
557
- await expect(handle.started).resolves.toBe(1300);
558
- expect(animator.get('x', 1300)).toBeCloseTo(0, 9);
559
- expect(animator.get('x', 1400)).toBeCloseTo(curve.value(0.1), 9);
560
- expect(handle.value('x', 1400)).toBeCloseTo(curve.value(0.1), 9);
561
- expect(sampleAt(animation, 'translate', 1400)[0]).toBeCloseTo(
562
- curve.value(0.1),
563
- 1,
564
- );
565
- });
566
-
567
- it('a start the browser dates before the block (WebKit) moves to after it', async () => {
568
- // WebKit dates a pending animation at its last frame time before the
569
- // task that made it, so after a block its first frame would show the
570
- // motion that far in; the call's first read of that start moves it to
571
- // the read. Chromium's commit start (the case above) stays.
572
- Object.defineProperty(document, 'timeline', {
573
- configurable: true,
574
- get: () => ({currentTime: clock}),
575
- });
576
- try {
577
- const {animator} = setup();
578
- const handle = animator.animate({x: 300}, {spring: springs.settle});
579
- const [animation] = live('translate');
580
- // The task blocks for 300 ms; the browser dates the animation at 1000.
581
- clock = 1300;
582
- animation.startTime = 1000;
583
- await commitFrame(1300);
584
- await expect(handle.started).resolves.toBe(1300);
585
- expect(animation.startTime).toBe(1300);
586
- expect(animator.get('x', 1300)).toBeCloseTo(0, 9);
587
- expect(animator.get('x', 1400)).toBeCloseTo(curve.value(0.1), 9);
588
- } finally {
589
- Reflect.deleteProperty(document, 'timeline');
590
- }
591
- });
592
-
593
- it('a start the browser dates at the frame before the call stays when the call\u2019s task runs on a few ms', async () => {
594
- // Browser start times are frame times and a task's end is a live clock:
595
- // on every call they differ by up to a frame plus the task's own length.
596
- // A task that runs on 5 ms after the call (a component's effect after a
597
- // tap) blocks nothing, so the start stays the browser's and a sequence
598
- // chained on it keeps its clock.
599
- Object.defineProperty(document, 'timeline', {
600
- configurable: true,
601
- get: () => ({currentTime: clock}),
602
- });
603
- try {
604
- const {animator} = setup();
605
- clock = 1005;
606
- const handle = animator.animate({x: 300}, {spring: springs.settle});
607
- const [animation] = live('translate');
608
- clock = 1010;
609
- animation.startTime = 1000;
610
- await commitFrame(1016);
611
- await expect(handle.started).resolves.toBe(1000);
612
- expect(animation.startTime).toBe(1000);
613
- } finally {
614
- Reflect.deleteProperty(document, 'timeline');
615
- }
616
- });
617
-
618
- it('calls made in one task start together, whichever of them a block follows', async () => {
619
- // One motion's parts are often separate calls in one task (a
620
- // component's effect): a block measured per call would move the
621
- // earlier calls past it and leave a later one on the browser's start,
622
- // splitting the parts by a frame.
623
- Object.defineProperty(document, 'timeline', {
624
- configurable: true,
625
- get: () => ({currentTime: clock}),
626
- });
627
- try {
628
- const {animator} = setup();
629
- const first = animator.animate({x: 300}, {spring: springs.settle});
630
- clock = 1030;
631
- const second = animator.animate({opacity: 0.5}, {spring: springs.settle});
632
- clock = 1040;
633
- for (const animation of recorded) {
634
- animation.startTime = 1000;
635
- }
636
- await commitFrame(1040);
637
- const [a, b] = await Promise.all([first.started, second.started]);
638
- expect(a).toBe(b);
639
- } finally {
640
- Reflect.deleteProperty(document, 'timeline');
641
- }
642
- });
643
-
644
- it('a block within two frames of the call keeps the browser\u2019s start', async () => {
645
- // Browser start times are frame times and the task's end a live clock: a
646
- // 20 ms block cannot be told apart from that quantization, so the start
647
- // stays where the browser put it.
648
- Object.defineProperty(document, 'timeline', {
649
- configurable: true,
650
- get: () => ({currentTime: clock}),
651
- });
652
- try {
653
- const {animator} = setup();
654
- const handle = animator.animate({x: 300}, {spring: springs.settle});
655
- const [animation] = live('translate');
656
- // The task blocks for 20 ms; the browser dates the animation at 1000.
657
- clock = 1020;
658
- animation.startTime = 1000;
659
- await commitFrame(1020);
660
- await expect(handle.started).resolves.toBe(1000);
661
- expect(animation.startTime).toBe(1000);
662
- } finally {
663
- Reflect.deleteProperty(document, 'timeline');
664
- }
665
- });
666
-
667
- it('a start the browser dates by the call stays when its own task ended at once, however late the first read', async () => {
668
- // WebKit under load from other tasks: the call's task ends at once, and
669
- // another task holds the main thread before the first frame. Nothing in
670
- // the call's task delayed it, so its start stays the browser's and the
671
- // calls a sequence chains on it keep their clock (design:reduced-motion
672
- // DR2's 200 ms cross-fade, a cancel fading on the previous fade's end).
673
- Object.defineProperty(document, 'timeline', {
674
- configurable: true,
675
- get: () => ({currentTime: clock}),
676
- });
677
- try {
678
- const {animator} = setup();
679
- const handle = animator.animate({x: 300}, {spring: springs.settle});
680
- const [animation] = live('translate');
681
- // The call's task ends; then another task runs for 100 ms, and the
682
- // browser commits the animation after it, dated at the call.
683
- await Promise.resolve();
684
- clock = 1100;
685
- animation.startTime = 1000;
686
- await commitFrame(1100);
687
- await expect(handle.started).resolves.toBe(1000);
688
- expect(animation.startTime).toBe(1000);
689
- } finally {
690
- Reflect.deleteProperty(document, 'timeline');
691
- }
692
- });
693
-
694
- it('a start read after the first frame stays the browser\u2019s', async () => {
695
- Object.defineProperty(document, 'timeline', {
696
- configurable: true,
697
- get: () => ({currentTime: clock}),
698
- });
699
- try {
700
- const {animator} = setup();
701
- const handle = animator.animate({x: 300}, {spring: springs.settle});
702
- const [animation] = live('translate');
703
- // Paused before its first frame (a harness), then started late: the
704
- // first frame passed with no start to read.
705
- animation.paused = true;
706
- await commitFrame(1016);
707
- clock = 1600;
708
- animation.paused = false;
709
- animation.startTime = 1000;
710
- await commitFrame(1600);
711
- await expect(handle.started).resolves.toBe(1000);
712
- expect(animation.startTime).toBe(1000);
713
- } finally {
714
- Reflect.deleteProperty(document, 'timeline');
715
- }
716
- });
717
-
718
- it('holds its start until the browser starts it', async () => {
719
- const {animator} = setup();
720
- animator.animate({x: 300}, {spring: springs.settle});
721
- // Nothing has moved on screen yet, whatever the clock says; a time ahead
722
- // reads the curve from the call's time, and the model is moving: a
723
- // retarget carries this velocity.
724
- expect(animator.get('x')).toBe(0);
725
- expect(animator.get('x', 1100)).toBeCloseTo(curve.value(0.1), 9);
726
- clock = 1100;
727
- expect(animator.get('x')).toBe(0);
728
- expect(animator.getVelocity('x', 1100)).toBeCloseTo(curve.velocity(0.1), 9);
729
- clock = 1250;
730
- await commitFrame(1250);
731
- expect(animator.get('x', 1350)).toBeCloseTo(curve.value(0.1), 9);
732
- expect(live('translate')[0].startTime).toBe(1250);
733
- });
734
-
735
- it('a companion sampling a waiting curve ahead follows its shape', async () => {
736
- // A tab bar's counter-moving copy, sampled from the body's curve.
737
- const {animator} = setup();
738
- animator.animate({x: 300}, {spring: springs.settle});
739
- const at = clock;
740
- const samples = [0, 50, 100, 200].map(t => animator.get('x', at + t));
741
- expect(samples[0]).toBe(0);
742
- expect(samples.slice(1).map((v, i) => v > samples[i])).toEqual([
743
- true,
744
- true,
745
- true,
746
- ]);
747
- expect(samples[2]).toBeCloseTo(curve.value(0.1), 9);
748
- });
749
-
750
- it('finishes and drops the animation on the committed clock', async () => {
751
- const {animator} = setup();
752
- const handle = animator.animate({x: 300}, {spring: springs.settle});
753
- const [animation] = live('translate');
754
- const duration = Number(animation.options.duration) - END_HOLD_MS;
755
- clock = 1300;
756
- await commitFrame(1300);
757
- let done = false;
758
- void handle.finished.then(() => {
759
- done = true;
760
- });
761
- await advance(duration - 1);
762
- expect(done).toBe(false);
763
- expect(animation.cancelled).toBe(false);
764
- await advance(2);
765
- expect(done).toBe(true);
766
- expect(animation.cancelled).toBe(true);
767
- });
768
-
769
- it('a retarget mid-flight keeps an explicit start', async () => {
770
- const {animator} = setup();
771
- const first = animator.animate({x: 300}, {spring: springs.settle});
772
- await advance(100);
773
- await expect(first.started).resolves.toBe(1000);
774
- const second = animator.animate({x: 0}, {spring: springs.settle});
775
- expect(live('translate')[0].startTime).toBe(1100);
776
- await expect(second.started).resolves.toBe(1100);
777
- });
778
-
779
- it('a call stopped before its first frame resolves at its own time', async () => {
780
- const {animator} = setup();
781
- const handle = animator.animate({x: 300}, {spring: springs.settle});
782
- animator.stop();
783
- clock = 1300;
784
- await commitFrame(1300);
785
- await expect(handle.started).resolves.toBe(1000);
786
- await expect(handle.finished).resolves.toBe(false);
787
- });
788
-
789
- it('a second call before the first frame starts with the same commit', async () => {
790
- const {animator} = setup();
791
- animator.animate({x: 300}, {spring: springs.settle});
792
- animator.animate({y: 300}, {spring: springs.settle});
793
- const [animation] = live('translate');
794
- expect(animation.startTime).toBeNull();
795
- clock = 1300;
796
- await commitFrame(1300);
797
- expect(animator.get('x', 1400)).toBeCloseTo(curve.value(0.1), 9);
798
- expect(animator.get('y', 1400)).toBeCloseTo(curve.value(0.1), 9);
799
- });
800
- it('an explicit clock after a waiting call was finished from outside keeps that clock, with no lead-in', async () => {
801
- // A sampler holds a call from rest before the browser starts it, then
802
- // finishes it (the interaction harness's release with finish): the call
803
- // never gets a start time. A call on an explicit clock that follows plays
804
- // from that clock instead of waiting on the finished call's start.
805
- const {animator} = setup();
806
- animator.animate({opacity: 0}, {spring: springs.settle});
807
- const [held] = live('opacity');
808
- expect(held.startTime).toBeNull();
809
- held.paused = true;
810
- held.finish();
811
- clock += 9;
812
- const at = clock - 4;
813
- animator.animate({opacity: 1}, {spring: springs.settle}, {at});
814
- const fade = recorded.filter(a => !a.cancelled && a !== held).at(-1);
815
- expect(fade?.startTime).toBe(at);
816
- // The curve moves from its first keyframe: no hold before it.
817
- expect(fade?.keyframes[1].opacity).not.toBe(fade?.keyframes[0].opacity);
818
- });
819
- });
820
-
821
- describe('review fixes', () => {
822
- it('a retarget before the first frame starts from what is on screen', async () => {
823
- const {animator} = setup();
824
- animator.animate({x: 300}, {spring: springs.settle});
825
- // A 150 ms block, then a second call on the same channel, all before the
826
- // browser started the first.
827
- clock = 1150;
828
- animator.animate({x: 100}, {spring: springs.settle});
829
- expect(animator.get('x')).toBe(0);
830
- await commitFrame(1150);
831
- // From where it is drawn, with the velocity the first curve had reached.
832
- const first = solveSpring(toSpring(springs.settle), {from: 0, to: 300});
833
- const from0 = solveSpring(toSpring(springs.settle), {
834
- from: 0,
835
- to: 100,
836
- velocity: first.velocity(0.15),
837
- });
838
- expect(animator.get('x', 1250)).toBeCloseTo(from0.value(0.1), 9);
839
- });
840
-
841
- it('retargets the browser has not started keep a flick\u2019s velocity', async () => {
842
- const {animator} = setup();
843
- const tracking = {response: 0.08, dampingRatio: 1};
844
- // Ten moves at 120 Hz retarget the tracking spring, and the browser starts
845
- // none of them before the finger lifts.
846
- for (let i = 1; i <= 10; i++) {
847
- clock = 1000 + (i * 1000) / 120;
848
- animator.animate({x: -12 * i}, {spring: tracking});
849
- }
850
- // Nothing has moved on screen, but the model is moving with the finger.
851
- expect(animator.get('x')).toBe(0);
852
- const velocity = animator.getVelocity('x');
853
- expect(velocity).toBeLessThan(-100);
854
- // The release springs with that velocity.
855
- animator.animate({x: -200}, {spring: springs.settle});
856
- await commitFrame(clock);
857
- const release = solveSpring(toSpring(springs.settle), {
858
- from: 0,
859
- to: -200,
860
- velocity,
861
- });
862
- expect(animator.get('x', clock + 50)).toBeCloseTo(release.value(0.05), 6);
863
- });
864
-
865
- it('a pager settle after drags the browser has not started is already moving', async () => {
866
- const {animator} = setup();
867
- const tracking = {response: 0.08, dampingRatio: 1};
868
- // A page drag toward the next page, its moves all held.
869
- for (let i = 1; i <= 6; i++) {
870
- clock = 1000 + (i * 1000) / 60;
871
- animator.animate({x: -20 * i}, {spring: tracking});
872
- }
873
- const velocity = animator.getVelocity('x');
874
- expect(velocity).toBeLessThan(0);
875
- // The settle to the next page starts with the drag's velocity.
876
- animator.animate({x: -400}, {spring: springs.settle});
877
- expect(animator.getVelocity('x')).toBeCloseTo(velocity, 6);
878
- await commitFrame(clock);
879
- const first = animator.get('x', clock + 16);
880
- const settle = solveSpring(toSpring(springs.settle), {
881
- from: 0,
882
- to: -400,
883
- velocity,
884
- });
885
- expect(first).toBeCloseTo(settle.value(0.016), 6);
886
- expect(first).toBeLessThan(
887
- solveSpring(toSpring(springs.settle), {from: 0, to: -400}).value(0.016),
888
- );
889
- });
890
-
891
- it('a call adopted by a later same-task call starts with it', async () => {
892
- const {animator} = setup();
893
- const a = animator.animate({x: 300}, {spring: springs.settle});
894
- const b = animator.animate({y: 300}, {spring: springs.settle});
895
- clock = 1300;
896
- await commitFrame(1300);
897
- await expect(b.started).resolves.toBe(1300);
898
- await expect(a.started).resolves.toBe(1300);
899
- });
900
-
901
- it('dispose settles every atRest() wait', async () => {
902
- const {animator} = setup();
903
- animator.animate({x: 300}, {spring: springs.settle});
904
- await commitFrame(1000);
905
- let rested = false;
906
- void animator.atRest().then(() => {
907
- rested = true;
908
- });
909
- animator.dispose();
910
- for (let i = 0; i < 5; i++) {
911
- await Promise.resolve();
912
- }
913
- expect(rested).toBe(true);
914
- expect(vi.getTimerCount()).toBe(0);
915
- });
916
-
917
- it('rebasing a curve that waits for its first frame keeps it in its call', async () => {
918
- const {animator} = setup();
919
- animator.play({
920
- opacity: {duration: 0.3, at: t => 1 - t, velocity: () => -1},
921
- x: {duration: 0.3, at: t => 100 * t, velocity: () => 100},
922
- rotate: {duration: 0.3, at: t => 90 * t, velocity: () => 90},
923
- });
924
- animator.rebase({x: -20});
925
- animator.animate({y: 50}, {spring: springs.settle});
926
- clock = 1300;
927
- await commitFrame(1300);
928
- // Every curve starts with the browser's start.
929
- // 100 ms in: 9° (not the 27° of a curve dated at the call), x 10 − 20.
930
- expect(animator.get('rotate', 1400)).toBeCloseTo(9, 6);
931
- expect(animator.get('x', 1400)).toBeCloseTo(-10, 6);
932
- });
933
-
934
- it('a rebase and a retarget in the task of a drop from rest start on the browser\u2019s clock', async () => {
935
- // A list row's drop: it springs home from where the finger left it.
936
- const {animator} = setup();
937
- animator.set({y: 30});
938
- animator.animate({y: 0}, {spring: springs.settle, velocity: {y: 0}});
939
- // The reorder commits in the same task, on the call's clock: the layout
940
- // moved the row by 56 px, and the row springs home from there.
941
- animator.rebase({y: 56}, {at: 1000});
942
- const home = animator.animate({y: 0}, {spring: springs.settle}, {at: 1000});
943
- clock = 1004;
944
- await commitFrame(1004);
945
- await expect(home.started).resolves.toBe(1004);
946
- const curve = solveSpring(toSpring(springs.settle), {from: 86, to: 0});
947
- for (const t of [0, 16, 50, 100, 200]) {
948
- expect(animator.get('y', 1004 + t)).toBeCloseTo(curve.value(t / 1000), 6);
949
- }
950
- });
951
-
952
- it('writing another axis before the first frame keeps the channel on the call\u2019s start', async () => {
953
- const {animator} = setup();
954
- animator.animate({opacity: 0.5, x: 100}, {spring: springs.settle});
955
- animator.set({y: 10});
956
- const [translate] = live('translate');
957
- expect(translate.startTime).toBeNull();
958
- clock = 1300;
959
- await commitFrame(1300);
960
- const x = solveSpring(toSpring(springs.settle), {from: 0, to: 100});
961
- expect(animator.get('x', 1400)).toBeCloseTo(x.value(0.1), 6);
962
- expect(sampleAt(live('translate')[0], 'translate', 1400)[0]).toBeCloseTo(
963
- x.value(0.1),
964
- 1,
965
- );
966
- });
967
-
968
- it('a same-task write that cancels the call\u2019s first animation still leaves the call on the browser\u2019s start', async () => {
969
- const {animator} = setup();
970
- const handle = animator.animate({x: 100}, {spring: springs.settle});
971
- animator.set({y: 10});
972
- // The cancelled animation's rejection runs before the first frame, as in
973
- // a browser's task order.
974
- await Promise.resolve();
975
- await Promise.resolve();
976
- clock = 1300;
977
- await commitFrame(1300);
978
- await expect(handle.started).resolves.toBe(1300);
979
- const x = solveSpring(toSpring(springs.settle), {from: 0, to: 100});
980
- expect(animator.get('x', 1316)).toBeCloseTo(x.value(0.016), 6);
981
- expect(sampleAt(live('translate')[0], 'translate', 1316)[0]).toBeCloseTo(
982
- x.value(0.016),
983
- 1,
984
- );
985
- });
986
-
987
- it('a write later in the task samples the waiting call\u2019s curve from its start, so the screen and get() share one clock', async () => {
988
- const {animator} = setup();
989
- animator.animate({opacity: 0.5, x: 100}, {spring: springs.settle});
990
- // 100 ms of work in the same task before another axis is written.
991
- clock = 1100;
992
- animator.set({y: 10});
993
- clock = 1300;
994
- await commitFrame(1300);
995
- const x = solveSpring(toSpring(springs.settle), {from: 0, to: 100});
996
- expect(animator.get('x', 1400)).toBeCloseTo(x.value(0.1), 6);
997
- expect(sampleAt(live('translate')[0], 'translate', 1400)[0]).toBeCloseTo(
998
- x.value(0.1),
999
- 1,
1000
- );
1001
- });
1002
-
1003
- it('an earlier {at} on a channel whose other axis waits joins that call, so the screen and get() share its clock', async () => {
1004
- const {animator} = setup();
1005
- clock = 1020;
1006
- animator.animate({x: 100}, {spring: springs.settle});
1007
- // An event timestamp 20 ms before the waiting call's time.
1008
- animator.animate({y: 50}, {spring: springs.settle}, {at: 1000});
1009
- clock = 1300;
1010
- await commitFrame(1300);
1011
- const y = animator.get('y', 1316);
1012
- expect(sampleAt(live('translate')[0], 'translate', 1316)[1]).toBeCloseTo(
1013
- y,
1014
- 1,
1015
- );
1016
- });
1017
-
1018
- it('a later {at} than a call from rest still waiting keeps its own clock, with no hold', async () => {
1019
- const {animator} = setup();
1020
- animator.animate({opacity: 0}, {spring: springs.settle});
1021
- // A frame later the browser has still not started it (a busy compositor),
1022
- // and a tap's call names its own, later clock.
1023
- clock = 1011;
1024
- animator.animate({opacity: 1}, {spring: springs.settle}, {at: 1011});
1025
- const fade = recorded.filter(a => !a.cancelled).at(-1);
1026
- expect(fade?.startTime).toBe(1011);
1027
- // The curve moves from its first keyframe on.
1028
- expect(fade?.keyframes[1].opacity).not.toBe(fade?.keyframes[0].opacity);
1029
- });
1030
-
1031
- it('a call adopted by a later same-task call starts at the commit, after the work between them', async () => {
1032
- const {animator} = setup();
1033
- const first = animator.animate({x: 100}, {spring: springs.settle});
1034
- // 300 ms of work in the same task, then another axis from rest.
1035
- clock = 1300;
1036
- animator.animate({y: 50}, {spring: springs.settle});
1037
- clock = 1310;
1038
- await commitFrame(1310);
1039
- await expect(first.started).resolves.toBe(1310);
1040
- expect(animator.get('x', 1310)).toBeCloseTo(0, 6);
1041
- expect(sampleAt(live('translate')[0], 'translate', 1310)[0]).toBeCloseTo(
1042
- 0,
1043
- 1,
1044
- );
1045
- });
1046
-
1047
- it('under Reduced Motion on a fine pointer, a move leaves a running fade alone', async () => {
1048
- const {animator} = setup({
1049
- reduced: true,
1050
- coarse: false,
1051
- });
1052
- animator.set({opacity: 0});
1053
- animator.animate({opacity: 1}, {spring: springs.settle});
1054
- await advance(10_000);
1055
- animator.animate({x: 40}, {spring: springs.settle});
1056
- expect(animator.get('opacity')).toBe(1);
1057
- expect(animator.get('x')).toBe(40);
1058
- });
1059
- });
1060
-
1061
- describe('additive: a retarget adds to the curve on screen', () => {
1062
- const old = solveSpring(toSpring(springs.settle), {from: 0, to: 300});
1063
- const oldEnd = old.settleTime(0.05);
1064
- const oldAt = (t: number) => (t >= oldEnd ? 300 : old.value(t));
1065
-
1066
- it('starts from the old curve\u2019s value and velocity, and reads as their sum', async () => {
1067
- const {animator} = setup();
1068
- animator.animate({x: 300}, {spring: springs.settle});
1069
- await commitFrame(1000);
1070
- clock = 1150;
1071
- const x = animator.get('x');
1072
- const v = animator.getVelocity('x');
1073
- animator.animate({x: 100}, {spring: springs.settle}, {additive: true});
1074
- expect(animator.get('x')).toBeCloseTo(x, 9);
1075
- expect(animator.getVelocity('x')).toBeCloseTo(v, 6);
1076
- const delta = solveSpring(toSpring(springs.settle), {from: 0, to: -200});
1077
- for (const t of [0.02, 0.1, 0.4]) {
1078
- expect(animator.get('x', 1150 + t * 1000)).toBeCloseTo(
1079
- oldAt(0.15 + t) + delta.value(t),
1080
- 6,
1081
- );
1082
- }
1083
- await advance(10_000);
1084
- expect(animator.get('x')).toBe(100);
1085
- });
1086
-
1087
- it('a played reversal keeps the old velocity: a late first frame shows only the reversal\u2019s own start', async () => {
1088
- // An ease-in-out reversal starts at rest; replacing a curve that moves
1089
- // at v puts the old curve v·d ahead of it by a first frame d ms late.
1090
- const ease = cubicBezier(timing.curves.move);
1091
- const reversal = (from: number, to: number) => ({
1092
- duration: 0.35,
1093
- at: (t: number) => from + (to - from) * ease(Math.min(1, t / 0.35)),
1094
- velocity: (t: number) =>
1095
- ((to - from) / 0.35) *
1096
- ((ease(Math.min(1, t / 0.35 + 1e-4)) -
1097
- ease(Math.max(0, t / 0.35 - 1e-4))) /
1098
- 2e-4),
1099
- });
1100
- const steps = async (additive: boolean) => {
1101
- const {animator} = setup();
1102
- animator.animate({x: 300}, {spring: springs.settle}, {at: 1000});
1103
- clock = 1120;
1104
- const from = animator.get('x');
1105
- animator.play({x: reversal(from, 0)}, {at: 1120, additive});
1106
- return [30, 60, 100].map(d =>
1107
- Math.abs(animator.get('x', 1120 + d) - oldAt((120 + d) / 1000)),
1108
- );
1109
- };
1110
- const replaced = await steps(false);
1111
- const added = await steps(true);
1112
- for (let i = 0; i < added.length; i++) {
1113
- expect(added[i]).toBeLessThan(replaced[i] / 2);
1114
- }
1115
- // What remains is the reversal's own first d ms, scaled to the targets.
1116
- expect(added[0]).toBeCloseTo(300 * ease(30 / 350), 6);
1117
- });
1118
-
1119
- it('nests: a second retarget adds to the first', async () => {
1120
- const {animator} = setup();
1121
- animator.animate({x: 300}, {spring: springs.settle});
1122
- await commitFrame(1000);
1123
- clock = 1100;
1124
- animator.animate({x: 100}, {spring: springs.settle}, {additive: true});
1125
- clock = 1200;
1126
- const x = animator.get('x');
1127
- const v = animator.getVelocity('x');
1128
- animator.animate({x: 250}, {spring: springs.settle}, {additive: true});
1129
- expect(animator.get('x')).toBeCloseTo(x, 9);
1130
- expect(animator.getVelocity('x')).toBeCloseTo(v, 6);
1131
- const first = solveSpring(toSpring(springs.settle), {from: 0, to: -200});
1132
- const second = solveSpring(toSpring(springs.settle), {from: 0, to: 150});
1133
- expect(animator.get('x', 1300)).toBeCloseTo(
1134
- oldAt(0.3) + first.value(0.2) + second.value(0.1),
1135
- 6,
1136
- );
1137
- await advance(10_000);
1138
- expect(animator.get('x')).toBe(250);
1139
- });
1140
-
1141
- it('replaces as before for a property at rest or given a velocity', async () => {
1142
- const {animator} = setup();
1143
- animator.animate({x: 300}, {spring: springs.settle}, {additive: true});
1144
- await commitFrame(1000);
1145
- const fromRest = solveSpring(toSpring(springs.settle), {from: 0, to: 300});
1146
- expect(animator.get('x', 1100)).toBeCloseTo(fromRest.value(0.1), 9);
1147
- clock = 1100;
1148
- const x = animator.get('x');
1149
- animator.animate(
1150
- {x: 0},
1151
- {spring: springs.settle, velocity: {x: 0}},
1152
- {additive: true},
1153
- );
1154
- const back = solveSpring(toSpring(springs.settle), {from: x, to: 0});
1155
- expect(animator.get('x', 1200)).toBeCloseTo(back.value(0.1), 9);
1156
- });
1157
- });
1158
-
1159
- describe('start: when a call\u2019s animations start', () => {
1160
- it('presented: leaves the element at rest, and creates the animations two frames later', async () => {
1161
- const {animator, element} = setup();
1162
- animator.set({x: 20});
1163
- // The set's own promotion ends first.
1164
- await vi.advanceTimersByTimeAsync(PROMOTION_LINGER_MS + 1);
1165
- expect(element.style.willChange).toBe('');
1166
- const handle = animator.animate(
1167
- {x: 100},
1168
- {spring: springs.settle},
1169
- {start: 'presented'},
1170
- );
1171
- // At rest, with no layer yet: the next frame commits it where it is.
1172
- // (A layer at rest for two frames left a stale paint in WebKit on iOS.)
1173
- expect(live('translate')).toHaveLength(0);
1174
- expect(element.style.translate).toBe('20px 0px');
1175
- expect(element.style.willChange).toBe('');
1176
- expect(animator.get('x')).toBe(20);
1177
- clock = 1016;
1178
- await commitFrame(1016);
1179
- expect(live('translate')).toHaveLength(0);
1180
- // The frame after it creates them; the browser starts them at its commit.
1181
- clock = 1033;
1182
- await commitFrame(1033);
1183
- expect(live('translate')).toHaveLength(1);
1184
- expect(element.style.willChange).toContain('translate');
1185
- clock = 1050;
1186
- await commitFrame(1050);
1187
- await expect(handle.started).resolves.toBe(1050);
1188
- const curve = solveSpring(toSpring(springs.settle), {from: 20, to: 100});
1189
- expect(animator.get('x', 1150)).toBeCloseTo(curve.value(0.1), 9);
1190
- expect(sampleAt(live('translate')[0], 'translate', 1150)[0]).toBeCloseTo(
1191
- curve.value(0.1),
1192
- 0,
1193
- );
1194
- });
1195
-
1196
- it('presented: a start WebKit dates at the frame that creates the animations keeps it, wherever in its frame the call was made', async () => {
1197
- // A presented call's animations are created in its second frame's
1198
- // callback, so its task is that callback's, not the call's: measured
1199
- // from the call, a call made early in its frame looked like a block
1200
- // longer than two frames, and a late first read moved the start.
1201
- Object.defineProperty(document, 'timeline', {
1202
- configurable: true,
1203
- get: () => ({currentTime: clock}),
1204
- });
1205
- try {
1206
- const {animator} = setup();
1207
- const handle = animator.animate(
1208
- {x: 100},
1209
- {spring: springs.settle},
1210
- {start: 'presented'},
1211
- );
1212
- clock = 1016;
1213
- await commitFrame(1016);
1214
- // The frame that creates the animations; the callback's task runs on
1215
- // 3 ms.
1216
- requestFrame(() => {
1217
- clock = 1036;
1218
- });
1219
- clock = 1033;
1220
- await commitFrame(1033);
1221
- expect(live('translate')).toHaveLength(1);
1222
- // Other tasks hold the main thread until the next frame, where WebKit's
1223
- // start for them, that frame's time, is first read.
1224
- clock = 1090;
1225
- live('translate')[0].startTime = 1033;
1226
- await commitFrame(1090);
1227
- await expect(handle.started).resolves.toBe(1033);
1228
- expect(live('translate')[0].startTime).toBe(1033);
1229
- } finally {
1230
- Reflect.deleteProperty(document, 'timeline');
1231
- }
1232
- });
1233
-
1234
- it('presented: a block in the frame that creates the animations moves their start past it', async () => {
1235
- Object.defineProperty(document, 'timeline', {
1236
- configurable: true,
1237
- get: () => ({currentTime: clock}),
1238
- });
1239
- try {
1240
- const {animator} = setup();
1241
- const handle = animator.animate(
1242
- {x: 100},
1243
- {spring: springs.settle},
1244
- {start: 'presented'},
1245
- );
1246
- clock = 1016;
1247
- await commitFrame(1016);
1248
- // The frame that creates the animations blocks for 300 ms; WebKit's
1249
- // start for them, that frame's time, is read at the next frame.
1250
- requestFrame(() => {
1251
- clock = 1333;
1252
- });
1253
- clock = 1033;
1254
- await commitFrame(1033);
1255
- clock = 1340;
1256
- live('translate')[0].startTime = 1033;
1257
- await commitFrame(1340);
1258
- await expect(handle.started).resolves.toBe(1340);
1259
- expect(live('translate')[0].startTime).toBe(1340);
1260
- } finally {
1261
- Reflect.deleteProperty(document, 'timeline');
1262
- }
1263
- });
1264
-
1265
- it('presented: a call queued after another change flushed the queue still waits its own two frames', async () => {
1266
- const {animator} = setup();
1267
- animator.animate({x: 100}, {spring: springs.settle}, {start: 'presented'});
1268
- // Another change creates the waiting call's animations first.
1269
- animator.animate({y: 50}, {spring: springs.settle});
1270
- clock = 1016;
1271
- await commitFrame(1016);
1272
- animator.animate(
1273
- {opacity: 0.5},
1274
- {spring: springs.settle},
1275
- {start: 'presented'},
1276
- );
1277
- expect(live('opacity')).toHaveLength(0);
1278
- // The first call's second frame is this call's first: it still waits.
1279
- clock = 1033;
1280
- await commitFrame(1033);
1281
- expect(live('opacity')).toHaveLength(0);
1282
- clock = 1050;
1283
- await commitFrame(1050);
1284
- expect(live('opacity')).toHaveLength(1);
1285
- });
1286
-
1287
- it('presented: a second presented call on the same property a frame later keeps its own two frames', async () => {
1288
- const {animator} = setup();
1289
- animator.animate({x: 100}, {spring: springs.settle}, {start: 'presented'});
1290
- clock = 1016;
1291
- await commitFrame(1016);
1292
- animator.animate({x: 200}, {spring: springs.settle}, {start: 'presented'});
1293
- // The first call's second frame: its property is now the second call's,
1294
- // so nothing starts yet.
1295
- clock = 1033;
1296
- await commitFrame(1033);
1297
- expect(live('translate')).toHaveLength(0);
1298
- // The second call's own second frame.
1299
- clock = 1050;
1300
- await commitFrame(1050);
1301
- expect(live('translate')).toHaveLength(1);
1302
- await commitFrame(1066);
1303
- expect(animator.get('x', 1066 + 5000)).toBeCloseTo(200, 3);
1304
- });
1305
-
1306
- it('presented: a later presented call that takes part of a waiting call\u2019s channel starts the rest of it, from its own start', async () => {
1307
- const {animator} = setup();
1308
- const first = animator.animate(
1309
- {x: 100, y: 100},
1310
- {spring: springs.settle},
1311
- {start: 'presented'},
1312
- );
1313
- clock = 1016;
1314
- await commitFrame(1016);
1315
- animator.animate({x: 200}, {spring: springs.settle}, {start: 'presented'});
1316
- // The first call's second frame: its channel now holds the second call's
1317
- // curve, so nothing starts yet.
1318
- clock = 1033;
1319
- await commitFrame(1033);
1320
- expect(live('translate')).toHaveLength(0);
1321
- // The second call's second frame creates the channel, with the first
1322
- // call's y in it; the browser starts it at the next commit.
1323
- clock = 1050;
1324
- await commitFrame(1050);
1325
- expect(live('translate')).toHaveLength(1);
1326
- clock = 1066;
1327
- await commitFrame(1066);
1328
- await expect(first.started).resolves.toBe(1066);
1329
- // y was at rest on screen until then: its curve starts there, and the
1330
- // model reads what the screen shows.
1331
- const y = solveSpring(toSpring(springs.settle), {from: 0, to: 100});
1332
- expect(animator.get('y', 1166)).toBeCloseTo(y.value(0.1), 6);
1333
- expect(sampleAt(live('translate')[0], 'translate', 1166)[1]).toBeCloseTo(
1334
- y.value(0.1),
1335
- 0,
1336
- );
1337
- });
1338
-
1339
- it('presented: another change before then creates the animations first', async () => {
1340
- const {animator} = setup();
1341
- animator.animate({x: 100}, {spring: springs.settle}, {start: 'presented'});
1342
- animator.animate({y: 50}, {spring: springs.settle});
1343
- expect(live('translate').length).toBeGreaterThan(0);
1344
- await commitFrame(clock);
1345
- const x = solveSpring(toSpring(springs.settle), {from: 0, to: 100});
1346
- expect(animator.get('x', clock + 100)).toBeCloseTo(x.value(0.1), 9);
1347
- });
1348
-
1349
- it('presented: a retarget of a moving property starts now, from the value and velocity on screen (FR6)', async () => {
1350
- const {animator} = setup();
1351
- animator.animate({x: 300}, {spring: springs.settle});
1352
- await commitFrame(1000);
1353
- clock = 1100;
1354
- const from = animator.get('x');
1355
- const velocity = animator.getVelocity('x');
1356
- animator.animate({x: 0}, {spring: springs.settle}, {start: 'presented'});
1357
- // The element is moving, not at rest: no two frames on the old curve and
1358
- // no restart at the commit from the call's value. The new curve starts at
1359
- // the call, from what is on screen, as a retarget does.
1360
- const [animation] = live('translate');
1361
- expect(animation.startTime).toBe(1100);
1362
- expect(animator.get('x', 1100)).toBeCloseTo(from, 6);
1363
- expect(animator.getVelocity('x', 1100)).toBeCloseTo(velocity, 3);
1364
- const back = solveSpring(toSpring(springs.settle), {
1365
- from,
1366
- to: 0,
1367
- velocity,
1368
- });
1369
- expect(animator.get('x', 1200)).toBeCloseTo(back.value(0.1), 6);
1370
- });
1371
-
1372
- it('commit: a retarget is dated by the browser\u2019s commit, from the value on screen', async () => {
1373
- const {animator} = setup();
1374
- animator.animate({x: 300}, {spring: springs.settle});
1375
- await commitFrame(1000);
1376
- clock = 1100;
1377
- const from = animator.get('x');
1378
- const velocity = animator.getVelocity('x');
1379
- const handle = animator.animate(
1380
- {x: 0},
1381
- {spring: springs.settle},
1382
- {start: 'commit'},
1383
- );
1384
- const [animation] = live('translate');
1385
- expect(animation.startTime).toBeNull();
1386
- // Held where it is until the browser starts it.
1387
- expect(animator.get('x')).toBeCloseTo(from, 9);
1388
- clock = 1130;
1389
- await commitFrame(1130);
1390
- await expect(handle.started).resolves.toBe(1130);
1391
- const back = solveSpring(toSpring(springs.settle), {
1392
- from,
1393
- to: 0,
1394
- velocity,
1395
- });
1396
- expect(animator.get('x', 1230)).toBeCloseTo(back.value(0.1), 6);
1397
- });
1398
-
1399
- it('a handle hands out the curve it plays, for a companion on the same clock', async () => {
1400
- const {animator} = setup();
1401
- const handle = animator.animate({y: 400}, {spring: springs.sheetPresent});
1402
- const curve = handle.curve('y');
1403
- expect(curve).not.toBeNull();
1404
- expect(handle.curve('x')).toBeNull();
1405
- await commitFrame(1000);
1406
- const y = solveSpring(toSpring(springs.sheetPresent), {from: 0, to: 400});
1407
- for (const t of [0, 0.05, 0.2]) {
1408
- expect(curve?.at(t)).toBeCloseTo(y.value(t), 9);
1409
- expect(curve?.velocity(t)).toBeCloseTo(y.velocity(t), 6);
1410
- expect(animator.get('y', 1000 + t * 1000)).toBeCloseTo(y.value(t), 9);
1411
- }
1412
- expect(curve?.at(curve.duration)).toBe(400);
1413
- });
1414
- });
1415
-
1416
- describe('animatorFor: one animator per element', () => {
1417
- it('gives every caller the same animator for an element', () => {
1418
- const a = document.createElement('div');
1419
- const b = document.createElement('div');
1420
- expect(animatorFor(a)).toBe(animatorFor(a));
1421
- expect(animatorFor(a)).not.toBe(animatorFor(b));
1422
- expect(animatorFor(a, {pseudoElement: '::backdrop'})).toBe(
1423
- animatorFor(a, {pseudoElement: '::backdrop'}),
1424
- );
1425
- expect(animatorFor(a, {pseudoElement: '::backdrop'})).not.toBe(
1426
- animatorFor(a),
1427
- );
1428
- });
1429
-
1430
- it('composes two callers’ axes in one translate track', async () => {
1431
- const row = document.createElement('div');
1432
- const options = {
1433
- now: () => clock,
1434
- requestFrame,
1435
- };
1436
- const swipe = animatorFor(row, options);
1437
- swipe.animate({x: -120}, {spring: springs.settle});
1438
- await advance(50);
1439
- const x = solveSpring(toSpring(springs.settle), {from: 0, to: -120});
1440
- const removal = animatorFor(row, options);
1441
- removal.animate({y: -44}, {spring: springs.settle});
1442
- const tracks = live('translate');
1443
- expect(tracks).toHaveLength(1);
1444
- // x stays on its curve; y starts its own.
1445
- expect(removal.get('x', clock + 30)).toBeCloseTo(x.value(0.08), 9);
1446
- const y = solveSpring(toSpring(springs.settle), {from: 0, to: -44});
1447
- expect(swipe.get('y', clock + 30)).toBeCloseTo(y.value(0.03), 9);
1448
- const [tx, ty] = sampleAt(tracks[0], 'translate', clock + 30);
1449
- expect(Math.abs(tx - x.value(0.08))).toBeLessThan(0.26);
1450
- expect(Math.abs(ty - y.value(0.03))).toBeLessThan(0.26);
1451
- });
1452
- });
1453
-
1454
- describe('rebase: a layout shift under a moving element', () => {
1455
- it('keeps a spring’s spring, velocity and target', async () => {
1456
- const {animator} = setup();
1457
- const handle = animator.animate({y: 100}, {spring: springs.settle});
1458
- await advance(60);
1459
- const value = animator.get('y');
1460
- const velocity = animator.getVelocity('y');
1461
- animator.rebase({y: -40});
1462
- expect(animator.get('y', clock)).toBeCloseTo(value - 40, 9);
1463
- expect(animator.getVelocity('y', clock)).toBeCloseTo(velocity, 6);
1464
- const curve = solveSpring(toSpring(springs.settle), {
1465
- from: value - 40,
1466
- to: 100,
1467
- velocity,
1468
- });
1469
- expect(animator.get('y', clock + 30)).toBeCloseTo(curve.value(0.03), 9);
1470
- expect(live('translate')).toHaveLength(1);
1471
- await advance(5000);
1472
- expect(animator.get('y')).toBe(100);
1473
- await expect(handle.finished).resolves.toBe(true);
1474
- });
1475
-
1476
- it('offsets a resting value and starts nothing', () => {
1477
- const {animator, element} = setup();
1478
- animator.set({y: 10});
1479
- animator.rebase({y: -20});
1480
- expect(animator.get('y')).toBe(-10);
1481
- expect(live('translate')).toHaveLength(0);
1482
- expect(parse(element.style.translate)[1]).toBe(-10);
1483
- });
1484
- });
1485
-
1486
- describe('promotion: a compositing layer while it moves', () => {
1487
- it('promotes the animated channels in the task that starts the motion, and ends it after rest', async () => {
1488
- const {animator, element} = setup();
1489
- animator.animate({x: 120, opacity: 0.5}, {spring: springs.settle});
1490
- expect(element.style.willChange).toBe('translate, opacity');
1491
- const end = Math.max(
1492
- ...live('translate').map(a => Number(a.options.duration) - END_HOLD_MS),
1493
- ...live('opacity').map(a => Number(a.options.duration) - END_HOLD_MS),
1494
- );
1495
- await advance(end + PROMOTION_LINGER_MS - 5);
1496
- expect(element.style.willChange).toBe('translate, opacity');
1497
- await advance(10);
1498
- expect(element.style.willChange).toBe('');
1499
- });
1500
-
1501
- it('keeps the element’s own will-change', async () => {
1502
- const {animator, element} = setup();
1503
- element.style.willChange = 'contents';
1504
- animator.animate({y: 40}, {spring: springs.quickChange});
1505
- expect(element.style.willChange).toBe('contents, translate');
1506
- await advance(5000 + PROMOTION_LINGER_MS);
1507
- expect(element.style.willChange).toBe('contents');
1508
- });
1509
-
1510
- it("keeps the stylesheet's will-change reasons while it promotes, and hands them back", async () => {
1511
- const {animator, element} = setup();
1512
- stylesheet = {'will-change': 'transform, opacity'};
1513
- animator.animate({y: 40, opacity: 0.5}, {spring: springs.quickChange});
1514
- expect(element.style.willChange).toBe('transform, translate, opacity');
1515
- await advance(5000 + PROMOTION_LINGER_MS);
1516
- expect(element.style.willChange).toBe('');
1517
- });
1518
-
1519
- it("reads the stylesheet's will-change in a task of its own, so a promotion reads no style in its own task", async () => {
1520
- // A drag's first move promotes: reading the stylesheet's reasons then
1521
- // would force a style recalculation in the input handler.
1522
- stylesheet['will-change'] = 'transform, opacity';
1523
- const {animator, element} = setup();
1524
- // In the document, where the read happens.
1525
- document.body.append(element);
1526
- await commitFrame(clock);
1527
- await vi.advanceTimersByTimeAsync(0);
1528
- const readsOf = () =>
1529
- vi
1530
- .mocked(window.getComputedStyle)
1531
- .mock.calls.filter(([read]) => read === element).length;
1532
- const before = readsOf();
1533
- animator.set({y: 10});
1534
- expect(readsOf()).toBe(before);
1535
- expect(element.style.willChange).toBe('transform, opacity, translate');
1536
- await advance(PROMOTION_LINGER_MS + 10);
1537
- expect(element.style.willChange).toBe('');
1538
- element.remove();
1539
- });
1540
-
1541
- it('reads no style for a node out of the document: a node removed before its read is never read', async () => {
1542
- // A shared animator (animatorFor) is never detached: its node can leave
1543
- // the document with the read still waiting. A node out of the document
1544
- // has no style to read, and reading one costs a style pass for nothing.
1545
- stubMedia(false, false);
1546
- const readsOf = (node: Element) =>
1547
- vi
1548
- .mocked(window.getComputedStyle)
1549
- .mock.calls.filter(([read]) => read === node).length;
1550
- const removed = document.createElement('div');
1551
- document.body.append(removed);
1552
- createAnimator(removed, {now: () => clock, requestFrame});
1553
- removed.remove();
1554
- const kept = document.createElement('div');
1555
- document.body.append(kept);
1556
- createAnimator(kept, {now: () => clock, requestFrame});
1557
- await vi.advanceTimersByTimeAsync(0);
1558
- expect(readsOf(removed)).toBe(0);
1559
- // A node still in the document is read, once, in that task.
1560
- expect(readsOf(kept)).toBe(1);
1561
- kept.remove();
1562
- });
1563
-
1564
- it("keeps the stylesheet's will-change when a node read nothing before it moves", () => {
1565
- // Put back after its read was skipped, a node reads its stylesheet's
1566
- // reasons when a promotion needs them.
1567
- stylesheet['will-change'] = 'transform, opacity';
1568
- stubMedia(false, false);
1569
- const element = document.createElement('div');
1570
- const animator = createAnimator(element, {
1571
- now: () => clock,
1572
- requestFrame,
1573
- });
1574
- document.body.append(element);
1575
- animator.set({y: 10});
1576
- expect(element.style.willChange).toBe('transform, opacity, translate');
1577
- element.remove();
1578
- });
1579
-
1580
- it("keeps the stylesheet's will-change when an element attached in this task moves at once", () => {
1581
- stylesheet['will-change'] = 'transform, opacity';
1582
- const {animator, element} = setup();
1583
- animator.animate({y: 100}, {spring: springs.settle});
1584
- expect(element.style.willChange).toBe('transform, opacity, translate');
1585
- });
1586
-
1587
- it('promotes during direct manipulation, until the writes stop', async () => {
1588
- const {animator, element} = setup();
1589
- animator.set({y: 10});
1590
- expect(element.style.willChange).toBe('translate');
1591
- await advance(PROMOTION_LINGER_MS - 10);
1592
- animator.set({y: 20});
1593
- await advance(PROMOTION_LINGER_MS - 10);
1594
- expect(element.style.willChange).toBe('translate');
1595
- await advance(20);
1596
- expect(element.style.willChange).toBe('');
1597
- });
1598
-
1599
- it('set with promote: false writes the values without a layer, and leaves other promotion alone', async () => {
1600
- // A one-off switch (a veil under a sticky header during a programmatic
1601
- // scroll) must not give its element a layer.
1602
- const {animator, element} = setup();
1603
- animator.set({opacity: 0.5}, {promote: false});
1604
- expect(element.style.opacity).toBe('0.5');
1605
- expect(element.style.willChange).toBe('');
1606
- await advance(PROMOTION_LINGER_MS + 10);
1607
- expect(element.style.willChange).toBe('');
1608
-
1609
- // A channel a running motion promoted stays promoted, on its own clock.
1610
- const moving = setup();
1611
- moving.animator.animate({x: 120}, {spring: springs.settle});
1612
- expect(moving.element.style.willChange).toBe('translate');
1613
- moving.animator.set({opacity: 0.25}, {promote: false});
1614
- expect(moving.element.style.opacity).toBe('0.25');
1615
- expect(moving.element.style.willChange).toBe('translate');
1616
- await advance(5000 + PROMOTION_LINGER_MS);
1617
- expect(moving.element.style.willChange).toBe('');
1618
-
1619
- // A channel with other motion still running gets its animation's layer.
1620
- const shared = setup();
1621
- shared.animator.animate({y: 80}, {spring: springs.settle});
1622
- shared.animator.set({x: 10}, {promote: false});
1623
- expect(live('translate').length).toBeGreaterThan(0);
1624
- expect(shared.element.style.willChange).toBe('translate');
1625
- });
1626
-
1627
- it('promotes a pseudo-element through a custom property on its host', async () => {
1628
- const {animator, element} = setup({pseudoElement: '::backdrop'});
1629
- animator.set({opacity: 0});
1630
- // set() promotes a pseudo-element too.
1631
- expect(
1632
- element.style.getPropertyValue('--astryx-motion-will-change-backdrop'),
1633
- ).toBe('opacity');
1634
- animator.animate({opacity: 1}, {spring: springs.alertPresent});
1635
- expect(
1636
- element.style.getPropertyValue('--astryx-motion-will-change-backdrop'),
1637
- ).toBe('opacity');
1638
- expect(element.style.willChange).toBe('');
1639
- await advance(5000 + PROMOTION_LINGER_MS);
1640
- expect(
1641
- element.style.getPropertyValue('--astryx-motion-will-change-backdrop'),
1642
- ).toBe('');
1643
- });
1644
-
1645
- it('ends promotion on the element it leaves', () => {
1646
- const {animator, element} = setup();
1647
- animator.animate({x: 50}, {spring: springs.settle});
1648
- expect(element.style.willChange).toBe('translate');
1649
- animator.attach(document.createElement('div'));
1650
- expect(element.style.willChange).toBe('');
1651
- });
1652
- });
1653
-
1654
- describe('atRest: waiting out every curve', () => {
1655
- it('resolves when the last curve ends, retargets included', async () => {
1656
- const {animator} = setup();
1657
- animator.animate({y: 100}, {spring: springs.settle});
1658
- let rested = false;
1659
- void animator.atRest(['y']).then(() => {
1660
- rested = true;
1661
- });
1662
- await advance(100);
1663
- // Someone else retargets the row: the wait follows the new curve.
1664
- const second = animator.animate({y: 0}, {spring: springs.settle});
1665
- const [track] = live('translate');
1666
- const end = Number(track.options.duration) - END_HOLD_MS;
1667
- await advance(end - 1);
1668
- expect(rested).toBe(false);
1669
- await advance(2);
1670
- expect(rested).toBe(true);
1671
- await expect(second.finished).resolves.toBe(true);
1672
- });
1673
-
1674
- it('resolves at once at rest', async () => {
1675
- const {animator} = setup();
1676
- await expect(animator.atRest()).resolves.toBeUndefined();
1677
- });
1678
- });
1679
-
1680
- describe('presentation values, retargeting, velocity (spec:AST-094 FR6)', () => {
1681
- it('hands a release velocity to the spring', () => {
1682
- const {animator} = setup();
1683
- animator.set({y: 200});
1684
- animator.animate(
1685
- {y: 0},
1686
- {spring: springs.sheetDetent, velocity: {y: 1500}},
1687
- );
1688
- expect(animator.get('y')).toBe(200);
1689
- expect(animator.getVelocity('y')).toBeCloseTo(1500, 6);
1690
- });
1691
-
1692
- it('a retarget starts from the value and the velocity on screen', async () => {
1693
- const {animator} = setup();
1694
- animator.animate({x: 300}, {spring: springs.emphasis, velocity: {x: 800}});
1695
- const first = live('translate')[0];
1696
- await advance(120);
1697
- const value = animator.get('x');
1698
- const velocity = animator.getVelocity('x');
1699
- animator.animate({x: -100}, {spring: springs.emphasis});
1700
- expect(first.cancelled).toBe(true);
1701
- const second = live('translate')[0];
1702
- expect(second.startTime).toBe(clock);
1703
- expect(animator.get('x', clock)).toBeCloseTo(value, 9);
1704
- expect(animator.getVelocity('x', clock)).toBeCloseTo(velocity, 6);
1705
- expect(sampleAt(second, 'translate', clock)[0]).toBeCloseTo(value, 2);
1706
- // And it really goes to the new target with that start.
1707
- const curve = solveSpring(toSpring(springs.emphasis), {
1708
- from: value,
1709
- to: -100,
1710
- velocity,
1711
- });
1712
- expect(animator.get('x', clock + 90)).toBeCloseTo(curve.value(0.09), 9);
1713
- });
1714
-
1715
- it('velocity is continuous across a retarget (property sweep)', async () => {
1716
- for (const spring of [
1717
- springs.settle,
1718
- springs.quickChange,
1719
- springs.switchThumbMove,
1720
- springs.navigationPush,
1721
- ]) {
1722
- const {animator} = setup();
1723
- animator.animate({x: 200}, {spring});
1724
- for (const step of [16, 50, 120]) {
1725
- await advance(step);
1726
- const before = animator.getVelocity('x', clock);
1727
- const value = animator.get('x', clock);
1728
- animator.animate({x: value > 100 ? 0 : 200}, {spring});
1729
- expect(animator.getVelocity('x', clock)).toBeCloseTo(before, 6);
1730
- expect(animator.get('x', clock)).toBeCloseTo(value, 9);
1731
- }
1732
- }
1733
- });
1734
-
1735
- it('a value that keeps moving through a rebuild stays on its curve', async () => {
1736
- const {animator} = setup();
1737
- animator.animate({x: 300, y: 200}, {spring: springs.settle});
1738
- const yCurve = solveSpring(toSpring(springs.settle), {from: 0, to: 200});
1739
- await advance(100);
1740
- animator.animate({x: 0}, {spring: springs.settle});
1741
- const [animation] = live('translate');
1742
- for (let t = clock; t < clock + 400; t += 7) {
1743
- expect(
1744
- Math.abs(
1745
- sampleAt(animation, 'translate', t)[1] -
1746
- yCurve.value((t - 1000) / 1000),
1747
- ),
1748
- ).toBeLessThan(0.26);
1749
- expect(animator.get('y', t)).toBeCloseTo(
1750
- yCurve.value((t - 1000) / 1000),
1751
- 9,
1752
- );
1753
- }
1754
- });
1755
-
1756
- it('stop() freezes at the presentation value', async () => {
1757
- const {animator, element} = setup();
1758
- animator.animate({x: 300}, {spring: springs.settle});
1759
- await advance(80);
1760
- const value = animator.get('x');
1761
- animator.stop();
1762
- expect(live('translate')).toHaveLength(0);
1763
- expect(Number.parseFloat(element.style.translate)).toBeCloseTo(value, 3);
1764
- await advance(500);
1765
- expect(animator.get('x')).toBe(value);
1766
- expect(animator.getVelocity('x')).toBe(0);
1767
- });
1768
-
1769
- it('a handle reads, retargets and stops its own properties', async () => {
1770
- const {animator} = setup();
1771
- const handle = animator.animate({x: 100}, {spring: springs.settle});
1772
- await advance(50);
1773
- expect(handle.value('x')).toBe(animator.get('x'));
1774
- expect(handle.velocity('x')).toBe(animator.getVelocity('x'));
1775
- const next = handle.retarget({x: 50});
1776
- await expect(handle.finished).resolves.toBe(false);
1777
- next.stop();
1778
- await expect(next.finished).resolves.toBe(false);
1779
- });
1780
- });
1781
-
1782
- describe('set: direct manipulation', () => {
1783
- it('a commit that leaves several channels at identity reads the stylesheet once', () => {
1784
- // Each read after a write forces a style recalculation (a lifted menu
1785
- // that grows back to identity on translate, scale and opacity paid one
1786
- // per channel in its opening commit).
1787
- const {animator} = setup();
1788
- animator.set({x: 10, scale: 2, opacity: 0.5});
1789
- const reads = vi.mocked(window.getComputedStyle).mock.calls.length;
1790
- animator.set({x: 0, scale: 1, opacity: 1});
1791
- expect(vi.mocked(window.getComputedStyle).mock.calls.length - reads).toBe(
1792
- 1,
1793
- );
1794
- });
1795
-
1796
- it('writes one inline style per move and starts no animation', () => {
1797
- const {animator, element} = setup();
1798
- for (let x = 0; x < 30; x += 3) {
1799
- animator.set({x});
1800
- expect(element.style.translate).toBe(x === 0 ? '' : `${x}px 0px`);
1801
- }
1802
- expect(recorded).toHaveLength(0);
1803
- });
1804
-
1805
- it('a drag on translate leaves a running scale alone', () => {
1806
- const {animator} = setup();
1807
- animator.animate({scale: 0.95}, {spring: springs.settle});
1808
- const scaleAnimation = live('scale')[0];
1809
- animator.set({x: 12});
1810
- animator.set({x: 20});
1811
- expect(scaleAnimation.cancelled).toBe(false);
1812
- expect(live('translate')).toHaveLength(0);
1813
- });
1814
- });
1815
-
1816
- describe('finished', () => {
1817
- it('resolves true when the curve ends untouched', async () => {
1818
- const {animator} = setup();
1819
- const handle = animator.animate({x: 40}, {spring: springs.quickChange});
1820
- let result: boolean | undefined;
1821
- void handle.finished.then(value => {
1822
- result = value;
1823
- });
1824
- await advance(100);
1825
- expect(result).toBeUndefined();
1826
- await advance(5000);
1827
- expect(result).toBe(true);
1828
- });
1829
-
1830
- it('resolves false as soon as a property is retargeted, set or stopped', async () => {
1831
- const {animator} = setup();
1832
- const a = animator.animate({x: 40}, {spring: springs.quickChange});
1833
- animator.animate({x: 80}, {spring: springs.quickChange});
1834
- await expect(a.finished).resolves.toBe(false);
1835
- const b = animator.animate({y: 40}, {spring: springs.quickChange});
1836
- animator.set({y: 3});
1837
- await expect(b.finished).resolves.toBe(false);
1838
- const c = animator.animate({rotate: 40}, {spring: springs.quickChange});
1839
- animator.stop(['rotate']);
1840
- await expect(c.finished).resolves.toBe(false);
1841
- });
1842
-
1843
- it('waits while a sampler holds the animation past the curve\u2019s end', async () => {
1844
- const {animator} = setup();
1845
- const handle = animator.animate({x: 40}, {spring: springs.quickChange});
1846
- let result: boolean | undefined;
1847
- void handle.finished.then(value => {
1848
- result = value;
1849
- });
1850
- await advance(16);
1851
- // A harness pauses it (holdAnimations) and keeps it held well past the
1852
- // end of the curve on the wall clock: the motion has not ended.
1853
- const [animation] = live('translate');
1854
- animation.paused = true;
1855
- await advance(5000);
1856
- expect(result).toBeUndefined();
1857
- });
1858
-
1859
- it('resolves true once a held animation resumes and reaches its end', async () => {
1860
- const {animator} = setup();
1861
- const handle = animator.animate({x: 40}, {spring: springs.quickChange});
1862
- let result: boolean | undefined;
1863
- void handle.finished.then(value => {
1864
- result = value;
1865
- });
1866
- await advance(16);
1867
- const [animation] = live('translate');
1868
- animation.paused = true;
1869
- await advance(5000);
1870
- animation.paused = false;
1871
- await advance(1000);
1872
- expect(result).toBe(true);
1873
- });
1874
-
1875
- it('resolves on time for an animation nobody holds', async () => {
1876
- const {animator} = setup();
1877
- const handle = animator.animate({x: 40}, {spring: springs.quickChange});
1878
- let result: boolean | undefined;
1879
- void handle.finished.then(value => {
1880
- result = value;
1881
- });
1882
- const end = (handle.curve('x')?.duration ?? NaN) * 1000;
1883
- await advance(end - 50);
1884
- expect(result).toBeUndefined();
1885
- await advance(100);
1886
- expect(result).toBe(true);
1887
- });
1888
-
1889
- it('dispose cancels and settles everything', async () => {
1890
- const {animator} = setup();
1891
- const handle = animator.animate(
1892
- {x: 40, opacity: 0},
1893
- {spring: springs.quickChange},
1894
- );
1895
- animator.dispose();
1896
- await expect(handle.finished).resolves.toBe(false);
1897
- expect(recorded.every(a => a.cancelled)).toBe(true);
1898
- expect(animator.element).toBeNull();
1899
- });
1900
- });
1901
-
1902
- describe('Reduced Motion (design:reduced-motion)', () => {
1903
- // A coarse primary pointer, or a touch drag's release on any pointer,
1904
- // cross-fades (DR2); any other call completes at once (DR3).
1905
- const reduced = (coarse = true) => setup({reduced: true, coarse});
1906
- const fade = timing.reducedMotionCrossFadeMs;
1907
- const ease = cubicBezier(timing.curves.move);
1908
- /** Every animation the browser was handed changes opacity only. */
1909
- const opacityOnly = () =>
1910
- recorded.every(animation =>
1911
- animation.keyframes.every(keyframe =>
1912
- Object.keys(keyframe).every(key =>
1913
- ['opacity', 'offset', 'easing', 'composite'].includes(key),
1914
- ),
1915
- ),
1916
- );
1917
-
1918
- it('a call naming the opacity a running dip heads to keeps the dip', async () => {
1919
- const {animator} = reduced();
1920
- animator.animate({x: 100}, {spring: springs.navigationPush});
1921
- await commitFrame(clock);
1922
- const start = clock;
1923
- await advance(fade / 4);
1924
- // Mid fade out: a call names the opacity the dip returns to.
1925
- const handle = animator.animate({opacity: 1}, {spring: springs.settle});
1926
- // The dip goes on as it was: at its bottom when it was due, not opening
1927
- // a second dip from where it had got to.
1928
- expect(animator.get('opacity', start + fade / 2)).toBeCloseTo(0, 6);
1929
- await advance(fade / 4 + 1);
1930
- // Landed at the bottom; the fade back in ends when the dip was due to.
1931
- expect(animator.get('x')).toBe(100);
1932
- expect(animator.get('opacity', start + fade)).toBeCloseTo(1, 6);
1933
- await advance(fade + END_HOLD_MS + 1);
1934
- expect(animator.get('x')).toBe(100);
1935
- expect(animator.get('opacity')).toBe(1);
1936
- expect(await handle.finished).toBe(true);
1937
- });
1938
-
1939
- it('a call naming the opacity a dip heads to, in the same task as the dip, hands the browser no second fade', async () => {
1940
- const {animator} = reduced();
1941
- animator.animate({x: 100}, {spring: springs.navigationPush});
1942
- animator.animate({opacity: 1}, {spring: springs.settle});
1943
- await commitFrame(clock);
1944
- const fades = recorded.filter(animation =>
1945
- animation.keyframes.some(keyframe => 'opacity' in keyframe),
1946
- );
1947
- expect(fades).toHaveLength(1);
1948
- expect(fades[0].cancelled).toBe(false);
1949
- });
1950
-
1951
- it('a release played as a dip, then its state layer naming the opacity the dip returns to, fades once', async () => {
1952
- // A swipe row's release: the move's layer plays the travel, then the
1953
- // state layer lands its opacity on the same element in the same task.
1954
- const {animator} = reduced();
1955
- const move = animator.play(
1956
- {x: {duration: 0.3, at: t => (100 * t) / 0.3, velocity: () => 100 / 0.3}},
1957
- {touchRelease: true},
1958
- );
1959
- const state = animator.animate(
1960
- {opacity: 1},
1961
- {spring: springs.settle},
1962
- {touchRelease: true},
1963
- );
1964
- await commitFrame(clock);
1965
- const fades = recorded.filter(animation =>
1966
- animation.keyframes.some(keyframe => 'opacity' in keyframe),
1967
- );
1968
- expect(fades).toHaveLength(1);
1969
- await advance(fade + END_HOLD_MS + 1);
1970
- expect(animator.get('x')).toBe(100);
1971
- expect(animator.get('opacity')).toBe(1);
1972
- expect(await move.finished).toBe(true);
1973
- expect(await state.finished).toBe(true);
1974
- });
1975
-
1976
- it('an entrance after an outside finish starts from what is on screen', async () => {
1977
- const {animator} = reduced();
1978
- animator.animate(
1979
- {opacity: 0},
1980
- {spring: springs.settle},
1981
- {crossfadeAs: 'exit'},
1982
- );
1983
- await commitFrame(clock);
1984
- await advance(16);
1985
- // A test utility finishes the fade out: opacity 0 on screen, while the
1986
- // curve would still read about 0.93.
1987
- const [exit] = live('opacity');
1988
- exit.finish();
1989
- animator.animate(
1990
- {opacity: 1},
1991
- {spring: springs.settle},
1992
- {crossfadeAs: 'entrance'},
1993
- );
1994
- const fade = live('opacity').at(-1);
1995
- expect(fade?.keyframes[0].opacity).toBe('0');
1996
- });
1997
-
1998
- it('presented: a call that moves and fades in from transparent lands its travel', async () => {
1999
- // A control part at its rest offset, transparent, presented in one task
2000
- // with its own animator (SearchField's close button).
2001
- const {animator, element} = reduced();
2002
- animator.set({x: 44, opacity: 0});
2003
- animator.animate(
2004
- {x: 0, opacity: 1},
2005
- {spring: springs.settle},
2006
- {start: 'presented'},
2007
- );
2008
- await commitFrame(clock);
2009
- await commitFrame(clock);
2010
- await advance(fade + 16);
2011
- expect(animator.get('x')).toBe(0);
2012
- expect(parse(element.style.translate)[0] || 0).toBe(0);
2013
- expect(animator.get('opacity', clock)).toBeCloseTo(1, 9);
2014
- });
2015
-
2016
- it('fades for 200 ms at most', () => {
2017
- expect(fade).toBeGreaterThan(0);
2018
- expect(fade).toBeLessThanOrEqual(200);
2019
- });
2020
-
2021
- it('never animates a transform, on either pointer', async () => {
2022
- for (const coarse of [true, false]) {
2023
- const {animator} = reduced(coarse);
2024
- animator.animate({x: 100}, {spring: springs.navigationPush});
2025
- animator.animate({y: 400, opacity: 0}, {spring: springs.sheetDismiss});
2026
- animator.animate(
2027
- {scale: 0.9},
2028
- {spring: springs.quickChange},
2029
- {crossfadeAs: 'exit'},
2030
- );
2031
- animator.play({
2032
- rotate: {duration: 0.3, at: t => 30 * t, velocity: () => 30},
2033
- });
2034
- await advance(1000);
2035
- }
2036
- expect(recorded.length).toBeGreaterThan(0);
2037
- expect(opacityOnly()).toBe(true);
2038
- });
2039
-
2040
- it("a move with no opacity of its own dips from and back to the stylesheet's opacity, then hands it back", async () => {
2041
- const {animator, element} = reduced();
2042
- stylesheet = {opacity: '0.6'};
2043
- animator.animate({x: 100}, {spring: springs.navigationPush});
2044
- await commitFrame(clock); // the browser starts it
2045
- expect(animator.get('opacity', 1000)).toBeCloseTo(0.6, 9);
2046
- const [out] = live('opacity');
2047
- expect(out.keyframes[0].opacity).toBe('0.6');
2048
- await advance(fade / 2);
2049
- // Landed while transparent, fading back in to the stylesheet's value.
2050
- expect(animator.get('x')).toBe(100);
2051
- expect(animator.get('opacity', clock + fade / 2)).toBeCloseTo(0.6, 9);
2052
- await advance(fade / 2 + END_HOLD_MS + 1);
2053
- // No inline opacity is left behind: the stylesheet owns it again.
2054
- expect(element.style.opacity).toBe('');
2055
- expect(animator.get('opacity')).toBe(1);
2056
- });
2057
-
2058
- it('overlapping dips on the stylesheet opacity never leave it pinned inline', async () => {
2059
- for (const at of ['fading out', 'fading back in'] as const) {
2060
- const {animator, element} = reduced();
2061
- stylesheet = {opacity: '0.6'};
2062
- animator.animate({x: 100}, {spring: springs.navigationPush});
2063
- await commitFrame(clock);
2064
- await advance(at === 'fading out' ? fade / 4 : fade / 2 + 20);
2065
- animator.animate({x: 200}, {spring: springs.navigationPush});
2066
- await commitFrame(clock);
2067
- await advance(fade * 2 + END_HOLD_MS + 1);
2068
- expect(animator.get('x')).toBe(200);
2069
- // The stylesheet owns opacity again.
2070
- expect(element.style.opacity).toBe('');
2071
- expect(animator.get('opacity')).toBe(1);
2072
- }
2073
- });
2074
-
2075
- it('detaching and attaching a new node during a dip lands the move on it (React replacement)', async () => {
2076
- const {animator} = reduced();
2077
- const handle = animator.animate({x: 100}, {spring: springs.navigationPush});
2078
- await commitFrame(clock);
2079
- await advance(50);
2080
- animator.attach(null);
2081
- const replacement = document.createElement('div');
2082
- animator.attach(replacement);
2083
- // The dip goes on on the new node: the move lands at its bottom.
2084
- await advance(fade);
2085
- expect(animator.get('x')).toBe(100);
2086
- expect(replacement.style.translate).toBe('100px 0px');
2087
- await expect(handle.finished).resolves.toBe(true);
2088
- });
2089
-
2090
- it('a move that overlaps a running fade lands only once the element is invisible', async () => {
2091
- const {animator} = reduced();
2092
- animator.set({opacity: 0});
2093
- animator.animate({opacity: 1}, {spring: springs.navigationPush});
2094
- await advance(fade / 3);
2095
- const start = clock;
2096
- expect(animator.get('opacity')).toBeGreaterThan(0.1);
2097
- animator.animate({x: 100}, {spring: springs.navigationPush});
2098
- // Still where it was while it shows; it moves at the bottom of the dip.
2099
- await advance(fade / 2 - 2);
2100
- expect(clock - start).toBe(fade / 2 - 2);
2101
- expect(animator.get('x')).toBe(0);
2102
- await advance(4);
2103
- expect(animator.get('x')).toBe(100);
2104
- expect(animator.get('opacity')).toBeLessThan(0.1);
2105
- await advance(fade);
2106
- expect(animator.get('opacity')).toBeCloseTo(1, 9);
2107
- });
2108
-
2109
- it("a second call's fade re-times the first call's pending jump to its own invisible moment", async () => {
2110
- const {animator} = reduced();
2111
- animator.animate({x: 100}, {spring: springs.navigationPush});
2112
- await advance(fade / 4);
2113
- const start = clock;
2114
- // x still waits for the first dip's bottom; y starts a new dip now.
2115
- animator.animate({y: 50}, {spring: springs.navigationPush});
2116
- // Neither moves while the element shows: both land at the new dip's
2117
- // bottom.
2118
- await advance(fade / 2 - 2);
2119
- expect(clock - start).toBe(fade / 2 - 2);
2120
- expect(animator.get('x')).toBe(0);
2121
- expect(animator.get('y')).toBe(0);
2122
- await advance(4);
2123
- expect(animator.get('x')).toBe(100);
2124
- expect(animator.get('y')).toBe(50);
2125
- expect(animator.get('opacity')).toBeLessThan(0.1);
2126
- });
2127
-
2128
- it('a stop during a dip finishes the fade instead of freezing it', async () => {
2129
- const {animator} = reduced();
2130
- animator.animate({x: 100}, {spring: springs.navigationPush});
2131
- await advance(fade / 2 - 5);
2132
- expect(animator.get('opacity')).toBeLessThan(0.1);
2133
- animator.stop();
2134
- expect(animator.get('opacity')).toBe(1);
2135
- });
2136
-
2137
- it("a stop during a dip on the stylesheet's opacity hands it back", async () => {
2138
- const {animator, element} = reduced();
2139
- stylesheet = {opacity: '0.6'};
2140
- animator.animate({x: 100}, {spring: springs.navigationPush});
2141
- await advance(fade / 4);
2142
- animator.stop();
2143
- expect(element.style.opacity).toBe('');
2144
- expect(animator.get('opacity')).toBe(1);
2145
- });
2146
-
2147
- it('a call that does not own opacity keeps a running borrowed dip handing it back', async () => {
2148
- // One that moves nothing.
2149
- const still = reduced();
2150
- stylesheet = {opacity: '0.6'};
2151
- still.animator.animate({x: 100}, {spring: springs.navigationPush});
2152
- await advance(fade / 4);
2153
- still.animator.animate({x: 100}, {spring: springs.navigationPush});
2154
- await advance(fade + END_HOLD_MS + 1);
2155
- expect(still.element.style.opacity).toBe('');
2156
-
2157
- // One that springs after Reduce Motion turned off mid-dip.
2158
- const changed = setup({reduced: true, coarse: true});
2159
- changed.animator.animate({x: 100}, {spring: springs.navigationPush});
2160
- await advance(fade / 4);
2161
- stubMedia(false, true);
2162
- changed.animator.animate({y: 20}, {spring: springs.navigationPush});
2163
- await advance(2000);
2164
- expect(changed.element.style.opacity).toBe('');
2165
- });
2166
-
2167
- it('a borrowed dip that ends while detached hands the opacity back on the next attach', async () => {
2168
- const {animator, element} = reduced();
2169
- stylesheet = {opacity: '0.6'};
2170
- animator.animate({x: 100}, {spring: springs.navigationPush});
2171
- await advance(25);
2172
- animator.attach(null);
2173
- await advance(fade + END_HOLD_MS + 1);
2174
- animator.attach(element);
2175
- expect(element.style.opacity).toBe('');
2176
- expect(animator.get('opacity')).toBe(1);
2177
- });
2178
-
2179
- it('an unmount or dispose during a borrowed dip hands the opacity back to that element', async () => {
2180
- for (const end of ['detach', 'dispose'] as const) {
2181
- const {animator, element} = reduced();
2182
- stylesheet = {opacity: '0.6'};
2183
- animator.animate({x: 100}, {spring: springs.navigationPush});
2184
- await advance(25);
2185
- if (end === 'detach') {
2186
- animator.attach(null);
2187
- } else {
2188
- animator.dispose();
2189
- }
2190
- expect(element.style.opacity).toBe('');
2191
- }
2192
- });
2193
-
2194
- it('a new element taking over mid-dip keeps the dip, so the move lands while invisible', async () => {
2195
- const {animator, element} = reduced();
2196
- stylesheet = {opacity: '0.6'};
2197
- animator.animate({x: 240}, {spring: springs.navigationPush});
2198
- await advance(25);
2199
- const next = document.createElement('div');
2200
- document.body.append(next);
2201
- animator.attach(next);
2202
- // The outgoing element follows its stylesheet again.
2203
- expect(element.style.opacity).toBe('');
2204
- const start = clock - 25;
2205
- for (let t = start; t <= start + fade; t += 2) {
2206
- if (animator.get('x', t) !== 0) {
2207
- expect(animator.get('opacity', t)).toBeCloseTo(0, 6);
2208
- break;
2209
- }
2210
- }
2211
- await advance(fade + END_HOLD_MS + 1);
2212
- expect(next.style.opacity).toBe('');
2213
- next.remove();
2214
- });
2215
-
2216
- it('a node detached mid-dip and attached again in a later task shows the move landed and visible', async () => {
2217
- const {animator, element} = reduced();
2218
- // The call owns its opacity: its dip writes opacity inline, the value on
2219
- // screen as the fade starts (its end is written when the fade retires),
2220
- // while the model is already partway down.
2221
- animator.animate({x: 240, opacity: 1}, {spring: springs.navigationPush});
2222
- await advance(25);
2223
- expect(element.style.opacity).not.toBe('');
2224
- expect(animator.get('opacity')).toBeLessThan(1);
2225
- animator.attach(null);
2226
- await advance(100);
2227
- animator.attach(element);
2228
- expect(animator.get('x')).toBe(240);
2229
- expect(animator.get('opacity')).toBe(1);
2230
- expect(element.style.opacity).not.toBe('0');
2231
- expect(Number(element.style.opacity || '1')).toBe(1);
2232
- });
2233
-
2234
- it('a node detached mid-dip from a dimmed opacity shows the move landed and visible when attached again', async () => {
2235
- // With the presented start, a curve writes its starting value inline: a
2236
- // dip from a dimmed opacity leaves that low value on the node while the
2237
- // move still waits to land.
2238
- const {animator, element} = reduced();
2239
- animator.set({opacity: 0.3});
2240
- animator.animate({x: 240, opacity: 1}, {spring: springs.navigationPush});
2241
- await advance(25);
2242
- expect(Number(element.style.opacity)).toBeLessThan(1);
2243
- expect(animator.get('x')).toBe(0);
2244
- animator.attach(null);
2245
- await advance(100);
2246
- animator.attach(element);
2247
- expect(animator.get('x')).toBe(240);
2248
- expect(animator.get('opacity')).toBe(1);
2249
- expect(Number(element.style.opacity || '1')).toBe(1);
2250
- });
2251
-
2252
- it('a node detached mid-dip while another axis moves is left with no animation or promotion', async () => {
2253
- const {animator, element} = reduced();
2254
- animator.set({x: 0, y: 0});
2255
- // y coasts (momentum keeps its motion) while x waits in a dip.
2256
- const start = clock;
2257
- animator.decay(coast(animator, {y: 800}, {at: start}), {at: start});
2258
- animator.animate({x: 240}, {spring: springs.navigationPush});
2259
- await advance(25);
2260
- animator.attach(null);
2261
- await advance(1);
2262
- expect(
2263
- recorded.filter(
2264
- animation =>
2265
- animation.element === element &&
2266
- !animation.cancelled &&
2267
- animation.playState !== 'finished',
2268
- ),
2269
- ).toEqual([]);
2270
- expect(element.style.willChange).toBe('');
2271
- });
2272
-
2273
- it('lands a waiting move on the latest node detached in the task, after a replacement too', async () => {
2274
- const {animator} = reduced();
2275
- animator.animate({x: 240, opacity: 1}, {spring: springs.navigationPush});
2276
- await advance(25);
2277
- const next = document.createElement('div');
2278
- document.body.append(next);
2279
- animator.attach(null);
2280
- animator.attach(next);
2281
- animator.attach(null);
2282
- await advance(100);
2283
- // The node attached last, then detached, is the one left visible.
2284
- expect(Number(next.style.opacity || '1')).toBe(1);
2285
- next.remove();
2286
- });
2287
-
2288
- it('a dispose right after a detach lands the waiting move on that node', async () => {
2289
- const {animator, element} = reduced();
2290
- animator.animate({x: 240, opacity: 1}, {spring: springs.navigationPush});
2291
- await advance(25);
2292
- animator.attach(null);
2293
- animator.dispose();
2294
- await advance(100);
2295
- expect(Number(element.style.opacity || '1')).toBe(1);
2296
- expect(element.style.willChange).toBe('');
2297
- });
2298
-
2299
- it('an identity held over a differing stylesheet follows a node replacement', () => {
2300
- const {animator, element} = reduced();
2301
- stylesheet = {opacity: '0'};
2302
- animator.set({opacity: 1});
2303
- expect(element.style.opacity).toBe('1');
2304
- animator.attach(null);
2305
- const next = document.createElement('div');
2306
- document.body.append(next);
2307
- animator.attach(next);
2308
- expect(next.style.opacity).toBe('1');
2309
- expect(animator.get('opacity')).toBe(1);
2310
- next.remove();
2311
- });
2312
-
2313
- it('a running dip survives any re-attach, so the move never passes in view', async () => {
2314
- const halfway = async (
2315
- animator: ReturnType<typeof createAnimator>,
2316
- start: number,
2317
- ): Promise<number> => {
2318
- // The plan lands by timer: step the clock to the landing.
2319
- while (clock <= start + fade) {
2320
- await advance(2);
2321
- if (animator.get('x') !== 0) {
2322
- return animator.get('opacity');
2323
- }
2324
- }
2325
- return Number.NaN;
2326
- };
2327
- // Detached and re-attached to the same element, no stylesheet opacity.
2328
- const same = reduced();
2329
- same.animator.animate({x: 240}, {spring: springs.navigationPush});
2330
- const start = clock;
2331
- await advance(25);
2332
- same.animator.attach(null);
2333
- same.animator.attach(same.element);
2334
- expect(await halfway(same.animator, start)).toBeCloseTo(0, 6);
2335
- // Handed to another element, no stylesheet opacity.
2336
- const other = reduced();
2337
- other.animator.animate({x: 240}, {spring: springs.navigationPush});
2338
- const start2 = clock;
2339
- await advance(25);
2340
- const next = document.createElement('div');
2341
- document.body.append(next);
2342
- other.animator.attach(next);
2343
- expect(await halfway(other.animator, start2)).toBeCloseTo(0, 6);
2344
- await advance(fade + END_HOLD_MS + 1);
2345
- expect(next.style.opacity).toBe('');
2346
- next.remove();
2347
- });
2348
-
2349
- it('an opacity the animator wrote is owned: a dip returns to it, never to a hiding stylesheet', async () => {
2350
- const {animator, element} = reduced();
2351
- stylesheet = {opacity: '0'};
2352
- animator.set({opacity: 1});
2353
- expect(element.style.opacity).toBe('1');
2354
- animator.animate({x: 100}, {spring: springs.navigationPush});
2355
- await advance(fade + END_HOLD_MS + 1);
2356
- expect(element.style.opacity).toBe('1');
2357
- });
2358
-
2359
- it('borrows nothing from a hidden element, so a later move still dips once it shows', async () => {
2360
- const {animator} = reduced();
2361
- stylesheet = {opacity: '0'};
2362
- animator.animate({x: 100}, {spring: springs.navigationPush});
2363
- // Invisible: the move lands at once, with no dip.
2364
- expect(animator.get('x')).toBe(100);
2365
- await advance(fade + END_HOLD_MS + 1);
2366
- stylesheet = {opacity: '1'};
2367
- animator.animate({x: 200}, {spring: springs.navigationPush});
2368
- const start = clock;
2369
- for (let t = start; t <= start + fade; t += 2) {
2370
- if (animator.get('x', t) !== 100) {
2371
- expect(animator.get('opacity', t)).toBeCloseTo(0, 6);
2372
- break;
2373
- }
2374
- }
2375
- });
2376
-
2377
- it("a stop that finishes a dip's fade lands the move with it, never later in view", async () => {
2378
- const {animator} = reduced();
2379
- animator.animate({x: 100}, {spring: springs.navigationPush});
2380
- await advance(fade / 4);
2381
- animator.stop(['opacity']);
2382
- expect(animator.get('x')).toBe(100);
2383
- expect(animator.get('opacity')).toBe(1);
2384
- });
2385
-
2386
- it('a release past an edge springs back as a cross-fade, not momentum (DR2)', async () => {
2387
- const {animator} = reduced();
2388
- animator.set({x: -80});
2389
- const start = clock;
2390
- animator.decay(
2391
- coast(animator, {x: 0}, {bounds: {x: {min: 0, max: 100}}, at: start}),
2392
- {at: start},
2393
- );
2394
- // The plan lands by timer: step the clock; it moves only while invisible.
2395
- let moved = false;
2396
- while (clock <= start + fade) {
2397
- await advance(2);
2398
- if (!moved && animator.get('x') !== -80) {
2399
- moved = true;
2400
- expect(animator.get('opacity')).toBeLessThan(0.1);
2401
- }
2402
- }
2403
- expect(moved).toBe(true);
2404
- expect(animator.get('x')).toBe(0);
2405
- });
2406
-
2407
- it('a spring back a touch release starts cross-fades on a fine pointer too (DR2)', async () => {
2408
- const {animator} = reduced(false);
2409
- animator.set({x: -80});
2410
- const start = clock;
2411
- animator.decay(
2412
- coast(animator, {x: 0}, {bounds: {x: {min: 0, max: 100}}, at: start}),
2413
- {at: start, touchRelease: true},
2414
- );
2415
- // Not at once: it moves only while invisible.
2416
- expect(animator.get('x')).toBe(-80);
2417
- let moved = false;
2418
- while (clock <= start + fade) {
2419
- await advance(2);
2420
- if (!moved && animator.get('x') !== -80) {
2421
- moved = true;
2422
- expect(animator.get('opacity')).toBeLessThan(0.1);
2423
- }
2424
- }
2425
- expect(moved).toBe(true);
2426
- expect(animator.get('x')).toBe(0);
2427
- });
2428
-
2429
- it('a release with one axis past an edge is one handle: stop() stops the cross-fade too', async () => {
2430
- const {animator} = reduced();
2431
- animator.set({x: -80, y: 0});
2432
- const start = clock;
2433
- const handle = animator.decay(
2434
- coast(
2435
- animator,
2436
- {x: 0, y: 500},
2437
- {bounds: {x: {min: 0, max: 100}}, at: start},
2438
- ),
2439
- {at: start},
2440
- );
2441
- expect(handle.properties).toEqual(expect.arrayContaining(['x', 'y']));
2442
- await advance(fade / 4);
2443
- handle.stop();
2444
- // A catch freezes the release where it is on screen (AST-094 FR6): x
2445
- // never lands at its edge, and the fade it was waiting in finishes.
2446
- const stopped = {x: animator.get('x'), y: animator.get('y')};
2447
- expect(stopped.x).toBe(-80);
2448
- expect(animator.get('opacity')).toBe(1);
2449
- await advance(fade + END_HOLD_MS + 1);
2450
- expect(animator.get('x')).toBe(-80);
2451
- expect(animator.get('y')).toBe(stopped.y);
2452
- });
2453
-
2454
- it('a carried move keeps its own call: stopping or setting it settles that call, not the one carrying it', async () => {
2455
- for (const interrupt of ['set', 'stop'] as const) {
2456
- const {animator} = reduced();
2457
- const a = animator.animate({x: 100}, {spring: springs.navigationPush});
2458
- await advance(fade / 4);
2459
- const b = animator.animate({y: 50}, {spring: springs.navigationPush});
2460
- if (interrupt === 'set') {
2461
- animator.set({x: 40});
2462
- } else {
2463
- a.stop();
2464
- }
2465
- await advance(fade * 2 + END_HOLD_MS + 1);
2466
- await expect(a.finished).resolves.toBe(false);
2467
- await expect(b.finished).resolves.toBe(true);
2468
- expect(animator.get('x')).toBe(interrupt === 'set' ? 40 : 0);
2469
- expect(animator.get('y')).toBe(50);
2470
- }
2471
- });
2472
-
2473
- it("an earlier handle's stop leaves a later call's move on the same property alone", async () => {
2474
- const {animator} = reduced();
2475
- const a = animator.animate({x: 100}, {spring: springs.navigationPush});
2476
- await advance(fade / 4);
2477
- const b = animator.animate({x: 200}, {spring: springs.navigationPush});
2478
- a.stop();
2479
- await advance(fade * 2 + END_HOLD_MS + 1);
2480
- expect(animator.get('x')).toBe(200);
2481
- await expect(a.finished).resolves.toBe(false);
2482
- await expect(b.finished).resolves.toBe(true);
2483
- });
2484
-
2485
- it('a retargeted call settles interrupted; its retarget lands', async () => {
2486
- const {animator} = reduced();
2487
- const a = animator.animate({x: 100}, {spring: springs.navigationPush});
2488
- await advance(fade / 4);
2489
- const b = a.retarget({x: 150});
2490
- await advance(fade * 2 + END_HOLD_MS + 1);
2491
- expect(animator.get('x')).toBe(150);
2492
- await expect(a.finished).resolves.toBe(false);
2493
- await expect(b.finished).resolves.toBe(true);
2494
- });
2495
-
2496
- it('a move whose animations are paused before their first frame still lands once released', async () => {
2497
- for (const release of ['resume', 'finish'] as const) {
2498
- const {animator} = reduced();
2499
- const handle = animator.animate(
2500
- {x: 100},
2501
- {spring: springs.navigationPush},
2502
- );
2503
- // Something pauses the call's animations in its own task.
2504
- for (const animation of recorded) {
2505
- animation.paused = true;
2506
- }
2507
- await commitFrame(clock);
2508
- clock += 30;
2509
- await commitFrame(clock);
2510
- for (const animation of recorded) {
2511
- if (release === 'resume') {
2512
- // play(): pending, so the start comes a frame later, after the
2513
- // frame's callbacks.
2514
- animation.paused = false;
2515
- animation.startDelayFrames = 1;
2516
- } else {
2517
- animation.finish();
2518
- }
2519
- }
2520
- // Frames keep coming: step the clock through the landing.
2521
- for (let step = 0; step < 16; step++) {
2522
- await advance(fade / 4);
2523
- }
2524
- expect(animator.get('x')).toBe(100);
2525
- expect(animator.get('opacity')).toBe(1);
2526
- await expect(handle.finished).resolves.toBe(true);
2527
- }
2528
- });
2529
-
2530
- it('a landing later than the whole fade back in shows the element at once and settles then', async () => {
2531
- // A hold released long after the dip was due: the landing\u2019s timer runs
2532
- // more than the whole fade back in late, so the element appears at once
2533
- // where it landed. No fade is left for the browser to start a frame
2534
- // later, so the call\u2019s finished never reports an element still at 0.
2535
- for (const sheet of ['own', 'stylesheet'] as const) {
2536
- const {animator, element} = reduced();
2537
- stylesheet = sheet === 'stylesheet' ? {opacity: '0.6'} : {};
2538
- const handle = animator.animate(
2539
- {x: 100},
2540
- {spring: springs.navigationPush},
2541
- );
2542
- for (const animation of recorded) {
2543
- animation.paused = true;
2544
- }
2545
- await commitFrame(clock);
2546
- clock += fade * 2;
2547
- for (const animation of recorded) {
2548
- animation.finish();
2549
- }
2550
- const before = recorded.length;
2551
- let settled: boolean | undefined;
2552
- void handle.finished.then(value => {
2553
- settled = value;
2554
- });
2555
- // The next frame finds the hold finished: the landing is long due.
2556
- await commitFrame(clock);
2557
- await vi.advanceTimersByTimeAsync(0);
2558
- expect(animator.get('x')).toBe(100);
2559
- expect(
2560
- recorded
2561
- .slice(before)
2562
- .filter(
2563
- animation =>
2564
- !animation.cancelled &&
2565
- 'opacity' in (animation.keyframes[0] ?? {}),
2566
- ),
2567
- ).toHaveLength(0);
2568
- expect(settled).toBe(true);
2569
- if (sheet === 'stylesheet') {
2570
- // Handed back to the stylesheet at once.
2571
- expect(element.style.opacity).toBe('');
2572
- } else {
2573
- expect(animator.get('opacity')).toBe(1);
2574
- }
2575
- animator.dispose();
2576
- recorded = [];
2577
- }
2578
- });
2579
-
2580
- it('a move held before its first frame and finished from outside still lands when its retire runs before the next frame', async () => {
2581
- // A sampler pauses the call's animations in its own task and finishes
2582
- // them later. A loaded page can run the retire timer, which cancels the
2583
- // finished fade, before the frame that would read the call's start: the
2584
- // call must not be left waiting for a start that no animation can give.
2585
- const {animator} = reduced();
2586
- const handle = animator.animate({x: 100}, {spring: springs.navigationPush});
2587
- for (const animation of recorded) {
2588
- animation.paused = true;
2589
- }
2590
- await commitFrame(clock);
2591
- clock += 30;
2592
- await commitFrame(clock);
2593
- for (const animation of recorded) {
2594
- animation.finish();
2595
- }
2596
- let settled: boolean | undefined;
2597
- void handle.finished.then(value => {
2598
- settled = value;
2599
- });
2600
- // The retire timer first, with no frame in between: it cancels the
2601
- // finished fade out.
2602
- clock += fade * 2;
2603
- await vi.advanceTimersByTimeAsync(fade * 2);
2604
- expect(
2605
- recorded.filter(animation => animation.finished && !animation.cancelled),
2606
- ).toEqual([]);
2607
- // Frames keep coming: step the clock through the landing.
2608
- for (let step = 0; step < 16; step++) {
2609
- await advance(fade / 4);
2610
- }
2611
- expect(animator.get('x')).toBe(100);
2612
- expect(animator.get('opacity')).toBe(1);
2613
- expect(settled).toBe(true);
2614
- });
2615
-
2616
- it('a waiting call whose own opacity a later call retargets settles interrupted', async () => {
2617
- const {animator} = reduced();
2618
- const dismiss = animator.animate(
2619
- {y: 800, opacity: 0},
2620
- {spring: springs.sheetDismiss},
2621
- );
2622
- await advance(fade / 4);
2623
- const show = animator.animate({opacity: 1}, {spring: springs.settle});
2624
- // The plan lands by timer: step the clock through the dip.
2625
- for (let step = 0; step < 12; step++) {
2626
- await advance(fade / 8);
2627
- }
2628
- expect(animator.get('opacity')).toBe(1);
2629
- await expect(dismiss.finished).resolves.toBe(false);
2630
- await expect(show.finished).resolves.toBe(true);
2631
- });
2632
-
2633
- it('a move taken back mid-dip fades straight back up instead of finishing the dip', async () => {
2634
- const {animator} = reduced();
2635
- const move = animator.animate({x: 100}, {spring: springs.navigationPush});
2636
- await advance(fade / 4);
2637
- const shown = animator.get('opacity');
2638
- expect(shown).toBeLessThan(1);
2639
- const back = animator.animate({x: 0}, {spring: springs.navigationPush});
2640
- let lowest = shown;
2641
- for (let step = 0; step < 12; step++) {
2642
- await advance(fade / 8);
2643
- lowest = Math.min(lowest, animator.get('opacity'));
2644
- }
2645
- expect(lowest).toBeGreaterThanOrEqual(shown - 1e-6);
2646
- expect(animator.get('x')).toBe(0);
2647
- expect(animator.get('opacity')).toBe(1);
2648
- await expect(move.finished).resolves.toBe(false);
2649
- await expect(back.finished).resolves.toBe(true);
2650
- });
2651
-
2652
- it('an entrance by role caught mid-exit fades in from where the exit has it', async () => {
2653
- const {animator} = reduced();
2654
- animator.animate(
2655
- {y: 40},
2656
- {spring: springs.navigationPush},
2657
- {crossfadeAs: 'exit'},
2658
- );
2659
- await advance(fade / 4);
2660
- const shown = animator.get('opacity');
2661
- expect(shown).toBeLessThan(1);
2662
- animator.animate(
2663
- {y: 0},
2664
- {spring: springs.navigationPush},
2665
- {crossfadeAs: 'entrance'},
2666
- );
2667
- let lowest = shown;
2668
- for (let step = 0; step < 12; step++) {
2669
- await advance(fade / 8);
2670
- lowest = Math.min(lowest, animator.get('opacity'));
2671
- }
2672
- expect(lowest).toBeGreaterThanOrEqual(shown - 1e-6);
2673
- expect(animator.get('y')).toBe(0);
2674
- expect(animator.get('opacity')).toBe(1);
2675
- });
2676
-
2677
- it('a caught dismissal fades straight back up: a call that sets every waiting value takes it over', async () => {
2678
- const {animator} = reduced();
2679
- const dismiss = animator.animate(
2680
- {y: 800, opacity: 0},
2681
- {spring: springs.sheetDismiss},
2682
- );
2683
- await advance(fade / 4);
2684
- const shown = animator.get('opacity');
2685
- const present = animator.animate(
2686
- {y: 0, opacity: 1},
2687
- {spring: springs.sheetPresent},
2688
- );
2689
- await commitFrame(clock);
2690
- // No dip: the opacity only rises from where it was.
2691
- let lowest = shown;
2692
- const start = clock;
2693
- while (clock <= start + fade * 2) {
2694
- await advance(2);
2695
- lowest = Math.min(lowest, animator.get('opacity'));
2696
- }
2697
- expect(lowest).toBeGreaterThanOrEqual(shown - 1e-6);
2698
- expect(animator.get('y')).toBe(0);
2699
- expect(animator.get('opacity')).toBe(1);
2700
- await expect(dismiss.finished).resolves.toBe(false);
2701
- await expect(present.finished).resolves.toBe(true);
2702
- });
2703
-
2704
- it("a handle's stop mid-dip freezes its waiting travel where it is, as animator.stop() does (AST-094 FR6)", async () => {
2705
- const {animator} = reduced();
2706
- const handle = animator.animate({x: 100}, {spring: springs.navigationPush});
2707
- await advance(fade / 4);
2708
- handle.stop();
2709
- expect(animator.get('x')).toBe(0);
2710
- expect(animator.get('opacity')).toBe(1);
2711
- await advance(fade + END_HOLD_MS + 1);
2712
- expect(animator.get('x')).toBe(0);
2713
- await expect(handle.finished).resolves.toBe(false);
2714
- });
2715
-
2716
- it('a second move during a borrowed dip copies no stylesheet opacity inline', async () => {
2717
- const {animator, element} = reduced();
2718
- stylesheet = {opacity: '0.6'};
2719
- animator.animate({x: 100}, {spring: springs.navigationPush});
2720
- await advance(fade / 4);
2721
- animator.animate({y: 50}, {spring: springs.navigationPush});
2722
- await advance(fade / 2);
2723
- // Landed, and fading back in to the stylesheet's value.
2724
- expect(animator.get('opacity', clock + fade / 2)).toBeCloseTo(0.6, 9);
2725
- await advance(fade + END_HOLD_MS + 1);
2726
- expect(element.style.opacity).toBe('');
2727
- expect(animator.get('opacity')).toBe(1);
2728
- });
2729
-
2730
- it('a stop during a dip whose opacity a call owns ends where the fade was heading', async () => {
2731
- const {animator} = reduced();
2732
- animator.set({opacity: 0.8});
2733
- animator.animate({x: 100}, {spring: springs.navigationPush});
2734
- await commitFrame(clock);
2735
- await advance(50);
2736
- animator.stop();
2737
- expect(animator.get('opacity')).toBeCloseTo(0.8, 9);
2738
- });
2739
-
2740
- it('an opacity change mid-dip lands the waiting move only once the element is invisible', async () => {
2741
- const {animator} = reduced();
2742
- animator.animate({x: 100}, {spring: springs.navigationPush});
2743
- await commitFrame(clock);
2744
- await advance(20);
2745
- animator.animate({opacity: 0}, {spring: springs.navigationPush});
2746
- // Still where it was while it shows.
2747
- expect(animator.get('x')).toBe(0);
2748
- await advance(fade - 2);
2749
- expect(animator.get('x')).toBe(0);
2750
- await advance(4);
2751
- expect(animator.get('x')).toBe(100);
2752
- expect(animator.get('opacity')).toBeCloseTo(0, 9);
2753
- });
2754
-
2755
- it('a second borrowed dip opens at the opacity on screen', async () => {
2756
- const {animator} = reduced();
2757
- stylesheet = {opacity: '0.6'};
2758
- animator.animate({x: 100}, {spring: springs.navigationPush});
2759
- await commitFrame(clock);
2760
- await advance(fade / 4);
2761
- const before = animator.get('opacity');
2762
- expect(before).toBeLessThan(0.6);
2763
- animator.animate({x: 200}, {spring: springs.navigationPush});
2764
- expect(animator.get('opacity')).toBeCloseTo(before, 6);
2765
- });
2766
-
2767
- it("a fade by role on a stylesheet's opacity ends on it and hands it back", async () => {
2768
- for (const role of ['entrance', 'exit'] as const) {
2769
- const {animator, element} = reduced();
2770
- stylesheet = {opacity: '0.6'};
2771
- animator.animate(
2772
- {x: 100},
2773
- {spring: springs.navigationPush},
2774
- {crossfadeAs: role},
2775
- );
2776
- await commitFrame(clock);
2777
- const [layer] = live('opacity');
2778
- const keyframes = layer.keyframes.map(k => Number(k.opacity));
2779
- expect(Math.max(...keyframes)).toBeCloseTo(0.6, 9);
2780
- await advance(fade * 2 + END_HOLD_MS + 1);
2781
- expect(animator.get('x')).toBe(100);
2782
- expect(element.style.opacity).toBe('');
2783
- }
2784
- });
2785
-
2786
- it('a move set before its dip lands does not report finished', async () => {
2787
- const {animator} = reduced();
2788
- const handle = animator.animate({x: 100}, {spring: springs.navigationPush});
2789
- await commitFrame(clock);
2790
- await advance(20);
2791
- animator.set({x: 40});
2792
- await expect(handle.finished).resolves.toBe(false);
2793
- await advance(fade + END_HOLD_MS + 1);
2794
- expect(animator.get('x')).toBe(40);
2795
- });
2796
-
2797
- it('dispose settles a move still waiting to land, and the calls it carries, as interrupted', async () => {
2798
- const {animator} = reduced();
2799
- const first = animator.animate({x: 100}, {spring: springs.navigationPush});
2800
- await commitFrame(clock);
2801
- await advance(10);
2802
- const second = animator.animate({y: 50}, {spring: springs.navigationPush});
2803
- await advance(10);
2804
- animator.dispose();
2805
- await expect(first.finished).resolves.toBe(false);
2806
- await expect(second.finished).resolves.toBe(false);
2807
- expect(vi.getTimerCount()).toBe(0);
2808
- });
2809
-
2810
- it("a caught or replaced exit by role hands the stylesheet's opacity back", async () => {
2811
- // Caught: stop() 50 ms into the exit.
2812
- const caught = reduced();
2813
- stylesheet = {opacity: '0.6'};
2814
- caught.animator.animate(
2815
- {x: 100},
2816
- {spring: springs.navigationPush},
2817
- {crossfadeAs: 'exit'},
2818
- );
2819
- await commitFrame(clock);
2820
- await advance(50);
2821
- caught.animator.stop();
2822
- expect(caught.element.style.opacity).toBe('');
2823
- // Replaced: React swaps the node 50 ms into the exit.
2824
- const replaced = reduced();
2825
- stylesheet = {opacity: '0.6'};
2826
- replaced.animator.animate(
2827
- {x: 100},
2828
- {spring: springs.navigationPush},
2829
- {crossfadeAs: 'exit'},
2830
- );
2831
- await commitFrame(clock);
2832
- await advance(50);
2833
- replaced.animator.attach(null);
2834
- const node = document.createElement('div');
2835
- replaced.animator.attach(node);
2836
- expect(replaced.element.style.opacity).toBe('');
2837
- // The exit goes on on the new node, then hands the opacity back.
2838
- await advance(fade + END_HOLD_MS + 1);
2839
- expect(node.style.opacity).toBe('');
2840
- expect(replaced.animator.get('x')).toBe(100);
2841
- });
2842
-
2843
- it('dispose mid-dip or mid-exit leaves the element visible where it was going', async () => {
2844
- // A dip on an owned opacity.
2845
- const dip = reduced();
2846
- dip.animator.set({opacity: 0.8});
2847
- dip.animator.animate({x: 100}, {spring: springs.navigationPush});
2848
- await commitFrame(clock);
2849
- await advance(50);
2850
- dip.animator.dispose();
2851
- expect(dip.element.style.opacity).toBe('0.8');
2852
- expect(dip.element.style.translate).toBe('100px 0px');
2853
- // An exit by role.
2854
- const exit = reduced();
2855
- exit.animator.animate(
2856
- {x: 100},
2857
- {spring: springs.navigationPush},
2858
- {crossfadeAs: 'exit'},
2859
- );
2860
- await commitFrame(clock);
2861
- await advance(50);
2862
- exit.animator.dispose();
2863
- expect(['', '1']).toContain(exit.element.style.opacity);
2864
- expect(exit.element.style.translate).toBe('100px 0px');
2865
- });
2866
-
2867
- it('an unmount mid-dip leaves no compositing promotion on the element it leaves', async () => {
2868
- const {animator, element} = reduced();
2869
- animator.decay(coast(animator, {y: 1500}));
2870
- animator.animate({x: 100}, {spring: springs.navigationPush});
2871
- await commitFrame(clock);
2872
- await advance(20);
2873
- animator.attach(null);
2874
- // The unmount is deferred to a microtask: read once it has run.
2875
- await Promise.resolve();
2876
- expect(element.style.willChange).toBe('');
2877
- expect(vi.getTimerCount()).toBe(0);
2878
- });
2879
-
2880
- it("a new element taking over an exit by role leaves the stylesheet's opacity on the outgoing one", async () => {
2881
- const {animator, element} = reduced();
2882
- stylesheet = {opacity: '0.6'};
2883
- animator.animate(
2884
- {x: 100},
2885
- {spring: springs.navigationPush},
2886
- {crossfadeAs: 'exit'},
2887
- );
2888
- await commitFrame(clock);
2889
- await advance(50);
2890
- animator.attach(document.createElement('div'));
2891
- expect(element.style.opacity).toBe('');
2892
- });
2893
-
2894
- it('an unmount mid-dip lands the move where it was going, so a later attach shows it visible there', async () => {
2895
- const {animator, element} = reduced();
2896
- animator.set({opacity: 0.8});
2897
- const handle = animator.animate({x: 100}, {spring: springs.navigationPush});
2898
- await commitFrame(clock);
2899
- await advance(50);
2900
- animator.attach(null);
2901
- await Promise.resolve(); // the end of the task: an unmount
2902
- await expect(handle.finished).resolves.toBe(false);
2903
- await advance(fade);
2904
- animator.attach(element);
2905
- expect(animator.get('x')).toBe(100);
2906
- expect(animator.get('opacity')).toBeCloseTo(0.8, 9);
2907
- expect(element.style.opacity).toBe('0.8');
2908
- expect(element.style.translate).toBe('100px 0px');
2909
- });
2910
-
2911
- it("a pseudo-element's dip borrows its own opacity and hands it back without touching the host", async () => {
2912
- for (const role of [undefined, 'exit'] as const) {
2913
- const {animator, element} = setup({
2914
- reduced: true,
2915
- coarse: true,
2916
- pseudoElement: '::before',
2917
- });
2918
- element.style.opacity = '0.5'; // the host's own, untouched
2919
- pseudoStylesheet = {opacity: '0.3'};
2920
- animator.animate(
2921
- {x: 100},
2922
- {spring: springs.navigationPush},
2923
- role == null ? {} : {crossfadeAs: role},
2924
- );
2925
- await commitFrame(clock);
2926
- const [fadeLayer] = live('opacity');
2927
- const values = fadeLayer.keyframes.map(k => Number(k.opacity));
2928
- expect(Math.max(...values)).toBeCloseTo(0.3, 9);
2929
- await advance(fade * 2 + END_HOLD_MS + 1);
2930
- expect(animator.get('x')).toBe(100);
2931
- // The pseudo-element's stylesheet owns its opacity again; the host
2932
- // keeps its own.
2933
- expect(live('opacity')).toEqual([]);
2934
- expect(element.style.opacity).toBe('0.5');
2935
- }
2936
- });
2937
-
2938
- it("a pseudo-element's identity hold follows a node replacement", () => {
2939
- const {animator, element} = setup({pseudoElement: '::backdrop'});
2940
- pseudoStylesheet = {opacity: '0'};
2941
- animator.set({opacity: 1});
2942
- animator.attach(null);
2943
- const next = document.createElement('div');
2944
- document.body.append(next);
2945
- animator.attach(next);
2946
- const held = live('opacity').filter(
2947
- animation => animation.element === next,
2948
- );
2949
- expect(held).toHaveLength(1);
2950
- expect(Number(held[0].keyframes.at(-1)!.opacity)).toBe(1);
2951
- expect(live('opacity').some(a => a.element === element)).toBe(false);
2952
- next.remove();
2953
- });
2954
-
2955
- it('a pseudo-element shown over a hiding stylesheet keeps its own opacity through a move', async () => {
2956
- for (const role of [undefined, 'entrance'] as const) {
2957
- const {animator} = setup({
2958
- reduced: true,
2959
- coarse: true,
2960
- pseudoElement: '::backdrop',
2961
- });
2962
- pseudoStylesheet = {opacity: '0'};
2963
- animator.set({opacity: 1});
2964
- animator.animate(
2965
- {x: 100},
2966
- {spring: springs.navigationPush},
2967
- role == null ? {} : {crossfadeAs: role},
2968
- );
2969
- await commitFrame(clock);
2970
- for (let step = 0; step < 8; step++) {
2971
- await advance(fade / 4);
2972
- }
2973
- expect(animator.get('x')).toBe(100);
2974
- expect(animator.get('opacity')).toBe(1);
2975
- const [held] = live('opacity');
2976
- expect(Number(held.keyframes.at(-1)?.opacity)).toBe(1);
2977
- }
2978
- });
2979
-
2980
- it('a move dips: fades out, lands while transparent, fades back in', async () => {
2981
- const {animator, element} = reduced();
2982
- animator.animate({x: 100}, {spring: springs.navigationPush});
2983
- await commitFrame(clock); // the browser starts it
2984
- // Fading out in place.
2985
- expect(animator.get('x')).toBe(0);
2986
- expect(animator.get('opacity', 1000 + fade / 4)).toBeCloseTo(
2987
- 1 - ease(0.5),
2988
- 9,
2989
- );
2990
- expect(live('translate')).toHaveLength(0);
2991
- await advance(fade / 2);
2992
- // Landed with a plain write at the bottom, and fading back in from there.
2993
- expect(animator.get('x')).toBe(100);
2994
- expect(element.style.translate).toBe('100px 0px');
2995
- expect(animator.get('opacity')).toBeCloseTo(0, 9);
2996
- expect(animator.get('opacity', clock + fade / 4)).toBeCloseTo(ease(0.5), 9);
2997
- expect(live('translate')).toHaveLength(0);
2998
- expect(opacityOnly()).toBe(true);
2999
- });
3000
-
3001
- it('a landing a busy main thread runs late still ends the dip on time', async () => {
3002
- const {animator} = reduced();
3003
- animator.animate({x: 100}, {spring: springs.navigationPush});
3004
- await commitFrame(1000);
3005
- // The task that lands it runs 80 ms late (the page's clock is ahead
3006
- // of the timer when it fires).
3007
- clock += fade / 2 + 80;
3008
- await vi.advanceTimersByTimeAsync(fade / 2);
3009
- // Landed while transparent, never shown in the wrong place.
3010
- expect(animator.get('x')).toBe(100);
3011
- expect(animator.get('opacity')).toBeCloseTo(0, 9);
3012
- // The fade back in takes what is left: the dip ends when it was due.
3013
- expect(animator.get('opacity', 1000 + fade)).toBe(1);
3014
- expect(opacityOnly()).toBe(true);
3015
- });
3016
-
3017
- it('a busy main thread keeps the element transparent longer, never in the wrong place', async () => {
3018
- const {animator} = reduced();
3019
- const handle = animator.animate({x: 100}, {spring: springs.navigationPush});
3020
- await commitFrame(1000);
3021
- // The task that would land it runs 300 ms late.
3022
- clock += fade / 2 + 300;
3023
- expect(animator.get('x')).toBe(0);
3024
- expect(animator.get('opacity')).toBe(0);
3025
- await vi.advanceTimersByTimeAsync(fade / 2 + 300);
3026
- expect(animator.get('x')).toBe(100);
3027
- let finished: boolean | null = null;
3028
- void handle.finished.then(value => {
3029
- finished = value;
3030
- });
3031
- await advance(fade);
3032
- expect(animator.get('opacity')).toBe(1);
3033
- expect(finished).toBe(true);
3034
- });
3035
-
3036
- it('two calls in one frame both land', async () => {
3037
- // A drag cancel: the position on one spring, the scale on another.
3038
- const {animator, element} = reduced();
3039
- animator.set({x: 6.3, y: 84, scale: 0.969});
3040
- const position = animator.animate(
3041
- {x: 0, y: 0},
3042
- {spring: springs.sheetPresent},
3043
- {touchRelease: true},
3044
- );
3045
- const scale = animator.animate(
3046
- {scale: 1},
3047
- {spring: springs.quickChange},
3048
- {touchRelease: true},
3049
- );
3050
- const settled: boolean[] = [];
3051
- void position.finished.then(value => settled.push(value));
3052
- void scale.finished.then(value => settled.push(value));
3053
- await commitFrame(clock);
3054
- // Both land at the bottom of one dip, then fade back in together.
3055
- await advance(fade / 2);
3056
- expect(animator.get('x')).toBe(0);
3057
- expect(animator.get('scaleX')).toBe(1);
3058
- expect(animator.get('opacity')).toBeCloseTo(0, 9);
3059
- await advance(fade);
3060
- expect(animator.get('x')).toBe(0);
3061
- expect(animator.get('y')).toBe(0);
3062
- expect(animator.get('scaleX')).toBe(1);
3063
- expect(animator.get('opacity')).toBe(1);
3064
- // Back at identity with nothing running: the inline value is gone.
3065
- expect(element.style.translate).toBe('');
3066
- expect(settled).toEqual([true, true]);
3067
- expect(opacityOnly()).toBe(true);
3068
- });
3069
-
3070
- it('a move during a dip\u2019s fade out dips once more and ends visible', async () => {
3071
- const {animator} = reduced();
3072
- animator.animate({y: 100}, {spring: springs.sheetPresent});
3073
- await commitFrame(clock);
3074
- // Half-way down the first dip's fade out, a frame or more later.
3075
- await advance(fade / 4);
3076
- animator.animate({y: 120}, {spring: springs.sheetPresent});
3077
- await commitFrame(clock);
3078
- await advance(fade / 2);
3079
- await advance(fade);
3080
- expect(animator.get('y')).toBe(120);
3081
- expect(animator.get('opacity')).toBe(1);
3082
- });
3083
-
3084
- it('a drop, its reorder\u2019s rebase and the move to the new slot in one task dip once', async () => {
3085
- // A list row's drop under Reduce Motion: the drop from where the finger
3086
- // left it, then the reorder's commit (the layout moved the row by 56 px)
3087
- // and the move to its new slot, in one task on one clock.
3088
- const {animator} = reduced();
3089
- animator.set({y: 30});
3090
- const at = clock;
3091
- animator.animate(
3092
- {y: 0},
3093
- {spring: springs.settle, velocity: {y: 0}},
3094
- {at, touchRelease: true},
3095
- );
3096
- // The commit comes a few ms later, once the first fade has begun.
3097
- clock += 8;
3098
- const at2 = clock;
3099
- animator.rebase({y: 56}, {at: at2});
3100
- animator.animate(
3101
- {y: 0},
3102
- {spring: springs.settle},
3103
- {at: at2, touchRelease: true},
3104
- );
3105
- await commitFrame(clock);
3106
- // It never moves while visible, and fades all the way out once.
3107
- let lowest = 1;
3108
- for (let t = 0; t <= fade / 2; t += 10) {
3109
- const opacity = animator.get('opacity', at2 + t);
3110
- lowest = Math.min(lowest, opacity);
3111
- if (opacity > 0.01) {
3112
- expect(animator.get('y', at2 + t)).toBe(86);
3113
- }
3114
- }
3115
- expect(lowest).toBeLessThanOrEqual(0.1);
3116
- await advance(fade / 2);
3117
- expect(animator.get('y')).toBe(0);
3118
- await advance(fade);
3119
- expect(animator.get('y')).toBe(0);
3120
- expect(animator.get('opacity')).toBe(1);
3121
- });
3122
-
3123
- it('a later opacity change carries a waiting move to its own invisible moment instead of dropping it', async () => {
3124
- const {animator} = reduced();
3125
- const move = animator.animate({x: 100}, {spring: springs.navigationPush});
3126
- await commitFrame(clock);
3127
- animator.animate({opacity: 0.5}, {spring: springs.settle});
3128
- // Not while the element shows: at the bottom of the new call's dip.
3129
- expect(animator.get('x')).toBe(0);
3130
- const start = clock;
3131
- let landedAt: number | null = null;
3132
- while (clock <= start + fade * 2) {
3133
- await advance(2);
3134
- if (landedAt == null && animator.get('x') !== 0) {
3135
- landedAt = animator.get('opacity');
3136
- }
3137
- }
3138
- expect(landedAt).not.toBeNull();
3139
- expect(landedAt as number).toBeLessThan(0.05);
3140
- expect(animator.get('x')).toBe(100);
3141
- expect(animator.get('opacity')).toBeCloseTo(0.5, 9);
3142
- await expect(move.finished).resolves.toBe(true);
3143
- });
3144
-
3145
- it('a move whose opacity rises from or falls to a visible value lands only while transparent (DR1, DR2)', async () => {
3146
- for (const [from, to] of [
3147
- [0.5, 1],
3148
- [1, 0.5],
3149
- ] as const) {
3150
- const {animator} = reduced();
3151
- animator.set({opacity: from});
3152
- animator.animate({x: 100, opacity: to}, {spring: springs.navigationPush});
3153
- expect(animator.get('x')).toBe(0);
3154
- const start = clock;
3155
- let landedAt: number | null = null;
3156
- while (clock <= start + fade * 2) {
3157
- await advance(2);
3158
- if (landedAt == null && animator.get('x') !== 0) {
3159
- landedAt = animator.get('opacity');
3160
- }
3161
- }
3162
- expect(landedAt).not.toBeNull();
3163
- expect(landedAt as number).toBeLessThan(0.05);
3164
- expect(animator.get('x')).toBe(100);
3165
- expect(animator.get('opacity')).toBeCloseTo(to, 9);
3166
- }
3167
- });
3168
-
3169
- it('an entrance lands in place and fades in', async () => {
3170
- const {animator} = reduced();
3171
- animator.set({y: 400, opacity: 0});
3172
- animator.animate({y: 0, opacity: 1}, {spring: springs.sheetPresent});
3173
- await commitFrame(clock); // the browser starts it
3174
- expect(animator.get('y')).toBe(0);
3175
- expect(live('translate')).toHaveLength(0);
3176
- expect(animator.get('opacity', 1000 + fade / 2)).toBeCloseTo(ease(0.5), 9);
3177
- expect(Number(live('opacity')[0].options.duration)).toBeCloseTo(
3178
- fade + END_HOLD_MS,
3179
- 6,
3180
- );
3181
- });
3182
-
3183
- it('an exit fades out in place, then lands', async () => {
3184
- const {animator} = reduced();
3185
- animator.animate({y: 400, opacity: 0}, {spring: springs.sheetDismiss});
3186
- await commitFrame(clock); // the browser starts it
3187
- expect(animator.get('opacity', 1000 + fade / 2)).toBeCloseTo(
3188
- 1 - ease(0.5),
3189
- 9,
3190
- );
3191
- await advance(fade - 1);
3192
- expect(animator.get('y')).toBe(0);
3193
- await advance(1);
3194
- expect(animator.get('y')).toBe(400);
3195
- expect(animator.get('opacity')).toBe(0);
3196
- expect(opacityOnly()).toBe(true);
3197
- });
3198
-
3199
- it('an opacity change on a spring becomes the timed fade, never the spring', async () => {
3200
- const {animator} = reduced();
3201
- animator.animate({opacity: 0}, {spring: springs.alertDismiss});
3202
- await commitFrame(clock); // the browser starts it
3203
- expect(animator.get('opacity', 1000 + fade / 2)).toBeCloseTo(
3204
- 1 - ease(0.5),
3205
- 9,
3206
- );
3207
- expect(animator.get('opacity', 1000 + fade)).toBe(0);
3208
- expect(Number(live('opacity')[0].options.duration)).toBeCloseTo(
3209
- fade + END_HOLD_MS,
3210
- 6,
3211
- );
3212
- });
3213
-
3214
- it('a played curve, opacity alone included, becomes the timed fade', async () => {
3215
- const {animator} = reduced();
3216
- // A long dim that would follow a sheet's spring.
3217
- animator.play({
3218
- opacity: {duration: 0.6, at: t => 1 - t / 0.6, velocity: () => -1 / 0.6},
3219
- });
3220
- await commitFrame(clock); // the browser starts it
3221
- expect(animator.get('opacity', 1000 + fade)).toBe(0);
3222
- expect(Number(live('opacity')[0].options.duration)).toBeCloseTo(
3223
- fade + END_HOLD_MS,
3224
- 6,
3225
- );
3226
- });
3227
-
3228
- it('a slide without opacity takes its direction from crossfadeAs', async () => {
3229
- const entrance = reduced().animator;
3230
- entrance.set({x: 300});
3231
- entrance.animate(
3232
- {x: 0},
3233
- {spring: springs.navigationPush},
3234
- {crossfadeAs: 'entrance'},
3235
- );
3236
- await commitFrame(clock); // the browser starts it
3237
- expect(entrance.get('x', 1000)).toBe(0);
3238
- expect(entrance.get('opacity', 1000)).toBe(0);
3239
- expect(entrance.get('opacity', 1000 + fade / 2)).toBeCloseTo(ease(0.5), 9);
3240
- expect(entrance.get('opacity', 1000 + fade)).toBe(1);
3241
-
3242
- const exit = reduced().animator;
3243
- exit.animate(
3244
- {y: 800},
3245
- {spring: springs.sheetDismiss},
3246
- {crossfadeAs: 'exit'},
3247
- );
3248
- await commitFrame(clock); // the browser starts it
3249
- expect(exit.get('opacity', clock + fade / 2)).toBeCloseTo(1 - ease(0.5), 9);
3250
- await advance(fade);
3251
- // Lands, and the opacity returns to its value, in one plain write.
3252
- expect(exit.get('y')).toBe(800);
3253
- expect(exit.get('opacity')).toBe(1);
3254
- });
3255
-
3256
- it('a later call before the landing takes the property over', async () => {
3257
- const {animator} = reduced();
3258
- animator.animate({x: 100}, {spring: springs.navigationPush});
3259
- await advance(fade / 4);
3260
- animator.set({x: 40});
3261
- await advance(fade);
3262
- expect(animator.get('x')).toBe(40);
3263
- });
3264
-
3265
- it('completes at once on a fine pointer, opacity included', () => {
3266
- const {animator} = reduced(false);
3267
- animator.animate({x: 100, opacity: 0.5}, {spring: springs.navigationPush});
3268
- animator.play({
3269
- y: {duration: 0.4, at: t => 100 * t, velocity: () => 100},
3270
- });
3271
- expect(recorded).toHaveLength(0);
3272
- expect(animator.get('x')).toBe(100);
3273
- expect(animator.get('opacity')).toBe(0.5);
3274
- expect(animator.get('y')).toBeCloseTo(40, 9);
3275
- });
3276
-
3277
- it('fades on a fine pointer when a touch release started the call', async () => {
3278
- const {animator} = reduced(false);
3279
- animator.animate(
3280
- {y: 400, opacity: 0},
3281
- {spring: springs.sheetDismiss},
3282
- {touchRelease: true},
3283
- );
3284
- await commitFrame(clock); // the browser starts it
3285
- expect(animator.get('opacity', 1000 + fade / 2)).toBeCloseTo(
3286
- 1 - ease(0.5),
3287
- 9,
3288
- );
3289
- await advance(fade);
3290
- expect(animator.get('y')).toBe(400);
3291
- });
3292
-
3293
- it('no theme lengthens the fade', async () => {
3294
- const {animator, element} = reduced();
3295
- element.style.setProperty(
3296
- '--motion-timing-reduced-motion-cross-fade-ms',
3297
- '900ms',
3298
- );
3299
- document.documentElement.append(element);
3300
- animator.animate({opacity: 0}, {spring: springs.settle});
3301
- await commitFrame(clock); // the browser starts it
3302
- expect(animator.get('opacity', 1000 + fade)).toBe(0);
3303
- element.remove();
3304
- });
3305
-
3306
- it('says what it makes of a call, for feedback with no fade of its own', () => {
3307
- expect(setup().animator.reducedMotion()).toBe('off');
3308
- expect(reduced().animator.reducedMotion()).toBe('crossfade');
3309
- expect(reduced(false).animator.reducedMotion()).toBe('instant');
3310
- expect(reduced(false).animator.reducedMotion({touchRelease: true})).toBe(
3311
- 'crossfade',
3312
- );
3313
- });
3314
-
3315
- it('crossfadeAs changes nothing without Reduced Motion', async () => {
3316
- const {animator} = setup();
3317
- animator.set({y: 800});
3318
- animator.animate(
3319
- {y: 0},
3320
- {spring: springs.sheetPresent},
3321
- {crossfadeAs: 'entrance'},
3322
- );
3323
- await commitFrame(clock); // the browser starts it
3324
- expect(live('opacity')).toHaveLength(0);
3325
- expect(animator.getVelocity('y', 1010)).toBeLessThan(0);
3326
- });
3327
- });
3328
-
3329
- describe('play: any closed-form curve', () => {
3330
- // A press that keeps deepening: the scale's target falls at 0.16 per
3331
- // second and the presentation follows it on a spring.
3332
- const pressSpring = toSpring(springs.contextMenuLift);
3333
- const press = solveSpringTowardRamp(pressSpring, {
3334
- from: 1,
3335
- target: 1,
3336
- slope: -0.16,
3337
- });
3338
- const pressCurve = {
3339
- duration: 0.266,
3340
- at: (t: number) => press.value(t),
3341
- velocity: (t: number) => press.velocity(t),
3342
- };
3343
-
3344
- it('bakes the curve into keyframes and reads it back', async () => {
3345
- const {animator, element} = setup();
3346
- animator.play({scale: pressCurve});
3347
- const [animation] = live('scale');
3348
- await commitFrame(1000);
3349
- expect(animation.startTime).toBe(1000);
3350
- expect(Number(animation.options.duration)).toBeCloseTo(
3351
- 266 + END_HOLD_MS,
3352
- 6,
3353
- );
3354
- // Up to the end: from then on the value rests where the curve ended.
3355
- for (let t = 0; t < 266; t += 0.5) {
3356
- const [sx, sy] = sampleAt(animation, 'scale', 1000 + t);
3357
- expect(Math.abs(sx - press.value(t / 1000))).toBeLessThan(0.001);
3358
- expect(sy).toBe(sx);
3359
- expect(animator.get('scale', 1000 + t)).toBeCloseTo(
3360
- press.value(t / 1000),
3361
- 12,
3362
- );
3363
- expect(animator.getVelocity('scaleY', 1000 + t)).toBeCloseTo(
3364
- press.velocity(t / 1000),
3365
- 12,
3366
- );
3367
- }
3368
- const end = press.value(0.266);
3369
- expect(animator.get('scale', 1266)).toBeCloseTo(end, 12);
3370
- expect(animator.getVelocity('scale', 1266)).toBe(0);
3371
- // Retired, the end is inline.
3372
- await advance(400);
3373
- for (const axis of parse(element.style.scale)) {
3374
- expect(axis).toBeCloseTo(end, 4);
3375
- }
3376
- });
3377
-
3378
- it('finishes true at its end, false when interrupted', async () => {
3379
- const {animator} = setup();
3380
- const done = animator.play({
3381
- x: {duration: 0.2, at: t => 100 * t, velocity: () => 100},
3382
- });
3383
- await advance(250);
3384
- await expect(done.finished).resolves.toBe(true);
3385
- const cut = animator.play({
3386
- x: {duration: 0.2, at: t => 20 + 100 * t, velocity: () => 100},
3387
- });
3388
- await advance(50);
3389
- animator.set({x: 0});
3390
- await expect(cut.finished).resolves.toBe(false);
3391
- });
3392
-
3393
- it('a later animate starts from the played value and velocity', async () => {
3394
- const {animator} = setup();
3395
- animator.play({scale: pressCurve});
3396
- await advance(120);
3397
- const value = animator.get('scale');
3398
- const velocity = animator.getVelocity('scale');
3399
- expect(value).toBeCloseTo(press.value(0.12), 12);
3400
- animator.animate({scale: 1.06}, {spring: springs.contextMenuLift});
3401
- expect(animator.get('scale')).toBeCloseTo(value, 9);
3402
- expect(animator.getVelocity('scale')).toBeCloseTo(velocity, 9);
3403
- });
3404
-
3405
- it('a zero-length curve puts the value in place', () => {
3406
- const {animator, element} = setup();
3407
- animator.play({opacity: {duration: 0, at: () => 0.4, velocity: () => 0}});
3408
- expect(live('opacity')).toHaveLength(0);
3409
- expect(animator.get('opacity')).toBe(0.4);
3410
- expect(element.style.opacity).toBe('0.4');
3411
- });
3412
-
3413
- it('under Reduced Motion a played travel cross-fades to its end', async () => {
3414
- const reduced = setup({
3415
- reduced: true,
3416
- coarse: true,
3417
- });
3418
- reduced.animator.play({
3419
- x: {duration: 0.3, at: t => 300 * t, velocity: () => 300},
3420
- });
3421
- await commitFrame(clock); // the browser starts it
3422
- const [opacity] = live('opacity');
3423
- expect(opacity).toBeDefined();
3424
- expect(live('translate')).toHaveLength(0);
3425
- await advance(timing.reducedMotionCrossFadeMs);
3426
- expect(reduced.animator.get('x')).toBeCloseTo(90, 9);
3427
- });
3428
-
3429
- it('its handle retargets only with a spring', () => {
3430
- const {animator} = setup();
3431
- const handle = animator.play({
3432
- x: {duration: 0.3, at: t => 300 * t, velocity: () => 300},
3433
- });
3434
- expect(() => handle.retarget({x: 0})).toThrow(/spring/);
3435
- handle.retarget({x: 0}, {spring: springs.settle});
3436
- expect(animator.getVelocity('x')).toBeCloseTo(300, 9);
3437
- });
3438
-
3439
- it('lets an explicit axis win over scale, in either order', () => {
3440
- const {animator} = setup();
3441
- const flat = (value: number) => ({
3442
- duration: 0,
3443
- at: () => value,
3444
- velocity: () => 0,
3445
- });
3446
- animator.play({scaleY: flat(0.5), scale: flat(2)});
3447
- expect(animator.get('scaleX')).toBe(2);
3448
- expect(animator.get('scaleY')).toBe(0.5);
3449
- animator.play({scale: flat(3), scaleX: flat(0.25)});
3450
- expect(animator.get('scaleX')).toBe(0.25);
3451
- expect(animator.get('scaleY')).toBe(3);
3452
- });
3453
-
3454
- it('rejects a curve without a finite duration', () => {
3455
- const {animator} = setup();
3456
- expect(() =>
3457
- animator.play({
3458
- x: {duration: Number.POSITIVE_INFINITY, at: () => 0, velocity: () => 0},
3459
- }),
3460
- ).toThrow(RangeError);
3461
- });
3462
- });
3463
-
3464
- describe('decay: momentum curves (a coast)', () => {
3465
- it('plays a coast and comes to rest where it projects', async () => {
3466
- const {animator} = setup();
3467
- animator.decay(coast(animator, {y: -2400}));
3468
- await commitFrame(clock); // the browser starts it
3469
- const glide = solveDecay({from: 0, velocity: -2400});
3470
- for (const t of [0, 16, 100, 400, 1200]) {
3471
- expect(animator.get('y', 1000 + t)).toBeCloseTo(glide.value(t / 1000), 9);
3472
- }
3473
- const [animation] = live('translate');
3474
- for (let t = 0; t < 1500; t += 3) {
3475
- expect(
3476
- Math.abs(
3477
- sampleAt(animation, 'translate', 1000 + t)[1] - glide.value(t / 1000),
3478
- ),
3479
- ).toBeLessThan(0.26);
3480
- }
3481
- expect(animator.get('y', 1e7)).toBeCloseTo(glide.rest, 9);
3482
- });
3483
-
3484
- it('a coast that reaches an edge hands its velocity to the edge spring', async () => {
3485
- const {animator} = setup();
3486
- animator.set({y: -100});
3487
- animator.decay(
3488
- coast(animator, {y: 3000}, {bounds: {y: {min: -2000, max: 0}}}),
3489
- );
3490
- await commitFrame(clock); // the browser starts it
3491
- const glide = solveDecay({from: -100, velocity: 3000});
3492
- const contact = 1000 + (glide.timeToReach(0) as number) * 1000;
3493
- expect(animator.get('y', contact)).toBeCloseTo(0, 6);
3494
- expect(animator.getVelocity('y', contact - 1e-6)).toBeCloseTo(
3495
- animator.getVelocity('y', contact + 1e-6),
3496
- 2,
3497
- );
3498
- // It overshoots past the edge, then comes back to it.
3499
- expect(animator.get('y', contact + 60)).toBeGreaterThan(0);
3500
- expect(animator.get('y', 1e7)).toBe(0);
3501
- });
3502
-
3503
- it('a release past an edge springs straight back with the release velocity', async () => {
3504
- const {animator} = setup();
3505
- animator.set({x: 60});
3506
- animator.decay(
3507
- coast(animator, {x: 400}, {bounds: {x: {min: -500, max: 0}}}),
3508
- );
3509
- await commitFrame(clock); // the browser starts it
3510
- expect(animator.getVelocity('x')).toBeCloseTo(400, 6);
3511
- const curve = solveSpring(toSpring(scroll.bounce), {
3512
- from: 60,
3513
- to: 0,
3514
- velocity: 400,
3515
- });
3516
- expect(animator.get('x', 1100)).toBeCloseTo(curve.value(0.1), 9);
3517
- });
3518
-
3519
- it('a coast continues a running spring from its presentation value', async () => {
3520
- const {animator} = setup();
3521
- animator.animate({x: 300}, {spring: springs.settle});
3522
- await commitFrame(clock); // the browser starts it
3523
- clock += 80;
3524
- const from = animator.get('x');
3525
- expect(from).toBeGreaterThan(0);
3526
- animator.decay(coast(animator, {x: 900}));
3527
- await commitFrame(clock);
3528
- expect(animator.get('x', clock)).toBeCloseTo(from, 9);
3529
- expect(animator.getVelocity('x', clock)).toBeCloseTo(900, 6);
3530
- });
3531
-
3532
- it('plays any curve as given, and a zero-length one rests at its value', async () => {
3533
- const {animator} = setup();
3534
- const linear = {
3535
- duration: 0.5,
3536
- at: (t: number) => 200 * t,
3537
- velocity: () => 200,
3538
- };
3539
- animator.decay({
3540
- x: linear,
3541
- y: {duration: 0, at: () => 5, velocity: () => 0},
3542
- });
3543
- await commitFrame(clock); // the browser starts it
3544
- expect(animator.get('x', 1250)).toBeCloseTo(50, 9);
3545
- expect(animator.get('x', 1e7)).toBeCloseTo(100, 9);
3546
- expect(animator.get('y')).toBe(5);
3547
- });
3548
-
3549
- it('keeps moving under Reduced Motion: momentum continues the throw (DEC-2)', async () => {
3550
- const {animator, element} = setup({reduced: true});
3551
- animator.decay(coast(animator, {x: 1000}));
3552
- await commitFrame(clock); // the browser starts it
3553
- expect(animator.getVelocity('x', 1016)).toBeGreaterThan(900);
3554
- // No cross-fade: the coast moves the element and leaves opacity alone.
3555
- expect(live('translate')).toHaveLength(1);
3556
- expect(live('opacity')).toHaveLength(0);
3557
- expect(element.style.opacity).toBe('');
3558
- });
3559
-
3560
- it('ships the Reduce Motion fade, not the rest of the timing table', () => {
3561
- // Bundled for a page, the animator and reducedMotionFade() read two
3562
- // timing values; the table's other rows stay out
3563
- // (architecture:component-style-authoring INV6).
3564
- // esbuild runs in its own process: it needs a native TextEncoder.
3565
- const script = [
3566
- "import {build} from 'esbuild';",
3567
- 'const result = await build({',
3568
- ` entryPoints: ${JSON.stringify(['animator.ts', 'reducedMotion.ts'].map(file => path.resolve(__dirname, file)))},`,
3569
- ' outdir: "out",',
3570
- " bundle: true, write: false, format: 'esm', logLevel: 'silent',",
3571
- '});',
3572
- 'process.stdout.write(result.outputFiles.map(file => file.text).join("\\n"));',
3573
- ].join('\n');
3574
- const bundle = execFileSync(
3575
- process.execPath,
3576
- ['--input-type=module', '-e', script],
3577
- {cwd: path.resolve(__dirname, '../../../..'), encoding: 'utf8'},
3578
- );
3579
- expect(bundle).toContain('durationMs');
3580
- for (const row of [
3581
- 'stateChangeMs',
3582
- 'highlightOutMs',
3583
- 'navigationBarHideShowMs',
3584
- ]) {
3585
- expect(bundle).not.toContain(row);
3586
- }
3587
- });
3588
-
3589
- it('imports neither the coast math nor the scroll table', () => {
3590
- // Only a surface that coasts pays for them (coast.ts).
3591
- const source = fs.readFileSync(
3592
- path.resolve(__dirname, 'animator.ts'),
3593
- 'utf8',
3594
- );
3595
- expect(source).not.toMatch(/from '\.\/decay'/);
3596
- expect(source).not.toMatch(/from '\.\/uikit\/scroll'/);
3597
- });
3598
- });
3599
-
3600
- describe('pseudoElement: a dialog\u2019s ::backdrop', () => {
3601
- it('targets the pseudo-element, writes no inline style and holds the end state', async () => {
3602
- const {animator, element} = setup({pseudoElement: '::backdrop'});
3603
- animator.set({opacity: 0});
3604
- const [held] = live('opacity');
3605
- expect(held.options).toMatchObject({
3606
- fill: 'both',
3607
- pseudoElement: '::backdrop',
3608
- });
3609
- expect(held.keyframes.map(k => k.opacity)).toEqual(['0', '0']);
3610
- expect(element.style.opacity).toBe('');
3611
-
3612
- animator.animate({opacity: 1}, {spring: springs.alertPresent});
3613
- // The new animation exists before the hold goes: no frame in between.
3614
- expect(held.cancelled).toBe(true);
3615
- const [fade] = live('opacity');
3616
- expect(fade.options).toMatchObject({
3617
- fill: 'both',
3618
- pseudoElement: '::backdrop',
3619
- });
3620
- expect(fade.keyframes[fade.keyframes.length - 1].opacity).toBe('1');
3621
- expect(element.style.opacity).toBe('');
3622
- await advance(Number(fade.options.duration) + 1000);
3623
- // Past the curve's end, a static animation holds the end value.
3624
- expect(fade.cancelled).toBe(true);
3625
- const [rest] = live('opacity');
3626
- expect(rest.options).toMatchObject({
3627
- fill: 'both',
3628
- pseudoElement: '::backdrop',
3629
- });
3630
- expect(rest.keyframes.map(k => k.opacity)).toEqual(['1', '1']);
3631
- expect(animator.get('opacity')).toBe(1);
3632
- });
3633
-
3634
- it('an exit holds 0 until the next animation replaces it', async () => {
3635
- const {animator} = setup({
3636
- pseudoElement: '::backdrop',
3637
- initial: {opacity: 1},
3638
- });
3639
- animator.animate({opacity: 0}, {spring: springs.alertDismiss});
3640
- const [fade] = live('opacity');
3641
- await advance(Number(fade.options.duration) + 1000);
3642
- const [rest] = live('opacity');
3643
- expect(rest.keyframes.map(k => k.opacity)).toEqual(['0', '0']);
3644
- animator.animate({opacity: 1}, {spring: springs.alertPresent});
3645
- expect(rest.cancelled).toBe(true);
3646
- expect(live('opacity')).toHaveLength(1);
3647
- });
3648
- });
3649
-
3650
- describe('attach', () => {
3651
- it('keeps state without an element and resumes the curve on attach', () => {
3652
- const animator = createAnimator(null, {
3653
- now: () => clock,
3654
- });
3655
- animator.animate({x: 300}, {spring: springs.settle});
3656
- expect(recorded).toHaveLength(0);
3657
- clock += 100;
3658
- const element = document.createElement('div');
3659
- animator.attach(element);
3660
- const [animation] = live('translate');
3661
- expect(animation.startTime).toBe(1100);
3662
- const curve = solveSpring(toSpring(springs.settle), {from: 0, to: 300});
3663
- expect(sampleAt(animation, 'translate', 1100)[0]).toBeCloseTo(
3664
- curve.value(0.1),
3665
- 1,
3666
- );
3667
- // The value on screen, not the end.
3668
- expect(parse(element.style.translate)[0]).toBeCloseTo(curve.value(0.1), 2);
3669
- });
3670
-
3671
- it('unmounting settles a pending atRest() wait and leaves no poll timer', async () => {
3672
- const {animator} = setup();
3673
- animator.animate({x: 300}, {spring: springs.settle});
3674
- const rest = animator.atRest();
3675
- animator.attach(null);
3676
- // Resolves without any timer running (none is advanced here).
3677
- await rest;
3678
- expect(vi.getTimerCount()).toBe(0);
3679
- });
3680
-
3681
- it('unmounting settles every handle as interrupted and leaves no timer', async () => {
3682
- const {animator} = setup();
3683
- const handle = animator.animate({x: 300}, {spring: springs.settle});
3684
- expect(vi.getTimerCount()).toBeGreaterThan(0);
3685
- animator.attach(null);
3686
- // At the end of the task, once no node has replaced it.
3687
- await Promise.resolve();
3688
- expect(vi.getTimerCount()).toBe(0);
3689
- await expect(handle.finished).resolves.toBe(false);
3690
- });
3691
-
3692
- it('a node replacement keeps every handle and atRest() wait: the motion goes on on the new node', async () => {
3693
- const {animator} = setup();
3694
- const handle = animator.animate({x: 300}, {spring: springs.settle});
3695
- let rested = false;
3696
- void animator.atRest().then(() => {
3697
- rested = true;
3698
- });
3699
- let finished: boolean | null = null;
3700
- void handle.finished.then(value => {
3701
- finished = value;
3702
- });
3703
- // React's replacement order: the old node detaches, the new one attaches.
3704
- animator.attach(null);
3705
- animator.attach(document.createElement('div'));
3706
- for (let tick = 0; tick < 5; tick++) {
3707
- await Promise.resolve();
3708
- }
3709
- expect(finished).toBeNull();
3710
- expect(rested).toBe(false);
3711
- await advance(5000);
3712
- expect(finished).toBe(true);
3713
- expect(rested).toBe(true);
3714
- });
3715
-
3716
- it('unmounting settles every atRest() wait, as dispose() does', async () => {
3717
- const {animator} = setup();
3718
- animator.animate({x: 300}, {spring: springs.settle});
3719
- let rested = false;
3720
- void animator.atRest().then(() => {
3721
- rested = true;
3722
- });
3723
- animator.attach(null);
3724
- // Without advancing time: the curve has not ended.
3725
- for (let tick = 0; tick < 5; tick++) {
3726
- await Promise.resolve();
3727
- }
3728
- expect(rested).toBe(true);
3729
- expect(vi.getTimerCount()).toBe(0);
3730
- });
3731
-
3732
- it('detaching cancels the running animations', async () => {
3733
- const {animator} = setup();
3734
- animator.animate({x: 300}, {spring: springs.settle});
3735
- await commitFrame(clock); // the browser starts it
3736
- animator.attach(null);
3737
- expect(recorded.every(a => a.cancelled)).toBe(true);
3738
- expect(animator.get('x', 1050)).toBeGreaterThan(0);
3739
- });
3740
-
3741
- it('writes nothing for channels at identity', () => {
3742
- const element = document.createElement('div');
3743
- createAnimator(element);
3744
- expect(element.getAttribute('style')).toBeNull();
3745
- });
3746
- });