@astryxdesign/core 0.7.1 → 0.7.2-canary.020e1fe

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 (377) hide show
  1. package/dist/AppShell/AppShell.d.ts.map +1 -1
  2. package/dist/AppShell/AppShell.js +40 -1
  3. package/dist/AspectRatio/AspectRatio.d.ts +6 -8
  4. package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
  5. package/dist/AspectRatio/AspectRatio.js +44 -3
  6. package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
  7. package/dist/Breadcrumbs/BreadcrumbItem.js +5 -2
  8. package/dist/Button/Button.d.ts.map +1 -1
  9. package/dist/Button/Button.js +38 -14
  10. package/dist/CheckboxInput/CheckboxInput.d.ts +1 -1
  11. package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
  12. package/dist/CheckboxInput/CheckboxInput.js +3 -1
  13. package/dist/CheckboxList/CheckboxListItem.d.ts +9 -1
  14. package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
  15. package/dist/CheckboxList/CheckboxListItem.js +4 -2
  16. package/dist/CommandPalette/CommandPaletteInput.d.ts +1 -1
  17. package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
  18. package/dist/CommandPalette/CommandPaletteInput.js +37 -5
  19. package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
  20. package/dist/ContextMenu/ContextMenu.js +5 -2
  21. package/dist/Dialog/Dialog.d.ts.map +1 -1
  22. package/dist/Dialog/Dialog.js +20 -8
  23. package/dist/Drawer/Drawer.d.ts +191 -0
  24. package/dist/Drawer/Drawer.d.ts.map +1 -0
  25. package/dist/Drawer/Drawer.js +382 -0
  26. package/dist/Drawer/DrawerHeader.d.ts +85 -0
  27. package/dist/Drawer/DrawerHeader.d.ts.map +1 -0
  28. package/dist/Drawer/DrawerHeader.js +134 -0
  29. package/dist/Drawer/index.d.ts +11 -0
  30. package/dist/Drawer/index.d.ts.map +1 -0
  31. package/dist/Drawer/index.js +11 -0
  32. package/dist/Drawer/useDrawerDialogPresence.d.ts +42 -0
  33. package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -0
  34. package/dist/Drawer/useDrawerDialogPresence.js +236 -0
  35. package/dist/DropdownMenu/DropdownMenu.d.ts +1 -1
  36. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  37. package/dist/DropdownMenu/DropdownMenu.js +83 -11
  38. package/dist/DropdownMenu/DropdownMenuContext.d.ts +17 -0
  39. package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
  40. package/dist/DropdownMenu/DropdownMenuContext.js +21 -0
  41. package/dist/DropdownMenu/DropdownMenuDivider.d.ts +5 -3
  42. package/dist/DropdownMenu/DropdownMenuDivider.d.ts.map +1 -1
  43. package/dist/DropdownMenu/DropdownMenuDivider.js +7 -3
  44. package/dist/DropdownMenu/DropdownMenuGroup.d.ts +6 -4
  45. package/dist/DropdownMenu/DropdownMenuGroup.d.ts.map +1 -1
  46. package/dist/DropdownMenu/DropdownMenuGroup.js +4 -3
  47. package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
  48. package/dist/DropdownMenu/DropdownMenuSubMenu.js +19 -8
  49. package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts +24 -0
  50. package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts.map +1 -0
  51. package/dist/DropdownMenu/lazyMenuBottomSheet.js +46 -0
  52. package/dist/EmptyState/EmptyState.d.ts.map +1 -1
  53. package/dist/EmptyState/EmptyState.js +4 -10
  54. package/dist/Field/Field.d.ts +1 -1
  55. package/dist/Field/Field.d.ts.map +1 -1
  56. package/dist/Field/Field.js +8 -4
  57. package/dist/Grid/GridSpan.d.ts.map +1 -1
  58. package/dist/Grid/GridSpan.js +1 -0
  59. package/dist/Heading/Heading.d.ts.map +1 -1
  60. package/dist/Heading/Heading.js +4 -2
  61. package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
  62. package/dist/HoverCard/useHoverCard.js +10 -2
  63. package/dist/Item/Item.d.ts +6 -2
  64. package/dist/Item/Item.d.ts.map +1 -1
  65. package/dist/Item/Item.js +19 -4
  66. package/dist/Layer/layerViewportInset.stylex.d.ts +6 -2
  67. package/dist/Layer/layerViewportInset.stylex.d.ts.map +1 -1
  68. package/dist/Layer/layerViewportInset.stylex.js +6 -2
  69. package/dist/Layer/useLayer.d.ts.map +1 -1
  70. package/dist/Layer/useLayer.js +13 -7
  71. package/dist/Layer/useLayerDismissal.d.ts +1 -1
  72. package/dist/Layer/useLayerDismissal.js +1 -1
  73. package/dist/Layout/container.stylex.d.ts +5 -5
  74. package/dist/Layout/container.stylex.js +4 -4
  75. package/dist/List/List.d.ts +46 -19
  76. package/dist/List/List.d.ts.map +1 -1
  77. package/dist/List/List.js +28 -10
  78. package/dist/List/ListContext.d.ts +8 -3
  79. package/dist/List/ListContext.d.ts.map +1 -1
  80. package/dist/List/ListContext.js +7 -2
  81. package/dist/List/ListItem.d.ts +13 -5
  82. package/dist/List/ListItem.d.ts.map +1 -1
  83. package/dist/List/ListItem.js +21 -8
  84. package/dist/List/index.d.ts +1 -1
  85. package/dist/List/index.d.ts.map +1 -1
  86. package/dist/Markdown/Markdown.d.ts.map +1 -1
  87. package/dist/Markdown/Markdown.js +8 -1
  88. package/dist/Markdown/plugins/frontmatter.d.ts.map +1 -1
  89. package/dist/Markdown/plugins/frontmatter.js +7 -3
  90. package/dist/MetadataList/MetadataList.d.ts.map +1 -1
  91. package/dist/MetadataList/MetadataList.js +5 -1
  92. package/dist/MetadataList/MetadataListContext.d.ts +1 -1
  93. package/dist/MetadataList/MetadataListContext.d.ts.map +1 -1
  94. package/dist/MobileNav/MobileNav.d.ts +9 -0
  95. package/dist/MobileNav/MobileNav.d.ts.map +1 -1
  96. package/dist/MobileNav/MobileNav.js +30 -3
  97. package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
  98. package/dist/MultiSelector/MultiSelector.js +22 -8
  99. package/dist/MultiSelector/OptionActions.a11y.chromium.spec.js +100 -2
  100. package/dist/MultiSelector/hooks.d.ts.map +1 -1
  101. package/dist/MultiSelector/hooks.js +3 -1
  102. package/dist/Pagination/Pagination.d.ts +8 -5
  103. package/dist/Pagination/Pagination.d.ts.map +1 -1
  104. package/dist/Pagination/Pagination.js +21 -8
  105. package/dist/Popover/Popover.js +2 -2
  106. package/dist/PowerSearch/PowerSearch.js +1 -1
  107. package/dist/RadioList/RadioList.d.ts +1 -1
  108. package/dist/RadioList/RadioList.d.ts.map +1 -1
  109. package/dist/RadioList/RadioList.js +6 -2
  110. package/dist/RadioList/RadioListItem.d.ts +9 -1
  111. package/dist/RadioList/RadioListItem.d.ts.map +1 -1
  112. package/dist/RadioList/RadioListItem.js +2 -0
  113. package/dist/Selector/hooks.d.ts.map +1 -1
  114. package/dist/Selector/hooks.js +6 -2
  115. package/dist/SideNav/SideNavItem.d.ts +8 -1
  116. package/dist/SideNav/SideNavItem.d.ts.map +1 -1
  117. package/dist/SideNav/SideNavItem.js +71 -9
  118. package/dist/Switch/Switch.d.ts +1 -1
  119. package/dist/Switch/Switch.d.ts.map +1 -1
  120. package/dist/Switch/Switch.js +13 -1
  121. package/dist/TabList/TabMenu.d.ts +2 -2
  122. package/dist/TabList/TabMenu.d.ts.map +1 -1
  123. package/dist/TabList/TabMenu.js +6 -3
  124. package/dist/Text/Text.d.ts.map +1 -1
  125. package/dist/Text/Text.js +4 -2
  126. package/dist/Text/useTruncation.d.ts +7 -5
  127. package/dist/Text/useTruncation.d.ts.map +1 -1
  128. package/dist/Text/useTruncation.js +16 -5
  129. package/dist/ToggleButton/ToggleButton.d.ts +3 -2
  130. package/dist/ToggleButton/ToggleButton.d.ts.map +1 -1
  131. package/dist/ToggleButton/ToggleButton.js +12 -1
  132. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  133. package/dist/Tooltip/useTooltip.js +11 -0
  134. package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
  135. package/dist/TopNav/TopNavMegaMenu.js +3 -3
  136. package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
  137. package/dist/TopNav/TopNavMenu.js +3 -3
  138. package/dist/TreeList/TreeList.d.ts.map +1 -1
  139. package/dist/TreeList/TreeList.js +1 -0
  140. package/dist/TreeList/TreeListBranches.d.ts.map +1 -1
  141. package/dist/TreeList/TreeListBranches.js +2 -2
  142. package/dist/TreeList/TreeListItem.d.ts.map +1 -1
  143. package/dist/TreeList/TreeListItem.js +57 -9
  144. package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
  145. package/dist/Typeahead/BaseTypeahead.js +26 -0
  146. package/dist/astryx.css +47 -13
  147. package/dist/hooks/useEntryAnimation.d.ts +2 -1
  148. package/dist/hooks/useEntryAnimation.d.ts.map +1 -1
  149. package/dist/hooks/useEntryAnimation.js +14 -12
  150. package/dist/hooks/useIsHydrating.d.ts +6 -0
  151. package/dist/hooks/useIsHydrating.d.ts.map +1 -0
  152. package/dist/hooks/useIsHydrating.js +30 -0
  153. package/dist/hooks/useMenuHover.d.ts.map +1 -1
  154. package/dist/hooks/useMenuHover.js +18 -13
  155. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  156. package/dist/i18n/generated-locales/en.generated.js +112 -1
  157. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  158. package/dist/i18n/generated-locales/pseudo.generated.js +112 -1
  159. package/dist/index.d.ts +1 -0
  160. package/dist/index.d.ts.map +1 -1
  161. package/dist/index.js +1 -0
  162. package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
  163. package/dist/theme/derivedVarRegistry.js +0 -3
  164. package/dist/utils/focusOutline.stylex.d.ts +4 -0
  165. package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
  166. package/dist/utils/focusOutline.stylex.js +4 -0
  167. package/dist/utils/plainDate.d.ts.map +1 -1
  168. package/dist/utils/plainDate.js +15 -9
  169. package/dist/utils/sharedMutationObserver.d.ts +21 -0
  170. package/dist/utils/sharedMutationObserver.d.ts.map +1 -0
  171. package/dist/utils/sharedMutationObserver.js +69 -0
  172. package/locales/en.json +444 -0
  173. package/locales/pseudo.json +333 -0
  174. package/package.json +9 -4
  175. package/scripts/agent-doc-state.mjs +38 -0
  176. package/scripts/postinstall.mjs +1 -1
  177. package/src/AppShell/AppShell.tsx +45 -1
  178. package/src/AspectRatio/AspectRatio.test.tsx +44 -43
  179. package/src/AspectRatio/AspectRatio.tsx +38 -18
  180. package/src/AspectRatio/__tests__/AspectRatioFitLayers.a11y.browser.spec.ts +157 -0
  181. package/src/Avatar/Avatar.doc.mjs +5 -3
  182. package/src/AvatarGroup/AvatarGroup.doc.mjs +3 -2
  183. package/src/Breadcrumbs/BreadcrumbItem.tsx +4 -1
  184. package/src/Breadcrumbs/Breadcrumbs.test.tsx +30 -1
  185. package/src/Button/Button.doc.mjs +2 -2
  186. package/src/Button/Button.test.tsx +155 -9
  187. package/src/Button/Button.tsx +39 -16
  188. package/src/Button/__tests__/Button.a11y.known-failures.ts +1 -62
  189. package/src/Button/__tests__/Button.a11y.states.ts +0 -10
  190. package/src/Card/Card.doc.mjs +1 -1
  191. package/src/Chat/__tests__/ChatMessageMetadata.a11y.chromium.spec.ts +3 -1
  192. package/src/CheckboxInput/CheckboxInput.test.tsx +34 -0
  193. package/src/CheckboxInput/CheckboxInput.tsx +3 -1
  194. package/src/CheckboxList/CheckboxList.test.tsx +22 -0
  195. package/src/CheckboxList/CheckboxListItem.doc.mjs +16 -0
  196. package/src/CheckboxList/CheckboxListItem.tsx +10 -0
  197. package/src/Code/Code.doc.mjs +1 -0
  198. package/src/CommandPalette/CommandPalette.doc.mjs +2 -0
  199. package/src/CommandPalette/CommandPaletteInput.test.tsx +53 -4
  200. package/src/CommandPalette/CommandPaletteInput.tsx +33 -3
  201. package/src/CommandPalette/__tests__/CommandPaletteInputAudit.a11y.chromium.spec.ts +335 -0
  202. package/src/CommandPalette/__tests__/CommandPaletteItemAudit.a11y.chromium.spec.ts +292 -0
  203. package/src/ContextMenu/ContextMenu.doc.mjs +2 -3
  204. package/src/ContextMenu/ContextMenu.tsx +4 -1
  205. package/src/ContextMenu/__tests__/ContextMenuAudit.a11y.chromium.spec.ts +438 -0
  206. package/src/Dialog/Dialog.test.tsx +46 -0
  207. package/src/Dialog/Dialog.tsx +20 -7
  208. package/src/Dialog/__tests__/Dialog.a11y.known-failures.ts +0 -14
  209. package/src/Drawer/Drawer.doc.mjs +473 -0
  210. package/src/Drawer/Drawer.spec.md +357 -0
  211. package/src/Drawer/Drawer.test.tsx +1300 -0
  212. package/src/Drawer/Drawer.tsx +613 -0
  213. package/src/Drawer/DrawerDirection.test.tsx +127 -0
  214. package/src/Drawer/DrawerHeader.doc.mjs +293 -0
  215. package/src/Drawer/DrawerHeader.test.tsx +102 -0
  216. package/src/Drawer/DrawerHeader.tsx +235 -0
  217. package/src/Drawer/__tests__/DrawerAudit.a11y.chromium.spec.ts +401 -0
  218. package/src/Drawer/__tests__/DrawerHeaderAudit.a11y.chromium.spec.ts +297 -0
  219. package/src/Drawer/index.ts +13 -0
  220. package/src/Drawer/useDrawerDialogPresence.ts +284 -0
  221. package/src/DropdownMenu/DropdownMenu.ssr.test.tsx +57 -0
  222. package/src/DropdownMenu/DropdownMenu.test.tsx +79 -18
  223. package/src/DropdownMenu/DropdownMenu.tsx +83 -12
  224. package/src/DropdownMenu/DropdownMenuContext.tsx +24 -0
  225. package/src/DropdownMenu/DropdownMenuDivider.doc.mjs +2 -2
  226. package/src/DropdownMenu/DropdownMenuDivider.spec.md +192 -0
  227. package/src/DropdownMenu/DropdownMenuDivider.tsx +9 -5
  228. package/src/DropdownMenu/DropdownMenuGroup.doc.mjs +169 -10
  229. package/src/DropdownMenu/DropdownMenuGroup.tsx +6 -4
  230. package/src/DropdownMenu/DropdownMenuLazySheet.test.tsx +126 -0
  231. package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +185 -0
  232. package/src/DropdownMenu/DropdownMenuSubMenu.tsx +19 -5
  233. package/src/DropdownMenu/__tests__/DropdownMenuDividerAudit.a11y.chromium.spec.ts +280 -0
  234. package/src/DropdownMenu/__tests__/DropdownMenuGroupAudit.a11y.chromium.spec.ts +334 -0
  235. package/src/DropdownMenu/__tests__/Menu.a11y.chromium.spec.ts +145 -0
  236. package/src/DropdownMenu/__tests__/Menu.a11y.known-failures.ts +26 -0
  237. package/src/DropdownMenu/__tests__/Menu.a11y.renders.tsx +65 -0
  238. package/src/DropdownMenu/__tests__/Menu.a11y.states.ts +138 -0
  239. package/src/DropdownMenu/__tests__/Menu.a11y.test.tsx +136 -0
  240. package/src/DropdownMenu/__tests__/warmMenuBottomSheet.tsx +43 -0
  241. package/src/DropdownMenu/lazyMenuBottomSheet.ts +71 -0
  242. package/src/EmptyState/EmptyState.doc.mjs +3 -2
  243. package/src/EmptyState/EmptyState.spec.md +189 -0
  244. package/src/EmptyState/EmptyState.test.tsx +74 -3
  245. package/src/EmptyState/EmptyState.tsx +4 -8
  246. package/src/Field/Field.doc.mjs +14 -8
  247. package/src/Field/Field.spec.md +217 -0
  248. package/src/Field/Field.test.tsx +60 -2
  249. package/src/Field/Field.tsx +17 -8
  250. package/src/Field/FieldLabel.doc.mjs +133 -26
  251. package/src/Field/FieldLabel.spec.md +172 -0
  252. package/src/Field/__tests__/FieldLabelAudit.a11y.chromium.spec.ts +296 -0
  253. package/src/Grid/GridSpan.tsx +3 -0
  254. package/src/Heading/Heading.test.tsx +57 -0
  255. package/src/Heading/Heading.tsx +6 -2
  256. package/src/HoverCard/HoverCard.test.tsx +58 -0
  257. package/src/HoverCard/useHoverCard.tsx +10 -2
  258. package/src/Icon/Icon.doc.mjs +36 -0
  259. package/src/IconButton/IconButton.doc.mjs +2 -2
  260. package/src/IconButton/IconButton.test.tsx +3 -1
  261. package/src/Item/Item.doc.mjs +12 -8
  262. package/src/Item/Item.spec.md +226 -0
  263. package/src/Item/Item.test.tsx +61 -0
  264. package/src/Item/Item.tsx +40 -4
  265. package/src/Layer/layerViewportInset.source-build.test.mjs +90 -0
  266. package/src/Layer/layerViewportInset.stylex.ts +6 -2
  267. package/src/Layer/layerViewportInset.test.ts +1 -0
  268. package/src/Layer/useLayer.tsx +24 -13
  269. package/src/Layer/useLayerDismissal.ts +1 -1
  270. package/src/Layout/LayoutHeader.doc.mjs +5 -0
  271. package/src/Layout/container.stylex.ts +6 -6
  272. package/src/List/List.doc.mjs +14 -1
  273. package/src/List/List.spec.md +129 -77
  274. package/src/List/List.test.tsx +163 -94
  275. package/src/List/List.tsx +74 -18
  276. package/src/List/ListContext.tsx +9 -3
  277. package/src/List/ListItem.doc.mjs +24 -5
  278. package/src/List/ListItem.tsx +56 -27
  279. package/src/List/index.ts +1 -1
  280. package/src/Markdown/Markdown.tsx +14 -1
  281. package/src/Markdown/plugins/frontmatter.test.tsx +25 -0
  282. package/src/Markdown/plugins/frontmatter.ts +7 -3
  283. package/src/MetadataList/MetadataList.doc.mjs +3 -3
  284. package/src/MetadataList/MetadataList.test.tsx +38 -0
  285. package/src/MetadataList/MetadataList.tsx +8 -1
  286. package/src/MetadataList/MetadataListContext.tsx +1 -1
  287. package/src/MobileNav/MobileNav.tsx +30 -3
  288. package/src/MobileNav/MobileNavCloseEdgeCases.test.tsx +173 -15
  289. package/src/MoreMenu/MoreMenu.test.tsx +5 -1
  290. package/src/MultiSelector/MultiSelector.test.tsx +159 -0
  291. package/src/MultiSelector/MultiSelector.tsx +40 -7
  292. package/src/MultiSelector/OptionActions.a11y.chromium.spec.ts +112 -2
  293. package/src/MultiSelector/hooks.ts +3 -1
  294. package/src/MultiSelector/useMultiCombobox.doc.mjs +267 -0
  295. package/src/Pagination/Pagination.doc.mjs +7 -7
  296. package/src/Pagination/Pagination.spec.md +9 -9
  297. package/src/Pagination/Pagination.test.tsx +242 -0
  298. package/src/Pagination/Pagination.tsx +27 -11
  299. package/src/Popover/Popover.test.tsx +2 -2
  300. package/src/Popover/Popover.tsx +4 -4
  301. package/src/PowerSearch/PowerSearch.test.tsx +85 -0
  302. package/src/PowerSearch/PowerSearch.tsx +2 -2
  303. package/src/ProgressBar/ProgressBar.doc.mjs +1 -0
  304. package/src/RadioList/RadioList.fr10.test.tsx +45 -2
  305. package/src/RadioList/RadioList.test.tsx +22 -0
  306. package/src/RadioList/RadioList.tsx +4 -1
  307. package/src/RadioList/RadioListItem.doc.mjs +16 -0
  308. package/src/RadioList/RadioListItem.tsx +10 -1
  309. package/src/Resizable/useResizable.doc.mjs +2 -0
  310. package/src/ScrollableArea/ScrollableArea.doc.mjs +1 -1
  311. package/src/Selector/hooks.ts +6 -2
  312. package/src/Selector/useCombobox.doc.mjs +237 -0
  313. package/src/SideNav/SideNav.spec.md +227 -0
  314. package/src/SideNav/SideNav.test.tsx +179 -0
  315. package/src/SideNav/SideNavItem.doc.mjs +2 -2
  316. package/src/SideNav/SideNavItem.tsx +96 -17
  317. package/src/Slider/Slider.spec.md +39 -18
  318. package/src/Spinner/Spinner.doc.mjs +1 -1
  319. package/src/Switch/Switch.test.tsx +49 -0
  320. package/src/Switch/Switch.tsx +11 -0
  321. package/src/TabList/TabList.spec.md +57 -44
  322. package/src/TabList/TabList.test.tsx +67 -0
  323. package/src/TabList/TabMenu.doc.mjs +4 -3
  324. package/src/TabList/TabMenu.tsx +7 -4
  325. package/src/Text/Text.test.tsx +57 -0
  326. package/src/Text/Text.tsx +6 -2
  327. package/src/Text/useTruncation.test.tsx +69 -0
  328. package/src/Text/useTruncation.ts +16 -5
  329. package/src/TimeInput/TimeInput.fr10.test.tsx +15 -0
  330. package/src/Timestamp/Timestamp.doc.mjs +1 -1
  331. package/src/ToggleButton/ToggleButton.test.tsx +95 -0
  332. package/src/ToggleButton/ToggleButton.tsx +12 -1
  333. package/src/ToggleButton/ToggleButtonGroup.doc.mjs +4 -0
  334. package/src/Tokenizer/Tokenizer.test.tsx +54 -1
  335. package/src/Toolbar/Toolbar.test.tsx +0 -8
  336. package/src/Toolbar/__tests__/Toolbar.a11y.chromium.spec.ts +163 -0
  337. package/src/Toolbar/__tests__/Toolbar.a11y.renders.tsx +63 -0
  338. package/src/Toolbar/__tests__/Toolbar.a11y.states.ts +142 -0
  339. package/src/Toolbar/__tests__/Toolbar.a11y.test.tsx +126 -0
  340. package/src/Tooltip/Tooltip.test.tsx +31 -0
  341. package/src/Tooltip/useTooltip.test.tsx +13 -0
  342. package/src/Tooltip/useTooltip.tsx +11 -0
  343. package/src/TopNav/TopNavMegaMenu.test.tsx +22 -0
  344. package/src/TopNav/TopNavMegaMenu.tsx +7 -3
  345. package/src/TopNav/TopNavMenu.test.tsx +19 -0
  346. package/src/TopNav/TopNavMenu.tsx +11 -3
  347. package/src/TreeList/TreeList.doc.mjs +1 -0
  348. package/src/TreeList/TreeList.spec.md +29 -17
  349. package/src/TreeList/TreeList.test.tsx +327 -6
  350. package/src/TreeList/TreeList.tsx +5 -1
  351. package/src/TreeList/TreeListBranches.tsx +6 -0
  352. package/src/TreeList/TreeListItem.tsx +88 -13
  353. package/src/Typeahead/BaseTypeahead.tsx +26 -0
  354. package/src/Typeahead/Typeahead.test.tsx +260 -2
  355. package/src/docPropLiterals.test.ts +36 -10
  356. package/src/hooks/useEntryAnimation.doc.mjs +4 -4
  357. package/src/hooks/useEntryAnimation.ssr.test.tsx +143 -0
  358. package/src/hooks/useEntryAnimation.ts +15 -16
  359. package/src/hooks/useIsHydrating.test.tsx +70 -0
  360. package/src/hooks/useIsHydrating.ts +31 -0
  361. package/src/hooks/useMenuHover.ts +18 -13
  362. package/src/i18n/InternationalizationProvider.doc.mjs +8 -0
  363. package/src/i18n/InternationalizationProvider.spec.md +252 -0
  364. package/src/i18n/__tests__/InternationalizationProvider.test.tsx +128 -0
  365. package/src/i18n/generated-locales/en.generated.ts +121 -0
  366. package/src/i18n/generated-locales/pseudo.generated.ts +121 -0
  367. package/src/i18n/useTranslator.test.tsx +37 -0
  368. package/src/index.ts +1 -0
  369. package/src/postinstall.test.mjs +46 -0
  370. package/src/reset.css +0 -29
  371. package/src/theme/derivedVarRegistry.test.ts +7 -3
  372. package/src/theme/derivedVarRegistry.ts +0 -3
  373. package/src/utils/focusOutline.stylex.ts +4 -0
  374. package/src/utils/plainDate.test.ts +37 -1
  375. package/src/utils/plainDate.ts +15 -5
  376. package/src/utils/sharedMutationObserver.test.ts +53 -0
  377. package/src/utils/sharedMutationObserver.ts +78 -0
@@ -163,6 +163,27 @@ const runtimeCatalog: Readonly<Record<string, string>> = {
163
163
  '⟦{itemName} ðřóþþéð àţ þóšíţíóñ {position, number} óƒ {total, number}.⟧',
164
164
  '@astryx.listInput.announceAlreadyAtBoundary':
165
165
  '⟦Ţĥíš {itemName} íš àłřéàðý {boundary, select, first {first} last {last} other {}}.⟧',
166
+ '@astryx.diffViewer.label': '⟦Ð탃⟧',
167
+ '@astryx.diffViewer.renamedPath': '⟦{oldPath} → {newPath}⟧',
168
+ '@astryx.diffViewer.statusAdded': '⟦Àððéð⟧',
169
+ '@astryx.diffViewer.statusDeleted': '⟦Ðéłéţéð⟧',
170
+ '@astryx.diffViewer.statusRenamed': '⟦Řéñàɱéð⟧',
171
+ '@astryx.diffViewer.addedCount': '⟦+{count, number}⟧',
172
+ '@astryx.diffViewer.removedCount': '⟦−{count, number}⟧',
173
+ '@astryx.diffViewer.stats':
174
+ '⟦{added, plural, one {# line added} other {# lines added}}, {removed, plural, one {# line removed} other {# lines removed}}⟧',
175
+ '@astryx.diffViewer.added': '⟦Àððéð⟧',
176
+ '@astryx.diffViewer.removed': '⟦Řéɱóṽéð⟧',
177
+ '@astryx.diffViewer.lineNumberButton':
178
+ '⟦{side, select, old {Original line {line, number}} other {Changed line {line, number}}}⟧',
179
+ '@astryx.diffViewer.columnOldLine': '⟦Óříĝíñàł łíñé ñúɱƀéř⟧',
180
+ '@astryx.diffViewer.columnNewLine': '⟦Çĥàñĝéð łíñé ñúɱƀéř⟧',
181
+ '@astryx.diffViewer.columnChange': '⟦Çĥàñĝé⟧',
182
+ '@astryx.diffViewer.columnCode': '⟦Çóðé⟧',
183
+ '@astryx.diffViewer.columnOldCode': '⟦Óříĝíñàł çóðé⟧',
184
+ '@astryx.diffViewer.columnNewCode': '⟦Çĥàñĝéð çóðé⟧',
185
+ '@astryx.diffViewer.binary': '⟦Ɓíñàřý ƒíłé ñóţ šĥóŵñ⟧',
186
+ '@astryx.diffViewer.noChanges': '⟦Ñó çóñţéñţ çĥàñĝéš⟧',
166
187
  '@astryx.markdownHeadingLinks.copied': '⟦Łíñķ çóþíéð⟧',
167
188
  '@astryx.markdownHeadingLinks.copy': '⟦Çóþý łíñķ ţó {heading}⟧',
168
189
  '@astryx.richTextEditor.tabEscapeHint':
@@ -468,6 +489,106 @@ const runtimeCatalog: Readonly<Record<string, string>> = {
468
489
  '@astryx.transferListSelector.apply': '⟦Àþþłý⟧',
469
490
  '@astryx.transferListSelector.cancel': '⟦Çàñçéł⟧',
470
491
  '@astryx.transferListSelector.triggerLabel': '⟦{count, number} šéłéçţéð⟧',
492
+ '@astryx.emojiPicker.label': '⟦Éɱóĵí⟧',
493
+ '@astryx.emojiPicker.searchLabel': '⟦Šéàřçĥ éɱóĵí⟧',
494
+ '@astryx.emojiPicker.frequentlyUsed': '⟦Ƒřéɋúéñţłý úšéð⟧',
495
+ '@astryx.emojiPicker.searchResults': '⟦Šéàřçĥ řéšúłţš⟧',
496
+ '@astryx.emojiPicker.noResults': '⟦Ñó éɱóĵí ɱàţçĥ “{query}”⟧',
497
+ '@astryx.emojiPicker.loading': '⟦Łóàðíñĝ éɱóĵí⟧',
498
+ '@astryx.emojiPicker.loadFailed': "⟦Ṁóřé éɱóĵí çóúłðñ'ţ ƀé łóàðéð.⟧",
499
+ '@astryx.emojiPicker.groupSmileysEmotion': '⟦Šɱíłéýš & éɱóţíóñ⟧',
500
+ '@astryx.emojiPicker.groupPeopleBody': '⟦Þéóþłé & ƀóðý⟧',
501
+ '@astryx.emojiPicker.groupAnimalsNature': '⟦Àñíɱàłš & ñàţúřé⟧',
502
+ '@astryx.emojiPicker.groupFoodDrink': '⟦Ƒóóð & ðříñķ⟧',
503
+ '@astryx.emojiPicker.groupTravelPlaces': '⟦Ţřàṽéł & þłàçéš⟧',
504
+ '@astryx.emojiPicker.groupActivities': '⟦Àçţíṽíţíéš⟧',
505
+ '@astryx.emojiPicker.groupObjects': '⟦Óƀĵéçţš⟧',
506
+ '@astryx.emojiPicker.groupSymbols': '⟦Šýɱƀółš⟧',
507
+ '@astryx.emojiPicker.groupFlags': '⟦Ƒłàĝš⟧',
508
+ '@astryx.comments.retry': '⟦Řéţřý⟧',
509
+ '@astryx.commentComposer.placeholder': '⟦Ŵříţé à çóɱɱéñţ…⟧',
510
+ '@astryx.commentComposer.noAgents': '⟦Ñó àĝéñţš⟧',
511
+ '@astryx.commentComposer.agents': '⟦Àĝéñţš⟧',
512
+ '@astryx.commentComposer.uploadFailed': "⟦Íɱàĝéš çóúłðñ'ţ ƀé àððéð⟧",
513
+ '@astryx.commentComposer.imagesOnly': '⟦Óñłý íɱàĝé ƒíłéš çàñ ƀé àððéð⟧',
514
+ '@astryx.commentComposer.chooseImages': '⟦Çĥóóšé íɱàĝéš⟧',
515
+ '@astryx.commentComposer.imageAlt': '⟦Íɱàĝé àţţàçĥɱéñţ⟧',
516
+ '@astryx.commentComposer.removeQuote': '⟦Řéɱóṽé ɋúóţéð ţéẋţ⟧',
517
+ '@astryx.commentComposer.attachImages': '⟦Àţţàçĥ íɱàĝéš⟧',
518
+ '@astryx.commentComposer.addEmoji': '⟦Àðð éɱóĵí⟧',
519
+ '@astryx.commentComposer.cancel': '⟦Çàñçéł⟧',
520
+ '@astryx.comments.actionsLabel': "⟦Àçţíóñš ƒóř {name}'š çóɱɱéñţ⟧",
521
+ '@astryx.comments.addReaction': '⟦Àðð řéàçţíóñ⟧',
522
+ '@astryx.comments.agentBadge': '⟦Àĝéñţ⟧',
523
+ '@astryx.comments.agentLogo': '⟦{name} łóĝó⟧',
524
+ '@astryx.comments.chooseReaction': '⟦Çĥóóšé à řéàçţíóñ⟧',
525
+ '@astryx.comments.copyLink': '⟦Çóþý çóɱɱéñţ łíñķ⟧',
526
+ '@astryx.comments.currentVersion': '⟦Çúřřéñţ ṽéřšíóñ⟧',
527
+ '@astryx.comments.delete': '⟦Ðéłéţé⟧',
528
+ '@astryx.comments.deleteDescription':
529
+ "⟦Ðéłéţé {name}'š çóɱɱéñţ? Ţĥíš àçţíóñ çàññóţ ƀé úñðóñé.⟧",
530
+ '@astryx.comments.deleteFailed': "⟦Ţĥíš çóɱɱéñţ çóúłðñ'ţ ƀé ðéłéţéð.⟧",
531
+ '@astryx.comments.deleteFailedRetry':
532
+ "⟦Ţĥíš çóɱɱéñţ çóúłðñ'ţ ƀé ðéłéţéð. Ţřý àĝàíñ.⟧",
533
+ '@astryx.comments.deleteTitle': '⟦Ðéłéţé çóɱɱéñţ?⟧',
534
+ '@astryx.comments.edit': '⟦Éðíţ⟧',
535
+ '@astryx.comments.editFailed': "⟦Ýóúř éðíţ çóúłðñ'ţ ƀé šàṽéð.⟧",
536
+ '@astryx.comments.editPlaceholder': '⟦Éðíţ çóɱɱéñţ⟧',
537
+ '@astryx.comments.edited': '⟦Éðíţéð⟧',
538
+ '@astryx.comments.editingContext': '⟦Éðíţíñĝ çóɱɱéñţ⟧',
539
+ '@astryx.comments.hideReplies': '⟦Ĥíðé řéþłíéš⟧',
540
+ '@astryx.comments.historyEmptyDescription':
541
+ '⟦Ţĥíš çóɱɱéñţ ĥàš ñó éàřłíéř ṽéřšíóñš.⟧',
542
+ '@astryx.comments.historyEmptyTitle': '⟦Ñó éðíţ ĥíšţóřý⟧',
543
+ '@astryx.comments.historyFailed': "⟦Éðíţ ĥíšţóřý çóúłðñ'ţ łóàð⟧",
544
+ '@astryx.comments.historyLoadFailed':
545
+ "⟦Ţĥé çóɱɱéñţ'š éðíţ ĥíšţóřý çóúłðñ'ţ ƀé łóàðéð. Ţřý àĝàíñ.⟧",
546
+ '@astryx.comments.historyLoading': '⟦Łóàðíñĝ éðíţ ĥíšţóřý⟧',
547
+ '@astryx.comments.historySubtitle': '⟦Çóɱɱéñţ ƀý {name}⟧',
548
+ '@astryx.comments.historyTitle': '⟦Éðíţ ĥíšţóřý⟧',
549
+ '@astryx.comments.linkCopied': '⟦Çóɱɱéñţ łíñķ çóþíéð⟧',
550
+ '@astryx.comments.otherReactors':
551
+ '⟦{count, plural, one {# other} other {# others}}⟧',
552
+ '@astryx.comments.outdated': '⟦Óúţðàţéð⟧',
553
+ '@astryx.comments.reactionCelebrate': '⟦Çéłéƀřàţé⟧',
554
+ '@astryx.comments.reactionCount': '⟦{reaction}: {count, number}⟧',
555
+ '@astryx.comments.reactionFailed': "⟦Ýóúř řéàçţíóñ çóúłðñ'ţ ƀé šàṽéð.⟧",
556
+ '@astryx.comments.reactionLaugh': '⟦Ĥàĥà⟧',
557
+ '@astryx.comments.reactionLike': '⟦Łíķé⟧',
558
+ '@astryx.comments.reactionLove': '⟦Łóṽé⟧',
559
+ '@astryx.comments.reactionSad': '⟦Šàð⟧',
560
+ '@astryx.comments.reactionWow': '⟦Ŵóŵ⟧',
561
+ '@astryx.comments.reopen': '⟦Řéóþéñ⟧',
562
+ '@astryx.comments.reopenFailed': "⟦Ţĥíš ţĥřéàð çóúłðñ'ţ ƀé řéóþéñéð.⟧",
563
+ '@astryx.comments.reply': '⟦Řéþłý⟧',
564
+ '@astryx.comments.replyFailed': "⟦Ýóúř řéþłý çóúłðñ'ţ ƀé þóšţéð.⟧",
565
+ '@astryx.comments.replyPlaceholder': '⟦Řéþłý ţó {name}…⟧',
566
+ '@astryx.comments.replyingContext': '⟦Řéþłýíñĝ ţó {name}⟧',
567
+ '@astryx.comments.resolve': '⟦Ṁàřķ àš řéšółṽéð⟧',
568
+ '@astryx.comments.resolveFailed': "⟦Ţĥíš ţĥřéàð çóúłðñ'ţ ƀé řéšółṽéð.⟧",
569
+ '@astryx.comments.resolved': '⟦Řéšółṽéð⟧',
570
+ '@astryx.comments.resolvedBy': '⟦Řéšółṽéð ƀý {name}⟧',
571
+ '@astryx.comments.retryFailed': "⟦Řéţřýíñĝ ðíðñ'ţ ŵóřķ.⟧",
572
+ '@astryx.comments.sendFailed': "⟦Çóúłðñ'ţ šéñð ţĥíš çóɱɱéñţ.⟧",
573
+ '@astryx.comments.threadLabel': '⟦Ţĥřéàð ƀý {name}⟧',
574
+ '@astryx.comments.unread': '⟦Ñéŵ⟧',
575
+ '@astryx.comments.unsavedDraft':
576
+ '⟦Úñšàṽéð ðřàƒţ. Ðíšɱíšš àĝàíñ ţó ðíšçàřð íţ.⟧',
577
+ '@astryx.comments.versionAuthor': '⟦ƀý {name}⟧',
578
+ '@astryx.comments.viewHistory': '⟦Ṽíéŵ éðíţ ĥíšţóřý⟧',
579
+ '@astryx.comments.viewReplies':
580
+ '⟦Ṽíéŵ {count, plural, one {# reply} other {# replies}}⟧',
581
+ '@astryx.comments.commentsLabel': '⟦Ţĥřéàðš íñ {label}⟧',
582
+ '@astryx.comments.emptyDescription': '⟦Šţàřţ ţĥé ðíšçúššíóñ ŵíţĥ à çóɱɱéñţ.⟧',
583
+ '@astryx.comments.emptyReadOnlyDescription':
584
+ '⟦Ţĥéřé íš ñó ðíšçúššíóñ óñ ţĥíš íţéɱ.⟧',
585
+ '@astryx.comments.emptyTitle': '⟦Ñó çóɱɱéñţš ýéţ⟧',
586
+ '@astryx.comments.label': '⟦Çóɱɱéñţš⟧',
587
+ '@astryx.comments.loadFailed': "⟦Çóɱɱéñţš çóúłðñ'ţ łóàð⟧",
588
+ '@astryx.comments.loadOlder': '⟦Łóàð éàřłíéř çóɱɱéñţš⟧',
589
+ '@astryx.comments.loading': '⟦Łóàðíñĝ çóɱɱéñţš⟧',
590
+ '@astryx.comments.olderFailed': "⟦Éàřłíéř çóɱɱéñţš çóúłðñ'ţ łóàð⟧",
591
+ '@astryx.comments.postFailed': "⟦Ýóúř çóɱɱéñţ çóúłðñ'ţ ƀé þóšţéð.⟧",
471
592
  };
472
593
 
473
594
  export default runtimeCatalog;
@@ -32,6 +32,12 @@ const FR_MESSAGES: MessagesByLocale = {
32
32
  const FR_RUNTIME_MESSAGES: ProviderMessagesByLocale = {
33
33
  fr: {'@astryx.pagination.next': 'Page suivante compacte'},
34
34
  };
35
+ // One messages value mixing shapes: a generated string map for the active
36
+ // locale and a rich catalog for its parent.
37
+ const MIXED_MESSAGES: ProviderMessagesByLocale = {
38
+ 'fr-CA': {'@astryx.pagination.next': 'Page suivante (CA)'},
39
+ fr: {'@astryx.pagination.previous': {defaultMessage: 'Page précédente'}},
40
+ };
35
41
  const FR_OVERRIDES: Overrides = {
36
42
  fr: {'@astryx.pagination.next': 'Suivant'},
37
43
  };
@@ -101,6 +107,37 @@ describe('useTranslator — resolution', () => {
101
107
  ).toEqual({defaultMessage: 'Page suivante compacte'});
102
108
  });
103
109
 
110
+ it('resolves rich and runtime catalogs mixed in one messages value', () => {
111
+ const {result} = renderHook(
112
+ () => ({
113
+ context: use(InternationalizationContext),
114
+ translate: useTranslator(),
115
+ }),
116
+ {
117
+ wrapper: ({children}) => (
118
+ <InternationalizationProvider
119
+ locale="fr-CA"
120
+ messages={MIXED_MESSAGES}>
121
+ {children}
122
+ </InternationalizationProvider>
123
+ ),
124
+ },
125
+ );
126
+
127
+ expect(result.current.translate('@astryx.pagination.next')).toBe(
128
+ 'Page suivante (CA)',
129
+ );
130
+ expect(result.current.translate('@astryx.pagination.previous')).toBe(
131
+ 'Page précédente',
132
+ );
133
+ expect(result.current.context.messages).toEqual({
134
+ 'fr-CA': {
135
+ '@astryx.pagination.next': {defaultMessage: 'Page suivante (CA)'},
136
+ },
137
+ fr: {'@astryx.pagination.previous': {defaultMessage: 'Page précédente'}},
138
+ });
139
+ });
140
+
104
141
  it('lets a provider override beat the provider catalog', () => {
105
142
  const {result} = renderHook(() => useTranslator(), {
106
143
  wrapper: ({children}) => (
package/src/index.ts CHANGED
@@ -95,6 +95,7 @@ export * from './AlertDialog';
95
95
  export * from './Dialog';
96
96
  export * from './ContextMenu';
97
97
  export * from './DropdownMenu';
98
+ export * from './Drawer';
98
99
  export * from './MoreMenu';
99
100
  export * from './InteractiveRoleContext';
100
101
  export * from './SizeContext';
@@ -11,12 +11,15 @@
11
11
  */
12
12
 
13
13
  import {describe, it, expect, beforeEach, afterEach} from 'vitest';
14
+ import {spawnSync} from 'node:child_process';
14
15
  import * as fs from 'node:fs';
15
16
  import * as os from 'node:os';
16
17
  import * as path from 'node:path';
18
+ import {fileURLToPath} from 'node:url';
17
19
  // Core's own package-local contract copy — what actually runs at install time.
18
20
  import {
19
21
  isAstryxInitialized,
22
+ isAstryxPromptInReach,
20
23
  shouldNudge,
21
24
  AGENT_DOC_PATHS,
22
25
  INIT_MARKERS,
@@ -98,6 +101,49 @@ describe('core postinstall — one authoritative source, no drift', () => {
98
101
  write('AGENTS.md', `# doc\n${MARKER}\nbody`);
99
102
  expect(isAstryxInitialized(tmp)).toBe(cliLeaf.isAstryxInitialized(tmp));
100
103
  });
104
+
105
+ it('agrees with the CLI leaf on a monorepo package', () => {
106
+ fs.mkdirSync(path.join(tmp, '.git'));
107
+ write('AGENTS.md', MARKER);
108
+ write('packages/app/package.json', '{"name":"app"}');
109
+ const app = path.join(tmp, 'packages/app');
110
+ expect(isAstryxPromptInReach(app)).toBe(true);
111
+ expect(isAstryxPromptInReach(app)).toBe(cliLeaf.isAstryxPromptInReach(app));
112
+ });
113
+ });
114
+
115
+ // Install time, end to end: core's real script and its contract copy, installed
116
+ // under a monorepo's node_modules, run the way npm runs them for a package.
117
+ describe('core postinstall — inside a monorepo package', () => {
118
+ const CORE = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
119
+ const install = () => {
120
+ const installed = path.join(tmp, 'node_modules/@astryxdesign/core/scripts');
121
+ fs.mkdirSync(installed, {recursive: true});
122
+ for (const file of ['postinstall.mjs', 'agent-doc-state.mjs']) {
123
+ fs.copyFileSync(path.join(CORE, 'scripts', file), path.join(installed, file));
124
+ }
125
+ return spawnSync(process.execPath, [path.join(installed, 'postinstall.mjs')], {
126
+ env: {...process.env, INIT_CWD: path.join(tmp, 'packages/app'), npm_command: 'install'},
127
+ encoding: 'utf8',
128
+ });
129
+ };
130
+ beforeEach(() => {
131
+ fs.mkdirSync(path.join(tmp, '.git'));
132
+ write('packages/app/package.json', '{"name":"app"}');
133
+ });
134
+
135
+ it('stays quiet when init ran at the repository root', () => {
136
+ write('AGENTS.md', MARKER);
137
+ const r = install();
138
+ expect(r.status).toBe(0);
139
+ expect(r.stdout).toBe('');
140
+ });
141
+
142
+ it('still nudges when no folder up to the repository root ran init', () => {
143
+ const r = install();
144
+ expect(r.status).toBe(0);
145
+ expect(r.stdout).toMatch(/finish setup and install the Astryx agent prompt/);
146
+ });
101
147
  });
102
148
 
103
149
  describe('core postinstall — shouldNudge', () => {
package/src/reset.css CHANGED
@@ -203,35 +203,6 @@
203
203
  height: auto;
204
204
  }
205
205
 
206
- /* ===========================================================================
207
- AspectRatio Fit Baseline
208
- =========================================================================== */
209
-
210
- /*
211
- * Child sizing for AspectRatio's `fit` prop — the component marks the
212
- * child's direct parent with `data-astryx-aspect-ratio-override` (carrying
213
- * the fit value), and these direct-child rules size the child, so
214
- * consumers don't hand-write width/height/object-fit on every media child.
215
- * The marker sits on the parent itself, so the rules don't depend on
216
- * AspectRatio's internal element structure or its theming surface. As with
217
- * the [data-astryx-media] baseline below, the rules are zero-specificity
218
- * and any styling the child sets itself still wins. `fit="center"` needs
219
- * no rules here — the component centers the child from its own wrapper.
220
- */
221
- :where([data-astryx-aspect-ratio-override="cover"], [data-astryx-aspect-ratio-override="contain"])
222
- > :where(*) {
223
- width: 100%;
224
- height: 100%;
225
- }
226
-
227
- :where([data-astryx-aspect-ratio-override="cover"]) > :where(img, video) {
228
- object-fit: cover;
229
- }
230
-
231
- :where([data-astryx-aspect-ratio-override="contain"]) > :where(img, video) {
232
- object-fit: contain;
233
- }
234
-
235
206
  /* ===========================================================================
236
207
  Forms
237
208
  =========================================================================== */
@@ -224,9 +224,6 @@ const DIR_TO_REGISTRY_KEY: Record<string, string> = {
224
224
  Chat: 'chat',
225
225
  ContextMenu: 'context-menu',
226
226
  Dialog: 'dialog',
227
- // The Drawer doc file lives in packages/lab/src/Drawer, outside this
228
- // package's scan; the mapping keeps the registry orphan check honest and
229
- // defineTheme.test.ts pins the expansion.
230
227
  Drawer: 'drawer',
231
228
  DropdownMenu: 'dropdown-menu',
232
229
  Field: 'field',
@@ -264,6 +261,9 @@ const CROSS_COMPONENT_VARS: Record<string, string[]> = {
264
261
  // The destructive item variant recolors the Item it renders; Item owns,
265
262
  // documents and reads both slots.
266
263
  DropdownMenu: ['--_item-label-color', '--_item-description-color'],
264
+ // List's edge="flush" zeroes the inline inset of the Item each ListItem
265
+ // renders; Item owns, documents and reads it.
266
+ List: ['--_item-inset-inline'],
267
267
  // A layer content root stops an outer Stepper's connector gap; Stepper owns,
268
268
  // documents and reads it.
269
269
  Layer: ['--step-connector-gap'],
@@ -319,6 +319,10 @@ const VARS_WITHOUT_DERIVED_MAPPING = new Set([
319
319
  '--tree-list-indent',
320
320
  '--_tree-indent',
321
321
  '--tree-list-row-gap',
322
+ // Published by each treeitem while it has keyboard focus and read as its
323
+ // row's z-index, so the focused row paints above the guide lines. Focus
324
+ // state, not a value a theme author sets.
325
+ '--_tree-focus-z',
322
326
  // Clipped on the ONE side each on-track connector segment faces the
323
327
  // indicator from — trailing above the node, leading below it, mirrored
324
328
  // again per axis. No standard property maps onto this purpose-based seam:
@@ -59,9 +59,6 @@ export const derivedVarRegistry: Record<string, DerivedVarEntry[]> = {
59
59
  {property: 'borderRadius', vars: ['--_dialog-radius']},
60
60
  {property: 'padding', expand: 'container'},
61
61
  ],
62
- // Drawer lives in @astryxdesign/lab; its doc source of truth is
63
- // packages/lab/src/Drawer/Drawer.doc.mjs, outside this package's consistency
64
- // scan. defineTheme.test.ts pins the expansion instead.
65
62
  drawer: [{property: 'padding', expand: 'container'}],
66
63
  'context-menu': [
67
64
  {property: 'borderRadius', vars: ['--_dropdown-menu-radius']},
@@ -70,6 +70,10 @@ const focusOutlineLonghands = {
70
70
  * independently overridable — and every part stays a var, so a theme's
71
71
  * `--focus-outline-*` overrides still flow through.
72
72
  *
73
+ * NOT usable inside another file's `stylex.create`, for the same reason as
74
+ * {@link FOCUS_OUTLINE}: StyleX compiles each member there to a CSS variable
75
+ * nothing defines. Compose the `focusVars` tokens instead.
76
+ *
73
77
  * Keys are camelCase to match `HTMLElement.style`, so this spreads straight
74
78
  * onto an element:
75
79
  *
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
- import {describe, it, expect} from 'vitest';
3
+ import {describe, it, expect, afterEach} from 'vitest';
4
4
  import {
5
5
  type PlainDate,
6
6
  plainDateCreate,
@@ -711,6 +711,42 @@ describe('plainDateGetWeekNumber', () => {
711
711
  expect(plainDateGetWeekNumber({year: 2026, month: 1, day: 4})).toBe(1);
712
712
  });
713
713
 
714
+ // Regression: the week number must not depend on the host timezone's DST
715
+ // offset. Zones whose DST ends after New Year (southern hemisphere) used to
716
+ // add a phantom hour to the Thursday-vs-Jan-1 day count, and in years whose
717
+ // Jan 1 is a Friday that hour rounded a whole week up.
718
+ describe('DST independence', () => {
719
+ const originalTZ = process.env.TZ;
720
+
721
+ afterEach(() => {
722
+ if (originalTZ === undefined) {
723
+ delete process.env.TZ;
724
+ } else {
725
+ process.env.TZ = originalTZ;
726
+ }
727
+ });
728
+
729
+ it.each(['Australia/Sydney', 'Pacific/Auckland', 'America/Santiago'])(
730
+ 'does not round week 14 up to 15 in %s (DST ends after New Year)',
731
+ zone => {
732
+ process.env.TZ = zone;
733
+ // 2021-01-01 is a Friday, so every ISO Thursday falls on a whole
734
+ // multiple of 7 days into the year. 2021-04-05..11 is ISO week 14.
735
+ expect(plainDateGetWeekNumber({year: 2021, month: 4, day: 5})).toBe(14);
736
+ expect(plainDateGetWeekNumber({year: 2021, month: 4, day: 8})).toBe(14);
737
+ expect(plainDateGetWeekNumber({year: 2021, month: 4, day: 11})).toBe(
738
+ 14,
739
+ );
740
+ },
741
+ );
742
+
743
+ it('keeps late-December weeks correct in Australia/Sydney', () => {
744
+ process.env.TZ = 'Australia/Sydney';
745
+ // 2027-12-30 (Thursday) is ISO week 52, not 53.
746
+ expect(plainDateGetWeekNumber({year: 2027, month: 12, day: 30})).toBe(52);
747
+ });
748
+ });
749
+
714
750
  it('keeps years 1-99 instead of mapping them to 1900-1999', () => {
715
751
  // 0004-01-01 is a Thursday (ISO week 1); 1904-01-01 was a Friday.
716
752
  expect(plainDateGetWeekNumber({year: 4, month: 1, day: 1})).toBe(1);
@@ -282,11 +282,21 @@ export function plainDateSetEndOfWeekExclusive(
282
282
  }
283
283
 
284
284
  export function plainDateGetWeekNumber(pd: PlainDate): number {
285
- const d = plainDateToDate(pd);
286
- const dayNum = d.getDay() || 7;
287
- d.setDate(d.getDate() + 4 - dayNum);
288
- const yearStart = plainDateToDate({year: d.getFullYear(), month: 1, day: 1});
289
- return Math.ceil(((d.getTime() - yearStart.getTime()) / 86400000 + 1) / 7);
285
+ // ISO week number: ceil(day-of-year of the week's Thursday / 7). Computed
286
+ // entirely on UTC anchors — the same DST immunity plainDateDiffDays relies
287
+ // on — because mixing local-time instants leaks the host zone's DST offset
288
+ // into the day count. When Jan 1 is a Friday (so every Thursday's day-of-year
289
+ // is an exact multiple of 7), a one-hour offset from a zone whose DST ends
290
+ // after New Year rounds a whole week up: Sydney, Auckland and Santiago users
291
+ // saw week 15 for the week that is ISO week 14. utcTime keeps years 1-99
292
+ // as given, like the other Calendar date helpers.
293
+ const msPerDay = 24 * 60 * 60 * 1000;
294
+ const utcMidnight = utcTime(pd.year, pd.month - 1, pd.day);
295
+ const dayNum = new Date(utcMidnight).getUTCDay() || 7;
296
+ const thursday = utcMidnight + (4 - dayNum) * msPerDay;
297
+ const yearStart = utcTime(new Date(thursday).getUTCFullYear(), 0, 1);
298
+ const dayOfYear = (thursday - yearStart) / msPerDay + 1;
299
+ return Math.ceil(dayOfYear / 7);
290
300
  }
291
301
 
292
302
  // e.g. "Wednesday, May 21, 2026" (locale-dependent)
@@ -0,0 +1,53 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ import {describe, it, expect, vi} from 'vitest';
4
+ import {observeContent} from './sharedMutationObserver';
5
+
6
+ const flush = async () => new Promise(resolve => setTimeout(resolve, 0));
7
+
8
+ describe('observeContent', () => {
9
+ it('calls a registration once per batch for changes anywhere inside its element', async () => {
10
+ const element = document.createElement('div');
11
+ element.innerHTML = '<span>first</span>';
12
+ const callback = vi.fn();
13
+ const unsubscribe = observeContent(element, callback);
14
+
15
+ element.querySelector('span')!.firstChild!.nodeValue = 'second';
16
+ element.append('third');
17
+ await flush();
18
+
19
+ expect(callback).toHaveBeenCalledTimes(1);
20
+ unsubscribe();
21
+ });
22
+
23
+ it('removes only its own registration', async () => {
24
+ const element = document.createElement('div');
25
+ const kept = vi.fn();
26
+ const removed = vi.fn();
27
+ const unsubscribeKept = observeContent(element, kept);
28
+ const unsubscribeRemoved = observeContent(element, removed);
29
+
30
+ unsubscribeRemoved();
31
+ element.textContent = 'changed';
32
+ await flush();
33
+
34
+ expect(kept).toHaveBeenCalledTimes(1);
35
+ expect(removed).not.toHaveBeenCalled();
36
+ unsubscribeKept();
37
+ });
38
+
39
+ it('ignores a released element', async () => {
40
+ const released = document.createElement('div');
41
+ const live = document.createElement('div');
42
+ const releasedCallback = vi.fn();
43
+ const unsubscribeReleased = observeContent(released, releasedCallback);
44
+ const unsubscribeLive = observeContent(live, vi.fn());
45
+
46
+ unsubscribeReleased();
47
+ released.textContent = 'changed';
48
+ await flush();
49
+
50
+ expect(releasedCallback).not.toHaveBeenCalled();
51
+ unsubscribeLive();
52
+ });
53
+ });
@@ -0,0 +1,78 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ /**
6
+ * @file sharedMutationObserver.ts
7
+ * @input MutationObserver API
8
+ * @output Exports observeContent for shared content-change observation
9
+ * @position Internal utility; consumed by useTruncation. The content-change
10
+ * counterpart of sharedResizeObserver: one observer for every element, so a
11
+ * repeated cell or row path does not create one observer per instance.
12
+ */
13
+
14
+ type ContentCallback = () => void;
15
+
16
+ const OPTIONS: MutationObserverInit = {
17
+ characterData: true,
18
+ childList: true,
19
+ subtree: true,
20
+ };
21
+
22
+ let observer: MutationObserver | null = null;
23
+ const callbacks = new Map<Node, Set<ContentCallback>>();
24
+
25
+ function dispatch(records: MutationRecord[]): void {
26
+ // One call per callback per batch, however many records it received. A
27
+ // record's target can be any descendant, so walk up to the observed roots.
28
+ const pending = new Set<ContentCallback>();
29
+ for (const record of records) {
30
+ for (let node: Node | null = record.target; node; node = node.parentNode) {
31
+ callbacks.get(node)?.forEach(callback => pending.add(callback));
32
+ }
33
+ }
34
+ pending.forEach(callback => callback());
35
+ }
36
+
37
+ /**
38
+ * Call `callback` when the element's text or children change (including
39
+ * descendants). Returns an unsubscribe that removes only this registration.
40
+ *
41
+ * MutationObserver has no per-target unobserve, so a released element stays
42
+ * registered with the shared observer until no element remains; its records
43
+ * match no callback and are ignored. The observer disconnects and is released
44
+ * when the last registration goes.
45
+ */
46
+ export function observeContent(
47
+ element: Element,
48
+ callback: ContentCallback,
49
+ ): () => void {
50
+ if (typeof MutationObserver === 'undefined') {
51
+ return () => {};
52
+ }
53
+ observer ??= new MutationObserver(dispatch);
54
+ const existing = callbacks.get(element);
55
+ if (existing) {
56
+ existing.add(callback);
57
+ } else {
58
+ callbacks.set(element, new Set([callback]));
59
+ observer.observe(element, OPTIONS);
60
+ }
61
+
62
+ let isSubscribed = true;
63
+ return () => {
64
+ if (!isSubscribed) {
65
+ return;
66
+ }
67
+ isSubscribed = false;
68
+ const targetCallbacks = callbacks.get(element);
69
+ targetCallbacks?.delete(callback);
70
+ if (targetCallbacks?.size === 0) {
71
+ callbacks.delete(element);
72
+ }
73
+ if (callbacks.size === 0 && observer) {
74
+ observer.disconnect();
75
+ observer = null;
76
+ }
77
+ };
78
+ }