@unicom-cloud/ui-common 0.1.58 → 0.1.60

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 (437) hide show
  1. package/.virtual/_rolldown/runtime.js +1 -1
  2. package/animation/Animation.js +41 -42
  3. package/animation/constants.d.ts +2 -0
  4. package/animation/constants.js +4 -4
  5. package/animation/context.d.ts +0 -1
  6. package/animation/context.js +3 -3
  7. package/animation/index.d.ts +0 -6
  8. package/animation/index.js +6 -10
  9. package/animation/interface.d.ts +1 -1
  10. package/animation/style/index.js +1 -1
  11. package/animation/utils.js +1 -1
  12. package/base/Base.js +1 -1
  13. package/base/constants.d.ts +2 -0
  14. package/base/constants.js +4 -1
  15. package/base/context.d.ts +0 -1
  16. package/base/context.js +3 -3
  17. package/base/index.js +1 -1
  18. package/base/style/index.js +1 -1
  19. package/base/utils.js +1 -1
  20. package/border-beam/BorderBeam.js +14 -14
  21. package/border-beam/Effect.d.ts +1 -6
  22. package/border-beam/Effect.js +3 -3
  23. package/border-beam/constants.d.ts +2 -1
  24. package/border-beam/constants.js +8 -3
  25. package/border-beam/context.d.ts +0 -1
  26. package/border-beam/context.js +4 -10
  27. package/border-beam/hooks/useBorderSize.d.ts +1 -5
  28. package/border-beam/hooks/useBorderSize.js +1 -1
  29. package/border-beam/hooks/useChildDom.d.ts +1 -1
  30. package/border-beam/hooks/useChildDom.js +1 -1
  31. package/border-beam/index.d.ts +0 -6
  32. package/border-beam/index.js +5 -9
  33. package/border-beam/interface.d.ts +27 -4
  34. package/border-beam/style/index.js +1 -1
  35. package/border-beam/utils.d.ts +1 -9
  36. package/border-beam/utils.js +9 -9
  37. package/development/Development.js +6 -5
  38. package/development/constants.d.ts +2 -0
  39. package/development/constants.js +4 -1
  40. package/development/context.d.ts +0 -1
  41. package/development/context.js +3 -3
  42. package/development/index.d.ts +0 -6
  43. package/development/index.js +5 -9
  44. package/development/style/index.js +1 -1
  45. package/development/utils.js +1 -1
  46. package/empty/Empty.d.ts +1 -1
  47. package/empty/Empty.js +28 -27
  48. package/empty/constants.d.ts +2 -0
  49. package/empty/constants.js +4 -1
  50. package/empty/context.d.ts +0 -1
  51. package/empty/context.js +3 -3
  52. package/empty/index.d.ts +1 -7
  53. package/empty/index.js +5 -9
  54. package/empty/style/index.js +1 -1
  55. package/empty/utils.js +1 -1
  56. package/flex/Flex.js +5 -4
  57. package/flex/FlexVertical.js +1 -1
  58. package/flex/constants.d.ts +2 -0
  59. package/flex/constants.js +7 -1
  60. package/flex/context.d.ts +0 -1
  61. package/flex/context.js +3 -6
  62. package/flex/index.d.ts +1 -7
  63. package/flex/index.js +9 -11
  64. package/flex/interface.d.ts +1 -1
  65. package/flex/style/index.js +1 -1
  66. package/flex/utils.d.ts +1 -1
  67. package/flex/utils.js +10 -12
  68. package/grid/Grid.js +16 -15
  69. package/grid/Item.js +10 -9
  70. package/grid/constants.d.ts +3 -0
  71. package/grid/constants.js +8 -1
  72. package/grid/context.d.ts +0 -2
  73. package/grid/context.js +4 -8
  74. package/grid/index.d.ts +0 -6
  75. package/grid/index.js +9 -11
  76. package/grid/style/index.js +1 -1
  77. package/grid/utils.js +1 -1
  78. package/higher-order/with-speech-synthesis/constants.d.ts +2 -0
  79. package/higher-order/with-speech-synthesis/constants.js +7 -0
  80. package/higher-order/with-speech-synthesis/context.d.ts +0 -1
  81. package/higher-order/with-speech-synthesis/context.js +3 -3
  82. package/higher-order/with-speech-synthesis/index.d.ts +0 -6
  83. package/higher-order/with-speech-synthesis/index.js +5 -9
  84. package/higher-order/with-speech-synthesis/style/index.js +1 -1
  85. package/higher-order/with-speech-synthesis/withSpeechSynthesis.d.ts +8 -1
  86. package/higher-order/with-speech-synthesis/withSpeechSynthesis.js +28 -27
  87. package/hoc/withContext.js +1 -1
  88. package/hooks/create-deep-compare-effect/index.js +1 -1
  89. package/hooks/create-update-effect/index.js +1 -1
  90. package/hooks/create-use-storage-state/index.js +9 -9
  91. package/hooks/index.d.ts +1 -0
  92. package/hooks/index.js +93 -92
  93. package/hooks/use-async-effect/index.js +1 -1
  94. package/hooks/use-boolean/index.js +1 -1
  95. package/hooks/use-click-away/index.d.ts +7 -1
  96. package/hooks/use-click-away/index.js +20 -12
  97. package/hooks/use-computed-state/index.js +1 -1
  98. package/hooks/use-controllable-value/index.js +1 -1
  99. package/hooks/use-cookie-state/index.js +2 -2
  100. package/hooks/use-count-down/index.js +1 -1
  101. package/hooks/use-counter/index.js +1 -1
  102. package/hooks/use-create/index.js +6 -5
  103. package/hooks/use-creation/index.js +7 -6
  104. package/hooks/use-debounce/debounceOptions.d.ts +1 -6
  105. package/hooks/use-debounce/index.js +1 -1
  106. package/hooks/use-debounce/interface.d.ts +14 -0
  107. package/hooks/use-debounce-effect/index.js +1 -1
  108. package/hooks/use-debounce-fn/index.js +5 -5
  109. package/hooks/use-deep-compare-effect/index.js +1 -1
  110. package/hooks/use-deep-compare-layout-effect/index.js +1 -1
  111. package/hooks/use-document-visibility/index.js +7 -7
  112. package/hooks/use-drag/index.d.ts +1 -1
  113. package/hooks/use-drag/index.js +10 -10
  114. package/hooks/use-drag-move/index.js +1 -1
  115. package/hooks/use-drop/index.d.ts +1 -1
  116. package/hooks/use-drop/index.js +1 -1
  117. package/hooks/use-dynamic-list/index.d.ts +18 -0
  118. package/hooks/use-dynamic-list/index.js +105 -0
  119. package/hooks/use-effect-event/index.js +1 -1
  120. package/hooks/use-event/index.js +1 -1
  121. package/hooks/use-event-emitter/index.d.ts +13 -1
  122. package/hooks/use-event-emitter/index.js +15 -12
  123. package/hooks/use-event-listener/index.d.ts +2 -7
  124. package/hooks/use-event-listener/index.js +1 -1
  125. package/hooks/use-event-target/index.js +1 -1
  126. package/hooks/use-external/index.js +2 -2
  127. package/hooks/use-favicon/index.js +2 -2
  128. package/hooks/use-focus-within/index.d.ts +1 -5
  129. package/hooks/use-focus-within/index.js +1 -1
  130. package/hooks/use-focus-within/interface.d.ts +13 -0
  131. package/hooks/use-force-update/index.js +1 -1
  132. package/hooks/use-fullscreen/index.js +14 -14
  133. package/hooks/use-get-state/index.d.ts +1 -7
  134. package/hooks/use-get-state/index.js +1 -1
  135. package/hooks/use-history-travel/index.d.ts +1 -1
  136. package/hooks/use-history-travel/index.js +32 -26
  137. package/hooks/use-hover/index.js +1 -1
  138. package/hooks/use-id/index.js +1 -1
  139. package/hooks/use-in-viewport/index.js +10 -10
  140. package/hooks/use-infinite-scroll/index.js +33 -31
  141. package/hooks/use-intersection-observer/index.js +3 -3
  142. package/hooks/use-intersection-observers/index.js +10 -10
  143. package/hooks/use-interval/index.js +1 -1
  144. package/hooks/use-is-first-render/index.js +1 -1
  145. package/hooks/use-isomorphic-layout-effect/index.js +1 -1
  146. package/hooks/use-key-press/index.js +1 -1
  147. package/hooks/use-keyboard-event/index.d.ts +1 -0
  148. package/hooks/use-keyboard-event/index.js +1 -1
  149. package/hooks/use-latest/index.js +1 -1
  150. package/hooks/use-listen-window-resize/index.js +1 -1
  151. package/hooks/use-local-storage-state/index.js +4 -4
  152. package/hooks/use-lock-fn/index.js +1 -1
  153. package/hooks/use-long-press/index.js +1 -1
  154. package/hooks/use-map/index.js +1 -1
  155. package/hooks/use-media/index.js +1 -1
  156. package/hooks/use-memo/index.js +1 -1
  157. package/hooks/use-memoized-fn/index.js +1 -1
  158. package/hooks/use-merge-component-props/index.d.ts +2 -2
  159. package/hooks/use-merge-component-props/index.js +2 -1
  160. package/hooks/use-merge-value/index.d.ts +1 -1
  161. package/hooks/use-merge-value/index.js +1 -1
  162. package/hooks/use-mobile/index.js +1 -1
  163. package/hooks/use-mount/index.js +1 -1
  164. package/hooks/use-mouse/index.d.ts +1 -1
  165. package/hooks/use-mouse/index.js +9 -9
  166. package/hooks/use-mutation-observer/index.js +2 -2
  167. package/hooks/use-mutation-observers/index.js +10 -10
  168. package/hooks/use-network/index.js +1 -1
  169. package/hooks/use-online-status/index.js +1 -1
  170. package/hooks/use-overflow-hidden/index.js +1 -1
  171. package/hooks/use-override-ref/index.d.ts +3 -5
  172. package/hooks/use-override-ref/index.js +5 -5
  173. package/hooks/use-pagination/index.js +1 -1
  174. package/hooks/use-pagination/types.d.ts +5 -8
  175. package/hooks/use-paste-file/index.js +9 -9
  176. package/hooks/use-paste-image/index.js +1 -1
  177. package/hooks/use-persist-callback/index.js +1 -1
  178. package/hooks/use-prefers-color-scheme-dark/index.js +1 -1
  179. package/hooks/use-previous/index.js +1 -1
  180. package/hooks/use-raf-interval/index.js +17 -17
  181. package/hooks/use-raf-state/index.d.ts +1 -6
  182. package/hooks/use-raf-state/index.js +1 -1
  183. package/hooks/use-raf-timeout/index.js +17 -17
  184. package/hooks/use-reactive/index.js +5 -5
  185. package/hooks/use-ref-latest/index.js +1 -1
  186. package/hooks/use-ref-map/index.d.ts +2 -1
  187. package/hooks/use-ref-map/index.js +1 -1
  188. package/hooks/use-refs/index.js +1 -1
  189. package/hooks/use-request/index.js +5 -5
  190. package/hooks/use-request/src/Fetch.d.ts +2 -0
  191. package/hooks/use-request/src/Fetch.js +32 -28
  192. package/hooks/use-request/src/plugins/useAutoRunPlugin.js +1 -1
  193. package/hooks/use-request/src/plugins/useCachePlugin.js +5 -5
  194. package/hooks/use-request/src/plugins/useDebouncePlugin.js +2 -2
  195. package/hooks/use-request/src/plugins/useLoadingDelayPlugin.js +13 -12
  196. package/hooks/use-request/src/plugins/usePollingPlugin.js +3 -3
  197. package/hooks/use-request/src/plugins/useRefreshOnWindowFocusPlugin.js +1 -1
  198. package/hooks/use-request/src/plugins/useRetryPlugin.js +1 -1
  199. package/hooks/use-request/src/plugins/useThrottlePlugin.js +1 -1
  200. package/hooks/use-request/src/types.d.ts +2 -1
  201. package/hooks/use-request/src/useRequest.d.ts +11 -4
  202. package/hooks/use-request/src/useRequest.js +1 -1
  203. package/hooks/use-request/src/useRequestImplement.js +18 -18
  204. package/hooks/use-request/src/utils/cache.js +1 -1
  205. package/hooks/use-request/src/utils/cachePromise.js +1 -1
  206. package/hooks/use-request/src/utils/cacheSubscribe.js +1 -1
  207. package/hooks/use-request/src/utils/isDocumentVisible.js +1 -1
  208. package/hooks/use-request/src/utils/isOnline.js +3 -3
  209. package/hooks/use-request/src/utils/limit.js +1 -1
  210. package/hooks/use-request/src/utils/subscribeFocus.js +1 -1
  211. package/hooks/use-request/src/utils/subscribeReVisible.js +1 -1
  212. package/hooks/use-reset-state/index.js +6 -6
  213. package/hooks/use-resize-observer/index.d.ts +6 -1
  214. package/hooks/use-resize-observer/index.js +30 -4
  215. package/hooks/use-resize-observers/index.d.ts +1 -0
  216. package/hooks/use-resize-observers/index.js +23 -24
  217. package/hooks/use-responsive/index.js +2 -2
  218. package/hooks/use-safe-state/index.js +1 -1
  219. package/hooks/use-scroll/index.js +20 -20
  220. package/hooks/use-selections/index.d.ts +1 -1
  221. package/hooks/use-selections/index.js +45 -39
  222. package/hooks/use-session-storage-state/index.js +4 -4
  223. package/hooks/use-set/index.js +1 -1
  224. package/hooks/use-set-state/index.js +1 -1
  225. package/hooks/use-size/index.d.ts +1 -6
  226. package/hooks/use-size/index.js +4 -33
  227. package/hooks/use-state-callback/index.d.ts +1 -5
  228. package/hooks/use-state-callback/index.js +7 -7
  229. package/hooks/use-state-with-promise/index.d.ts +1 -4
  230. package/hooks/use-state-with-promise/index.js +1 -1
  231. package/hooks/use-sync-state/index.js +5 -5
  232. package/hooks/use-text-selection/index.js +1 -1
  233. package/hooks/use-theme/index.js +14 -14
  234. package/hooks/use-throttle/index.js +1 -1
  235. package/hooks/use-throttle/interface.d.ts +13 -0
  236. package/hooks/use-throttle/throttleOptions.d.ts +1 -5
  237. package/hooks/use-throttle-effect/index.js +5 -5
  238. package/hooks/use-throttle-fn/index.js +5 -5
  239. package/hooks/use-throttle-fn-with-raf/index.js +6 -6
  240. package/hooks/use-timeout/index.js +1 -1
  241. package/hooks/use-title/index.js +5 -5
  242. package/hooks/use-toggle/index.d.ts +6 -3
  243. package/hooks/use-toggle/index.js +1 -1
  244. package/hooks/use-tracked-effect/index.js +1 -1
  245. package/hooks/use-unmount/index.js +1 -1
  246. package/hooks/use-unmounted-ref/index.js +1 -1
  247. package/hooks/use-update/index.js +1 -1
  248. package/hooks/use-update-effect/index.js +1 -1
  249. package/hooks/use-update-layout-effect/index.js +1 -1
  250. package/hooks/use-url-state/index.d.ts +1 -1
  251. package/hooks/use-url-state/index.js +1 -1
  252. package/hooks/use-virtual-list/index.js +13 -13
  253. package/hooks/use-watch/index.js +1 -1
  254. package/hooks/use-web-socket/index.js +7 -7
  255. package/hooks/use-why-did-you-update/index.js +1 -1
  256. package/hooks/use-window-size/index.js +7 -7
  257. package/hooks/utils/createEffectWithTarget.js +7 -7
  258. package/hooks/utils/depsAreSame.js +1 -1
  259. package/hooks/utils/depsEqual.js +1 -1
  260. package/hooks/utils/domTarget.js +1 -1
  261. package/hooks/utils/getDocumentOrShadow.js +1 -1
  262. package/hooks/utils/index.js +1 -1
  263. package/hooks/utils/isAppleDevice.js +1 -1
  264. package/hooks/utils/isBrowser.js +1 -1
  265. package/hooks/utils/isDev.js +1 -1
  266. package/hooks/utils/rect.js +1 -1
  267. package/hooks/utils/useDeepCompareWithTarget.js +4 -4
  268. package/hooks/utils/useEffectWithTarget.js +1 -1
  269. package/hooks/utils/useIsomorphicLayoutEffectWithTarget.js +1 -1
  270. package/hooks/utils/useLayoutEffectWithTarget.js +1 -1
  271. package/icons/file/File.js +5 -4
  272. package/icons/file/constants.d.ts +2 -0
  273. package/icons/file/constants.js +7 -0
  274. package/icons/file/context.d.ts +0 -1
  275. package/icons/file/context.js +3 -3
  276. package/icons/file/index.js +2 -2
  277. package/icons/file/style/index.js +1 -1
  278. package/index.d.ts +2 -2
  279. package/index.js +542 -537
  280. package/morphicons/core/interpolate.js +1 -1
  281. package/morphicons/core/normalize.js +57 -57
  282. package/morphicons/core/parse.d.ts +1 -9
  283. package/morphicons/core/resample.js +1 -1
  284. package/morphicons/core/serialize.js +1 -1
  285. package/morphicons/core/spring.js +1 -1
  286. package/morphicons/dom/controller.d.ts +3 -3
  287. package/morphicons/dom/index.js +23 -23
  288. package/morphicons/element/index.d.ts +1 -1
  289. package/morphicons/index.d.ts +1 -1
  290. package/morphicons/index.js +6 -6
  291. package/morphicons/react/index.d.ts +1 -1
  292. package/morphicons/react/index.js +65 -65
  293. package/package.json +1 -1
  294. package/progress/Progress.js +20 -20
  295. package/progress/constants.js +1 -1
  296. package/progress/context.js +1 -1
  297. package/progress/index.js +1 -1
  298. package/progress/style/index.js +1 -1
  299. package/progress/utils.js +1 -1
  300. package/resize-observer/Collection.js +1 -1
  301. package/resize-observer/ResizeObserver.js +13 -12
  302. package/resize-observer/SingleObserver.d.ts +1 -5
  303. package/resize-observer/SingleObserver.js +4 -4
  304. package/resize-observer/constants.d.ts +2 -0
  305. package/resize-observer/constants.js +4 -1
  306. package/resize-observer/context.d.ts +0 -1
  307. package/resize-observer/context.js +3 -3
  308. package/resize-observer/index.d.ts +1 -7
  309. package/resize-observer/index.js +7 -9
  310. package/resize-observer/interface.d.ts +18 -0
  311. package/resize-observer/observerUtil.d.ts +1 -1
  312. package/resize-observer/observerUtil.js +1 -1
  313. package/resize-observer/style/index.js +1 -1
  314. package/resize-observer/utils.js +1 -1
  315. package/space/Space.d.ts +2 -1
  316. package/space/Space.js +12 -11
  317. package/space/SpaceVertical.js +1 -1
  318. package/space/constants.d.ts +2 -0
  319. package/space/constants.js +9 -1
  320. package/space/context.d.ts +0 -1
  321. package/space/context.js +3 -8
  322. package/space/index.d.ts +0 -6
  323. package/space/index.js +8 -10
  324. package/space/interface.d.ts +1 -0
  325. package/space/style/index.js +1 -1
  326. package/space/utils.js +1 -1
  327. package/style/animation.less +2 -8
  328. package/style/normalize.less +0 -13
  329. package/style.css +1 -1
  330. package/suspense-fallback-test/NeverLoadLazy.d.ts +3 -0
  331. package/suspense-fallback-test/NeverLoadLazy.js +8 -0
  332. package/suspense-fallback-test/SuspenseFallbackTest.js +14 -14
  333. package/suspense-fallback-test/constants.d.ts +2 -0
  334. package/suspense-fallback-test/constants.js +4 -1
  335. package/suspense-fallback-test/context.d.ts +0 -2
  336. package/suspense-fallback-test/context.js +3 -3
  337. package/suspense-fallback-test/index.d.ts +0 -6
  338. package/suspense-fallback-test/index.js +5 -9
  339. package/suspense-fallback-test/style/index.js +1 -1
  340. package/suspense-fallback-test/utils.js +1 -1
  341. package/test.js +1 -1
  342. package/timer/Timer.js +6 -5
  343. package/timer/constants.d.ts +2 -0
  344. package/timer/constants.js +4 -1
  345. package/timer/context.d.ts +0 -1
  346. package/timer/context.js +3 -3
  347. package/timer/index.d.ts +0 -6
  348. package/timer/index.js +5 -9
  349. package/timer/style/index.js +1 -1
  350. package/timer/utils.js +1 -1
  351. package/transition/Transition.d.ts +0 -1
  352. package/transition/Transition.js +55 -58
  353. package/transition/TransitionCSS.js +15 -15
  354. package/transition/TransitionGroup.js +13 -13
  355. package/transition/TransitionStyle.js +12 -12
  356. package/transition/constants.d.ts +4 -27
  357. package/transition/constants.js +37 -41
  358. package/transition/context.d.ts +2 -3
  359. package/transition/context.js +4 -5
  360. package/transition/index.d.ts +0 -7
  361. package/transition/index.js +15 -16
  362. package/transition/interface.d.ts +26 -1
  363. package/transition/interface.js +11 -0
  364. package/transition/style/index.js +1 -1
  365. package/transition/utils.d.ts +1 -1
  366. package/transition/utils.js +1 -1
  367. package/utils/callbackOriginRef.js +1 -1
  368. package/utils/confetti.js +1 -1
  369. package/utils/constants.d.ts +3 -2
  370. package/utils/constants.js +6 -5
  371. package/utils/copy.js +1 -1
  372. package/utils/createRoot.d.ts +1 -6
  373. package/utils/createRoot.js +11 -11
  374. package/utils/css.js +1 -1
  375. package/utils/date.d.ts +1 -1
  376. package/utils/date.js +1 -1
  377. package/utils/dayjs.js +1 -1
  378. package/utils/document.js +1 -1
  379. package/utils/dom.d.ts +1 -1
  380. package/utils/dom.js +9 -9
  381. package/utils/file.js +1 -1
  382. package/utils/fillNBSP.js +1 -1
  383. package/utils/getCompatProp.js +1 -1
  384. package/utils/getElement.js +1 -1
  385. package/utils/getHighlightText.js +1 -1
  386. package/utils/getHotkeyHandler.d.ts +1 -12
  387. package/utils/getHotkeyHandler.js +17 -17
  388. package/utils/getPrefixCls.js +1 -1
  389. package/utils/getScrollBarHeight.js +1 -1
  390. package/utils/getScrollBarSize.js +1 -1
  391. package/utils/getScrollBarWidth.js +1 -1
  392. package/utils/getScrollParent.js +1 -1
  393. package/utils/getStringLength.js +1 -1
  394. package/utils/getUrlSearchParam.js +1 -1
  395. package/utils/index.js +274 -273
  396. package/utils/initAllLineClamp.js +1 -1
  397. package/utils/injectLineClamp.js +1 -1
  398. package/utils/interface.d.ts +103 -0
  399. package/utils/interface.js +4 -0
  400. package/utils/intersectionObserver.js +1 -1
  401. package/utils/is.js +1 -1
  402. package/utils/keyboardCode.js +1 -1
  403. package/utils/lodash.d.ts +2 -1
  404. package/utils/lodash.js +19 -18
  405. package/utils/math.d.ts +1 -1
  406. package/utils/mergeProps.d.ts +1 -2
  407. package/utils/mergeProps.js +1 -1
  408. package/utils/mergedToString.js +1 -1
  409. package/utils/migrateLegacyProps.d.ts +1 -8
  410. package/utils/migrateLegacyProps.js +1 -1
  411. package/utils/mutationObserver.js +1 -1
  412. package/utils/names.d.ts +1 -8
  413. package/utils/names.js +1 -1
  414. package/utils/object.js +1 -1
  415. package/utils/omit.js +1 -1
  416. package/utils/pad.js +1 -1
  417. package/utils/pick.js +1 -1
  418. package/utils/react19Adapter.js +1 -1
  419. package/utils/reactNode.js +1 -1
  420. package/utils/ref.d.ts +2 -1
  421. package/utils/ref.js +13 -13
  422. package/utils/resizeObserver.js +1 -1
  423. package/utils/scrollIntoViewIfNeeded.js +1 -1
  424. package/utils/scrollTo.js +1 -1
  425. package/utils/setDarkTheme.js +1 -1
  426. package/utils/setDir.js +1 -1
  427. package/utils/setPrimaryColor.js +1 -1
  428. package/utils/setTheme.js +1 -1
  429. package/utils/string.js +1 -1
  430. package/utils/style.js +1 -1
  431. package/utils/tinycolor.js +1 -1
  432. package/utils/toArray.js +1 -1
  433. package/utils/tunnel.d.ts +2 -12
  434. package/utils/tunnel.js +1 -1
  435. package/utils/warning.js +1 -1
  436. package/version/index.js +9 -9
  437. /package/{suspense-fallback-test → base}/style/index.css +0 -0
@@ -3,14 +3,11 @@ export type Data = {
3
3
  total: number;
4
4
  list: any[];
5
5
  };
6
- export type Params = [
7
- {
8
- current: number;
9
- pageSize: number;
10
- [key: string]: any;
11
- },
12
- ...any[]
13
- ];
6
+ export type Params = [{
7
+ current: number;
8
+ pageSize: number;
9
+ [key: string]: any;
10
+ }, ...any[]];
14
11
  export type Service<TData extends Data, TParams extends Params> = (...args: TParams) => Promise<TData>;
15
12
  export interface PaginationResult<TData extends Data, TParams extends Params> extends Result<TData, TParams> {
16
13
  pagination: {
@@ -1,19 +1,19 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
- import e from "../use-latest/index.js";
4
- import t from "../utils/domTarget.js";
5
- import n from "../use-memoized-fn/index.js";
6
- import { noop as r } from "../../utils/lodash.js";
7
- import { getDOM as i } from "../../utils/dom.js";
3
+ import { getDOM as e } from "../../utils/dom.js";
4
+ import { noop as t } from "../../utils/lodash.js";
5
+ import n from "../use-latest/index.js";
6
+ import r from "../use-memoized-fn/index.js";
7
+ import i from "../utils/domTarget.js";
8
8
  import { useEffect as a, useState as o } from "react";
9
9
  import { isArray as s, isArrayAndNotEmpty as c, isDocument as l, isElement as u, isFunction as d } from "@unicom-cloud/utils/is";
10
10
  // components/common/hooks/use-paste-file/index.ts
11
11
  var f = (e) => e.kind === "file";
12
- function p(p, m = r, h = []) {
13
- let { deps: g = [], filter: _ = f, disabled: v = !1 } = s(h) ? { deps: h } : h, y = e(m), b = e(_), [x, S] = o([]), C = n((e) => {
12
+ function p(p, m = t, h = []) {
13
+ let { deps: g = [], filter: _ = f, disabled: v = !1 } = s(h) ? { deps: h } : h, y = n(m), b = n(_), [x, S] = o([]), C = r((e) => {
14
14
  let t = (e.clipboardData || window.clipboardData).items, n = Array.from(t).filter((e) => b.current(e)).map((e) => e.getAsFile()).filter(Boolean), r = y.current;
15
15
  c(n) && d(r) && r(n), S(n);
16
- }), w = l(p) ? p : i(p) || t(p) || document;
16
+ }), w = l(p) ? p : e(p) || i(p) || document;
17
17
  return a(() => {
18
18
  if (!v && (l(w) || u(w, !0))) return w.addEventListener("paste", C), () => {
19
19
  w.removeEventListener("paste", C);
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import e from "../use-paste-file/index.js";
4
4
  // components/common/hooks/use-paste-image/index.ts
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import e from "../use-memoized-fn/index.js";
4
4
  // components/common/hooks/use-persist-callback/index.ts
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import { useEffect as e, useState as t } from "react";
4
4
  import { MATCH_MEDIA_PREFERS_COLOR_SCHEME_DARK as n } from "@unicom-cloud/utils/constants/matchMedia";
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import { useEffect as e, useRef as t } from "react";
4
4
  // components/common/hooks/use-previous/index.ts
@@ -1,30 +1,30 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import e from "../use-latest/index.js";
4
4
  import { useCallback as t, useEffect as n, useRef as r } from "react";
5
- import { isNumber as i, isUndefined as a } from "@unicom-cloud/utils/is";
5
+ import { isGlobalUndefined as i, isNumber as a, isUndefined as o } from "@unicom-cloud/utils/is";
6
6
  // components/common/hooks/use-raf-interval/index.ts
7
- var o = (e, t = 0) => {
8
- if (a(requestAnimationFrame)) return { id: setInterval(e, t) };
9
- let n = Date.now(), r = { id: 0 }, i = () => {
10
- let a = Date.now();
11
- r.id = requestAnimationFrame(i), a - n >= t && (e(), n = Date.now());
7
+ var s = (e, t = 0) => {
8
+ if (i("requestAnimationFrame")) return { id: setInterval(e, t) };
9
+ let n = Date.now(), r = { id: 0 }, a = () => {
10
+ let i = Date.now();
11
+ r.id = requestAnimationFrame(a), i - n >= t && (e(), n = Date.now());
12
12
  };
13
- return r.id = requestAnimationFrame(i), r;
14
- }, s = (e) => a(cancelAnimationFrame), c = (e) => {
15
- if (s(e.id)) return clearInterval(e.id);
13
+ return r.id = requestAnimationFrame(a), r;
14
+ }, c = (e) => o(cancelAnimationFrame), l = (e) => {
15
+ if (c(e.id)) return clearInterval(e.id);
16
16
  cancelAnimationFrame(e.id);
17
17
  };
18
- function l(a, s, l) {
19
- let u = l?.immediate, d = e(a), f = r(void 0), p = t(() => {
20
- f.current && c(f.current);
18
+ function u(i, o, c) {
19
+ let u = c?.immediate, d = e(i), f = r(void 0), p = t(() => {
20
+ f.current && l(f.current);
21
21
  }, []);
22
22
  return n(() => {
23
- if (i(s) && !(s < 0)) return u && d.current(), f.current = o(() => {
23
+ if (a(o) && !(o < 0)) return u && d.current(), f.current = s(() => {
24
24
  d.current();
25
- }, s), p;
26
- }, [s]), p;
25
+ }, o), p;
26
+ }, [o]), p;
27
27
  }
28
- export { l as default };
28
+ export { u as default };
29
29
  /* 欲穷千里目,更上一层楼 */
30
30
  /* 独立思考,明辨是非 */
@@ -1,7 +1,2 @@
1
- import { type Dispatch, type SetStateAction } from 'react';
2
- declare function useRafState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>];
3
- declare function useRafState<S = undefined>(): [
4
- S | undefined,
5
- Dispatch<SetStateAction<S | undefined>>
6
- ];
1
+ declare function useRafState<S>(initialState?: S | (() => S)): readonly [S | undefined, (value: S | ((prevState: S | undefined) => S)) => void];
7
2
  export default useRafState;
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import e from "../use-unmount/index.js";
4
4
  import { useCallback as t, useRef as n, useState as r } from "react";
@@ -1,29 +1,29 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import e from "../use-latest/index.js";
4
4
  import { useCallback as t, useEffect as n, useRef as r } from "react";
5
- import { isNumber as i, isUndefined as a } from "@unicom-cloud/utils/is";
5
+ import { isGlobalUndefined as i, isNumber as a, isUndefined as o } from "@unicom-cloud/utils/is";
6
6
  // components/common/hooks/use-raf-timeout/index.ts
7
- var o = (e, t = 0) => {
8
- if (a(requestAnimationFrame)) return { id: setTimeout(e, t) };
9
- let n = { id: 0 }, r = Date.now(), i = () => {
10
- Date.now() - r >= t ? e() : n.id = requestAnimationFrame(i);
7
+ var s = (e, t = 0) => {
8
+ if (i("requestAnimationFrame")) return { id: setTimeout(e, t) };
9
+ let n = { id: 0 }, r = Date.now(), a = () => {
10
+ Date.now() - r >= t ? e() : n.id = requestAnimationFrame(a);
11
11
  };
12
- return n.id = requestAnimationFrame(i), n;
13
- }, s = (e) => a(cancelAnimationFrame), c = (e) => {
14
- if (s(e.id)) return clearTimeout(e.id);
12
+ return n.id = requestAnimationFrame(a), n;
13
+ }, c = (e) => o(cancelAnimationFrame), l = (e) => {
14
+ if (c(e.id)) return clearTimeout(e.id);
15
15
  cancelAnimationFrame(e.id);
16
16
  };
17
- function l(a, s) {
18
- let l = e(a), u = r(void 0), d = t(() => {
19
- u.current && c(u.current);
17
+ function u(i, o) {
18
+ let c = e(i), u = r(void 0), d = t(() => {
19
+ u.current && l(u.current);
20
20
  }, []);
21
21
  return n(() => {
22
- if (i(s) && !(s < 0)) return u.current = o(() => {
23
- l.current();
24
- }, s), d;
25
- }, [s]), d;
22
+ if (a(o) && !(o < 0)) return u.current = s(() => {
23
+ c.current();
24
+ }, o), d;
25
+ }, [o]), d;
26
26
  }
27
- export { l as default };
27
+ export { u as default };
28
28
  /* 欲穷千里目,更上一层楼 */
29
29
  /* 独立思考,明辨是非 */
@@ -1,7 +1,7 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
- import e from "../use-update/index.js";
4
- import t from "../use-creation/index.js";
3
+ import e from "../use-creation/index.js";
4
+ import t from "../use-update/index.js";
5
5
  import { useRef as n } from "react";
6
6
  import { isArray as r, isPlainObject as i } from "@unicom-cloud/utils/is";
7
7
  // components/common/hooks/use-reactive/index.ts
@@ -27,8 +27,8 @@ function s(e, t) {
27
27
  return a.set(e, c), o.set(c, e), c;
28
28
  }
29
29
  function c(r) {
30
- let i = e(), a = n(r);
31
- return t(() => s(a.current, () => {
30
+ let i = t(), a = n(r);
31
+ return e(() => s(a.current, () => {
32
32
  i();
33
33
  }), []);
34
34
  }
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import e from "../use-latest/index.js";
4
4
  // components/common/hooks/use-ref-latest/index.ts
@@ -1,3 +1,4 @@
1
- declare function useRefMap<T>(defaultValue?: Map<React.Key, T>): readonly [(key: React.Key) => T | undefined, (key: React.Key, element: T) => void];
1
+ import { type Key } from 'react';
2
+ declare function useRefMap<T>(defaultValue?: Map<Key, T>): readonly [(key: Key) => T | undefined, (key: Key, element: T) => void];
2
3
  export { useRefMap };
3
4
  export default useRefMap;
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import { useRef as e } from "react";
4
4
  // components/common/hooks/use-ref-map/index.ts
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import { useRef as e } from "react";
4
4
  import { isUndefined as t } from "@unicom-cloud/utils/is";
@@ -1,9 +1,9 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
- import { clearCache as e } from "./src/utils/cache.js";
4
- import t from "./src/useRequest.js";
3
+ import e from "./src/useRequest.js";
4
+ import { clearCache as t } from "./src/utils/cache.js";
5
5
  // components/common/hooks/use-request/index.ts
6
- var n = t;
7
- export { e as clearCache, n as default };
6
+ var n = e;
7
+ export { t as clearCache, n as default };
8
8
  /* 欲穷千里目,更上一层楼 */
9
9
  /* 独立思考,明辨是非 */
@@ -7,6 +7,8 @@ export default class Fetch<TData, TParams extends any[]> {
7
7
  initState: Partial<FetchState<TData, TParams>>;
8
8
  pluginImpls: PluginReturn<TData, TParams>[];
9
9
  count: number;
10
+ /** 当前请求的 AbortController,用于 cancel 时打断底层 Promise */
11
+ private abortController;
10
12
  state: FetchState<TData, TParams>;
11
13
  constructor(serviceRef: RefObject<Service<TData, TParams>>, options: Options<TData, TParams>, subscribe: Subscribe, initState?: Partial<FetchState<TData, TParams>>);
12
14
  setState(s?: Partial<FetchState<TData, TParams>>): void;
@@ -1,10 +1,11 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
- import { isExist as e, isFunction as t } from "@unicom-cloud/utils/is";
3
+ import { callWith as e } from "../../../utils/call.js";
4
+ import { isExist as t, isFunction as n } from "@unicom-cloud/utils/is";
4
5
  // components/common/hooks/use-request/src/Fetch.ts
5
- var n = class {
6
+ var r = class {
6
7
  constructor(e, t, n, r = {}) {
7
- this.serviceRef = e, this.options = t, this.subscribe = n, this.initState = r, this.pluginImpls = [], this.count = 0, this.state = {
8
+ this.serviceRef = e, this.options = t, this.subscribe = n, this.initState = r, this.pluginImpls = [], this.count = 0, this.abortController = null, this.state = {
8
9
  loading: !1,
9
10
  params: void 0,
10
11
  data: void 0,
@@ -21,34 +22,37 @@ var n = class {
21
22
  ...e
22
23
  }, this.subscribe();
23
24
  }
24
- runPluginHandler(t, ...n) {
25
- let r = this.pluginImpls.map((e) => e[t]?.(...n)).filter(e);
25
+ runPluginHandler(e, ...n) {
26
+ let r = this.pluginImpls.map((t) => t[e]?.(...n)).filter(t);
26
27
  return Object.assign({}, ...r);
27
28
  }
28
- async runAsync(...e) {
29
+ async runAsync(...t) {
29
30
  this.count += 1;
30
- let t = this.count, { stopNow: n = !1, returnNow: r = !1, ...i } = this.runPluginHandler("onBefore", e);
31
- if (n || (this.setState({
31
+ let n = this.count, r = !!this.options.enableAbort, i;
32
+ r && (e(this.abortController, this.abortController?.abort), this.abortController = new AbortController(), i = this.abortController.signal);
33
+ let { stopNow: a = !1, returnNow: o = !1, ...s } = this.runPluginHandler("onBefore", t);
34
+ if (a || (this.setState({
32
35
  loading: !0,
33
- params: e,
34
- ...i
35
- }), r)) return Promise.resolve(i.data);
36
- this.options.onBefore?.(e);
36
+ params: t,
37
+ ...s
38
+ }), o)) return Promise.resolve(s.data);
39
+ this.options.onBefore?.(t);
37
40
  try {
38
- let { servicePromise: n } = this.runPluginHandler("onRequest", this.serviceRef.current, e);
39
- n ||= this.serviceRef.current(...e);
40
- let r = await n;
41
- return t === this.count ? (this.setState({
42
- data: r,
41
+ r && (t = [...t, { signal: i }]);
42
+ let { servicePromise: e } = this.runPluginHandler("onRequest", this.serviceRef.current, t);
43
+ e ||= this.serviceRef.current(...t);
44
+ let a = await e;
45
+ return n === this.count ? (r && (this.abortController = null), this.setState({
46
+ data: a,
43
47
  error: void 0,
44
48
  loading: !1
45
- }), this.options.onSuccess?.(r, e), this.runPluginHandler("onSuccess", r, e), this.options.onFinally?.(e, r, void 0), t === this.count && this.runPluginHandler("onFinally", e, r, void 0), r) : new Promise(() => {});
46
- } catch (n) {
47
- if (t !== this.count) return new Promise(() => {});
48
- throw this.setState({
49
- error: n,
49
+ }), this.options.onSuccess?.(a, t), this.runPluginHandler("onSuccess", a, t), this.options.onFinally?.(t, a, void 0), n === this.count && this.runPluginHandler("onFinally", t, a, void 0), a) : new Promise(() => {});
50
+ } catch (e) {
51
+ if (n !== this.count) return new Promise(() => {});
52
+ throw r && (this.abortController = null), this.setState({
53
+ error: e,
50
54
  loading: !1
51
- }), this.options.onError?.(n, e), this.runPluginHandler("onError", n, e), this.options.onFinally?.(e, void 0, n), t === this.count && this.runPluginHandler("onFinally", e, void 0, n), n;
55
+ }), this.options.onError?.(e, t), this.runPluginHandler("onError", e, t), this.options.onFinally?.(t, void 0, e), n === this.count && this.runPluginHandler("onFinally", t, void 0, e), e;
52
56
  }
53
57
  }
54
58
  run(...e) {
@@ -57,7 +61,7 @@ var n = class {
57
61
  });
58
62
  }
59
63
  cancel() {
60
- this.count += 1, this.setState({ loading: !1 }), this.runPluginHandler("onCancel");
64
+ this.count += 1, this.options.enableAbort && (e(this.abortController, this.abortController?.abort), this.abortController = null), this.setState({ loading: !1 }), this.runPluginHandler("onCancel");
61
65
  }
62
66
  refresh() {
63
67
  this.run(...this.state.params || []);
@@ -66,10 +70,10 @@ var n = class {
66
70
  return this.runAsync(...this.state.params || []);
67
71
  }
68
72
  mutate(e) {
69
- let n = t(e) ? e(this.state.data) : e;
70
- this.runPluginHandler("onMutate", n), this.setState({ data: n });
73
+ let t = n(e) ? e(this.state.data) : e;
74
+ this.runPluginHandler("onMutate", t), this.setState({ data: t });
71
75
  }
72
76
  };
73
- export { n as default };
77
+ export { r as default };
74
78
  /* 欲穷千里目,更上一层楼 */
75
79
  /* 独立思考,明辨是非 */
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import e from "../../../use-update-effect/index.js";
4
4
  import { useRef as t } from "react";
@@ -1,7 +1,7 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
- import e from "../../../use-unmount/index.js";
4
- import t from "../../../use-creation/index.js";
3
+ import e from "../../../use-creation/index.js";
4
+ import t from "../../../use-unmount/index.js";
5
5
  import { getCache as n, setCache as r } from "../utils/cache.js";
6
6
  import { getCachePromise as i, setCachePromise as a } from "../utils/cachePromise.js";
7
7
  import { subscribe as o, trigger as s } from "../utils/cacheSubscribe.js";
@@ -11,13 +11,13 @@ var l = (l, { cacheKey: u, cacheTime: d = 3e5, staleTime: f = 0, setCache: p, ge
11
11
  let h = c(void 0), g = c(void 0), _ = (e, t) => {
12
12
  p ? p(t) : r(e, d, t), s(e, t.data);
13
13
  }, v = (e, t = []) => m ? m(t) : n(e);
14
- return t(() => {
14
+ return e(() => {
15
15
  if (!u) return;
16
16
  let e = v(u);
17
17
  e && Object.hasOwnProperty.call(e, "data") && (l.state.data = e.data, l.state.params = e.params, (f === -1 || Date.now() - e.time <= f) && (l.state.loading = !1)), h.current = o(u, (e) => {
18
18
  l.setState({ data: e });
19
19
  });
20
- }, []), e(() => {
20
+ }, []), t(() => {
21
21
  h.current?.();
22
22
  }), u ? {
23
23
  onBefore: (e) => {
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import e from "../../../use-update-effect/index.js";
4
4
  import { useEffect as t, useMemo as n, useRef as r } from "react";
@@ -32,7 +32,7 @@ var s = (s, { debounceWait: c, debounceLeading: l, debounceTrailing: u, debounce
32
32
  m,
33
33
  s
34
34
  ]), e(() => {
35
- f === !1 && p.current?.cancel();
35
+ i(f) && p.current?.cancel();
36
36
  }, [f]), c ? { onCancel: () => {
37
37
  p.current?.cancel?.();
38
38
  } } : {};
@@ -1,25 +1,26 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import { useRef as e } from "react";
4
+ import { isFalse as t } from "@unicom-cloud/utils/is";
4
5
  // components/common/hooks/use-request/src/plugins/useLoadingDelayPlugin.ts
5
- var t = (t, { loadingDelay: n, ready: r }) => {
6
- let i = e(void 0);
7
- if (!n) return {};
8
- let a = () => {
9
- i.current && clearTimeout(i.current);
6
+ var n = (n, { loadingDelay: r, ready: i }) => {
7
+ let a = e(void 0);
8
+ if (!r) return {};
9
+ let o = () => {
10
+ a.current && clearTimeout(a.current);
10
11
  };
11
12
  return {
12
- onBefore: () => (a(), r !== !1 && (i.current = setTimeout(() => {
13
- t.setState({ loading: !0 });
14
- }, n)), { loading: !1 }),
13
+ onBefore: () => (o(), t(i) || (a.current = setTimeout(() => {
14
+ n.setState({ loading: !0 });
15
+ }, r)), { loading: !1 }),
15
16
  onFinally: () => {
16
- a();
17
+ o();
17
18
  },
18
19
  onCancel: () => {
19
- a();
20
+ o();
20
21
  }
21
22
  };
22
23
  };
23
- export { t as default };
24
+ export { n as default };
24
25
  /* 欲穷千里目,更上一层楼 */
25
26
  /* 独立思考,明辨是非 */
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import e from "../../../use-update-effect/index.js";
4
4
  import t from "../utils/isDocumentVisible.js";
@@ -23,9 +23,9 @@ var i = (i, { pollingInterval: a, pollingWhenHidden: o = !0, pollingErrorRetryCo
23
23
  },
24
24
  onFinally: () => {
25
25
  s === -1 || s !== -1 && u.current <= s ? c.current = setTimeout(() => {
26
- !o && !t() ? l.current = n(() => {
26
+ o || t() ? i.refresh() : l.current = n(() => {
27
27
  i.refresh();
28
- }) : i.refresh();
28
+ });
29
29
  }, a) : u.current = 0;
30
30
  },
31
31
  onCancel: () => {
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import e from "../../../use-unmount/index.js";
4
4
  import t from "../utils/limit.js";
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import { useRef as e } from "react";
4
4
  // components/common/hooks/use-request/src/plugins/useRetryPlugin.ts
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import { useEffect as e, useRef as t } from "react";
4
4
  import { isUndefined as n } from "@unicom-cloud/utils/is";
@@ -14,7 +14,7 @@ export interface PluginReturn<TData, TParams extends any[]> {
14
14
  stopNow?: boolean;
15
15
  returnNow?: boolean;
16
16
  } & Partial<FetchState<TData, TParams>>) | void;
17
- onRequest?: (service: Service<TData, TParams>, params: TParams) => {
17
+ onRequest?: (service: Service<TData, TParams>, params: TParams, signal?: AbortSignal) => {
18
18
  servicePromise?: Promise<TData>;
19
19
  };
20
20
  onSuccess?: (data: TData, params: TParams) => void;
@@ -53,6 +53,7 @@ export interface Options<TData, TParams extends any[]> {
53
53
  retryCount?: number;
54
54
  retryInterval?: number;
55
55
  ready?: boolean;
56
+ enableAbort?: boolean;
56
57
  }
57
58
  export type Plugin<TData, TParams extends any[]> = {
58
59
  (fetchInstance: Fetch<TData, TParams>, options: Options<TData, TParams>): PluginReturn<TData, TParams>;
@@ -1,7 +1,14 @@
1
1
  import type { Options, Plugin, Result, Service } from './types';
2
- type AnyService = (...args: any[]) => Promise<any>;
3
- type InferData<TService extends AnyService> = Awaited<ReturnType<TService>>;
4
- type InferParams<TService extends AnyService> = Parameters<TService>;
5
- declare function useRequest<TService extends AnyService>(service: TService, options?: Options<InferData<TService>, InferParams<TService>>, plugins?: Plugin<InferData<TService>, InferParams<TService>>[]): Result<InferData<TService>, InferParams<TService>>;
2
+ /**
3
+ * 核心 Hook —— 管理异步请求的加载状态、数据、错误,以及各类插件扩展能力。
4
+ *
5
+ * 内部实现是将用户自定义插件与内置插件合并后,交给 `useRequestImplement` 统一调度。
6
+ * 插件执行顺序:用户传入 → 防抖 → loading 延迟 → 轮询 → 窗口聚焦刷新 → 节流 → 自动运行 → 缓存 → 重试。
7
+ *
8
+ * @param service 请求函数,签名为 `(...args: TParams) => Promise<TData>`
9
+ * @param options 配置项(手动触发、防抖、节流、轮询、缓存、重试等)
10
+ * @param plugins 自定义插件数组,会排在内置插件之前执行
11
+ * @returns 请求状态与操作方法:`{ loading, data, error, params, run, runAsync, refresh, refreshAsync, cancel, mutate }`
12
+ */
6
13
  declare function useRequest<TData, TParams extends any[]>(service: Service<TData, TParams>, options?: Options<TData, TParams>, plugins?: Plugin<TData, TParams>[]): Result<TData, TParams>;
7
14
  export default useRequest;
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import e from "./plugins/useAutoRunPlugin.js";
4
4
  import t from "./plugins/useCachePlugin.js";
@@ -1,44 +1,44 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
- import e from "../../use-latest/index.js";
4
- import t from "../../utils/isDev.js";
5
- import n from "../../use-unmount/index.js";
6
- import r from "../../use-memoized-fn/index.js";
7
- import i from "../../use-update/index.js";
8
- import a from "../../use-creation/index.js";
9
- import o from "../../use-mount/index.js";
3
+ import e from "../../use-creation/index.js";
4
+ import t from "../../use-latest/index.js";
5
+ import n from "../../use-memoized-fn/index.js";
6
+ import r from "../../use-mount/index.js";
7
+ import i from "../../use-unmount/index.js";
8
+ import a from "../../use-update/index.js";
9
+ import o from "../../utils/isDev.js";
10
10
  import s from "./Fetch.js";
11
11
  import { isArray as c, isExist as l } from "@unicom-cloud/utils/is";
12
12
  // components/common/hooks/use-request/src/useRequestImplement.ts
13
13
  function u(u, d = {}, f = []) {
14
14
  let { manual: p = !1, ready: m = !0, ...h } = d;
15
- t && d.defaultParams && !c(d.defaultParams) && console.warn(`expected defaultParams is array, got ${typeof d.defaultParams}`);
15
+ o && d.defaultParams && !c(d.defaultParams) && console.warn(`expected defaultParams is array, got ${typeof d.defaultParams}`);
16
16
  let g = {
17
17
  manual: p,
18
18
  ready: m,
19
19
  ...h
20
- }, _ = e(u), v = i(), y = a(() => {
20
+ }, _ = t(u), v = a(), y = e(() => {
21
21
  let e = f.map((e) => e?.onInit?.(g)).filter(l);
22
22
  return new s(_, g, v, Object.assign({}, ...e));
23
23
  }, []);
24
- return y.options = g, y.pluginImpls = f.map((e) => e(y, g)), o(() => {
24
+ return y.options = g, y.pluginImpls = f.map((e) => e(y, g)), r(() => {
25
25
  if (!p && m) {
26
26
  let e = y.state.params || d.defaultParams || [];
27
27
  y.run(...e);
28
28
  }
29
- }), n(() => {
29
+ }), i(() => {
30
30
  y.cancel();
31
31
  }), {
32
32
  loading: y.state.loading,
33
33
  data: y.state.data,
34
34
  error: y.state.error,
35
35
  params: y.state.params || [],
36
- cancel: r(y.cancel.bind(y)),
37
- refresh: r(y.refresh.bind(y)),
38
- refreshAsync: r(y.refreshAsync.bind(y)),
39
- run: r(y.run.bind(y)),
40
- runAsync: r((...e) => y.runAsync(...e)),
41
- mutate: r(y.mutate.bind(y))
36
+ cancel: n(y.cancel.bind(y)),
37
+ refresh: n(y.refresh.bind(y)),
38
+ refreshAsync: n(y.refreshAsync.bind(y)),
39
+ run: n(y.run.bind(y)),
40
+ runAsync: n((...e) => y.runAsync(...e)),
41
+ mutate: n(y.mutate.bind(y))
42
42
  };
43
43
  }
44
44
  export { u as default };
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-11-04 17:31:58 星期三 山东省济南市 */
1
+ /* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
2
2
  /* 世界因你而美丽 */
3
3
  import e from "lodash/castArray";
4
4
  // components/common/hooks/use-request/src/utils/cache.ts