@seanyeh77/ui 0.44.0 → 0.45.0

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 (868) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/dist/bundle.js +20 -20
  4. package/dist/components/AccentPicker/AccentPicker.d.ts +1 -0
  5. package/dist/components/AccentPicker/AccentPicker.js +92 -72
  6. package/dist/components/AccentPicker/AccentPicker.js.map +1 -1
  7. package/dist/components/ActionBar/ActionBar.d.ts +2 -0
  8. package/dist/components/ActionBar/ActionBar.js.map +1 -1
  9. package/dist/components/AiMark/AiMark.d.ts +1 -0
  10. package/dist/components/AiMark/AiMark.js.map +1 -1
  11. package/dist/components/Alert/Alert.d.ts +5 -2
  12. package/dist/components/Alert/Alert.js +17 -14
  13. package/dist/components/Alert/Alert.js.map +1 -1
  14. package/dist/components/AppShell/AppShell.d.ts +10 -4
  15. package/dist/components/AppShell/AppShell.js +30 -19
  16. package/dist/components/AppShell/AppShell.js.map +1 -1
  17. package/dist/components/Badge/Badge.d.ts +24 -7
  18. package/dist/components/Badge/Badge.js +78 -21
  19. package/dist/components/Badge/Badge.js.map +1 -1
  20. package/dist/components/BarChart/BarChart.d.ts +14 -1
  21. package/dist/components/BarChart/BarChart.js +88 -59
  22. package/dist/components/BarChart/BarChart.js.map +1 -1
  23. package/dist/components/Breadcrumb/Breadcrumb.d.ts +1 -0
  24. package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
  25. package/dist/components/Button/Button.d.ts +4 -1
  26. package/dist/components/Button/Button.js +17 -3
  27. package/dist/components/Button/Button.js.map +1 -1
  28. package/dist/components/Calendar/Calendar.d.ts +11 -2
  29. package/dist/components/Calendar/Calendar.js +16 -5
  30. package/dist/components/Calendar/Calendar.js.map +1 -1
  31. package/dist/components/Card/Card.d.ts +1 -0
  32. package/dist/components/Card/Card.js.map +1 -1
  33. package/dist/components/Checkbox/Checkbox.d.ts +24 -8
  34. package/dist/components/Checkbox/Checkbox.js +22 -9
  35. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  36. package/dist/components/CodeView/CodeView.d.ts +3 -0
  37. package/dist/components/CodeView/CodeView.js +6 -6
  38. package/dist/components/CodeView/CodeView.js.map +1 -1
  39. package/dist/components/CommandPalette/CommandPalette.d.ts +16 -4
  40. package/dist/components/CommandPalette/CommandPalette.js +38 -11
  41. package/dist/components/CommandPalette/CommandPalette.js.map +1 -1
  42. package/dist/components/ConsoleLayout/ConsoleLayout.d.ts +2 -3
  43. package/dist/components/ConsoleLayout/ConsoleLayout.js +4 -1
  44. package/dist/components/ConsoleLayout/ConsoleLayout.js.map +1 -1
  45. package/dist/components/DangerZone/DangerZone.d.ts +2 -1
  46. package/dist/components/DangerZone/DangerZone.js +1 -1
  47. package/dist/components/DangerZone/DangerZone.js.map +1 -1
  48. package/dist/components/DataTable/DataTable.d.ts +8 -1
  49. package/dist/components/DataTable/DataTable.js +213 -167
  50. package/dist/components/DataTable/DataTable.js.map +1 -1
  51. package/dist/components/DataTable/SortButton.js +48 -5
  52. package/dist/components/DataTable/SortButton.js.map +1 -1
  53. package/dist/components/DataTable/filters.js +2 -1
  54. package/dist/components/DataTable/filters.js.map +1 -1
  55. package/dist/components/DataTable/parts.js +1 -1
  56. package/dist/components/DataTable/parts.js.map +1 -1
  57. package/dist/components/DataTable/types.d.ts +10 -3
  58. package/dist/components/DatePicker/DatePicker.d.ts +7 -5
  59. package/dist/components/DatePicker/DatePicker.js +16 -6
  60. package/dist/components/DatePicker/DatePicker.js.map +1 -1
  61. package/dist/components/DateRangePicker/DateRangePicker.d.ts +12 -7
  62. package/dist/components/DateRangePicker/DateRangePicker.js +81 -45
  63. package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -1
  64. package/dist/components/DetailList/DetailList.d.ts +2 -0
  65. package/dist/components/DetailList/DetailList.js.map +1 -1
  66. package/dist/components/Dialog/Dialog.d.ts +56 -20
  67. package/dist/components/Dialog/Dialog.js +45 -14
  68. package/dist/components/Dialog/Dialog.js.map +1 -1
  69. package/dist/components/Drawer/Drawer.d.ts +17 -5
  70. package/dist/components/Drawer/Drawer.js +86 -24
  71. package/dist/components/Drawer/Drawer.js.map +1 -1
  72. package/dist/components/ErrorPage/ErrorPage.d.ts +3 -0
  73. package/dist/components/ErrorPage/ErrorPage.js.map +1 -1
  74. package/dist/components/EventTimeline/EventTimeline.d.ts +22 -4
  75. package/dist/components/EventTimeline/EventTimeline.js +63 -20
  76. package/dist/components/EventTimeline/EventTimeline.js.map +1 -1
  77. package/dist/components/FileUpload/FileUpload.d.ts +9 -1
  78. package/dist/components/FileUpload/FileUpload.js +3 -1
  79. package/dist/components/FileUpload/FileUpload.js.map +1 -1
  80. package/dist/components/FormGrid/FormGrid.d.ts +3 -1
  81. package/dist/components/FormGrid/FormGrid.js +5 -2
  82. package/dist/components/FormGrid/FormGrid.js.map +1 -1
  83. package/dist/components/Graph/Graph.d.ts +1 -0
  84. package/dist/components/Graph/Graph.js +8 -4
  85. package/dist/components/Graph/Graph.js.map +1 -1
  86. package/dist/components/Grid/Grid.d.ts +11 -4
  87. package/dist/components/Grid/Grid.js +14 -2
  88. package/dist/components/Grid/Grid.js.map +1 -1
  89. package/dist/components/IconButton/IconButton.d.ts +2 -1
  90. package/dist/components/IconButton/IconButton.js +10 -1
  91. package/dist/components/IconButton/IconButton.js.map +1 -1
  92. package/dist/components/InlineCode/InlineCode.d.ts +6 -0
  93. package/dist/components/InlineCode/InlineCode.js.map +1 -1
  94. package/dist/components/KpiCard/KpiCard.d.ts +5 -1
  95. package/dist/components/KpiCard/KpiCard.js +35 -21
  96. package/dist/components/KpiCard/KpiCard.js.map +1 -1
  97. package/dist/components/LayerGraph/LayerGraph.d.ts +68 -23
  98. package/dist/components/LayerGraph/LayerGraph.js +159 -88
  99. package/dist/components/LayerGraph/LayerGraph.js.map +1 -1
  100. package/dist/components/LineChart/LineChart.d.ts +10 -3
  101. package/dist/components/LineChart/LineChart.js +55 -23
  102. package/dist/components/LineChart/LineChart.js.map +1 -1
  103. package/dist/components/Link/Link.d.ts +17 -0
  104. package/dist/components/Link/Link.js +47 -0
  105. package/dist/components/Link/Link.js.map +1 -0
  106. package/dist/components/LoadingBar/LoadingBar.d.ts +1 -0
  107. package/dist/components/LoadingBar/LoadingBar.js.map +1 -1
  108. package/dist/components/LoginCard/LoginCard.d.ts +9 -3
  109. package/dist/components/LoginCard/LoginCard.js +99 -78
  110. package/dist/components/LoginCard/LoginCard.js.map +1 -1
  111. package/dist/components/Markdown/Markdown.d.ts +1 -0
  112. package/dist/components/Markdown/Markdown.js +1 -1
  113. package/dist/components/Markdown/Markdown.js.map +1 -1
  114. package/dist/components/Menu/Menu.d.ts +4 -2
  115. package/dist/components/Menu/Menu.js +43 -33
  116. package/dist/components/Menu/Menu.js.map +1 -1
  117. package/dist/components/Meter/Meter.d.ts +4 -0
  118. package/dist/components/Meter/Meter.js.map +1 -1
  119. package/dist/components/MobileTabBar/MobileTabBar.d.ts +3 -0
  120. package/dist/components/MobileTabBar/MobileTabBar.js.map +1 -1
  121. package/dist/components/MultiSelect/MultiSelect.d.ts +7 -6
  122. package/dist/components/MultiSelect/MultiSelect.js +27 -9
  123. package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
  124. package/dist/components/NotificationBell/NotificationBell.d.ts +3 -0
  125. package/dist/components/NotificationBell/NotificationBell.js +2 -2
  126. package/dist/components/NotificationBell/NotificationBell.js.map +1 -1
  127. package/dist/components/PageHeader/PageHeader.d.ts +34 -0
  128. package/dist/components/PageHeader/PageHeader.js +68 -0
  129. package/dist/components/PageHeader/PageHeader.js.map +1 -0
  130. package/dist/components/Popover/Popover.d.ts +11 -4
  131. package/dist/components/Popover/Popover.js +17 -7
  132. package/dist/components/Popover/Popover.js.map +1 -1
  133. package/dist/components/ProgressBar/ProgressBar.d.ts +2 -0
  134. package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
  135. package/dist/components/ProgressRing/ProgressRing.d.ts +1 -0
  136. package/dist/components/ProgressRing/ProgressRing.js.map +1 -1
  137. package/dist/components/ProjectSwitcher/ProjectSwitcher.d.ts +5 -1
  138. package/dist/components/ProjectSwitcher/ProjectSwitcher.js +16 -3
  139. package/dist/components/ProjectSwitcher/ProjectSwitcher.js.map +1 -1
  140. package/dist/components/RadioGroup/RadioGroup.d.ts +22 -5
  141. package/dist/components/RadioGroup/RadioGroup.js +48 -47
  142. package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
  143. package/dist/components/RelativeTime/RelativeTime.d.ts +10 -0
  144. package/dist/components/RelativeTime/RelativeTime.js +44 -0
  145. package/dist/components/RelativeTime/RelativeTime.js.map +1 -0
  146. package/dist/components/SearchField/SearchField.d.ts +2 -0
  147. package/dist/components/SearchField/SearchField.js.map +1 -1
  148. package/dist/components/Section/Section.d.ts +4 -0
  149. package/dist/components/Section/Section.js +8 -22
  150. package/dist/components/Section/Section.js.map +1 -1
  151. package/dist/components/SegmentedControl/SegmentedControl.d.ts +22 -9
  152. package/dist/components/SegmentedControl/SegmentedControl.js +20 -19
  153. package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
  154. package/dist/components/Select/Select.d.ts +7 -11
  155. package/dist/components/Select/Select.js +7 -3
  156. package/dist/components/Select/Select.js.map +1 -1
  157. package/dist/components/SettingsLayout/SettingsLayout.d.ts +32 -3
  158. package/dist/components/SettingsLayout/SettingsLayout.js +60 -13
  159. package/dist/components/SettingsLayout/SettingsLayout.js.map +1 -1
  160. package/dist/components/SideNav/SideNav.d.ts +2 -0
  161. package/dist/components/SideNav/SideNav.js +3 -3
  162. package/dist/components/SideNav/SideNav.js.map +1 -1
  163. package/dist/components/SplitPane/SplitPane.d.ts +1 -0
  164. package/dist/components/SplitPane/SplitPane.js.map +1 -1
  165. package/dist/components/StatusBand/StatusBand.d.ts +1 -0
  166. package/dist/components/StatusBand/StatusBand.js.map +1 -1
  167. package/dist/components/Suggestion/Suggestion.d.ts +6 -0
  168. package/dist/components/Suggestion/Suggestion.js.map +1 -1
  169. package/dist/components/Switch/Switch.d.ts +13 -3
  170. package/dist/components/Switch/Switch.js +16 -7
  171. package/dist/components/Switch/Switch.js.map +1 -1
  172. package/dist/components/Tabs/Tabs.d.ts +4 -0
  173. package/dist/components/Tabs/Tabs.js +1 -1
  174. package/dist/components/Tabs/Tabs.js.map +1 -1
  175. package/dist/components/Tag/Tag.d.ts +15 -7
  176. package/dist/components/Tag/Tag.js +22 -10
  177. package/dist/components/Tag/Tag.js.map +1 -1
  178. package/dist/components/Term/Term.d.ts +8 -3
  179. package/dist/components/Term/Term.js +1 -1
  180. package/dist/components/Term/Term.js.map +1 -1
  181. package/dist/components/TextArea/TextArea.d.ts +6 -10
  182. package/dist/components/TextArea/TextArea.js +22 -10
  183. package/dist/components/TextArea/TextArea.js.map +1 -1
  184. package/dist/components/TextField/TextField.d.ts +8 -11
  185. package/dist/components/TextField/TextField.js +9 -7
  186. package/dist/components/TextField/TextField.js.map +1 -1
  187. package/dist/components/ThemePicker/ThemePicker.d.ts +1 -0
  188. package/dist/components/ThemePicker/ThemePicker.js +35 -34
  189. package/dist/components/ThemePicker/ThemePicker.js.map +1 -1
  190. package/dist/components/TimeControl/TimeControl.d.ts +1 -0
  191. package/dist/components/TimeControl/TimeControl.js.map +1 -1
  192. package/dist/components/Toast/Toast.d.ts +55 -2
  193. package/dist/components/Toast/Toast.js +190 -8
  194. package/dist/components/Toast/Toast.js.map +1 -1
  195. package/dist/components/TopBar/TopBar.d.ts +6 -2
  196. package/dist/components/TopBar/TopBar.js +7 -1
  197. package/dist/components/TopBar/TopBar.js.map +1 -1
  198. package/dist/components/Tour/Tour.d.ts +14 -3
  199. package/dist/components/Tour/Tour.js +26 -14
  200. package/dist/components/Tour/Tour.js.map +1 -1
  201. package/dist/components/TreeList/TreeList.d.ts +28 -4
  202. package/dist/components/TreeList/TreeList.js +32 -20
  203. package/dist/components/TreeList/TreeList.js.map +1 -1
  204. package/dist/components/Workbench/Workbench.d.ts +1 -0
  205. package/dist/components/Workbench/Workbench.js +24 -12
  206. package/dist/components/Workbench/Workbench.js.map +1 -1
  207. package/dist/components/ZoneMap/ZoneMap.d.ts +12 -2
  208. package/dist/components/ZoneMap/ZoneMap.js +13 -5
  209. package/dist/components/ZoneMap/ZoneMap.js.map +1 -1
  210. package/dist/components/useFormErrors/useFormErrors.d.ts +20 -0
  211. package/dist/components/useFormErrors/useFormErrors.js +55 -0
  212. package/dist/components/useFormErrors/useFormErrors.js.map +1 -0
  213. package/dist/css/AccentPicker.css +1 -0
  214. package/dist/css/Alert.css +7 -19
  215. package/dist/css/AppShell.css +1 -0
  216. package/dist/css/Badge.css +19 -45
  217. package/dist/css/BarChart.css +21 -3
  218. package/dist/css/Button.css +5 -1
  219. package/dist/css/Card.css +8 -8
  220. package/dist/css/Checkbox.css +19 -0
  221. package/dist/css/CodeView.css +2 -1
  222. package/dist/css/DangerZone.css +4 -3
  223. package/dist/css/DataTable.css +129 -34
  224. package/dist/css/DateRangePicker.css +23 -2
  225. package/dist/css/Drawer.css +30 -0
  226. package/dist/css/ErrorPage.css +3 -1
  227. package/dist/css/EventTimeline.css +33 -5
  228. package/dist/css/FormGrid.css +12 -3
  229. package/dist/css/Graph.css +9 -1
  230. package/dist/css/Grid.css +8 -0
  231. package/dist/css/KpiCard.css +12 -1
  232. package/dist/css/LayerGraph.css +40 -15
  233. package/dist/css/Link.css +23 -0
  234. package/dist/css/LoginCard.css +16 -11
  235. package/dist/css/Markdown.css +2 -1
  236. package/dist/css/Menu.css +0 -2
  237. package/dist/css/Meter.css +16 -0
  238. package/dist/css/PageHeader.css +50 -0
  239. package/dist/css/ProgressBar.css +12 -0
  240. package/dist/css/ProjectSwitcher.css +23 -26
  241. package/dist/css/RelativeTime.css +2 -0
  242. package/dist/css/SegmentedControl.css +38 -10
  243. package/dist/css/SettingsLayout.css +28 -8
  244. package/dist/css/SideNav.css +4 -1
  245. package/dist/css/Skeleton.css +22 -1
  246. package/dist/css/Switch.css +27 -0
  247. package/dist/css/Tabs.css +2 -1
  248. package/dist/css/Tag.css +19 -12
  249. package/dist/css/Toast.css +100 -4
  250. package/dist/css/TopBar.css +21 -2
  251. package/dist/css/TreeList.css +6 -3
  252. package/dist/css/Workbench.css +1 -1
  253. package/dist/css/ZoneMap.css +0 -1
  254. package/dist/css/base.css +45 -0
  255. package/dist/css/end.css +119 -5
  256. package/dist/deprecated.d.ts +3 -0
  257. package/dist/deprecated.js +13 -0
  258. package/dist/deprecated.js.map +1 -0
  259. package/dist/fonts.css +2 -7543
  260. package/dist/format.d.ts +3 -1
  261. package/dist/format.js +12 -4
  262. package/dist/format.js.map +1 -1
  263. package/dist/generated/themeDefaults.d.ts +8 -0
  264. package/dist/generated/themeDefaults.js +35 -0
  265. package/dist/generated/themeDefaults.js.map +1 -0
  266. package/dist/i18n.d.ts +7 -2
  267. package/dist/i18n.js +65 -10
  268. package/dist/i18n.js.map +1 -1
  269. package/dist/icons/Icon.d.ts +3 -1
  270. package/dist/icons/Icon.js.map +1 -1
  271. package/dist/index.d.ts +23 -14
  272. package/dist/index.js +14 -8
  273. package/dist/internal/Field.d.ts +19 -0
  274. package/dist/internal/Field.js +10 -4
  275. package/dist/internal/Field.js.map +1 -1
  276. package/dist/internal/FloatingPanel.js +2 -1
  277. package/dist/internal/FloatingPanel.js.map +1 -1
  278. package/dist/internal/chart.d.ts +4 -0
  279. package/dist/internal/chart.js +89 -19
  280. package/dist/internal/chart.js.map +1 -1
  281. package/dist/internal/dev.js +9 -4
  282. package/dist/internal/dev.js.map +1 -1
  283. package/dist/internal/focus.js +27 -3
  284. package/dist/internal/focus.js.map +1 -1
  285. package/dist/internal/focusMain.js +6 -2
  286. package/dist/internal/focusMain.js.map +1 -1
  287. package/dist/internal/open.d.ts +14 -0
  288. package/dist/internal/open.js +28 -0
  289. package/dist/internal/open.js.map +1 -0
  290. package/dist/internal/roving.js +37 -0
  291. package/dist/internal/roving.js.map +1 -0
  292. package/dist/internal/shell.js +12 -0
  293. package/dist/internal/shell.js.map +1 -0
  294. package/dist/internal/stored.js +89 -0
  295. package/dist/internal/stored.js.map +1 -0
  296. package/dist/internal/tableTools.js +46 -4
  297. package/dist/internal/tableTools.js.map +1 -1
  298. package/dist/internal/util.js +8 -17
  299. package/dist/internal/util.js.map +1 -1
  300. package/dist/locale.d.ts +17 -0
  301. package/dist/locale.js +29 -0
  302. package/dist/locale.js.map +1 -0
  303. package/dist/styles.css +944 -231
  304. package/dist/theme.d.ts +23 -5
  305. package/dist/theme.js +85 -25
  306. package/dist/theme.js.map +1 -1
  307. package/dist/tokens.css +3 -0
  308. package/docs/AccentPicker.md +3 -1
  309. package/docs/Alert.md +4 -4
  310. package/docs/AppShell.md +11 -10
  311. package/docs/Badge.md +26 -16
  312. package/docs/BarChart.md +7 -4
  313. package/docs/Button.md +4 -5
  314. package/docs/Calendar.md +2 -2
  315. package/docs/Card.md +8 -7
  316. package/docs/Checkbox.md +4 -1
  317. package/docs/CodeView.md +30 -43
  318. package/docs/CommandPalette.md +3 -2
  319. package/docs/ConsoleLayout.md +5 -5
  320. package/docs/DangerZone.md +3 -3
  321. package/docs/DataColors.md +2 -2
  322. package/docs/DataTable.md +26 -148
  323. package/docs/DatePicker.md +1 -1
  324. package/docs/DateRangePicker.md +3 -0
  325. package/docs/DetailList.md +9 -9
  326. package/docs/Dialog.md +8 -5
  327. package/docs/Drawer.md +7 -5
  328. package/docs/EmptyState.md +0 -1
  329. package/docs/ErrorPage.md +1 -2
  330. package/docs/EventTimeline.md +23 -13
  331. package/docs/FileUpload.md +1 -2
  332. package/docs/FormGrid.md +2 -1
  333. package/docs/Format.md +4 -2
  334. package/docs/Graph.md +1 -1
  335. package/docs/Grid.md +5 -1
  336. package/docs/KpiCard.md +6 -5
  337. package/docs/LayerGraph.md +18 -53
  338. package/docs/LineChart.md +5 -3
  339. package/docs/Link.md +22 -0
  340. package/docs/LoginCard.md +7 -4
  341. package/docs/Markdown.md +2 -15
  342. package/docs/Menu.md +2 -0
  343. package/docs/Meter.md +1 -0
  344. package/docs/MultiSelect.md +2 -2
  345. package/docs/NotificationBell.md +1 -1
  346. package/docs/PageHeader.md +34 -0
  347. package/docs/Popover.md +3 -1
  348. package/docs/ProgressBar.md +3 -1
  349. package/docs/ProjectSwitcher.md +14 -14
  350. package/docs/RadioGroup.md +2 -0
  351. package/docs/RelativeTime.md +23 -0
  352. package/docs/Section.md +1 -1
  353. package/docs/SegmentedControl.md +9 -6
  354. package/docs/Select.md +2 -2
  355. package/docs/SettingsLayout.md +19 -5
  356. package/docs/SideNav.md +1 -1
  357. package/docs/Skeleton.md +2 -1
  358. package/docs/Switch.md +3 -1
  359. package/docs/Tabs.md +2 -1
  360. package/docs/Tag.md +9 -7
  361. package/docs/Term.md +3 -4
  362. package/docs/TextArea.md +2 -2
  363. package/docs/TextField.md +5 -4
  364. package/docs/ThemePicker.md +3 -1
  365. package/docs/Toast.md +17 -6
  366. package/docs/TopBar.md +8 -5
  367. package/docs/Tour.md +3 -2
  368. package/docs/TreeList.md +10 -37
  369. package/docs/Workbench.md +1 -48
  370. package/docs/ZoneMap.md +5 -5
  371. package/docs/agents.md +82 -0
  372. package/docs/code.md +2 -2
  373. package/docs/components.json +314 -0
  374. package/docs/data.md +9 -19
  375. package/docs/forms.md +6 -5
  376. package/docs/guidelines.md +39 -31
  377. package/docs/icons.md +9 -0
  378. package/docs/layout.md +16 -20
  379. package/docs/motion.md +31 -56
  380. package/docs/theme.md +15 -18
  381. package/docs/useFormErrors.md +35 -0
  382. package/package.json +8 -7
  383. package/dist/bundle.js.map +0 -1
  384. package/dist/fonts/LICENSE-OFL.txt +0 -93
  385. package/dist/fonts/geist-mono-cyrillic-400-normal.woff2 +0 -0
  386. package/dist/fonts/geist-mono-cyrillic-500-normal.woff2 +0 -0
  387. package/dist/fonts/geist-mono-cyrillic-600-normal.woff2 +0 -0
  388. package/dist/fonts/geist-mono-cyrillic-700-normal.woff2 +0 -0
  389. package/dist/fonts/geist-mono-cyrillic-ext-400-normal.woff2 +0 -0
  390. package/dist/fonts/geist-mono-cyrillic-ext-500-normal.woff2 +0 -0
  391. package/dist/fonts/geist-mono-cyrillic-ext-600-normal.woff2 +0 -0
  392. package/dist/fonts/geist-mono-cyrillic-ext-700-normal.woff2 +0 -0
  393. package/dist/fonts/geist-mono-latin-400-normal.woff2 +0 -0
  394. package/dist/fonts/geist-mono-latin-500-normal.woff2 +0 -0
  395. package/dist/fonts/geist-mono-latin-600-normal.woff2 +0 -0
  396. package/dist/fonts/geist-mono-latin-700-normal.woff2 +0 -0
  397. package/dist/fonts/geist-mono-latin-ext-400-normal.woff2 +0 -0
  398. package/dist/fonts/geist-mono-latin-ext-500-normal.woff2 +0 -0
  399. package/dist/fonts/geist-mono-latin-ext-600-normal.woff2 +0 -0
  400. package/dist/fonts/geist-mono-latin-ext-700-normal.woff2 +0 -0
  401. package/dist/fonts/geist-mono-symbols2-400-normal.woff2 +0 -0
  402. package/dist/fonts/geist-mono-symbols2-500-normal.woff2 +0 -0
  403. package/dist/fonts/geist-mono-symbols2-600-normal.woff2 +0 -0
  404. package/dist/fonts/geist-mono-symbols2-700-normal.woff2 +0 -0
  405. package/dist/fonts/geist-mono-vietnamese-400-normal.woff2 +0 -0
  406. package/dist/fonts/geist-mono-vietnamese-500-normal.woff2 +0 -0
  407. package/dist/fonts/geist-mono-vietnamese-600-normal.woff2 +0 -0
  408. package/dist/fonts/geist-mono-vietnamese-700-normal.woff2 +0 -0
  409. package/dist/fonts/inter-cyrillic-400-normal.woff2 +0 -0
  410. package/dist/fonts/inter-cyrillic-500-normal.woff2 +0 -0
  411. package/dist/fonts/inter-cyrillic-600-normal.woff2 +0 -0
  412. package/dist/fonts/inter-cyrillic-700-normal.woff2 +0 -0
  413. package/dist/fonts/inter-cyrillic-ext-400-normal.woff2 +0 -0
  414. package/dist/fonts/inter-cyrillic-ext-500-normal.woff2 +0 -0
  415. package/dist/fonts/inter-cyrillic-ext-600-normal.woff2 +0 -0
  416. package/dist/fonts/inter-cyrillic-ext-700-normal.woff2 +0 -0
  417. package/dist/fonts/inter-greek-400-normal.woff2 +0 -0
  418. package/dist/fonts/inter-greek-500-normal.woff2 +0 -0
  419. package/dist/fonts/inter-greek-600-normal.woff2 +0 -0
  420. package/dist/fonts/inter-greek-700-normal.woff2 +0 -0
  421. package/dist/fonts/inter-greek-ext-400-normal.woff2 +0 -0
  422. package/dist/fonts/inter-greek-ext-500-normal.woff2 +0 -0
  423. package/dist/fonts/inter-greek-ext-600-normal.woff2 +0 -0
  424. package/dist/fonts/inter-greek-ext-700-normal.woff2 +0 -0
  425. package/dist/fonts/inter-latin-400-normal.woff2 +0 -0
  426. package/dist/fonts/inter-latin-500-normal.woff2 +0 -0
  427. package/dist/fonts/inter-latin-600-normal.woff2 +0 -0
  428. package/dist/fonts/inter-latin-700-normal.woff2 +0 -0
  429. package/dist/fonts/inter-latin-ext-400-normal.woff2 +0 -0
  430. package/dist/fonts/inter-latin-ext-500-normal.woff2 +0 -0
  431. package/dist/fonts/inter-latin-ext-600-normal.woff2 +0 -0
  432. package/dist/fonts/inter-latin-ext-700-normal.woff2 +0 -0
  433. package/dist/fonts/inter-vietnamese-400-normal.woff2 +0 -0
  434. package/dist/fonts/inter-vietnamese-500-normal.woff2 +0 -0
  435. package/dist/fonts/inter-vietnamese-600-normal.woff2 +0 -0
  436. package/dist/fonts/inter-vietnamese-700-normal.woff2 +0 -0
  437. package/dist/fonts/noto-sans-tc-0-400-normal.woff2 +0 -0
  438. package/dist/fonts/noto-sans-tc-0-500-normal.woff2 +0 -0
  439. package/dist/fonts/noto-sans-tc-0-600-normal.woff2 +0 -0
  440. package/dist/fonts/noto-sans-tc-0-700-normal.woff2 +0 -0
  441. package/dist/fonts/noto-sans-tc-1-400-normal.woff2 +0 -0
  442. package/dist/fonts/noto-sans-tc-1-500-normal.woff2 +0 -0
  443. package/dist/fonts/noto-sans-tc-1-600-normal.woff2 +0 -0
  444. package/dist/fonts/noto-sans-tc-1-700-normal.woff2 +0 -0
  445. package/dist/fonts/noto-sans-tc-10-400-normal.woff2 +0 -0
  446. package/dist/fonts/noto-sans-tc-10-500-normal.woff2 +0 -0
  447. package/dist/fonts/noto-sans-tc-10-600-normal.woff2 +0 -0
  448. package/dist/fonts/noto-sans-tc-10-700-normal.woff2 +0 -0
  449. package/dist/fonts/noto-sans-tc-101-400-normal.woff2 +0 -0
  450. package/dist/fonts/noto-sans-tc-101-500-normal.woff2 +0 -0
  451. package/dist/fonts/noto-sans-tc-101-600-normal.woff2 +0 -0
  452. package/dist/fonts/noto-sans-tc-101-700-normal.woff2 +0 -0
  453. package/dist/fonts/noto-sans-tc-102-400-normal.woff2 +0 -0
  454. package/dist/fonts/noto-sans-tc-102-500-normal.woff2 +0 -0
  455. package/dist/fonts/noto-sans-tc-102-600-normal.woff2 +0 -0
  456. package/dist/fonts/noto-sans-tc-102-700-normal.woff2 +0 -0
  457. package/dist/fonts/noto-sans-tc-103-400-normal.woff2 +0 -0
  458. package/dist/fonts/noto-sans-tc-103-500-normal.woff2 +0 -0
  459. package/dist/fonts/noto-sans-tc-103-600-normal.woff2 +0 -0
  460. package/dist/fonts/noto-sans-tc-103-700-normal.woff2 +0 -0
  461. package/dist/fonts/noto-sans-tc-104-400-normal.woff2 +0 -0
  462. package/dist/fonts/noto-sans-tc-104-500-normal.woff2 +0 -0
  463. package/dist/fonts/noto-sans-tc-104-600-normal.woff2 +0 -0
  464. package/dist/fonts/noto-sans-tc-104-700-normal.woff2 +0 -0
  465. package/dist/fonts/noto-sans-tc-105-400-normal.woff2 +0 -0
  466. package/dist/fonts/noto-sans-tc-105-500-normal.woff2 +0 -0
  467. package/dist/fonts/noto-sans-tc-105-600-normal.woff2 +0 -0
  468. package/dist/fonts/noto-sans-tc-105-700-normal.woff2 +0 -0
  469. package/dist/fonts/noto-sans-tc-106-400-normal.woff2 +0 -0
  470. package/dist/fonts/noto-sans-tc-106-500-normal.woff2 +0 -0
  471. package/dist/fonts/noto-sans-tc-106-600-normal.woff2 +0 -0
  472. package/dist/fonts/noto-sans-tc-106-700-normal.woff2 +0 -0
  473. package/dist/fonts/noto-sans-tc-107-400-normal.woff2 +0 -0
  474. package/dist/fonts/noto-sans-tc-107-500-normal.woff2 +0 -0
  475. package/dist/fonts/noto-sans-tc-107-600-normal.woff2 +0 -0
  476. package/dist/fonts/noto-sans-tc-107-700-normal.woff2 +0 -0
  477. package/dist/fonts/noto-sans-tc-108-400-normal.woff2 +0 -0
  478. package/dist/fonts/noto-sans-tc-108-500-normal.woff2 +0 -0
  479. package/dist/fonts/noto-sans-tc-108-600-normal.woff2 +0 -0
  480. package/dist/fonts/noto-sans-tc-108-700-normal.woff2 +0 -0
  481. package/dist/fonts/noto-sans-tc-109-400-normal.woff2 +0 -0
  482. package/dist/fonts/noto-sans-tc-109-500-normal.woff2 +0 -0
  483. package/dist/fonts/noto-sans-tc-109-600-normal.woff2 +0 -0
  484. package/dist/fonts/noto-sans-tc-109-700-normal.woff2 +0 -0
  485. package/dist/fonts/noto-sans-tc-11-400-normal.woff2 +0 -0
  486. package/dist/fonts/noto-sans-tc-11-500-normal.woff2 +0 -0
  487. package/dist/fonts/noto-sans-tc-11-600-normal.woff2 +0 -0
  488. package/dist/fonts/noto-sans-tc-11-700-normal.woff2 +0 -0
  489. package/dist/fonts/noto-sans-tc-110-400-normal.woff2 +0 -0
  490. package/dist/fonts/noto-sans-tc-110-500-normal.woff2 +0 -0
  491. package/dist/fonts/noto-sans-tc-110-600-normal.woff2 +0 -0
  492. package/dist/fonts/noto-sans-tc-110-700-normal.woff2 +0 -0
  493. package/dist/fonts/noto-sans-tc-111-400-normal.woff2 +0 -0
  494. package/dist/fonts/noto-sans-tc-111-500-normal.woff2 +0 -0
  495. package/dist/fonts/noto-sans-tc-111-600-normal.woff2 +0 -0
  496. package/dist/fonts/noto-sans-tc-111-700-normal.woff2 +0 -0
  497. package/dist/fonts/noto-sans-tc-112-400-normal.woff2 +0 -0
  498. package/dist/fonts/noto-sans-tc-112-500-normal.woff2 +0 -0
  499. package/dist/fonts/noto-sans-tc-112-600-normal.woff2 +0 -0
  500. package/dist/fonts/noto-sans-tc-112-700-normal.woff2 +0 -0
  501. package/dist/fonts/noto-sans-tc-113-400-normal.woff2 +0 -0
  502. package/dist/fonts/noto-sans-tc-113-500-normal.woff2 +0 -0
  503. package/dist/fonts/noto-sans-tc-113-600-normal.woff2 +0 -0
  504. package/dist/fonts/noto-sans-tc-113-700-normal.woff2 +0 -0
  505. package/dist/fonts/noto-sans-tc-114-400-normal.woff2 +0 -0
  506. package/dist/fonts/noto-sans-tc-114-500-normal.woff2 +0 -0
  507. package/dist/fonts/noto-sans-tc-114-600-normal.woff2 +0 -0
  508. package/dist/fonts/noto-sans-tc-114-700-normal.woff2 +0 -0
  509. package/dist/fonts/noto-sans-tc-115-400-normal.woff2 +0 -0
  510. package/dist/fonts/noto-sans-tc-115-500-normal.woff2 +0 -0
  511. package/dist/fonts/noto-sans-tc-115-600-normal.woff2 +0 -0
  512. package/dist/fonts/noto-sans-tc-115-700-normal.woff2 +0 -0
  513. package/dist/fonts/noto-sans-tc-116-400-normal.woff2 +0 -0
  514. package/dist/fonts/noto-sans-tc-116-500-normal.woff2 +0 -0
  515. package/dist/fonts/noto-sans-tc-116-600-normal.woff2 +0 -0
  516. package/dist/fonts/noto-sans-tc-116-700-normal.woff2 +0 -0
  517. package/dist/fonts/noto-sans-tc-117-400-normal.woff2 +0 -0
  518. package/dist/fonts/noto-sans-tc-117-500-normal.woff2 +0 -0
  519. package/dist/fonts/noto-sans-tc-117-600-normal.woff2 +0 -0
  520. package/dist/fonts/noto-sans-tc-117-700-normal.woff2 +0 -0
  521. package/dist/fonts/noto-sans-tc-118-400-normal.woff2 +0 -0
  522. package/dist/fonts/noto-sans-tc-118-500-normal.woff2 +0 -0
  523. package/dist/fonts/noto-sans-tc-118-600-normal.woff2 +0 -0
  524. package/dist/fonts/noto-sans-tc-118-700-normal.woff2 +0 -0
  525. package/dist/fonts/noto-sans-tc-119-400-normal.woff2 +0 -0
  526. package/dist/fonts/noto-sans-tc-119-500-normal.woff2 +0 -0
  527. package/dist/fonts/noto-sans-tc-119-600-normal.woff2 +0 -0
  528. package/dist/fonts/noto-sans-tc-119-700-normal.woff2 +0 -0
  529. package/dist/fonts/noto-sans-tc-12-400-normal.woff2 +0 -0
  530. package/dist/fonts/noto-sans-tc-12-500-normal.woff2 +0 -0
  531. package/dist/fonts/noto-sans-tc-12-600-normal.woff2 +0 -0
  532. package/dist/fonts/noto-sans-tc-12-700-normal.woff2 +0 -0
  533. package/dist/fonts/noto-sans-tc-120-400-normal.woff2 +0 -0
  534. package/dist/fonts/noto-sans-tc-120-500-normal.woff2 +0 -0
  535. package/dist/fonts/noto-sans-tc-120-600-normal.woff2 +0 -0
  536. package/dist/fonts/noto-sans-tc-120-700-normal.woff2 +0 -0
  537. package/dist/fonts/noto-sans-tc-121-400-normal.woff2 +0 -0
  538. package/dist/fonts/noto-sans-tc-121-500-normal.woff2 +0 -0
  539. package/dist/fonts/noto-sans-tc-121-600-normal.woff2 +0 -0
  540. package/dist/fonts/noto-sans-tc-121-700-normal.woff2 +0 -0
  541. package/dist/fonts/noto-sans-tc-122-400-normal.woff2 +0 -0
  542. package/dist/fonts/noto-sans-tc-122-500-normal.woff2 +0 -0
  543. package/dist/fonts/noto-sans-tc-122-600-normal.woff2 +0 -0
  544. package/dist/fonts/noto-sans-tc-122-700-normal.woff2 +0 -0
  545. package/dist/fonts/noto-sans-tc-123-400-normal.woff2 +0 -0
  546. package/dist/fonts/noto-sans-tc-123-500-normal.woff2 +0 -0
  547. package/dist/fonts/noto-sans-tc-123-600-normal.woff2 +0 -0
  548. package/dist/fonts/noto-sans-tc-123-700-normal.woff2 +0 -0
  549. package/dist/fonts/noto-sans-tc-2-400-normal.woff2 +0 -0
  550. package/dist/fonts/noto-sans-tc-2-500-normal.woff2 +0 -0
  551. package/dist/fonts/noto-sans-tc-2-600-normal.woff2 +0 -0
  552. package/dist/fonts/noto-sans-tc-2-700-normal.woff2 +0 -0
  553. package/dist/fonts/noto-sans-tc-23-400-normal.woff2 +0 -0
  554. package/dist/fonts/noto-sans-tc-23-500-normal.woff2 +0 -0
  555. package/dist/fonts/noto-sans-tc-23-600-normal.woff2 +0 -0
  556. package/dist/fonts/noto-sans-tc-23-700-normal.woff2 +0 -0
  557. package/dist/fonts/noto-sans-tc-24-400-normal.woff2 +0 -0
  558. package/dist/fonts/noto-sans-tc-24-500-normal.woff2 +0 -0
  559. package/dist/fonts/noto-sans-tc-24-600-normal.woff2 +0 -0
  560. package/dist/fonts/noto-sans-tc-24-700-normal.woff2 +0 -0
  561. package/dist/fonts/noto-sans-tc-25-400-normal.woff2 +0 -0
  562. package/dist/fonts/noto-sans-tc-25-500-normal.woff2 +0 -0
  563. package/dist/fonts/noto-sans-tc-25-600-normal.woff2 +0 -0
  564. package/dist/fonts/noto-sans-tc-25-700-normal.woff2 +0 -0
  565. package/dist/fonts/noto-sans-tc-26-400-normal.woff2 +0 -0
  566. package/dist/fonts/noto-sans-tc-26-500-normal.woff2 +0 -0
  567. package/dist/fonts/noto-sans-tc-26-600-normal.woff2 +0 -0
  568. package/dist/fonts/noto-sans-tc-26-700-normal.woff2 +0 -0
  569. package/dist/fonts/noto-sans-tc-27-400-normal.woff2 +0 -0
  570. package/dist/fonts/noto-sans-tc-27-500-normal.woff2 +0 -0
  571. package/dist/fonts/noto-sans-tc-27-600-normal.woff2 +0 -0
  572. package/dist/fonts/noto-sans-tc-27-700-normal.woff2 +0 -0
  573. package/dist/fonts/noto-sans-tc-28-400-normal.woff2 +0 -0
  574. package/dist/fonts/noto-sans-tc-28-500-normal.woff2 +0 -0
  575. package/dist/fonts/noto-sans-tc-28-600-normal.woff2 +0 -0
  576. package/dist/fonts/noto-sans-tc-28-700-normal.woff2 +0 -0
  577. package/dist/fonts/noto-sans-tc-29-400-normal.woff2 +0 -0
  578. package/dist/fonts/noto-sans-tc-29-500-normal.woff2 +0 -0
  579. package/dist/fonts/noto-sans-tc-29-600-normal.woff2 +0 -0
  580. package/dist/fonts/noto-sans-tc-29-700-normal.woff2 +0 -0
  581. package/dist/fonts/noto-sans-tc-30-400-normal.woff2 +0 -0
  582. package/dist/fonts/noto-sans-tc-30-500-normal.woff2 +0 -0
  583. package/dist/fonts/noto-sans-tc-30-600-normal.woff2 +0 -0
  584. package/dist/fonts/noto-sans-tc-30-700-normal.woff2 +0 -0
  585. package/dist/fonts/noto-sans-tc-31-400-normal.woff2 +0 -0
  586. package/dist/fonts/noto-sans-tc-31-500-normal.woff2 +0 -0
  587. package/dist/fonts/noto-sans-tc-31-600-normal.woff2 +0 -0
  588. package/dist/fonts/noto-sans-tc-31-700-normal.woff2 +0 -0
  589. package/dist/fonts/noto-sans-tc-32-400-normal.woff2 +0 -0
  590. package/dist/fonts/noto-sans-tc-32-500-normal.woff2 +0 -0
  591. package/dist/fonts/noto-sans-tc-32-600-normal.woff2 +0 -0
  592. package/dist/fonts/noto-sans-tc-32-700-normal.woff2 +0 -0
  593. package/dist/fonts/noto-sans-tc-33-400-normal.woff2 +0 -0
  594. package/dist/fonts/noto-sans-tc-33-500-normal.woff2 +0 -0
  595. package/dist/fonts/noto-sans-tc-33-600-normal.woff2 +0 -0
  596. package/dist/fonts/noto-sans-tc-33-700-normal.woff2 +0 -0
  597. package/dist/fonts/noto-sans-tc-34-400-normal.woff2 +0 -0
  598. package/dist/fonts/noto-sans-tc-34-500-normal.woff2 +0 -0
  599. package/dist/fonts/noto-sans-tc-34-600-normal.woff2 +0 -0
  600. package/dist/fonts/noto-sans-tc-34-700-normal.woff2 +0 -0
  601. package/dist/fonts/noto-sans-tc-35-400-normal.woff2 +0 -0
  602. package/dist/fonts/noto-sans-tc-35-500-normal.woff2 +0 -0
  603. package/dist/fonts/noto-sans-tc-35-600-normal.woff2 +0 -0
  604. package/dist/fonts/noto-sans-tc-35-700-normal.woff2 +0 -0
  605. package/dist/fonts/noto-sans-tc-36-400-normal.woff2 +0 -0
  606. package/dist/fonts/noto-sans-tc-36-500-normal.woff2 +0 -0
  607. package/dist/fonts/noto-sans-tc-36-600-normal.woff2 +0 -0
  608. package/dist/fonts/noto-sans-tc-36-700-normal.woff2 +0 -0
  609. package/dist/fonts/noto-sans-tc-37-400-normal.woff2 +0 -0
  610. package/dist/fonts/noto-sans-tc-37-500-normal.woff2 +0 -0
  611. package/dist/fonts/noto-sans-tc-37-600-normal.woff2 +0 -0
  612. package/dist/fonts/noto-sans-tc-37-700-normal.woff2 +0 -0
  613. package/dist/fonts/noto-sans-tc-38-400-normal.woff2 +0 -0
  614. package/dist/fonts/noto-sans-tc-38-500-normal.woff2 +0 -0
  615. package/dist/fonts/noto-sans-tc-38-600-normal.woff2 +0 -0
  616. package/dist/fonts/noto-sans-tc-38-700-normal.woff2 +0 -0
  617. package/dist/fonts/noto-sans-tc-39-400-normal.woff2 +0 -0
  618. package/dist/fonts/noto-sans-tc-39-500-normal.woff2 +0 -0
  619. package/dist/fonts/noto-sans-tc-39-600-normal.woff2 +0 -0
  620. package/dist/fonts/noto-sans-tc-39-700-normal.woff2 +0 -0
  621. package/dist/fonts/noto-sans-tc-4-400-normal.woff2 +0 -0
  622. package/dist/fonts/noto-sans-tc-4-500-normal.woff2 +0 -0
  623. package/dist/fonts/noto-sans-tc-4-600-normal.woff2 +0 -0
  624. package/dist/fonts/noto-sans-tc-4-700-normal.woff2 +0 -0
  625. package/dist/fonts/noto-sans-tc-40-400-normal.woff2 +0 -0
  626. package/dist/fonts/noto-sans-tc-40-500-normal.woff2 +0 -0
  627. package/dist/fonts/noto-sans-tc-40-600-normal.woff2 +0 -0
  628. package/dist/fonts/noto-sans-tc-40-700-normal.woff2 +0 -0
  629. package/dist/fonts/noto-sans-tc-41-400-normal.woff2 +0 -0
  630. package/dist/fonts/noto-sans-tc-41-500-normal.woff2 +0 -0
  631. package/dist/fonts/noto-sans-tc-41-600-normal.woff2 +0 -0
  632. package/dist/fonts/noto-sans-tc-41-700-normal.woff2 +0 -0
  633. package/dist/fonts/noto-sans-tc-42-400-normal.woff2 +0 -0
  634. package/dist/fonts/noto-sans-tc-42-500-normal.woff2 +0 -0
  635. package/dist/fonts/noto-sans-tc-42-600-normal.woff2 +0 -0
  636. package/dist/fonts/noto-sans-tc-42-700-normal.woff2 +0 -0
  637. package/dist/fonts/noto-sans-tc-43-400-normal.woff2 +0 -0
  638. package/dist/fonts/noto-sans-tc-43-500-normal.woff2 +0 -0
  639. package/dist/fonts/noto-sans-tc-43-600-normal.woff2 +0 -0
  640. package/dist/fonts/noto-sans-tc-43-700-normal.woff2 +0 -0
  641. package/dist/fonts/noto-sans-tc-44-400-normal.woff2 +0 -0
  642. package/dist/fonts/noto-sans-tc-44-500-normal.woff2 +0 -0
  643. package/dist/fonts/noto-sans-tc-44-600-normal.woff2 +0 -0
  644. package/dist/fonts/noto-sans-tc-44-700-normal.woff2 +0 -0
  645. package/dist/fonts/noto-sans-tc-45-400-normal.woff2 +0 -0
  646. package/dist/fonts/noto-sans-tc-45-500-normal.woff2 +0 -0
  647. package/dist/fonts/noto-sans-tc-45-600-normal.woff2 +0 -0
  648. package/dist/fonts/noto-sans-tc-45-700-normal.woff2 +0 -0
  649. package/dist/fonts/noto-sans-tc-46-400-normal.woff2 +0 -0
  650. package/dist/fonts/noto-sans-tc-46-500-normal.woff2 +0 -0
  651. package/dist/fonts/noto-sans-tc-46-600-normal.woff2 +0 -0
  652. package/dist/fonts/noto-sans-tc-46-700-normal.woff2 +0 -0
  653. package/dist/fonts/noto-sans-tc-47-400-normal.woff2 +0 -0
  654. package/dist/fonts/noto-sans-tc-47-500-normal.woff2 +0 -0
  655. package/dist/fonts/noto-sans-tc-47-600-normal.woff2 +0 -0
  656. package/dist/fonts/noto-sans-tc-47-700-normal.woff2 +0 -0
  657. package/dist/fonts/noto-sans-tc-48-400-normal.woff2 +0 -0
  658. package/dist/fonts/noto-sans-tc-48-500-normal.woff2 +0 -0
  659. package/dist/fonts/noto-sans-tc-48-600-normal.woff2 +0 -0
  660. package/dist/fonts/noto-sans-tc-48-700-normal.woff2 +0 -0
  661. package/dist/fonts/noto-sans-tc-49-400-normal.woff2 +0 -0
  662. package/dist/fonts/noto-sans-tc-49-500-normal.woff2 +0 -0
  663. package/dist/fonts/noto-sans-tc-49-600-normal.woff2 +0 -0
  664. package/dist/fonts/noto-sans-tc-49-700-normal.woff2 +0 -0
  665. package/dist/fonts/noto-sans-tc-50-400-normal.woff2 +0 -0
  666. package/dist/fonts/noto-sans-tc-50-500-normal.woff2 +0 -0
  667. package/dist/fonts/noto-sans-tc-50-600-normal.woff2 +0 -0
  668. package/dist/fonts/noto-sans-tc-50-700-normal.woff2 +0 -0
  669. package/dist/fonts/noto-sans-tc-51-400-normal.woff2 +0 -0
  670. package/dist/fonts/noto-sans-tc-51-500-normal.woff2 +0 -0
  671. package/dist/fonts/noto-sans-tc-51-600-normal.woff2 +0 -0
  672. package/dist/fonts/noto-sans-tc-51-700-normal.woff2 +0 -0
  673. package/dist/fonts/noto-sans-tc-52-400-normal.woff2 +0 -0
  674. package/dist/fonts/noto-sans-tc-52-500-normal.woff2 +0 -0
  675. package/dist/fonts/noto-sans-tc-52-600-normal.woff2 +0 -0
  676. package/dist/fonts/noto-sans-tc-52-700-normal.woff2 +0 -0
  677. package/dist/fonts/noto-sans-tc-53-400-normal.woff2 +0 -0
  678. package/dist/fonts/noto-sans-tc-53-500-normal.woff2 +0 -0
  679. package/dist/fonts/noto-sans-tc-53-600-normal.woff2 +0 -0
  680. package/dist/fonts/noto-sans-tc-53-700-normal.woff2 +0 -0
  681. package/dist/fonts/noto-sans-tc-54-400-normal.woff2 +0 -0
  682. package/dist/fonts/noto-sans-tc-54-500-normal.woff2 +0 -0
  683. package/dist/fonts/noto-sans-tc-54-600-normal.woff2 +0 -0
  684. package/dist/fonts/noto-sans-tc-54-700-normal.woff2 +0 -0
  685. package/dist/fonts/noto-sans-tc-55-400-normal.woff2 +0 -0
  686. package/dist/fonts/noto-sans-tc-55-500-normal.woff2 +0 -0
  687. package/dist/fonts/noto-sans-tc-55-600-normal.woff2 +0 -0
  688. package/dist/fonts/noto-sans-tc-55-700-normal.woff2 +0 -0
  689. package/dist/fonts/noto-sans-tc-56-400-normal.woff2 +0 -0
  690. package/dist/fonts/noto-sans-tc-56-500-normal.woff2 +0 -0
  691. package/dist/fonts/noto-sans-tc-56-600-normal.woff2 +0 -0
  692. package/dist/fonts/noto-sans-tc-56-700-normal.woff2 +0 -0
  693. package/dist/fonts/noto-sans-tc-57-400-normal.woff2 +0 -0
  694. package/dist/fonts/noto-sans-tc-57-500-normal.woff2 +0 -0
  695. package/dist/fonts/noto-sans-tc-57-600-normal.woff2 +0 -0
  696. package/dist/fonts/noto-sans-tc-57-700-normal.woff2 +0 -0
  697. package/dist/fonts/noto-sans-tc-58-400-normal.woff2 +0 -0
  698. package/dist/fonts/noto-sans-tc-58-500-normal.woff2 +0 -0
  699. package/dist/fonts/noto-sans-tc-58-600-normal.woff2 +0 -0
  700. package/dist/fonts/noto-sans-tc-58-700-normal.woff2 +0 -0
  701. package/dist/fonts/noto-sans-tc-59-400-normal.woff2 +0 -0
  702. package/dist/fonts/noto-sans-tc-59-500-normal.woff2 +0 -0
  703. package/dist/fonts/noto-sans-tc-59-600-normal.woff2 +0 -0
  704. package/dist/fonts/noto-sans-tc-59-700-normal.woff2 +0 -0
  705. package/dist/fonts/noto-sans-tc-60-400-normal.woff2 +0 -0
  706. package/dist/fonts/noto-sans-tc-60-500-normal.woff2 +0 -0
  707. package/dist/fonts/noto-sans-tc-60-600-normal.woff2 +0 -0
  708. package/dist/fonts/noto-sans-tc-60-700-normal.woff2 +0 -0
  709. package/dist/fonts/noto-sans-tc-61-400-normal.woff2 +0 -0
  710. package/dist/fonts/noto-sans-tc-61-500-normal.woff2 +0 -0
  711. package/dist/fonts/noto-sans-tc-61-600-normal.woff2 +0 -0
  712. package/dist/fonts/noto-sans-tc-61-700-normal.woff2 +0 -0
  713. package/dist/fonts/noto-sans-tc-62-400-normal.woff2 +0 -0
  714. package/dist/fonts/noto-sans-tc-62-500-normal.woff2 +0 -0
  715. package/dist/fonts/noto-sans-tc-62-600-normal.woff2 +0 -0
  716. package/dist/fonts/noto-sans-tc-62-700-normal.woff2 +0 -0
  717. package/dist/fonts/noto-sans-tc-63-400-normal.woff2 +0 -0
  718. package/dist/fonts/noto-sans-tc-63-500-normal.woff2 +0 -0
  719. package/dist/fonts/noto-sans-tc-63-600-normal.woff2 +0 -0
  720. package/dist/fonts/noto-sans-tc-63-700-normal.woff2 +0 -0
  721. package/dist/fonts/noto-sans-tc-64-400-normal.woff2 +0 -0
  722. package/dist/fonts/noto-sans-tc-64-500-normal.woff2 +0 -0
  723. package/dist/fonts/noto-sans-tc-64-600-normal.woff2 +0 -0
  724. package/dist/fonts/noto-sans-tc-64-700-normal.woff2 +0 -0
  725. package/dist/fonts/noto-sans-tc-65-400-normal.woff2 +0 -0
  726. package/dist/fonts/noto-sans-tc-65-500-normal.woff2 +0 -0
  727. package/dist/fonts/noto-sans-tc-65-600-normal.woff2 +0 -0
  728. package/dist/fonts/noto-sans-tc-65-700-normal.woff2 +0 -0
  729. package/dist/fonts/noto-sans-tc-66-400-normal.woff2 +0 -0
  730. package/dist/fonts/noto-sans-tc-66-500-normal.woff2 +0 -0
  731. package/dist/fonts/noto-sans-tc-66-600-normal.woff2 +0 -0
  732. package/dist/fonts/noto-sans-tc-66-700-normal.woff2 +0 -0
  733. package/dist/fonts/noto-sans-tc-67-400-normal.woff2 +0 -0
  734. package/dist/fonts/noto-sans-tc-67-500-normal.woff2 +0 -0
  735. package/dist/fonts/noto-sans-tc-67-600-normal.woff2 +0 -0
  736. package/dist/fonts/noto-sans-tc-67-700-normal.woff2 +0 -0
  737. package/dist/fonts/noto-sans-tc-68-400-normal.woff2 +0 -0
  738. package/dist/fonts/noto-sans-tc-68-500-normal.woff2 +0 -0
  739. package/dist/fonts/noto-sans-tc-68-600-normal.woff2 +0 -0
  740. package/dist/fonts/noto-sans-tc-68-700-normal.woff2 +0 -0
  741. package/dist/fonts/noto-sans-tc-69-400-normal.woff2 +0 -0
  742. package/dist/fonts/noto-sans-tc-69-500-normal.woff2 +0 -0
  743. package/dist/fonts/noto-sans-tc-69-600-normal.woff2 +0 -0
  744. package/dist/fonts/noto-sans-tc-69-700-normal.woff2 +0 -0
  745. package/dist/fonts/noto-sans-tc-70-400-normal.woff2 +0 -0
  746. package/dist/fonts/noto-sans-tc-70-500-normal.woff2 +0 -0
  747. package/dist/fonts/noto-sans-tc-70-600-normal.woff2 +0 -0
  748. package/dist/fonts/noto-sans-tc-70-700-normal.woff2 +0 -0
  749. package/dist/fonts/noto-sans-tc-71-400-normal.woff2 +0 -0
  750. package/dist/fonts/noto-sans-tc-71-500-normal.woff2 +0 -0
  751. package/dist/fonts/noto-sans-tc-71-600-normal.woff2 +0 -0
  752. package/dist/fonts/noto-sans-tc-71-700-normal.woff2 +0 -0
  753. package/dist/fonts/noto-sans-tc-72-400-normal.woff2 +0 -0
  754. package/dist/fonts/noto-sans-tc-72-500-normal.woff2 +0 -0
  755. package/dist/fonts/noto-sans-tc-72-600-normal.woff2 +0 -0
  756. package/dist/fonts/noto-sans-tc-72-700-normal.woff2 +0 -0
  757. package/dist/fonts/noto-sans-tc-73-400-normal.woff2 +0 -0
  758. package/dist/fonts/noto-sans-tc-73-500-normal.woff2 +0 -0
  759. package/dist/fonts/noto-sans-tc-73-600-normal.woff2 +0 -0
  760. package/dist/fonts/noto-sans-tc-73-700-normal.woff2 +0 -0
  761. package/dist/fonts/noto-sans-tc-74-400-normal.woff2 +0 -0
  762. package/dist/fonts/noto-sans-tc-74-500-normal.woff2 +0 -0
  763. package/dist/fonts/noto-sans-tc-74-600-normal.woff2 +0 -0
  764. package/dist/fonts/noto-sans-tc-74-700-normal.woff2 +0 -0
  765. package/dist/fonts/noto-sans-tc-75-400-normal.woff2 +0 -0
  766. package/dist/fonts/noto-sans-tc-75-500-normal.woff2 +0 -0
  767. package/dist/fonts/noto-sans-tc-75-600-normal.woff2 +0 -0
  768. package/dist/fonts/noto-sans-tc-75-700-normal.woff2 +0 -0
  769. package/dist/fonts/noto-sans-tc-76-400-normal.woff2 +0 -0
  770. package/dist/fonts/noto-sans-tc-76-500-normal.woff2 +0 -0
  771. package/dist/fonts/noto-sans-tc-76-600-normal.woff2 +0 -0
  772. package/dist/fonts/noto-sans-tc-76-700-normal.woff2 +0 -0
  773. package/dist/fonts/noto-sans-tc-77-400-normal.woff2 +0 -0
  774. package/dist/fonts/noto-sans-tc-77-500-normal.woff2 +0 -0
  775. package/dist/fonts/noto-sans-tc-77-600-normal.woff2 +0 -0
  776. package/dist/fonts/noto-sans-tc-77-700-normal.woff2 +0 -0
  777. package/dist/fonts/noto-sans-tc-78-400-normal.woff2 +0 -0
  778. package/dist/fonts/noto-sans-tc-78-500-normal.woff2 +0 -0
  779. package/dist/fonts/noto-sans-tc-78-600-normal.woff2 +0 -0
  780. package/dist/fonts/noto-sans-tc-78-700-normal.woff2 +0 -0
  781. package/dist/fonts/noto-sans-tc-79-400-normal.woff2 +0 -0
  782. package/dist/fonts/noto-sans-tc-79-500-normal.woff2 +0 -0
  783. package/dist/fonts/noto-sans-tc-79-600-normal.woff2 +0 -0
  784. package/dist/fonts/noto-sans-tc-79-700-normal.woff2 +0 -0
  785. package/dist/fonts/noto-sans-tc-80-400-normal.woff2 +0 -0
  786. package/dist/fonts/noto-sans-tc-80-500-normal.woff2 +0 -0
  787. package/dist/fonts/noto-sans-tc-80-600-normal.woff2 +0 -0
  788. package/dist/fonts/noto-sans-tc-80-700-normal.woff2 +0 -0
  789. package/dist/fonts/noto-sans-tc-81-400-normal.woff2 +0 -0
  790. package/dist/fonts/noto-sans-tc-81-500-normal.woff2 +0 -0
  791. package/dist/fonts/noto-sans-tc-81-600-normal.woff2 +0 -0
  792. package/dist/fonts/noto-sans-tc-81-700-normal.woff2 +0 -0
  793. package/dist/fonts/noto-sans-tc-82-400-normal.woff2 +0 -0
  794. package/dist/fonts/noto-sans-tc-82-500-normal.woff2 +0 -0
  795. package/dist/fonts/noto-sans-tc-82-600-normal.woff2 +0 -0
  796. package/dist/fonts/noto-sans-tc-82-700-normal.woff2 +0 -0
  797. package/dist/fonts/noto-sans-tc-83-400-normal.woff2 +0 -0
  798. package/dist/fonts/noto-sans-tc-83-500-normal.woff2 +0 -0
  799. package/dist/fonts/noto-sans-tc-83-600-normal.woff2 +0 -0
  800. package/dist/fonts/noto-sans-tc-83-700-normal.woff2 +0 -0
  801. package/dist/fonts/noto-sans-tc-84-400-normal.woff2 +0 -0
  802. package/dist/fonts/noto-sans-tc-84-500-normal.woff2 +0 -0
  803. package/dist/fonts/noto-sans-tc-84-600-normal.woff2 +0 -0
  804. package/dist/fonts/noto-sans-tc-84-700-normal.woff2 +0 -0
  805. package/dist/fonts/noto-sans-tc-85-400-normal.woff2 +0 -0
  806. package/dist/fonts/noto-sans-tc-85-500-normal.woff2 +0 -0
  807. package/dist/fonts/noto-sans-tc-85-600-normal.woff2 +0 -0
  808. package/dist/fonts/noto-sans-tc-85-700-normal.woff2 +0 -0
  809. package/dist/fonts/noto-sans-tc-86-400-normal.woff2 +0 -0
  810. package/dist/fonts/noto-sans-tc-86-500-normal.woff2 +0 -0
  811. package/dist/fonts/noto-sans-tc-86-600-normal.woff2 +0 -0
  812. package/dist/fonts/noto-sans-tc-86-700-normal.woff2 +0 -0
  813. package/dist/fonts/noto-sans-tc-87-400-normal.woff2 +0 -0
  814. package/dist/fonts/noto-sans-tc-87-500-normal.woff2 +0 -0
  815. package/dist/fonts/noto-sans-tc-87-600-normal.woff2 +0 -0
  816. package/dist/fonts/noto-sans-tc-87-700-normal.woff2 +0 -0
  817. package/dist/fonts/noto-sans-tc-88-400-normal.woff2 +0 -0
  818. package/dist/fonts/noto-sans-tc-88-500-normal.woff2 +0 -0
  819. package/dist/fonts/noto-sans-tc-88-600-normal.woff2 +0 -0
  820. package/dist/fonts/noto-sans-tc-88-700-normal.woff2 +0 -0
  821. package/dist/fonts/noto-sans-tc-89-400-normal.woff2 +0 -0
  822. package/dist/fonts/noto-sans-tc-89-500-normal.woff2 +0 -0
  823. package/dist/fonts/noto-sans-tc-89-600-normal.woff2 +0 -0
  824. package/dist/fonts/noto-sans-tc-89-700-normal.woff2 +0 -0
  825. package/dist/fonts/noto-sans-tc-90-400-normal.woff2 +0 -0
  826. package/dist/fonts/noto-sans-tc-90-500-normal.woff2 +0 -0
  827. package/dist/fonts/noto-sans-tc-90-600-normal.woff2 +0 -0
  828. package/dist/fonts/noto-sans-tc-90-700-normal.woff2 +0 -0
  829. package/dist/fonts/noto-sans-tc-91-400-normal.woff2 +0 -0
  830. package/dist/fonts/noto-sans-tc-91-500-normal.woff2 +0 -0
  831. package/dist/fonts/noto-sans-tc-91-600-normal.woff2 +0 -0
  832. package/dist/fonts/noto-sans-tc-91-700-normal.woff2 +0 -0
  833. package/dist/fonts/noto-sans-tc-92-400-normal.woff2 +0 -0
  834. package/dist/fonts/noto-sans-tc-92-500-normal.woff2 +0 -0
  835. package/dist/fonts/noto-sans-tc-92-600-normal.woff2 +0 -0
  836. package/dist/fonts/noto-sans-tc-92-700-normal.woff2 +0 -0
  837. package/dist/fonts/noto-sans-tc-93-400-normal.woff2 +0 -0
  838. package/dist/fonts/noto-sans-tc-93-500-normal.woff2 +0 -0
  839. package/dist/fonts/noto-sans-tc-93-600-normal.woff2 +0 -0
  840. package/dist/fonts/noto-sans-tc-93-700-normal.woff2 +0 -0
  841. package/dist/fonts/noto-sans-tc-94-400-normal.woff2 +0 -0
  842. package/dist/fonts/noto-sans-tc-94-500-normal.woff2 +0 -0
  843. package/dist/fonts/noto-sans-tc-94-600-normal.woff2 +0 -0
  844. package/dist/fonts/noto-sans-tc-94-700-normal.woff2 +0 -0
  845. package/dist/fonts/noto-sans-tc-95-400-normal.woff2 +0 -0
  846. package/dist/fonts/noto-sans-tc-95-500-normal.woff2 +0 -0
  847. package/dist/fonts/noto-sans-tc-95-600-normal.woff2 +0 -0
  848. package/dist/fonts/noto-sans-tc-95-700-normal.woff2 +0 -0
  849. package/dist/fonts/noto-sans-tc-96-400-normal.woff2 +0 -0
  850. package/dist/fonts/noto-sans-tc-96-500-normal.woff2 +0 -0
  851. package/dist/fonts/noto-sans-tc-96-600-normal.woff2 +0 -0
  852. package/dist/fonts/noto-sans-tc-96-700-normal.woff2 +0 -0
  853. package/dist/fonts/noto-sans-tc-cyrillic-400-normal.woff2 +0 -0
  854. package/dist/fonts/noto-sans-tc-cyrillic-500-normal.woff2 +0 -0
  855. package/dist/fonts/noto-sans-tc-cyrillic-600-normal.woff2 +0 -0
  856. package/dist/fonts/noto-sans-tc-cyrillic-700-normal.woff2 +0 -0
  857. package/dist/fonts/noto-sans-tc-latin-400-normal.woff2 +0 -0
  858. package/dist/fonts/noto-sans-tc-latin-500-normal.woff2 +0 -0
  859. package/dist/fonts/noto-sans-tc-latin-600-normal.woff2 +0 -0
  860. package/dist/fonts/noto-sans-tc-latin-700-normal.woff2 +0 -0
  861. package/dist/fonts/noto-sans-tc-latin-ext-400-normal.woff2 +0 -0
  862. package/dist/fonts/noto-sans-tc-latin-ext-500-normal.woff2 +0 -0
  863. package/dist/fonts/noto-sans-tc-latin-ext-600-normal.woff2 +0 -0
  864. package/dist/fonts/noto-sans-tc-latin-ext-700-normal.woff2 +0 -0
  865. package/dist/fonts/noto-sans-tc-vietnamese-400-normal.woff2 +0 -0
  866. package/dist/fonts/noto-sans-tc-vietnamese-500-normal.woff2 +0 -0
  867. package/dist/fonts/noto-sans-tc-vietnamese-600-normal.woff2 +0 -0
  868. package/dist/fonts/noto-sans-tc-vietnamese-700-normal.woff2 +0 -0
@@ -37,7 +37,31 @@ function useReturnFocus(open) {
37
37
  wasOpen.current = open;
38
38
  }, [open]);
39
39
  }
40
- const FOCUSABLE = "button:not([disabled]), a[href], [tabindex]:not([tabindex=\"-1\"]), input:not([disabled]), [role=\"tab\"]";
40
+ const FOCUSABLE = "button:not([disabled]), a[href], [tabindex]:not([tabindex=\"-1\"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [role=\"tab\"]";
41
+ /** The focusable controls inside box that a person can reach now: visible and enabled. */
42
+ const reachable = (box) => Array.from(box.querySelectorAll(FOCUSABLE)).filter((e) => e.getClientRects().length > 0 && !e.matches(":disabled"));
43
+ /** The group a control belongs to, for picking a neighbour: its toolbar, group, form, section, card or dialog. */
44
+ const GROUP = "[role=\"toolbar\"], [role=\"group\"], [role=\"radiogroup\"], form, section, fieldset, [role=\"dialog\"], [role=\"alertdialog\"], main";
45
+ /** Moves focus from a control that is about to lose it (disabled or removed) to a sensible neighbour: the control
46
+ * before it in its group, else the one after it, else the main content. Returns the element that got focus. */
47
+ function focusNeighbour(from) {
48
+ const scope = from.parentElement?.closest(GROUP) ?? document.body;
49
+ const all = reachable(scope).filter((e) => e !== from);
50
+ const before = all.filter((e) => e.compareDocumentPosition(from) & Node.DOCUMENT_POSITION_FOLLOWING).pop();
51
+ const after = all.find((e) => e.compareDocumentPosition(from) & Node.DOCUMENT_POSITION_PRECEDING);
52
+ const next = before ?? after ?? null;
53
+ if (next) next.focus();
54
+ else focusMain();
55
+ return next;
56
+ }
57
+ /** For one control that can turn disabled while it has focus (a button that is pressed and then disabled): the
58
+ * browser would drop focus to the body, so it goes to the neighbour before it (focusNeighbour) instead. */
59
+ function useDisabledFocusRescue(ref, disabled) {
60
+ React.useLayoutEffect(() => {
61
+ const el = ref.current;
62
+ if (disabled && el && document.activeElement === el) focusNeighbour(el);
63
+ }, [disabled, ref]);
64
+ }
41
65
  /** When the focused control inside the container is removed or replaced (a button that turns into another), focus
42
66
  * moves to the control now at its place, else the one before it, else `fallback()`, instead of falling to the body. */
43
67
  function useFocusRescue(ref, fallback) {
@@ -50,7 +74,7 @@ function useFocusRescue(ref, fallback) {
50
74
  if (!box) return;
51
75
  let last = null;
52
76
  let index = -1;
53
- const list = () => Array.from(box.querySelectorAll(FOCUSABLE)).filter((e) => e.getClientRects().length > 0 && !e.matches(":disabled"));
77
+ const list = () => reachable(box);
54
78
  const onIn = (e) => {
55
79
  if (!(e.target instanceof HTMLElement)) return;
56
80
  last = e.target;
@@ -89,6 +113,6 @@ function useFocusRescue(ref, fallback) {
89
113
  };
90
114
  }, [ref]);
91
115
  }
92
- export { useFocusRescue, useReturnFocus };
116
+ export { focusNeighbour, useDisabledFocusRescue, useFocusRescue, useReturnFocus };
93
117
 
94
118
  //# sourceMappingURL=focus.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"focus.js","names":[],"sources":["../../src/internal/focus.tsx"],"sourcesContent":["import * as React from 'react';\nimport { focusMain } from './focusMain';\n\n/** True when focus has fallen out of the page's content: nothing focused, or the body. */\nconst lost = () => !document.activeElement || document.activeElement === document.body;\n\n/** For a dialog-like overlay opened by the open prop: remembers what had focus when it opened and gives focus back\n * when it closes. When that element is gone (the app changed page), focus goes to the main content. */\nexport function useReturnFocus(open: boolean): void {\n const opener = React.useRef<HTMLElement | null>(null);\n const wasOpen = React.useRef(false);\n React.useEffect(() => {\n if (open && !wasOpen.current) {\n const a = document.activeElement;\n opener.current = a instanceof HTMLElement && a !== document.body ? a : null;\n }\n if (!open && wasOpen.current) {\n const back = opener.current;\n opener.current = null;\n // The overlay is removed only after its closing animation, and focus falls to the page then, not now: look every\n // frame (for 2 s at most) while focus stays where it was or inside a closing overlay. Fallen to the page: back to\n // the opener, else to the main content. Moved somewhere that stays (the overlay gave it back, or the app moved\n // it): left there.\n const held = document.activeElement;\n const until = performance.now() + 2000;\n let frame = 0;\n const look = () => {\n if (lost()) {\n if (back?.isConnected) back.focus();\n else focusMain();\n return;\n }\n // Still where it was, or on something in an overlay that is closing (both about to go): keep looking.\n const at = document.activeElement;\n const going = at === held || !!at?.closest('[data-ending-style]');\n if (!going || performance.now() > until) return;\n frame = requestAnimationFrame(look);\n };\n frame = requestAnimationFrame(look);\n wasOpen.current = open;\n return () => cancelAnimationFrame(frame);\n }\n wasOpen.current = open;\n }, [open]);\n}\n\nconst FOCUSABLE = 'button:not([disabled]), a[href], [tabindex]:not([tabindex=\"-1\"]), input:not([disabled]), [role=\"tab\"]';\n\n/** When the focused control inside the container is removed or replaced (a button that turns into another), focus\n * moves to the control now at its place, else the one before it, else `fallback()`, instead of falling to the body. */\nexport function useFocusRescue(ref: React.RefObject<HTMLElement | null>, fallback?: () => HTMLElement | null | undefined): void {\n const fb = React.useRef(fallback);\n React.useEffect(() => {\n fb.current = fallback;\n });\n React.useEffect(() => {\n const box = ref.current;\n if (!box) return;\n let last: HTMLElement | null = null;\n let index = -1;\n const list = () => Array.from(box.querySelectorAll<HTMLElement>(FOCUSABLE)).filter((e) => e.getClientRects().length > 0 && !e.matches(':disabled'));\n const onIn = (e: FocusEvent) => {\n if (!(e.target instanceof HTMLElement)) return;\n last = e.target;\n // The same list rescue() picks from (visible, enabled), so the index means the same place.\n index = list().indexOf(last);\n };\n const rescue = () => {\n const now = list();\n const next = fb.current?.() ?? now[Math.min(index, now.length - 1)] ?? null;\n last = null;\n if (next) next.focus();\n else focusMain();\n };\n let frame = 0;\n const mo = new MutationObserver(() => {\n // Gone, or still there but disabled (a disabled control drops focus too).\n if (!last || (last.isConnected && !last.matches(':disabled'))) return;\n if (lost()) return rescue();\n // The browser moves focus off a control it just disabled at its next rendering update, not at once: look again\n // then. Rescue when focus fell to the page, or still sits on the dead control; not when it went somewhere else.\n const dead = last;\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(() => {\n frame = requestAnimationFrame(() => {\n if (last === dead && (lost() || document.activeElement === dead)) rescue();\n });\n });\n });\n box.addEventListener('focusin', onIn);\n mo.observe(box, { childList: true, subtree: true, attributes: true, attributeFilter: ['disabled'] });\n return () => {\n box.removeEventListener('focusin', onIn);\n mo.disconnect();\n cancelAnimationFrame(frame);\n };\n }, [ref]);\n}\n"],"mappings":";;;;;AAIA,MAAM,aAAa,CAAC,SAAS,iBAAiB,SAAS,kBAAkB,SAAS;;;AAIlF,SAAgB,eAAe,MAAqB;CAClD,MAAM,SAAS,MAAM,OAA2B,IAAI;CACpD,MAAM,UAAU,MAAM,OAAO,KAAK;CAClC,MAAM,gBAAgB;EACpB,IA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AAK;GACjB,MAAM,OAAO,GAAG,UAAU,KAAK,IAAI,KAAK,IAAI,OAAO,IAAI,SAAS,CAAC,MAAM;GACvE,OAAO;GACP,IAAI,MAAM,KAAK,MAAM;QAChB,UAAU;EACjB;EACA,IAAI,QAAQ;EACZ,MAAM,KAAK,IAAI,uBAAuB;GAEpC,IAAI,CAAC,QAAS,KAAK,eAAe,CAAC,KAAK,QAAQ,WAAW,GAAI;GAC/D,IAAI,KAAK,GAAG,OAAO,OAAO;GAG1B,MAAM,OAAO;GACb,qBAAqB,KAAK;GAC1B,QAAQ,4BAA4B;IAClC,QAAQ,4BAA4B;KAClC,IAAI,SAAS,SAAS,KAAK,KAAK,SAAS,kBAAkB,OAAO,OAAO;IAC3E,CAAC;GACH,CAAC;EACH,CAAC;EACD,IAAI,iBAAiB,WAAW,IAAI;EACpC,GAAG,QAAQ,KAAK;GAAE,WAAW;GAAM,SAAS;GAAM,YAAY;GAAM,iBAAiB,CAAC,UAAU;EAAE,CAAC;EACnG,aAAa;GACX,IAAI,oBAAoB,WAAW,IAAI;GACvC,GAAG,WAAW;GACd,qBAAqB,KAAK;EAC5B;CACF,GAAG,CAAC,GAAG,CAAC;AACV"}
1
+ {"version":3,"file":"focus.js","names":[],"sources":["../../src/internal/focus.tsx"],"sourcesContent":["import * as React from 'react';\nimport { focusMain } from './focusMain';\n\n/** True when focus has fallen out of the page's content: nothing focused, or the body. */\nconst lost = () => !document.activeElement || document.activeElement === document.body;\n\n/** For a dialog-like overlay opened by the open prop: remembers what had focus when it opened and gives focus back\n * when it closes. When that element is gone (the app changed page), focus goes to the main content. */\nexport function useReturnFocus(open: boolean): void {\n const opener = React.useRef<HTMLElement | null>(null);\n const wasOpen = React.useRef(false);\n React.useEffect(() => {\n if (open && !wasOpen.current) {\n const a = document.activeElement;\n opener.current = a instanceof HTMLElement && a !== document.body ? a : null;\n }\n if (!open && wasOpen.current) {\n const back = opener.current;\n opener.current = null;\n // The overlay is removed only after its closing animation, and focus falls to the page then, not now: look every\n // frame (for 2 s at most) while focus stays where it was or inside a closing overlay. Fallen to the page: back to\n // the opener, else to the main content. Moved somewhere that stays (the overlay gave it back, or the app moved\n // it): left there.\n const held = document.activeElement;\n const until = performance.now() + 2000;\n let frame = 0;\n const look = () => {\n if (lost()) {\n if (back?.isConnected) back.focus();\n else focusMain();\n return;\n }\n // Still where it was, or on something in an overlay that is closing (both about to go): keep looking.\n const at = document.activeElement;\n const going = at === held || !!at?.closest('[data-ending-style]');\n if (!going || performance.now() > until) return;\n frame = requestAnimationFrame(look);\n };\n frame = requestAnimationFrame(look);\n wasOpen.current = open;\n return () => cancelAnimationFrame(frame);\n }\n wasOpen.current = open;\n }, [open]);\n}\n\nconst FOCUSABLE =\n 'button:not([disabled]), a[href], [tabindex]:not([tabindex=\"-1\"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [role=\"tab\"]';\n\n/** The focusable controls inside box that a person can reach now: visible and enabled. */\nconst reachable = (box: ParentNode) =>\n Array.from(box.querySelectorAll<HTMLElement>(FOCUSABLE)).filter((e) => e.getClientRects().length > 0 && !e.matches(':disabled'));\n\n/** The group a control belongs to, for picking a neighbour: its toolbar, group, form, section, card or dialog. */\nconst GROUP = '[role=\"toolbar\"], [role=\"group\"], [role=\"radiogroup\"], form, section, fieldset, [role=\"dialog\"], [role=\"alertdialog\"], main';\n\n/** Moves focus from a control that is about to lose it (disabled or removed) to a sensible neighbour: the control\n * before it in its group, else the one after it, else the main content. Returns the element that got focus. */\nexport function focusNeighbour(from: HTMLElement): HTMLElement | null {\n const scope = from.parentElement?.closest<HTMLElement>(GROUP) ?? document.body;\n // By document position: the control itself may no longer match (it is disabled now).\n const all = reachable(scope).filter((e) => e !== from);\n const before = all.filter((e) => e.compareDocumentPosition(from) & Node.DOCUMENT_POSITION_FOLLOWING).pop();\n const after = all.find((e) => e.compareDocumentPosition(from) & Node.DOCUMENT_POSITION_PRECEDING);\n const next = before ?? after ?? null;\n if (next) next.focus();\n else focusMain();\n return next;\n}\n\n/** For one control that can turn disabled while it has focus (a button that is pressed and then disabled): the\n * browser would drop focus to the body, so it goes to the neighbour before it (focusNeighbour) instead. */\nexport function useDisabledFocusRescue(ref: React.RefObject<HTMLElement | null>, disabled: boolean | undefined): void {\n React.useLayoutEffect(() => {\n const el = ref.current;\n // The browser drops focus from a disabled control at its next rendering update, not at once: it is still here.\n if (disabled && el && document.activeElement === el) focusNeighbour(el);\n }, [disabled, ref]);\n}\n\n/** When the focused control inside the container is removed or replaced (a button that turns into another), focus\n * moves to the control now at its place, else the one before it, else `fallback()`, instead of falling to the body. */\nexport function useFocusRescue(ref: React.RefObject<HTMLElement | null>, fallback?: () => HTMLElement | null | undefined): void {\n const fb = React.useRef(fallback);\n React.useEffect(() => {\n fb.current = fallback;\n });\n React.useEffect(() => {\n const box = ref.current;\n if (!box) return;\n let last: HTMLElement | null = null;\n let index = -1;\n const list = () => reachable(box);\n const onIn = (e: FocusEvent) => {\n if (!(e.target instanceof HTMLElement)) return;\n last = e.target;\n // The same list rescue() picks from (visible, enabled), so the index means the same place.\n index = list().indexOf(last);\n };\n const rescue = () => {\n const now = list();\n const next = fb.current?.() ?? now[Math.min(index, now.length - 1)] ?? null;\n last = null;\n if (next) next.focus();\n else focusMain();\n };\n let frame = 0;\n const mo = new MutationObserver(() => {\n // Gone, or still there but disabled (a disabled control drops focus too).\n if (!last || (last.isConnected && !last.matches(':disabled'))) return;\n if (lost()) return rescue();\n // The browser moves focus off a control it just disabled at its next rendering update, not at once: look again\n // then. Rescue when focus fell to the page, or still sits on the dead control; not when it went somewhere else.\n const dead = last;\n cancelAnimationFrame(frame);\n frame = requestAnimationFrame(() => {\n frame = requestAnimationFrame(() => {\n if (last === dead && (lost() || document.activeElement === dead)) rescue();\n });\n });\n });\n box.addEventListener('focusin', onIn);\n mo.observe(box, { childList: true, subtree: true, attributes: true, attributeFilter: ['disabled'] });\n return () => {\n box.removeEventListener('focusin', onIn);\n mo.disconnect();\n cancelAnimationFrame(frame);\n };\n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4BAA4B;IAClC,QAAQ,4BAA4B;KAClC,IAAI,SAAS,SAAS,KAAK,KAAK,SAAS,kBAAkB,OAAO,OAAO;IAC3E,CAAC;GACH,CAAC;EACH,CAAC;EACD,IAAI,iBAAiB,WAAW,IAAI;EACpC,GAAG,QAAQ,KAAK;GAAE,WAAW;GAAM,SAAS;GAAM,YAAY;GAAM,iBAAiB,CAAC,UAAU;EAAE,CAAC;EACnG,aAAa;GACX,IAAI,oBAAoB,WAAW,IAAI;GACvC,GAAG,WAAW;GACd,qBAAqB,KAAK;EAC5B;CACF,GAAG,CAAC,GAAG,CAAC;AACV"}
@@ -1,7 +1,11 @@
1
1
  "use client";
2
2
  // src/internal/focusMain.ts
3
3
  let lastInput = "pointer";
4
- if (typeof document !== "undefined") {
4
+ let installed = false;
5
+ /** Starts following the last kind of input on the document; safe to call more than once. */
6
+ function installFocusMain() {
7
+ if (installed || typeof document === "undefined") return;
8
+ installed = true;
5
9
  document.addEventListener("keydown", () => lastInput = "key", true);
6
10
  document.addEventListener("pointerdown", () => lastInput = "pointer", true);
7
11
  }
@@ -17,6 +21,6 @@ function focusMain() {
17
21
  target.setAttribute("data-ui-main-focus", lastInput);
18
22
  target.focus({ preventScroll: false });
19
23
  }
20
- export { focusMain };
24
+ export { focusMain, installFocusMain };
21
25
 
22
26
  //# sourceMappingURL=focusMain.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"focusMain.js","names":[],"sources":["../../src/internal/focusMain.ts"],"sourcesContent":["// How the person last acted: a key, or a pointer (mouse, pen, touch). The heading focusMain() moves to shows a bar on\n// its left only after a key: someone who changed page with a mouse sees no change.\nlet lastInput: 'key' | 'pointer' = 'pointer';\nif (typeof document !== 'undefined') {\n document.addEventListener('keydown', () => (lastInput = 'key'), true);\n document.addEventListener('pointerdown', () => (lastInput = 'pointer'), true);\n}\n\n/** Moves keyboard and screen-reader focus to the page's content: its first heading inside main (or the top bar's title),\n * else main itself. Call it after the app changes page, e.g. when a CommandPalette result opens another page. The\n * heading gets no focus ring: a 3 px accent bar on its left after a key press, nothing after a mouse or touch. */\nexport function focusMain(): void {\n if (typeof document === 'undefined') return;\n const main = document.querySelector<HTMLElement>('main');\n const target = main?.querySelector<HTMLElement>('h1, h2') ?? document.querySelector<HTMLElement>('.ui-topbar-title') ?? main;\n if (!target) return;\n if (target.tabIndex < 0 && !target.hasAttribute('tabindex')) target.setAttribute('tabindex', '-1');\n target.setAttribute('data-ui-main-focus', lastInput);\n target.focus({ preventScroll: false });\n}\n"],"mappings":";;AAEA,IAAI,YAA+B;AACnC,IAAI,OAAO,aAAa,aAAa;CACnC,SAAS,iBAAiB,iBAAkB,YAAY,OAAQ,IAAI;CACpE,SAAS,iBAAiB,qBAAsB,YAAY,WAAY,IAAI;AAC9E;;;;AAKA,SAAgB,YAAkB;CAChC,IAAI,OAAO,aAAa,aAAa;CACrC,MAAM,OAAO,SAAS,cAA2B,MAAM;CACvD,MAAM,SAAS,MAAM,cAA2B,QAAQ,KAAK,SAAS,cAA2B,kBAAkB,KAAK;CACxH,IAAI,CAAC,QAAQ;CACb,IAAI,OAAO,WAAW,KAAK,CAAC,OAAO,aAAa,UAAU,GAAG,OAAO,aAAa,YAAY,IAAI;CACjG,OAAO,aAAa,sBAAsB,SAAS;CACnD,OAAO,MAAM,EAAE,eAAe,MAAM,CAAC;AACvC"}
1
+ {"version":3,"file":"focusMain.js","names":[],"sources":["../../src/internal/focusMain.ts"],"sourcesContent":["// How the person last acted: a key, or a pointer (mouse, pen, touch). The heading focusMain() moves to shows a bar on\n// its left only after a key: someone who changed page with a mouse sees no change.\n// Followed only after installFocusMain() (AppShell and initTheme call it): importing the module has no side effect.\nlet lastInput: 'key' | 'pointer' = 'pointer';\nlet installed = false;\n\n/** Starts following the last kind of input on the document; safe to call more than once. */\nexport function installFocusMain(): void {\n if (installed || typeof document === 'undefined') return;\n installed = true;\n document.addEventListener('keydown', () => (lastInput = 'key'), true);\n document.addEventListener('pointerdown', () => (lastInput = 'pointer'), true);\n}\n\n/** Moves keyboard and screen-reader focus to the page's content: its first heading inside main (or the top bar's title),\n * else main itself. Call it after the app changes page, e.g. when a CommandPalette result opens another page. The\n * heading gets no focus ring: a 3 px accent bar on its left after a key press, nothing after a mouse or touch. */\nexport function focusMain(): void {\n if (typeof document === 'undefined') return;\n const main = document.querySelector<HTMLElement>('main');\n const target = main?.querySelector<HTMLElement>('h1, h2') ?? document.querySelector<HTMLElement>('.ui-topbar-title') ?? main;\n if (!target) return;\n if (target.tabIndex < 0 && !target.hasAttribute('tabindex')) target.setAttribute('tabindex', '-1');\n target.setAttribute('data-ui-main-focus', lastInput);\n target.focus({ preventScroll: false });\n}\n"],"mappings":";;AAGA,IAAI,YAA+B;AACnC,IAAI,YAAY;;AAGhB,SAAgB,mBAAyB;CACvC,IAAI,aAAa,OAAO,aAAa,aAAa;CAClD,YAAY;CACZ,SAAS,iBAAiB,iBAAkB,YAAY,OAAQ,IAAI;CACpE,SAAS,iBAAiB,qBAAsB,YAAY,WAAY,IAAI;AAC9E;;;;AAKA,SAAgB,YAAkB;CAChC,IAAI,OAAO,aAAa,aAAa;CACrC,MAAM,OAAO,SAAS,cAA2B,MAAM;CACvD,MAAM,SAAS,MAAM,cAA2B,QAAQ,KAAK,SAAS,cAA2B,kBAAkB,KAAK;CACxH,IAAI,CAAC,QAAQ;CACb,IAAI,OAAO,WAAW,KAAK,CAAC,OAAO,aAAa,UAAU,GAAG,OAAO,aAAa,YAAY,IAAI;CACjG,OAAO,aAAa,sBAAsB,SAAS;CACnD,OAAO,MAAM,EAAE,eAAe,MAAM,CAAC;AACvC"}
@@ -0,0 +1,14 @@
1
+ /** Why an overlay opened or closed, passed as onOpenChange's second argument.
2
+ * trigger: its button was pressed (or hovered); escape: Esc; outside: a press outside it; close: its × or close
3
+ * button; cancel: its cancel button; confirm: its confirming button; select: an item was chosen; hotkey: a keyboard
4
+ * shortcut (Ctrl K); done / skip: a Tour was finished or skipped; other: anything else (focus moved away, the app). */
5
+ export type OpenChangeReason = 'trigger' | 'escape' | 'outside' | 'close' | 'cancel' | 'confirm' | 'select' | 'hotkey' | 'done' | 'skip' | 'other';
6
+ /** The open-state props every overlay takes: controlled with open, uncontrolled with defaultOpen. */
7
+ export interface OpenStateProps {
8
+ /** Controlled: shown while true. Leave it out (and use defaultOpen) to let the component keep its own state. */
9
+ open?: boolean;
10
+ /** Uncontrolled: whether it starts open. Default false. */
11
+ defaultOpen?: boolean;
12
+ /** Called with the new state and why it changed (Esc, a press outside, the close button…). */
13
+ onOpenChange?: (open: boolean, reason?: OpenChangeReason) => void;
14
+ }
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ // src/internal/open.ts
4
+ /** Maps Base UI's change reasons to OpenChangeReason. */
5
+ function baseReason(reason) {
6
+ switch (reason) {
7
+ case "trigger-press":
8
+ case "trigger-hover":
9
+ case "trigger-focus": return "trigger";
10
+ case "escape-key": return "escape";
11
+ case "outside-press": return "outside";
12
+ case "close-press": return "close";
13
+ case "item-press": return "select";
14
+ default: return "other";
15
+ }
16
+ }
17
+ /** open / defaultOpen / onOpenChange in one place: returns the current state and the setter to call with a reason. */
18
+ function useOpenState({ open, defaultOpen, onOpenChange }) {
19
+ const [own, setOwn] = React.useState(!!defaultOpen);
20
+ const controlled = open !== void 0;
21
+ return [controlled ? open : own, React.useCallback((next, reason) => {
22
+ if (!controlled) setOwn(next);
23
+ onOpenChange?.(next, reason);
24
+ }, [controlled, onOpenChange])];
25
+ }
26
+ export { baseReason, useOpenState };
27
+
28
+ //# sourceMappingURL=open.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open.js","names":[],"sources":["../../src/internal/open.ts"],"sourcesContent":["import * as React from 'react';\n\n/** Why an overlay opened or closed, passed as onOpenChange's second argument.\n * trigger: its button was pressed (or hovered); escape: Esc; outside: a press outside it; close: its × or close\n * button; cancel: its cancel button; confirm: its confirming button; select: an item was chosen; hotkey: a keyboard\n * shortcut (Ctrl K); done / skip: a Tour was finished or skipped; other: anything else (focus moved away, the app). */\nexport type OpenChangeReason = 'trigger' | 'escape' | 'outside' | 'close' | 'cancel' | 'confirm' | 'select' | 'hotkey' | 'done' | 'skip' | 'other';\n\n/** The open-state props every overlay takes: controlled with open, uncontrolled with defaultOpen. */\nexport interface OpenStateProps {\n /** Controlled: shown while true. Leave it out (and use defaultOpen) to let the component keep its own state. */\n open?: boolean;\n /** Uncontrolled: whether it starts open. Default false. */\n defaultOpen?: boolean;\n /** Called with the new state and why it changed (Esc, a press outside, the close button…). */\n onOpenChange?: (open: boolean, reason?: OpenChangeReason) => void;\n}\n\n/** Maps Base UI's change reasons to OpenChangeReason. */\nexport function baseReason(reason: string | undefined): OpenChangeReason {\n switch (reason) {\n case 'trigger-press':\n case 'trigger-hover':\n case 'trigger-focus':\n return 'trigger';\n case 'escape-key':\n return 'escape';\n case 'outside-press':\n return 'outside';\n case 'close-press':\n return 'close';\n case 'item-press':\n return 'select';\n default:\n return 'other';\n }\n}\n\n/** open / defaultOpen / onOpenChange in one place: returns the current state and the setter to call with a reason. */\nexport function useOpenState({ open, defaultOpen, onOpenChange }: OpenStateProps): [boolean, (next: boolean, reason?: OpenChangeReason) => void] {\n const [own, setOwn] = React.useState(!!defaultOpen);\n const controlled = open !== undefined;\n const cur = controlled ? open : own;\n const set = React.useCallback(\n (next: boolean, reason?: OpenChangeReason) => {\n if (!controlled) setOwn(next);\n onOpenChange?.(next, reason);\n },\n [controlled, onOpenChange],\n );\n return [cur, set];\n}\n"],"mappings":";;;;AAmBA,SAAgB,WAAW,QAA8C;CACvE,QAAQ,QAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK,iBACH,OAAO;EACT,KAAK,cACH,OAAO;EACT,KAAK,iBACH,OAAO;EACT,KAAK,eACH,OAAO;EACT,KAAK,cACH,OAAO;EACT,SACE,OAAO;CACX;AACF;;AAGA,SAAgB,aAAa,EAAE,MAAM,aAAa,gBAA+F;CAC/I,MAAM,CAAC,KAAK,UAAU,MAAM,SAAS,CAAC,CAAC,WAAW;CAClD,MAAM,aAAa,SAAS,KAAA;CAS5B,OAAO,CARK,aAAa,OAAO,KACpB,MAAM,aACf,MAAe,WAA8B;EAC5C,IAAI,CAAC,YAAY,OAAO,IAAI;EAC5B,eAAe,MAAM,MAAM;CAC7B,GACA,CAAC,YAAY,YAAY,CAEZ,CAAC;AAClB"}
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import { browserKey } from "./util.js";
3
+ import * as React from "react";
4
+ // src/internal/roving.ts
5
+ /** The keyboard of a radio group (RadioGroup, SegmentedControl, ThemePicker, AccentPicker): one Tab stop, the arrow
6
+ * keys move to the next or previous option and pick it, wrapping at the ends and passing over disabled options.
7
+ * Returns a ref setter and a keydown handler per option index. */
8
+ function useRovingRadio(n, onPick, enabled) {
9
+ const refs = React.useRef([]);
10
+ const pick = React.useRef(onPick);
11
+ const ok = React.useRef(enabled);
12
+ React.useEffect(() => {
13
+ pick.current = onPick;
14
+ ok.current = enabled;
15
+ });
16
+ return {
17
+ ref: React.useCallback((i) => (el) => {
18
+ refs.current[i] = el;
19
+ }, []),
20
+ onKeyDown: React.useCallback((i) => (e) => {
21
+ if (browserKey(e)) return;
22
+ const dir = e.key === "ArrowRight" || e.key === "ArrowDown" ? 1 : e.key === "ArrowLeft" || e.key === "ArrowUp" ? -1 : 0;
23
+ if (!dir) return;
24
+ e.preventDefault();
25
+ for (let k = 1; k <= n; k++) {
26
+ const to = (i + dir * k + n * k) % n;
27
+ if (ok.current && !ok.current(to)) continue;
28
+ refs.current[to]?.focus();
29
+ pick.current(to);
30
+ return;
31
+ }
32
+ }, [n])
33
+ };
34
+ }
35
+ export { useRovingRadio };
36
+
37
+ //# sourceMappingURL=roving.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roving.js","names":[],"sources":["../../src/internal/roving.ts"],"sourcesContent":["import * as React from 'react';\nimport { browserKey } from './util';\n\n/** The keyboard of a radio group (RadioGroup, SegmentedControl, ThemePicker, AccentPicker): one Tab stop, the arrow\n * keys move to the next or previous option and pick it, wrapping at the ends and passing over disabled options.\n * Returns a ref setter and a keydown handler per option index. */\nexport function useRovingRadio(n: number, onPick: (index: number) => void, enabled?: (index: number) => boolean) {\n const refs = React.useRef<(HTMLElement | null)[]>([]);\n const pick = React.useRef(onPick);\n const ok = React.useRef(enabled);\n React.useEffect(() => {\n pick.current = onPick;\n ok.current = enabled;\n });\n const ref = React.useCallback(\n (i: number) => (el: HTMLElement | null) => {\n refs.current[i] = el;\n },\n [],\n );\n const onKeyDown = React.useCallback(\n (i: number) => (e: React.KeyboardEvent) => {\n if (browserKey(e)) return;\n const dir = e.key === 'ArrowRight' || e.key === 'ArrowDown' ? 1 : e.key === 'ArrowLeft' || e.key === 'ArrowUp' ? -1 : 0;\n if (!dir) return;\n e.preventDefault();\n for (let k = 1; k <= n; k++) {\n const to = (i + dir * k + n * k) % n;\n if (ok.current && !ok.current(to)) continue;\n refs.current[to]?.focus();\n pick.current(to);\n return;\n }\n },\n [n],\n );\n return { ref, onKeyDown };\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,eAAe,GAAW,QAAiC,SAAsC;CAC/G,MAAM,OAAO,MAAM,OAA+B,CAAC,CAAC;CACpD,MAAM,OAAO,MAAM,OAAO,MAAM;CAChC,MAAM,KAAK,MAAM,OAAO,OAAO;CAC/B,MAAM,gBAAgB;EACpB,KAAK,UAAU;EACf,GAAG,UAAU;CACf,CAAC;CAuBD,OAAO;EAAE,KAtBG,MAAM,aACf,OAAe,OAA2B;GACzC,KAAK,QAAQ,KAAK;EACpB,GACA,CAAC,CAkBQ;EAAG,WAhBI,MAAM,aACrB,OAAe,MAA2B;GACzC,IAAI,WAAW,CAAC,GAAG;GACnB,MAAM,MAAM,EAAE,QAAQ,gBAAgB,EAAE,QAAQ,cAAc,IAAI,EAAE,QAAQ,eAAe,EAAE,QAAQ,YAAY,KAAK;GACtH,IAAI,CAAC,KAAK;GACV,EAAE,eAAe;GACjB,KAAK,IAAI,IAAI,GAAG,KAAK,GAAG,KAAK;IAC3B,MAAM,MAAM,IAAI,MAAM,IAAI,IAAI,KAAK;IACnC,IAAI,GAAG,WAAW,CAAC,GAAG,QAAQ,EAAE,GAAG;IACnC,KAAK,QAAQ,GAAG,EAAE,MAAM;IACxB,KAAK,QAAQ,EAAE;IACf;GACF;EACF,GACA,CAAC,CAAC,CAEkB;CAAE;AAC1B"}
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ // src/internal/shell.ts
4
+ /** Set by AppShell: whether its top bar shows the page title. A page heading inside (PageHeader, SettingsLayout)
5
+ * warns when it would show a second title. */
6
+ const ShellTitle = React.createContext({
7
+ inShell: false,
8
+ title: false
9
+ });
10
+ export { ShellTitle };
11
+
12
+ //# sourceMappingURL=shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.js","names":[],"sources":["../../src/internal/shell.ts"],"sourcesContent":["import * as React from 'react';\n\n/** Set by AppShell: whether its top bar shows the page title. A page heading inside (PageHeader, SettingsLayout)\n * warns when it would show a second title. */\nexport const ShellTitle = React.createContext<{ inShell: boolean; title: boolean }>({ inShell: false, title: false });\n"],"mappings":";;;;;AAIA,MAAa,aAAa,MAAM,cAAoD;CAAE,SAAS;CAAO,OAAO;AAAM,CAAC"}
@@ -0,0 +1,89 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ // src/internal/stored.ts
4
+ const listeners = /* @__PURE__ */ new Map();
5
+ const memory = /* @__PURE__ */ new Map();
6
+ let listening = false;
7
+ function notify(key) {
8
+ if (key === null) {
9
+ for (const set of listeners.values()) for (const f of set) f();
10
+ return;
11
+ }
12
+ listeners.get(key)?.forEach((f) => f());
13
+ }
14
+ function subscribe(key, f) {
15
+ let set = listeners.get(key);
16
+ if (!set) listeners.set(key, set = /* @__PURE__ */ new Set());
17
+ set.add(f);
18
+ if (!listening && typeof window !== "undefined") {
19
+ listening = true;
20
+ window.addEventListener("storage", (e) => notify(e.key));
21
+ }
22
+ return () => {
23
+ set.delete(f);
24
+ if (!set.size) listeners.delete(key);
25
+ };
26
+ }
27
+ /** The stored text for a key, or null; after a write that failed, the value kept in memory for this page. */
28
+ function readStored(key) {
29
+ const kept = memory.get(key);
30
+ let now;
31
+ try {
32
+ now = localStorage.getItem(key);
33
+ } catch {
34
+ return kept ? kept.raw : null;
35
+ }
36
+ if (!kept) return now;
37
+ if (kept.under === now) return kept.raw;
38
+ memory.delete(key);
39
+ return now;
40
+ }
41
+ /** Stores the text (null removes it) and tells every component that reads the key. */
42
+ function writeStored(key, raw) {
43
+ try {
44
+ if (raw === null) localStorage.removeItem(key);
45
+ else localStorage.setItem(key, raw);
46
+ memory.delete(key);
47
+ } catch {
48
+ let under;
49
+ try {
50
+ under = localStorage.getItem(key);
51
+ } catch {
52
+ under = void 0;
53
+ }
54
+ memory.set(key, {
55
+ raw,
56
+ under
57
+ });
58
+ }
59
+ notify(key);
60
+ }
61
+ const serverNull = () => null;
62
+ /** A value stored in localStorage under key, the same on the server and the first browser render (fallback), then
63
+ * the stored value. parse turns the stored text into the value (throwing gives the fallback); pass a function that
64
+ * stays the same between renders (module level or useCallback). serialize turns a value into text, null to remove
65
+ * it; by default strings as they are, null and undefined removed, anything else as JSON. An undefined key keeps the value in memory only. */
66
+ function useStored(key, parse, fallback, serialize = (v) => v == null ? null : typeof v === "string" ? v : JSON.stringify(v)) {
67
+ const sub = React.useCallback((f) => key ? subscribe(key, f) : () => {}, [key]);
68
+ const snap = React.useCallback(() => key ? readStored(key) : null, [key]);
69
+ const raw = React.useSyncExternalStore(sub, snap, serverNull);
70
+ const [mem, setMem] = React.useState(null);
71
+ const parsed = React.useMemo(() => {
72
+ if (raw === null) return null;
73
+ try {
74
+ return { v: parse(raw) };
75
+ } catch {
76
+ return null;
77
+ }
78
+ }, [raw, parse]);
79
+ const set = React.useCallback((v) => {
80
+ if (key) writeStored(key, serialize(v));
81
+ else setMem({ v });
82
+ }, [key]);
83
+ return [key ? parsed ? parsed.v : fallback : mem ? mem.v : fallback, set];
84
+ }
85
+ /** parse for a stored text kept as it is. */
86
+ const asText = (raw) => raw;
87
+ export { asText, readStored, useStored, writeStored };
88
+
89
+ //# sourceMappingURL=stored.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stored.js","names":[],"sources":["../../src/internal/stored.ts"],"sourcesContent":["import * as React from 'react';\n\n/* A value kept in localStorage that renders the same on the server and on the first render in the browser.\n The server snapshot is the fallback; React then re-renders with the stored value right after hydration, so the\n markup never differs. Other tabs and other components with the same key follow through the `storage` event and an\n in-page notification. Where storage is blocked or full the value is kept in memory for this page instead. */\n\ntype Listener = () => void;\nconst listeners = new Map<string, Set<Listener>>();\n// Values that could not be written (storage blocked or full), with what storage held then (undefined: it could not be\n// read): kept so the change still shows on this page, until storage holds something else (changed by other code).\nconst memory = new Map<string, { raw: string | null; under: string | null | undefined }>();\nlet listening = false;\n\nfunction notify(key: string | null): void {\n if (key === null) {\n for (const set of listeners.values()) for (const f of set) f();\n return;\n }\n listeners.get(key)?.forEach((f) => f());\n}\n\nfunction subscribe(key: string, f: Listener): () => void {\n let set = listeners.get(key);\n if (!set) listeners.set(key, (set = new Set()));\n set.add(f);\n if (!listening && typeof window !== 'undefined') {\n listening = true;\n // Another tab changed the value (key null: that tab cleared all storage).\n window.addEventListener('storage', (e) => notify(e.key));\n }\n return () => {\n set.delete(f);\n if (!set.size) listeners.delete(key);\n };\n}\n\n/** The stored text for a key, or null; after a write that failed, the value kept in memory for this page. */\nexport function readStored(key: string): string | null {\n const kept = memory.get(key);\n let now: string | null;\n try {\n now = localStorage.getItem(key);\n } catch {\n return kept ? kept.raw : null;\n }\n if (!kept) return now;\n if (kept.under === now) return kept.raw;\n // Storage changed since the failed write: it wins.\n memory.delete(key);\n return now;\n}\n\n/** Stores the text (null removes it) and tells every component that reads the key. */\nexport function writeStored(key: string, raw: string | null): void {\n try {\n if (raw === null) localStorage.removeItem(key);\n else localStorage.setItem(key, raw);\n memory.delete(key);\n } catch {\n // Storage blocked or full: it works the same for this page, without remembering.\n let under: string | null | undefined;\n try {\n under = localStorage.getItem(key);\n } catch {\n under = undefined;\n }\n memory.set(key, { raw, under });\n }\n notify(key);\n}\n\nconst serverNull = () => null;\n\n/** A value stored in localStorage under key, the same on the server and the first browser render (fallback), then\n * the stored value. parse turns the stored text into the value (throwing gives the fallback); pass a function that\n * stays the same between renders (module level or useCallback). serialize turns a value into text, null to remove\n * it; by default strings as they are, null and undefined removed, anything else as JSON. An undefined key keeps the value in memory only. */\nexport function useStored<T>(\n key: string | undefined,\n parse: (raw: string) => T,\n fallback: T,\n serialize: (v: T) => string | null = (v) => (v == null ? null : typeof v === 'string' ? v : JSON.stringify(v)),\n): [T, (v: T) => void] {\n const sub = React.useCallback((f: Listener) => (key ? subscribe(key, f) : () => {}), [key]);\n const snap = React.useCallback(() => (key ? readStored(key) : null), [key]);\n const raw = React.useSyncExternalStore(sub, snap, serverNull);\n const [mem, setMem] = React.useState<{ v: T } | null>(null);\n const parsed = React.useMemo(() => {\n if (raw === null) return null;\n try {\n return { v: parse(raw) };\n } catch {\n return null;\n }\n }, [raw, parse]);\n const set = React.useCallback(\n (v: T) => {\n if (key) writeStored(key, serialize(v));\n else setMem({ v });\n },\n // serialize is usually inline: what it does does not change between renders.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [key],\n );\n const value = key ? (parsed ? parsed.v : fallback) : mem ? mem.v : fallback;\n return [value, set];\n}\n\n/** parse for a stored text kept as it is. */\nexport const asText = (raw: string): string => raw;\n"],"mappings":";;;AAQA,MAAM,4BAAY,IAAI,IAA2B;AAGjD,MAAM,yBAAS,IAAI,IAAsE;AACzF,IAAI,YAAY;AAEhB,SAAS,OAAO,KAA0B;CACxC,IAAI,QAAQ,MAAM;EAChB,KAAK,MAAM,OAAO,UAAU,OAAO,GAAG,KAAK,MAAM,KAAK,KAAK,EAAE;EAC7D;CACF;CACA,UAAU,IAAI,GAAG,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;AACxC;AAEA,SAAS,UAAU,KAAa,GAAyB;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,IAAI,MAAO,CAAC,GAAG,CAAC;CAC1E,MAAM,MAAM,MAAM,qBAAqB,KAAK,MAAM,UAAU;CAC5D,MAAM,CAAC,KAAK,UAAU,MAAM,SAA0B,IAAI;CAC1D,MAAM,SAAS,MAAM,cAAc;EACjC,IAAI,QAAQ,MAAM,OAAO;EACzB,IAAI;GACF,OAAO,EAAE,GAAG,MAAM,GAAG,EAAE;EACzB,QAAQ;GACN,OAAO;EACT;CACF,GAAG,CAAC,KAAK,KAAK,CAAC;CACf,MAAM,MAAM,MAAM,aACf,MAAS;EACR,IAAI,KAAK,YAAY,KAAK,UAAU,CAAC,CAAC;OACjC,OAAO,EAAE,EAAE,CAAC;CACnB,GAGA,CAAC,GAAG,CACN;CAEA,OAAO,CADO,MAAO,SAAS,OAAO,IAAI,WAAY,MAAM,IAAI,IAAI,UACpD,GAAG;AACpB;;AAGA,MAAa,UAAU,QAAwB"}
@@ -2,6 +2,7 @@
2
2
  import { tr } from "../i18n.js";
3
3
  import { Dialog } from "../components/Dialog/Dialog.js";
4
4
  import { IconButton } from "../components/IconButton/IconButton.js";
5
+ import { announce } from "../announce.js";
5
6
  import { cx } from "./util.js";
6
7
  import { includeIcons } from "../icons/store.js";
7
8
  import copy_default from "../icons/ph/copy.js";
@@ -11,21 +12,49 @@ import { jsx } from "react/jsx-runtime";
11
12
  // src/internal/tableTools.tsx
12
13
  includeIcons(copy_default, corners_out_default);
13
14
  /** The right border of a header cell, dragged to set the column's width. ← → 16 px, Enter or a double-click back
14
- * to the widths by content. Hidden on touch screens (CSS), where 「放大表格」 shows the whole table instead. */
15
+ * to the widths by content. A click without dragging (one pointer, WCAG 2.5.7) steps the width up: 1.5 times, twice,
16
+ * then back to the width by content. Hidden on touch screens (CSS), where 「放大表格」 shows the whole table instead. */
15
17
  function ColResize(p) {
16
18
  const [on, setOn] = React.useState(false);
17
19
  const from = React.useRef(null);
20
+ const steps = React.useRef(null);
18
21
  const min = p.min ?? 48;
19
22
  const set = (w) => p.onWidth(Math.max(min, Math.round(w)));
20
23
  const drag = (v) => {
21
24
  setOn(v);
22
25
  p.onDragging?.(v);
23
26
  };
27
+ const step = () => {
28
+ const cur = steps.current && Math.abs(steps.current.last - p.width) <= 1 ? steps.current : {
29
+ base: p.start(),
30
+ n: 0,
31
+ last: -1
32
+ };
33
+ const n = cur.n + 1;
34
+ if (n >= STEPS.length + 1) {
35
+ steps.current = null;
36
+ p.onReset();
37
+ announce(tr("已還原「{name}」欄寬", { name: p.name }));
38
+ return;
39
+ }
40
+ const w = Math.max(min, Math.round(cur.base * STEPS[n - 1]));
41
+ steps.current = {
42
+ base: cur.base,
43
+ n,
44
+ last: w
45
+ };
46
+ p.onWidth(w);
47
+ announce(tr("「{name}」欄寬 {n} px", {
48
+ name: p.name,
49
+ n: w
50
+ }));
51
+ };
24
52
  return /* @__PURE__ */ jsx("span", {
25
53
  className: cx("ui-col-resize", on && "is-dragging"),
26
54
  role: "separator",
27
55
  "aria-orientation": "vertical",
28
56
  "aria-label": tr("調整「{name}」欄寬", { name: p.name }),
57
+ "aria-description": tr("拖曳或按 ← → 調整;按一下依序加寬,按 Enter 還原"),
29
58
  "aria-valuenow": Math.round(p.width),
30
59
  "aria-valuemin": min,
31
60
  tabIndex: 0,
@@ -37,16 +66,24 @@ function ColResize(p) {
37
66
  e.currentTarget.setPointerCapture?.(e.pointerId);
38
67
  from.current = {
39
68
  x: e.clientX,
40
- w: p.start()
69
+ w: p.start(),
70
+ moved: false
41
71
  };
42
72
  drag(true);
43
73
  },
44
74
  onPointerMove: (e) => {
45
- if (from.current) set(from.current.w + e.clientX - from.current.x);
75
+ const f = from.current;
76
+ if (!f) return;
77
+ if (!f.moved && Math.abs(e.clientX - f.x) < DRAG_MIN) return;
78
+ f.moved = true;
79
+ steps.current = null;
80
+ set(f.w + e.clientX - f.x);
46
81
  },
47
82
  onPointerUp: () => {
83
+ const clicked = from.current && !from.current.moved;
48
84
  from.current = null;
49
85
  drag(false);
86
+ if (clicked) step();
50
87
  },
51
88
  onPointerCancel: () => {
52
89
  from.current = null;
@@ -54,6 +91,7 @@ function ColResize(p) {
54
91
  },
55
92
  onDoubleClick: (e) => {
56
93
  e.stopPropagation();
94
+ steps.current = null;
57
95
  p.onReset();
58
96
  },
59
97
  onKeyDown: (e) => {
@@ -61,15 +99,19 @@ function ColResize(p) {
61
99
  if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
62
100
  e.preventDefault();
63
101
  e.stopPropagation();
102
+ steps.current = null;
64
103
  set(p.start() + (e.key === "ArrowRight" ? 16 : -16));
65
104
  } else if (e.key === "Enter") {
66
105
  e.preventDefault();
67
106
  e.stopPropagation();
107
+ steps.current = null;
68
108
  p.onReset();
69
109
  }
70
110
  }
71
111
  });
72
112
  }
113
+ const STEPS = [1.5, 2];
114
+ const DRAG_MIN = 4;
73
115
  /** The 「放大表格」 icon: 32 px, no border, at a Markdown table's top right; in a DataTable's toolbar (inToolbar) it is a
74
116
  * toolbar button like 「複製成 Markdown」. */
75
117
  function ZoomButton({ onClick, inToolbar }) {
@@ -86,7 +128,7 @@ function TableDialog(p) {
86
128
  if (!p.open) return null;
87
129
  return /* @__PURE__ */ jsx(Dialog, {
88
130
  open: true,
89
- onClose: p.onClose,
131
+ onOpenChange: (o) => !o && p.onClose(),
90
132
  title: p.title || tr("表格"),
91
133
  className: "ui-table-dialog",
92
134
  children: /* @__PURE__ */ jsx("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"tableTools.js","names":["phCopy","phCornersOut"],"sources":["../../src/internal/tableTools.tsx"],"sourcesContent":["import * as React from 'react';\nimport { tr } from '../i18n';\nimport { CHECK } from '../icons/Icon';\nimport { Dialog } from '../components/Dialog/Dialog';\nimport { IconButton } from '../components/IconButton/IconButton';\nimport { announce } from '../announce';\nimport { copyText, cx } from './util';\nimport { includeIcons } from '../icons/store';\nimport phCopy from '../icons/ph/copy';\nimport phCornersOut from '../icons/ph/corners-out';\n\nincludeIcons(phCopy, phCornersOut);\n\n/* What Markdown tables and DataTable share: the column border that drags, the 「放大表格」 dialog, and the\n 「複製成 Markdown」 icon. One implementation, so both tables behave and look the same. */\n\n/** The narrowest a dragged column gets (px); a DataTable column also never gets narrower than its heading. */\nexport const MIN_COL = 48;\n/** One ← or → on a column border (px). */\nexport const COL_STEP = 16;\n\n/** The right border of a header cell, dragged to set the column's width. ← → 16 px, Enter or a double-click back\n * to the widths by content. Hidden on touch screens (CSS), where 「放大表格」 shows the whole table instead. */\nexport function ColResize(p: {\n /** The column's name: the border is called 「調整「名稱」欄寬」. */\n name: string;\n /** Its width now (px), for aria-valuenow. */\n width: number;\n /** The narrowest it may get (px). */\n min?: number;\n /** The width when a drag or a key starts: the set width, or the drawn one. */\n start: () => number;\n onWidth: (px: number) => void;\n onReset: () => void;\n onDragging?: (on: boolean) => void;\n}) {\n const [on, setOn] = React.useState(false);\n const from = React.useRef<{ x: number; w: number } | null>(null);\n const min = p.min ?? MIN_COL;\n const set = (w: number) => p.onWidth(Math.max(min, Math.round(w)));\n const drag = (v: boolean) => {\n setOn(v);\n p.onDragging?.(v);\n };\n return (\n <span\n className={cx('ui-col-resize', on && 'is-dragging')}\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={tr('調整「{name}」欄寬', { name: p.name })}\n aria-valuenow={Math.round(p.width)}\n aria-valuemin={min}\n tabIndex={0}\n onClick={(e) => e.stopPropagation()}\n onPointerDown={(e) => {\n if (e.button !== 0) return;\n e.preventDefault();\n e.stopPropagation();\n e.currentTarget.setPointerCapture?.(e.pointerId);\n from.current = { x: e.clientX, w: p.start() };\n drag(true);\n }}\n onPointerMove={(e) => {\n if (from.current) set(from.current.w + e.clientX - from.current.x);\n }}\n onPointerUp={() => {\n from.current = null;\n drag(false);\n }}\n onPointerCancel={() => {\n from.current = null;\n drag(false);\n }}\n onDoubleClick={(e) => {\n e.stopPropagation();\n p.onReset();\n }}\n onKeyDown={(e) => {\n if (e.altKey || e.metaKey || e.ctrlKey) return;\n if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {\n e.preventDefault();\n e.stopPropagation();\n set(p.start() + (e.key === 'ArrowRight' ? COL_STEP : -COL_STEP));\n } else if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n p.onReset();\n }\n }}\n />\n );\n}\n\n/** The 「放大表格」 icon: 32 px, no border, at a Markdown table's top right; in a DataTable's toolbar (inToolbar) it is a\n * toolbar button like 「複製成 Markdown」. */\nexport function ZoomButton({ onClick, inToolbar }: { onClick: () => void; inToolbar?: boolean }) {\n return <IconButton className={inToolbar ? 'ui-dt-zoombtn' : 'ui-table-zoom'} icon=\"corners-out\" label={tr('放大表格')} onClick={onClick} />;\n}\n\n/** The whole table in a wide dialog (at most 1200 px). A plain click on a link inside (a function, a path) closes the\n * dialog after the link has done its job; Ctrl, ⌘, Shift or the middle button open a new tab and keep it open. */\nexport function TableDialog(p: { open: boolean; onClose: () => void; title?: string; children: React.ReactNode }) {\n if (!p.open) return null;\n return (\n <Dialog open onClose={p.onClose} title={p.title || tr('表格')} className=\"ui-table-dialog\">\n <div\n className=\"ui-table-dialog-body\"\n onClick={(e) => {\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;\n const link = (e.target as Element).closest('a[href], [role=\"link\"], .ui-code.is-link, .ui-md-link');\n if (link && e.currentTarget.contains(link)) p.onClose();\n }}\n >\n {p.children}\n </div>\n </Dialog>\n );\n}\n\n/** The 「複製成 Markdown」 icon: copies the text, turns into a check for 2 s and says 「已複製」, as CodeView's copy. */\nexport function CopyMarkdownButton(p: { text: () => string; onCopyError?: () => void; className?: string }) {\n const [done, setDone] = React.useState(false);\n const timer = React.useRef<ReturnType<typeof setTimeout>>(undefined);\n React.useEffect(() => () => clearTimeout(timer.current), []);\n return (\n <IconButton\n className={cx('ui-table-copy', done && 'is-copied', p.className)}\n icon={done ? CHECK : 'copy'}\n label={done ? tr('已複製') : tr('複製成 Markdown')}\n onClick={() =>\n copyText(p.text()).then(\n () => {\n setDone(true);\n announce(tr('已複製'));\n clearTimeout(timer.current);\n timer.current = setTimeout(() => setDone(false), 2000);\n },\n () => p.onCopyError?.(),\n )\n }\n />\n );\n}\n\n/** A table as GitHub Markdown: | in a cell is escaped, line breaks become spaces. */\nexport function markdownTable(heads: string[], rows: string[][]): string {\n const cell = (s: string) => s.replace(/\\r?\\n/g, ' ').replace(/\\|/g, '\\\\|').trim();\n return [`| ${heads.map(cell).join(' | ')} |`, `|${heads.map(() => '---').join('|')}|`, ...rows.map((r) => `| ${r.map(cell).join(' | ')} |`)].join('\\n');\n}\n"],"mappings":";;;;;;;;;;;AAWA,aAAaA,cAAQC,mBAAY;;;AAYjC,SAAgB,UAAU,GAYvB;CACD,MAAM,CAAC,IAAI,SAAS,MAAM,SAAS,KAAK;CACxC,MAAM,OAAO,MAAM,OAAwC,IAAI;CAC/D,MAAM,MAAM,EAAE,OAAA;CACd,MAAM,OAAO,MAAc,EAAE,QAAQ,KAAK,IAAI,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC;CACjE,MAAM,QAAQ,MAAe;EAC3B,MAAM,CAAC;EACP,EAAE,aAAa,CAAC;CAClB;CACA,OACE,oBAAC,QAAD;EACE,WAAW,GAAG,iBAAiB,MAAM,aAAa;EAClD,MAAK;EACL,oBAAiB;EACjB,cAAY,GAAG,gBAAgB,EAAE,MAAM,EAAE,KAAK,CAAC;EAC/C,iBAAe,KAAK,MAAM,EAAE,KAAK;EACjC,iBAAe;EACf,UAAU;EACV,UAAU,MAAM,EAAE,gBAAgB;EAClC,gBAAgB,MAAM;GACpB,IAAI,EAAE,WAAW,GAAG;GACpB,EAAE,eAAe;GACjB,EAAE,gBAAgB;GAClB,EAAE,cAAc,oBAAoB,EAAE,SAAS;GAC/C,KAAK,UAAU;IAAE,GAAG,EAAE;IAAS,GAAG,EAAE,MAAM;GAAE;GAC5C,KAAK,IAAI;EACX;EACA,gBAAgB,MAAM;GACpB,IAAI,KAAK,SAAS,IAAI,KAAK,QAAQ,IAAI,EAAE,UAAU,KAAK,QAAQ,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AAQ,OAAO,KAAK,CAAC,CAAC,KAAK;CAChF,OAAO;EAAC,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,EAAE;EAAK,IAAI,MAAM,UAAU,KAAK,CAAC,CAAC,KAAK,GAAG,EAAE;EAAI,GAAG,KAAK,KAAK,MAAM,KAAK,EAAE,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,EAAE,GAAG;CAAC,CAAC,CAAC,KAAK,IAAI;AACxJ"}
1
+ {"version":3,"file":"tableTools.js","names":["phCopy","phCornersOut"],"sources":["../../src/internal/tableTools.tsx"],"sourcesContent":["import * as React from 'react';\nimport { tr } from '../i18n';\nimport { CHECK } from '../icons/Icon';\nimport { Dialog } from '../components/Dialog/Dialog';\nimport { IconButton } from '../components/IconButton/IconButton';\nimport { announce } from '../announce';\nimport { copyText, cx } from './util';\nimport { includeIcons } from '../icons/store';\nimport phCopy from '../icons/ph/copy';\nimport phCornersOut from '../icons/ph/corners-out';\n\nincludeIcons(phCopy, phCornersOut);\n\n/* What Markdown tables and DataTable share: the column border that drags, the 「放大表格」 dialog, and the\n 「複製成 Markdown」 icon. One implementation, so both tables behave and look the same. */\n\n/** The narrowest a dragged column gets (px); a DataTable column also never gets narrower than its heading. */\nexport const MIN_COL = 48;\n/** One ← or → on a column border (px). */\nexport const COL_STEP = 16;\n\n/** The right border of a header cell, dragged to set the column's width. ← → 16 px, Enter or a double-click back\n * to the widths by content. A click without dragging (one pointer, WCAG 2.5.7) steps the width up: 1.5 times, twice,\n * then back to the width by content. Hidden on touch screens (CSS), where 「放大表格」 shows the whole table instead. */\nexport function ColResize(p: {\n /** The column's name: the border is called 「調整「名稱」欄寬」. */\n name: string;\n /** Its width now (px), for aria-valuenow. */\n width: number;\n /** The narrowest it may get (px). */\n min?: number;\n /** The width when a drag or a key starts: the set width, or the drawn one. */\n start: () => number;\n /** A new width (px), from a drag, a key or a click. */\n onWidth: (px: number) => void;\n /** Back to the width by content (Enter, a double-click, the last click step). */\n onReset: () => void;\n /** A drag starts (true) or ends (false). */\n onDragging?: (on: boolean) => void;\n}) {\n const [on, setOn] = React.useState(false);\n const from = React.useRef<{ x: number; w: number; moved: boolean } | null>(null);\n // The click steps: the width they started from and the last one set, so a drag or a key in between starts over.\n const steps = React.useRef<{ base: number; n: number; last: number } | null>(null);\n const min = p.min ?? MIN_COL;\n const set = (w: number) => p.onWidth(Math.max(min, Math.round(w)));\n const drag = (v: boolean) => {\n setOn(v);\n p.onDragging?.(v);\n };\n const step = () => {\n const cur = steps.current && Math.abs(steps.current.last - p.width) <= 1 ? steps.current : { base: p.start(), n: 0, last: -1 };\n const n = cur.n + 1;\n if (n >= STEPS.length + 1) {\n steps.current = null;\n p.onReset();\n announce(tr('已還原「{name}」欄寬', { name: p.name }));\n return;\n }\n const w = Math.max(min, Math.round(cur.base * STEPS[n - 1]));\n steps.current = { base: cur.base, n, last: w };\n p.onWidth(w);\n announce(tr('「{name}」欄寬 {n} px', { name: p.name, n: w }));\n };\n return (\n <span\n className={cx('ui-col-resize', on && 'is-dragging')}\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={tr('調整「{name}」欄寬', { name: p.name })}\n aria-description={tr('拖曳或按 ← → 調整;按一下依序加寬,按 Enter 還原')}\n aria-valuenow={Math.round(p.width)}\n aria-valuemin={min}\n tabIndex={0}\n onClick={(e) => e.stopPropagation()}\n onPointerDown={(e) => {\n if (e.button !== 0) return;\n e.preventDefault();\n e.stopPropagation();\n e.currentTarget.setPointerCapture?.(e.pointerId);\n from.current = { x: e.clientX, w: p.start(), moved: false };\n drag(true);\n }}\n onPointerMove={(e) => {\n const f = from.current;\n if (!f) return;\n // A few px of jitter in a click is not a drag.\n if (!f.moved && Math.abs(e.clientX - f.x) < DRAG_MIN) return;\n f.moved = true;\n steps.current = null;\n set(f.w + e.clientX - f.x);\n }}\n onPointerUp={() => {\n const clicked = from.current && !from.current.moved;\n from.current = null;\n drag(false);\n if (clicked) step();\n }}\n onPointerCancel={() => {\n from.current = null;\n drag(false);\n }}\n onDoubleClick={(e) => {\n e.stopPropagation();\n steps.current = null;\n p.onReset();\n }}\n onKeyDown={(e) => {\n if (e.altKey || e.metaKey || e.ctrlKey) return;\n if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {\n e.preventDefault();\n e.stopPropagation();\n steps.current = null;\n set(p.start() + (e.key === 'ArrowRight' ? COL_STEP : -COL_STEP));\n } else if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n steps.current = null;\n p.onReset();\n }\n }}\n />\n );\n}\n\n// A click on a column border: the width it started from times these, then back to the width by content.\nconst STEPS = [1.5, 2];\n// A pointer that moves less than this (px) between down and up clicked.\nconst DRAG_MIN = 4;\n\n/** The 「放大表格」 icon: 32 px, no border, at a Markdown table's top right; in a DataTable's toolbar (inToolbar) it is a\n * toolbar button like 「複製成 Markdown」. */\nexport function ZoomButton({ onClick, inToolbar }: { onClick: () => void; inToolbar?: boolean }) {\n return <IconButton className={inToolbar ? 'ui-dt-zoombtn' : 'ui-table-zoom'} icon=\"corners-out\" label={tr('放大表格')} onClick={onClick} />;\n}\n\n/** The whole table in a wide dialog (at most 1200 px). A plain click on a link inside (a function, a path) closes the\n * dialog after the link has done its job; Ctrl, ⌘, Shift or the middle button open a new tab and keep it open. */\nexport function TableDialog(p: { open: boolean; onClose: () => void; title?: string; children: React.ReactNode }) {\n if (!p.open) return null;\n return (\n <Dialog open onOpenChange={(o) => !o && p.onClose()} title={p.title || tr('表格')} className=\"ui-table-dialog\">\n <div\n className=\"ui-table-dialog-body\"\n onClick={(e) => {\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;\n const link = (e.target as Element).closest('a[href], [role=\"link\"], .ui-code.is-link, .ui-md-link');\n if (link && e.currentTarget.contains(link)) p.onClose();\n }}\n >\n {p.children}\n </div>\n </Dialog>\n );\n}\n\n/** The 「複製成 Markdown」 icon: copies the text, turns into a check for 2 s and says 「已複製」, as CodeView's copy. */\nexport function CopyMarkdownButton(p: { text: () => string; onCopyError?: () => void; className?: string }) {\n const [done, setDone] = React.useState(false);\n const timer = React.useRef<ReturnType<typeof setTimeout>>(undefined);\n React.useEffect(() => () => clearTimeout(timer.current), []);\n return (\n <IconButton\n className={cx('ui-table-copy', done && 'is-copied', p.className)}\n icon={done ? CHECK : 'copy'}\n label={done ? tr('已複製') : tr('複製成 Markdown')}\n onClick={() =>\n copyText(p.text()).then(\n () => {\n setDone(true);\n announce(tr('已複製'));\n clearTimeout(timer.current);\n timer.current = setTimeout(() => setDone(false), 2000);\n },\n () => p.onCopyError?.(),\n )\n }\n />\n );\n}\n\n/** A table as GitHub Markdown: | in a cell is escaped, line breaks become spaces. */\nexport function markdownTable(heads: string[], rows: string[][]): string {\n const cell = (s: string) => s.replace(/\\r?\\n/g, ' ').replace(/\\|/g, '\\\\|').trim();\n return [`| ${heads.map(cell).join(' | ')} |`, `|${heads.map(() => '---').join('|')}|`, ...rows.map((r) => `| ${r.map(cell).join(' | ')} |`)].join('\\n');\n}\n"],"mappings":";;;;;;;;;;;;AAWA,aAAaA,cAAQC,mBAAY;;;;AAajC,SAAgB,UAAU,GAevB;CACD,MAAM,CAAC,IAAI,SAAS,MAAM,SAAS,KAAK;CACxC,MAAM,OAAO,MAAM,OAAwD,IAAI;CAE/E,MAAM,QAAQ,MAAM,OAAyD,IAAI;CACjF,MAAM,MAAM,EAAE,OAAA;CACd,MAAM,OAAO,MAAc,EAAE,QAAQ,KAAK,IAAI,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC;CACjE,MAAM,QAAQ,MAAe;EAC3B,MAAM,CAAC;EACP,EAAE,aAAa,CAAC;CAClB;CACA,MAAM,aAAa;EACjB,MAAM,MAAM,MAAM,WAAW,KAAK,IAAI,MAAM,QAAQ,OAAO,EAAE,KAAK,KAAK,IAAI,MAAM,UAAU;GAAE,MAAM,EAAE,MAAM;GAAG,GAAG;GAAG,MAAM;EAAG;EAC7H,MAAM,IAAI,IAAI,IAAI;EAClB,IAAI,KAA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OAAiB,MAA0B;CACvE,MAAM,QAAQ,MAAc,EAAE,QAAQ,UAAU,GAAG,CAAC,CAAC,QAAQ,OAAO,KAAK,CAAC,CAAC,KAAK;CAChF,OAAO;EAAC,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,EAAE;EAAK,IAAI,MAAM,UAAU,KAAK,CAAC,CAAC,KAAK,GAAG,EAAE;EAAI,GAAG,KAAK,KAAK,MAAM,KAAK,EAAE,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,EAAE,GAAG;CAAC,CAAC,CAAC,KAAK,IAAI;AACxJ"}
@@ -28,14 +28,6 @@ function monoNums(text, nums) {
28
28
  children: nums[k]
29
29
  }, i) : t);
30
30
  }
31
- /** localStorage get (no value) or set; null when storage is blocked. */
32
- function store(key, value) {
33
- try {
34
- if (value === void 0) return localStorage.getItem(key);
35
- localStorage.setItem(key, value);
36
- } catch {}
37
- return null;
38
- }
39
31
  function reduced() {
40
32
  return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
41
33
  }
@@ -46,20 +38,19 @@ const IS_MAC = /mac|iphone|ipad/i.test(nav?.userAgentData?.platform || nav?.plat
46
38
  * turned off and a mouse would then lose its Tooltips. */
47
39
  const TOUCH_ONLY = "(pointer: coarse)";
48
40
  const SHORTCUT = IS_MAC ? "⌘K" : "Ctrl K";
49
- /** Matches a media query and follows changes. */
41
+ /** Matches a media query and follows changes. false on the server and in the first browser render while hydrating,
42
+ * so the markup matches; then the real match. */
50
43
  function useMedia(query) {
51
- const get = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(query).matches;
52
- const [match, setMatch] = React.useState(get);
53
- React.useEffect(() => {
54
- if (typeof window.matchMedia !== "function") return;
44
+ const sub = React.useCallback((f) => {
45
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") return () => {};
55
46
  const m = window.matchMedia(query);
56
- const f = () => setMatch(m.matches);
57
- f();
58
47
  m.addEventListener("change", f);
59
48
  return () => m.removeEventListener("change", f);
60
49
  }, [query]);
61
- return match;
50
+ const get = React.useCallback(() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(query).matches, [query]);
51
+ return React.useSyncExternalStore(sub, get, serverFalse);
62
52
  }
53
+ const serverFalse = () => false;
63
54
  /** A ResizeObserver, or null where there is none (jsdom, old browsers): the first measure then stays. */
64
55
  function resizeObserver(cb) {
65
56
  return typeof ResizeObserver === "function" ? new ResizeObserver(cb) : null;
@@ -106,6 +97,6 @@ function nodeText(node) {
106
97
  }
107
98
  return "";
108
99
  }
109
- export { IS_MAC, SHORTCUT, TOUCH_ONLY, browserKey, copyText, cx, digits, idPart, monoNums, nodeText, reduced, resizeObserver, seenOnly, store, useMedia, useNarrow };
100
+ export { IS_MAC, SHORTCUT, TOUCH_ONLY, browserKey, copyText, cx, digits, idPart, monoNums, nodeText, reduced, resizeObserver, seenOnly, useMedia, useNarrow };
110
101
 
111
102
  //# sourceMappingURL=util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","names":[],"sources":["../../src/internal/util.tsx"],"sourcesContent":["import * as React from 'react';\n\n/** A value (a row or node id, a file path) as part of an element id: no spaces, so aria-owns, aria-controls and\n * aria-labelledby, which split their value at spaces, still find it. */\nexport const idPart = (s: string): string => encodeURIComponent(s);\n\n/** Joins the truthy class names. */\nexport function cx(...names: unknown[]): string {\n return names.filter(Boolean).join(' ');\n}\n\n// Text that is only seen: drawn by CSS (::before), so it is neither in the page's text (copy, innerText, text-reading\n// tools) nor read aloud. The readable version goes beside it, visually hidden. Numbers keep Geist Mono.\nexport function seenOnly(text: string, nums: string[]): React.ReactNode[] {\n return splitMarks(text).map(([t, k], i) => <span key={i} className={cx('ui-seen', k >= 0 && 'ui-num')} data-text={k >= 0 ? nums[k] : t} />);\n}\n\n// A translated sentence cut at its number marks (\\u0001, \\u0002, \\u0003): [text, -1] or [mark, its index].\nfunction splitMarks(text: string): [string, number][] {\n return (\n text\n // eslint-disable-next-line no-control-regex -- the marks are control characters on purpose\n .split(/(\\u0001|\\u0002|\\u0003)/)\n .filter(Boolean)\n .map((t) => [t, ['\\u0001', '\\u0002', '\\u0003'].indexOf(t)])\n );\n}\n\n// Puts the numbers of a translated sentence in Geist Mono and leaves the words in the text font.\n// The sentence marks each number with \\u0001, \\u0002 or \\u0003 in the order of nums.\nexport function monoNums(text: string, nums: React.ReactNode[]): React.ReactNode[] {\n return splitMarks(text).map(([t, k], i) =>\n k >= 0 ? (\n <span key={i} className=\"ui-num\">\n {nums[k]}\n </span>\n ) : (\n t\n ),\n );\n}\n\n/** localStorage get (no value) or set; null when storage is blocked. */\nexport function store(key: string, value?: string): string | null {\n try {\n if (value === undefined) return localStorage.getItem(key);\n localStorage.setItem(key, value);\n } catch {\n /* storage blocked (private mode, sandboxed frame) */\n }\n return null;\n}\n\nexport function reduced(): boolean {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\nconst nav = typeof navigator !== 'undefined' ? (navigator as Navigator & { userAgentData?: { platform?: string } }) : undefined;\nexport const IS_MAC = /mac|iphone|ipad/i.test(nav?.userAgentData?.platform || nav?.platform || nav?.userAgent || '');\n/** A touch screen as the main input (phones, tablets): no keyboard to press a shortcut with, no hover. Phones and\n * tablets report (pointer: coarse); (hover: none) alone is not used, since Chromium keeps it after touch emulation is\n * turned off and a mouse would then lose its Tooltips. */\nexport const TOUCH_ONLY = '(pointer: coarse)';\nexport const SHORTCUT = IS_MAC ? '⌘K' : 'Ctrl K';\n\n/** Matches a media query and follows changes. */\nexport function useMedia(query: string): boolean {\n const get = () => typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(query).matches;\n const [match, setMatch] = React.useState(get);\n React.useEffect(() => {\n if (typeof window.matchMedia !== 'function') return;\n const m = window.matchMedia(query);\n const f = () => setMatch(m.matches);\n f();\n m.addEventListener('change', f);\n return () => m.removeEventListener('change', f);\n }, [query]);\n return match;\n}\n\n/** A ResizeObserver, or null where there is none (jsdom, old browsers): the first measure then stays. */\nexport function resizeObserver(cb: ResizeObserverCallback): ResizeObserver | null {\n return typeof ResizeObserver === 'function' ? new ResizeObserver(cb) : null;\n}\n\n/** True under 600 px, the same width where cards stack. */\nexport function useNarrow(): boolean {\n return useMedia('(max-width: 599px)');\n}\n\nexport async function copyText(text: string): Promise<void> {\n if (navigator.clipboard?.writeText) {\n try {\n return await navigator.clipboard.writeText(text);\n } catch {\n /* fall back below (insecure context, denied permission) */\n }\n }\n const t = document.createElement('textarea');\n t.value = text;\n t.setAttribute('readonly', '');\n t.style.position = 'fixed';\n t.style.opacity = '0';\n document.body.appendChild(t);\n t.select();\n try {\n if (!document.execCommand('copy')) throw new Error('copy failed');\n } finally {\n document.body.removeChild(t);\n }\n}\n\n/** Text with every number in Geist Mono and the words in the text font, for labels that mix both (「第 1 週」). */\nexport function digits(text: string, numbers = /(\\d[\\d,.:/]*)/): React.ReactNode[] {\n return text.split(numbers).map((t, i) =>\n i % 2 ? (\n <span key={i} className=\"ui-num\">\n {t}\n </span>\n ) : (\n t\n ),\n );\n}\n\n/** Alt, Meta or Ctrl held: the key belongs to the browser or the system (Alt+← goes back a page), not to the widget. */\nexport const browserKey = (e: { altKey: boolean; metaKey: boolean; ctrlKey: boolean }): boolean => e.altKey || e.metaKey || e.ctrlKey;\n\n/** The words in a React node, as a screen reader would read them: strings and numbers, through elements' children. */\nexport function nodeText(node: React.ReactNode): string {\n if (node == null || typeof node === 'boolean') return '';\n if (typeof node === 'string' || typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(nodeText).join('');\n if (React.isValidElement(node)) {\n const props = node.props as { 'aria-label'?: string; label?: unknown; children?: React.ReactNode };\n if (typeof props['aria-label'] === 'string') return props['aria-label'];\n return nodeText(props.children) || (typeof props.label === 'string' ? props.label : '');\n }\n return '';\n}\n"],"mappings":";;;;;;AAIA,MAAa,UAAU,MAAsB,mBAAmB,CAAC;;AAG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AAS,WAAW,OAAO;CACtD,IAAI,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU,OAAO,OAAO,IAAI;CAC5E,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO,KAAK,IAAI,QAAQ,CAAC,CAAC,KAAK,EAAE;CAC1D,IAAI,MAAM,eAAe,IAAI,GAAG;EAC9B,MAAM,QAAQ,KAAK;EACnB,IAAI,OAAO,MAAM,kBAAkB,UAAU,OAAO,MAAM;EAC1D,OAAO,SAAS,MAAM,QAAQ,MAAM,OAAO,MAAM,UAAU,WAAW,MAAM,QAAQ;CACtF;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"util.js","names":[],"sources":["../../src/internal/util.tsx"],"sourcesContent":["import * as React from 'react';\n\n/** A value (a row or node id, a file path) as part of an element id: no spaces, so aria-owns, aria-controls and\n * aria-labelledby, which split their value at spaces, still find it. */\nexport const idPart = (s: string): string => encodeURIComponent(s);\n\n/** Joins the truthy class names. */\nexport function cx(...names: unknown[]): string {\n return names.filter(Boolean).join(' ');\n}\n\n// Text that is only seen: drawn by CSS (::before), so it is neither in the page's text (copy, innerText, text-reading\n// tools) nor read aloud. The readable version goes beside it, visually hidden. Numbers keep Geist Mono.\nexport function seenOnly(text: string, nums: string[]): React.ReactNode[] {\n return splitMarks(text).map(([t, k], i) => <span key={i} className={cx('ui-seen', k >= 0 && 'ui-num')} data-text={k >= 0 ? nums[k] : t} />);\n}\n\n// A translated sentence cut at its number marks (\\u0001, \\u0002, \\u0003): [text, -1] or [mark, its index].\nfunction splitMarks(text: string): [string, number][] {\n return (\n text\n // eslint-disable-next-line no-control-regex -- the marks are control characters on purpose\n .split(/(\\u0001|\\u0002|\\u0003)/)\n .filter(Boolean)\n .map((t) => [t, ['\\u0001', '\\u0002', '\\u0003'].indexOf(t)])\n );\n}\n\n// Puts the numbers of a translated sentence in Geist Mono and leaves the words in the text font.\n// The sentence marks each number with \\u0001, \\u0002 or \\u0003 in the order of nums.\nexport function monoNums(text: string, nums: React.ReactNode[]): React.ReactNode[] {\n return splitMarks(text).map(([t, k], i) =>\n k >= 0 ? (\n <span key={i} className=\"ui-num\">\n {nums[k]}\n </span>\n ) : (\n t\n ),\n );\n}\n\n/** localStorage get (no value) or set; null when storage is blocked. */\nexport function store(key: string, value?: string): string | null {\n try {\n if (value === undefined) return localStorage.getItem(key);\n localStorage.setItem(key, value);\n } catch {\n /* storage blocked (private mode, sandboxed frame) */\n }\n return null;\n}\n\nexport function reduced(): boolean {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\nconst nav = typeof navigator !== 'undefined' ? (navigator as Navigator & { userAgentData?: { platform?: string } }) : undefined;\nexport const IS_MAC = /mac|iphone|ipad/i.test(nav?.userAgentData?.platform || nav?.platform || nav?.userAgent || '');\n/** A touch screen as the main input (phones, tablets): no keyboard to press a shortcut with, no hover. Phones and\n * tablets report (pointer: coarse); (hover: none) alone is not used, since Chromium keeps it after touch emulation is\n * turned off and a mouse would then lose its Tooltips. */\nexport const TOUCH_ONLY = '(pointer: coarse)';\nexport const SHORTCUT = IS_MAC ? '⌘K' : 'Ctrl K';\n\n/** Matches a media query and follows changes. false on the server and in the first browser render while hydrating,\n * so the markup matches; then the real match. */\nexport function useMedia(query: string): boolean {\n const sub = React.useCallback(\n (f: () => void) => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return () => {};\n const m = window.matchMedia(query);\n m.addEventListener('change', f);\n return () => m.removeEventListener('change', f);\n },\n [query],\n );\n const get = React.useCallback(() => typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(query).matches, [query]);\n return React.useSyncExternalStore(sub, get, serverFalse);\n}\nconst serverFalse = () => false;\n\n/** A ResizeObserver, or null where there is none (jsdom, old browsers): the first measure then stays. */\nexport function resizeObserver(cb: ResizeObserverCallback): ResizeObserver | null {\n return typeof ResizeObserver === 'function' ? new ResizeObserver(cb) : null;\n}\n\n/** True under 600 px, the same width where cards stack. */\nexport function useNarrow(): boolean {\n return useMedia('(max-width: 599px)');\n}\n\nexport async function copyText(text: string): Promise<void> {\n if (navigator.clipboard?.writeText) {\n try {\n return await navigator.clipboard.writeText(text);\n } catch {\n /* fall back below (insecure context, denied permission) */\n }\n }\n const t = document.createElement('textarea');\n t.value = text;\n t.setAttribute('readonly', '');\n t.style.position = 'fixed';\n t.style.opacity = '0';\n document.body.appendChild(t);\n t.select();\n try {\n if (!document.execCommand('copy')) throw new Error('copy failed');\n } finally {\n document.body.removeChild(t);\n }\n}\n\n/** Text with every number in Geist Mono and the words in the text font, for labels that mix both (「第 1 週」). */\nexport function digits(text: string, numbers = /(\\d[\\d,.:/]*)/): React.ReactNode[] {\n return text.split(numbers).map((t, i) =>\n i % 2 ? (\n <span key={i} className=\"ui-num\">\n {t}\n </span>\n ) : (\n t\n ),\n );\n}\n\n/** Alt, Meta or Ctrl held: the key belongs to the browser or the system (Alt+← goes back a page), not to the widget. */\nexport const browserKey = (e: { altKey: boolean; metaKey: boolean; ctrlKey: boolean }): boolean => e.altKey || e.metaKey || e.ctrlKey;\n\n/** The words in a React node, as a screen reader would read them: strings and numbers, through elements' children. */\nexport function nodeText(node: React.ReactNode): string {\n if (node == null || typeof node === 'boolean') return '';\n if (typeof node === 'string' || typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(nodeText).join('');\n if (React.isValidElement(node)) {\n const props = node.props as { 'aria-label'?: string; label?: unknown; children?: React.ReactNode };\n if (typeof props['aria-label'] === 'string') return props['aria-label'];\n return nodeText(props.children) || (typeof props.label === 'string' ? props.label : '');\n }\n return '';\n}\n"],"mappings":";;;;;;AAIA,MAAa,UAAU,MAAsB,mBAAmB,CAAC;;AAGjE,SAAgB,GAAG,GAAG,OAA0B;CAC9C,OAAO,MAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACvC;AAIA,SAAgB,SAAS,MAAc,MAAmC;CACxE,OAAO,WAAW,IAAI,CAAC,CAAC,KAAK,CAAC,GA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