@astryxdesign/core 0.7.1-canary.ff40b78 → 0.7.1

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 (348) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/dist/Button/Button.d.ts +1 -1
  3. package/dist/Button/Button.d.ts.map +1 -1
  4. package/dist/Button/Button.js +5 -2
  5. package/dist/Calendar/Calendar.d.ts.map +1 -1
  6. package/dist/Calendar/Calendar.js +191 -32
  7. package/dist/Chat/ChatComposerInput.d.ts +9 -0
  8. package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
  9. package/dist/Chat/ChatComposerInput.js +5 -0
  10. package/dist/Chat/ChatMessage.d.ts +11 -0
  11. package/dist/Chat/ChatMessage.d.ts.map +1 -1
  12. package/dist/Chat/ChatMessage.js +18 -9
  13. package/dist/Chat/useTriggerMenu.d.ts +9 -2
  14. package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
  15. package/dist/Chat/useTriggerMenu.js +222 -50
  16. package/dist/CodeBlock/CodeBlock.d.ts +10 -1
  17. package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
  18. package/dist/CodeBlock/CodeBlock.js +158 -38
  19. package/dist/CodeBlock/tokenizer.d.ts +39 -0
  20. package/dist/CodeBlock/tokenizer.d.ts.map +1 -1
  21. package/dist/CodeBlock/tokenizer.js +108 -0
  22. package/dist/CommandPalette/CommandPalette.d.ts +9 -5
  23. package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
  24. package/dist/CommandPalette/CommandPalette.js +38 -20
  25. package/dist/CommandPalette/CommandPaletteEmpty.d.ts +4 -3
  26. package/dist/CommandPalette/CommandPaletteEmpty.d.ts.map +1 -1
  27. package/dist/CommandPalette/CommandPaletteEmpty.js +4 -3
  28. package/dist/CommandPalette/CommandPaletteInput.d.ts +5 -4
  29. package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
  30. package/dist/CommandPalette/CommandPaletteInput.js +35 -18
  31. package/dist/CommandPalette/CommandPaletteItem.d.ts +11 -6
  32. package/dist/CommandPalette/CommandPaletteItem.d.ts.map +1 -1
  33. package/dist/CommandPalette/CommandPaletteItem.js +8 -9
  34. package/dist/CommandPalette/CommandPaletteList.d.ts +4 -2
  35. package/dist/CommandPalette/CommandPaletteList.d.ts.map +1 -1
  36. package/dist/CommandPalette/CommandPaletteList.js +10 -5
  37. package/dist/ComplexSelector/ComplexSelector.d.ts +8 -5
  38. package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
  39. package/dist/ComplexSelector/ComplexSelector.js +12 -3
  40. package/dist/ContextMenu/ContextMenu.d.ts +3 -3
  41. package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
  42. package/dist/ContextMenu/ContextMenu.js +62 -48
  43. package/dist/DateInput/DateInput.js +1 -1
  44. package/dist/DateInput/MonthScroller.d.ts.map +1 -1
  45. package/dist/DateInput/MonthScroller.js +12 -4
  46. package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
  47. package/dist/DateRangeInput/DateRangeInput.js +12 -2
  48. package/dist/Dialog/Dialog.d.ts +1 -1
  49. package/dist/Dialog/Dialog.d.ts.map +1 -1
  50. package/dist/Dialog/Dialog.js +16 -5
  51. package/dist/Dialog/DialogHeader.d.ts +1 -1
  52. package/dist/Dialog/DialogHeader.d.ts.map +1 -1
  53. package/dist/Dialog/DialogHeader.js +7 -7
  54. package/dist/Divider/Divider.d.ts +1 -0
  55. package/dist/Divider/Divider.d.ts.map +1 -1
  56. package/dist/Divider/Divider.js +5 -4
  57. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  58. package/dist/DropdownMenu/DropdownMenu.js +161 -65
  59. package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts +7 -5
  60. package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
  61. package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +12 -5
  62. package/dist/Field/InputClearButton.d.ts +8 -4
  63. package/dist/Field/InputClearButton.d.ts.map +1 -1
  64. package/dist/Field/InputClearButton.js +23 -7
  65. package/dist/FormLayout/FormLayout.d.ts.map +1 -1
  66. package/dist/FormLayout/FormLayout.js +1 -0
  67. package/dist/Grid/Grid.d.ts +13 -4
  68. package/dist/Grid/Grid.d.ts.map +1 -1
  69. package/dist/Grid/Grid.js +7 -1
  70. package/dist/HoverCard/useHoverCard.d.ts +1 -1
  71. package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
  72. package/dist/HoverCard/useHoverCard.js +67 -49
  73. package/dist/InputGroup/InputGroup.d.ts +2 -4
  74. package/dist/InputGroup/InputGroup.d.ts.map +1 -1
  75. package/dist/InputGroup/InputGroup.js +2 -4
  76. package/dist/InputGroup/groupStyles.d.ts +10 -2
  77. package/dist/InputGroup/groupStyles.d.ts.map +1 -1
  78. package/dist/InputGroup/groupStyles.js +19 -2
  79. package/dist/Layer/useLayerDismissal.d.ts +9 -9
  80. package/dist/Layer/useLayerDismissal.js +9 -9
  81. package/dist/Markdown/Markdown.d.ts.map +1 -1
  82. package/dist/Markdown/Markdown.js +25 -4
  83. package/dist/MobileNav/MobileNav.d.ts +7 -0
  84. package/dist/MobileNav/MobileNav.d.ts.map +1 -1
  85. package/dist/MobileNav/MobileNav.js +45 -2
  86. package/dist/MultiSelector/MultiSelector.d.ts +7 -4
  87. package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
  88. package/dist/MultiSelector/MultiSelector.js +24 -3
  89. package/dist/NumberInput/NumberInput.js +1 -1
  90. package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
  91. package/dist/PowerSearch/PowerSearchEditPopover.js +6 -0
  92. package/dist/Resizable/ResizeHandle.d.ts +1 -1
  93. package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
  94. package/dist/Resizable/ResizeHandle.js +83 -15
  95. package/dist/Resizable/useResizable.d.ts +23 -0
  96. package/dist/Resizable/useResizable.d.ts.map +1 -1
  97. package/dist/Resizable/useResizable.js +78 -0
  98. package/dist/Selector/Selector.d.ts +6 -3
  99. package/dist/Selector/Selector.d.ts.map +1 -1
  100. package/dist/Selector/Selector.js +28 -6
  101. package/dist/SideNav/SideNav.d.ts.map +1 -1
  102. package/dist/SideNav/SideNav.js +10 -2
  103. package/dist/Slider/Slider.d.ts.map +1 -1
  104. package/dist/Slider/Slider.js +18 -7
  105. package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
  106. package/dist/Tokenizer/Tokenizer.js +16 -4
  107. package/dist/Toolbar/Toolbar.d.ts +2 -1
  108. package/dist/Toolbar/Toolbar.d.ts.map +1 -1
  109. package/dist/Toolbar/Toolbar.js +3 -1
  110. package/dist/TreeList/TreeList.d.ts.map +1 -1
  111. package/dist/TreeList/TreeList.js +6 -3
  112. package/dist/TreeList/TreeListItem.d.ts.map +1 -1
  113. package/dist/TreeList/TreeListItem.js +7 -1
  114. package/dist/astryx.css +22 -0
  115. package/dist/hooks/useScrollOverflow.d.ts.map +1 -1
  116. package/dist/hooks/useScrollOverflow.js +55 -12
  117. package/dist/hooks/useTreeFocus.d.ts +21 -0
  118. package/dist/hooks/useTreeFocus.d.ts.map +1 -1
  119. package/dist/hooks/useTreeFocus.js +40 -2
  120. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  121. package/dist/i18n/generated-locales/en.generated.js +3 -0
  122. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  123. package/dist/i18n/generated-locales/pseudo.generated.js +3 -0
  124. package/dist/reset.a11y.chromium.spec.js +6 -1
  125. package/dist/reset.until-found.a11y.browser.spec.d.ts +2 -0
  126. package/dist/reset.until-found.a11y.browser.spec.d.ts.map +1 -0
  127. package/dist/reset.until-found.a11y.browser.spec.js +71 -0
  128. package/dist/theme/syntax/SyntaxTheme.d.ts.map +1 -1
  129. package/dist/theme/syntax/SyntaxTheme.js +43 -2
  130. package/dist/theme/syntax/defineSyntaxTheme.d.ts +18 -5
  131. package/dist/theme/syntax/defineSyntaxTheme.d.ts.map +1 -1
  132. package/dist/theme/syntax/defineSyntaxTheme.js +38 -9
  133. package/dist/theme/syntax/index.d.ts +1 -1
  134. package/dist/theme/syntax/index.d.ts.map +1 -1
  135. package/dist/theme/syntax/tokens.d.ts +12 -2
  136. package/dist/theme/syntax/tokens.d.ts.map +1 -1
  137. package/dist/theme/syntax/tokens.js +25 -4
  138. package/dist/utils/plainDate.d.ts +12 -0
  139. package/dist/utils/plainDate.d.ts.map +1 -1
  140. package/dist/utils/plainDate.js +63 -10
  141. package/locales/en.json +13 -1
  142. package/locales/pseudo.json +9 -0
  143. package/package.json +4 -4
  144. package/src/AlertDialog/AlertDialog.doc.mjs +6 -0
  145. package/src/AlertDialog/AlertDialog.spec.md +205 -0
  146. package/src/AlertDialog/AlertDialog.test.tsx +3 -14
  147. package/src/AlertDialog/__tests__/AlertDialog.a11y.chromium.spec.ts +115 -0
  148. package/src/AlertDialog/__tests__/AlertDialog.a11y.renders.tsx +52 -0
  149. package/src/AlertDialog/__tests__/AlertDialog.a11y.states.ts +68 -0
  150. package/src/AlertDialog/__tests__/AlertDialog.a11y.test.tsx +144 -0
  151. package/src/Button/Button.test.tsx +37 -0
  152. package/src/Button/Button.tsx +5 -1
  153. package/src/Calendar/Calendar.doc.mjs +234 -60
  154. package/src/Calendar/Calendar.spec.md +209 -0
  155. package/src/Calendar/Calendar.test.tsx +559 -20
  156. package/src/Calendar/Calendar.tsx +258 -41
  157. package/src/Calendar/__tests__/Calendar.a11y.chromium.spec.ts +126 -0
  158. package/src/Calendar/__tests__/Calendar.a11y.known-failures.ts +12 -0
  159. package/src/Calendar/__tests__/Calendar.a11y.renders.tsx +57 -0
  160. package/src/Calendar/__tests__/Calendar.a11y.states.ts +139 -0
  161. package/src/Calendar/__tests__/Calendar.a11y.test.tsx +137 -0
  162. package/src/Carousel/Carousel.test.tsx +54 -71
  163. package/src/Carousel/__tests__/Carousel.a11y.chromium.spec.ts +192 -0
  164. package/src/Carousel/__tests__/Carousel.a11y.known-failures.ts +27 -0
  165. package/src/Carousel/__tests__/Carousel.a11y.renders.tsx +39 -0
  166. package/src/Carousel/__tests__/Carousel.a11y.states.ts +139 -0
  167. package/src/Carousel/__tests__/Carousel.a11y.test.tsx +127 -0
  168. package/src/Chat/ChatComposerInput.doc.mjs +1 -1
  169. package/src/Chat/ChatComposerInput.spec.md +94 -55
  170. package/src/Chat/ChatComposerInput.test.tsx +202 -1
  171. package/src/Chat/ChatComposerInput.tsx +13 -0
  172. package/src/Chat/ChatMessage.doc.mjs +31 -16
  173. package/src/Chat/ChatMessage.spec.md +265 -0
  174. package/src/Chat/ChatMessage.test.tsx +246 -0
  175. package/src/Chat/ChatMessage.tsx +30 -7
  176. package/src/Chat/ChatSystemMessage.spec.md +36 -37
  177. package/src/Chat/ChatSystemMessage.test.tsx +4 -4
  178. package/src/Chat/useTriggerMenu.test.tsx +994 -0
  179. package/src/Chat/useTriggerMenu.tsx +278 -46
  180. package/src/CodeBlock/CodeBlock.doc.mjs +7 -0
  181. package/src/CodeBlock/CodeBlock.spec.md +40 -41
  182. package/src/CodeBlock/CodeBlock.test.tsx +89 -9
  183. package/src/CodeBlock/CodeBlock.tsx +205 -25
  184. package/src/CodeBlock/__tests__/CodeBlockOverflowStop.a11y.chromium.spec.ts +125 -0
  185. package/src/CodeBlock/__tests__/DiffRowPaint.a11y.chromium.spec.ts +93 -0
  186. package/src/CodeBlock/tokenizer.test.ts +112 -0
  187. package/src/CodeBlock/tokenizer.ts +106 -0
  188. package/src/Collapsible/CollapsibleGroup.spec.md +17 -8
  189. package/src/Collapsible/__tests__/CollapsibleGroup.a11y.renders.tsx +45 -0
  190. package/src/Collapsible/__tests__/CollapsibleGroup.a11y.states.ts +139 -0
  191. package/src/Collapsible/__tests__/CollapsibleGroup.a11y.test.tsx +135 -0
  192. package/src/Collapsible/__tests__/CollapsibleGroupAccordion.a11y.chromium.spec.ts +128 -0
  193. package/src/CommandPalette/CommandPalette.doc.mjs +126 -23
  194. package/src/CommandPalette/CommandPalette.spec.md +100 -49
  195. package/src/CommandPalette/CommandPalette.test.tsx +241 -2
  196. package/src/CommandPalette/CommandPalette.tsx +47 -21
  197. package/src/CommandPalette/CommandPaletteEmpty.tsx +4 -3
  198. package/src/CommandPalette/CommandPaletteInput.doc.mjs +61 -4
  199. package/src/CommandPalette/CommandPaletteInput.spec.md +215 -0
  200. package/src/CommandPalette/CommandPaletteInput.test.tsx +375 -51
  201. package/src/CommandPalette/CommandPaletteInput.tsx +74 -21
  202. package/src/CommandPalette/CommandPaletteItem.doc.mjs +73 -22
  203. package/src/CommandPalette/CommandPaletteItem.spec.md +223 -0
  204. package/src/CommandPalette/CommandPaletteItem.test.tsx +200 -5
  205. package/src/CommandPalette/CommandPaletteItem.tsx +16 -11
  206. package/src/CommandPalette/CommandPaletteList.doc.mjs +3 -3
  207. package/src/CommandPalette/CommandPaletteList.spec.md +41 -36
  208. package/src/CommandPalette/CommandPaletteList.test.tsx +80 -0
  209. package/src/CommandPalette/CommandPaletteList.tsx +10 -5
  210. package/src/CommandPalette/__tests__/CommandPalette.a11y.chromium.spec.ts +599 -0
  211. package/src/ComplexSelector/ComplexSelector.doc.mjs +10 -8
  212. package/src/ComplexSelector/ComplexSelector.spec.md +14 -9
  213. package/src/ComplexSelector/ComplexSelector.test.tsx +64 -16
  214. package/src/ComplexSelector/ComplexSelector.tsx +37 -8
  215. package/src/ContextMenu/ContextMenu.doc.mjs +6 -0
  216. package/src/ContextMenu/ContextMenu.spec.md +51 -53
  217. package/src/ContextMenu/ContextMenu.test.tsx +132 -1
  218. package/src/ContextMenu/ContextMenu.tsx +78 -48
  219. package/src/DateInput/DateInput.doc.mjs +52 -0
  220. package/src/DateInput/DateInput.spec.md +27 -15
  221. package/src/DateInput/DateInput.test.tsx +38 -0
  222. package/src/DateInput/DateInput.tsx +1 -1
  223. package/src/DateInput/DateInputTouch.test.tsx +22 -0
  224. package/src/DateInput/MonthScroller.tsx +12 -4
  225. package/src/DateRangeInput/DateRangeInput.test.tsx +49 -0
  226. package/src/DateRangeInput/DateRangeInput.tsx +20 -2
  227. package/src/Dialog/Dialog.test.tsx +27 -1
  228. package/src/Dialog/Dialog.tsx +16 -5
  229. package/src/Dialog/DialogHeader.test.tsx +27 -2
  230. package/src/Dialog/DialogHeader.tsx +7 -8
  231. package/src/Dialog/__tests__/Dialog.a11y.chromium.spec.ts +21 -14
  232. package/src/Divider/Divider.doc.mjs +5 -3
  233. package/src/Divider/Divider.spec.md +140 -54
  234. package/src/Divider/Divider.test.tsx +15 -0
  235. package/src/Divider/Divider.tsx +6 -4
  236. package/src/DropdownMenu/DropdownMenu.doc.mjs +2 -2
  237. package/src/DropdownMenu/DropdownMenu.spec.md +121 -45
  238. package/src/DropdownMenu/DropdownMenu.test.tsx +288 -23
  239. package/src/DropdownMenu/DropdownMenu.tsx +212 -81
  240. package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +38 -2
  241. package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +32 -18
  242. package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +146 -1
  243. package/src/DropdownMenu/__tests__/MenuButton.a11y.chromium.spec.ts +136 -0
  244. package/src/DropdownMenu/__tests__/MenuButton.a11y.known-failures.ts +12 -0
  245. package/src/DropdownMenu/__tests__/MenuButton.a11y.renders.tsx +67 -0
  246. package/src/DropdownMenu/__tests__/MenuButton.a11y.states.ts +141 -0
  247. package/src/DropdownMenu/__tests__/MenuButton.a11y.test.tsx +138 -0
  248. package/src/DropdownMenu/__tests__/MenuHeaderFooter.a11y.chromium.spec.ts +40 -5
  249. package/src/Field/InputClearButton.test.tsx +29 -4
  250. package/src/Field/InputClearButton.tsx +26 -8
  251. package/src/FieldStatus/__tests__/StatusMessage.a11y.chromium.spec.ts +21 -14
  252. package/src/FormLayout/FormLayout.tsx +1 -0
  253. package/src/FormLayout/__snapshots__/FormLayout.test.tsx.snap +1 -1
  254. package/src/Grid/Grid.doc.mjs +14 -11
  255. package/src/Grid/Grid.spec.md +50 -32
  256. package/src/Grid/Grid.tsx +13 -4
  257. package/src/HoverCard/HoverCard.test.tsx +46 -1
  258. package/src/HoverCard/useHoverCard.tsx +68 -48
  259. package/src/InputGroup/InputGroup.doc.mjs +11 -1
  260. package/src/InputGroup/InputGroup.tsx +2 -4
  261. package/src/InputGroup/groupStyles.ts +40 -2
  262. package/src/Layer/useLayerDismissal.ts +9 -9
  263. package/src/Link/__tests__/Link.a11y.chromium.spec.ts +142 -0
  264. package/src/Link/__tests__/Link.a11y.renders.tsx +97 -0
  265. package/src/Link/__tests__/Link.a11y.states.ts +104 -0
  266. package/src/Link/__tests__/Link.a11y.test.tsx +127 -0
  267. package/src/Markdown/Markdown.doc.mjs +1 -1
  268. package/src/Markdown/Markdown.fr23.perf.test.ts +161 -40
  269. package/src/Markdown/Markdown.spec.md +45 -23
  270. package/src/Markdown/Markdown.test.tsx +38 -0
  271. package/src/Markdown/Markdown.tsx +24 -2
  272. package/src/Markdown/plugins/semanticFence.test.tsx +3 -2
  273. package/src/MobileNav/MobileNav.tsx +50 -2
  274. package/src/MobileNav/MobileNavFocus.test.tsx +553 -0
  275. package/src/MoreMenu/MoreMenu.spec.md +18 -7
  276. package/src/MoreMenu/MoreMenu.test.tsx +38 -0
  277. package/src/MultiSelector/MultiSelector.doc.mjs +8 -8
  278. package/src/MultiSelector/MultiSelector.spec.md +1 -1
  279. package/src/MultiSelector/MultiSelector.test.tsx +188 -21
  280. package/src/MultiSelector/MultiSelector.tsx +50 -11
  281. package/src/NumberInput/NumberInput.test.tsx +24 -0
  282. package/src/NumberInput/NumberInput.tsx +1 -1
  283. package/src/NumberInput/__tests__/NumberInput.a11y.chromium.spec.ts +22 -15
  284. package/src/PowerSearch/PowerSearchEditPopover.test.tsx +78 -0
  285. package/src/PowerSearch/PowerSearchEditPopover.tsx +6 -0
  286. package/src/Resizable/Resizable.spec.md +41 -9
  287. package/src/Resizable/ResizeHandle.test.tsx +565 -2
  288. package/src/Resizable/ResizeHandle.tsx +126 -21
  289. package/src/Resizable/__tests__/ResizeHandle.a11y.chromium.spec.ts +119 -0
  290. package/src/Resizable/__tests__/ResizeHandle.a11y.known-failures.ts +39 -0
  291. package/src/Resizable/__tests__/ResizeHandle.a11y.renders.tsx +80 -0
  292. package/src/Resizable/__tests__/ResizeHandle.a11y.states.ts +197 -0
  293. package/src/Resizable/__tests__/ResizeHandle.a11y.test.tsx +123 -0
  294. package/src/Resizable/useResizable.ts +95 -0
  295. package/src/Selector/Selector.doc.mjs +7 -6
  296. package/src/Selector/Selector.spec.md +37 -24
  297. package/src/Selector/Selector.test.tsx +176 -10
  298. package/src/Selector/Selector.tsx +59 -14
  299. package/src/Selector/__tests__/Combobox.a11y.known-failures.ts +27 -0
  300. package/src/Selector/__tests__/Combobox.a11y.states.ts +145 -0
  301. package/src/Selector/__tests__/Selector.combobox.a11y.chromium.spec.ts +108 -0
  302. package/src/Selector/__tests__/Selector.combobox.a11y.test.tsx +126 -0
  303. package/src/SideNav/SideNav.test.tsx +35 -0
  304. package/src/SideNav/SideNav.tsx +16 -2
  305. package/src/Slider/Slider.spec.md +43 -17
  306. package/src/Slider/Slider.test.tsx +134 -0
  307. package/src/Slider/Slider.tsx +29 -6
  308. package/src/Slider/__tests__/Slider.a11y.chromium.spec.ts +112 -0
  309. package/src/Slider/__tests__/Slider.a11y.known-failures.ts +12 -0
  310. package/src/Slider/__tests__/Slider.a11y.renders.tsx +42 -0
  311. package/src/Slider/__tests__/Slider.a11y.states.ts +106 -0
  312. package/src/Slider/__tests__/Slider.a11y.test.tsx +105 -0
  313. package/src/Switch/__tests__/Switch.a11y.chromium.spec.ts +25 -18
  314. package/src/TabList/__tests__/Tabs.a11y.chromium.spec.ts +19 -12
  315. package/src/TextInput/__tests__/TextInput.a11y.chromium.spec.ts +21 -14
  316. package/src/ToggleButton/__tests__/ToggleButton.a11y.chromium.spec.ts +18 -11
  317. package/src/Tokenizer/Tokenizer.test.tsx +87 -0
  318. package/src/Tokenizer/Tokenizer.tsx +31 -3
  319. package/src/Toolbar/Toolbar.test.tsx +131 -4
  320. package/src/Toolbar/Toolbar.tsx +3 -1
  321. package/src/TreeList/TreeList.spec.md +33 -8
  322. package/src/TreeList/TreeList.test.tsx +72 -0
  323. package/src/TreeList/TreeList.tsx +10 -6
  324. package/src/TreeList/TreeListItem.tsx +5 -0
  325. package/src/TreeList/__tests__/TreeList.a11y.chromium.spec.ts +125 -0
  326. package/src/TreeList/__tests__/TreeList.a11y.renders.tsx +44 -0
  327. package/src/TreeList/__tests__/TreeList.a11y.states.ts +164 -0
  328. package/src/TreeList/__tests__/TreeList.a11y.test.tsx +138 -0
  329. package/src/TreeList/__tests__/TreeListRowNames.a11y.chromium.spec.ts +82 -0
  330. package/src/hooks/useScrollOverflow.test.tsx +222 -0
  331. package/src/hooks/useScrollOverflow.ts +55 -13
  332. package/src/hooks/useTreeFocus.test.tsx +37 -0
  333. package/src/hooks/useTreeFocus.ts +55 -2
  334. package/src/i18n/generated-locales/en.generated.ts +3 -0
  335. package/src/i18n/generated-locales/pseudo.generated.ts +3 -0
  336. package/src/reset.a11y.chromium.spec.ts +9 -1
  337. package/src/reset.css +8 -3
  338. package/src/reset.until-found.a11y.browser.spec.ts +75 -0
  339. package/src/reset.until-found.test.ts +32 -0
  340. package/src/stylexValidation.source-build.test.mjs +42 -0
  341. package/src/theme/syntax/SyntaxTheme.tsx +46 -5
  342. package/src/theme/syntax/defineSyntaxTheme.diff.test.ts +91 -0
  343. package/src/theme/syntax/defineSyntaxTheme.ts +75 -15
  344. package/src/theme/syntax/index.ts +5 -1
  345. package/src/theme/syntax/tokens.ts +32 -2
  346. package/src/theme/syntax/useSyntaxTheme.diff.test.tsx +40 -0
  347. package/src/utils/plainDate.test.ts +147 -0
  348. package/src/utils/plainDate.ts +75 -10
@@ -154,4 +154,25 @@ export interface UseTreeFocusReturn<T extends HTMLElement = HTMLElement> {
154
154
  * ```
155
155
  */
156
156
  export declare function useTreeFocus<T extends HTMLElement = HTMLElement>(options?: UseTreeFocusOptions): UseTreeFocusReturn<T>;
157
+ /**
158
+ * Options the package's own components can pass beyond the public hook.
159
+ *
160
+ * Not exported from the package: TreeList imports this module directly, so
161
+ * `UseTreeFocusOptions` stays exactly as released.
162
+ */
163
+ export type UseTreeFocusInternalOptions = UseTreeFocusOptions & {
164
+ /**
165
+ * Match typeahead against the item's `aria-labelledby` text (its label
166
+ * alone) instead of its whole text content, so start content, a chevron
167
+ * toggle or a description never takes part. TreeList passes this; the
168
+ * released text match stays the default for direct callers.
169
+ * @default false
170
+ */
171
+ matchLabelledBy?: boolean;
172
+ };
173
+ /**
174
+ * The implementation behind {@link useTreeFocus}. Not exported from the
175
+ * package; the public hook calls it without the internal options.
176
+ */
177
+ export declare function useTreeFocusInternal<T extends HTMLElement = HTMLElement>(options?: UseTreeFocusInternalOptions): UseTreeFocusReturn<T>;
157
178
  //# sourceMappingURL=useTreeFocus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTreeFocus.d.ts","sourceRoot":"","sources":["../../src/hooks/useTreeFocus.ts"],"names":[],"mappings":"AAmCA;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC;IAEhD;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,MAAM,CAAC;IAEzC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC;IAE5C;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC;IAE7C;;;;;OAKG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,MAAM,GAAG,SAAS,CAAC;IAEtD;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,EAA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,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAE3C,gDAAgD;IAChD,UAAU,EAAE,MAAM,IAAI,CAAC;IAEvB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,wBAAgB,YAAY,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAC9D,OAAO,GAAE,mBAAwB,GAChC,kBAAkB,CAAC,CAAC,CAAC,CAIvB;AAED;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG,mBAAmB,GAAG;IAC9D;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EACtE,OAAO,GAAE,2BAAgC,GACxC,kBAAkB,CAAC,CAAC,CAAC,CAiXvB"}
@@ -38,6 +38,22 @@ const DEFAULT_TYPEAHEAD_RESET_MS = 500;
38
38
  * Return type for useTreeFocus hook.
39
39
  */
40
40
 
41
+ /**
42
+ * The text typeahead matches against. With `matchLabelledBy`, the row's
43
+ * `aria-labelledby` text (the label alone) when it has one; otherwise, and by
44
+ * default, its text content.
45
+ */
46
+ function itemLabelText(item, matchLabelledBy) {
47
+ const labelledBy = matchLabelledBy ? item.getAttribute('aria-labelledby') : null;
48
+ if (labelledBy != null) {
49
+ const label = labelledBy.split(/\s+/).map(id => item.ownerDocument.getElementById(id)?.textContent ?? '').join(' ').trim();
50
+ if (label !== '') {
51
+ return label;
52
+ }
53
+ }
54
+ return (item.textContent ?? '').trim();
55
+ }
56
+
41
57
  /**
42
58
  * Hook for managing roving-tabindex focus + the WAI-ARIA tree keyboard model.
43
59
  *
@@ -70,7 +86,28 @@ const DEFAULT_TYPEAHEAD_RESET_MS = 500;
70
86
  * </ul>
71
87
  * ```
72
88
  */
89
+
73
90
  export function useTreeFocus(options = {}) {
91
+ // The flag is pinned off here so an untyped options object cannot smuggle
92
+ // it through the public hook.
93
+ return useTreeFocusInternal({
94
+ ...options,
95
+ matchLabelledBy: false
96
+ });
97
+ }
98
+
99
+ /**
100
+ * Options the package's own components can pass beyond the public hook.
101
+ *
102
+ * Not exported from the package: TreeList imports this module directly, so
103
+ * `UseTreeFocusOptions` stays exactly as released.
104
+ */
105
+
106
+ /**
107
+ * The implementation behind {@link useTreeFocus}. Not exported from the
108
+ * package; the public hook calls it without the internal options.
109
+ */
110
+ export function useTreeFocusInternal(options = {}) {
74
111
  const {
75
112
  itemSelector = '[role="treeitem"]',
76
113
  isItemDisabled,
@@ -82,6 +119,7 @@ export function useTreeFocus(options = {}) {
82
119
  onActivate,
83
120
  typeahead = true,
84
121
  typeaheadResetMs = DEFAULT_TYPEAHEAD_RESET_MS,
122
+ matchLabelledBy = false,
85
123
  onActiveChange,
86
124
  hasRovingTabIndex = false
87
125
  } = options;
@@ -201,12 +239,12 @@ export function useTreeFocus(options = {}) {
201
239
  const start = hasCurrent ? currentIndex : 0;
202
240
  const offset = hasCurrent && query.length === 1 ? 1 : 0;
203
241
  const ordered = [...items.slice(start + offset), ...items.slice(0, start + offset)];
204
- const match = ordered.find(item => !itemDisabled(item) && (item.textContent ?? '').trim().toLowerCase().startsWith(query));
242
+ const match = ordered.find(item => !itemDisabled(item) && itemLabelText(item, matchLabelledBy).toLowerCase().startsWith(query));
205
243
  if (match != null) {
206
244
  e.preventDefault();
207
245
  focusItem(match);
208
246
  }
209
- }, [typeaheadResetMs, itemDisabled, focusItem]);
247
+ }, [typeaheadResetMs, itemDisabled, focusItem, matchLabelledBy]);
210
248
  const handleKeyDown = useCallback(e => {
211
249
  const items = getItems();
212
250
  if (items.length === 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"en.generated.d.ts","sourceRoot":"","sources":["../../../src/i18n/generated-locales/en.generated.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAkcpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"en.generated.d.ts","sourceRoot":"","sources":["../../../src/i18n/generated-locales/en.generated.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAqcpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -223,6 +223,7 @@ const runtimeCatalog = {
223
223
  '@astryx.chat.speechRecognition.noSpeechDetected': 'No speech was detected.',
224
224
  '@astryx.commandPalette.label': 'Command palette',
225
225
  '@astryx.commandPalette.input.placeholder': 'Search…',
226
+ '@astryx.commandPalette.input.label': 'Search commands',
226
227
  '@astryx.commandPalette.list.label': 'Commands',
227
228
  '@astryx.contextMenu.label': 'Context menu',
228
229
  '@astryx.dateInput.placeholder': 'Select a date',
@@ -329,6 +330,7 @@ const runtimeCatalog = {
329
330
  '@astryx.numberInput.clearLabel': 'Clear {label}',
330
331
  '@astryx.numberInput.decrementLabel': 'Decrement {label}',
331
332
  '@astryx.numberInput.incrementLabel': 'Increment {label}',
333
+ '@astryx.numberInput.invalidNumber': 'Invalid number',
332
334
  '@astryx.selector.clearLabel': 'Clear {label}',
333
335
  '@astryx.sideNavCollapseButton.expandSidebar': 'Expand sidebar',
334
336
  '@astryx.sideNavCollapseButton.collapseSidebar': 'Collapse sidebar',
@@ -359,6 +361,7 @@ const runtimeCatalog = {
359
361
  '@astryx.tableTree.expandAllRows': 'Expand all rows',
360
362
  '@astryx.textArea.charactersRemaining': '{count, number} {count, plural, one {character} other {characters}} remaining',
361
363
  '@astryx.textArea.charactersOverLimit': '{count, number} {count, plural, one {character} other {characters}} over the limit',
364
+ '@astryx.inputClearButton.tooltip': 'Clear',
362
365
  '@astryx.textInput.clearLabel': 'Clear {label}',
363
366
  '@astryx.thumbnail.remove': 'Remove {accessibleName}',
364
367
  '@astryx.thumbnail.open': 'Open {accessibleName}',
@@ -1 +1 @@
1
- {"version":3,"file":"pseudo.generated.d.ts","sourceRoot":"","sources":["../../../src/i18n/generated-locales/pseudo.generated.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA2cpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"pseudo.generated.d.ts","sourceRoot":"","sources":["../../../src/i18n/generated-locales/pseudo.generated.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA8cpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -223,6 +223,7 @@ const runtimeCatalog = {
223
223
  '@astryx.chat.speechRecognition.noSpeechDetected': '⟦Ñó šþééçĥ ŵàš ðéţéçţéð.⟧',
224
224
  '@astryx.commandPalette.label': '⟦Çóɱɱàñð þàłéţţé⟧',
225
225
  '@astryx.commandPalette.input.placeholder': '⟦Šéàřçĥ…⟧',
226
+ '@astryx.commandPalette.input.label': '⟦Šéàřçĥ çóɱɱàñðš⟧',
226
227
  '@astryx.commandPalette.list.label': '⟦Çóɱɱàñðš⟧',
227
228
  '@astryx.contextMenu.label': '⟦Çóñţéẋţ ɱéñú⟧',
228
229
  '@astryx.dateInput.placeholder': '⟦Šéłéçţ à ðàţé⟧',
@@ -329,6 +330,7 @@ const runtimeCatalog = {
329
330
  '@astryx.numberInput.clearLabel': '⟦Çłéàř {label}⟧',
330
331
  '@astryx.numberInput.decrementLabel': '⟦Ðéçřéɱéñţ {label}⟧',
331
332
  '@astryx.numberInput.incrementLabel': '⟦Íñçřéɱéñţ {label}⟧',
333
+ '@astryx.numberInput.invalidNumber': '⟦Íñṽàłíð ñúɱƀéř⟧',
332
334
  '@astryx.selector.clearLabel': '⟦Çłéàř {label}⟧',
333
335
  '@astryx.sideNavCollapseButton.expandSidebar': '⟦Éẋþàñð šíðéƀàř⟧',
334
336
  '@astryx.sideNavCollapseButton.collapseSidebar': '⟦Çółłàþšé šíðéƀàř⟧',
@@ -359,6 +361,7 @@ const runtimeCatalog = {
359
361
  '@astryx.tableTree.expandAllRows': '⟦Éẋþàñð àłł řóŵš⟧',
360
362
  '@astryx.textArea.charactersRemaining': '⟦{count, number} {count, plural, one {character} other {characters}} řéɱàíñíñĝ⟧',
361
363
  '@astryx.textArea.charactersOverLimit': '⟦{count, number} {count, plural, one {character} other {characters}} óṽéř ţĥé łíɱíţ⟧',
364
+ '@astryx.inputClearButton.tooltip': '⟦Çłéàř⟧',
362
365
  '@astryx.textInput.clearLabel': '⟦Çłéàř {label}⟧',
363
366
  '@astryx.thumbnail.remove': '⟦Řéɱóṽé {accessibleName}⟧',
364
367
  '@astryx.thumbnail.open': '⟦Óþéñ {accessibleName}⟧',
@@ -69,7 +69,12 @@ test('Chromium keeps every selector the reset writes', async ({
69
69
  // A forgiving list drops an invalid entry instead of the whole rule, so a
70
70
  // dropped pseudo-element shows up as a shorter serialized selector.
71
71
  const parsed = await page.evaluate(() => {
72
- const layer = document.styleSheets[0].cssRules[0];
72
+ // The sheet opens with the `@layer` order statement; the rules live in
73
+ // the `reset` layer block after it.
74
+ const layer = [...document.styleSheets[0].cssRules].find(rule => rule instanceof CSSLayerBlockRule && rule.name === 'reset');
75
+ if (layer == null) {
76
+ throw new Error('reset.css has no @layer reset block');
77
+ }
73
78
  return [...layer.cssRules].map(rule => rule.selectorText);
74
79
  });
75
80
  expect(parsed.map(normalize)).toEqual(sourceSelectors(RESET_CSS).map(normalize));
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=reset.until-found.a11y.browser.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset.until-found.a11y.browser.spec.d.ts","sourceRoot":"","sources":["../src/reset.until-found.a11y.browser.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,71 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file reset.until-found.a11y.browser.spec.ts
5
+ * @input packages/core/src/reset.css, alone on a blank page
6
+ * @output Browser evidence that `hidden="until-found"` content stays findable
7
+ * @position reset.css integration proof. The browser hides until-found content
8
+ * with `content-visibility: hidden`, which find in page and text fragments
9
+ * can search and reveal; `display: none` takes the content out of both, and
10
+ * only a shipping engine shows which one applies.
11
+ */
12
+
13
+ import * as fs from 'node:fs';
14
+ import { fileURLToPath } from 'node:url';
15
+ import { expect, test } from '@playwright/test';
16
+ const RESET_CSS = fs.readFileSync(fileURLToPath(new URL('./reset.css', import.meta.url)), 'utf8');
17
+
18
+ // Served at a real URL so a text fragment navigation can run against it.
19
+ const ORIGIN = 'http://reset.test';
20
+ const PAGE = `<!doctype html>
21
+ <style>${RESET_CSS}</style>
22
+ <div style="height: 3000px">Above the fold</div>
23
+ <div id="answer" hidden="until-found">The hidden answer</div>
24
+ <div id="closed" hidden>Plain hidden text</div>
25
+ <script>
26
+ document.getElementById('answer').addEventListener('beforematch', () => {
27
+ document.body.dataset.beforematch = 'fired';
28
+ });
29
+ </script>`;
30
+ test.beforeEach(async ({
31
+ page
32
+ }) => {
33
+ await page.route(`${ORIGIN}/**`, async route => route.fulfill({
34
+ contentType: 'text/html',
35
+ body: PAGE
36
+ }));
37
+ });
38
+ test('until-found content keeps the browser rendering', async ({
39
+ page
40
+ }) => {
41
+ await page.goto(`${ORIGIN}/`);
42
+ const styles = await page.evaluate(() => ['answer', 'closed'].map(id => {
43
+ const element = document.getElementById(id);
44
+ if (!element) {
45
+ throw new Error(`missing #${id}`);
46
+ }
47
+ const style = getComputedStyle(element);
48
+ return {
49
+ display: style.display,
50
+ contentVisibility: style.contentVisibility
51
+ };
52
+ }));
53
+ expect(styles).toEqual([{
54
+ display: 'block',
55
+ contentVisibility: 'hidden'
56
+ }, {
57
+ display: 'none',
58
+ contentVisibility: 'visible'
59
+ }]);
60
+ });
61
+ test('a text fragment finds until-found content and reveals it', async ({
62
+ page
63
+ }) => {
64
+ await page.goto(`${ORIGIN}/#:~:text=hidden%20answer`);
65
+ // The browser removes the attribute and fires beforematch when it reveals.
66
+ await expect(page.locator('#answer')).not.toHaveAttribute('hidden');
67
+ await expect(page.locator('#answer')).toBeInViewport();
68
+ await expect(page.locator('body')).toHaveAttribute('data-beforematch', 'fired');
69
+ // Plain hidden content stays out of reach.
70
+ await expect(page.locator('#closed')).toBeHidden();
71
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"SyntaxTheme.d.ts","sourceRoot":"","sources":["../../../src/theme/syntax/SyntaxTheme.tsx"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAmB7B,MAAM,WAAW,oBAAoB;IACnC,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB;;;;;OAKG;IACH,KAAK,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,MAAM,CAAC;IAC7C;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;CAC7C;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,IAAI,oBAAoB,GAAG,IAAI,CA6B5D;AAMD,UAAU,gBAAgB;IACxB,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,GACT,EAAE,gBAAgB,GAAG,KAAK,CAAC,YAAY,CAWvC;yBAde,WAAW"}
1
+ {"version":3,"file":"SyntaxTheme.d.ts","sourceRoot":"","sources":["../../../src/theme/syntax/SyntaxTheme.tsx"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAqB7B,MAAM,WAAW,oBAAoB;IACnC,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB;;;;;OAKG;IACH,KAAK,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,MAAM,CAAC;IAC7C;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;CAC7C;AAsBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,IAAI,oBAAoB,GAAG,IAAI,CAoD5D;AAMD,UAAU,gBAAgB;IACxB,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,GACT,EAAE,gBAAgB,GAAG,KAAK,CAAC,YAAY,CAWvC;yBAde,WAAW"}
@@ -13,6 +13,8 @@
13
13
  import React, { createContext, use, useMemo } from 'react';
14
14
  import { syntaxThemeStyle, resolveSyntaxTokenForMode, ALL_SYNTAX_KEYS } from "./defineSyntaxTheme.js";
15
15
  import { useMediaQuery } from "../../hooks/useMediaQuery.js";
16
+ import { useTheme } from "../useTheme.js";
17
+ import { formatColor, parseColor } from "../../utils/color.js";
16
18
 
17
19
  // =============================================================================
18
20
  // Context
@@ -31,6 +33,22 @@ SyntaxThemeContext.displayName = 'SyntaxThemeContext';
31
33
  // Hook
32
34
  // =============================================================================
33
35
 
36
+ /** The strength of the default diff row paints: the muted tokens at 25%. */
37
+ const DIFF_TINT_STRENGTH = 0.25;
38
+
39
+ /**
40
+ * The colour `color-mix(in srgb, <colour> <strength>, transparent)` paints, as
41
+ * a value a canvas can use. Returns undefined for a colour the shared parser
42
+ * does not read (the CSS default then stands).
43
+ */
44
+ function mixWithTransparent(colour, strength) {
45
+ const parsed = parseColor(colour);
46
+ return parsed ? formatColor({
47
+ ...parsed,
48
+ a: parsed.a * strength
49
+ }) : undefined;
50
+ }
51
+
34
52
  /**
35
53
  * Access the current syntax theme's token values, resolved for the active
36
54
  * color mode. Returns null if no SyntaxTheme provider is present.
@@ -46,6 +64,7 @@ SyntaxThemeContext.displayName = 'SyntaxThemeContext';
46
64
  */
47
65
  export function useSyntaxTheme() {
48
66
  const ctx = use(SyntaxThemeContext);
67
+ const page = useTheme();
49
68
  const prefersDark = useMediaQuery('(prefers-color-scheme: dark)');
50
69
  const effectiveMode = prefersDark ? 'dark' : 'light';
51
70
  const tokens = useMemo(() => {
@@ -54,10 +73,32 @@ export function useSyntaxTheme() {
54
73
  }
55
74
  const resolved = {};
56
75
  for (const key of ALL_SYNTAX_KEYS) {
57
- resolved[key] = resolveSyntaxTokenForMode(ctx.theme.__inputTokens[key], effectiveMode);
76
+ const input = ctx.theme.__inputTokens[key];
77
+ if (input !== undefined) {
78
+ resolved[key] = resolveSyntaxTokenForMode(input, effectiveMode);
79
+ }
80
+ }
81
+ // A diff row slot the theme did not set follows its CSS default; a canvas
82
+ // consumer needs a colour it can paint, so the marker slots take the
83
+ // theme's own resolved punctuation colour and the row paints derive from
84
+ // the enclosing page theme's resolved tokens (the same mix the CSS
85
+ // default makes), never from a probe outside the nearest Theme.
86
+ for (const key of ALL_SYNTAX_KEYS) {
87
+ if (resolved[key] !== undefined) {
88
+ continue;
89
+ }
90
+ const fallback = ctx.theme.tokens[key] ?? '';
91
+ if (key === 'added-marker' || key === 'removed-marker') {
92
+ resolved[key] = resolved.punctuation ?? fallback;
93
+ } else if (key === 'added' || key === 'removed') {
94
+ const base = page.token(key === 'added' ? '--color-success-muted' : '--color-error-muted');
95
+ resolved[key] = mixWithTransparent(base, DIFF_TINT_STRENGTH) ?? fallback;
96
+ } else {
97
+ resolved[key] = fallback;
98
+ }
58
99
  }
59
100
  return resolved;
60
- }, [ctx, effectiveMode]);
101
+ }, [ctx, effectiveMode, page]);
61
102
  if (!ctx || !tokens) {
62
103
  return null;
63
104
  }
@@ -1,14 +1,25 @@
1
1
  /** Human-readable syntax token name (without CSS custom property prefix). */
2
- export type SyntaxThemeTokenKey = 'keyword' | 'string' | 'comment' | 'number' | 'function' | 'type' | 'variable' | 'operator' | 'constant' | 'tag' | 'attribute' | 'property' | 'punctuation' | 'background';
2
+ export type SyntaxThemeTokenKey = 'keyword' | 'string' | 'comment' | 'number' | 'function' | 'type' | 'variable' | 'operator' | 'constant' | 'tag' | 'attribute' | 'property' | 'punctuation' | 'background' | DiffSyntaxThemeTokenKey;
3
+ /** The diff row slots a syntax theme MAY set; unset ones keep their defaults. */
4
+ export type DiffSyntaxThemeTokenKey = 'added' | 'removed' | 'diff-header' | 'added-marker' | 'removed-marker';
3
5
  /**
4
6
  * Token value — either a single string or a [light, dark] tuple.
5
7
  * Tuples are converted to CSS light-dark() at theme creation time.
6
8
  */
7
9
  export type SyntaxTokenValue = string | [light: string, dark: string];
8
- /** Token map for defineSyntaxTheme input — values can be strings or tuples. */
9
- export type SyntaxThemeTokenInput = Record<SyntaxThemeTokenKey, SyntaxTokenValue>;
10
- /** Resolved token map — all values are CSS strings (tuples resolved to light-dark()). */
11
- export type SyntaxThemeTokenMap = Record<SyntaxThemeTokenKey, string>;
10
+ /**
11
+ * Token map for defineSyntaxTheme input — values can be strings or tuples.
12
+ * The diff row slots are optional: a theme that sets none keeps the defaults
13
+ * (semantic success/error muted tints and the muted surface).
14
+ */
15
+ export type SyntaxThemeTokenInput = Record<Exclude<SyntaxThemeTokenKey, DiffSyntaxThemeTokenKey>, SyntaxTokenValue> & Partial<Record<DiffSyntaxThemeTokenKey, SyntaxTokenValue>>;
16
+ /**
17
+ * Resolved token map — all values are CSS strings (tuples resolved to
18
+ * light-dark()). The diff row slots are optional here as in the input, so a
19
+ * map written before they existed still type-checks; an unset slot renders
20
+ * its default.
21
+ */
22
+ export type SyntaxThemeTokenMap = Record<Exclude<SyntaxThemeTokenKey, DiffSyntaxThemeTokenKey>, string> & Partial<Record<DiffSyntaxThemeTokenKey, string>>;
12
23
  /** Input to defineSyntaxTheme. */
13
24
  export interface SyntaxThemeInput {
14
25
  name: string;
@@ -25,6 +36,8 @@ export interface SyntaxThemeDefinition {
25
36
  }
26
37
  /** All valid human-readable token keys, derived from the defaults. */
27
38
  export declare const ALL_SYNTAX_KEYS: SyntaxThemeTokenKey[];
39
+ /** The keys every syntax theme must set: everything but the diff rows. */
40
+ export declare const REQUIRED_SYNTAX_KEYS: SyntaxThemeTokenKey[];
28
41
  /**
29
42
  * Resolve a token value for a specific color mode.
30
43
  * - [light, dark] tuple → picks the correct side
@@ -1 +1 @@
1
- {"version":3,"file":"defineSyntaxTheme.d.ts","sourceRoot":"","sources":["../../../src/theme/syntax/defineSyntaxTheme.ts"],"names":[],"mappings":"AAoBA,6EAA6E;AAC7E,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,UAAU,GACV,MAAM,GACN,UAAU,GACV,UAAU,GACV,UAAU,GACV,KAAK,GACL,WAAW,GACX,UAAU,GACV,aAAa,GACb,YAAY,CAAC;AAEjB;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEtE,+EAA+E;AAC/E,MAAM,MAAM,qBAAqB,GAAG,MAAM,CACxC,mBAAmB,EACnB,gBAAgB,CACjB,CAAC;AAEF,yFAAyF;AACzF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAEtE,kCAAkC;AAClC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAA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AG,MAAM,CAKrE"}
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * @see https://github.com/facebook/astryx/issues/1148
12
12
  */
13
- import { syntaxTokenDefaults } from "./tokens.js";
13
+ import { syntaxTokenDefaults, DIFF_SYNTAX_TOKEN_NAMES } from "./tokens.js";
14
14
  import { devWarn } from "../../utils/devWarning.js";
15
15
 
16
16
  // =============================================================================
@@ -19,14 +19,25 @@ import { devWarn } from "../../utils/devWarning.js";
19
19
 
20
20
  /** Human-readable syntax token name (without CSS custom property prefix). */
21
21
 
22
+ /** The diff row slots a syntax theme MAY set; unset ones keep their defaults. */
23
+
22
24
  /**
23
25
  * Token value — either a single string or a [light, dark] tuple.
24
26
  * Tuples are converted to CSS light-dark() at theme creation time.
25
27
  */
26
28
 
27
- /** Token map for defineSyntaxTheme input — values can be strings or tuples. */
29
+ /**
30
+ * Token map for defineSyntaxTheme input — values can be strings or tuples.
31
+ * The diff row slots are optional: a theme that sets none keeps the defaults
32
+ * (semantic success/error muted tints and the muted surface).
33
+ */
28
34
 
29
- /** Resolved token map — all values are CSS strings (tuples resolved to light-dark()). */
35
+ /**
36
+ * Resolved token map — all values are CSS strings (tuples resolved to
37
+ * light-dark()). The diff row slots are optional here as in the input, so a
38
+ * map written before they existed still type-checks; an unset slot renders
39
+ * its default.
40
+ */
30
41
 
31
42
  /** Input to defineSyntaxTheme. */
32
43
 
@@ -43,6 +54,13 @@ function toCSSProperty(key) {
43
54
 
44
55
  /** All valid human-readable token keys, derived from the defaults. */
45
56
  export const ALL_SYNTAX_KEYS = Object.keys(syntaxTokenDefaults).map(k => k.replace(CSS_PREFIX, ''));
57
+ const DIFF_KEYS = new Set(DIFF_SYNTAX_TOKEN_NAMES.map(name => name.replace(CSS_PREFIX, '')));
58
+
59
+ /** The marker slots: unset in a theme, they follow that theme's punctuation. */
60
+ const MARKER_KEYS = new Set(['added-marker', 'removed-marker']);
61
+
62
+ /** The keys every syntax theme must set: everything but the diff rows. */
63
+ export const REQUIRED_SYNTAX_KEYS = ALL_SYNTAX_KEYS.filter(key => !DIFF_KEYS.has(key));
46
64
 
47
65
  // =============================================================================
48
66
  // Helpers
@@ -96,15 +114,23 @@ export function resolveSyntaxTokenForMode(value, mode) {
96
114
  * });
97
115
  */
98
116
  export function defineSyntaxTheme(input) {
99
- const missing = ALL_SYNTAX_KEYS.filter(key => !(key in input.tokens));
117
+ const missing = REQUIRED_SYNTAX_KEYS.filter(key => !(key in input.tokens));
100
118
  if (missing.length > 0) {
101
- devWarn('defineSyntaxTheme', `"${input.name}": missing tokens: ${missing.join(', ')}. ` + `All 14 syntax tokens are required.`);
119
+ devWarn('defineSyntaxTheme', `"${input.name}": missing tokens: ${missing.join(', ')}. ` + `All ${REQUIRED_SYNTAX_KEYS.length} syntax colour tokens are required; ` + `the diff row slots (added, removed, diff-header, added-marker, removed-marker) are optional.`);
102
120
  }
103
121
 
104
- // Resolve tuples to light-dark() CSS strings
122
+ // Resolve tuples to light-dark() CSS strings. An unset diff row paint keeps
123
+ // its default so every existing theme renders a readable diff unchanged; an
124
+ // unset marker slot takes this theme's own line-number colour (its
125
+ // punctuation token) rather than the page theme's green and red, and an
126
+ // unset header paint is none at all (the header row sits on this theme's
127
+ // own background with punctuation text), so number, glyph, and header
128
+ // text stay legible on this theme's background in every page mode — the
129
+ // glyph's shape carries the meaning where the colour does not.
105
130
  const resolved = {};
106
131
  for (const key of ALL_SYNTAX_KEYS) {
107
- resolved[key] = resolveTokenValue(input.tokens[key]);
132
+ const value = input.tokens[key];
133
+ resolved[key] = value !== undefined ? resolveTokenValue(value) : MARKER_KEYS.has(key) ? 'var(--color-syntax-punctuation)' : key === 'diff-header' ? 'transparent' : syntaxTokenDefaults[toCSSProperty(key)];
108
134
  }
109
135
  return {
110
136
  name: input.name,
@@ -123,12 +149,15 @@ export function defineSyntaxTheme(input) {
123
149
  export function syntaxThemeStyle(theme) {
124
150
  const vars = {};
125
151
  for (const key of ALL_SYNTAX_KEYS) {
126
- vars[toCSSProperty(key)] = theme.tokens[key];
152
+ // An unset diff slot is left to its default rather than written empty.
153
+ const value = theme.tokens[key];
154
+ if (value !== undefined) vars[toCSSProperty(key)] = value;
127
155
  }
128
156
  return vars;
129
157
  }
130
158
 
131
159
  /** Convert a syntax theme to CSS declarations (no selector wrapper). */
132
160
  export function syntaxThemeToCSS(theme) {
133
- return ALL_SYNTAX_KEYS.map(key => toCSSProperty(key) + ': ' + theme.tokens[key] + ';').join('\n ');
161
+ // An unset diff slot is left to its default rather than written `undefined`.
162
+ return ALL_SYNTAX_KEYS.filter(key => theme.tokens[key] !== undefined).map(key => toCSSProperty(key) + ': ' + theme.tokens[key] + ';').join('\n ');
134
163
  }
@@ -10,7 +10,7 @@
10
10
  */
11
11
  export { syntaxTokenDefaults } from './tokens';
12
12
  export type { SyntaxTokenName } from './tokens';
13
- export { defineSyntaxTheme, syntaxThemeStyle, syntaxThemeToCSS } from './defineSyntaxTheme';
13
+ export { defineSyntaxTheme, syntaxThemeStyle, syntaxThemeToCSS, } from './defineSyntaxTheme';
14
14
  export type { SyntaxThemeDefinition, SyntaxThemeInput, SyntaxThemeTokenKey, SyntaxThemeTokenMap, SyntaxThemeTokenInput, SyntaxTokenValue, } from './defineSyntaxTheme';
15
15
  export { SyntaxTheme, useSyntaxTheme } from './SyntaxTheme';
16
16
  export type { UseSyntaxThemeReturn } from './SyntaxTheme';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/syntax/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAE9C,OAAO,EAAC,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAC1F,YAAY,EACV,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAC1D,YAAY,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAGxD,OAAO,EACL,UAAU,EACV,OAAO,EACP,OAAO,EACP,IAAI,EACJ,UAAU,EACV,eAAe,EACf,UAAU,EACV,WAAW,EACX,cAAc,EACd,QAAQ,EACR,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/syntax/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAE9C,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAC1D,YAAY,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAGxD,OAAO,EACL,UAAU,EACV,OAAO,EACP,OAAO,EACP,IAAI,EACJ,UAAU,EACV,eAAe,EACf,UAAU,EACV,WAAW,EACX,cAAc,EACd,QAAQ,EACR,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,WAAW,CAAC"}
@@ -11,8 +11,11 @@
11
11
  * colors automatically adapt to any theme's color system. Themes can also
12
12
  * set an explicit syntax theme via defineTheme({ syntax: dracula }).
13
13
  *
14
- * 14-token architecture validated against 11 community code themes.
15
- * All themes map cleanly to these 14 slots.
14
+ * 14 token colours and the code background, validated against 11 community
15
+ * code themes — all of them map cleanly to those slots — plus five diff row
16
+ * slots (added, removed, header paints; added and removed markers) that default
17
+ * to semantic tokens, so a syntax theme that does not set them keeps a
18
+ * readable diff.
16
19
  *
17
20
  * @see https://github.com/facebook/astryx/issues/1148
18
21
  */
@@ -31,6 +34,13 @@ export declare const syntaxTokenDefaults: {
31
34
  readonly '--color-syntax-property': "var(--color-text-cyan)";
32
35
  readonly '--color-syntax-punctuation': "var(--color-text-secondary)";
33
36
  readonly '--color-syntax-background': "var(--color-background-muted)";
37
+ readonly '--color-syntax-added': "color-mix(in srgb, var(--color-success-muted) 25%, transparent)";
38
+ readonly '--color-syntax-removed': "color-mix(in srgb, var(--color-error-muted) 25%, transparent)";
39
+ readonly '--color-syntax-diff-header': "var(--color-background-muted)";
40
+ readonly '--color-syntax-added-marker': "var(--color-text-green)";
41
+ readonly '--color-syntax-removed-marker': "var(--color-text-red)";
34
42
  };
35
43
  export type SyntaxTokenName = keyof typeof syntaxTokenDefaults;
44
+ /** The five diff row slots: optional in a syntax theme, defaulted when unset. */
45
+ export declare const DIFF_SYNTAX_TOKEN_NAMES: readonly ["--color-syntax-added", "--color-syntax-removed", "--color-syntax-diff-header", "--color-syntax-added-marker", "--color-syntax-removed-marker"];
36
46
  //# sourceMappingURL=tokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/theme/syntax/tokens.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;CAgCtB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,mBAAmB,CAAC"}
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/theme/syntax/tokens.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;CAkDtB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,mBAAmB,CAAC;AAE/D,iFAAiF;AACjF,eAAO,MAAM,uBAAuB,2JAMe,CAAC"}
@@ -13,8 +13,11 @@
13
13
  * colors automatically adapt to any theme's color system. Themes can also
14
14
  * set an explicit syntax theme via defineTheme({ syntax: dracula }).
15
15
  *
16
- * 14-token architecture validated against 11 community code themes.
17
- * All themes map cleanly to these 14 slots.
16
+ * 14 token colours and the code background, validated against 11 community
17
+ * code themes — all of them map cleanly to those slots — plus five diff row
18
+ * slots (added, removed, header paints; added and removed markers) that default
19
+ * to semantic tokens, so a syntax theme that does not set them keeps a
20
+ * readable diff.
18
21
  *
19
22
  * @see https://github.com/facebook/astryx/issues/1148
20
23
  */
@@ -50,5 +53,23 @@ export const syntaxTokenDefaults = {
50
53
  // text — see #5386.
51
54
  '--color-syntax-punctuation': 'var(--color-text-secondary)',
52
55
  // background -> muted surface
53
- '--color-syntax-background': 'var(--color-background-muted)'
54
- };
56
+ '--color-syntax-background': 'var(--color-background-muted)',
57
+ // Diff rows (CodeBlock isDiff): whole-row tints behind unchanged syntax
58
+ // colours. Added/removed derive from the semantic success/error muted
59
+ // tokens at 25% strength: at full strength the secondary-grey syntax
60
+ // tokens (operator, punctuation, comment) fall under 4.5:1 on the tints
61
+ // in light; at 25% every default token clears it on both schemes with
62
+ // margin while the tint still reads against the plain row. Header rows
63
+ // (@@, and ---/+++ before the first hunk) sit on the muted surface.
64
+ '--color-syntax-added': 'color-mix(in srgb, var(--color-success-muted) 25%, transparent)',
65
+ '--color-syntax-removed': 'color-mix(in srgb, var(--color-error-muted) 25%, transparent)',
66
+ '--color-syntax-diff-header': 'var(--color-background-muted)',
67
+ // The margin of a changed row — its line number and +/- glyph — in the
68
+ // default theme's tinted-text tokens, made for tinted surfaces; a defined
69
+ // syntax theme that leaves them unset follows its own punctuation colour
70
+ // (see defineSyntaxTheme). Code text keeps the syntax theme's colours.
71
+ '--color-syntax-added-marker': 'var(--color-text-green)',
72
+ '--color-syntax-removed-marker': 'var(--color-text-red)'
73
+ };
74
+ /** The five diff row slots: optional in a syntax theme, defaulted when unset. */
75
+ export const DIFF_SYNTAX_TOKEN_NAMES = ['--color-syntax-added', '--color-syntax-removed', '--color-syntax-diff-header', '--color-syntax-added-marker', '--color-syntax-removed-marker'];
@@ -72,6 +72,18 @@ export declare const DATE_FORMAT_SHORT_WITH_YEAR: Intl.DateTimeFormatOptions;
72
72
  * serialization, or any Astryx component's calendar semantics.
73
73
  */
74
74
  export declare function plainDateFormat(pd: PlainDate, options: Intl.DateTimeFormatOptions, locale?: Locale): string;
75
+ /**
76
+ * The locale's name for the "week of year" date field ("week", "Woche", "週"),
77
+ * from CLDR through `Intl.DisplayNames`. Calendar names its week-number
78
+ * column header with it, so no catalog string is needed for a word the
79
+ * platform already carries in every locale.
80
+ *
81
+ * `Intl.DisplayNames` with `type: 'dateTimeField'` is inside the Baseline − 2
82
+ * support tier (Chrome 106, Safari 15.4, Firefox 110). Should a host lack it
83
+ * or return nothing, the field's English CLDR name stands in rather than an
84
+ * empty header.
85
+ */
86
+ export declare function plainDateWeekFieldName(locale?: Locale): string;
75
87
  /**
76
88
  * The date-only members of Timestamp's `format` vocabulary that a
77
89
  * calendar-date field (no time-of-day) can render. Both Timestamp and
@@ -1 +1 @@
1
- {"version":3,"file":"plainDate.d.ts","sourceRoot":"","sources":["../../src/utils/plainDate.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAE1C,YAAY,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAE3C,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,SAAS,CAcX;AAED,wBAA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