@astryxdesign/core 0.7.8 → 0.7.9-canary.07992bb

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 (403) hide show
  1. package/dist/AppShell/observeMainOverflow.d.ts.map +1 -1
  2. package/dist/AppShell/observeMainOverflow.js +9 -6
  3. package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
  4. package/dist/BottomSheet/BottomSheet.js +5 -0
  5. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  6. package/dist/BottomSheet/BottomSheetPanel.js +40 -8
  7. package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
  8. package/dist/BottomSheet/useSheetGestures.js +61 -21
  9. package/dist/Calendar/Calendar.d.ts +14 -2
  10. package/dist/Calendar/Calendar.d.ts.map +1 -1
  11. package/dist/Calendar/Calendar.js +63 -74
  12. package/dist/Calendar/getInitialFocusDate.d.ts +4 -1
  13. package/dist/Calendar/getInitialFocusDate.d.ts.map +1 -1
  14. package/dist/Calendar/getInitialFocusDate.js +7 -5
  15. package/dist/Calendar/hooks/useCalendarDays.d.ts +19 -2
  16. package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
  17. package/dist/Calendar/hooks/useCalendarDays.js +57 -64
  18. package/dist/Calendar/hooks/useCalendarNavigation.d.ts +28 -3
  19. package/dist/Calendar/hooks/useCalendarNavigation.d.ts.map +1 -1
  20. package/dist/Calendar/hooks/useCalendarNavigation.js +33 -22
  21. package/dist/Calendar/styles.d.ts +1 -1
  22. package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
  23. package/dist/CheckboxInput/CheckboxInput.js +54 -11
  24. package/dist/ClickableCard/ClickableCard.d.ts +1 -1
  25. package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
  26. package/dist/ClickableCard/ClickableCard.js +5 -1
  27. package/dist/DateInput/DateInput.d.ts.map +1 -1
  28. package/dist/DateInput/DateInput.js +4 -1
  29. package/dist/DateInput/PickerWheel.d.ts.map +1 -1
  30. package/dist/DateInput/PickerWheel.js +7 -1
  31. package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
  32. package/dist/DateRangeInput/DateRangeInput.js +5 -2
  33. package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
  34. package/dist/DateTimeInput/DateTimeInput.js +4 -1
  35. package/dist/Dialog/Dialog.d.ts +2 -1
  36. package/dist/Dialog/Dialog.d.ts.map +1 -1
  37. package/dist/Dialog/Dialog.js +12 -1
  38. package/dist/Drawer/useDrawerDialogPresence.d.ts +2 -1
  39. package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
  40. package/dist/Drawer/useDrawerDialogPresence.js +11 -2
  41. package/dist/DropdownMenu/DropdownMenu.d.ts +9 -1
  42. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  43. package/dist/DropdownMenu/DropdownMenu.js +9 -4
  44. package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
  45. package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +3 -2
  46. package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
  47. package/dist/DropdownMenu/DropdownMenuItem.js +3 -2
  48. package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
  49. package/dist/DropdownMenu/DropdownMenuRadioItem.js +3 -2
  50. package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
  51. package/dist/DropdownMenu/DropdownMenuSubMenu.js +3 -2
  52. package/dist/Field/inputDisabledFocus.d.ts +4 -4
  53. package/dist/Field/inputStyles.stylex.d.ts +1 -1
  54. package/dist/FileInput/FileInput.d.ts.map +1 -1
  55. package/dist/FileInput/FileInput.js +16 -2
  56. package/dist/HoverCard/useHoverCard.d.ts +3 -1
  57. package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
  58. package/dist/Icon/Icon.d.ts +1 -1
  59. package/dist/InfoTip/InfoTip.d.ts +1 -0
  60. package/dist/InfoTip/InfoTip.d.ts.map +1 -1
  61. package/dist/InfoTip/InfoTip.js +1 -0
  62. package/dist/InputGroup/InputGroup.d.ts +4 -3
  63. package/dist/InputGroup/InputGroup.d.ts.map +1 -1
  64. package/dist/InputGroup/InputGroup.js +2 -2
  65. package/dist/InputGroup/groupStyles.d.ts +1 -1
  66. package/dist/InputGroup/groupStyles.d.ts.map +1 -1
  67. package/dist/InputGroup/groupStyles.js +1 -1
  68. package/dist/Item/Item.d.ts +2 -1
  69. package/dist/Item/Item.d.ts.map +1 -1
  70. package/dist/Item/Item.js +29 -6
  71. package/dist/Layer/holdEntranceInput.d.ts +24 -0
  72. package/dist/Layer/holdEntranceInput.d.ts.map +1 -0
  73. package/dist/Layer/holdEntranceInput.js +65 -0
  74. package/dist/Layer/inputHold.d.ts +49 -0
  75. package/dist/Layer/inputHold.d.ts.map +1 -0
  76. package/dist/Layer/inputHold.js +636 -0
  77. package/dist/Layer/preserveAnimations.d.ts +1 -5
  78. package/dist/Layer/preserveAnimations.d.ts.map +1 -1
  79. package/dist/Layer/preserveAnimations.js +12 -214
  80. package/dist/Layer/useLayer.d.ts +3 -1
  81. package/dist/Layer/useLayer.d.ts.map +1 -1
  82. package/dist/Layer/useLayer.js +64 -4
  83. package/dist/Layout/LayoutContent.d.ts +3 -1
  84. package/dist/Layout/LayoutContent.d.ts.map +1 -1
  85. package/dist/Layout/LayoutContent.js +12 -4
  86. package/dist/Layout/LayoutPanel.d.ts +4 -1
  87. package/dist/Layout/LayoutPanel.d.ts.map +1 -1
  88. package/dist/Layout/LayoutPanel.js +13 -4
  89. package/dist/Lightbox/Lightbox.d.ts.map +1 -1
  90. package/dist/Lightbox/Lightbox.js +4 -0
  91. package/dist/MetadataList/MetadataList.js +1 -1
  92. package/dist/MobileNav/MobileNav.d.ts +11 -1
  93. package/dist/MobileNav/MobileNav.d.ts.map +1 -1
  94. package/dist/MobileNav/MobileNav.js +39 -1
  95. package/dist/MoreMenu/MoreMenu.d.ts +5 -3
  96. package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
  97. package/dist/NumberInput/NumberInput.d.ts +4 -2
  98. package/dist/NumberInput/NumberInput.d.ts.map +1 -1
  99. package/dist/NumberInput/NumberInput.js +244 -11
  100. package/dist/Popover/usePopover.d.ts +1 -0
  101. package/dist/Popover/usePopover.d.ts.map +1 -1
  102. package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
  103. package/dist/PowerSearch/PowerSearch.js +12 -5
  104. package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -1
  105. package/dist/PowerSearch/PowerSearchBottomSheet.js +4 -2
  106. package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
  107. package/dist/PowerSearch/PowerSearchToken.js +3 -1
  108. package/dist/PowerSearch/formatFilterValue.d.ts +9 -3
  109. package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
  110. package/dist/PowerSearch/formatFilterValue.js +14 -11
  111. package/dist/PowerSearch/formatTokenValue.d.ts +6 -2
  112. package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -1
  113. package/dist/PowerSearch/formatTokenValue.js +6 -3
  114. package/dist/RadioList/RadioListItem.d.ts.map +1 -1
  115. package/dist/RadioList/RadioListItem.js +22 -4
  116. package/dist/SelectableCard/SelectableCard.d.ts +1 -1
  117. package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
  118. package/dist/SelectableCard/SelectableCard.js +5 -1
  119. package/dist/Spinner/Spinner.d.ts.map +1 -1
  120. package/dist/Spinner/Spinner.js +14 -71
  121. package/dist/Spinner/index.d.ts +1 -1
  122. package/dist/Spinner/index.d.ts.map +1 -1
  123. package/dist/Spinner/spinnerRotor.d.ts +28 -0
  124. package/dist/Spinner/spinnerRotor.d.ts.map +1 -0
  125. package/dist/Spinner/spinnerRotor.js +98 -0
  126. package/dist/Stack/StackItem.d.ts +8 -4
  127. package/dist/Stack/StackItem.d.ts.map +1 -1
  128. package/dist/Stack/StackItem.js +17 -4
  129. package/dist/Switch/Switch.d.ts.map +1 -1
  130. package/dist/Switch/Switch.js +13 -10
  131. package/dist/Table/plugins/sortable/useTableSortable.js +1 -1
  132. package/dist/Timestamp/Timestamp.d.ts.map +1 -1
  133. package/dist/Timestamp/Timestamp.js +14 -8
  134. package/dist/Timestamp/formatInstant.d.ts +10 -1
  135. package/dist/Timestamp/formatInstant.d.ts.map +1 -1
  136. package/dist/Timestamp/formatInstant.js +13 -27
  137. package/dist/Timestamp/tooltipEntries.d.ts +5 -3
  138. package/dist/Timestamp/tooltipEntries.d.ts.map +1 -1
  139. package/dist/Timestamp/tooltipEntries.js +6 -4
  140. package/dist/Token/Token.d.ts.map +1 -1
  141. package/dist/Token/Token.js +9 -0
  142. package/dist/Token/TokenLink.d.ts +1 -1
  143. package/dist/Token/TokenLink.d.ts.map +1 -1
  144. package/dist/Token/TokenLink.js +4 -1
  145. package/dist/Tokenizer/Tokenizer.d.ts +14 -10
  146. package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
  147. package/dist/Tokenizer/Tokenizer.js +189 -89
  148. package/dist/Tooltip/useTooltip.d.ts +3 -1
  149. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  150. package/dist/Tooltip/useTooltip.js +162 -59
  151. package/dist/TreeList/TreeListItem.d.ts +2 -1
  152. package/dist/TreeList/TreeListItem.d.ts.map +1 -1
  153. package/dist/TreeList/TreeListItem.js +27 -3
  154. package/dist/astryx.css +45 -18
  155. package/dist/gestures/GestureHost.d.ts +2 -2
  156. package/dist/gestures/GestureHost.d.ts.map +1 -1
  157. package/dist/gestures/GestureHost.js +21 -6
  158. package/dist/gestures/PanGestureRecognizer.d.ts +11 -1
  159. package/dist/gestures/PanGestureRecognizer.d.ts.map +1 -1
  160. package/dist/gestures/PanGestureRecognizer.js +15 -1
  161. package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts +6 -1
  162. package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts.map +1 -1
  163. package/dist/gestures/nativeScroll.d.ts +3 -6
  164. package/dist/gestures/nativeScroll.d.ts.map +1 -1
  165. package/dist/gestures/nativeScroll.js +7 -52
  166. package/dist/gestures/wheelSegmenter.d.ts +68 -1
  167. package/dist/gestures/wheelSegmenter.d.ts.map +1 -1
  168. package/dist/gestures/wheelSegmenter.js +199 -10
  169. package/dist/hooks/StackItemScrollRegion.d.ts +31 -0
  170. package/dist/hooks/StackItemScrollRegion.d.ts.map +1 -0
  171. package/dist/hooks/StackItemScrollRegion.js +40 -0
  172. package/dist/hooks/menuPressGesture.d.ts +133 -21
  173. package/dist/hooks/menuPressGesture.d.ts.map +1 -1
  174. package/dist/hooks/menuPressGesture.js +155 -30
  175. package/dist/hooks/menuPressValues.d.ts +16 -0
  176. package/dist/hooks/menuPressValues.d.ts.map +1 -0
  177. package/dist/hooks/menuPressValues.js +18 -0
  178. package/dist/hooks/useClickableContainer.d.ts +27 -5
  179. package/dist/hooks/useClickableContainer.d.ts.map +1 -1
  180. package/dist/hooks/useClickableContainer.js +41 -5
  181. package/dist/hooks/useFocusTrap.d.ts +10 -0
  182. package/dist/hooks/useFocusTrap.d.ts.map +1 -1
  183. package/dist/hooks/useFocusTrap.js +225 -132
  184. package/dist/hooks/useMenuPress.d.ts +34 -1
  185. package/dist/hooks/useMenuPress.d.ts.map +1 -1
  186. package/dist/hooks/useMenuPress.js +93 -5
  187. package/dist/hooks/usePressFeedback.d.ts +6 -6
  188. package/dist/hooks/usePressFeedback.js +6 -6
  189. package/dist/hooks/useScrollRegionProps.d.ts +35 -0
  190. package/dist/hooks/useScrollRegionProps.d.ts.map +1 -0
  191. package/dist/hooks/useScrollRegionProps.js +51 -0
  192. package/dist/i18n/InternationalizationContext.d.ts +6 -0
  193. package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
  194. package/dist/i18n/InternationalizationProvider.d.ts +21 -3
  195. package/dist/i18n/InternationalizationProvider.d.ts.map +1 -1
  196. package/dist/i18n/InternationalizationProvider.js +8 -3
  197. package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.d.ts +8 -0
  198. package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.d.ts.map +1 -0
  199. package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.js +12 -0
  200. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  201. package/dist/i18n/generated-locales/en.generated.js +1 -0
  202. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  203. package/dist/i18n/generated-locales/pseudo.generated.js +1 -0
  204. package/dist/i18n/index.d.ts +2 -0
  205. package/dist/i18n/index.d.ts.map +1 -1
  206. package/dist/i18n/index.js +1 -0
  207. package/dist/i18n/useCalendarSystem.d.ts +19 -0
  208. package/dist/i18n/useCalendarSystem.d.ts.map +1 -0
  209. package/dist/i18n/useCalendarSystem.js +61 -0
  210. package/dist/internal/spinner-rotor.d.ts +16 -0
  211. package/dist/internal/spinner-rotor.d.ts.map +1 -0
  212. package/dist/internal/spinner-rotor.js +16 -0
  213. package/dist/internal/touch.d.ts +14 -1
  214. package/dist/internal/touch.d.ts.map +1 -1
  215. package/dist/internal/touch.js +20 -2
  216. package/dist/motion/carryAnimations.d.ts +58 -0
  217. package/dist/motion/carryAnimations.d.ts.map +1 -0
  218. package/dist/motion/carryAnimations.js +305 -0
  219. package/dist/motion/transientCopy.d.ts +4 -2
  220. package/dist/motion/transientCopy.d.ts.map +1 -1
  221. package/dist/motion/transientCopy.js +34 -5
  222. package/dist/motion/uikit/gestures.d.ts +41 -0
  223. package/dist/motion/uikit/gestures.d.ts.map +1 -1
  224. package/dist/motion/uikit/gestures.js +25 -0
  225. package/dist/motion/uikit/index.d.ts +1 -1
  226. package/dist/motion/uikit/index.d.ts.map +1 -1
  227. package/dist/motion/uikit/index.js +1 -1
  228. package/dist/motion/uikit/timing.d.ts +14 -10
  229. package/dist/motion/uikit/timing.d.ts.map +1 -1
  230. package/dist/motion/uikit/timing.js +7 -5
  231. package/dist/privateAttributes/menuPressLit.stylex.d.ts +52 -0
  232. package/dist/privateAttributes/menuPressLit.stylex.d.ts.map +1 -0
  233. package/dist/privateAttributes/menuPressLit.stylex.js +99 -0
  234. package/dist/privateAttributes/press.stylex.d.ts +139 -0
  235. package/dist/privateAttributes/press.stylex.d.ts.map +1 -0
  236. package/dist/privateAttributes/press.stylex.js +97 -0
  237. package/dist/theme/themeMotion.d.ts +3 -2
  238. package/dist/theme/themeMotion.d.ts.map +1 -1
  239. package/dist/theme/themeMotion.js +3 -2
  240. package/dist/theme/tokens.stylex.d.ts +2 -2
  241. package/dist/theme/tokens.stylex.js +1 -1
  242. package/dist/utils/calendarSystem.d.ts +114 -0
  243. package/dist/utils/calendarSystem.d.ts.map +1 -0
  244. package/dist/utils/calendarSystem.js +386 -0
  245. package/dist/utils/flatTree.d.ts +6 -3
  246. package/dist/utils/flatTree.d.ts.map +1 -1
  247. package/dist/utils/flatTree.js +13 -3
  248. package/dist/utils/hitArea.d.ts.map +1 -1
  249. package/dist/utils/hitArea.js +82 -5
  250. package/dist/utils/inputStream.d.ts +14 -1
  251. package/dist/utils/inputStream.d.ts.map +1 -1
  252. package/dist/utils/inputStream.js +40 -9
  253. package/dist/utils/interactionOverlay.stylex.d.ts +5 -9
  254. package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
  255. package/dist/utils/interactionOverlay.stylex.js +29 -31
  256. package/dist/utils/plainDate.d.ts +23 -7
  257. package/dist/utils/plainDate.d.ts.map +1 -1
  258. package/dist/utils/plainDate.js +57 -18
  259. package/dist/utils/pressFeedback.d.ts +10 -2
  260. package/dist/utils/pressFeedback.d.ts.map +1 -1
  261. package/dist/utils/pressFeedback.js +40 -15
  262. package/dist/utils/pressGesture.d.ts +12 -6
  263. package/dist/utils/pressGesture.d.ts.map +1 -1
  264. package/dist/utils/pressGesture.js +26 -8
  265. package/dist/utils/scrollView.d.ts +25 -0
  266. package/dist/utils/scrollView.d.ts.map +1 -0
  267. package/dist/utils/scrollView.js +108 -0
  268. package/dist/utils/selectionLock.d.ts.map +1 -1
  269. package/dist/utils/selectionLock.js +1 -10
  270. package/dist/utils/touchHitArea.stylex.d.ts +35 -0
  271. package/dist/utils/touchHitArea.stylex.d.ts.map +1 -0
  272. package/dist/utils/touchHitArea.stylex.js +32 -0
  273. package/dist/utils/triggerFocus.d.ts +5 -0
  274. package/dist/utils/triggerFocus.d.ts.map +1 -1
  275. package/dist/utils/triggerFocus.js +9 -2
  276. package/locales/en.json +4 -0
  277. package/locales/pseudo.json +3 -0
  278. package/package.json +10 -4
  279. package/src/AppShell/observeMainOverflow.ts +9 -6
  280. package/src/BottomSheet/BottomSheet.tsx +5 -0
  281. package/src/BottomSheet/BottomSheetPanel.tsx +64 -7
  282. package/src/BottomSheet/useSheetGestures.ts +83 -20
  283. package/src/Calendar/Calendar.doc.mjs +76 -6
  284. package/src/Calendar/Calendar.tsx +123 -104
  285. package/src/Calendar/getInitialFocusDate.ts +22 -8
  286. package/src/Calendar/hooks/useCalendarDays.ts +89 -63
  287. package/src/Calendar/hooks/useCalendarNavigation.ts +68 -26
  288. package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -2
  289. package/src/CheckboxInput/CheckboxInput.tsx +71 -9
  290. package/src/ClickableCard/ClickableCard.tsx +8 -1
  291. package/src/DateInput/DateInput.tsx +2 -0
  292. package/src/DateInput/PickerWheel.tsx +7 -2
  293. package/src/DateRangeInput/DateRangeInput.tsx +3 -1
  294. package/src/DateTimeInput/DateTimeInput.tsx +2 -0
  295. package/src/Dialog/Dialog.doc.mjs +1 -1
  296. package/src/Dialog/Dialog.tsx +12 -1
  297. package/src/Drawer/Drawer.doc.mjs +1 -1
  298. package/src/Drawer/useDrawerDialogPresence.ts +9 -2
  299. package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -2
  300. package/src/DropdownMenu/DropdownMenu.tsx +29 -5
  301. package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +5 -1
  302. package/src/DropdownMenu/DropdownMenuItem.tsx +8 -4
  303. package/src/DropdownMenu/DropdownMenuRadioItem.tsx +5 -1
  304. package/src/DropdownMenu/DropdownMenuSubMenu.tsx +5 -1
  305. package/src/FileInput/FileInput.tsx +16 -2
  306. package/src/HoverCard/useHoverCard.tsx +3 -1
  307. package/src/InfoTip/InfoTip.doc.mjs +26 -2
  308. package/src/InfoTip/InfoTip.tsx +1 -0
  309. package/src/InputGroup/InputGroup.doc.mjs +4 -3
  310. package/src/InputGroup/InputGroup.tsx +4 -3
  311. package/src/InputGroup/groupStyles.ts +3 -1
  312. package/src/Item/Item.tsx +51 -9
  313. package/src/Layer/holdEntranceInput.ts +84 -0
  314. package/src/Layer/inputHold.ts +734 -0
  315. package/src/Layer/preserveAnimations.ts +12 -275
  316. package/src/Layer/useLayer.tsx +77 -4
  317. package/src/Layout/LayoutContent.doc.mjs +6 -3
  318. package/src/Layout/LayoutContent.tsx +10 -4
  319. package/src/Layout/LayoutPanel.doc.mjs +6 -3
  320. package/src/Layout/LayoutPanel.tsx +11 -4
  321. package/src/Lightbox/Lightbox.tsx +4 -0
  322. package/src/MetadataList/MetadataList.tsx +1 -1
  323. package/src/MobileNav/MobileNav.doc.mjs +3 -3
  324. package/src/MobileNav/MobileNav.tsx +39 -1
  325. package/src/MoreMenu/MoreMenu.doc.mjs +2 -4
  326. package/src/MoreMenu/MoreMenu.tsx +5 -3
  327. package/src/NumberInput/NumberInput.doc.mjs +1 -1
  328. package/src/NumberInput/NumberInput.tsx +259 -11
  329. package/src/Popover/usePopover.tsx +1 -0
  330. package/src/PowerSearch/PowerSearch.doc.mjs +3 -3
  331. package/src/PowerSearch/PowerSearch.tsx +20 -3
  332. package/src/PowerSearch/PowerSearchBottomSheet.tsx +4 -1
  333. package/src/PowerSearch/PowerSearchToken.tsx +3 -0
  334. package/src/PowerSearch/formatFilterValue.ts +21 -11
  335. package/src/PowerSearch/formatTokenValue.ts +7 -1
  336. package/src/RadioList/RadioListItem.doc.mjs +3 -2
  337. package/src/RadioList/RadioListItem.tsx +25 -7
  338. package/src/SelectableCard/SelectableCard.tsx +8 -1
  339. package/src/Spinner/Spinner.tsx +7 -89
  340. package/src/Spinner/index.ts +1 -5
  341. package/src/Spinner/spinnerRotor.ts +113 -0
  342. package/src/Stack/Stack.doc.mjs +1 -1
  343. package/src/Stack/StackItem.tsx +27 -13
  344. package/src/Switch/Switch.tsx +7 -6
  345. package/src/Table/plugins/sortable/useTableSortable.tsx +1 -1
  346. package/src/Timestamp/Timestamp.doc.mjs +3 -3
  347. package/src/Timestamp/Timestamp.tsx +13 -8
  348. package/src/Timestamp/formatInstant.ts +49 -28
  349. package/src/Timestamp/tooltipEntries.ts +7 -3
  350. package/src/Token/Token.tsx +18 -1
  351. package/src/Token/TokenLink.tsx +7 -1
  352. package/src/Tokenizer/Tokenizer.doc.mjs +3 -3
  353. package/src/Tokenizer/Tokenizer.tsx +252 -115
  354. package/src/Tooltip/useTooltip.tsx +178 -80
  355. package/src/TreeList/TreeListItem.tsx +36 -2
  356. package/src/gestures/GestureHost.ts +21 -5
  357. package/src/gestures/PanGestureRecognizer.ts +19 -2
  358. package/src/gestures/README.md +14 -5
  359. package/src/gestures/ScreenEdgePanGestureRecognizer.ts +6 -1
  360. package/src/gestures/nativeScroll.ts +12 -68
  361. package/src/gestures/wheelSegmenter.ts +243 -10
  362. package/src/hooks/StackItemScrollRegion.tsx +57 -0
  363. package/src/hooks/menuPressGesture.ts +244 -38
  364. package/src/hooks/menuPressValues.ts +18 -0
  365. package/src/hooks/useClickableContainer.doc.mjs +8 -2
  366. package/src/hooks/useClickableContainer.ts +72 -6
  367. package/src/hooks/useFocusTrap.ts +268 -151
  368. package/src/hooks/useMenuPress.ts +118 -11
  369. package/src/hooks/usePressFeedback.doc.mjs +3 -3
  370. package/src/hooks/usePressFeedback.ts +6 -6
  371. package/src/hooks/useScrollRegionProps.ts +76 -0
  372. package/src/i18n/InternationalizationContext.ts +6 -0
  373. package/src/i18n/InternationalizationProvider.doc.mjs +29 -1
  374. package/src/i18n/InternationalizationProvider.tsx +33 -3
  375. package/src/i18n/generated-english/hooks/useScrollRegionProps.generated.ts +13 -0
  376. package/src/i18n/generated-locales/en.generated.ts +1 -0
  377. package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
  378. package/src/i18n/index.ts +2 -0
  379. package/src/i18n/useCalendarSystem.ts +95 -0
  380. package/src/internal/spinner-rotor.ts +20 -0
  381. package/src/internal/touch.ts +34 -1
  382. package/src/motion/MEASUREMENTS.md +11 -0
  383. package/src/motion/carryAnimations.ts +389 -0
  384. package/src/motion/transientCopy.ts +45 -5
  385. package/src/motion/uikit/gestures.ts +22 -0
  386. package/src/motion/uikit/index.ts +1 -0
  387. package/src/motion/uikit/timing.ts +7 -5
  388. package/src/privateAttributes/menuPressLit.stylex.ts +104 -0
  389. package/src/privateAttributes/press.stylex.ts +243 -0
  390. package/src/theme/themeMotion.ts +3 -2
  391. package/src/theme/tokens.stylex.ts +1 -1
  392. package/src/utils/calendarSystem.ts +548 -0
  393. package/src/utils/flatTree.ts +15 -3
  394. package/src/utils/hitArea.ts +107 -5
  395. package/src/utils/inputStream.ts +47 -10
  396. package/src/utils/interactionOverlay.stylex.ts +19 -22
  397. package/src/utils/plainDate.ts +84 -19
  398. package/src/utils/pressFeedback.ts +46 -14
  399. package/src/utils/pressGesture.ts +35 -9
  400. package/src/utils/scrollView.ts +135 -0
  401. package/src/utils/selectionLock.ts +5 -10
  402. package/src/utils/touchHitArea.stylex.ts +41 -0
  403. package/src/utils/triggerFocus.ts +17 -4
@@ -0,0 +1,389 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file carryAnimations.ts
5
+ * @input The CSS animations and transitions of an element and its subtree,
6
+ * read before the browser starts them afresh
7
+ * @output Exports `saveAnimations` and `carryAnimations`, which carry them on
8
+ * in a clone of the element. Also `saveAnimation` and `restoreAnimations`,
9
+ * which put them back after a display reset
10
+ * @position Motion foundation; the transient copy (transientCopy.ts) and the
11
+ * layer runtime's re-placement (Layer/preserveAnimations.ts) use it
12
+ */
13
+
14
+ /**
15
+ * Animation members written in a fixed order rather than generically: the
16
+ * timeline before the range that is measured on it, the rate before the
17
+ * time, and the start time (or, for a paused animation, the current time)
18
+ * last, once the play state is set. `effect` is not
19
+ * replaced, because a CSS animation whose effect script replaces leaves the
20
+ * stylesheet's control; its state is copied onto the new effect instead.
21
+ */
22
+ const ORDERED = new Set([
23
+ 'effect',
24
+ 'timeline',
25
+ 'rangeStart',
26
+ 'rangeEnd',
27
+ 'playbackRate',
28
+ 'startTime',
29
+ 'currentTime',
30
+ ]);
31
+
32
+ type Writable = Record<string, unknown>;
33
+
34
+ /** Every accessor with a setter on `object`'s prototype chain. */
35
+ function writableAccessors(object: object): string[] {
36
+ const names = new Set<string>();
37
+ for (
38
+ let proto: object | null = Object.getPrototypeOf(object);
39
+ proto != null && proto !== Object.prototype;
40
+ proto = Object.getPrototypeOf(proto)
41
+ ) {
42
+ for (const [name, descriptor] of Object.entries(
43
+ Object.getOwnPropertyDescriptors(proto),
44
+ )) {
45
+ if (descriptor.set != null) {
46
+ names.add(name);
47
+ }
48
+ }
49
+ }
50
+ return [...names];
51
+ }
52
+
53
+ /**
54
+ * A textual form of a value that is compared by content rather than by
55
+ * identity: a CSS numeric value (as in a timeline range offset) through its
56
+ * serialization, a plain object (a range) through its members. Anything else
57
+ * is compared by identity (`null`).
58
+ */
59
+ function contentOf(value: unknown): string | null {
60
+ if (
61
+ typeof CSSNumericValue !== 'undefined' &&
62
+ value instanceof CSSNumericValue
63
+ ) {
64
+ return value.toString();
65
+ }
66
+ if (
67
+ value != null &&
68
+ typeof value === 'object' &&
69
+ Object.getPrototypeOf(value) === Object.prototype
70
+ ) {
71
+ return Object.entries(value)
72
+ .map(([key, inner]) => `${key}:${contentOf(inner) ?? String(inner)}`)
73
+ .join(';');
74
+ }
75
+ return null;
76
+ }
77
+
78
+ function differs(a: unknown, b: unknown): boolean {
79
+ if (a === b) {
80
+ return false;
81
+ }
82
+ const textA = contentOf(a);
83
+ return textA == null || textA !== contentOf(b);
84
+ }
85
+
86
+ /** One animation's state, read before the browser starts it afresh. */
87
+ export interface SavedAnimation {
88
+ animation: Animation;
89
+ name: string;
90
+ target: Element | null;
91
+ pseudoElement: string | null;
92
+ values: Writable;
93
+ effectValues: Writable;
94
+ timing: EffectTiming | null;
95
+ keyframes: ComputedKeyframe[] | null;
96
+ playState: AnimationPlayState;
97
+ replaceState: AnimationReplaceState;
98
+ }
99
+
100
+ /**
101
+ * Reads one animation's state generically, from what the platform exposes.
102
+ * That is every accessor with a setter on the animation's and its effect's
103
+ * prototype chains, every field of the effect's timing, and its keyframes. Only values
104
+ * that differ from the recreated animation's are written back, so a value the
105
+ * stylesheet controls stays under its control. A few members are not plain
106
+ * state and are written in their own step (`ORDERED`). The Animation and
107
+ * effect objects themselves cannot be carried over: the old ones keep their
108
+ * listeners and promises.
109
+ */
110
+ export function saveAnimation(animation: Animation): SavedAnimation {
111
+ const effect = animation.effect as KeyframeEffect | null;
112
+ const values: Writable = {};
113
+ for (const name of writableAccessors(animation)) {
114
+ values[name] = (animation as unknown as Writable)[name];
115
+ }
116
+ const effectValues: Writable = {};
117
+ if (effect != null) {
118
+ for (const name of writableAccessors(effect)) {
119
+ effectValues[name] = (effect as unknown as Writable)[name];
120
+ }
121
+ }
122
+ return {
123
+ animation,
124
+ name:
125
+ (animation as Animation & {animationName?: string}).animationName ?? '',
126
+ target: effect?.target ?? null,
127
+ pseudoElement: effect?.pseudoElement ?? null,
128
+ values,
129
+ effectValues,
130
+ timing: effect?.getTiming() ?? null,
131
+ keyframes: effect?.getKeyframes() ?? null,
132
+ playState: animation.playState,
133
+ replaceState: animation.replaceState,
134
+ };
135
+ }
136
+
137
+ function write(object: object, name: string, value: unknown): void {
138
+ (object as Writable)[name] = value;
139
+ }
140
+
141
+ /** Give `next` the effect state `saved` had: every writable member. */
142
+ function restoreEffect(next: KeyframeEffect, saved: SavedAnimation): void {
143
+ for (const name of writableAccessors(next)) {
144
+ if (
145
+ name in saved.effectValues &&
146
+ differs(saved.effectValues[name], (next as unknown as Writable)[name])
147
+ ) {
148
+ write(next, name, saved.effectValues[name]);
149
+ }
150
+ }
151
+ if (saved.timing != null) {
152
+ const timing = next.getTiming() as unknown as Writable;
153
+ const changed: Writable = {};
154
+ for (const [field, value] of Object.entries(saved.timing)) {
155
+ if (differs(value, timing[field])) {
156
+ changed[field] = value;
157
+ }
158
+ }
159
+ if (Object.keys(changed).length > 0) {
160
+ next.updateTiming(changed);
161
+ }
162
+ }
163
+ if (
164
+ saved.keyframes != null &&
165
+ JSON.stringify(saved.keyframes) !== JSON.stringify(next.getKeyframes())
166
+ ) {
167
+ next.setKeyframes(saved.keyframes);
168
+ }
169
+ }
170
+
171
+ /** Give `next` the state `saved` had, member by member. */
172
+ function restore(next: Animation, saved: SavedAnimation): void {
173
+ const effect = next.effect as KeyframeEffect | null;
174
+ if (effect != null) {
175
+ restoreEffect(effect, saved);
176
+ }
177
+ const current = next as unknown as Writable;
178
+ for (const name of ['timeline', 'rangeStart', 'rangeEnd']) {
179
+ if (name in saved.values && differs(saved.values[name], current[name])) {
180
+ write(next, name, saved.values[name]);
181
+ }
182
+ }
183
+ for (const name of writableAccessors(next)) {
184
+ if (
185
+ !ORDERED.has(name) &&
186
+ name in saved.values &&
187
+ differs(saved.values[name], current[name])
188
+ ) {
189
+ write(next, name, saved.values[name]);
190
+ }
191
+ }
192
+ if (saved.replaceState === 'persisted' && next.replaceState !== 'persisted') {
193
+ next.persist();
194
+ }
195
+ const rate = saved.values.playbackRate;
196
+ if (typeof rate === 'number' && rate !== next.playbackRate) {
197
+ next.playbackRate = rate;
198
+ }
199
+ if (saved.playState === 'paused' && next.playState !== 'paused') {
200
+ next.pause();
201
+ } else if (saved.playState !== 'paused' && next.playState === 'paused') {
202
+ next.play();
203
+ }
204
+ // A running animation is anchored to its timeline by its start time, which
205
+ // carries its current time on exactly. A paused one has none and keeps its
206
+ // current time. A finished one holds its end: finishing it again holds the
207
+ // same time, though its start time is then counted from now, since script
208
+ // cannot set a start time and a held time together.
209
+ const start = saved.values.startTime as CSSNumberish | null | undefined;
210
+ const time = saved.values.currentTime as CSSNumberish | null | undefined;
211
+ if (saved.playState === 'finished') {
212
+ next.finish();
213
+ } else if (start != null) {
214
+ next.startTime = start;
215
+ } else if (time != null) {
216
+ next.currentTime = time;
217
+ }
218
+ }
219
+
220
+ /** Resume a cancelled CSS transition with a script animation in its state. */
221
+ function resumeTransition(saved: SavedAnimation): void {
222
+ if (saved.target == null || saved.keyframes == null) {
223
+ return;
224
+ }
225
+ const replacement = saved.target.animate(saved.keyframes, {
226
+ pseudoElement: saved.pseudoElement ?? undefined,
227
+ });
228
+ restore(replacement, saved);
229
+ }
230
+
231
+ function isTransition(animation: Animation): boolean {
232
+ return (
233
+ typeof CSSTransition !== 'undefined' && animation instanceof CSSTransition
234
+ );
235
+ }
236
+
237
+ function isCssAnimation(animation: Animation): animation is CSSAnimation {
238
+ return (
239
+ typeof CSSAnimation !== 'undefined' && animation instanceof CSSAnimation
240
+ );
241
+ }
242
+
243
+ /**
244
+ * Finishes an animation that ends: an infinite one cannot be finished, and is
245
+ * left as it runs.
246
+ */
247
+ function finishIfItEnds(animation: Animation): void {
248
+ const end = animation.effect?.getComputedTiming().endTime;
249
+ if (
250
+ end != null &&
251
+ Number.isFinite(Number(end)) &&
252
+ animation.playbackRate !== 0
253
+ ) {
254
+ animation.finish();
255
+ }
256
+ }
257
+
258
+ /** The members a copy's animation does not take: its element's keep them. */
259
+ const IDENTITY_MEMBERS = new Set(['id', 'onfinish', 'oncancel', 'onremove']);
260
+
261
+ /**
262
+ * `saved` for an animation that carries on on the copy of its element:
263
+ * aimed at the copy, without the element's id and event handlers.
264
+ */
265
+ function retarget(
266
+ saved: SavedAnimation,
267
+ copyOf: (element: Element) => Element | null,
268
+ ): SavedAnimation | null {
269
+ const target = saved.target == null ? null : copyOf(saved.target);
270
+ if (target == null) {
271
+ return null;
272
+ }
273
+ const values: Writable = Object.fromEntries(
274
+ Object.entries(saved.values).filter(
275
+ ([name]) => !IDENTITY_MEMBERS.has(name),
276
+ ),
277
+ );
278
+ const effectValues: Writable = {...saved.effectValues};
279
+ if ('target' in effectValues) {
280
+ effectValues.target = target;
281
+ }
282
+ return {...saved, target, values, effectValues};
283
+ }
284
+
285
+ /**
286
+ * Puts each state `saved` holds on the CSS animations and transitions of
287
+ * `root` and its subtree that are not among `survivors`. Each CSS animation
288
+ * the browser started afresh takes the state of the one it replaces. It is
289
+ * matched by element, pseudo-element and name, in order, and then by name
290
+ * alone (an effect script moved to another element or pseudo-element). Each
291
+ * transition whose animation no longer runs resumes as a script animation in
292
+ * its state. One started afresh that replaces none is finished: an entrance
293
+ * that had played and been dropped, or a transition from `@starting-style`.
294
+ * Script animations are left as they are.
295
+ */
296
+ export function restoreAnimations(
297
+ root: Element,
298
+ saved: ReadonlyArray<SavedAnimation>,
299
+ survivors: ReadonlySet<Animation>,
300
+ ): void {
301
+ const after = root.getAnimations({subtree: true});
302
+ const current = new Set(after);
303
+ const cancelled: SavedAnimation[] = [];
304
+ for (const state of saved) {
305
+ if (current.has(state.animation)) {
306
+ continue;
307
+ }
308
+ if (isTransition(state.animation)) {
309
+ resumeTransition(state);
310
+ } else {
311
+ cancelled.push(state);
312
+ }
313
+ }
314
+ const recreated = after.filter(
315
+ animation =>
316
+ (isCssAnimation(animation) || isTransition(animation)) &&
317
+ !survivors.has(animation),
318
+ );
319
+ const unmatched: Animation[] = [];
320
+ for (const animation of recreated) {
321
+ const effect = animation.effect as KeyframeEffect | null;
322
+ const name =
323
+ (animation as Animation & {animationName?: string}).animationName ?? '';
324
+ const index = cancelled.findIndex(
325
+ state =>
326
+ state.name === name &&
327
+ state.target === (effect?.target ?? null) &&
328
+ state.pseudoElement === (effect?.pseudoElement ?? null),
329
+ );
330
+ if (index === -1) {
331
+ unmatched.push(animation);
332
+ } else {
333
+ restore(animation, cancelled.splice(index, 1)[0]);
334
+ }
335
+ }
336
+ for (const animation of unmatched) {
337
+ const name =
338
+ (animation as Animation & {animationName?: string}).animationName ?? '';
339
+ const index = cancelled.findIndex(state => state.name === name);
340
+ if (index === -1) {
341
+ finishIfItEnds(animation);
342
+ } else {
343
+ restore(animation, cancelled.splice(index, 1)[0]);
344
+ }
345
+ }
346
+ }
347
+
348
+ /** The CSS animations and transitions `saveAnimations` read. */
349
+ export type SavedAnimations = ReadonlyArray<SavedAnimation>;
350
+
351
+ /**
352
+ * Reads the state of every CSS animation and transition of `root` and its
353
+ * subtree, for `carryAnimations` to give a copy of it.
354
+ */
355
+ export function saveAnimations(root: Element): SavedAnimations {
356
+ if (typeof root.getAnimations !== 'function') {
357
+ return [];
358
+ }
359
+ return root
360
+ .getAnimations({subtree: true})
361
+ .filter(animation => isCssAnimation(animation) || isTransition(animation))
362
+ .map(saveAnimation);
363
+ }
364
+
365
+ /**
366
+ * Carries on in `copy`, a clone of the root `saved` was read from, now laid
367
+ * out, the CSS animations and transitions its element ran. A clone starts
368
+ * each CSS animation again and runs no transition but a `@starting-style`
369
+ * one. So each CSS animation the clone started takes the state of its
370
+ * element's, and each transition runs on as a script animation. One the
371
+ * clone started that its element no longer ran is finished: an entrance that
372
+ * had played, or a `@starting-style` transition. `copyOf` maps each element
373
+ * of the cloned subtree to its copy. The element's own animations keep
374
+ * running, so the copy's take no id or event handler.
375
+ */
376
+ export function carryAnimations(
377
+ saved: SavedAnimations,
378
+ copy: Element,
379
+ copyOf: (element: Element) => Element | null,
380
+ ): void {
381
+ if (typeof copy.getAnimations !== 'function') {
382
+ return;
383
+ }
384
+ restoreAnimations(
385
+ copy,
386
+ saved.flatMap(state => retarget(state, copyOf) ?? []),
387
+ new Set(),
388
+ );
389
+ }
@@ -15,9 +15,12 @@
15
15
  * technology, carries no ids or test ids, joins no form or radio group (a
16
16
  * copied checked radio would uncheck the live one), and its frames and media
17
17
  * load nothing. Laying it out changes no ancestor's position, and a scaled
18
- * host draws it at the old size. Laid in a host outside the element's own
19
- * ancestors, it keeps what it inherited from them: its inherited properties
20
- * and custom properties that differ from the host's are written on it.
18
+ * host draws it at the old size. A clone restarts each CSS animation and runs
19
+ * no transition but a `@starting-style` one; the copy carries on its
20
+ * element's from where they were.
21
+ * Laid in a host outside the element's own ancestors, it keeps what it
22
+ * inherited from them: its inherited properties and custom properties that
23
+ * differ from the host's are written on it.
21
24
  * Limits: a rule keyed on a removed `id`, or matched through an ancestor
22
25
  * between the host and the element (`.collapsed .label`), does not style the
23
26
  * copy as it styled the element; and content holding a canvas whose pixels read back
@@ -28,6 +31,12 @@
28
31
  * SYNC: When modified, update /packages/core/src/motion/animatedLayout.ts
29
32
  */
30
33
 
34
+ import {
35
+ carryAnimations,
36
+ saveAnimations,
37
+ type SavedAnimations,
38
+ } from './carryAnimations';
39
+
31
40
  /** Above this many elements, old content is not copied: the new one enters. */
32
41
  const MAX_COPIED_ELEMENTS = 1500;
33
42
 
@@ -151,11 +160,22 @@ const scrollOffsets = new WeakMap<
151
160
  ReadonlyArray<readonly [Element, number, number]>
152
161
  >();
153
162
 
163
+ /**
164
+ * The CSS animations and transitions a copy's element ran, and the copy of
165
+ * each element in the copied subtree. The copy carries them on once laid out
166
+ * (`placeOver`).
167
+ */
168
+ const carriedMotion = new WeakMap<
169
+ HTMLElement,
170
+ {saved: SavedAnimations; copyOf: ReadonlyMap<Element, Element>}
171
+ >();
172
+
154
173
  /**
155
174
  * A copy that takes no part: no ids or test ids, no form or radio group (a
156
175
  * copied checked radio would uncheck the live one), no label for a live
157
176
  * control, and copied frames and media load nothing. Scrolled descendants
158
- * keep their offsets once the copy is laid out (`placeOver`).
177
+ * keep their offsets. The CSS animations and transitions running in it carry
178
+ * on from where they were, once the copy is laid out (`placeOver`).
159
179
  */
160
180
  export function inertCopy(element: HTMLElement): HTMLElement | null {
161
181
  const copy = element.cloneNode(true) as HTMLElement;
@@ -169,6 +189,10 @@ export function inertCopy(element: HTMLElement): HTMLElement | null {
169
189
  });
170
190
  scrollOffsets.set(copy, offsets);
171
191
  inheritedValues.set(copy, readInherited(element));
192
+ carriedMotion.set(copy, {
193
+ saved: saveAnimations(element),
194
+ copyOf: new Map(sourceNodes.map((node, index) => [node, copyNodes[index]])),
195
+ });
172
196
  for (const node of copyNodes) {
173
197
  for (const name of [
174
198
  'id',
@@ -215,7 +239,8 @@ export function paintedBackground(element: Element): string {
215
239
  /**
216
240
  * Lay `element` over `rect` (viewport coordinates), absolutely, as the last
217
241
  * child of `host`, wherever its containing block is: no ancestor's position
218
- * changes.
242
+ * changes. A copy's scrolled descendants then restore their offsets, and the
243
+ * CSS animations and transitions its element ran carry on in it.
219
244
  */
220
245
  export function placeOver(
221
246
  element: HTMLElement,
@@ -277,6 +302,15 @@ export function placeOver(
277
302
  node.scrollLeft = left;
278
303
  }
279
304
  }
305
+ const carried = carriedMotion.get(element);
306
+ if (carried != null) {
307
+ carriedMotion.delete(element);
308
+ carryAnimations(
309
+ carried.saved,
310
+ element,
311
+ node => carried.copyOf.get(node) ?? null,
312
+ );
313
+ }
280
314
  }
281
315
 
282
316
  /**
@@ -323,6 +357,12 @@ export function visiblePartCopy(element: HTMLElement): {
323
357
  if (values != null) {
324
358
  inheritedValues.set(holder, values);
325
359
  }
360
+ // The content's CSS motion carries on when the holder is laid out.
361
+ const carried = carriedMotion.get(content);
362
+ if (carried != null) {
363
+ carriedMotion.set(holder, carried);
364
+ carriedMotion.delete(content);
365
+ }
326
366
  const box = element.getBoundingClientRect();
327
367
  return {
328
368
  copy: holder,
@@ -251,6 +251,27 @@ export const UIKIT_PRESS = {
251
251
  momentumMemory: {value: 3000, unit: 'ms'},
252
252
  } as const satisfies Record<string, GestureConstant>;
253
253
 
254
+ /**
255
+ * UIMenu presented by a button whose menu is its primary action: how far the
256
+ * finger that opened it travels before it picks. DropdownMenu's press model
257
+ * reads a copy in `hooks/menuPressValues.ts`.
258
+ */
259
+ export const UIKIT_MENU_PRESS = {
260
+ /**
261
+ * After the menu opens under a still-held finger, the finger travels this
262
+ * far before it starts picking. The distance is a straight line from the
263
+ * first sample the menu receives after it opened. Until then nothing is
264
+ * lit, and lifting acts on nothing.
265
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
266
+ * iPhone 17 Pro, gesture-state hook, steps 150 ms apart, Oct 23 2026
267
+ * (M-MN2): with the menu open under a held finger and a 1 pt first step,
268
+ * moves of (0, 9) and (7, 7) picked nothing; (0, 10), (0, 11), (10, 0),
269
+ * (9, 9) and (10, 10) picked; a 9 pt step followed by 3 pt more picked
270
+ * nothing
271
+ */
272
+ handoff: {value: 10, unit: 'px'},
273
+ } as const satisfies Record<string, GestureConstant>;
274
+
254
275
  export const UIKIT_VELOCITY = {
255
276
  /**
256
277
  * UIPanGestureRecognizer.velocity(in:) is this times the newest event's
@@ -318,6 +339,7 @@ export const UIKIT_GESTURES = {
318
339
  screenEdgePan: UIKIT_SCREEN_EDGE_PAN,
319
340
  control: UIKIT_CONTROL,
320
341
  press: UIKIT_PRESS,
342
+ menuPress: UIKIT_MENU_PRESS,
321
343
  velocity: UIKIT_VELOCITY,
322
344
  } as const;
323
345
 
@@ -27,6 +27,7 @@ export {
27
27
  UIKIT_CONTROL,
28
28
  UIKIT_GESTURES,
29
29
  UIKIT_LONG_PRESS,
30
+ UIKIT_MENU_PRESS,
30
31
  UIKIT_PAN,
31
32
  UIKIT_PINCH,
32
33
  UIKIT_PRESS,
@@ -50,17 +50,19 @@ export const press = {
50
50
  */
51
51
  flashMs: 100,
52
52
  /**
53
- * Highlight fade after release: UIKit's deselect cross-fade.
53
+ * Highlight fade after release: UIKit's deselect cross-fade. Reference
54
+ * only, not played: a press release plays the theme's exit motion tokens
55
+ * (`--duration-exit`, `--ease-exit`).
54
56
  * @source measured: Settings and Contacts, iOS 26.2, simulator driven
55
- * with real HID touches at 60 fps (PRESS_FADE_MS / pressConsts.releaseMs,
57
+ * with real HID touches at 60 fps (touch press model,
56
58
  * packages/core/src/utils/pressGesture.ts, 2026-10-06)
57
59
  */
58
60
  highlightOutMs: 200,
59
61
  /**
60
62
  * The highlight fade's curve after release: an ease-out that spends the
61
- * whole clock fading (strength about 0.2 at the midpoint).
62
- * @source GUESS — the release curve the touch press model ships with
63
- * (`RELEASE_EASE`, packages/core/src/utils/interactionOverlay.stylex.ts),
63
+ * whole clock fading (strength about 0.2 at the midpoint). Reference only,
64
+ * not played: a press release plays the theme's `--ease-exit`.
65
+ * @source GUESS — the release curve the touch press model shipped with,
64
66
  * chosen to read as UIKit's deselect cross-fade, not read from UIKit
65
67
  * @measure M-PR1
66
68
  */
@@ -0,0 +1,104 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ /**
3
+ * @file privateAttributes/menuPressLit.stylex.ts
4
+ * @input The row that a held finger or pen lights in a menu
5
+ * @output Exports markMenuPressLit and clearMenuPressLit, which mark that row,
6
+ * and isMenuPressLit, which reads the mark. It also exports
7
+ * menuPressLitRowStyle, which paints the marked row. The hold pair,
8
+ * holdMenuPressPaint and releaseMenuPressPaint, keeps the other rows off
9
+ * their pressed paint, and isMenuPressPaintHeld reads that hold.
10
+ * @position Owner module of the private menu-press-lit attribute: the only
11
+ * file that writes its name. The menu press model (hooks/useMenuPress.ts)
12
+ * marks the row; DropdownMenu's rows compose the styles. No package entry
13
+ * exports it.
14
+ *
15
+ * SYNC: Each row that composes menuPressLitRowStyle reads
16
+ * `--_menu-row-focus-paint` in its `:focus` background, and a row with an
17
+ * `:active` background reads `--_menu-row-active-paint` there:
18
+ * - /packages/core/src/DropdownMenu/DropdownMenuItem.tsx
19
+ * - /packages/core/src/DropdownMenu/DropdownMenuCheckboxItem.tsx
20
+ * - /packages/core/src/DropdownMenu/DropdownMenuRadioItem.tsx
21
+ * - /packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx
22
+ */
23
+
24
+ import * as stylex from '@stylexjs/stylex';
25
+ import type {StyleXStyles} from '@stylexjs/stylex';
26
+ import {colorVars} from '../theme/tokens.stylex';
27
+
28
+ const MENU_PRESS_LIT = 'data-astryx-menu-press-lit';
29
+ const ACTIVE_PAINT = '--_menu-row-active-paint';
30
+
31
+ /** Marks `row` as the row that a held finger or pen lights. */
32
+ export function markMenuPressLit(row: Element): void {
33
+ row.setAttribute(MENU_PRESS_LIT, '');
34
+ }
35
+
36
+ /** Removes the mark from `row`. */
37
+ export function clearMenuPressLit(row: Element): void {
38
+ row.removeAttribute(MENU_PRESS_LIT);
39
+ }
40
+
41
+ /** Whether a held finger or pen lights `row`. */
42
+ export function isMenuPressLit(row: Element): boolean {
43
+ return row.hasAttribute(MENU_PRESS_LIT);
44
+ }
45
+
46
+ /**
47
+ * Keeps `menu`'s rows off their `:active` paint while a held finger or pen
48
+ * presses in it. The row the press began on stays `:active` as the press
49
+ * moves on. The lit row keeps the pressed overlay through its own mark.
50
+ */
51
+ export function holdMenuPressPaint(menu: HTMLElement): void {
52
+ menu.style.setProperty(ACTIVE_PAINT, 'transparent');
53
+ }
54
+
55
+ /** Gives `menu`'s rows their `:active` paint back. */
56
+ export function releaseMenuPressPaint(menu: HTMLElement): void {
57
+ menu.style.removeProperty(ACTIVE_PAINT);
58
+ }
59
+
60
+ /** Whether a held finger or pen keeps `menu`'s rows off their `:active` paint. */
61
+ export function isMenuPressPaintHeld(menu: HTMLElement): boolean {
62
+ return menu.style.getPropertyValue(ACTIVE_PAINT) !== '';
63
+ }
64
+
65
+ /**
66
+ * A value for each attribute state. The index signature gives StyleX the value
67
+ * type, which it cannot read from a literal attribute key.
68
+ */
69
+ type ByAttribute<Value> = Readonly<{
70
+ default: null;
71
+ [attribute: string]: Value | null;
72
+ }>;
73
+
74
+ const litRowPaint: Readonly<{
75
+ '--_menu-row-focus-paint': ByAttribute<string>;
76
+ '--_menu-row-active-paint': ByAttribute<string>;
77
+ }> = {
78
+ '--_menu-row-focus-paint': {
79
+ default: null,
80
+ '[data-astryx-menu-press-lit]': colorVars['--color-overlay-pressed'],
81
+ },
82
+ '--_menu-row-active-paint': {
83
+ default: null,
84
+ '[data-astryx-menu-press-lit]': colorVars['--color-overlay-pressed'],
85
+ },
86
+ };
87
+
88
+ const styles = stylex.create({
89
+ row: {...litRowPaint},
90
+ });
91
+
92
+ /**
93
+ * Compose on a menu row whose `:focus` background is
94
+ * `var(--_menu-row-focus-paint, <hover overlay>)`, and whose `:active`
95
+ * background, if any, is `var(--_menu-row-active-paint, <pressed overlay>)`.
96
+ * The row paints the hover overlay on focus, and the pressed overlay while a
97
+ * held finger or pen lights it.
98
+ * Under a finger, the hover overlay is too faint to follow. The variable has
99
+ * no default: a layered stylesheet emits a default unlayered, and it would
100
+ * beat the attribute arm. The value resolves on the row, so a theme set on any
101
+ * ancestor applies. The style sets only a custom property, which shares no
102
+ * key with StyleX's CSS property type, so TypeScript needs the wider type.
103
+ */
104
+ export const menuPressLitRowStyle = styles.row as StyleXStyles;