@astryxdesign/core 0.7.11 → 0.7.12-canary.ccb4a6d

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 (533) hide show
  1. package/dist/AppShell/AppShellMobileContext.d.ts.map +1 -1
  2. package/dist/AppShell/AppShellMobileContext.js +4 -3
  3. package/dist/AppShell/useAppShellMainId.d.ts.map +1 -1
  4. package/dist/AppShell/useAppShellMainId.js +3 -2
  5. package/dist/Avatar/AvatarSizeContext.d.ts.map +1 -1
  6. package/dist/Avatar/AvatarSizeContext.js +2 -2
  7. package/dist/Avatar/AvatarStatusLabelContext.d.ts +2 -2
  8. package/dist/Avatar/AvatarStatusLabelContext.d.ts.map +1 -1
  9. package/dist/Avatar/AvatarStatusLabelContext.js +3 -3
  10. package/dist/AvatarGroup/AvatarGroupContext.d.ts.map +1 -1
  11. package/dist/AvatarGroup/AvatarGroupContext.js +2 -2
  12. package/dist/BottomSheet/BottomSheetHostContext.d.ts.map +1 -1
  13. package/dist/BottomSheet/BottomSheetHostContext.js +3 -2
  14. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  15. package/dist/BottomSheet/BottomSheetPanel.js +48 -4
  16. package/dist/BottomSheet/BottomSheetSwitcherContext.d.ts.map +1 -1
  17. package/dist/BottomSheet/BottomSheetSwitcherContext.js +2 -2
  18. package/dist/BottomSheet/bottomSheetEscape.d.ts.map +1 -1
  19. package/dist/BottomSheet/bottomSheetEscape.js +2 -2
  20. package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
  21. package/dist/BottomSheet/bottomSheetStack.js +2 -13
  22. package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
  23. package/dist/BottomSheet/useSheetGestures.js +25 -42
  24. package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  25. package/dist/Breadcrumbs/Breadcrumbs.js +2 -2
  26. package/dist/Button/Button.d.ts.map +1 -1
  27. package/dist/Button/Button.js +12 -21
  28. package/dist/Button/buttonHitArea.d.ts.map +1 -1
  29. package/dist/Button/buttonHitArea.js +3 -3
  30. package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
  31. package/dist/ButtonGroup/ButtonGroup.js +13 -7
  32. package/dist/ButtonGroup/ButtonGroupContext.d.ts.map +1 -1
  33. package/dist/ButtonGroup/ButtonGroupContext.js +2 -2
  34. package/dist/Carousel/Carousel.d.ts.map +1 -1
  35. package/dist/Carousel/Carousel.js +24 -15
  36. package/dist/Chat/ChatContext.d.ts.map +1 -1
  37. package/dist/Chat/ChatContext.js +6 -5
  38. package/dist/Chat/useChatStreamScroll.d.ts.map +1 -1
  39. package/dist/Chat/useChatStreamScroll.js +7 -22
  40. package/dist/CheckboxInput/CheckboxRowPressContext.d.ts.map +1 -1
  41. package/dist/CheckboxInput/CheckboxRowPressContext.js +1 -1
  42. package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
  43. package/dist/CheckboxList/CheckboxListContext.js +1 -1
  44. package/dist/Collapsible/CollapsibleGroupContext.d.ts.map +1 -1
  45. package/dist/Collapsible/CollapsibleGroupContext.js +3 -3
  46. package/dist/CommandPalette/CommandPaletteContext.d.ts.map +1 -1
  47. package/dist/CommandPalette/CommandPaletteContext.js +4 -3
  48. package/dist/CommandPalette/busyStartSettle.d.ts.map +1 -1
  49. package/dist/CommandPalette/busyStartSettle.js +2 -2
  50. package/dist/DateInput/TouchDateField.d.ts.map +1 -1
  51. package/dist/DateInput/TouchDateField.js +41 -4
  52. package/dist/Dialog/DialogContext.d.ts.map +1 -1
  53. package/dist/Dialog/DialogContext.js +3 -2
  54. package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
  55. package/dist/DropdownMenu/DropdownMenuContext.js +6 -5
  56. package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts.map +1 -1
  57. package/dist/DropdownMenu/lazyMenuBottomSheet.js +4 -15
  58. package/dist/DropdownMenu/menuRegionStops.d.ts.map +1 -1
  59. package/dist/DropdownMenu/menuRegionStops.js +2 -37
  60. package/dist/FormLayout/FormLayoutContext.d.ts.map +1 -1
  61. package/dist/FormLayout/FormLayoutContext.js +2 -2
  62. package/dist/Heading/Heading.d.ts.map +1 -1
  63. package/dist/Heading/Heading.js +19 -16
  64. package/dist/HoverCard/HoverCard.d.ts +1 -2
  65. package/dist/HoverCard/HoverCard.d.ts.map +1 -1
  66. package/dist/HoverCard/useHoverCard.d.ts +1 -2
  67. package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
  68. package/dist/HoverCard/useHoverCard.js +5 -1
  69. package/dist/Icon/IconDefaultSizeContext.d.ts.map +1 -1
  70. package/dist/Icon/IconDefaultSizeContext.js +2 -2
  71. package/dist/InputGroup/InputGroupContext.d.ts.map +1 -1
  72. package/dist/InputGroup/InputGroupContext.js +2 -2
  73. package/dist/InputGroup/InputGroupInternalContext.d.ts.map +1 -1
  74. package/dist/InputGroup/InputGroupInternalContext.js +2 -2
  75. package/dist/InteractiveRoleContext/InteractiveRoleContext.d.ts.map +1 -1
  76. package/dist/InteractiveRoleContext/InteractiveRoleContext.js +5 -3
  77. package/dist/Item/ItemDescriptionContext.d.ts.map +1 -1
  78. package/dist/Item/ItemDescriptionContext.js +3 -3
  79. package/dist/Item/ItemListRowContext.d.ts.map +1 -1
  80. package/dist/Item/ItemListRowContext.js +3 -3
  81. package/dist/Item/ItemMarkerColumnsContext.d.ts +1 -1
  82. package/dist/Item/ItemMarkerColumnsContext.d.ts.map +1 -1
  83. package/dist/Item/ItemMarkerColumnsContext.js +2 -2
  84. package/dist/Layer/LayerContext.d.ts.map +1 -1
  85. package/dist/Layer/LayerContext.js +3 -2
  86. package/dist/Layer/LayerDepthContext.d.ts.map +1 -1
  87. package/dist/Layer/LayerDepthContext.js +3 -2
  88. package/dist/Layer/LayerTouch.d.ts +3 -2
  89. package/dist/Layer/LayerTouch.d.ts.map +1 -1
  90. package/dist/Layer/LayerTouch.js +3 -2
  91. package/dist/Layer/anchorName.d.ts.map +1 -1
  92. package/dist/Layer/anchorName.js +5 -1
  93. package/dist/Layer/inputHold.d.ts.map +1 -1
  94. package/dist/Layer/inputHold.js +115 -13
  95. package/dist/Layer/layerScopedContext.d.ts +5 -2
  96. package/dist/Layer/layerScopedContext.d.ts.map +1 -1
  97. package/dist/Layer/layerScopedContext.js +27 -10
  98. package/dist/Layer/layerSlideRules.d.ts +28 -26
  99. package/dist/Layer/layerSlideRules.d.ts.map +1 -1
  100. package/dist/Layer/layerSlideRules.js +41 -40
  101. package/dist/Layer/outsidePress.d.ts +21 -3
  102. package/dist/Layer/outsidePress.d.ts.map +1 -1
  103. package/dist/Layer/outsidePress.js +119 -29
  104. package/dist/Layer/settledBox.d.ts +9 -8
  105. package/dist/Layer/settledBox.d.ts.map +1 -1
  106. package/dist/Layer/settledBox.js +169 -49
  107. package/dist/Layer/toastHost.d.ts.map +1 -1
  108. package/dist/Layer/toastHost.js +3 -2
  109. package/dist/Layer/useLayer.d.ts.map +1 -1
  110. package/dist/Layer/useLayer.js +172 -60
  111. package/dist/Layer/useLayerKeyboardClearance.d.ts +14 -2
  112. package/dist/Layer/useLayerKeyboardClearance.d.ts.map +1 -1
  113. package/dist/Layer/useLayerKeyboardClearance.js +83 -12
  114. package/dist/Layer/useTouchTrigger.d.ts +21 -1
  115. package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
  116. package/dist/Layer/useTouchTrigger.js +61 -37
  117. package/dist/Layout/Layout.d.ts +1 -1
  118. package/dist/Layout/Layout.d.ts.map +1 -1
  119. package/dist/Layout/Layout.js +10 -6
  120. package/dist/Layout/LayoutAreaContext.d.ts.map +1 -1
  121. package/dist/Layout/LayoutAreaContext.js +3 -3
  122. package/dist/Layout/LayoutContent.d.ts +6 -6
  123. package/dist/Layout/LayoutContent.js +9 -9
  124. package/dist/Layout/LayoutDividerContext.d.ts.map +1 -1
  125. package/dist/Layout/LayoutDividerContext.js +2 -2
  126. package/dist/Layout/LayoutSlotsContext.d.ts.map +1 -1
  127. package/dist/Layout/LayoutSlotsContext.js +2 -2
  128. package/dist/Link/LinkContext.d.ts +16 -0
  129. package/dist/Link/LinkContext.d.ts.map +1 -1
  130. package/dist/Link/LinkContext.js +3 -3
  131. package/dist/List/List.d.ts +12 -1
  132. package/dist/List/List.d.ts.map +1 -1
  133. package/dist/List/List.js +29 -10
  134. package/dist/List/ListContext.d.ts +18 -3
  135. package/dist/List/ListContext.d.ts.map +1 -1
  136. package/dist/List/ListContext.js +9 -6
  137. package/dist/List/ListItem.d.ts +13 -4
  138. package/dist/List/ListItem.d.ts.map +1 -1
  139. package/dist/List/ListItem.js +37 -10
  140. package/dist/List/listLayoutUpdates.d.ts +34 -0
  141. package/dist/List/listLayoutUpdates.d.ts.map +1 -0
  142. package/dist/List/listLayoutUpdates.js +539 -0
  143. package/dist/Markdown/Markdown.d.ts.map +1 -1
  144. package/dist/Markdown/Markdown.js +57 -10
  145. package/dist/Markdown/blockDirection.d.ts +26 -0
  146. package/dist/Markdown/blockDirection.d.ts.map +1 -0
  147. package/dist/Markdown/blockDirection.js +68 -0
  148. package/dist/Markdown/plugins/HeadingLinksRenderer.d.ts +3 -1
  149. package/dist/Markdown/plugins/HeadingLinksRenderer.d.ts.map +1 -1
  150. package/dist/Markdown/plugins/HeadingLinksRenderer.js +3 -1
  151. package/dist/MetadataList/MetadataListContext.d.ts.map +1 -1
  152. package/dist/MetadataList/MetadataListContext.js +2 -2
  153. package/dist/NavMenu/NavMenuContext.d.ts.map +1 -1
  154. package/dist/NavMenu/NavMenuContext.js +5 -4
  155. package/dist/Popover/Popover.d.ts.map +1 -1
  156. package/dist/Popover/Popover.js +9 -9
  157. package/dist/Popover/usePopover.d.ts.map +1 -1
  158. package/dist/Popover/usePopover.js +11 -8
  159. package/dist/RadioList/RadioList.d.ts.map +1 -1
  160. package/dist/RadioList/RadioList.js +2 -2
  161. package/dist/RadioList/RadioListReasonContext.d.ts.map +1 -1
  162. package/dist/RadioList/RadioListReasonContext.js +1 -1
  163. package/dist/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
  164. package/dist/SegmentedControl/SegmentedControlContext.js +2 -2
  165. package/dist/SelectableCard/selectableCardInput.d.ts.map +1 -1
  166. package/dist/SelectableCard/selectableCardInput.js +2 -2
  167. package/dist/Selector/SelectorRowLayoutContext.d.ts.map +1 -1
  168. package/dist/Selector/SelectorRowLayoutContext.js +2 -2
  169. package/dist/SideNav/SideNavCollapseButton.d.ts +4 -3
  170. package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
  171. package/dist/SideNav/SideNavCollapseContext.d.ts.map +1 -1
  172. package/dist/SideNav/SideNavCollapseContext.js +4 -3
  173. package/dist/SideNav/SideNavFocusTargetsContext.d.ts.map +1 -1
  174. package/dist/SideNav/SideNavFocusTargetsContext.js +2 -2
  175. package/dist/SideNav/SideNavItem.d.ts.map +1 -1
  176. package/dist/SideNav/SideNavItem.js +3 -2
  177. package/dist/SideNav/SideNavRenderContext.d.ts.map +1 -1
  178. package/dist/SideNav/SideNavRenderContext.js +4 -3
  179. package/dist/SideNav/railMotion.d.ts +40 -0
  180. package/dist/SideNav/railMotion.d.ts.map +1 -1
  181. package/dist/SideNav/railMotion.js +2 -2
  182. package/dist/SizeContext/SizeContext.d.ts.map +1 -1
  183. package/dist/SizeContext/SizeContext.js +2 -2
  184. package/dist/SnapPaging/SnapPaging.d.ts.map +1 -1
  185. package/dist/SnapPaging/SnapPaging.js +162 -36
  186. package/dist/SnapPaging/snapPagingValue.d.ts +29 -3
  187. package/dist/SnapPaging/snapPagingValue.d.ts.map +1 -1
  188. package/dist/SnapPaging/snapPagingValue.js +38 -6
  189. package/dist/Spinner/SpinnerOwnerContext.d.ts.map +1 -1
  190. package/dist/Spinner/SpinnerOwnerContext.js +2 -2
  191. package/dist/Stepper/StepperContext.d.ts.map +1 -1
  192. package/dist/Stepper/StepperContext.js +3 -3
  193. package/dist/Switch/useSwitchTouch.d.ts.map +1 -1
  194. package/dist/Switch/useSwitchTouch.js +8 -3
  195. package/dist/TabList/TabListContext.d.ts.map +1 -1
  196. package/dist/TabList/TabListContext.js +2 -2
  197. package/dist/Table/BaseTable.d.ts +3 -2
  198. package/dist/Table/BaseTable.d.ts.map +1 -1
  199. package/dist/Table/BaseTable.js +73 -16
  200. package/dist/Table/Table.d.ts.map +1 -1
  201. package/dist/Table/Table.js +3 -2
  202. package/dist/Table/TableContext.d.ts.map +1 -1
  203. package/dist/Table/TableContext.js +2 -2
  204. package/dist/Table/index.d.ts +1 -1
  205. package/dist/Table/index.d.ts.map +1 -1
  206. package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
  207. package/dist/Table/plugins/filtering/useTableFiltering.js +4 -3
  208. package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
  209. package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +5 -3
  210. package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts +16 -18
  211. package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts.map +1 -1
  212. package/dist/Table/plugins/rowIndex/useTableRowIndex.js +48 -39
  213. package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
  214. package/dist/Table/plugins/selection/useTableSelection.js +4 -2
  215. package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
  216. package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +1 -0
  217. package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
  218. package/dist/Table/plugins/tree/useTableTreeData.js +3 -2
  219. package/dist/Table/tableRowContextUsage.d.ts +21 -0
  220. package/dist/Table/tableRowContextUsage.d.ts.map +1 -0
  221. package/dist/Table/tableRowContextUsage.js +88 -0
  222. package/dist/Table/types.d.ts +58 -5
  223. package/dist/Table/types.d.ts.map +1 -1
  224. package/dist/Table/useBaseTablePlugins.d.ts.map +1 -1
  225. package/dist/Table/useBaseTablePlugins.js +5 -2
  226. package/dist/Text/Text.d.ts.map +1 -1
  227. package/dist/Text/Text.js +18 -14
  228. package/dist/Text/TruncationTooltip.d.ts +45 -0
  229. package/dist/Text/TruncationTooltip.d.ts.map +1 -0
  230. package/dist/Text/TruncationTooltip.js +123 -0
  231. package/dist/Text/textClampContext.d.ts.map +1 -1
  232. package/dist/Text/textClampContext.js +1 -1
  233. package/dist/TimeInput/TimeInput.d.ts.map +1 -1
  234. package/dist/TimeInput/TimeInput.js +4 -0
  235. package/dist/ToggleButton/ToggleButtonGroup.d.ts.map +1 -1
  236. package/dist/ToggleButton/ToggleButtonGroup.js +2 -2
  237. package/dist/Token/TokenNamingContext.d.ts.map +1 -1
  238. package/dist/Token/TokenNamingContext.js +2 -2
  239. package/dist/Tokenizer/TokenizerClearAllMessageContext.d.ts.map +1 -1
  240. package/dist/Tokenizer/TokenizerClearAllMessageContext.js +2 -2
  241. package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts +12 -0
  242. package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts.map +1 -1
  243. package/dist/Tokenizer/TokenizerItemRemovableContext.js +2 -2
  244. package/dist/Toolbar/Toolbar.d.ts.map +1 -1
  245. package/dist/Toolbar/Toolbar.js +12 -6
  246. package/dist/Tooltip/tooltipPresentInterest.d.ts +29 -0
  247. package/dist/Tooltip/tooltipPresentInterest.d.ts.map +1 -0
  248. package/dist/Tooltip/tooltipPresentInterest.js +29 -0
  249. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  250. package/dist/Tooltip/useTooltip.js +30 -4
  251. package/dist/TopNav/TopNavContext.d.ts.map +1 -1
  252. package/dist/TopNav/TopNavContext.js +2 -2
  253. package/dist/TopNav/TopNavMobileContentContext.d.ts +1 -1
  254. package/dist/TopNav/TopNavMobileContentContext.d.ts.map +1 -1
  255. package/dist/TopNav/TopNavMobileContentContext.js +4 -3
  256. package/dist/TopNav/TopNavRenderContext.d.ts.map +1 -1
  257. package/dist/TopNav/TopNavRenderContext.js +4 -3
  258. package/dist/Typeahead/busyIndicatorLane.d.ts.map +1 -1
  259. package/dist/Typeahead/busyIndicatorLane.js +3 -2
  260. package/dist/Typeahead/committedChoicesKey.d.ts.map +1 -1
  261. package/dist/Typeahead/committedChoicesKey.js +3 -2
  262. package/dist/Typeahead/trailingKeyDown.d.ts.map +1 -1
  263. package/dist/Typeahead/trailingKeyDown.js +3 -2
  264. package/dist/astryx.css +18 -8
  265. package/dist/gestures/GestureArena.d.ts +2 -0
  266. package/dist/gestures/GestureArena.d.ts.map +1 -1
  267. package/dist/gestures/GestureArena.js +8 -1
  268. package/dist/gestures/GestureRecognizer.d.ts +6 -0
  269. package/dist/gestures/GestureRecognizer.d.ts.map +1 -1
  270. package/dist/gestures/GestureRecognizer.js +9 -0
  271. package/dist/gestures/PressTracker.d.ts.map +1 -1
  272. package/dist/gestures/PressTracker.js +9 -4
  273. package/dist/hooks/focusableSelector.d.ts +13 -1
  274. package/dist/hooks/focusableSelector.d.ts.map +1 -1
  275. package/dist/hooks/focusableSelector.js +22 -2
  276. package/dist/hooks/longPressDetector.d.ts.map +1 -1
  277. package/dist/hooks/longPressDetector.js +1 -25
  278. package/dist/hooks/pressGroupContext.d.ts.map +1 -1
  279. package/dist/hooks/pressGroupContext.js +1 -1
  280. package/dist/hooks/useActionGroupTracking.d.ts +18 -1
  281. package/dist/hooks/useActionGroupTracking.d.ts.map +1 -1
  282. package/dist/hooks/useActionGroupTracking.js +13 -2
  283. package/dist/hooks/useAnnounce.d.ts.map +1 -1
  284. package/dist/hooks/useAnnounce.js +3 -2
  285. package/dist/hooks/useFocusTrap.d.ts +11 -0
  286. package/dist/hooks/useFocusTrap.d.ts.map +1 -1
  287. package/dist/hooks/useFocusTrap.js +47 -2
  288. package/dist/hooks/useListFocus.d.ts +7 -0
  289. package/dist/hooks/useListFocus.d.ts.map +1 -1
  290. package/dist/hooks/useListFocus.js +20 -3
  291. package/dist/hooks/usePager.d.ts.map +1 -1
  292. package/dist/hooks/usePager.js +26 -3
  293. package/dist/hooks/useScrollOverflow.d.ts +22 -0
  294. package/dist/hooks/useScrollOverflow.d.ts.map +1 -1
  295. package/dist/hooks/useScrollOverflow.js +67 -11
  296. package/dist/i18n/InternationalizationContext.d.ts +19 -0
  297. package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
  298. package/dist/i18n/InternationalizationContext.js +3 -3
  299. package/dist/i18n/englishFallback.d.ts.map +1 -1
  300. package/dist/i18n/englishFallback.js +5 -1
  301. package/dist/i18n/firstStrongDirection.d.ts +7 -0
  302. package/dist/i18n/firstStrongDirection.d.ts.map +1 -0
  303. package/dist/i18n/firstStrongDirection.js +65 -0
  304. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  305. package/dist/i18n/generated-locales/en.generated.js +1 -0
  306. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  307. package/dist/i18n/generated-locales/pseudo.generated.js +1 -0
  308. package/dist/internal/scroll-anchoring.d.ts +16 -0
  309. package/dist/internal/scroll-anchoring.d.ts.map +1 -0
  310. package/dist/internal/scroll-anchoring.js +16 -0
  311. package/dist/internal/touch.d.ts +2 -0
  312. package/dist/internal/touch.d.ts.map +1 -1
  313. package/dist/internal/touch.js +4 -1
  314. package/dist/motion/animatedLayout.d.ts +8 -0
  315. package/dist/motion/animatedLayout.d.ts.map +1 -1
  316. package/dist/motion/animatedLayout.js +51 -3
  317. package/dist/motion/animator.d.ts +19 -2
  318. package/dist/motion/animator.d.ts.map +1 -1
  319. package/dist/motion/animator.js +72 -7
  320. package/dist/privateAttributes/itemKey.stylex.d.ts +5 -0
  321. package/dist/privateAttributes/itemKey.stylex.d.ts.map +1 -0
  322. package/dist/privateAttributes/itemKey.stylex.js +25 -0
  323. package/dist/privateAttributes/leaving.stylex.d.ts +5 -0
  324. package/dist/privateAttributes/leaving.stylex.d.ts.map +1 -0
  325. package/dist/privateAttributes/leaving.stylex.js +23 -0
  326. package/dist/privateAttributes/press.stylex.d.ts.map +1 -1
  327. package/dist/privateAttributes/press.stylex.js +13 -3
  328. package/dist/privateAttributes/scrollAnchoring.stylex.d.ts +7 -0
  329. package/dist/privateAttributes/scrollAnchoring.stylex.d.ts.map +1 -0
  330. package/dist/privateAttributes/scrollAnchoring.stylex.js +50 -0
  331. package/dist/privateAttributes/travelling.stylex.d.ts +27 -0
  332. package/dist/privateAttributes/travelling.stylex.d.ts.map +1 -0
  333. package/dist/privateAttributes/travelling.stylex.js +51 -0
  334. package/dist/theme/Theme.d.ts.map +1 -1
  335. package/dist/theme/Theme.js +95 -49
  336. package/dist/theme/syntax/SyntaxTheme.d.ts.map +1 -1
  337. package/dist/theme/syntax/SyntaxTheme.js +3 -2
  338. package/dist/theme/useTheme.d.ts.map +1 -1
  339. package/dist/theme/useTheme.js +3 -2
  340. package/dist/utils/calendarSystem.d.ts.map +1 -1
  341. package/dist/utils/calendarSystem.js +4 -1
  342. package/dist/utils/flatTree.d.ts +13 -0
  343. package/dist/utils/flatTree.d.ts.map +1 -1
  344. package/dist/utils/flatTree.js +28 -4
  345. package/dist/utils/inputAge.d.ts +22 -0
  346. package/dist/utils/inputAge.d.ts.map +1 -0
  347. package/dist/utils/inputAge.js +54 -0
  348. package/dist/utils/inputStream.d.ts +8 -0
  349. package/dist/utils/inputStream.d.ts.map +1 -1
  350. package/dist/utils/inputStream.js +53 -3
  351. package/dist/utils/moduleLoader.d.ts +23 -0
  352. package/dist/utils/moduleLoader.d.ts.map +1 -0
  353. package/dist/utils/moduleLoader.js +31 -0
  354. package/dist/utils/pressFeedback.d.ts.map +1 -1
  355. package/dist/utils/pressFeedback.js +13 -8
  356. package/dist/utils/selectionLock.d.ts.map +1 -1
  357. package/dist/utils/selectionLock.js +7 -14
  358. package/dist/utils/sharedContext.d.ts +18 -0
  359. package/dist/utils/sharedContext.d.ts.map +1 -0
  360. package/dist/utils/sharedContext.js +33 -0
  361. package/dist/utils/sharedRealm.d.ts +24 -0
  362. package/dist/utils/sharedRealm.d.ts.map +1 -0
  363. package/dist/utils/sharedRealm.js +38 -0
  364. package/locales/en.json +4 -0
  365. package/locales/pseudo.json +3 -0
  366. package/package.json +10 -5
  367. package/src/AppShell/AppShellMobileContext.tsx +8 -3
  368. package/src/AppShell/useAppShellMainId.ts +7 -2
  369. package/src/Avatar/AvatarSizeContext.ts +6 -2
  370. package/src/Avatar/AvatarStatusLabelContext.ts +8 -3
  371. package/src/AvatarGroup/AvatarGroupContext.ts +7 -4
  372. package/src/BottomSheet/BottomSheetHostContext.ts +7 -3
  373. package/src/BottomSheet/BottomSheetPanel.tsx +56 -7
  374. package/src/BottomSheet/BottomSheetSwitcherContext.ts +7 -2
  375. package/src/BottomSheet/bottomSheetEscape.ts +6 -2
  376. package/src/BottomSheet/bottomSheetStack.ts +6 -14
  377. package/src/BottomSheet/useSheetGestures.ts +28 -48
  378. package/src/Breadcrumbs/Breadcrumbs.tsx +6 -5
  379. package/src/Button/Button.doc.mjs +3 -3
  380. package/src/Button/Button.tsx +10 -22
  381. package/src/Button/buttonHitArea.ts +7 -4
  382. package/src/ButtonGroup/ButtonGroup.doc.mjs +3 -3
  383. package/src/ButtonGroup/ButtonGroup.tsx +27 -16
  384. package/src/ButtonGroup/ButtonGroupContext.ts +7 -4
  385. package/src/Carousel/Carousel.tsx +33 -15
  386. package/src/Chat/ChatContext.tsx +23 -7
  387. package/src/Chat/useChatStreamScroll.ts +7 -26
  388. package/src/CheckboxInput/CheckboxRowPressContext.ts +5 -1
  389. package/src/CheckboxList/CheckboxListContext.tsx +5 -1
  390. package/src/Collapsible/CollapsibleGroupContext.tsx +11 -3
  391. package/src/CommandPalette/CommandPaletteContext.ts +8 -3
  392. package/src/CommandPalette/busyStartSettle.ts +6 -2
  393. package/src/DateInput/TouchDateField.tsx +62 -4
  394. package/src/Dialog/DialogContext.ts +7 -2
  395. package/src/DropdownMenu/DropdownMenuContext.tsx +18 -5
  396. package/src/DropdownMenu/lazyMenuBottomSheet.ts +6 -18
  397. package/src/DropdownMenu/menuRegionStops.ts +1 -49
  398. package/src/FormLayout/FormLayoutContext.ts +3 -3
  399. package/src/Heading/Heading.tsx +34 -18
  400. package/src/HoverCard/HoverCard.doc.mjs +3 -3
  401. package/src/HoverCard/HoverCard.tsx +1 -2
  402. package/src/HoverCard/useHoverCard.tsx +6 -2
  403. package/src/Icon/IconDefaultSizeContext.ts +6 -2
  404. package/src/IconButton/IconButton.doc.mjs +2 -2
  405. package/src/InputGroup/InputGroupContext.ts +7 -4
  406. package/src/InputGroup/InputGroupInternalContext.ts +6 -2
  407. package/src/InteractiveRoleContext/InteractiveRoleContext.ts +8 -3
  408. package/src/Item/ItemDescriptionContext.tsx +7 -3
  409. package/src/Item/ItemListRowContext.tsx +7 -3
  410. package/src/Item/ItemMarkerColumnsContext.tsx +7 -2
  411. package/src/Layer/LayerContext.ts +7 -2
  412. package/src/Layer/LayerDepthContext.tsx +3 -2
  413. package/src/Layer/LayerTouch.ts +6 -2
  414. package/src/Layer/anchorName.ts +8 -4
  415. package/src/Layer/inputHold.ts +138 -21
  416. package/src/Layer/layerScopedContext.tsx +34 -7
  417. package/src/Layer/layerSlideRules.ts +43 -40
  418. package/src/Layer/outsidePress.ts +144 -28
  419. package/src/Layer/settledBox.ts +216 -54
  420. package/src/Layer/toastHost.tsx +6 -2
  421. package/src/Layer/useLayer.tsx +200 -69
  422. package/src/Layer/useLayerKeyboardClearance.ts +90 -12
  423. package/src/Layer/useTouchTrigger.ts +89 -40
  424. package/src/Layout/Layout.doc.mjs +17 -0
  425. package/src/Layout/Layout.tsx +13 -9
  426. package/src/Layout/LayoutAreaContext.ts +8 -9
  427. package/src/Layout/LayoutContent.doc.mjs +11 -0
  428. package/src/Layout/LayoutContent.tsx +9 -9
  429. package/src/Layout/LayoutDividerContext.ts +6 -2
  430. package/src/Layout/LayoutSlotsContext.ts +6 -3
  431. package/src/Link/LinkContext.ts +7 -3
  432. package/src/List/List.doc.mjs +5 -0
  433. package/src/List/List.tsx +53 -5
  434. package/src/List/ListContext.tsx +28 -6
  435. package/src/List/ListItem.doc.mjs +11 -0
  436. package/src/List/ListItem.tsx +51 -14
  437. package/src/List/listLayoutUpdates.ts +603 -0
  438. package/src/Markdown/Markdown.tsx +93 -5
  439. package/src/Markdown/blockDirection.ts +100 -0
  440. package/src/Markdown/plugins/HeadingLinksRenderer.tsx +4 -0
  441. package/src/MetadataList/MetadataListContext.tsx +6 -2
  442. package/src/NavMenu/NavMenuContext.tsx +14 -5
  443. package/src/Popover/Popover.tsx +23 -16
  444. package/src/Popover/usePopover.tsx +21 -7
  445. package/src/RadioList/RadioList.tsx +7 -4
  446. package/src/RadioList/RadioListReasonContext.ts +1 -1
  447. package/src/Section/Section.doc.mjs +22 -0
  448. package/src/SegmentedControl/SegmentedControlContext.ts +6 -2
  449. package/src/SelectableCard/selectableCardInput.ts +6 -2
  450. package/src/Selector/SelectorRowLayoutContext.ts +6 -2
  451. package/src/SideNav/SideNavCollapseButton.doc.mjs +5 -5
  452. package/src/SideNav/SideNavCollapseButton.tsx +4 -3
  453. package/src/SideNav/SideNavCollapseContext.ts +12 -7
  454. package/src/SideNav/SideNavFocusTargetsContext.ts +6 -2
  455. package/src/SideNav/SideNavItem.tsx +6 -2
  456. package/src/SideNav/SideNavRenderContext.ts +9 -8
  457. package/src/SideNav/railMotion.ts +6 -2
  458. package/src/SizeContext/SizeContext.ts +6 -2
  459. package/src/SnapPaging/SnapPaging.ts +164 -39
  460. package/src/SnapPaging/snapPagingValue.ts +59 -12
  461. package/src/Spinner/SpinnerOwnerContext.ts +6 -2
  462. package/src/Stepper/StepperContext.ts +12 -3
  463. package/src/Switch/useSwitchTouch.ts +7 -5
  464. package/src/TabList/TabListContext.ts +7 -2
  465. package/src/Table/BaseTable.tsx +143 -19
  466. package/src/Table/Table.tsx +4 -3
  467. package/src/Table/TableContext.ts +6 -2
  468. package/src/Table/index.ts +2 -0
  469. package/src/Table/plugins/filtering/useTableFiltering.tsx +11 -3
  470. package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +10 -3
  471. package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +38 -29
  472. package/src/Table/plugins/selection/useTableSelection.tsx +7 -2
  473. package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +1 -0
  474. package/src/Table/plugins/tree/useTableTreeData.tsx +6 -2
  475. package/src/Table/tableRowContextUsage.ts +105 -0
  476. package/src/Table/types.ts +60 -2
  477. package/src/Table/useBaseTablePlugins.ts +5 -2
  478. package/src/Table/useTableRowIndex.doc.mjs +6 -7
  479. package/src/Text/Text.tsx +34 -18
  480. package/src/Text/TruncationTooltip.tsx +179 -0
  481. package/src/Text/textClampContext.ts +5 -1
  482. package/src/TimeInput/TimeInput.tsx +4 -0
  483. package/src/ToggleButton/ToggleButtonGroup.tsx +6 -2
  484. package/src/Token/TokenNamingContext.ts +6 -2
  485. package/src/Tokenizer/TokenizerClearAllMessageContext.ts +4 -4
  486. package/src/Tokenizer/TokenizerItemRemovableContext.ts +3 -3
  487. package/src/Toolbar/Toolbar.tsx +16 -9
  488. package/src/Tooltip/tooltipPresentInterest.ts +43 -0
  489. package/src/Tooltip/useTooltip.tsx +33 -0
  490. package/src/TopNav/TopNavContext.ts +6 -2
  491. package/src/TopNav/TopNavMobileContentContext.ts +8 -3
  492. package/src/TopNav/TopNavRenderContext.ts +8 -4
  493. package/src/Typeahead/busyIndicatorLane.tsx +7 -2
  494. package/src/Typeahead/committedChoicesKey.tsx +4 -3
  495. package/src/Typeahead/trailingKeyDown.tsx +7 -2
  496. package/src/gestures/GestureArena.ts +8 -1
  497. package/src/gestures/GestureRecognizer.ts +9 -0
  498. package/src/gestures/PressTracker.ts +13 -4
  499. package/src/hooks/focusableSelector.ts +29 -1
  500. package/src/hooks/longPressDetector.ts +1 -35
  501. package/src/hooks/pressGroupContext.ts +5 -1
  502. package/src/hooks/useActionGroupTracking.ts +29 -2
  503. package/src/hooks/useAnnounce.ts +8 -4
  504. package/src/hooks/useFocusTrap.ts +62 -2
  505. package/src/hooks/useListFocus.ts +34 -7
  506. package/src/hooks/usePager.ts +30 -3
  507. package/src/hooks/useScrollOverflow.ts +65 -7
  508. package/src/i18n/InternationalizationContext.ts +12 -8
  509. package/src/i18n/englishFallback.ts +7 -1
  510. package/src/i18n/firstStrongDirection.ts +69 -0
  511. package/src/i18n/generated-locales/en.generated.ts +1 -0
  512. package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
  513. package/src/internal/scroll-anchoring.ts +16 -0
  514. package/src/internal/touch.ts +4 -0
  515. package/src/motion/animatedLayout.ts +44 -3
  516. package/src/motion/animator.ts +97 -9
  517. package/src/privateAttributes/itemKey.stylex.ts +25 -0
  518. package/src/privateAttributes/leaving.stylex.ts +23 -0
  519. package/src/privateAttributes/press.stylex.ts +19 -7
  520. package/src/privateAttributes/scrollAnchoring.stylex.ts +50 -0
  521. package/src/privateAttributes/travelling.stylex.ts +88 -0
  522. package/src/theme/Theme.tsx +124 -60
  523. package/src/theme/syntax/SyntaxTheme.tsx +7 -2
  524. package/src/theme/useTheme.ts +7 -8
  525. package/src/utils/calendarSystem.ts +7 -1
  526. package/src/utils/flatTree.ts +31 -4
  527. package/src/utils/inputAge.ts +66 -0
  528. package/src/utils/inputStream.ts +52 -3
  529. package/src/utils/moduleLoader.ts +47 -0
  530. package/src/utils/pressFeedback.ts +16 -7
  531. package/src/utils/selectionLock.ts +8 -18
  532. package/src/utils/sharedContext.ts +42 -0
  533. package/src/utils/sharedRealm.ts +42 -0
@@ -18,23 +18,26 @@ import * as stylex from '@stylexjs/stylex';
18
18
  import { createPortal } from 'react-dom';
19
19
  import { LayerContentBoundary } from "./layerScopedContext.js";
20
20
  import { layerClickBoundary } from "./layerClickBoundary.js";
21
- import { addAnchorName, removeAnchorName } from "./anchorName.js";
21
+ import { addAnchorName, readAnchorNames, removeAnchorName } from "./anchorName.js";
22
22
  import { currentGesture, currentGestureHasClicked } from "./gestureCounter.js";
23
23
  import { resolveLayerPortalTarget } from "./layerHost.js";
24
24
  import { layerTextReset } from "./layerTextReset.stylex.js";
25
25
  import { layerStructureReset } from "./layerStructureReset.stylex.js";
26
26
  import "./layerViewportInset.stylex.js";
27
27
  import { layerViewportInset } from "./layerViewportInset.stylex.js";
28
- import { useLayerKeyboardClearance } from "./LayerTouch.js";
28
+ import { keyboardLiftStyle, useLayerKeyboardClearance } from "./LayerTouch.js";
29
29
  import { LAYER_ANCHORED_ATTRIBUTE } from "./layerKeyboardClearance.js";
30
30
  import { settledBox } from "./settledBox.js";
31
31
  import { layerInsetProperties } from "./layerInset.js";
32
- import { LAYER_CLEARANCE_PROPERTY, LAYER_CLEARS_ANCHOR_ATTRIBUTE, LAYER_SCROLLS_ATTRIBUTE, LAYER_CLEAR_FALLBACKS_PROPERTY, LAYER_TRY_FALLBACKS_PROPERTY, ensureSlideRules, getAnchorClearFallbacks, slideRuleName } from "./layerSlideRules.js";
32
+ import { LAYER_CLEARANCE_PROPERTY, LAYER_SCROLLS_ATTRIBUTE, ensureSlideRules, anchorClearAlignment, getAnchorClearFallbacks, slideRuleName } from "./layerSlideRules.js";
33
33
  import { afterPopoverOperations, isBrowserHideInFlight, isPopoverOperationInFlight, observeBrowserHide, runPopoverOperation } from "./popoverOperations.js";
34
34
  import { preserveAnimations } from "./preserveAnimations.js";
35
35
  import { useLayerContext } from "./LayerContext.js";
36
36
  import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
37
37
  import { overlayPaddingReset } from "../Layout/overlayPaddingReset.stylex.js";
38
+ import { containsAlongFlatTree, parentAcrossShadow } from "../utils/flatTree.js";
39
+ import { isShadowRoot } from "../utils/nodeType.js";
40
+ import { subscribeInput } from "../utils/inputStream.js";
38
41
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
39
42
  const _temp = {
40
43
  keoZOQ: "x1vhfslr",
@@ -274,37 +277,25 @@ function failsAnchor(layer, anchor) {
274
277
  }
275
278
 
276
279
  /**
277
- * For a layer that must never settle over its anchor (spec:AST-059 FR4): read
278
- * where its fallback list settled it and, if its box covers the anchor or,
279
- * while the anchor is in view, leaves the viewport on the block axis, switch it
280
- * to its anchor-clear list; then let it scroll only if its content overflows
281
- * the box it was given (FR3). Engines differ in where they leave a box that
282
- * fits no option: Chromium shifts it into the viewport, over the anchor; WebKit
283
- * keeps it at its preferred position, partly off-screen. Either way the
284
- * standard list has failed it. The runtime calls this in the same task as
285
- * every show and remount, and while the layer is open whenever its size, its
286
- * content's size, its anchor's size or the viewport changes; each of those
287
- * reads lands before the next frame paints. A same-size anchor that moves on
288
- * screen, in layout or because something scrolled, is reported after paint by
289
- * the anchor-move observer and read in the next frame, before it paints (FR8).
290
- * Scroll events are not read: during one the
291
- * anchor has moved but the layer anchored to it not yet, so the read would
292
- * compare a moved anchor with a stale layer. Once switched, a layer keeps its
293
- * anchor-clear list until it next opens, so it never jumps back over its
294
- * trigger while open; it is placed afresh (`placeAfresh`) only when the switch
295
- * does not take effect at once, or when a later read finds it failing again.
280
+ * For a layer that must never settle over its anchor (spec:AST-059 FR4). Every
281
+ * option of its one combined fallback list keeps it clear of its anchor, and
282
+ * the engine picks one. Where the box still covers the anchor or, while the
283
+ * anchor is in view, leaves the viewport on the block axis, the layer is
284
+ * placed afresh (`placeAfresh`) from that list. Then it scrolls only if its
285
+ * content overflows the box it was given (FR3). The runtime calls this in the
286
+ * same task as every show and remount, and while the layer is open whenever
287
+ * its size, its content's size, its anchor's size or the viewport changes;
288
+ * each of those reads lands before the next frame paints. It also runs once
289
+ * in the first frame painted after a scroll of the anchor stops
290
+ * (`observeScrollStop`), because during a scroll the browser does not choose
291
+ * an option again. A same-size anchor that moves on screen, in layout or
292
+ * because something scrolled, is reported after paint by the anchor-move
293
+ * observer. That call does not check the box and never places the layer
294
+ * afresh, so the layer never jumps to another side mid-scroll.
296
295
  */
297
- function keepAnchorClear(layer, anchor) {
298
- if (anchor && failsAnchor(layer, anchor)) {
299
- const switching = !layer.hasAttribute(LAYER_CLEARS_ANCHOR_ATTRIBUTE);
300
- layer.setAttribute(LAYER_CLEARS_ANCHOR_ATTRIBUTE, '');
301
- // A switch usually takes effect at once. The engine may instead keep the
302
- // option it last used, even one the new list does not contain or one a
303
- // scroll has since made fail: then, and on any later read that finds the
304
- // switched layer failing again, place it afresh.
305
- if (!switching || failsAnchor(layer, anchor)) {
306
- placeAfresh(layer);
307
- }
296
+ function keepAnchorClear(layer, anchor, cause = 'change') {
297
+ if (cause === 'change' && anchor && failsAnchor(layer, anchor)) {
298
+ placeAfresh(layer);
308
299
  }
309
300
  // A layer that fits has no scroll range and stays a plain box, so a wheel
310
301
  // over it still scrolls the page.
@@ -442,21 +433,125 @@ function observeMove(element, onMove) {
442
433
  return stop;
443
434
  }
444
435
 
436
+ /**
437
+ * How long a scroll must stay still, in ms, to count as stopped where the
438
+ * browser does not fire `scrollend`.
439
+ */
440
+ const SCROLL_STILL_MS = 150;
441
+
442
+ /**
443
+ * The shadow roots along `node`'s flat-tree path. `scroll` and `scrollend`
444
+ * are not composed, so a scroll inside a shadow tree reaches its shadow root
445
+ * but not the window.
446
+ */
447
+ function shadowRootsAbove(node) {
448
+ const roots = [];
449
+ for (let current = node; current; current = parentAcrossShadow(current)) {
450
+ const root = current.getRootNode();
451
+ if (isShadowRoot(root) && !roots.includes(root)) {
452
+ roots.push(root);
453
+ }
454
+ }
455
+ return roots;
456
+ }
457
+
458
+ /**
459
+ * Calls `onStop` once each time a scroll of the page or of an ancestor of
460
+ * `anchor` stops, in the first frame painted after it stops. During a scroll,
461
+ * Chromium does not choose a layer's position option again, so the layer is
462
+ * checked once the scroll stops. A scroll stops at `scrollend`; where the
463
+ * browser does not fire it, a scroll stops after `SCROLL_STILL_MS` with no
464
+ * `scroll` event. A scroll that starts again before the check cancels it. No
465
+ * handler reads layout.
466
+ */
467
+ function observeScrollStop(view, anchor, onStop) {
468
+ let frame = null;
469
+ let timer = null;
470
+ const cancel = () => {
471
+ if (frame !== null) {
472
+ view.cancelAnimationFrame(frame);
473
+ frame = null;
474
+ }
475
+ if (timer !== null) {
476
+ view.clearTimeout(timer);
477
+ timer = null;
478
+ }
479
+ };
480
+ // At `scrollend`, and in the frame after it, Chromium still reads the
481
+ // anchored layer at its position before the scroll. After one painted
482
+ // frame it reads the position the scroll gave it.
483
+ const callAfterNextPaint = () => {
484
+ cancel();
485
+ frame = view.requestAnimationFrame(() => {
486
+ frame = null;
487
+ timer = view.setTimeout(() => {
488
+ timer = null;
489
+ frame = view.requestAnimationFrame(() => {
490
+ frame = null;
491
+ onStop();
492
+ });
493
+ });
494
+ });
495
+ };
496
+ const firesScrollEnd = view.onscrollend !== undefined;
497
+ const isAnchorScroll = event => containsAlongFlatTree(event.target, anchor);
498
+ const onScroll = event => {
499
+ if (!isAnchorScroll(event)) {
500
+ return;
501
+ }
502
+ cancel();
503
+ if (!firesScrollEnd) {
504
+ timer = view.setTimeout(() => {
505
+ timer = null;
506
+ callAfterNextPaint();
507
+ }, SCROLL_STILL_MS);
508
+ }
509
+ };
510
+ const onScrollEnd = event => {
511
+ if (isAnchorScroll(event)) {
512
+ callAfterNextPaint();
513
+ }
514
+ };
515
+ const unsubscribes = [subscribeInput(view, 'scroll', onScroll)];
516
+ if (firesScrollEnd) {
517
+ unsubscribes.push(subscribeInput(view, 'scrollend', onScrollEnd));
518
+ }
519
+ const listening = {
520
+ capture: true,
521
+ passive: true
522
+ };
523
+ const shadowRoots = shadowRootsAbove(anchor);
524
+ for (const shadowRoot of shadowRoots) {
525
+ shadowRoot.addEventListener('scroll', onScroll, listening);
526
+ if (firesScrollEnd) {
527
+ shadowRoot.addEventListener('scrollend', onScrollEnd, listening);
528
+ }
529
+ }
530
+ return () => {
531
+ for (const unsubscribe of unsubscribes) {
532
+ unsubscribe();
533
+ }
534
+ for (const shadowRoot of shadowRoots) {
535
+ shadowRoot.removeEventListener('scroll', onScroll, listening);
536
+ shadowRoot.removeEventListener('scrollend', onScrollEnd, listening);
537
+ }
538
+ cancel();
539
+ };
540
+ }
541
+
445
542
  /**
446
543
  * Watch an open layer that keeps its anchor clear, and its anchor, for every
447
544
  * change that can re-settle the layer over the anchor or give it a scroll
448
545
  * range (spec:AST-059 FR4, FR8): the layer, its content or the anchor
449
546
  * resizing (ResizeObserver, before paint), the viewport resizing (before
450
- * paint), and the anchor moving on screen without resizing, in layout or by a
451
- * scroll (`observeMove`, reported after paint). Each calls `keepAnchorClear`
452
- * for this layer and anchor while `isCurrent` says they are still the live
453
- * pair. A move is read in the next animation frame, not in the task that
454
- * reports it: placing the layer afresh there, right after the frame that
455
- * scrolled its anchor, lets Chromium lay it out for one more frame against
456
- * the anchor's position before the scroll, over the anchor, so the second
457
- * painted frame would still cover it. Read in the next frame, before it
458
- * paints, the fresh placement uses the moved anchor. Reports in one frame
459
- * share one read. Returns the function that removes every observer and
547
+ * paint), a scroll of the anchor stopping (`observeScrollStop`, in the first
548
+ * frame painted after it), and the anchor moving on screen without resizing,
549
+ * in layout or by a scroll (`observeMove`, reported after paint). Each calls
550
+ * `keepAnchorClear` for this layer and anchor while `isCurrent` says they
551
+ * are still the live pair. A move is handled in the next animation frame, not
552
+ * in the task that reports it, and only updates whether the layer scrolls: it
553
+ * never checks the box and never places the layer afresh. Reports in one
554
+ * frame share one call. Returns the function that removes every observer and
460
555
  * listener it added.
461
556
  */
462
557
  function observeAnchorClearance(layer, anchor, isCurrent) {
@@ -464,14 +559,15 @@ function observeAnchorClearance(layer, anchor, isCurrent) {
464
559
  if (!view) {
465
560
  return () => {};
466
561
  }
467
- const reread = () => {
562
+ const reread = (cause = 'change') => {
468
563
  if (isCurrent()) {
469
- keepAnchorClear(layer, anchor);
564
+ keepAnchorClear(layer, anchor, cause);
470
565
  }
471
566
  };
567
+ const rereadAfterChange = () => reread('change');
472
568
  let observer = null;
473
569
  if (typeof ResizeObserver !== 'undefined') {
474
- observer = new ResizeObserver(reread);
570
+ observer = new ResizeObserver(rereadAfterChange);
475
571
  observer.observe(layer);
476
572
  for (const child of Array.from(layer.children)) {
477
573
  observer.observe(child);
@@ -485,18 +581,20 @@ function observeAnchorClearance(layer, anchor, isCurrent) {
485
581
  }
486
582
  moveFrame = view.requestAnimationFrame(() => {
487
583
  moveFrame = null;
488
- reread();
584
+ reread('move');
489
585
  });
490
586
  });
491
- view.addEventListener('resize', reread);
587
+ view.addEventListener('resize', rereadAfterChange);
588
+ const stopObservingScrollStop = observeScrollStop(view, anchor, rereadAfterChange);
492
589
  return () => {
493
590
  observer?.disconnect();
494
591
  stopObservingMove();
592
+ stopObservingScrollStop();
495
593
  if (moveFrame !== null) {
496
594
  view.cancelAnimationFrame(moveFrame);
497
595
  moveFrame = null;
498
596
  }
499
- view.removeEventListener('resize', reread);
597
+ view.removeEventListener('resize', rereadAfterChange);
500
598
  };
501
599
  }
502
600
 
@@ -1019,7 +1117,6 @@ function useLayerImplementation(options) {
1019
1117
  // before the writes of the show, so the read lays nothing out.
1020
1118
  const closeTransitionHolds = closeTransitionKeepsShown(popover);
1021
1119
  const closedAnimations = animationNames(popover);
1022
- popover.removeAttribute(LAYER_CLEARS_ANCHOR_ATTRIBUTE);
1023
1120
  popover.removeAttribute(LAYER_SCROLLS_ATTRIBUTE);
1024
1121
  applyDeferredWritingContext(popover);
1025
1122
  // The trigger takes the layer's anchor name in the task that shows the
@@ -1203,11 +1300,25 @@ function useLayerImplementation(options) {
1203
1300
  const handleBeforeToggle = useCallback(e => {
1204
1301
  const toggleEvent = e;
1205
1302
  const el = e.currentTarget;
1206
- if (toggleEvent.newState === 'closed' && isOpenRef.current && el != null) {
1303
+ if (toggleEvent.newState !== 'closed' || el == null) {
1304
+ return;
1305
+ }
1306
+ if (isOpenRef.current) {
1207
1307
  observeBrowserHide(el);
1208
1308
  onCloseStartRef.current?.();
1309
+ // The browser's own close releases the name from its toggle event.
1310
+ return;
1209
1311
  }
1210
- }, []);
1312
+ // Our hide drops its trigger's anchor name here, inside the hide, so the
1313
+ // hide's own layout covers the change. A name dropped after that layout
1314
+ // costs one more. A layer that the closed state keeps shown keeps the
1315
+ // name until its exit ends.
1316
+ const trigger = triggerRef.current;
1317
+ if (trigger != null && readAnchorNames(trigger).includes(anchorId) && !closeKeepsShownRef.current) {
1318
+ exitRef.current = null;
1319
+ removeAnchorName(trigger, anchorId);
1320
+ }
1321
+ }, [anchorId]);
1211
1322
  const handleToggle = useCallback(e => {
1212
1323
  const toggleEvent = e;
1213
1324
  if (toggleEvent.newState === 'closed' && isOpenRef.current) {
@@ -1247,6 +1358,7 @@ function useLayerImplementation(options) {
1247
1358
  // block-start edge and ends clear of the keyboard.
1248
1359
  const {
1249
1360
  cap: keyboardCap,
1361
+ lift: keyboardLift,
1250
1362
  inset: keyboardInset,
1251
1363
  followLayerElement
1252
1364
  } = useLayerKeyboardClearance(isOpen && mode === 'context', popoverRef);
@@ -1384,12 +1496,9 @@ function useLayerImplementation(options) {
1384
1496
 
1385
1497
  // CSS anchor positioning (dynamic, not in StyleX)
1386
1498
  const standardFallbacks = getPositionTryFallbacks(placement, alignment);
1387
- // A layer that keeps its anchor clear carries a second list; `show()`
1388
- // switches to it when the standard list settles over the anchor (FR4).
1499
+ // An above or below layer that keeps its anchor clear uses one combined
1500
+ // list whose options never overlap the anchor (FR4).
1389
1501
  const clearFallbacks = keepsAnchorClear && positioning === 'anchor' ? getAnchorClearFallbacks(placement) : '';
1390
- const clearFallbacksProperty = clearFallbacks ? {
1391
- [LAYER_CLEAR_FALLBACKS_PROPERTY]: clearFallbacks
1392
- } : {};
1393
1502
  const anchorStyle = positioning === 'custom' ?
1394
1503
  // Consumer authors its own position styles via `style` — keep
1395
1504
  // only the anchor wiring, derive nothing from placement.
@@ -1398,7 +1507,10 @@ function useLayerImplementation(options) {
1398
1507
  } : {
1399
1508
  positionAnchor: anchorId,
1400
1509
  positionArea: getPositionArea(placement, alignment),
1401
- positionTryFallbacks: clearFallbacks ? `var(${LAYER_TRY_FALLBACKS_PROPERTY}, ${standardFallbacks})` : standardFallbacks,
1510
+ positionTryFallbacks: clearFallbacks || standardFallbacks,
1511
+ ...(clearFallbacks ? {
1512
+ alignSelf: anchorClearAlignment(placement)
1513
+ } : {}),
1402
1514
  ...getSelfAlignment(placement, alignment, isAnchorInView)
1403
1515
  };
1404
1516
  const clearance = offset ? toCssLength(offset) : null;
@@ -1431,8 +1543,8 @@ function useLayerImplementation(options) {
1431
1543
  style: {
1432
1544
  ...stylexResult.style,
1433
1545
  ...anchorStyle,
1546
+ ...keyboardLiftStyle(keyboardLift),
1434
1547
  ...clearanceProperty,
1435
- ...clearFallbacksProperty,
1436
1548
  ...layerInsetProperties(declaredInset),
1437
1549
  ...mount.portalStyle,
1438
1550
  ...extraStyle
@@ -1452,7 +1564,7 @@ function useLayerImplementation(options) {
1452
1564
  renderLayer: renderLayer,
1453
1565
  sentinelRef: sentinelRefCallback
1454
1566
  });
1455
- }, [anchorId, declaredInset, id, isAnchorInView, keepsAnchorClear, keyboardCap, keyboardInset, lightDismiss, mountStore, popoverRefCallback, sentinelRefCallback]);
1567
+ }, [anchorId, declaredInset, id, isAnchorInView, keepsAnchorClear, keyboardCap, keyboardInset, keyboardLift, lightDismiss, mountStore, popoverRefCallback, sentinelRefCallback]);
1456
1568
 
1457
1569
  // Render function for fixed mode
1458
1570
  const renderFixed = useCallback((children, props) => {
@@ -3,7 +3,7 @@
3
3
  * @input Whether an anchor-mode layer is open, its element, and the keyboard
4
4
  * module: its one height, and its layout guide for timing.
5
5
  * @output Exports `useLayerKeyboardClearance` and its result type,
6
- * `keyboardClearanceCap`, `LAYER_ANCHORED_ATTRIBUTE`,
6
+ * `keyboardLiftStyle`, `keyboardClearanceCap`, `LAYER_ANCHORED_ATTRIBUTE`,
7
7
  * `LAYER_KEYBOARD_CAP_PROPERTY`, `LAYER_KEYBOARD_OVERFLOW_PROPERTY`,
8
8
  * `LAYER_KEYBOARD_INSET_PROPERTY` and `LAYER_KEYBOARD_CLEARANCE_PX`
9
9
  * @position Layer runtime, through the layer's touch module: the software
@@ -17,7 +17,7 @@
17
17
  * - /packages/core/src/Selector/hooks.ts
18
18
  * - /docs/specs/AST-059-layer-viewport-inset/spec.md
19
19
  */
20
- import { type RefObject } from 'react';
20
+ import { type CSSProperties, type RefObject } from 'react';
21
21
  export { keyboardClearanceCap, LAYER_ANCHORED_ATTRIBUTE, LAYER_KEYBOARD_CLEARANCE_PX, } from './layerKeyboardClearance.js';
22
22
  /**
23
23
  * The custom property each layer's style sets (useLayer.tsx's `keyboardCap`
@@ -41,10 +41,22 @@ export declare const LAYER_KEYBOARD_OVERFLOW_PROPERTY = "--_layer-keyboard-overf
41
41
  * keyboard with it before the cap measures, and stays there.
42
42
  */
43
43
  export declare const LAYER_KEYBOARD_INSET_PROPERTY = "--_layer-keyboard-inset-block-end";
44
+ /**
45
+ * The insets that move a capped layer's anchor area `lift` px toward the
46
+ * block-start, or null without a lift. They hold the layer's block-start edge
47
+ * where it was when the cap landed (`LayerKeyboardClearance.lift`).
48
+ */
49
+ export declare function keyboardLiftStyle(lift: number | null): CSSProperties | null;
44
50
  /** What `useLayerKeyboardClearance` gives the layer runtime. */
45
51
  export interface LayerKeyboardClearance {
46
52
  /** The block size that keeps the layer clear of the keyboard, or null. */
47
53
  readonly cap: number | null;
54
+ /**
55
+ * While the cap holds the layer, how far its block-start edge sits above
56
+ * the place the fallback order picks for the shorter box, in px. The
57
+ * runtime applies it with `keyboardLiftStyle`. Otherwise null.
58
+ */
59
+ readonly lift: number | null;
48
60
  /**
49
61
  * Once a software keyboard is up, the layout px between the layout
50
62
  * viewport's bottom and the line an anchored layer ends above. It keeps its
@@ -1 +1 @@
1
- {"version":3,"file":"useLayerKeyboardClearance.d.ts","sourceRoot":"","sources":["../../src/Layer/useLayerKeyboardClearance.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAgC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAmBpE,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC;AAElC;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,qCAAqC,CAAC;AAE9E;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,+BAA+B,CAAC;AA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AAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,kBAAkB,EAAE,MAAM,IAAI,CAAC;CACzC;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GACtC,sBAAsB,CAmVxB"}
@@ -7,7 +7,7 @@
7
7
  * @input Whether an anchor-mode layer is open, its element, and the keyboard
8
8
  * module: its one height, and its layout guide for timing.
9
9
  * @output Exports `useLayerKeyboardClearance` and its result type,
10
- * `keyboardClearanceCap`, `LAYER_ANCHORED_ATTRIBUTE`,
10
+ * `keyboardLiftStyle`, `keyboardClearanceCap`, `LAYER_ANCHORED_ATTRIBUTE`,
11
11
  * `LAYER_KEYBOARD_CAP_PROPERTY`, `LAYER_KEYBOARD_OVERFLOW_PROPERTY`,
12
12
  * `LAYER_KEYBOARD_INSET_PROPERTY` and `LAYER_KEYBOARD_CLEARANCE_PX`
13
13
  * @position Layer runtime, through the layer's touch module: the software
@@ -83,6 +83,18 @@ function keepInView(layer, target) {
83
83
  }
84
84
  }
85
85
 
86
+ /**
87
+ * The insets that move a capped layer's anchor area `lift` px toward the
88
+ * block-start, or null without a lift. They hold the layer's block-start edge
89
+ * where it was when the cap landed (`LayerKeyboardClearance.lift`).
90
+ */
91
+ export function keyboardLiftStyle(lift) {
92
+ return lift == null ? null : {
93
+ insetBlockStart: -lift,
94
+ insetBlockEnd: lift
95
+ };
96
+ }
97
+
86
98
  /** What `useLayerKeyboardClearance` gives the layer runtime. */
87
99
 
88
100
  /**
@@ -96,9 +108,11 @@ function keepInView(layer, target) {
96
108
  */
97
109
  export function useLayerKeyboardClearance(isOpen, layerRef) {
98
110
  const [cap, setCap] = useState(null);
111
+ const [lift, setLift] = useState(null);
99
112
  const [keyboardInset, setKeyboardInset] = useState(null);
100
113
  // The cap the layer renders with, read by the measurement between commits.
101
114
  const capRef = useRef(null);
115
+ const liftRef = useRef(null);
102
116
  const keyboardInsetRef = useRef(null);
103
117
  // Set while the layer is open: follows the runtime when it replaces the
104
118
  // layer element without closing it.
@@ -120,29 +134,51 @@ export function useLayerKeyboardClearance(isOpen, layerRef) {
120
134
  // replace the layer element while it stays open; `sync` moves both to the
121
135
  // element the ref holds now.
122
136
  let layer = initial;
137
+ // The field reveal after a cap stands down if a person's input reached
138
+ // the layer since the cap.
139
+ let personInputs = 0;
140
+ const notePersonInput = () => {
141
+ personInputs += 1;
142
+ };
123
143
  const sync = () => {
124
144
  const next = layerRef.current;
125
145
  if (next == null || next === layer) {
126
146
  return false;
127
147
  }
128
148
  layer.removeEventListener('pointerdown', handlePress, true);
149
+ layer.removeEventListener('touchstart', notePersonInput, {
150
+ capture: true
151
+ });
152
+ layer.removeEventListener('wheel', notePersonInput, {
153
+ capture: true
154
+ });
129
155
  layer = next;
130
156
  layer.addEventListener('pointerdown', handlePress, true);
157
+ layer.addEventListener('touchstart', notePersonInput, {
158
+ capture: true,
159
+ passive: true
160
+ });
161
+ layer.addEventListener('wheel', notePersonInput, {
162
+ capture: true,
163
+ passive: true
164
+ });
131
165
  return true;
132
166
  };
133
167
  // Renders the layer with `next` and returns once that commit has laid it
134
168
  // out, so the measurement after it reads the new box. Runs outside
135
169
  // React's own work: keyboard reports, timers, frames and native events.
136
- const commitCap = (next, nextInset = keyboardInsetRef.current) => {
137
- if (isDisposed || capRef.current === next && keyboardInsetRef.current === nextInset) {
170
+ const commitCap = (next, nextInset = keyboardInsetRef.current, nextLift = null) => {
171
+ if (isDisposed || capRef.current === next && keyboardInsetRef.current === nextInset && liftRef.current === nextLift) {
138
172
  return;
139
173
  }
140
174
  capRef.current = next;
141
175
  keyboardInsetRef.current = nextInset;
176
+ liftRef.current = nextLift;
142
177
  // eslint-disable-next-line @eslint-react/dom-no-flush-sync -- the box is measured at its new size in the same task, before the frame paints
143
178
  flushSync(() => {
144
179
  setCap(next);
145
180
  setKeyboardInset(nextInset);
181
+ setLift(nextLift);
146
182
  });
147
183
  sync();
148
184
  };
@@ -168,14 +204,24 @@ export function useLayerKeyboardClearance(isOpen, layerRef) {
168
204
  return false;
169
205
  }
170
206
  commitCap(height);
171
- // A layer too tall for the room below its trigger can sit higher, over
172
- // the trigger, where the viewport fit placed it. Shorter, it goes back
173
- // below the trigger: cap it again from where it starts now.
207
+ // A layer too tall for the room on both sides of its trigger sits over
208
+ // the trigger, where the viewport fit shifted it. Shorter, it fits below
209
+ // the trigger, and the fallback order moves it down. Lift it back, so it
210
+ // keeps the block-start edge it had when the cap landed. A layer that
211
+ // holds its block-end edge (placed above its trigger) moves only its
212
+ // top, and is not lifted.
174
213
  const placed = settledBox(layer);
175
- if (placed.top > box.top + 1) {
176
- const again = keyboardClearanceCap(placed, viewport, inset);
177
- if (again != null) {
178
- commitCap(again);
214
+ if (placed.top > box.top + 1 && Math.abs(placed.bottom - box.bottom) > 1) {
215
+ commitCap(height, keyboardInsetRef.current, placed.top - box.top);
216
+ // An engine that does not move the layer by the lift leaves it below
217
+ // the trigger: cap it from where it starts there.
218
+ const lifted = settledBox(layer);
219
+ if (Math.abs(lifted.top - box.top) > 1) {
220
+ commitCap(height);
221
+ const again = keyboardClearanceCap(placed, viewport, inset);
222
+ if (again != null) {
223
+ commitCap(again);
224
+ }
179
225
  }
180
226
  }
181
227
  // The cap holds the block-start edge: below its trigger the top stays
@@ -199,11 +245,16 @@ export function useLayerKeyboardClearance(isOpen, layerRef) {
199
245
  }
200
246
  // The composing component makes its surface a scroll container once it
201
247
  // overflows. That comes a frame later, as its observer reports the
202
- // smaller box. Keep the field being typed into in view after that.
248
+ // smaller box. Keep the field being typed into in view after that. A
249
+ // person who presses, touches or turns a wheel in the layer by then has
250
+ // placed its content, so the reveal stands down. A component's own
251
+ // scroll, such as a list keeping its active option in view, does not
252
+ // stop it. The next cap reveals the field again.
203
253
  const focused = layer.ownerDocument.activeElement;
204
254
  if (focused != null && focused !== layer && layer.contains(focused)) {
255
+ const inputsAtCap = personInputs;
205
256
  win.requestAnimationFrame(() => win.requestAnimationFrame(() => {
206
- if (!isDisposed) {
257
+ if (!isDisposed && personInputs === inputsAtCap) {
207
258
  keepInView(layer, focused);
208
259
  }
209
260
  }));
@@ -249,6 +300,7 @@ export function useLayerKeyboardClearance(isOpen, layerRef) {
249
300
  run?.();
250
301
  };
251
302
  function handlePress(event) {
303
+ notePersonInput();
252
304
  if (pressed.size === 0) {
253
305
  follow();
254
306
  }
@@ -268,6 +320,14 @@ export function useLayerKeyboardClearance(isOpen, layerRef) {
268
320
  });
269
321
  }
270
322
  layer.addEventListener('pointerdown', handlePress, true);
323
+ layer.addEventListener('touchstart', notePersonInput, {
324
+ capture: true,
325
+ passive: true
326
+ });
327
+ layer.addEventListener('wheel', notePersonInput, {
328
+ capture: true,
329
+ passive: true
330
+ });
271
331
  const unsubscribe = guide.subscribe(transition => {
272
332
  cancelPending();
273
333
  if (transition.animated && transition.to > transition.from) {
@@ -335,12 +395,22 @@ export function useLayerKeyboardClearance(isOpen, layerRef) {
335
395
  cancelPending();
336
396
  stopWaiting?.();
337
397
  layer.removeEventListener('pointerdown', handlePress, true);
398
+ layer.removeEventListener('touchstart', notePersonInput, {
399
+ capture: true
400
+ });
401
+ layer.removeEventListener('wheel', notePersonInput, {
402
+ capture: true
403
+ });
338
404
  unfollow();
339
405
  // A closed layer reopens at its own size.
340
406
  if (capRef.current != null) {
341
407
  capRef.current = null;
342
408
  setCap(null);
343
409
  }
410
+ if (liftRef.current != null) {
411
+ liftRef.current = null;
412
+ setLift(null);
413
+ }
344
414
  if (keyboardInsetRef.current != null) {
345
415
  keyboardInsetRef.current = null;
346
416
  setKeyboardInset(null);
@@ -352,6 +422,7 @@ export function useLayerKeyboardClearance(isOpen, layerRef) {
352
422
  }, []);
353
423
  return {
354
424
  cap: isOpen ? cap : null,
425
+ lift: isOpen ? lift : null,
355
426
  inset: isOpen ? keyboardInset : null,
356
427
  followLayerElement
357
428
  };
@@ -2,7 +2,8 @@
2
2
  * @file useTouchTrigger.ts
3
3
  * @input Touch trigger mode, layer open state, trigger ref, show/hide callbacks
4
4
  * @output Exports useTouchTrigger hook, isActionTrigger, LayerTouchTrigger type,
5
- * tapLandsOnDisabledControl, TOUCH_POINTER_TYPES and useTapStop (internal:
5
+ * tapLandsOnDisabledControl, TOUCH_POINTER_TYPES, useTapRecognizer and
6
+ * useTapStop (internal:
6
7
  * not re-exported from index). Also useTouchTriggerInternal, with the
7
8
  * outside dismissal's arm for useTooltip's hold (Core-internal).
8
9
  * @position Layer hook; shared touch behavior for useTooltip and useHoverCard
@@ -57,6 +58,20 @@ export type LayerTouchTrigger = 'auto' | 'tap' | 'none';
57
58
  * once it lands. See `handlePointerEnter`.
58
59
  */
59
60
  export declare const TOUCH_POINTER_TYPES: Set<string>;
61
+ /** Waits for the tap that a touch or pen press may become. Internal. */
62
+ export interface TapRecognizer {
63
+ /**
64
+ * Call on every press. A touch or pen press on `trigger` waits for its tap:
65
+ * the press's own `click`. A touch the browser takes for a scroll or a
66
+ * pinch (`pointercancel`) is no tap, and a new press replaces one still
67
+ * waiting. Returns whether the press is touch or pen.
68
+ */
69
+ press(event: PointerEvent, trigger: Element | null, onTap: (tapEvent: Event) => void): boolean;
70
+ /** Stops waiting for a press still waiting for its tap. */
71
+ forget(): void;
72
+ }
73
+ /** One tap recognizer for a trigger, released on unmount. Internal. */
74
+ export declare function useTapRecognizer(): TapRecognizer;
60
75
  export declare function useTapStop(event: 'click'): {
61
76
  onPointerDown: (event: ReactPointerEvent<Element>) => void;
62
77
  onClick: (event: ReactMouseEvent<Element>) => void;
@@ -151,6 +166,11 @@ export interface UseTouchTriggerInternalReturn extends UseTouchTriggerReturn {
151
166
  * hold arms it too.
152
167
  */
153
168
  armOutsideDismiss: () => void;
169
+ /**
170
+ * Answers a tap the trigger completed before the layer mounted, by the same
171
+ * rules as a tap it sees, and arms the outside dismissal when it opens.
172
+ */
173
+ answerTap: (tapEvent: Event | null) => void;
154
174
  }
155
175
  /**
156
176
  * Touch behavior shared by the hover layers.
@@ -1 +1 @@
1
- {"version":3,"file":"useTouchTrigger.d.ts","sourceRoot":"","sources":["../../src/Layer/useTouchTrigger.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAIL,KAAK,UAAU,IAAI,eAAe,EAClC,KAAK,YAAY,IAAI,iBAAiB,EACtC,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAUf;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,aAA4B,CAAC;AAE7D,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG;IAC1C,aAAa,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC3D,OAAO,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;CACpD,CAAC;AACF,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG;IAC9C,aAAa,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC3D,WAAW,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;CACxD,CAAC;AAwCF;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CA8B7D;AAiBD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAUlE;AAeD,MAAM,WAAW,sBAAsB;IACrC,sDAAsD;IACtD,YAAY,EAAE,iBAAiB,CAAC;IAEhC,oDAAoD;IACpD,SAAS,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,YAAY,EAAE,OAAO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