@unicom-cloud/ui-common 0.1.16 → 0.1.18

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 (620) hide show
  1. package/.virtual/_rolldown/runtime.js +19 -0
  2. package/.vite/license.md +3 -0
  3. package/.vite/manifest.json +2438 -0
  4. package/development/index.js +34 -61
  5. package/empty/index.js +38 -56
  6. package/{types/flex → flex}/index.d.ts +1 -1
  7. package/flex/index.js +49 -77
  8. package/{types/flex → flex}/utils.d.ts +1 -1
  9. package/flex/utils.js +30 -31
  10. package/higher-order/index.js +4 -5
  11. package/higher-order/with-speech-synthesis/index.js +74 -78
  12. package/hooks/create-deep-compare-effect/index.js +10 -9
  13. package/hooks/create-update-effect/index.js +14 -14
  14. package/{types/hooks → hooks}/create-use-storage-state/index.d.ts +1 -1
  15. package/hooks/create-use-storage-state/index.js +58 -88
  16. package/hooks/index.js +110 -216
  17. package/hooks/use-async-effect/index.js +20 -24
  18. package/hooks/use-boolean/index.js +15 -14
  19. package/hooks/use-click-away/index.js +23 -30
  20. package/hooks/use-computed-state/index.js +11 -11
  21. package/hooks/use-controllable-value/index.js +18 -26
  22. package/{types/hooks → hooks}/use-cookie-state/index.d.ts +0 -1
  23. package/hooks/use-cookie-state/index.js +21 -20
  24. package/hooks/use-count-down/index.js +33 -36
  25. package/hooks/use-counter/index.js +35 -42
  26. package/hooks/use-create/index.js +9 -8
  27. package/hooks/use-creation/index.js +14 -13
  28. package/hooks/use-debounce/index.js +14 -13
  29. package/hooks/use-debounce-effect/index.js +13 -12
  30. package/hooks/use-debounce-fn/index.js +20 -29
  31. package/hooks/use-deep-compare-effect/index.js +8 -7
  32. package/hooks/use-deep-compare-layout-effect/index.js +8 -7
  33. package/hooks/use-document-visibility/index.js +14 -19
  34. package/hooks/use-drag/index.js +36 -46
  35. package/hooks/use-drop/index.js +53 -62
  36. package/hooks/use-effect-event/index.js +16 -16
  37. package/hooks/use-event/index.js +10 -9
  38. package/hooks/use-event-listener/index.js +34 -35
  39. package/hooks/use-event-target/index.js +17 -20
  40. package/hooks/use-external/index.js +61 -64
  41. package/hooks/use-favicon/index.js +17 -17
  42. package/hooks/use-focus-within/index.js +14 -25
  43. package/hooks/use-force-update/index.js +7 -5
  44. package/hooks/use-fullscreen/index.js +65 -72
  45. package/hooks/use-get-state/index.js +14 -9
  46. package/hooks/use-history-travel/index.js +82 -77
  47. package/hooks/use-hover/index.js +14 -25
  48. package/hooks/use-id/index.js +10 -10
  49. package/hooks/use-in-view/index.js +20 -31
  50. package/hooks/use-in-viewport/index.js +28 -32
  51. package/hooks/use-infinite-scroll/index.js +67 -87
  52. package/hooks/use-intersection-observer/index.js +19 -23
  53. package/hooks/use-intersection-observers/index.js +29 -93
  54. package/hooks/use-interval/index.js +15 -16
  55. package/hooks/use-is-first-render/index.js +9 -9
  56. package/hooks/use-isomorphic-layout-effect/index.js +8 -7
  57. package/hooks/use-key-press/index.js +162 -178
  58. package/hooks/use-keyboard-event/index.js +12 -16
  59. package/hooks/use-latest/index.js +9 -8
  60. package/hooks/use-listen-window-resize/index.js +10 -9
  61. package/{types/hooks → hooks}/use-local-storage-state/index.d.ts +1 -1
  62. package/hooks/use-local-storage-state/index.js +8 -9
  63. package/hooks/use-lock-fn/index.js +20 -22
  64. package/hooks/use-long-press/index.js +60 -58
  65. package/hooks/use-map/index.js +28 -30
  66. package/hooks/use-media/index.js +16 -15
  67. package/hooks/use-memo/index.js +9 -8
  68. package/hooks/use-memoized-fn/index.js +14 -18
  69. package/{types/hooks → hooks}/use-merge-props/index.d.ts +1 -1
  70. package/hooks/use-merge-props/index.js +13 -17
  71. package/hooks/use-merge-value/index.js +21 -17
  72. package/hooks/use-mobile/index.js +13 -12
  73. package/{types/hooks → hooks}/use-mount/index.d.ts +1 -1
  74. package/hooks/use-mount/index.js +10 -12
  75. package/hooks/use-mouse/index.js +44 -49
  76. package/hooks/use-move/index.js +66 -77
  77. package/hooks/use-mutation-observer/index.js +18 -22
  78. package/hooks/use-mutation-observers/index.js +33 -127
  79. package/hooks/use-network/index.js +53 -53
  80. package/hooks/use-online-status/index.js +12 -18
  81. package/hooks/use-overflow-hidden/index.js +25 -26
  82. package/hooks/use-override-ref/index.js +13 -14
  83. package/hooks/use-pagination/index.js +44 -48
  84. package/hooks/use-paste-image/index.js +19 -19
  85. package/hooks/use-persist-callback/index.js +9 -8
  86. package/hooks/use-prefers-color-scheme-dark/index.js +17 -24
  87. package/hooks/use-previous/index.js +9 -9
  88. package/hooks/use-raf-interval/index.js +27 -35
  89. package/hooks/use-raf-state/index.js +16 -15
  90. package/hooks/use-raf-timeout/index.js +26 -33
  91. package/hooks/use-reactive/index.js +34 -36
  92. package/hooks/use-ref-latest/index.js +6 -4
  93. package/hooks/use-refs/index.js +16 -17
  94. package/hooks/use-request/index.js +8 -7
  95. package/hooks/use-request/src/Fetch.js +73 -89
  96. package/hooks/use-request/src/plugins/useAutoRunPlugin.js +17 -29
  97. package/hooks/use-request/src/plugins/useCachePlugin.js +59 -65
  98. package/hooks/use-request/src/plugins/useDebouncePlugin.js +32 -33
  99. package/hooks/use-request/src/plugins/useLoadingDelayPlugin.js +23 -27
  100. package/hooks/use-request/src/plugins/usePollingPlugin.js +36 -36
  101. package/hooks/use-request/src/plugins/useRefreshOnWindowFocusPlugin.js +26 -28
  102. package/hooks/use-request/src/plugins/useRetryPlugin.js +27 -27
  103. package/hooks/use-request/src/plugins/useThrottlePlugin.js +29 -30
  104. package/hooks/use-request/src/useRequest.js +26 -25
  105. package/hooks/use-request/src/useRequestImplement.js +44 -53
  106. package/hooks/use-request/src/utils/cache.js +18 -19
  107. package/hooks/use-request/src/utils/cachePromise.js +9 -9
  108. package/{types/hooks → hooks}/use-request/src/utils/cacheSubscribe.d.ts +1 -1
  109. package/hooks/use-request/src/utils/cacheSubscribe.js +10 -10
  110. package/hooks/use-request/src/utils/isDocumentVisible.js +8 -7
  111. package/hooks/use-request/src/utils/isOnline.js +8 -8
  112. package/hooks/use-request/src/utils/limit.js +12 -11
  113. package/hooks/use-request/src/utils/subscribeFocus.js +17 -16
  114. package/hooks/use-request/src/utils/subscribeReVisible.js +15 -17
  115. package/hooks/use-reset-state/index.js +18 -17
  116. package/hooks/use-resize-observer/index.js +7 -5
  117. package/hooks/use-resize-observers/index.js +30 -124
  118. package/hooks/use-responsive/index.js +38 -43
  119. package/hooks/use-safe-state/index.js +13 -12
  120. package/hooks/use-scroll/index.js +31 -43
  121. package/hooks/use-selections/index.js +52 -57
  122. package/{types/hooks → hooks}/use-session-storage-state/index.d.ts +1 -1
  123. package/hooks/use-session-storage-state/index.js +8 -9
  124. package/hooks/use-set/index.js +20 -22
  125. package/hooks/use-set-state/index.js +19 -16
  126. package/hooks/use-size/index.js +35 -37
  127. package/hooks/use-state-callback/index.js +13 -15
  128. package/hooks/use-state-with-promise/index.js +30 -35
  129. package/hooks/use-sync-state/index.js +14 -14
  130. package/hooks/use-text-selection/index.js +51 -53
  131. package/hooks/use-theme/index.js +29 -34
  132. package/hooks/use-throttle/index.js +14 -13
  133. package/hooks/use-throttle-effect/index.js +13 -12
  134. package/hooks/use-throttle-fn/index.js +21 -30
  135. package/hooks/use-timeout/index.js +15 -16
  136. package/hooks/use-title/index.js +16 -17
  137. package/hooks/use-toggle/index.js +17 -16
  138. package/hooks/use-tracked-effect/index.js +12 -11
  139. package/hooks/use-unmount/index.js +15 -20
  140. package/hooks/use-unmounted-ref/index.js +11 -10
  141. package/hooks/use-update/index.js +10 -9
  142. package/hooks/use-update-effect/index.js +8 -7
  143. package/hooks/use-update-layout-effect/index.js +7 -6
  144. package/hooks/use-url-state/index.js +47 -56
  145. package/hooks/use-virtual-list/index.js +65 -82
  146. package/hooks/use-watch/index.js +13 -13
  147. package/hooks/use-web-socket/index.js +49 -73
  148. package/hooks/use-why-did-you-update/index.js +23 -19
  149. package/hooks/use-window-size/index.js +30 -45
  150. package/hooks/utils/createEffectWithTarget.js +22 -21
  151. package/hooks/utils/depsAreSame.js +9 -11
  152. package/hooks/utils/depsEqual.js +7 -7
  153. package/hooks/utils/domTarget.js +12 -14
  154. package/hooks/utils/getDocumentOrShadow.js +14 -14
  155. package/hooks/utils/index.js +6 -5
  156. package/hooks/utils/isAppleDevice.js +7 -6
  157. package/hooks/utils/isBrowser.js +7 -6
  158. package/hooks/utils/isDev.js +6 -5
  159. package/hooks/utils/rect.js +11 -16
  160. package/hooks/utils/useDeepCompareWithTarget.js +11 -10
  161. package/hooks/utils/useEffectWithTarget.js +7 -6
  162. package/hooks/utils/useIsomorphicLayoutEffectWithTarget.js +9 -8
  163. package/hooks/utils/useLayoutEffectWithTarget.js +7 -6
  164. package/icons/file/index.js +54 -65
  165. package/{types/index.d.ts → index.d.ts} +2 -0
  166. package/index.js +589 -633
  167. package/motion/CSSMotion.js +75 -103
  168. package/motion/CSSMotionList.js +80 -98
  169. package/motion/context.js +12 -12
  170. package/motion/hooks/useDomMotionEvents.js +18 -20
  171. package/motion/hooks/useNextFrame.js +21 -23
  172. package/motion/hooks/useStatus.js +91 -120
  173. package/motion/hooks/useStepQueue.js +37 -42
  174. package/motion/index.js +8 -8
  175. package/motion/interface.js +6 -14
  176. package/motion/util/diff.js +47 -55
  177. package/motion/util/motion.js +33 -54
  178. package/package.json +1 -1
  179. package/progress/index.js +82 -132
  180. package/resize-observer/Collection.js +23 -23
  181. package/{types/resize-observer → resize-observer}/SingleObserver.d.ts +1 -1
  182. package/resize-observer/SingleObserver.js +47 -49
  183. package/resize-observer/index.js +22 -28
  184. package/resize-observer/observerUtil.js +18 -18
  185. package/{types/space → space}/index.d.ts +1 -1
  186. package/space/index.js +71 -83
  187. package/{types/space → space}/interface.d.ts +1 -1
  188. package/style.css +2 -1
  189. package/suspense-fallback-test/index.js +7 -16
  190. package/{types/timer → timer}/index.d.ts +1 -1
  191. package/timer/index.js +36 -40
  192. package/transition-group/CSSTransition.js +71 -95
  193. package/transition-group/ChildMapping.js +56 -63
  194. package/transition-group/PqbCSSTransition.js +33 -39
  195. package/transition-group/ReplaceTransition.js +37 -33
  196. package/transition-group/SwitchTransition.js +82 -100
  197. package/{types/transition-group → transition-group}/Transition.d.ts +1 -1
  198. package/transition-group/Transition.js +138 -187
  199. package/transition-group/TransitionGroup.js +53 -48
  200. package/transition-group/TransitionGroupContext.js +7 -6
  201. package/transition-group/index.js +11 -32
  202. package/utils/callOrReturn.js +4 -6
  203. package/{types/utils → utils}/callbackOriginRef.d.ts +1 -1
  204. package/utils/callbackOriginRef.js +10 -10
  205. package/utils/caseName.js +4 -6
  206. package/utils/className.js +4 -7
  207. package/utils/constant.js +8 -10
  208. package/utils/copy.js +7 -8
  209. package/utils/date.js +4 -8
  210. package/{types/utils → utils}/dayjs.d.ts +1 -0
  211. package/utils/dayjs.js +15 -22
  212. package/utils/dom.js +37 -53
  213. package/utils/emitter.js +4 -6
  214. package/utils/fileRead.js +4 -6
  215. package/utils/fileToDataURL.js +4 -6
  216. package/utils/fillNBSP.js +8 -9
  217. package/utils/findRootElement.js +17 -25
  218. package/utils/findScrollParent.js +14 -17
  219. package/utils/getHighlightText.js +24 -41
  220. package/utils/getHotkeyHandler.js +26 -27
  221. package/utils/getStringLength.js +9 -10
  222. package/utils/include.js +10 -10
  223. package/utils/index.js +318 -373
  224. package/utils/intersectionObserver.js +20 -22
  225. package/utils/is.d.ts +12 -0
  226. package/utils/is.js +32 -121
  227. package/utils/keyboardCode.js +7 -6
  228. package/{types/utils → utils}/lodash.d.ts +2 -1
  229. package/utils/lodash.js +64 -123
  230. package/utils/math.js +4 -10
  231. package/utils/mergeProps.js +10 -12
  232. package/utils/mergedToString.js +14 -15
  233. package/utils/mutationObserver.js +22 -20
  234. package/utils/omit.d.ts +3 -0
  235. package/utils/omit.js +10 -12
  236. package/utils/pad.js +15 -17
  237. package/utils/pick.js +16 -17
  238. package/utils/pinyin.js +4 -6
  239. package/utils/react19Adapter.js +7 -4
  240. package/utils/ref.js +28 -39
  241. package/utils/resizeObserver.js +30 -32
  242. package/utils/saveAs.js +4 -6
  243. package/utils/screenfull.js +4 -6
  244. package/utils/scrollIntoViewIfNeeded.js +7 -7
  245. package/utils/setCreateRoot.js +46 -47
  246. package/utils/setDarkTheme.js +23 -25
  247. package/utils/setDir.js +12 -13
  248. package/utils/setPrimaryColor.js +20 -30
  249. package/utils/setTheme.js +49 -55
  250. package/utils/string.js +11 -11
  251. package/utils/style.js +34 -36
  252. package/utils/throttleByRaf.js +15 -16
  253. package/utils/throttleByRaf2.js +8 -8
  254. package/utils/tinycolor.js +5 -6
  255. package/utils/toArray.js +13 -14
  256. package/utils/tree.js +4 -12
  257. package/utils/tween.js +4 -7
  258. package/utils/uuid.js +4 -7
  259. package/{types/utils → utils}/validate.d.ts +1 -1
  260. package/utils/validate.js +4 -16
  261. package/utils/warning.js +6 -12
  262. package/version/index.d.ts +5 -0
  263. package/version/index.js +30 -0
  264. package/Development.js +0 -10
  265. package/Empty.js +0 -14
  266. package/Flex.js +0 -16
  267. package/Motion.js +0 -9
  268. package/Progress.js +0 -8
  269. package/ResizeObserver.js +0 -12
  270. package/Space.js +0 -13
  271. package/SuspenseFallbackTest.js +0 -7
  272. package/Timer.js +0 -12
  273. package/TransitionGroup.js +0 -32
  274. package/higher-order/withSpeechSynthesis.js +0 -11
  275. package/hooks/createDeepCompareEffect.js +0 -7
  276. package/hooks/createUpdateEffect.js +0 -6
  277. package/hooks/createUseStorageState.js +0 -12
  278. package/hooks/useAsyncEffect.js +0 -8
  279. package/hooks/useBoolean.js +0 -7
  280. package/hooks/useClickAway.js +0 -10
  281. package/hooks/useComputedState.js +0 -6
  282. package/hooks/useControllableValue.js +0 -10
  283. package/hooks/useCookieState.js +0 -10
  284. package/hooks/useCountDown.js +0 -10
  285. package/hooks/useCounter.js +0 -9
  286. package/hooks/useCreate.js +0 -6
  287. package/hooks/useCreation.js +0 -7
  288. package/hooks/useDebounce.js +0 -7
  289. package/hooks/useDebounceEffect.js +0 -8
  290. package/hooks/useDebounceFn.js +0 -12
  291. package/hooks/useDeepCompareEffect.js +0 -7
  292. package/hooks/useDeepCompareLayoutEffect.js +0 -7
  293. package/hooks/useDocumentVisibility.js +0 -8
  294. package/hooks/useDrag.js +0 -12
  295. package/hooks/useDrop.js +0 -11
  296. package/hooks/useEffectEvent.js +0 -6
  297. package/hooks/useEvent.js +0 -7
  298. package/hooks/useEventListener.js +0 -9
  299. package/hooks/useEventTarget.js +0 -9
  300. package/hooks/useExternal.js +0 -6
  301. package/hooks/useFavicon.js +0 -6
  302. package/hooks/useFocusWithin.js +0 -7
  303. package/hooks/useForceUpdate.js +0 -5
  304. package/hooks/useFullscreen.js +0 -12
  305. package/hooks/useGetState.js +0 -7
  306. package/hooks/useHistoryTravel.js +0 -9
  307. package/hooks/useHover.js +0 -7
  308. package/hooks/useId.js +0 -8
  309. package/hooks/useInView.js +0 -7
  310. package/hooks/useInViewport.js +0 -9
  311. package/hooks/useInfiniteScroll.js +0 -13
  312. package/hooks/useIntersectionObserver.js +0 -9
  313. package/hooks/useIntersectionObservers.js +0 -71
  314. package/hooks/useInterval.js +0 -9
  315. package/hooks/useIsFirstRender.js +0 -6
  316. package/hooks/useIsomorphicLayoutEffect.js +0 -7
  317. package/hooks/useKeyPress.js +0 -11
  318. package/hooks/useKeyboardEvent.js +0 -7
  319. package/hooks/useLatest.js +0 -6
  320. package/hooks/useListenWindowResize.js +0 -6
  321. package/hooks/useLocalStorageState.js +0 -7
  322. package/hooks/useLockFn.js +0 -6
  323. package/hooks/useLongPress.js +0 -9
  324. package/hooks/useMap.js +0 -7
  325. package/hooks/useMedia.js +0 -6
  326. package/hooks/useMemo.js +0 -6
  327. package/hooks/useMemoizedFn.js +0 -9
  328. package/hooks/useMergeProps.js +0 -7
  329. package/hooks/useMergeValue.js +0 -10
  330. package/hooks/useMobile.js +0 -8
  331. package/hooks/useMount.js +0 -9
  332. package/hooks/useMouse.js +0 -8
  333. package/hooks/useMove.js +0 -11
  334. package/hooks/useMutationObserver.js +0 -8
  335. package/hooks/useMutationObservers.js +0 -102
  336. package/hooks/useNetwork.js +0 -8
  337. package/hooks/useOnlineStatus.js +0 -6
  338. package/hooks/useOverflowHidden.js +0 -6
  339. package/hooks/useOverrideRef.js +0 -8
  340. package/hooks/usePagination.js +0 -9
  341. package/hooks/usePasteImage.js +0 -9
  342. package/hooks/usePersistCallback.js +0 -6
  343. package/hooks/usePrefersColorSchemeDark.js +0 -7
  344. package/hooks/usePrevious.js +0 -6
  345. package/hooks/useRafInterval.js +0 -9
  346. package/hooks/useRafState.js +0 -7
  347. package/hooks/useRafTimeout.js +0 -9
  348. package/hooks/useReactive.js +0 -10
  349. package/hooks/useRefLatest.js +0 -5
  350. package/hooks/useRefs.js +0 -8
  351. package/hooks/useRequest.js +0 -7
  352. package/hooks/useResetState.js +0 -10
  353. package/hooks/useResizeObserver.js +0 -5
  354. package/hooks/useResizeObservers.js +0 -102
  355. package/hooks/useResponsive.js +0 -8
  356. package/hooks/useSafeState.js +0 -7
  357. package/hooks/useScroll.js +0 -9
  358. package/hooks/useSelections.js +0 -9
  359. package/hooks/useSessionStorageState.js +0 -7
  360. package/hooks/useSet.js +0 -7
  361. package/hooks/useSetState.js +0 -9
  362. package/hooks/useSize.js +0 -12
  363. package/hooks/useStateCallback.js +0 -6
  364. package/hooks/useStateWithPromise.js +0 -8
  365. package/hooks/useSyncState.js +0 -10
  366. package/hooks/useTextSelection.js +0 -8
  367. package/hooks/useTheme.js +0 -9
  368. package/hooks/useThrottle.js +0 -7
  369. package/hooks/useThrottleEffect.js +0 -8
  370. package/hooks/useThrottleFn.js +0 -12
  371. package/hooks/useTimeout.js +0 -9
  372. package/hooks/useTitle.js +0 -8
  373. package/hooks/useToggle.js +0 -6
  374. package/hooks/useTrackedEffect.js +0 -6
  375. package/hooks/useUnmount.js +0 -10
  376. package/hooks/useUnmountedRef.js +0 -6
  377. package/hooks/useUpdate.js +0 -7
  378. package/hooks/useUpdateEffect.js +0 -7
  379. package/hooks/useUpdateLayoutEffect.js +0 -7
  380. package/hooks/useUrlState.js +0 -12
  381. package/hooks/useVirtualList.js +0 -14
  382. package/hooks/useWatch.js +0 -9
  383. package/hooks/useWebSocket.js +0 -10
  384. package/hooks/useWhyDidYouUpdate.js +0 -6
  385. package/hooks/useWindowSize.js +0 -11
  386. package/hooks/utils.js +0 -5
  387. package/icons/file.js +0 -9
  388. package/types/utils/is.d.ts +0 -12
  389. package/types/utils/omit.d.ts +0 -3
  390. /package/{types/development → development}/index.d.ts +0 -0
  391. /package/{types/development → development}/interface.d.ts +0 -0
  392. /package/{types/empty → empty}/index.d.ts +0 -0
  393. /package/{types/empty → empty}/interface.d.ts +0 -0
  394. /package/{types/flex → flex}/interface.d.ts +0 -0
  395. /package/{types/higher-order → higher-order}/index.d.ts +0 -0
  396. /package/{types/higher-order → higher-order}/with-speech-synthesis/index.d.ts +0 -0
  397. /package/{types/higher-order → higher-order}/with-speech-synthesis/interface.d.ts +0 -0
  398. /package/{types/higher-order → higher-order}/with-speech-synthesis/style/index.d.ts +0 -0
  399. /package/{types/hooks → hooks}/create-deep-compare-effect/index.d.ts +0 -0
  400. /package/{types/hooks → hooks}/create-update-effect/index.d.ts +0 -0
  401. /package/{types/hooks → hooks}/index.d.ts +0 -0
  402. /package/{types/hooks → hooks}/use-async-effect/index.d.ts +0 -0
  403. /package/{types/hooks → hooks}/use-boolean/index.d.ts +0 -0
  404. /package/{types/hooks → hooks}/use-click-away/index.d.ts +0 -0
  405. /package/{types/hooks → hooks}/use-computed-state/index.d.ts +0 -0
  406. /package/{types/hooks → hooks}/use-controllable-value/index.d.ts +0 -0
  407. /package/{types/hooks → hooks}/use-count-down/index.d.ts +0 -0
  408. /package/{types/hooks → hooks}/use-counter/index.d.ts +0 -0
  409. /package/{types/hooks → hooks}/use-create/index.d.ts +0 -0
  410. /package/{types/hooks → hooks}/use-creation/index.d.ts +0 -0
  411. /package/{types/hooks → hooks}/use-debounce/debounceOptions.d.ts +0 -0
  412. /package/{types/hooks → hooks}/use-debounce/index.d.ts +0 -0
  413. /package/{types/hooks → hooks}/use-debounce-effect/index.d.ts +0 -0
  414. /package/{types/hooks → hooks}/use-debounce-fn/index.d.ts +0 -0
  415. /package/{types/hooks → hooks}/use-deep-compare-effect/index.d.ts +0 -0
  416. /package/{types/hooks → hooks}/use-deep-compare-layout-effect/index.d.ts +0 -0
  417. /package/{types/hooks → hooks}/use-document-visibility/index.d.ts +0 -0
  418. /package/{types/hooks → hooks}/use-drag/index.d.ts +0 -0
  419. /package/{types/hooks → hooks}/use-drop/index.d.ts +0 -0
  420. /package/{types/hooks → hooks}/use-effect-event/index.d.ts +0 -0
  421. /package/{types/hooks → hooks}/use-event/index.d.ts +0 -0
  422. /package/{types/hooks → hooks}/use-event-listener/index.d.ts +0 -0
  423. /package/{types/hooks → hooks}/use-event-target/index.d.ts +0 -0
  424. /package/{types/hooks → hooks}/use-external/index.d.ts +0 -0
  425. /package/{types/hooks → hooks}/use-favicon/index.d.ts +0 -0
  426. /package/{types/hooks → hooks}/use-focus-within/index.d.ts +0 -0
  427. /package/{types/hooks → hooks}/use-force-update/index.d.ts +0 -0
  428. /package/{types/hooks → hooks}/use-fullscreen/index.d.ts +0 -0
  429. /package/{types/hooks → hooks}/use-get-state/index.d.ts +0 -0
  430. /package/{types/hooks → hooks}/use-history-travel/index.d.ts +0 -0
  431. /package/{types/hooks → hooks}/use-hover/index.d.ts +0 -0
  432. /package/{types/hooks → hooks}/use-id/index.d.ts +0 -0
  433. /package/{types/hooks → hooks}/use-in-view/index.d.ts +0 -0
  434. /package/{types/hooks → hooks}/use-in-viewport/index.d.ts +0 -0
  435. /package/{types/hooks → hooks}/use-infinite-scroll/index.d.ts +0 -0
  436. /package/{types/hooks → hooks}/use-infinite-scroll/types.d.ts +0 -0
  437. /package/{types/hooks → hooks}/use-intersection-observer/index.d.ts +0 -0
  438. /package/{types/hooks → hooks}/use-intersection-observers/index.d.ts +0 -0
  439. /package/{types/hooks → hooks}/use-interval/index.d.ts +0 -0
  440. /package/{types/hooks → hooks}/use-is-first-render/index.d.ts +0 -0
  441. /package/{types/hooks → hooks}/use-isomorphic-layout-effect/index.d.ts +0 -0
  442. /package/{types/hooks → hooks}/use-key-press/index.d.ts +0 -0
  443. /package/{types/hooks → hooks}/use-keyboard-event/index.d.ts +0 -0
  444. /package/{types/hooks → hooks}/use-latest/index.d.ts +0 -0
  445. /package/{types/hooks → hooks}/use-listen-window-resize/index.d.ts +0 -0
  446. /package/{types/hooks → hooks}/use-lock-fn/index.d.ts +0 -0
  447. /package/{types/hooks → hooks}/use-long-press/index.d.ts +0 -0
  448. /package/{types/hooks → hooks}/use-map/index.d.ts +0 -0
  449. /package/{types/hooks → hooks}/use-media/index.d.ts +0 -0
  450. /package/{types/hooks → hooks}/use-memo/index.d.ts +0 -0
  451. /package/{types/hooks → hooks}/use-memoized-fn/index.d.ts +0 -0
  452. /package/{types/hooks → hooks}/use-merge-value/index.d.ts +0 -0
  453. /package/{types/hooks → hooks}/use-mobile/index.d.ts +0 -0
  454. /package/{types/hooks → hooks}/use-mouse/index.d.ts +0 -0
  455. /package/{types/hooks → hooks}/use-move/index.d.ts +0 -0
  456. /package/{types/hooks → hooks}/use-mutation-observer/index.d.ts +0 -0
  457. /package/{types/hooks → hooks}/use-mutation-observers/index.d.ts +0 -0
  458. /package/{types/hooks → hooks}/use-network/index.d.ts +0 -0
  459. /package/{types/hooks → hooks}/use-online-status/index.d.ts +0 -0
  460. /package/{types/hooks → hooks}/use-overflow-hidden/index.d.ts +0 -0
  461. /package/{types/hooks → hooks}/use-override-ref/index.d.ts +0 -0
  462. /package/{types/hooks → hooks}/use-pagination/index.d.ts +0 -0
  463. /package/{types/hooks → hooks}/use-pagination/types.d.ts +0 -0
  464. /package/{types/hooks → hooks}/use-paste-image/index.d.ts +0 -0
  465. /package/{types/hooks → hooks}/use-persist-callback/index.d.ts +0 -0
  466. /package/{types/hooks → hooks}/use-prefers-color-scheme-dark/index.d.ts +0 -0
  467. /package/{types/hooks → hooks}/use-previous/index.d.ts +0 -0
  468. /package/{types/hooks → hooks}/use-raf-interval/index.d.ts +0 -0
  469. /package/{types/hooks → hooks}/use-raf-state/index.d.ts +0 -0
  470. /package/{types/hooks → hooks}/use-raf-timeout/index.d.ts +0 -0
  471. /package/{types/hooks → hooks}/use-reactive/index.d.ts +0 -0
  472. /package/{types/hooks → hooks}/use-ref-latest/index.d.ts +0 -0
  473. /package/{types/hooks → hooks}/use-refs/index.d.ts +0 -0
  474. /package/{types/hooks → hooks}/use-request/index.d.ts +0 -0
  475. /package/{types/hooks → hooks}/use-request/src/Fetch.d.ts +0 -0
  476. /package/{types/hooks → hooks}/use-request/src/plugins/useAutoRunPlugin.d.ts +0 -0
  477. /package/{types/hooks → hooks}/use-request/src/plugins/useCachePlugin.d.ts +0 -0
  478. /package/{types/hooks → hooks}/use-request/src/plugins/useDebouncePlugin.d.ts +0 -0
  479. /package/{types/hooks → hooks}/use-request/src/plugins/useLoadingDelayPlugin.d.ts +0 -0
  480. /package/{types/hooks → hooks}/use-request/src/plugins/usePollingPlugin.d.ts +0 -0
  481. /package/{types/hooks → hooks}/use-request/src/plugins/useRefreshOnWindowFocusPlugin.d.ts +0 -0
  482. /package/{types/hooks → hooks}/use-request/src/plugins/useRetryPlugin.d.ts +0 -0
  483. /package/{types/hooks → hooks}/use-request/src/plugins/useThrottlePlugin.d.ts +0 -0
  484. /package/{types/hooks → hooks}/use-request/src/types.d.ts +0 -0
  485. /package/{types/hooks → hooks}/use-request/src/useRequest.d.ts +0 -0
  486. /package/{types/hooks → hooks}/use-request/src/useRequestImplement.d.ts +0 -0
  487. /package/{types/hooks → hooks}/use-request/src/utils/cache.d.ts +0 -0
  488. /package/{types/hooks → hooks}/use-request/src/utils/cachePromise.d.ts +0 -0
  489. /package/{types/hooks → hooks}/use-request/src/utils/isDocumentVisible.d.ts +0 -0
  490. /package/{types/hooks → hooks}/use-request/src/utils/isOnline.d.ts +0 -0
  491. /package/{types/hooks → hooks}/use-request/src/utils/limit.d.ts +0 -0
  492. /package/{types/hooks → hooks}/use-request/src/utils/subscribeFocus.d.ts +0 -0
  493. /package/{types/hooks → hooks}/use-request/src/utils/subscribeReVisible.d.ts +0 -0
  494. /package/{types/hooks → hooks}/use-reset-state/index.d.ts +0 -0
  495. /package/{types/hooks → hooks}/use-resize-observer/index.d.ts +0 -0
  496. /package/{types/hooks → hooks}/use-resize-observers/index.d.ts +0 -0
  497. /package/{types/hooks → hooks}/use-responsive/index.d.ts +0 -0
  498. /package/{types/hooks → hooks}/use-safe-state/index.d.ts +0 -0
  499. /package/{types/hooks → hooks}/use-scroll/index.d.ts +0 -0
  500. /package/{types/hooks → hooks}/use-selections/index.d.ts +0 -0
  501. /package/{types/hooks → hooks}/use-set/index.d.ts +0 -0
  502. /package/{types/hooks → hooks}/use-set-state/index.d.ts +0 -0
  503. /package/{types/hooks → hooks}/use-size/index.d.ts +0 -0
  504. /package/{types/hooks → hooks}/use-state-callback/index.d.ts +0 -0
  505. /package/{types/hooks → hooks}/use-state-with-promise/index.d.ts +0 -0
  506. /package/{types/hooks → hooks}/use-sync-state/index.d.ts +0 -0
  507. /package/{types/hooks → hooks}/use-text-selection/index.d.ts +0 -0
  508. /package/{types/hooks → hooks}/use-theme/index.d.ts +0 -0
  509. /package/{types/hooks → hooks}/use-throttle/index.d.ts +0 -0
  510. /package/{types/hooks → hooks}/use-throttle/throttleOptions.d.ts +0 -0
  511. /package/{types/hooks → hooks}/use-throttle-effect/index.d.ts +0 -0
  512. /package/{types/hooks → hooks}/use-throttle-fn/index.d.ts +0 -0
  513. /package/{types/hooks → hooks}/use-timeout/index.d.ts +0 -0
  514. /package/{types/hooks → hooks}/use-title/index.d.ts +0 -0
  515. /package/{types/hooks → hooks}/use-toggle/index.d.ts +0 -0
  516. /package/{types/hooks → hooks}/use-tracked-effect/index.d.ts +0 -0
  517. /package/{types/hooks → hooks}/use-unmount/index.d.ts +0 -0
  518. /package/{types/hooks → hooks}/use-unmounted-ref/index.d.ts +0 -0
  519. /package/{types/hooks → hooks}/use-update/index.d.ts +0 -0
  520. /package/{types/hooks → hooks}/use-update-effect/index.d.ts +0 -0
  521. /package/{types/hooks → hooks}/use-update-layout-effect/index.d.ts +0 -0
  522. /package/{types/hooks → hooks}/use-url-state/index.d.ts +0 -0
  523. /package/{types/hooks → hooks}/use-virtual-list/index.d.ts +0 -0
  524. /package/{types/hooks → hooks}/use-watch/index.d.ts +0 -0
  525. /package/{types/hooks → hooks}/use-web-socket/index.d.ts +0 -0
  526. /package/{types/hooks → hooks}/use-why-did-you-update/index.d.ts +0 -0
  527. /package/{types/hooks → hooks}/use-window-size/index.d.ts +0 -0
  528. /package/{types/hooks → hooks}/utils/createEffectWithTarget.d.ts +0 -0
  529. /package/{types/hooks → hooks}/utils/depsAreSame.d.ts +0 -0
  530. /package/{types/hooks → hooks}/utils/depsEqual.d.ts +0 -0
  531. /package/{types/hooks → hooks}/utils/domTarget.d.ts +0 -0
  532. /package/{types/hooks → hooks}/utils/getDocumentOrShadow.d.ts +0 -0
  533. /package/{types/hooks → hooks}/utils/index.d.ts +0 -0
  534. /package/{types/hooks → hooks}/utils/isAppleDevice.d.ts +0 -0
  535. /package/{types/hooks → hooks}/utils/isBrowser.d.ts +0 -0
  536. /package/{types/hooks → hooks}/utils/isDev.d.ts +0 -0
  537. /package/{types/hooks → hooks}/utils/noop.d.ts +0 -0
  538. /package/{types/hooks → hooks}/utils/rect.d.ts +0 -0
  539. /package/{types/hooks → hooks}/utils/useDeepCompareWithTarget.d.ts +0 -0
  540. /package/{types/hooks → hooks}/utils/useEffectWithTarget.d.ts +0 -0
  541. /package/{types/hooks → hooks}/utils/useIsomorphicLayoutEffectWithTarget.d.ts +0 -0
  542. /package/{types/hooks → hooks}/utils/useLayoutEffectWithTarget.d.ts +0 -0
  543. /package/{types/icons → icons}/file/index.d.ts +0 -0
  544. /package/{types/icons → icons}/file/interface.d.ts +0 -0
  545. /package/{types/icons → icons}/file/style/index.d.ts +0 -0
  546. /package/{types/motion → motion}/CSSMotion.d.ts +0 -0
  547. /package/{types/motion → motion}/CSSMotionList.d.ts +0 -0
  548. /package/{types/motion → motion}/context.d.ts +0 -0
  549. /package/{types/motion → motion}/hooks/useDomMotionEvents.d.ts +0 -0
  550. /package/{types/motion → motion}/hooks/useNextFrame.d.ts +0 -0
  551. /package/{types/motion → motion}/hooks/useStatus.d.ts +0 -0
  552. /package/{types/motion → motion}/hooks/useStepQueue.d.ts +0 -0
  553. /package/{types/motion → motion}/index.d.ts +0 -0
  554. /package/{types/motion → motion}/interface.d.ts +0 -0
  555. /package/{types/motion → motion}/util/diff.d.ts +0 -0
  556. /package/{types/motion → motion}/util/motion.d.ts +0 -0
  557. /package/{types/progress → progress}/index.d.ts +0 -0
  558. /package/{types/resize-observer → resize-observer}/Collection.d.ts +0 -0
  559. /package/{types/resize-observer → resize-observer}/index.d.ts +0 -0
  560. /package/{types/resize-observer → resize-observer}/interface.d.ts +0 -0
  561. /package/{types/resize-observer → resize-observer}/observerUtil.d.ts +0 -0
  562. /package/{types/suspense-fallback-test → suspense-fallback-test}/index.d.ts +0 -0
  563. /package/{types/suspense-fallback-test → suspense-fallback-test}/interface.d.ts +0 -0
  564. /package/{types/timer → timer}/interface.d.ts +0 -0
  565. /package/{types/transition-group → transition-group}/CSSTransition.d.ts +0 -0
  566. /package/{types/transition-group → transition-group}/ChildMapping.d.ts +0 -0
  567. /package/{types/transition-group → transition-group}/PqbCSSTransition.d.ts +0 -0
  568. /package/{types/transition-group → transition-group}/ReplaceTransition.d.ts +0 -0
  569. /package/{types/transition-group → transition-group}/SwitchTransition.d.ts +0 -0
  570. /package/{types/transition-group → transition-group}/TransitionGroup.d.ts +0 -0
  571. /package/{types/transition-group → transition-group}/TransitionGroupContext.d.ts +0 -0
  572. /package/{types/transition-group → transition-group}/index.d.ts +0 -0
  573. /package/{types/utils → utils}/callOrReturn.d.ts +0 -0
  574. /package/{types/utils → utils}/caseName.d.ts +0 -0
  575. /package/{types/utils → utils}/className.d.ts +0 -0
  576. /package/{types/utils → utils}/constant.d.ts +0 -0
  577. /package/{types/utils → utils}/copy.d.ts +0 -0
  578. /package/{types/utils → utils}/date.d.ts +0 -0
  579. /package/{types/utils → utils}/dom.d.ts +0 -0
  580. /package/{types/utils → utils}/emitter.d.ts +0 -0
  581. /package/{types/utils → utils}/fileRead.d.ts +0 -0
  582. /package/{types/utils → utils}/fileToDataURL.d.ts +0 -0
  583. /package/{types/utils → utils}/fillNBSP.d.ts +0 -0
  584. /package/{types/utils → utils}/findRootElement.d.ts +0 -0
  585. /package/{types/utils → utils}/findScrollParent.d.ts +0 -0
  586. /package/{types/utils → utils}/getHighlightText.d.ts +0 -0
  587. /package/{types/utils → utils}/getHotkeyHandler.d.ts +0 -0
  588. /package/{types/utils → utils}/getStringLength.d.ts +0 -0
  589. /package/{types/utils → utils}/include.d.ts +0 -0
  590. /package/{types/utils → utils}/index.d.ts +0 -0
  591. /package/{types/utils → utils}/intersectionObserver.d.ts +0 -0
  592. /package/{types/utils → utils}/keyboardCode.d.ts +0 -0
  593. /package/{types/utils → utils}/math.d.ts +0 -0
  594. /package/{types/utils → utils}/mergeProps.d.ts +0 -0
  595. /package/{types/utils → utils}/mergedToString.d.ts +0 -0
  596. /package/{types/utils → utils}/mutationObserver.d.ts +0 -0
  597. /package/{types/utils → utils}/pad.d.ts +0 -0
  598. /package/{types/utils → utils}/pick.d.ts +0 -0
  599. /package/{types/utils → utils}/pinyin.d.ts +0 -0
  600. /package/{types/utils → utils}/react19Adapter.d.ts +0 -0
  601. /package/{types/utils → utils}/ref.d.ts +0 -0
  602. /package/{types/utils → utils}/resizeObserver.d.ts +0 -0
  603. /package/{types/utils → utils}/saveAs.d.ts +0 -0
  604. /package/{types/utils → utils}/screenfull.d.ts +0 -0
  605. /package/{types/utils → utils}/scrollIntoViewIfNeeded.d.ts +0 -0
  606. /package/{types/utils → utils}/setCreateRoot.d.ts +0 -0
  607. /package/{types/utils → utils}/setDarkTheme.d.ts +0 -0
  608. /package/{types/utils → utils}/setDir.d.ts +0 -0
  609. /package/{types/utils → utils}/setPrimaryColor.d.ts +0 -0
  610. /package/{types/utils → utils}/setTheme.d.ts +0 -0
  611. /package/{types/utils → utils}/string.d.ts +0 -0
  612. /package/{types/utils → utils}/style.d.ts +0 -0
  613. /package/{types/utils → utils}/throttleByRaf.d.ts +0 -0
  614. /package/{types/utils → utils}/throttleByRaf2.d.ts +0 -0
  615. /package/{types/utils → utils}/tinycolor.d.ts +0 -0
  616. /package/{types/utils → utils}/toArray.d.ts +0 -0
  617. /package/{types/utils → utils}/tree.d.ts +0 -0
  618. /package/{types/utils → utils}/tween.d.ts +0 -0
  619. /package/{types/utils → utils}/uuid.d.ts +0 -0
  620. /package/{types/utils → utils}/warning.d.ts +0 -0
@@ -1,57 +1,48 @@
1
- /* 2026-02-26 14:43:01 */
2
- import o from "@unicom-cloud/utils/query-string";
3
- import { useRef as v, useMemo as u } from "react";
4
- import * as F from "react-router";
5
- import "../../utils/is.js";
6
- import M from "../use-memoized-fn/index.js";
7
- import N from "../use-update/index.js";
8
- import { isFunction as g } from "@unicom-cloud/utils/is";
9
- const a = F, U = {
10
- parseNumbers: !1,
11
- parseBooleans: !1
12
- }, k = {
13
- skipNull: !1,
14
- skipEmptyString: !1
15
- }, x = (e, h) => {
16
- const {
17
- navigateMode: n = "push",
18
- parseOptions: l,
19
- stringifyOptions: y
20
- } = h || {}, d = { ...U, ...l }, i = {
21
- ...k,
22
- ...y
23
- }, t = a.useLocation(), c = a.useHistory?.(), p = a.useNavigate?.(), S = N(), O = v(
24
- g(e) ? e() : e || {}
25
- ), s = u(() => o.parse(t.search, d), [t.search]), f = u(() => ({
26
- ...O.current,
27
- ...s
28
- }), [s]);
29
- return [f, M((r) => {
30
- const m = g(r) ? r(f) : r;
31
- S(), c && c[n](
32
- {
33
- hash: t.hash,
34
- search: o.stringify(
35
- { ...s, ...m },
36
- i
37
- ) || "?"
38
- },
39
- t.state
40
- ), p && p(
41
- {
42
- hash: t.hash,
43
- search: o.stringify(
44
- { ...s, ...m },
45
- i
46
- ) || "?"
47
- },
48
- {
49
- replace: n === "replace",
50
- state: t.state
51
- }
52
- );
53
- })];
54
- };
55
- export {
56
- x as default
1
+ /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
+ import { isFunction as e } from "../../utils/is.js";
3
+ import t from "../use-memoized-fn/index.js";
4
+ import n from "../use-update/index.js";
5
+ import { useMemo as r, useRef as i } from "react";
6
+ import a from "@unicom-cloud/utils/query-string";
7
+ import * as o from "react-router";
8
+ //#region components/common/hooks/use-url-state/index.ts
9
+ var s = o, c = {
10
+ parseNumbers: !1,
11
+ parseBooleans: !1
12
+ }, l = {
13
+ skipNull: !1,
14
+ skipEmptyString: !1
15
+ }, u = (o, u) => {
16
+ let { navigateMode: d = "push", parseOptions: f, stringifyOptions: p } = u || {}, m = {
17
+ ...c,
18
+ ...f
19
+ }, h = {
20
+ ...l,
21
+ ...p
22
+ }, g = s.useLocation(), _ = s.useHistory?.(), v = s.useNavigate?.(), y = n(), b = i(e(o) ? o() : o || {}), x = r(() => a.parse(g.search, m), [g.search]), S = r(() => ({
23
+ ...b.current,
24
+ ...x
25
+ }), [x]);
26
+ return [S, t((t) => {
27
+ let n = e(t) ? t(S) : t;
28
+ y(), _ && _[d]({
29
+ hash: g.hash,
30
+ search: a.stringify({
31
+ ...x,
32
+ ...n
33
+ }, h) || "?"
34
+ }, g.state), v && v({
35
+ hash: g.hash,
36
+ search: a.stringify({
37
+ ...x,
38
+ ...n
39
+ }, h) || "?"
40
+ }, {
41
+ replace: d === "replace",
42
+ state: g.state
43
+ });
44
+ })];
57
45
  };
46
+ //#endregion
47
+ export { u as default };
48
+ /* 独立思考,明辨是非 */
@@ -1,83 +1,66 @@
1
- /* 2026-02-26 14:43:01 */
2
- import { useRef as D, useState as b, useMemo as F, useEffect as O } from "react";
3
- import "../../utils/is.js";
4
- import R from "../use-event-listener/index.js";
5
- import V from "../use-latest/index.js";
6
- import _ from "../use-memoized-fn/index.js";
7
- import j from "../use-size/index.js";
8
- import B from "../use-update-effect/index.js";
9
- import { getTargetElement as m } from "../utils/domTarget.js";
10
- import { isNumber as f } from "@unicom-cloud/utils/is";
11
- const Q = (r, M) => {
12
- const { containerTarget: i, wrapperTarget: w, itemHeight: E, overscan: p = 5 } = M, c = V(E), a = j(i), h = D(!1), [L, S] = b(
13
- []
14
- ), [g, v] = b({}), y = (t, e) => {
15
- if (f(c.current))
16
- return Math.ceil(t / c.current);
17
- let n = 0, o = 0;
18
- for (let s = e; s < r.length; s++) {
19
- const u = c.current(s, r[s]);
20
- if (n += u, o = s, n >= t)
21
- break;
22
- }
23
- return o - e;
24
- }, x = (t) => {
25
- if (f(c.current))
26
- return Math.floor(t / c.current);
27
- let e = 0, n = 0;
28
- for (let o = 0; o < r.length; o++) {
29
- const s = c.current(o, r[o]);
30
- if (e += s, e >= t) {
31
- n = o;
32
- break;
33
- }
34
- }
35
- return n + 1;
36
- }, T = (t) => f(c.current) ? t * c.current : r.slice(0, t).reduce(
37
- (n, o, s) => n + c.current(s, r[s]),
38
- 0
39
- ), z = F(() => f(c.current) ? r.length * c.current : r.reduce(
40
- (t, e, n) => t + c.current(n, r[n]),
41
- 0
42
- ), [r]), l = () => {
43
- const t = m(i);
44
- if (t) {
45
- const { scrollTop: e, clientHeight: n } = t, o = x(e), s = y(n, o), u = Math.max(0, o - p), H = Math.min(r.length, o + s + p), d = T(u);
46
- v({
47
- height: z - d + "px",
48
- marginTop: d + "px"
49
- }), S(
50
- r.slice(u, H).map((k, C) => ({
51
- data: k,
52
- index: C + u
53
- }))
54
- );
55
- }
56
- };
57
- return B(() => {
58
- const t = m(w);
59
- t && Object.keys(g).forEach(
60
- (e) => t.style[e] = g[e]
61
- );
62
- }, [g]), O(() => {
63
- !a?.width || !a?.height || l();
64
- }, [a?.width, a?.height, r]), R(
65
- "scroll",
66
- (t) => {
67
- if (h.current) {
68
- h.current = !1;
69
- return;
70
- }
71
- t.preventDefault(), l();
72
- },
73
- {
74
- target: i
75
- }
76
- ), [L, _((t) => {
77
- const e = m(i);
78
- e && (h.current = !0, e.scrollTop = T(t), l());
79
- })];
80
- };
81
- export {
82
- Q as default
1
+ /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
+ import { isNumber as e } from "../../utils/is.js";
3
+ import t from "../use-latest/index.js";
4
+ import n from "../utils/domTarget.js";
5
+ import r from "../use-memoized-fn/index.js";
6
+ import i from "../use-update-effect/index.js";
7
+ import a from "../use-event-listener/index.js";
8
+ import o from "../use-size/index.js";
9
+ import { useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
10
+ //#region components/common/hooks/use-virtual-list/index.ts
11
+ var d = (d, f) => {
12
+ let { containerTarget: p, wrapperTarget: m, itemHeight: h, overscan: g = 5 } = f, _ = t(h), v = o(p), y = l(!1), [b, x] = u([]), [S, C] = u({}), w = (t, n) => {
13
+ if (e(_.current)) return Math.ceil(t / _.current);
14
+ let r = 0, i = 0;
15
+ for (let e = n; e < d.length; e++) {
16
+ let n = _.current(e, d[e]);
17
+ if (r += n, i = e, r >= t) break;
18
+ }
19
+ return i - n;
20
+ }, T = (t) => {
21
+ if (e(_.current)) return Math.floor(t / _.current);
22
+ let n = 0, r = 0;
23
+ for (let e = 0; e < d.length; e++) {
24
+ let i = _.current(e, d[e]);
25
+ if (n += i, n >= t) {
26
+ r = e;
27
+ break;
28
+ }
29
+ }
30
+ return r + 1;
31
+ }, E = (t) => e(_.current) ? t * _.current : d.slice(0, t).reduce((e, t, n) => e + _.current(n, d[n]), 0), D = c(() => e(_.current) ? d.length * _.current : d.reduce((e, t, n) => e + _.current(n, d[n]), 0), [d]), O = () => {
32
+ let e = n(p);
33
+ if (e) {
34
+ let { scrollTop: t, clientHeight: n } = e, r = T(t), i = w(n, r), a = Math.max(0, r - g), o = Math.min(d.length, r + i + g), s = E(a);
35
+ C({
36
+ height: D - s + "px",
37
+ marginTop: s + "px"
38
+ }), x(d.slice(a, o).map((e, t) => ({
39
+ data: e,
40
+ index: t + a
41
+ })));
42
+ }
43
+ };
44
+ return i(() => {
45
+ let e = n(m);
46
+ e && Object.keys(S).forEach((t) => e.style[t] = S[t]);
47
+ }, [S]), s(() => {
48
+ v?.width && v?.height && O();
49
+ }, [
50
+ v?.width,
51
+ v?.height,
52
+ d
53
+ ]), a("scroll", (e) => {
54
+ if (y.current) {
55
+ y.current = !1;
56
+ return;
57
+ }
58
+ e.preventDefault(), O();
59
+ }, { target: p }), [b, r((e) => {
60
+ let t = n(p);
61
+ t && (y.current = !0, t.scrollTop = E(e), O());
62
+ })];
83
63
  };
64
+ //#endregion
65
+ export { d as default };
66
+ /* 独立思考,明辨是非 */
@@ -1,14 +1,14 @@
1
- /* 2026-02-26 14:43:01 */
2
- import { useEffect as i } from "react";
3
- import "../../utils/is.js";
4
- import f from "../use-previous/index.js";
5
- import { isFunction as m } from "@unicom-cloud/utils/is";
6
- function u(o, t) {
7
- const r = f(o);
8
- return i(() => {
9
- o !== r && m(t) && t(o, r);
10
- }, [o]), [o, r];
1
+ /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
+ import { isFunction as e } from "../../utils/is.js";
3
+ import t from "../use-previous/index.js";
4
+ import { useEffect as n } from "react";
5
+ //#region components/common/hooks/use-watch/index.ts
6
+ function r(r, i) {
7
+ let a = t(r);
8
+ return n(() => {
9
+ r !== a && e(i) && i(r, a);
10
+ }, [r]), [r, a];
11
11
  }
12
- export {
13
- u as default
14
- };
12
+ //#endregion
13
+ export { r as default };
14
+ /* 独立思考,明辨是非 */
@@ -1,74 +1,50 @@
1
- /* 2026-02-26 14:43:01 */
2
- import { useState as O, useRef as i, useEffect as j } from "react";
3
- import s from "../use-latest/index.js";
4
- import f from "../use-memoized-fn/index.js";
5
- import q from "../use-unmount/index.js";
6
- var y = /* @__PURE__ */ ((n) => (n[n.Connecting = 0] = "Connecting", n[n.Open = 1] = "Open", n[n.Closing = 2] = "Closing", n[n.Closed = 3] = "Closed", n))(y || {});
7
- function H(n, M = {}) {
8
- const {
9
- reconnectLimit: a = 3,
10
- reconnectInterval: T = 3 * 1e3,
11
- manual: m = !1,
12
- onOpen: b,
13
- onClose: v,
14
- onMessage: w,
15
- onError: S,
16
- protocols: W
17
- } = M, [E, k] = O(), [l, u] = O(
18
- 3
19
- /* Closed */
20
- ), L = s(b), I = s(v), h = s(w), x = s(S), z = s(l), o = i(0), c = i(void 0), r = i(void 0), d = () => {
21
- o.current < a && r.current?.readyState !== 1 && (c.current && clearTimeout(c.current), c.current = setTimeout(() => {
22
- p(), o.current++;
23
- }, T));
24
- }, p = () => {
25
- c.current && clearTimeout(c.current), r.current && r.current.close();
26
- const e = new WebSocket(n, W);
27
- u(
28
- 0
29
- /* Connecting */
30
- ), e.onerror = (t) => {
31
- r.current === e && (d(), x.current?.(t, e), u(
32
- e.readyState || 3
33
- /* Closed */
34
- ));
35
- }, e.onopen = (t) => {
36
- r.current === e && (L.current?.(t, e), o.current = 0, u(
37
- e.readyState || 1
38
- /* Open */
39
- ));
40
- }, e.onmessage = (t) => {
41
- r.current === e && (h.current?.(t, e), k(t));
42
- }, e.onclose = (t) => {
43
- I.current?.(t, e), r.current === e && d(), (!r.current || r.current === e) && u(
44
- e.readyState || 3
45
- /* Closed */
46
- );
47
- }, r.current = e;
48
- }, F = (e) => {
49
- if (z.current === 1)
50
- r.current?.send(e);
51
- else
52
- throw new Error("WebSocket disconnected");
53
- }, g = () => {
54
- o.current = 0, p();
55
- }, C = () => {
56
- c.current && clearTimeout(c.current), o.current = a, r.current?.close(), r.current = void 0;
57
- };
58
- return j(() => {
59
- !m && n && g();
60
- }, [n, m]), q(() => {
61
- C();
62
- }), {
63
- latestMessage: E,
64
- sendMessage: f(F),
65
- connect: f(g),
66
- disconnect: f(C),
67
- readyState: l,
68
- webSocketIns: r.current
69
- };
1
+ /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
+ import e from "../use-latest/index.js";
3
+ import t from "../use-unmount/index.js";
4
+ import n from "../use-memoized-fn/index.js";
5
+ import { useEffect as r, useRef as i, useState as a } from "react";
6
+ //#region components/common/hooks/use-web-socket/index.ts
7
+ var o = /* @__PURE__ */ function(e) {
8
+ return e[e.Connecting = 0] = "Connecting", e[e.Open = 1] = "Open", e[e.Closing = 2] = "Closing", e[e.Closed = 3] = "Closed", e;
9
+ }({});
10
+ function s(s, c = {}) {
11
+ let { reconnectLimit: l = 3, reconnectInterval: u = 3 * 1e3, manual: d = !1, onOpen: f, onClose: p, onMessage: m, onError: h, protocols: g } = c, [_, v] = a(), [y, b] = a(o.Closed), x = e(f), S = e(p), C = e(m), w = e(h), T = e(y), E = i(0), D = i(void 0), O = i(void 0), k = () => {
12
+ E.current < l && O.current?.readyState !== o.Open && (D.current && clearTimeout(D.current), D.current = setTimeout(() => {
13
+ A(), E.current++;
14
+ }, u));
15
+ }, A = () => {
16
+ D.current && clearTimeout(D.current), O.current && O.current.close();
17
+ let e = new WebSocket(s, g);
18
+ b(o.Connecting), e.onerror = (t) => {
19
+ O.current === e && (k(), w.current?.(t, e), b(e.readyState || o.Closed));
20
+ }, e.onopen = (t) => {
21
+ O.current === e && (x.current?.(t, e), E.current = 0, b(e.readyState || o.Open));
22
+ }, e.onmessage = (t) => {
23
+ O.current === e && (C.current?.(t, e), v(t));
24
+ }, e.onclose = (t) => {
25
+ S.current?.(t, e), O.current === e && k(), (!O.current || O.current === e) && b(e.readyState || o.Closed);
26
+ }, O.current = e;
27
+ }, j = (e) => {
28
+ if (T.current === o.Open) O.current?.send?.(e);
29
+ else throw Error("WebSocket disconnected");
30
+ }, M = () => {
31
+ E.current = 0, A();
32
+ }, N = () => {
33
+ D.current && clearTimeout(D.current), E.current = l, O.current?.close?.(), O.current = void 0;
34
+ };
35
+ return r(() => {
36
+ !d && s && M();
37
+ }, [s, d]), t(() => {
38
+ N();
39
+ }), {
40
+ latestMessage: _,
41
+ sendMessage: n(j),
42
+ connect: n(M),
43
+ disconnect: n(N),
44
+ readyState: y,
45
+ webSocketIns: O.current
46
+ };
70
47
  }
71
- export {
72
- y as ReadyState,
73
- H as default
74
- };
48
+ //#endregion
49
+ export { o as ReadyState, s as default };
50
+ /* 独立思考,明辨是非 */
@@ -1,20 +1,24 @@
1
- /* 2026-02-26 14:43:01 */
2
- import { useRef as u, useEffect as f } from "react";
3
- function i(o, c) {
4
- const e = u({});
5
- f(() => {
6
- if (e.current) {
7
- const n = Object.keys({ ...e.current, ...c }), r = {};
8
- n.forEach((t) => {
9
- Object.is(e.current[t], c[t]) || (r[t] = {
10
- from: e.current[t],
11
- to: c[t]
12
- });
13
- }), Object.keys(r).length && console.log("[why-did-you-update]", o, r);
14
- }
15
- e.current = c;
16
- });
1
+ /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
+ import { useEffect as e, useRef as t } from "react";
3
+ //#region components/common/hooks/use-why-did-you-update/index.ts
4
+ function n(n, r) {
5
+ let i = t({});
6
+ e(() => {
7
+ if (i.current) {
8
+ let e = Object.keys({
9
+ ...i.current,
10
+ ...r
11
+ }), t = {};
12
+ e.forEach((e) => {
13
+ Object.is(i.current[e], r[e]) || (t[e] = {
14
+ from: i.current[e],
15
+ to: r[e]
16
+ });
17
+ }), Object.keys(t).length && console.log("[why-did-you-update]", n, t);
18
+ }
19
+ i.current = r;
20
+ });
17
21
  }
18
- export {
19
- i as default
20
- };
22
+ //#endregion
23
+ export { n as default };
24
+ /* 独立思考,明辨是非 */
@@ -1,46 +1,31 @@
1
- /* 2026-02-26 14:43:01 */
2
- import l from "lodash/debounce";
3
- import { useState as h, useDeferredValue as g, useMemo as p, useEffect as s } from "react";
4
- import "../../utils/is.js";
5
- import w from "../use-latest/index.js";
6
- import z from "../use-listen-window-resize/index.js";
7
- import { isFunction as E } from "@unicom-cloud/utils/is";
8
- function L(f) {
9
- const [r, o] = h({
10
- ...n()
11
- }), a = w(f), i = g(
12
- r
13
- // 延迟一个值与防抖和节流之间有什么不同?
14
- // 防抖(Debounce) 是指在用户停止输入一段时间(例如一秒钟)之后再更新列表。
15
- // 节流(Throttle) 是指每隔一段时间(例如最多每秒一次)更新列表。
16
- // 虽然这些技术在某些情况下是有用的,但 useDeferredValue 更适合优化渲染,因为它与 React 自身深度集成,并且能够适应用户的设备。
17
- // 与防抖或节流不同,useDeferredValue 不需要选择任何固定延迟时间。如果用户的设备很快(比如性能强劲的笔记本电脑),延迟的重渲染几乎会立即发生并且不会被察觉。如果用户的设备较慢,那么列表会相应地“滞后”于输入,滞后的程度与设备的速度有关。
18
- // 此外,与防抖或节流不同,useDeferredValue 执行的延迟重新渲染默认是可中断的。这意味着,如果 React 正在重新渲染一个大型列表,但用户进行了另一次键盘输入,React 会放弃该重新渲染,先处理键盘输入,然后再次开始在后台渲染。相比之下,防抖和节流仍会产生不顺畅的体验,因为它们是阻塞的:它们仅仅是将渲染阻塞键盘输入的时刻推迟了。
19
- // 如果你要优化的工作不是在渲染期间发生的,那么防抖和节流仍然非常有用。例如,它们可以让你减少网络请求的次数。你也可以同时使用这些技术。
20
- );
21
- function n(e) {
22
- let t = window;
23
- e instanceof Event && (t = e.currentTarget || e.target || t);
24
- const u = document.documentElement, {
25
- innerWidth: m = u.clientWidth,
26
- innerHeight: d = u.clientHeight
27
- } = t;
28
- return {
29
- width: m,
30
- height: d
31
- };
32
- }
33
- const c = p(() => l(function(t) {
34
- o(n(t));
35
- }, 123), []);
36
- return z(c), s(() => {
37
- const e = a.current;
38
- return E(e) && e(r), () => {
39
- };
40
- }, [i]), s(() => (o(n()), () => {
41
- c.cancel();
42
- }), []), i;
1
+ /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
+ import { isFunction as e } from "../../utils/is.js";
3
+ import t from "../use-latest/index.js";
4
+ import n from "../use-listen-window-resize/index.js";
5
+ import { useDeferredValue as r, useEffect as i, useMemo as a, useState as o } from "react";
6
+ import s from "lodash/debounce";
7
+ //#region components/common/hooks/use-window-size/index.ts
8
+ function c(c) {
9
+ let [l, u] = o({ ...p() }), d = t(c), f = r(l);
10
+ function p(e) {
11
+ let t = window;
12
+ e instanceof Event && (t = e.currentTarget || e.target || t);
13
+ let n = document.documentElement, { innerWidth: r = n.clientWidth, innerHeight: i = n.clientHeight } = t;
14
+ return {
15
+ width: r,
16
+ height: i
17
+ };
18
+ }
19
+ let m = a(() => s(function(e) {
20
+ u(p(e));
21
+ }, 123), []);
22
+ return n(m, [m]), i(() => {
23
+ let t = d.current;
24
+ return e(t) && t(l), () => {};
25
+ }, [f]), i(() => (u(p()), () => {
26
+ m.cancel();
27
+ }), []), f;
43
28
  }
44
- export {
45
- L as default
46
- };
29
+ //#endregion
30
+ export { c as default };
31
+ /* 独立思考,明辨是非 */
@@ -1,22 +1,23 @@
1
- /* 2026-02-26 14:43:01 */
2
- import g from "lodash/castArray";
3
- import { useRef as n } from "react";
4
- import l from "../use-unmount/index.js";
5
- import a from "./depsAreSame.js";
6
- import { getTargetElement as p } from "./domTarget.js";
7
- const U = (f) => (s, c, m) => {
8
- const u = n(!1), r = n([]), o = n([]), t = n(void 0);
9
- f(() => {
10
- const e = g(m).map((i) => p(i));
11
- if (!u.current) {
12
- u.current = !0, r.current = e, o.current = c, t.current = s();
13
- return;
14
- }
15
- (e.length !== r.current.length || !a(r.current, e) || !a(o.current, c)) && (t.current?.(), r.current = e, o.current = c, t.current = s());
16
- }), l(() => {
17
- t.current?.(), u.current = !1;
18
- });
19
- };
20
- export {
21
- U as default
1
+ /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
+ import e from "./domTarget.js";
3
+ import t from "../use-unmount/index.js";
4
+ import n from "./depsAreSame.js";
5
+ import { useRef as r } from "react";
6
+ import i from "lodash/castArray";
7
+ //#region components/common/hooks/utils/createEffectWithTarget.ts
8
+ var a = (a) => (o, s, c) => {
9
+ let l = r(!1), u = r([]), d = r([]), f = r(void 0);
10
+ a(() => {
11
+ let t = i(c).map((t) => e(t));
12
+ if (!l.current) {
13
+ l.current = !0, u.current = t, d.current = s, f.current = o();
14
+ return;
15
+ }
16
+ (t.length !== u.current.length || !n(u.current, t) || !n(d.current, s)) && (f.current?.(), u.current = t, d.current = s, f.current = o());
17
+ }), t(() => {
18
+ f.current?.(), l.current = !1;
19
+ });
22
20
  };
21
+ //#endregion
22
+ export { a as default };
23
+ /* 独立思考,明辨是非 */
@@ -1,12 +1,10 @@
1
- /* 2026-02-26 14:43:01 */
2
- function u(r, t) {
3
- if (r === t)
4
- return !0;
5
- for (let e = 0; e < r.length; e++)
6
- if (!Object.is(r[e], t[e]))
7
- return !1;
8
- return !0;
1
+ /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
+ //#region components/common/hooks/utils/depsAreSame.ts
3
+ function e(e, t) {
4
+ if (e === t) return !0;
5
+ for (let n = 0; n < e.length; n++) if (!Object.is(e[n], t[n])) return !1;
6
+ return !0;
9
7
  }
10
- export {
11
- u as default
12
- };
8
+ //#endregion
9
+ export { e as default };
10
+ /* 独立思考,明辨是非 */
@@ -1,7 +1,7 @@
1
- /* 2026-02-26 14:43:01 */
2
- import "../../utils/is.js";
3
- import { isEqual as r } from "@unicom-cloud/utils/is";
4
- const m = (o = [], p = []) => r(o, p);
5
- export {
6
- m as depsEqual
7
- };
1
+ /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
+ import { isEqual as e } from "../../utils/is.js";
3
+ //#region components/common/hooks/utils/depsEqual.ts
4
+ var t = (t = [], n = []) => e(t, n);
5
+ //#endregion
6
+ export { t as depsEqual };
7
+ /* 独立思考,明辨是非 */