haze-ui 1.30.0 → 1.32.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 (330) hide show
  1. package/README.md +67 -1
  2. package/dist/components/ActivityRail/ActivityRail.js +76 -0
  3. package/dist/components/ActivityRail/index.js +3 -0
  4. package/dist/components/BottomSheet/BottomSheet.js +12 -26
  5. package/dist/components/Button/Button.js +33 -15
  6. package/dist/components/Button/ButtonLink.js +12 -21
  7. package/dist/components/Button/styles.js +2 -2
  8. package/dist/components/Cascader/Cascader.js +11 -11
  9. package/dist/components/ColorPicker/ColorPicker.js +4 -4
  10. package/dist/components/Combobox/Combobox.js +128 -119
  11. package/dist/components/Command/Command.js +9 -9
  12. package/dist/components/ConfigProvider/ConfigContext.js +16 -0
  13. package/dist/components/ConfirmDialog/confirm.js +41 -0
  14. package/dist/components/ConfirmDialog/index.js +2 -1
  15. package/dist/components/ConversationList/ConversationList.js +16 -7
  16. package/dist/components/DataTable/DataTable.js +24 -24
  17. package/dist/components/DateTimePicker/DateTimePicker.js +25 -0
  18. package/dist/components/DateTimePicker/index.js +3 -0
  19. package/dist/components/Datepicker/Datepicker.js +8 -7
  20. package/dist/components/Datepicker/DatepickerCore.js +60 -59
  21. package/dist/components/Drawer/Drawer.js +45 -40
  22. package/dist/components/Fieldset/Fieldset.js +25 -0
  23. package/dist/components/Fieldset/index.js +2 -0
  24. package/dist/components/Highlight/Highlight.js +19 -0
  25. package/dist/components/Highlight/index.js +2 -0
  26. package/dist/components/Indicator/Indicator.js +37 -0
  27. package/dist/components/Indicator/index.js +2 -0
  28. package/dist/components/InlineCompletion/InlineCompletion.js +4 -4
  29. package/dist/components/Input/Input.js +9 -7
  30. package/dist/components/Input/InputCore.js +32 -13
  31. package/dist/components/List/List.js +14 -10
  32. package/dist/components/LoadingOverlay/LoadingOverlay.js +30 -0
  33. package/dist/components/LoadingOverlay/index.js +3 -0
  34. package/dist/components/LocaleProvider/ar-sa.js +11 -0
  35. package/dist/components/LocaleProvider/de-de.js +11 -0
  36. package/dist/components/LocaleProvider/es-es.js +11 -0
  37. package/dist/components/LocaleProvider/fr-fr.js +11 -0
  38. package/dist/components/LocaleProvider/it-it.js +11 -0
  39. package/dist/components/LocaleProvider/ja-jp.js +11 -0
  40. package/dist/components/LocaleProvider/ko-kr.js +11 -0
  41. package/dist/components/LocaleProvider/locale.js +11 -0
  42. package/dist/components/LocaleProvider/pt-br.js +11 -0
  43. package/dist/components/LocaleProvider/ru-ru.js +11 -0
  44. package/dist/components/LocaleProvider/zh-cn.js +11 -0
  45. package/dist/components/LogViewer/LogViewer.js +45 -38
  46. package/dist/components/Mark/Mark.js +20 -0
  47. package/dist/components/Mark/index.js +2 -0
  48. package/dist/components/Mentions/MentionsCore.js +3 -3
  49. package/dist/components/Menu/MenuItem.js +6 -4
  50. package/dist/components/NumberFormatter/NumberFormatter.js +16 -0
  51. package/dist/components/NumberFormatter/index.js +2 -0
  52. package/dist/components/OTPInput/OTPInputCore.js +7 -6
  53. package/dist/components/PasswordInput/PasswordInputCore.js +27 -26
  54. package/dist/components/Rating/RatingCore.js +18 -18
  55. package/dist/components/Resizable/Resizable.js +266 -36
  56. package/dist/components/Select/Select.js +28 -23
  57. package/dist/components/Select/SelectCore.js +26 -23
  58. package/dist/components/Select/SelectFloating.js +157 -153
  59. package/dist/components/Sparkline/Sparkline.js +45 -0
  60. package/dist/components/Sparkline/index.js +3 -0
  61. package/dist/components/Sparkline/sparkline-styles.js +18 -0
  62. package/dist/components/Spoiler/Spoiler.js +36 -0
  63. package/dist/components/Spoiler/index.js +3 -0
  64. package/dist/components/StatusBar/StatusBar.js +47 -0
  65. package/dist/components/StatusBar/index.js +3 -0
  66. package/dist/components/TabBar/TabBar.js +60 -0
  67. package/dist/components/TabBar/index.js +3 -0
  68. package/dist/components/Tabs/SortableTabList.js +116 -0
  69. package/dist/components/Tabs/Tab.js +83 -16
  70. package/dist/components/Tabs/TabList.js +94 -38
  71. package/dist/components/Tabs/edge-scroll.js +6 -0
  72. package/dist/components/Tabs/index.js +4 -3
  73. package/dist/components/Tabs/tab-metas.js +24 -0
  74. package/dist/components/TagGroup/SortableTagGroup.js +32 -20
  75. package/dist/components/TagGroup/TagGroup.js +23 -9
  76. package/dist/components/TagGroup/TagGroupItem.js +21 -15
  77. package/dist/components/TagInput/SortableTagInputCore.js +11 -11
  78. package/dist/components/TagInput/TagInputCore.js +10 -10
  79. package/dist/components/TimePicker/TimePickerPanel.js +3 -3
  80. package/dist/components/Toast/ToastContainer.js +5 -5
  81. package/dist/components/Toast/index.js +1 -1
  82. package/dist/components/Toast/{toast2.js → toast-channel.js} +1 -1
  83. package/dist/components/Toast/useToast.js +1 -1
  84. package/dist/components/Tree/SortableTree.js +39 -39
  85. package/dist/components/TreeSelect/TreeSelect.js +6 -6
  86. package/dist/components/VirtualList/VirtualList.js +133 -121
  87. package/dist/components/VisuallyHidden/VisuallyHidden.js +15 -0
  88. package/dist/components/VisuallyHidden/index.js +2 -0
  89. package/dist/components/Workbench/Workbench.js +144 -0
  90. package/dist/components/Workbench/index.js +3 -0
  91. package/dist/css/accordion.css +2 -0
  92. package/dist/css/activity-rail.css +4 -0
  93. package/dist/css/affix.css +2 -0
  94. package/dist/css/alert.css +2 -0
  95. package/dist/css/anchor.css +2 -0
  96. package/dist/css/app-shell.css +3 -1
  97. package/dist/css/approval-card.css +2 -0
  98. package/dist/css/aspect-ratio.css +2 -0
  99. package/dist/css/async-section.css +2 -0
  100. package/dist/css/avatar-group.css +2 -0
  101. package/dist/css/avatar.css +2 -0
  102. package/dist/css/back-to-top.css +2 -0
  103. package/dist/css/badge.css +2 -0
  104. package/dist/css/banner.css +2 -0
  105. package/dist/css/bottom-sheet.css +2 -0
  106. package/dist/css/breadcrumb.css +3 -1
  107. package/dist/css/button.css +3 -2
  108. package/dist/css/calendar.css +2 -0
  109. package/dist/css/card.css +2 -0
  110. package/dist/css/carousel.css +2 -0
  111. package/dist/css/cascader.css +2 -0
  112. package/dist/css/chart.css +2 -0
  113. package/dist/css/chat-container.css +2 -0
  114. package/dist/css/chat-input.css +2 -0
  115. package/dist/css/chat-message.css +2 -0
  116. package/dist/css/checkbox.css +3 -1
  117. package/dist/css/chip.css +2 -0
  118. package/dist/css/code-block.css +2 -0
  119. package/dist/css/collapsible.css +2 -0
  120. package/dist/css/color-picker.css +2 -0
  121. package/dist/css/combobox.css +2 -0
  122. package/dist/css/command.css +3 -1
  123. package/dist/css/confirm-dialog.css +2 -0
  124. package/dist/css/container.css +2 -0
  125. package/dist/css/context-menu.css +3 -1
  126. package/dist/css/conversation-list.css +2 -0
  127. package/dist/css/count-up.css +2 -0
  128. package/dist/css/data-table.css +2 -0
  129. package/dist/css/date-range-picker.css +3 -1
  130. package/dist/css/datepicker.css +2 -0
  131. package/dist/css/descriptions.css +2 -0
  132. package/dist/css/dialog.css +2 -0
  133. package/dist/css/diff-viewer.css +2 -0
  134. package/dist/css/disclosure.css +2 -0
  135. package/dist/css/divider.css +2 -0
  136. package/dist/css/drawer.css +3 -1
  137. package/dist/css/dropdown-menu.css +4 -2
  138. package/dist/css/ellipsis.css +2 -0
  139. package/dist/css/empty.css +2 -0
  140. package/dist/css/fieldset.css +4 -0
  141. package/dist/css/file-input.css +2 -0
  142. package/dist/css/file-preview.css +2 -0
  143. package/dist/css/flex.css +2 -0
  144. package/dist/css/float-button.css +2 -0
  145. package/dist/css/form.css +2 -0
  146. package/dist/css/grid.css +2 -0
  147. package/dist/css/hover-card.css +3 -1
  148. package/dist/css/icon.css +2 -0
  149. package/dist/css/image.css +2 -0
  150. package/dist/css/indicator.css +4 -0
  151. package/dist/css/inline-completion.css +2 -0
  152. package/dist/css/inline-edit.css +2 -0
  153. package/dist/css/input.css +3 -1
  154. package/dist/css/json-view.css +2 -0
  155. package/dist/css/kbd.css +2 -0
  156. package/dist/css/list.css +3 -1
  157. package/dist/css/loading-overlay.css +4 -0
  158. package/dist/css/log-viewer.css +2 -0
  159. package/dist/css/mark.css +4 -0
  160. package/dist/css/markdown-renderer.css +2 -0
  161. package/dist/css/masonry.css +2 -0
  162. package/dist/css/mentions.css +2 -0
  163. package/dist/css/menu.css +5 -3
  164. package/dist/css/model-picker.css +2 -0
  165. package/dist/css/navigation-bar.css +2 -0
  166. package/dist/css/number-input.css +2 -0
  167. package/dist/css/otp-input.css +2 -0
  168. package/dist/css/pagination.css +2 -0
  169. package/dist/css/password-input.css +3 -1
  170. package/dist/css/popover.css +3 -1
  171. package/dist/css/progress.css +2 -0
  172. package/dist/css/prompt-input.css +2 -0
  173. package/dist/css/qr-code.css +2 -0
  174. package/dist/css/radio.css +3 -1
  175. package/dist/css/rating.css +2 -0
  176. package/dist/css/resizable.css +3 -1
  177. package/dist/css/result.css +2 -0
  178. package/dist/css/scroll-area.css +2 -0
  179. package/dist/css/segmented.css +3 -1
  180. package/dist/css/select.css +2 -0
  181. package/dist/css/sidebar.css +3 -1
  182. package/dist/css/signature.css +2 -0
  183. package/dist/css/skeleton.css +2 -0
  184. package/dist/css/slider.css +3 -1
  185. package/dist/css/sources.css +2 -0
  186. package/dist/css/sparkline.css +4 -0
  187. package/dist/css/spinner.css +2 -0
  188. package/dist/css/spoiler.css +4 -0
  189. package/dist/css/stat.css +2 -0
  190. package/dist/css/status-bar.css +4 -0
  191. package/dist/css/step-timeline.css +2 -0
  192. package/dist/css/stepper.css +2 -0
  193. package/dist/css/streaming-text.css +2 -0
  194. package/dist/css/swipe-action.css +2 -0
  195. package/dist/css/switch.css +3 -1
  196. package/dist/css/tab-bar.css +4 -0
  197. package/dist/css/table.css +2 -0
  198. package/dist/css/tabs.css +5 -2
  199. package/dist/css/tag-group.css +2 -0
  200. package/dist/css/tag-input.css +2 -0
  201. package/dist/css/tag.css +3 -1
  202. package/dist/css/textarea.css +2 -0
  203. package/dist/css/thinking-indicator.css +2 -0
  204. package/dist/css/time-picker.css +2 -0
  205. package/dist/css/timeline.css +2 -0
  206. package/dist/css/toast.css +2 -0
  207. package/dist/css/toggle.css +2 -0
  208. package/dist/css/token-counter.css +2 -0
  209. package/dist/css/tokens.css +2 -0
  210. package/dist/css/tool-call-card.css +2 -0
  211. package/dist/css/toolbar.css +2 -0
  212. package/dist/css/tooltip.css +2 -0
  213. package/dist/css/tour.css +2 -0
  214. package/dist/css/transfer.css +2 -0
  215. package/dist/css/tree-select.css +2 -0
  216. package/dist/css/tree.css +3 -1
  217. package/dist/css/typography.css +2 -0
  218. package/dist/css/upload.css +2 -0
  219. package/dist/css/virtual-list.css +2 -0
  220. package/dist/css/visually-hidden.css +4 -0
  221. package/dist/css/watermark.css +2 -0
  222. package/dist/css/workbench.css +4 -0
  223. package/dist/css-manifest.json +202 -1
  224. package/dist/dates/adapter.js +9 -1
  225. package/dist/dates/buddhist.js +43 -0
  226. package/dist/dates/ethiopic.js +67 -0
  227. package/dist/dates/hebrew.js +95 -0
  228. package/dist/dates/japanese.js +41 -0
  229. package/dist/dates/persian.js +121 -0
  230. package/dist/dates/registry.js +14 -4
  231. package/dist/haze-ui.css +435 -29
  232. package/dist/headless/index.js +18 -17
  233. package/dist/hooks/useBusyPressable.js +10 -0
  234. package/dist/index.js +263 -241
  235. package/dist/mcp-docs.json +1073 -33
  236. package/dist/registry.json +256 -14
  237. package/dist/types/components/ActivityRail/ActivityRail.d.ts +30 -0
  238. package/dist/types/components/ActivityRail/index.d.ts +4 -0
  239. package/dist/types/components/Button/Button.d.ts +50 -5
  240. package/dist/types/components/Button/ButtonLink.d.ts +27 -15
  241. package/dist/types/components/Button/styles.d.ts +34 -0
  242. package/dist/types/components/Combobox/Combobox.d.ts +20 -2
  243. package/dist/types/components/Combobox/index.d.ts +1 -1
  244. package/dist/types/components/ConfigProvider/ConfigContext.d.ts +20 -0
  245. package/dist/types/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
  246. package/dist/types/components/ConfirmDialog/confirm.d.ts +33 -0
  247. package/dist/types/components/ConfirmDialog/index.d.ts +2 -0
  248. package/dist/types/components/ConversationList/ConversationList.d.ts +10 -1
  249. package/dist/types/components/DateTimePicker/DateTimePicker.d.ts +36 -0
  250. package/dist/types/components/DateTimePicker/index.d.ts +2 -0
  251. package/dist/types/components/Datepicker/Datepicker.d.ts +3 -3
  252. package/dist/types/components/Datepicker/DatepickerCore.d.ts +3 -3
  253. package/dist/types/components/Drawer/Drawer.d.ts +15 -2
  254. package/dist/types/components/Drawer/index.d.ts +1 -1
  255. package/dist/types/components/Fieldset/Fieldset.d.ts +16 -0
  256. package/dist/types/components/Fieldset/index.d.ts +2 -0
  257. package/dist/types/components/Highlight/Highlight.d.ts +27 -0
  258. package/dist/types/components/Highlight/index.d.ts +2 -0
  259. package/dist/types/components/Indicator/Indicator.d.ts +24 -0
  260. package/dist/types/components/Indicator/index.d.ts +2 -0
  261. package/dist/types/components/Input/Input.d.ts +8 -2
  262. package/dist/types/components/Input/InputCore.d.ts +11 -2
  263. package/dist/types/components/List/List.d.ts +10 -1
  264. package/dist/types/components/LoadingOverlay/LoadingOverlay.d.ts +25 -0
  265. package/dist/types/components/LoadingOverlay/index.d.ts +2 -0
  266. package/dist/types/components/LocaleProvider/locale.d.ts +11 -0
  267. package/dist/types/components/LogViewer/LogViewer.d.ts +10 -1
  268. package/dist/types/components/Mark/Mark.d.ts +12 -0
  269. package/dist/types/components/Mark/index.d.ts +2 -0
  270. package/dist/types/components/Menu/MenuItem.d.ts +15 -4
  271. package/dist/types/components/NumberFormatter/NumberFormatter.d.ts +23 -0
  272. package/dist/types/components/NumberFormatter/index.d.ts +2 -0
  273. package/dist/types/components/Resizable/Resizable.d.ts +24 -7
  274. package/dist/types/components/Resizable/index.d.ts +1 -1
  275. package/dist/types/components/Select/Select.d.ts +23 -2
  276. package/dist/types/components/Select/SelectCore.d.ts +4 -1
  277. package/dist/types/components/Select/SelectFloating.d.ts +6 -1
  278. package/dist/types/components/Select/index.d.ts +1 -1
  279. package/dist/types/components/Sparkline/Sparkline.d.ts +31 -0
  280. package/dist/types/components/Sparkline/index.d.ts +3 -0
  281. package/dist/types/components/Sparkline/sparkline-styles.d.ts +26 -0
  282. package/dist/types/components/Spoiler/Spoiler.d.ts +20 -0
  283. package/dist/types/components/Spoiler/index.d.ts +2 -0
  284. package/dist/types/components/StatusBar/StatusBar.d.ts +18 -0
  285. package/dist/types/components/StatusBar/index.d.ts +3 -0
  286. package/dist/types/components/TabBar/TabBar.d.ts +23 -0
  287. package/dist/types/components/TabBar/index.d.ts +4 -0
  288. package/dist/types/components/Tabs/SortableTabList.d.ts +46 -0
  289. package/dist/types/components/Tabs/Tab.d.ts +54 -3
  290. package/dist/types/components/Tabs/TabList.d.ts +26 -2
  291. package/dist/types/components/Tabs/edge-scroll.d.ts +17 -0
  292. package/dist/types/components/Tabs/index.d.ts +3 -1
  293. package/dist/types/components/Tabs/tab-metas.d.ts +20 -0
  294. package/dist/types/components/TagGroup/SortableTagGroup.d.ts +5 -1
  295. package/dist/types/components/TagGroup/TagGroup.d.ts +24 -2
  296. package/dist/types/components/TagGroup/index.d.ts +1 -1
  297. package/dist/types/components/Toast/index.d.ts +2 -2
  298. package/dist/types/components/Toast/useToast.d.ts +1 -1
  299. package/dist/types/components/VirtualList/VirtualList.d.ts +20 -1
  300. package/dist/types/components/VisuallyHidden/VisuallyHidden.d.ts +4 -0
  301. package/dist/types/components/VisuallyHidden/index.d.ts +2 -0
  302. package/dist/types/components/Workbench/Workbench.d.ts +50 -0
  303. package/dist/types/components/Workbench/index.d.ts +2 -0
  304. package/dist/types/dates/adapter.d.ts +33 -6
  305. package/dist/types/dates/buddhist.d.ts +14 -0
  306. package/dist/types/dates/ethiopic.d.ts +15 -0
  307. package/dist/types/dates/hebrew.d.ts +19 -0
  308. package/dist/types/dates/index.d.ts +5 -0
  309. package/dist/types/dates/japanese.d.ts +16 -0
  310. package/dist/types/dates/persian.d.ts +18 -0
  311. package/dist/types/dates/registry.d.ts +1 -1
  312. package/dist/types/headless/index.d.ts +9 -0
  313. package/dist/types/hooks/index.d.ts +13 -0
  314. package/dist/types/hooks/useBusyPressable.d.ts +33 -0
  315. package/dist/types/hooks/useElementSize.d.ts +38 -0
  316. package/dist/types/hooks/useIdle.d.ts +45 -0
  317. package/dist/types/hooks/useMutationObserver.d.ts +35 -0
  318. package/dist/types/hooks/useNetwork.d.ts +31 -0
  319. package/dist/types/hooks/useOrientation.d.ts +23 -0
  320. package/dist/types/hooks/useResizeObserver.d.ts +48 -0
  321. package/dist/types/index.d.ts +37 -9
  322. package/dist/types/utils/sortable.d.ts +8 -1
  323. package/dist/types/utils/use-end-reached.d.ts +56 -0
  324. package/dist/types/utils/viewport.d.ts +12 -0
  325. package/dist/utils/sortable-shared.js +3 -3
  326. package/dist/utils/sortable.js +15 -14
  327. package/dist/utils/use-end-reached.js +46 -0
  328. package/dist/utils/viewport.js +20 -0
  329. package/package.json +13 -5
  330. /package/dist/types/components/Toast/{toast.d.ts → toast-channel.d.ts} +0 -0
@@ -1,10 +1,32 @@
1
1
  import type { ReactNode } from 'react';
2
+ /** Item-level slot classes flow group → item without prop drilling.
3
+ * Default `undefined` — the same as no slot classes set anywhere. */
4
+ declare const TagGroupItemClassNamesContext: import("react").Context<TagGroupClassNames | undefined>;
5
+ /**
6
+ * Semantic slot classes for TagGroup (AntD v6 `classNames` shape; keys
7
+ * follow the data-slot names). `item`/`removeButton` forward onto every
8
+ * TagGroupItem child through context, so row-level skins are set once
9
+ * on the group. A ConfigProvider `TagGroup.classNames` section merges
10
+ * under the prop, per key.
11
+ */
12
+ type TagGroupClassNames = {
13
+ /** The group wrapper (data-slot='tag-group'). */
14
+ root?: string;
15
+ /** Every item's chip span (data-slot='tag-group-item'). */
16
+ item?: string;
17
+ /** Every item's remove button (data-slot='remove-button'). */
18
+ removeButton?: string;
19
+ };
2
20
  type TagGroupProps = {
3
21
  children: ReactNode;
4
22
  className?: string;
23
+ /** Slot classes (see {@link TagGroupClassNames}); item-level keys are
24
+ * inherited by the TagGroupItem children. */
25
+ classNames?: TagGroupClassNames;
5
26
  };
6
27
  /** Plain non-draggable tag row. For drag-and-drop reordering use
7
28
  * SortableTagGroup (which statically imports the @dnd-kit runtime);
8
29
  * this base component stays free of the dnd runtime. */
9
- export default function TagGroup({ children, className }: TagGroupProps): import("react").JSX.Element;
10
- export type { TagGroupProps };
30
+ export default function TagGroup({ children, className, classNames }: TagGroupProps): import("react").JSX.Element;
31
+ export { TagGroupItemClassNamesContext };
32
+ export type { TagGroupClassNames, TagGroupProps };
@@ -1,6 +1,6 @@
1
1
  export { default as TagGroup } from './TagGroup';
2
2
  export { default as TagGroupItem } from './TagGroupItem';
3
3
  export { default as SortableTagGroup } from './SortableTagGroup';
4
- export type { TagGroupProps } from './TagGroup';
4
+ export type { TagGroupClassNames, TagGroupProps } from './TagGroup';
5
5
  export type { TagGroupItemProps } from './TagGroupItem';
6
6
  export type { SortableTagGroupProps } from './SortableTagGroup';
@@ -3,5 +3,5 @@ export type { ToastProps, ToastClassNames } from './Toast';
3
3
  export { default as ToastContainer } from './ToastContainer';
4
4
  export type { ToastContainerProps } from './ToastContainer';
5
5
  export { default as useToast } from './useToast';
6
- export { toast } from './toast';
7
- export type { ToastAction, ToastOptions, ToastVariant } from './toast';
6
+ export { toast } from './toast-channel';
7
+ export type { ToastAction, ToastOptions, ToastVariant } from './toast-channel';
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { ToastOptions, ToastPromiseOptions, ToastUpdateOptions, ToastVariantOptions } from './toast';
2
+ import type { ToastOptions, ToastPromiseOptions, ToastUpdateOptions, ToastVariantOptions } from './toast-channel';
3
3
  /**
4
4
  * The `useToast()` return value: the toast trigger itself (returns the id,
5
5
  * usable with `update`) plus `loading`/`update`/`promise` — one-to-one
@@ -109,6 +109,25 @@ type VirtualListProps<T> = {
109
109
  * rows along the scroll axis, and columns in grid mode.
110
110
  */
111
111
  overscan?: number;
112
+ /**
113
+ * Fired when the scroll offset comes within `endReachedThreshold` px of
114
+ * the content's end along the scroll axis — the infinite-scroll "load
115
+ * the next page" trigger. Entering the zone fires once; staying inside
116
+ * it does not re-fire; scrolling back out re-arms, and content growth
117
+ * (a longer `items` array) re-arms too, so a list that is still short
118
+ * after a page load chains straight into the next one. Content shorter
119
+ * than the scrollport on mount fires immediately. In `reverse` mode the
120
+ * end edge mirrors to the scroll start (index 0 anchors to the end
121
+ * edge): the trigger fires as the *oldest* edge approaches. When the
122
+ * prop is omitted the check costs nothing.
123
+ */
124
+ onEndReached?: () => void;
125
+ /**
126
+ * Distance in px from the content end that arms `onEndReached`.
127
+ * Defaults to `200`. Measured along the scroll axis from the far edge
128
+ * of the scroll range (in `reverse` mode, from the scroll start).
129
+ */
130
+ endReachedThreshold?: number;
112
131
  /**
113
132
  * Chat orientation (opt-in): units anchor to the scrollport's end edge
114
133
  * (vertical: bottom; horizontal: inline-end) with index 0 at that edge
@@ -128,5 +147,5 @@ type VirtualListProps<T> = {
128
147
  className?: string;
129
148
  ref?: Ref<VirtualListHandle>;
130
149
  } & Omit<ComponentPropsWithoutRef<'div'>, 'children'>;
131
- export default function VirtualList<T>({ items, height, width, itemHeight, estimatedItemHeight, columns, columnWidth, orientation, groups, renderItem, overscan, reverse, className, style, ref, ...rest }: VirtualListProps<T>): import("react").JSX.Element;
150
+ export default function VirtualList<T>({ items, height, width, itemHeight, estimatedItemHeight, columns, columnWidth, orientation, groups, renderItem, overscan, onEndReached, endReachedThreshold, reverse, className, style, ref, ...rest }: VirtualListProps<T>): import("react").JSX.Element;
132
151
  export type { VirtualListProps, VirtualListHandle, VirtualListGroup, VirtualListAlign, VirtualListOrientation, };
@@ -0,0 +1,4 @@
1
+ import type { ComponentPropsWithoutRef } from 'react';
2
+ type VisuallyHiddenProps = ComponentPropsWithoutRef<'span'>;
3
+ export default function VisuallyHidden({ className, ...rest }: VisuallyHiddenProps): import("react").JSX.Element;
4
+ export type { VisuallyHiddenProps };
@@ -0,0 +1,2 @@
1
+ export { default as VisuallyHidden } from './VisuallyHidden';
2
+ export type { VisuallyHiddenProps } from './VisuallyHidden';
@@ -0,0 +1,50 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ import type { ControlOrValue } from 'react-use-control';
3
+ type WorkbenchProps = {
4
+ /** Narrow icon rail column on the leading edge (ActivityRail is the intended content). */
5
+ activityBar?: ReactNode;
6
+ /** Where the activity rail docks: its own column (`'side'`, the
7
+ * default) or inside the sidebar column at its top (`'top'`)
8
+ * or bottom (`'bottom'`) — the Cursor-style layout, where the
9
+ * rail rides the sidebar as one unit. */
10
+ activityBarPosition?: ControlOrValue<'side' | 'top' | 'bottom'>;
11
+ /** Docked explorer column beside the editor; under the mobile breakpoint
12
+ * it becomes a full-screen slide-out overlay dismissed via Escape, with
13
+ * focus moved in on open and returned to the opener on close. */
14
+ sidebar?: ReactNode;
15
+ /** Docked secondary column on the trailing edge; overlays like the sidebar on mobile. */
16
+ auxiliaryBar?: ReactNode;
17
+ /** Bottom tool region inside the main column (terminal/output); hidden on mobile. */
18
+ panel?: ReactNode;
19
+ /** Full-width strip under the middle row (StatusBar is the intended content). */
20
+ statusBar?: ReactNode;
21
+ /** Bottom navigation slot, rendered only under the mobile breakpoint where the activity bar is hidden. */
22
+ tabBar?: ReactNode;
23
+ /** Expanded sidebar width in px; a Control tracks handle drags live. */
24
+ sidebarWidth?: ControlOrValue<number>;
25
+ /** Sidebar collapsed state — desktop hides the column, mobile closes the overlay. */
26
+ sidebarCollapsed?: ControlOrValue<boolean>;
27
+ /**
28
+ * Mobile sidebar overlay, in full-viewport form. Under the
29
+ * mobile breakpoint this control owns the slide-out (the
30
+ * docked `sidebarCollapsed` semantics are desktop-only
31
+ * there); above the breakpoint it is inert. Defaults to
32
+ * false — the mobile sidebar starts hidden and a consumer's
33
+ * button (typically in `tabBar`, which only exists on
34
+ * mobile) opens it.
35
+ */
36
+ mobileSidebarOpen?: ControlOrValue<boolean>;
37
+ /** Expanded auxiliary bar width in px; a Control tracks handle drags live. */
38
+ auxiliaryBarWidth?: ControlOrValue<number>;
39
+ /** Auxiliary bar collapsed state — desktop hides the column, mobile closes the overlay. */
40
+ auxiliaryBarCollapsed?: ControlOrValue<boolean>;
41
+ /** Expanded bottom panel height in px; a Control tracks handle drags live. */
42
+ panelHeight?: ControlOrValue<number>;
43
+ /** Bottom panel collapsed state. */
44
+ panelCollapsed?: ControlOrValue<boolean>;
45
+ /** Maximized panel covers the whole main column; reversible through the same Control. */
46
+ panelMaximized?: ControlOrValue<boolean>;
47
+ children: ReactNode;
48
+ } & Omit<ComponentPropsWithoutRef<'div'>, 'children'>;
49
+ export default function Workbench({ activityBar: activityBarSlot, activityBarPosition: activityBarPositionControl, sidebar: sidebarSlot, auxiliaryBar: auxiliaryBarSlot, panel: panelSlot, statusBar: statusBarSlot, tabBar: tabBarSlot, sidebarWidth: sidebarWidthControl, sidebarCollapsed: sidebarCollapsedProp, mobileSidebarOpen: mobileSidebarOpenControl, auxiliaryBarWidth: auxiliaryBarWidthControl, auxiliaryBarCollapsed: auxiliaryBarCollapsedProp, panelHeight: panelHeightControl, panelCollapsed: panelCollapsedProp, panelMaximized: panelMaximizedProp, className, style, children, ...rest }: WorkbenchProps): import("react").JSX.Element;
50
+ export type { WorkbenchProps };
@@ -0,0 +1,2 @@
1
+ export { default as Workbench } from './Workbench';
2
+ export type { WorkbenchProps } from './Workbench';
@@ -18,7 +18,8 @@
18
18
  */
19
19
  /** Civil date parts in a specific calendar. `month` is 0-based — the
20
20
  * same `Date#getMonth` convention every date.ts function uses (0 = the
21
- * calendar's first month, 11 = its last) — while `day` is 1-based. */
21
+ * calendar's first month; 11 in 12-month calendars, 12 in hebrew leap
22
+ * years and ethiopic's Pagume-ending years) — while `day` is 1-based. */
22
23
  export type CivilDateParts = {
23
24
  year: number;
24
25
  month: number;
@@ -28,8 +29,12 @@ export type CivilDateParts = {
28
29
  * Umm al-Qura tabulation Node and browsers ship in full ICU; valid there
29
30
  * roughly 1300–1600 AH (Gregorian ~1882–2174), beyond which ICU falls
30
31
  * back to computed approximations (still self-consistent through this
31
- * adapter, which routes every conversion through Intl). */
32
- export type HazeCalendarIdentifier = 'gregory' | 'islamic-umalqura';
32
+ * adapter, which routes every conversion through Intl). The five
33
+ * algorithmic calendars (`persian`, `hebrew`, `japanese`, `buddhist`,
34
+ * `ethiopic`) are integer-arithmetic implementations whose outputs are
35
+ * cross-verified against Intl in their tests — see each adapter module
36
+ * for its supported range. */
37
+ export type HazeCalendarIdentifier = 'gregory' | 'islamic-umalqura' | 'persian' | 'hebrew' | 'japanese' | 'buddhist' | 'ethiopic';
33
38
  /** Month-name width, mirroring Intl's `month` option values. */
34
39
  export type MonthNameStyle = 'long' | 'short' | 'narrow';
35
40
  /**
@@ -57,9 +62,12 @@ export type HazeDateAdapter = {
57
62
  * day 29 when that month has 29 days). Pure integer arithmetic on the
58
63
  * month index — no Date rollover hazards. */
59
64
  addMonths(parts: CivilDateParts, delta: number): CivilDateParts;
60
- /** Twelve month names, index 0 = first month of the calendar year.
61
- * `locale` defaults to the adapter's base presentation locale ('en'
62
- * for the built-ins, matching Intl's calendar-extended locales). */
65
+ /** Month names for one full cycle of the calendar year, index 0 =
66
+ * first month of the calendar year. Twelve entries for 12-month
67
+ * calendars; thirteen where the calendar always has a thirteenth
68
+ * month (ethiopic's Pagume). `locale` defaults to the adapter's base
69
+ * presentation locale ('en' for the built-ins, matching Intl's
70
+ * calendar-extended locales). */
63
71
  monthNames(locale?: string, style?: MonthNameStyle): string[];
64
72
  /** Era abbreviation for a year ("AH" for Hijri, "AD"/"BC" for
65
73
  * Gregorian), via Intl. Optional: consumers that render no era skip
@@ -72,3 +80,22 @@ export type HazeDateAdapter = {
72
80
  * (internal helper; not part of the public dates surface).
73
81
  */
74
82
  export declare function eraOfDate(date: Date, calendar: HazeCalendarIdentifier, locale: string): string;
83
+ /**
84
+ * UTC-civil milliseconds of a proleptic (year, month, day) triple. The
85
+ * `setUTCFullYear` route sidesteps the constructor's two-digit-year →
86
+ * 19xx remap, which the algorithmic adapters need for far-past eras
87
+ * (ethiopic year 1 maps to 8 CE; buddhist year 608 to 65 CE). Shared
88
+ * implementation behind the algorithmic adapters' conversions (internal
89
+ * helper; not part of the public dates surface).
90
+ */
91
+ export declare function utcCivilMs(year: number, month: number, day: number): number;
92
+ /**
93
+ * Local-midnight Date materializing a UTC civil instant — the date.ts
94
+ * civil semantics every adapter's `toGregorian` must produce. The
95
+ * constructor already builds exact local midnights; only its
96
+ * two-digit-year → 19xx remap needs dodging (ethiopic year 1 maps to
97
+ * 8 CE), which `setFullYear` — unlike the constructor — does while
98
+ * preserving the midnight time-of-day. Internal helper; not part of
99
+ * the public dates surface.
100
+ */
101
+ export declare function localMidnightOf(ms: number): Date;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Buddhist-calendar adapter (Theravāda calendar as used in Thailand
3
+ * etc.). Structurally identical to the Gregorian calendar — same month
4
+ * lengths, same leap years — with the year counted in the Buddhist Era
5
+ * (BE), a constant +543 offset from the Gregorian year (2569 BE =
6
+ * 2026 CE). Month names come from Intl with the calendar pinned to
7
+ * `buddhist`, which renders the locale's ordinary month names; the era
8
+ * piece reports "BE". Because the offset is constant, every operation
9
+ * delegates to the shared Gregorian math in
10
+ * `src/lib/components/Calendar/date.ts` after translating the year,
11
+ * exactly like gregory.ts's shim.
12
+ */
13
+ import type { HazeDateAdapter } from './adapter';
14
+ export declare const buddhistAdapter: HazeDateAdapter;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Ethiopic calendar adapter (Amete Mihret era, as used in Ethiopia and
3
+ * Eritrea): twelve 30-day months plus the 13th short month Pagume (5
4
+ * days, 6 in leap years — year ≡ 3 mod 4), the extra day keeping New
5
+ * Year (1 Maskaram) on September 11, drifting to September 12 after a
6
+ * leap year. Structurally the Ge'ez calendar with the Incarnation
7
+ * epoch: 1 Maskaram 1 AME = 8 CE August 29 (Julian), JDN 1724221. All
8
+ * math is integer day-number arithmetic against that epoch (whole
9
+ * days, no DST drift); results materialize as local-midnight Dates per
10
+ * the date.ts civil semantics. ICU's `ethiopic` calendar agrees with
11
+ * this arithmetic — ethiopic.test.ts's Intl oracle grid is the standing
12
+ * proof.
13
+ */
14
+ import type { HazeDateAdapter } from './adapter';
15
+ export declare const ethiopicAdapter: HazeDateAdapter;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Hebrew (Jewish) civil calendar adapter — the fixed arithmetic
3
+ * rabbinical calendar (Hillel II): 19-year Metonic cycle with leap
4
+ * years 3/6/8/11/14/17/19 inserting Adar I/II, lunar months of 29/30
5
+ * days anchored by the molad (mean lunation of 29d 12h 793 parts) plus
6
+ * the four postponement rules that place Rosh Hashanah, and
7
+ * defective/regular/complete year types that vary only Heshvan and
8
+ * Kislev. Month indices are positional within the civil year (Tishri =
9
+ * 0): common years run 0–11 with Adar at 5; leap years run 0–12 with
10
+ * Adar I at 5 and Adar II at 6. ICU's `hebrew` calendar agrees with
11
+ * this arithmetic — hebrew.test.ts's Intl oracle grid (month names
12
+ * cross-walked to positional indices) is the standing proof.
13
+ *
14
+ * All math runs on integer day numbers (whole days, no DST drift) and
15
+ * results materialize as local-midnight Dates per the date.ts civil
16
+ * semantics.
17
+ */
18
+ import type { HazeDateAdapter } from './adapter';
19
+ export declare const hebrewAdapter: HazeDateAdapter;
@@ -1,5 +1,10 @@
1
1
  export { gregoryAdapter } from './gregory';
2
2
  export { islamicUmalquraAdapter } from './islamic';
3
+ export { persianAdapter } from './persian';
4
+ export { hebrewAdapter } from './hebrew';
5
+ export { japaneseAdapter } from './japanese';
6
+ export { buddhistAdapter } from './buddhist';
7
+ export { ethiopicAdapter } from './ethiopic';
3
8
  export { getAdapter } from './registry';
4
9
  export type { CivilDateParts, HazeDateAdapter, HazeCalendarIdentifier, MonthNameStyle, } from './adapter';
5
10
  export { formatInTimeZone, getZonedParts } from './timezone';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Japanese imperial-calendar adapter. ICU's `japanese` calendar is the
3
+ * Gregorian calendar with era-relative year display: month lengths,
4
+ * leap years, and weekday math are structurally identical to gregory,
5
+ * and only the year's *label* segments at imperial accessions (Reiwa 8
6
+ * = 2026 CE). The adapter therefore keeps the year field at its plain
7
+ * Gregorian numeric value — era segmentation is a formatting concern
8
+ * delegated to Intl's era piece (see `era`, which reports the era in
9
+ * force on June 1 of the year, i.e. after the May 1/January 8
10
+ * accessions of the modern eras) — so month arithmetic, grid math, and
11
+ * Date round-trips stay monotonic and hazard-free. Month names come
12
+ * from Intl with the calendar pinned to `japanese`, which renders
13
+ * plain month names in the requested locale.
14
+ */
15
+ import type { HazeDateAdapter } from './adapter';
16
+ export declare const japaneseAdapter: HazeDateAdapter;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Persian (Solar Hijri / Jalaali) adapter — the arithmetic calendar in
3
+ * official use in Iran and Afghanistan. Twelve solar months (six 31-day,
4
+ * five 30-day, Esfand 29 or 30) kept equinox-locked by the public-domain
5
+ * Borkowski algorithm that jalaali-js / moment-jalaali popularized: a
6
+ * breaks table that restarts the 33-year leap pattern at observed
7
+ * corrections, tracking the astronomical calendar across 1178–1633 AP
8
+ * (Gregorian 1799–2255). Node and browsers compute `persian` in full ICU
9
+ * with the same arithmetic, so this implementation and Intl agree over
10
+ * the whole supported range — persian.test.ts's Intl oracle grid is the
11
+ * standing proof.
12
+ *
13
+ * Like the other algorithmic adapters (hebrew, ethiopic), all math runs
14
+ * on integer Julian Day Numbers (whole days, no DST drift) and results
15
+ * materialize as local-midnight Dates per the date.ts civil semantics.
16
+ */
17
+ import type { HazeDateAdapter } from './adapter';
18
+ export declare const persianAdapter: HazeDateAdapter;
@@ -7,7 +7,7 @@
7
7
  import type { HazeCalendarIdentifier, HazeDateAdapter } from './adapter';
8
8
  /**
9
9
  * Adapter lookup by calendar identifier. Returns the shared singleton
10
- * adapters (`gregoryAdapter`, `islamicUmalquraAdapter`); throws
10
+ * adapters (`gregoryAdapter`, `islamicUmalquraAdapter`, …); throws
11
11
  * `RangeError` for identifiers with no built-in adapter.
12
12
  */
13
13
  export declare function getAdapter(identifier: HazeCalendarIdentifier): HazeDateAdapter;
@@ -17,6 +17,7 @@
17
17
  * major version. The primitives still evolve alongside the library's
18
18
  * own components, within that contract.
19
19
  */
20
+ import { useBusyPressable } from '../hooks/useBusyPressable';
20
21
  import { useClickOutside } from '../hooks/useClickOutside';
21
22
  import { hotkey, useHotkeys } from '../hooks/useHotkeys';
22
23
  import { useInView } from '../hooks/useInView';
@@ -378,6 +379,14 @@ export type { UseInViewOptions } from '../hooks/useInView';
378
379
  * get a stable `false` instead of a throw.
379
380
  */
380
381
  export { useMediaQuery };
382
+ /**
383
+ * Props bag for a pressable that can enter a busy/loading state —
384
+ * `disabled` forced while busy, `aria-busy` mirrored. The behavior
385
+ * half of `Button`'s/`ButtonLink`'s `loading` prop, for consumers
386
+ * composing their own trigger. Anchors translate `disabled` to
387
+ * `aria-disabled` (see ButtonLink).
388
+ */
389
+ export { useBusyPressable };
381
390
  /**
382
391
  * The value from the previous render; `undefined` on the first.
383
392
  * Compared by identity per render — no deep equality.
@@ -1,3 +1,4 @@
1
+ export { useBusyPressable } from './useBusyPressable';
1
2
  export { useClipboard } from './useClipboard';
2
3
  export type { UseClipboardResult } from './useClipboard';
3
4
  export { useClickOutside } from './useClickOutside';
@@ -14,6 +15,18 @@ export { useInView } from './useInView';
14
15
  export type { UseInViewOptions } from './useInView';
15
16
  export { useLocalStorage } from './useLocalStorage';
16
17
  export { useMediaQuery } from './useMediaQuery';
18
+ export { useElementSize } from './useElementSize';
19
+ export type { ElementSize, UseElementSizeOptions, UseElementSizeResult, } from './useElementSize';
20
+ export { useIdle } from './useIdle';
21
+ export type { UseIdleOptions, UseIdleResult } from './useIdle';
22
+ export { useMutationObserver } from './useMutationObserver';
23
+ export type { UseMutationObserverOptions, UseMutationObserverResult, } from './useMutationObserver';
24
+ export { useNetwork } from './useNetwork';
25
+ export type { NetworkSnapshot } from './useNetwork';
26
+ export { useOrientation } from './useOrientation';
27
+ export type { OrientationSnapshot } from './useOrientation';
28
+ export { useResizeObserver } from './useResizeObserver';
29
+ export type { UseResizeObserverOptions, UseResizeObserverResult, } from './useResizeObserver';
17
30
  export { usePrefersReducedMotion } from './usePrefersReducedMotion';
18
31
  export { usePrevious } from './usePrevious';
19
32
  export { useSessionStorage } from './useSessionStorage';
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Props bag for a pressable that can enter a busy/loading state — the
3
+ * behavior half of `Button`'s `loading` prop, for consumers composing
4
+ * their own trigger (list rows, table actions, custom submit
5
+ * controls):
6
+ *
7
+ * ```tsx
8
+ * const busyProps = useBusyPressable(submitting, disabledProp);
9
+ * <button {...busyProps} onClick={submit}>
10
+ * {submitting ? <Spinner size="sm" /> : null}
11
+ * Save
12
+ * </button>
13
+ * ```
14
+ *
15
+ * The bag carries exactly two things:
16
+ *
17
+ * - `disabled` — forced `true` while busy, so activation (click, Enter,
18
+ * form submission via `type="submit"`) is blocked at the platform
19
+ * level, not by convention. When a caller's own `disabled` is
20
+ * supplied, busy ORs into it — busy never *re-enables* a disabled
21
+ * control.
22
+ * - `aria-busy` — mirrors the busy phase to assistive technology; pair
23
+ * the swapped-in indicator with `aria-hidden` (or a labeled status
24
+ * spinner) so it is not double-announced.
25
+ *
26
+ * Anchors have no `disabled` attribute: when the pressable is an
27
+ * `<a>`, translate to `aria-disabled` + `tabIndex={-1}` the way
28
+ * `ButtonLink` does.
29
+ */
30
+ export declare function useBusyPressable(busy?: boolean, disabled?: boolean): {
31
+ disabled: boolean;
32
+ 'aria-busy': true | undefined;
33
+ };
@@ -0,0 +1,38 @@
1
+ import type { RefCallback } from 'react';
2
+ type ElementSize = {
3
+ width: number;
4
+ height: number;
5
+ };
6
+ type UseElementSizeOptions = {
7
+ /** 观测盒,同 ResizeObserver(默认 'content-box')。 */
8
+ box?: ResizeObserverBoxOptions;
9
+ /** 是否启用,默认 `true`。 */
10
+ enabled?: boolean;
11
+ };
12
+ type UseElementSizeResult<T extends Element = Element> = [
13
+ ref: RefCallback<T>,
14
+ size: ElementSize
15
+ ];
16
+ /**
17
+ * 元素 size 追踪(useResizeObserver 的简化形态——只吐 width/height)。
18
+ *
19
+ * ```tsx
20
+ * const [ref, size] = useElementSize<HTMLDivElement>();
21
+ * return <div ref={ref}>{size.width}×{size.height}</div>;
22
+ * ```
23
+ *
24
+ * - 底层 ResizeObserver;仅在 size 实际变化时 setState,避免子像素
25
+ * 抖动引发反复重渲。
26
+ * - `enabled=false` / 卸载时 size 清零(与 useResizeObserver 的冻结
27
+ * 语义相反:size 是原始数据,禁用后无订阅的冻结值是陈旧数据;
28
+ * entry 是结构化快照,那边反而选择冻结——详见其文档)。
29
+ * - ref 回调身份稳定(useCallback):React 19 对每个新 ref 函数会
30
+ * null-detach + re-attach,这里的 ref 只在 box/enabled 变化时才新建。
31
+ * - SSR:size 恒 `{0,0}`,无 hydration mismatch;无 ResizeObserver
32
+ * 环境(jsdom ≤23 / 老引擎)静默降级。
33
+ *
34
+ * @param options 见 {@link UseElementSizeOptions}。
35
+ * @returns `[ref, size]`。
36
+ */
37
+ export declare function useElementSize<T extends Element = Element>(options?: UseElementSizeOptions): UseElementSizeResult<T>;
38
+ export type { ElementSize, UseElementSizeOptions, UseElementSizeResult };
@@ -0,0 +1,45 @@
1
+ type UseIdleOptions = {
2
+ /**
3
+ * 判定 idle 的时间窗口(毫秒),默认 `60_000`(1 分钟)。
4
+ */
5
+ timeout?: number;
6
+ /**
7
+ * 哪些 DOM 事件「重置」idle(默认覆盖鼠标/键盘/触摸/滚动/visibilitychange)。
8
+ * 传空数组应当视为「只按 visibility 判定」,改用 `useNetwork` / 手动控制。
9
+ */
10
+ events?: (keyof WindowEventMap)[];
11
+ /**
12
+ * 首个事件目标:默认 `document`;显式传 window 时会同时监听
13
+ * document visibilitychange(不可绕过)。
14
+ */
15
+ element?: HTMLElement | Window | null | undefined;
16
+ /**
17
+ * 初始 idle 状态,默认 `false`(没收到任何事件前不认为空闲)。
18
+ * SSR 默认同此。
19
+ */
20
+ initialState?: boolean;
21
+ };
22
+ type UseIdleResult = {
23
+ /** 当前是否 idle(距最后一个事件超过 timeout)。 */
24
+ idle: boolean;
25
+ /** 最近一次活动的时间戳(epoch ms);无活动时为挂载时间。 */
26
+ lastActive: number;
27
+ };
28
+ /**
29
+ * 检测用户是否「空闲」(无鼠标/键盘/触摸/滚动活动超过 `timeout` 毫秒)。
30
+ *
31
+ * ```tsx
32
+ * const { idle, lastActive } = useIdle({ timeout: 5_000 });
33
+ * if (idle) return <AwayBadge />;
34
+ * ```
35
+ *
36
+ * - 触发源走「document 捕获」:子应用嵌套(dialog 内部点击)也算活动。
37
+ * - `visibilitychange` 强制同步:切走 tab 不重置计时;切回来先更新状态再算 idle。
38
+ * - SSR:isServer → idle=initialState,不挂监听。
39
+ * - 引擎无 timer(纯 SSR/单测起点):state 以 initialState 兜底、不调度。
40
+ *
41
+ * @param options 见 {@link UseIdleOptions}。
42
+ * @returns `{idle, lastActive}`。
43
+ */
44
+ export declare function useIdle(options?: UseIdleOptions): UseIdleResult;
45
+ export type { UseIdleOptions, UseIdleResult };
@@ -0,0 +1,35 @@
1
+ import type { RefCallback } from 'react';
2
+ type UseMutationObserverOptions = MutationObserverInit & {
3
+ /**
4
+ * 是否启用。默认 `true`;`false` 时快照冻结为最后一次观测值,
5
+ * 不建立观察器。
6
+ */
7
+ enabled?: boolean;
8
+ };
9
+ type UseMutationObserverResult = [
10
+ ref: RefCallback<Element>,
11
+ records: MutationRecord[]
12
+ ];
13
+ /**
14
+ * 通用 MutationObserver 订阅:观察元素的 attributes/childList/
15
+ * characterData 变化(由 options 决定)。
16
+ *
17
+ * ```tsx
18
+ * const [ref, mutations] = useMutationObserver(
19
+ * (records) => { console.log(records); },
20
+ * { attributes: true, attributeFilter: ['data-state'], subtree: false }
21
+ * );
22
+ * ```
23
+ *
24
+ * - 必须显式传 options(MutationObserverInit)——没有监听类型的
25
+ * MutationObserver 是非法用法。
26
+ * - ref 重挂时自动切换观察目标;history 不保留。
27
+ * - SSR:不观察,records 恒 `[]`。
28
+ *
29
+ * @param callback 收到记录时调用(可为 null / 省略,表示只更新 state)。
30
+ * @param options MutationObserver init 选项 + enabled。
31
+ * @returns `[ref, records]`:records 是最新一批 MutationRecord 列表
32
+ * (每次回调都新建数组——适合直接 `.map`)。
33
+ */
34
+ export declare function useMutationObserver(callback: MutationCallback | null | undefined, options: UseMutationObserverOptions): UseMutationObserverResult;
35
+ export type { UseMutationObserverOptions, UseMutationObserverResult };
@@ -0,0 +1,31 @@
1
+ type NetworkSnapshot = {
2
+ /** 当前在线状态;SSR/无 navigator 环境恒 `true`(假设在线)。 */
3
+ online: boolean;
4
+ /**
5
+ * 连接元信息(effectiveType/downlink/rtt/saveData)。仅部分浏览器
6
+ * 暴露 `navigator.connection`;单测/SSR/未支持浏览器全部为 undefined。
7
+ */
8
+ effectiveType?: string;
9
+ downlink?: number;
10
+ rtt?: number;
11
+ saveData?: boolean;
12
+ };
13
+ /**
14
+ * 网络在线状态 + 可选 `navigator.connection` 连接元信息。
15
+ *
16
+ * ```tsx
17
+ * const { online, effectiveType, saveData } = useNetwork();
18
+ * if (!online) return <OfflineBanner />;
19
+ * ```
20
+ *
21
+ * - 底层 `useSyncExternalStore('online/offline/connection.change')`——
22
+ * 状态切换自动触发 React 重新渲染,撕裂防护由 React 官方语义兜底。
23
+ * - SSR:恒返回 `{online: true}`,不产生 hydration mismatch(React
24
+ * 收不到 onChange 时保持首帧快照)。
25
+ * - 浏览器不支持 `navigator.connection`(FF/Safari ≤15):connection
26
+ * 相关字段 undefined、`online` 仍正确。
27
+ *
28
+ * @returns 当前网络状态快照。所有字段在事件触发后原子更新(同一 tick)。
29
+ */
30
+ export declare function useNetwork(): NetworkSnapshot;
31
+ export type { NetworkSnapshot };
@@ -0,0 +1,23 @@
1
+ export type OrientationSnapshot = {
2
+ /** 屏幕朝角:0/90/180/270,纵向起点 0。 */
3
+ angle: number;
4
+ /** 屏幕方向分类:landscape-primary/portrait-primary/landscape-secondary/portrait-secondary。 */
5
+ type: OrientationType;
6
+ };
7
+ /**
8
+ * 当前屏幕方向(screen.orientation + change 事件订阅)。
9
+ *
10
+ * ```tsx
11
+ * const { angle, type } = useOrientation();
12
+ * if (type.startsWith('landscape')) return <WideLayout />;
13
+ * ```
14
+ *
15
+ * - 使用 `useSyncExternalStore` 状态源:渲染与事件切换之间的撕裂由
16
+ * React 收敛,无需手动维护两套 useState。
17
+ * - SSR/无 orientation API(老 jsdom):恒返回 portrait-primary/0°。
18
+ * - 视觉上「横/竖」的判断可用 `window.screen.orientation.type.startsWith('landscape')`
19
+ * 或者 angle % 180 !== 0。
20
+ *
21
+ * @returns 当前屏幕方向快照。
22
+ */
23
+ export declare function useOrientation(): OrientationSnapshot;