@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,114 @@
1
+ /**
2
+ * @file calendarSystem.ts
3
+ * @input A calendar identifier and Gregorian PlainDates
4
+ * @output Calendar months located by their Gregorian days, their year and
5
+ * month numbers, month and year steps, dates from calendar fields,
6
+ * availability of each calendar, and calendar labels and digits
7
+ * @position Shared date utility; read by the i18n calendar resolution, by
8
+ * Calendar, and by its public hooks. Values stay Gregorian PlainDates. Temporal owns the arithmetic of
9
+ * every calendar whose months are not Gregorian.
10
+ */
11
+ import type { Locale } from '../i18n/types.js';
12
+ import type { PlainDate } from './dateTypes.js';
13
+ /**
14
+ * A calendar system that date components can show: the calendars that
15
+ * ECMA-402 and Temporal require. Values stay Gregorian ISO dates in every
16
+ * calendar.
17
+ */
18
+ export type CalendarSystem = 'gregory' | 'iso8601' | 'buddhist' | 'roc' | 'japanese' | 'persian' | 'indian' | 'hebrew' | 'chinese' | 'dangi' | 'coptic' | 'ethiopic' | 'ethioaa' | 'islamic-civil' | 'islamic-tbla' | 'islamic-umalqura';
19
+ export declare const CALENDAR_SYSTEMS: ReadonlyArray<CalendarSystem>;
20
+ /** Whether the calendar's months and days are the Gregorian ones. */
21
+ export declare function isGregorianAligned(calendar: CalendarSystem): boolean;
22
+ export declare function isCalendarSystem(value: string): value is CalendarSystem;
23
+ /**
24
+ * Whether this runtime can show the calendar. Gregorian-aligned calendars
25
+ * always can. The others need a `Temporal` that knows the calendar: a
26
+ * polyfill build without non-ISO calendars throws for them.
27
+ */
28
+ export declare function isCalendarSystemAvailable(calendar: CalendarSystem): boolean;
29
+ /** A month of a calendar, located by its first and last Gregorian days. */
30
+ export interface CalendarMonth {
31
+ readonly start: PlainDate;
32
+ readonly end: PlainDate;
33
+ readonly length: number;
34
+ }
35
+ /** The day of the calendar month that a Gregorian date falls on. */
36
+ export declare function calendarDayOfMonth(calendar: CalendarSystem, pd: PlainDate): number;
37
+ /** The calendar month that contains a Gregorian date. */
38
+ export declare function calendarMonthOf(calendar: CalendarSystem, pd: PlainDate): CalendarMonth;
39
+ /**
40
+ * A calendar month by its year and its position in that year, as
41
+ * `Temporal.PlainDate` numbers them: month 13 exists in a Hebrew leap year.
42
+ */
43
+ export interface CalendarYearMonth {
44
+ readonly year: number;
45
+ readonly month: number;
46
+ }
47
+ /** The year and month numbers of a calendar month. */
48
+ export declare function calendarYearMonthOf(calendar: CalendarSystem, month: CalendarMonth): CalendarYearMonth;
49
+ /**
50
+ * The calendar month with these year and month numbers. A month past the end
51
+ * of its year becomes the last month of that year, as Temporal constrains it.
52
+ */
53
+ export declare function calendarMonthFromYearMonth(calendar: CalendarSystem, { year, month }: CalendarYearMonth): CalendarMonth;
54
+ /** The calendar month `n` months after `month`, or before it when negative. */
55
+ export declare function calendarAddMonths(calendar: CalendarSystem, month: CalendarMonth, n: number): CalendarMonth;
56
+ /**
57
+ * Moves a date by `n` calendar months. It keeps the day of the month and
58
+ * clamps it to the length of the target month.
59
+ */
60
+ export declare function calendarShiftMonths(calendar: CalendarSystem, pd: PlainDate, n: number): PlainDate;
61
+ /**
62
+ * Moves a date by `n` calendar years, to the same month of the target year.
63
+ * It clamps the day of the month. A leap month that the target year does not
64
+ * have becomes its common counterpart, because Temporal keeps the month code
65
+ * and constrains it.
66
+ */
67
+ export declare function calendarShiftYears(calendar: CalendarSystem, pd: PlainDate, n: number): PlainDate;
68
+ /** Whether a Gregorian date falls inside a calendar month. */
69
+ export declare function isInCalendarMonth(pd: PlainDate, month: CalendarMonth): boolean;
70
+ /**
71
+ * The stand-alone month and year label of a calendar month, such as
72
+ * "Aban 1405 AP". It formats a day in the middle of the month: in the
73
+ * Japanese calendar an era can start inside a month, and most days of that
74
+ * month then belong to the era of its middle day.
75
+ */
76
+ export declare function formatCalendarMonthLabel(calendar: CalendarSystem, month: CalendarMonth, locale: Locale): string;
77
+ /**
78
+ * Formats a Gregorian date in the calendar, such as "Friday, Aban 8, 1405 AP".
79
+ * The label always names the month and day that the grid shows. Intl and the
80
+ * runtime's Temporal can disagree on where a month of the Chinese or Dangi
81
+ * calendar starts; the label then takes its month and year from the middle of
82
+ * the Temporal month, and its day from Temporal.
83
+ */
84
+ export declare function formatCalendarDate(calendar: CalendarSystem, pd: PlainDate, options: Intl.DateTimeFormatOptions, locale: Locale): string;
85
+ /** The parts of `formatCalendarDate`'s label. */
86
+ export declare function formatCalendarDateToParts(calendar: CalendarSystem, pd: PlainDate, options: Intl.DateTimeFormatOptions, locale: Locale): Intl.DateTimeFormatPart[];
87
+ /**
88
+ * Formats an instant as `formatCalendarDate` formats the day it falls on in
89
+ * `timeZone`, the host's zone when omitted. Intl writes any time of day that
90
+ * `options` asks for.
91
+ */
92
+ export declare function formatCalendarInstant(calendar: CalendarSystem, instant: Date, options: Intl.DateTimeFormatOptions, locale: Locale, timeZone?: string): string;
93
+ /**
94
+ * The fields of a date written in a calendar. A field gives either `year` or
95
+ * `era` with `eraYear`, and either `monthCode` (such as `M05L` for a leap
96
+ * month) or `month`, the month's position in its year.
97
+ */
98
+ export interface CalendarDateFields {
99
+ readonly year?: number;
100
+ readonly era?: string;
101
+ readonly eraYear?: number;
102
+ readonly monthCode?: string;
103
+ readonly month?: number;
104
+ readonly day: number;
105
+ }
106
+ /**
107
+ * The Gregorian date for fields written in a calendar that needs Temporal,
108
+ * or null when the calendar does not have that date. Temporal validates the
109
+ * fields and never adjusts them: 30 Esfand in a common Persian year is null.
110
+ */
111
+ export declare function calendarDateFromFields(calendar: CalendarSystem, fields: CalendarDateFields): PlainDate | null;
112
+ /** The number of months in the calendar year that contains a date. */
113
+ export declare function calendarMonthsInYear(calendar: CalendarSystem, pd: PlainDate): number;
114
+ //# sourceMappingURL=calendarSystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendarSystem.d.ts","sourceRoot":"","sources":["../../src/utils/calendarSystem.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAe3C;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,SAAS,GACT,UAAU,GACV,KAAK,GACL,UAAU,GACV,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,OAAO,GACP,QAAQ,GACR,UAAU,GACV,SAAS,GACT,eAAe,GACf,cAAc,GACd,kBAAkB,CAAC;AAsBvB,eAAO,MAAM,gBAAgB,EAExB,aAAa,CAAC,cAAc,CAAC,CAAC;AAUnC,qEAAqE;AACrE,wBAAgB,kBAAkB,CAAC,QAAQ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AAgB,sBAAsB,CACpC,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,kBAAkB,GACzB,SAAS,GAAG,IAAI,CAelB;AAED,sEAAsE;AACtE,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,cAAc,EACxB,EAAE,EAAE,SAAS,GACZ,MAAM,CAIR"}
@@ -0,0 +1,386 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file calendarSystem.ts
5
+ * @input A calendar identifier and Gregorian PlainDates
6
+ * @output Calendar months located by their Gregorian days, their year and
7
+ * month numbers, month and year steps, dates from calendar fields,
8
+ * availability of each calendar, and calendar labels and digits
9
+ * @position Shared date utility; read by the i18n calendar resolution, by
10
+ * Calendar, and by its public hooks. Values stay Gregorian PlainDates. Temporal owns the arithmetic of
11
+ * every calendar whose months are not Gregorian.
12
+ */
13
+
14
+ import { dateTimeFormatAtCall, dateTimeFormatFor, plainDateAddDays, plainDateAddMonths, plainDateFormatDayNumber, plainDateFormatStandaloneMonthYear, plainDateFormatToParts, plainDateFromDate, plainDateFromInstant, plainDateIsInRange, getDaysInMonth } from "./plainDate.js";
15
+
16
+ /**
17
+ * A calendar system that date components can show: the calendars that
18
+ * ECMA-402 and Temporal require. Values stay Gregorian ISO dates in every
19
+ * calendar.
20
+ */
21
+
22
+ // A record, so the compiler checks that it lists every calendar exactly once.
23
+ const KNOWN_CALENDARS = {
24
+ gregory: true,
25
+ iso8601: true,
26
+ buddhist: true,
27
+ roc: true,
28
+ japanese: true,
29
+ persian: true,
30
+ indian: true,
31
+ hebrew: true,
32
+ chinese: true,
33
+ dangi: true,
34
+ coptic: true,
35
+ ethiopic: true,
36
+ ethioaa: true,
37
+ 'islamic-civil': true,
38
+ 'islamic-tbla': true,
39
+ 'islamic-umalqura': true
40
+ };
41
+ export const CALENDAR_SYSTEMS = Object.keys(KNOWN_CALENDARS);
42
+ const GREGORIAN_ALIGNED = new Set(['gregory', 'iso8601', 'buddhist', 'roc', 'japanese']);
43
+
44
+ /** Whether the calendar's months and days are the Gregorian ones. */
45
+ export function isGregorianAligned(calendar) {
46
+ return GREGORIAN_ALIGNED.has(calendar);
47
+ }
48
+ export function isCalendarSystem(value) {
49
+ return Object.hasOwn(KNOWN_CALENDARS, value);
50
+ }
51
+
52
+ // The published types must not need the `esnext.temporal` library.
53
+ // This module declares only the Temporal members it reads.
54
+
55
+ function getTemporal() {
56
+ const temporal = globalThis.Temporal;
57
+ return typeof temporal?.PlainDate === 'function' ? temporal : undefined;
58
+ }
59
+
60
+ // The key is the Temporal object, so a polyfill that loads later gets its
61
+ // own probe.
62
+ const supportedCalendars = new WeakMap();
63
+
64
+ /**
65
+ * Whether this runtime can show the calendar. Gregorian-aligned calendars
66
+ * always can. The others need a `Temporal` that knows the calendar: a
67
+ * polyfill build without non-ISO calendars throws for them.
68
+ */
69
+ export function isCalendarSystemAvailable(calendar) {
70
+ if (isGregorianAligned(calendar)) {
71
+ return true;
72
+ }
73
+ const temporal = getTemporal();
74
+ if (temporal == null) {
75
+ return false;
76
+ }
77
+ let known = supportedCalendars.get(temporal);
78
+ if (known == null) {
79
+ known = new Map();
80
+ supportedCalendars.set(temporal, known);
81
+ }
82
+ let isSupported = known.get(calendar);
83
+ if (isSupported == null) {
84
+ try {
85
+ new temporal.PlainDate(2000, 1, 1, calendar);
86
+ isSupported = true;
87
+ } catch {
88
+ isSupported = false;
89
+ }
90
+ known.set(calendar, isSupported);
91
+ }
92
+ return isSupported;
93
+ }
94
+ function inCalendar(calendar, pd) {
95
+ const temporal = getTemporal();
96
+ if (temporal == null) {
97
+ throw new Error(`The "${calendar}" calendar needs Temporal.`);
98
+ }
99
+ return new temporal.PlainDate(pd.year, pd.month, pd.day, calendar);
100
+ }
101
+ function toGregorian(date) {
102
+ const iso = date.withCalendar('iso8601');
103
+ return {
104
+ year: iso.year,
105
+ month: iso.month,
106
+ day: iso.day
107
+ };
108
+ }
109
+
110
+ /** A month of a calendar, located by its first and last Gregorian days. */
111
+
112
+ function makeMonth(start, length) {
113
+ return {
114
+ start,
115
+ end: plainDateAddDays(start, length - 1),
116
+ length
117
+ };
118
+ }
119
+ function gregorianMonth(year, month) {
120
+ return makeMonth({
121
+ year,
122
+ month,
123
+ day: 1
124
+ }, getDaysInMonth(year, month));
125
+ }
126
+ function temporalMonth(firstDay) {
127
+ return makeMonth(toGregorian(firstDay), firstDay.daysInMonth);
128
+ }
129
+
130
+ /** The day of the calendar month that a Gregorian date falls on. */
131
+ export function calendarDayOfMonth(calendar, pd) {
132
+ return isGregorianAligned(calendar) ? pd.day : inCalendar(calendar, pd).day;
133
+ }
134
+
135
+ /** The calendar month that contains a Gregorian date. */
136
+ export function calendarMonthOf(calendar, pd) {
137
+ if (isGregorianAligned(calendar)) {
138
+ return gregorianMonth(pd.year, pd.month);
139
+ }
140
+ return temporalMonth(inCalendar(calendar, pd).with({
141
+ day: 1
142
+ }));
143
+ }
144
+
145
+ /**
146
+ * A calendar month by its year and its position in that year, as
147
+ * `Temporal.PlainDate` numbers them: month 13 exists in a Hebrew leap year.
148
+ */
149
+
150
+ // Temporal counts the years of these Gregorian-aligned calendars from another
151
+ // epoch: 2026 is 2569 in `buddhist` and 115 in `roc`.
152
+ const GREGORIAN_YEAR_OFFSETS = {
153
+ buddhist: 543,
154
+ roc: -1911
155
+ };
156
+
157
+ /** The year and month numbers of a calendar month. */
158
+ export function calendarYearMonthOf(calendar, month) {
159
+ if (isGregorianAligned(calendar)) {
160
+ return {
161
+ year: month.start.year + (GREGORIAN_YEAR_OFFSETS[calendar] ?? 0),
162
+ month: month.start.month
163
+ };
164
+ }
165
+ const {
166
+ year,
167
+ month: monthOfYear
168
+ } = inCalendar(calendar, month.start);
169
+ return {
170
+ year,
171
+ month: monthOfYear
172
+ };
173
+ }
174
+
175
+ /**
176
+ * The calendar month with these year and month numbers. A month past the end
177
+ * of its year becomes the last month of that year, as Temporal constrains it.
178
+ */
179
+ export function calendarMonthFromYearMonth(calendar, {
180
+ year,
181
+ month
182
+ }) {
183
+ if (isGregorianAligned(calendar)) {
184
+ return gregorianMonth(year - (GREGORIAN_YEAR_OFFSETS[calendar] ?? 0), month);
185
+ }
186
+ // `with` replaces the year and month of any date in the calendar.
187
+ return temporalMonth(inCalendar(calendar, {
188
+ year: 2000,
189
+ month: 1,
190
+ day: 1
191
+ }).with({
192
+ year,
193
+ month,
194
+ day: 1
195
+ }));
196
+ }
197
+
198
+ /** The calendar month `n` months after `month`, or before it when negative. */
199
+ export function calendarAddMonths(calendar, month, n) {
200
+ if (n === 0) {
201
+ return month;
202
+ }
203
+ if (isGregorianAligned(calendar)) {
204
+ const {
205
+ year,
206
+ month: monthOfYear
207
+ } = plainDateAddMonths(month.start, n);
208
+ return gregorianMonth(year, monthOfYear);
209
+ }
210
+ return temporalMonth(inCalendar(calendar, month.start).add({
211
+ months: n
212
+ }));
213
+ }
214
+
215
+ /**
216
+ * Moves a date by `n` calendar months. It keeps the day of the month and
217
+ * clamps it to the length of the target month.
218
+ */
219
+ export function calendarShiftMonths(calendar, pd, n) {
220
+ if (isGregorianAligned(calendar)) {
221
+ return plainDateAddMonths(pd, n);
222
+ }
223
+ return toGregorian(inCalendar(calendar, pd).add({
224
+ months: n
225
+ }));
226
+ }
227
+
228
+ /**
229
+ * Moves a date by `n` calendar years, to the same month of the target year.
230
+ * It clamps the day of the month. A leap month that the target year does not
231
+ * have becomes its common counterpart, because Temporal keeps the month code
232
+ * and constrains it.
233
+ */
234
+ export function calendarShiftYears(calendar, pd, n) {
235
+ if (isGregorianAligned(calendar)) {
236
+ return plainDateAddMonths(pd, n * 12);
237
+ }
238
+ return toGregorian(inCalendar(calendar, pd).add({
239
+ years: n
240
+ }));
241
+ }
242
+
243
+ /** Whether a Gregorian date falls inside a calendar month. */
244
+ export function isInCalendarMonth(pd, month) {
245
+ return plainDateIsInRange(pd, [month.start, month.end]);
246
+ }
247
+
248
+ /**
249
+ * The stand-alone month and year label of a calendar month, such as
250
+ * "Aban 1405 AP". It formats a day in the middle of the month: in the
251
+ * Japanese calendar an era can start inside a month, and most days of that
252
+ * month then belong to the era of its middle day.
253
+ */
254
+ export function formatCalendarMonthLabel(calendar, month, locale) {
255
+ return plainDateFormatStandaloneMonthYear(plainDateAddDays(month.start, Math.floor(month.length / 2)), locale, labelCalendar(calendar));
256
+ }
257
+
258
+ // Intl has no month names for `iso8601`. Labels use `gregory`, which has the
259
+ // same months and days.
260
+ function labelCalendar(calendar) {
261
+ return calendar === 'iso8601' ? 'gregory' : calendar;
262
+ }
263
+ function formatToParts(calendar, pd, options, locale) {
264
+ return plainDateFormatToParts(pd, {
265
+ ...options,
266
+ calendar
267
+ }, locale);
268
+ }
269
+ const MONTH_PART_TYPES = new Set(['era', 'year', 'relatedYear', 'yearName', 'month']);
270
+ function monthPartsKey(parts) {
271
+ return parts.filter(part => MONTH_PART_TYPES.has(part.type)).map(part => part.value).join('|');
272
+ }
273
+
274
+ /**
275
+ * Formats a Gregorian date in the calendar, such as "Friday, Aban 8, 1405 AP".
276
+ * The label always names the month and day that the grid shows. Intl and the
277
+ * runtime's Temporal can disagree on where a month of the Chinese or Dangi
278
+ * calendar starts; the label then takes its month and year from the middle of
279
+ * the Temporal month, and its day from Temporal.
280
+ */
281
+ export function formatCalendarDate(calendar, pd, options, locale) {
282
+ return joinParts(formatCalendarDateToParts(calendar, pd, options, locale));
283
+ }
284
+
285
+ /** The parts of `formatCalendarDate`'s label. */
286
+ export function formatCalendarDateToParts(calendar, pd, options, locale) {
287
+ const parts = formatToParts(labelCalendar(calendar), pd, options, locale);
288
+ return withTemporalDay(calendar, pd, parts, options, locale);
289
+ }
290
+
291
+ // Returns `parts` itself where Intl already names Temporal's month and day.
292
+ function withTemporalDay(calendar, pd, parts, options, locale) {
293
+ if (isGregorianAligned(calendar) || !isCalendarSystemAvailable(calendar)) {
294
+ return parts;
295
+ }
296
+ const date = inCalendar(calendar, pd);
297
+ const middle = plainDateAddDays(pd, Math.floor(date.daysInMonth / 2) - (date.day - 1));
298
+ const middleParts = formatToParts(calendar, middle, options, locale);
299
+ const intlDay = formatToParts(calendar, pd, {
300
+ day: 'numeric'
301
+ }, 'en-u-nu-latn').find(part => part.type === 'day')?.value;
302
+ if (Number(intlDay) === date.day && monthPartsKey(parts) === monthPartsKey(middleParts)) {
303
+ return parts;
304
+ }
305
+ const {
306
+ numberingSystem
307
+ } = dateTimeFormatFor(locale, {
308
+ ...options,
309
+ calendar,
310
+ timeZone: 'UTC'
311
+ }).resolvedOptions();
312
+ const middleValues = new Map(middleParts.map(part => [part.type, part.value]));
313
+ return parts.map(part => part.type === 'day' ? {
314
+ ...part,
315
+ value: plainDateFormatDayNumber(date.day, locale, numberingSystem)
316
+ } : MONTH_PART_TYPES.has(part.type) ? {
317
+ ...part,
318
+ value: middleValues.get(part.type) ?? part.value
319
+ } : part);
320
+ }
321
+
322
+ /**
323
+ * Formats an instant as `formatCalendarDate` formats the day it falls on in
324
+ * `timeZone`, the host's zone when omitted. Intl writes any time of day that
325
+ * `options` asks for.
326
+ */
327
+ export function formatCalendarInstant(calendar, instant, options, locale, timeZone) {
328
+ return instantLabel(calendar, instant, options, locale, timeZone).text;
329
+ }
330
+ function instantLabel(calendar, instant, options, locale, timeZone) {
331
+ const format = dateTimeFormatAtCall(locale, {
332
+ ...options,
333
+ ...(timeZone === undefined ? {} : {
334
+ timeZone
335
+ }),
336
+ calendar: labelCalendar(calendar)
337
+ });
338
+ const parts = format.formatToParts(instant);
339
+ const day = timeZone === undefined ? plainDateFromDate(instant) : plainDateFromInstant(instant.getTime(), timeZone);
340
+ const fixed = withTemporalDay(calendar, day, parts, options, locale);
341
+ const isIntl = fixed === parts;
342
+ return {
343
+ format,
344
+ isIntl,
345
+ text: isIntl ? format.format(instant) : joinParts(fixed)
346
+ };
347
+ }
348
+ function joinParts(parts) {
349
+ return parts.map(part => part.value).join('');
350
+ }
351
+
352
+ /**
353
+ * The fields of a date written in a calendar. A field gives either `year` or
354
+ * `era` with `eraYear`, and either `monthCode` (such as `M05L` for a leap
355
+ * month) or `month`, the month's position in its year.
356
+ */
357
+
358
+ /**
359
+ * The Gregorian date for fields written in a calendar that needs Temporal,
360
+ * or null when the calendar does not have that date. Temporal validates the
361
+ * fields and never adjusts them: 30 Esfand in a common Persian year is null.
362
+ */
363
+ export function calendarDateFromFields(calendar, fields) {
364
+ const temporal = getTemporal();
365
+ if (temporal == null) {
366
+ throw new Error(`The "${calendar}" calendar needs Temporal.`);
367
+ }
368
+ try {
369
+ return toGregorian(temporal.PlainDate.from({
370
+ ...fields,
371
+ calendar
372
+ }, {
373
+ overflow: 'reject'
374
+ }));
375
+ } catch (error) {
376
+ if (error instanceof RangeError || error instanceof TypeError) {
377
+ return null;
378
+ }
379
+ throw error;
380
+ }
381
+ }
382
+
383
+ /** The number of months in the calendar year that contains a date. */
384
+ export function calendarMonthsInYear(calendar, pd) {
385
+ return isGregorianAligned(calendar) ? 12 : inCalendar(calendar, pd).monthsInYear;
386
+ }
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * @file flatTree.ts
3
3
  * @input A DOM node
4
- * @output Exports parentAcrossShadow, and containsAlongFlatTree, which walks it
4
+ * @output Exports parentAcrossShadow, containsAlongFlatTree, which walks it,
5
+ * and deepActiveElement
5
6
  * @position The flat-tree parent the browser scrolls and dispatches
6
- * through, shared by the gesture host's native-scroll probe and the
7
+ * through, shared by the gesture host's native-scroll probe, the
7
8
  * selection lock (which the press feedback controller uses without the
8
- * gesture system)
9
+ * gesture system) and the Layer module's input hold
9
10
  */
10
11
  /** The node's parent, crossing out of shadow roots. */
11
12
  export declare function parentAcrossShadow(node: Node): Node | null;
@@ -14,4 +15,6 @@ export declare function parentAcrossShadow(node: Node): Node | null;
14
15
  * shadow root to its host, which `Node.contains` does not follow.
15
16
  */
16
17
  export declare function containsAlongFlatTree(ancestor: Node, node: Node): boolean;
18
+ /** The focused element of `doc`, inside open shadow roots too. */
19
+ export declare function deepActiveElement(doc: Document | null | undefined): Element | null;
17
20
  //# sourceMappingURL=flatTree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flatTree.d.ts","sourceRoot":"","sources":["../../src/utils/flatTree.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,uDAAuD;AACvD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAa1D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAOzE"}
1
+ {"version":3,"file":"flatTree.d.ts","sourceRoot":"","sources":["../../src/utils/flatTree.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,uDAAuD;AACvD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAa1D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAOzE;AAED,kEAAkE;AAClE,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,GAC/B,OAAO,GAAG,IAAI,CAMhB"}
@@ -3,11 +3,12 @@
3
3
  /**
4
4
  * @file flatTree.ts
5
5
  * @input A DOM node
6
- * @output Exports parentAcrossShadow, and containsAlongFlatTree, which walks it
6
+ * @output Exports parentAcrossShadow, containsAlongFlatTree, which walks it,
7
+ * and deepActiveElement
7
8
  * @position The flat-tree parent the browser scrolls and dispatches
8
- * through, shared by the gesture host's native-scroll probe and the
9
+ * through, shared by the gesture host's native-scroll probe, the
9
10
  * selection lock (which the press feedback controller uses without the
10
- * gesture system)
11
+ * gesture system) and the Layer module's input hold
11
12
  */
12
13
 
13
14
  /** The node's parent, crossing out of shadow roots. */
@@ -35,4 +36,13 @@ export function containsAlongFlatTree(ancestor, node) {
35
36
  }
36
37
  }
37
38
  return false;
39
+ }
40
+
41
+ /** The focused element of `doc`, inside open shadow roots too. */
42
+ export function deepActiveElement(doc) {
43
+ let active = doc?.activeElement ?? null;
44
+ while (active?.shadowRoot?.activeElement != null) {
45
+ active = active.shadowRoot.activeElement;
46
+ }
47
+ return active;
38
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hitArea.d.ts","sourceRoot":"","sources":["../../src/utils/hitArea.ts"],"names":[],"mappings":"AA6BA,+BAA+B;AAC/B,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,mEAAmE;AACnE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,qDAAqD;AACrD,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,6CAA6C;AAC7C,eAAO,MAAM,aAAa,EAAE,SAAkD,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;CAKvB,CAAC;AAmCX;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,aAAa,CAAC,OAAO,CAAC,EAClC,OAAO,GAAE,MAAyB,GACjC,SAAS,CA4CX;AAYD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAC7B,OAAO,GAAE,MAAyB,GACjC,MAAM,CAoBR;AAED,gDAAgD;AAChD,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,SAA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