@unicom-cloud/ui-common 0.1.6 → 0.1.7

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 (396) hide show
  1. package/Development.js +1 -1
  2. package/Empty.js +1 -1
  3. package/Flex.js +1 -1
  4. package/Motion.js +9 -0
  5. package/Progress.js +1 -1
  6. package/ResizeObserver.js +10 -0
  7. package/Space.js +1 -1
  8. package/SuspenseFallbackTest.js +1 -1
  9. package/TransitionGroup.js +30 -29
  10. package/development/index.js +38 -27
  11. package/empty/index.js +36 -32
  12. package/flex/index.js +56 -50
  13. package/flex/interface.js +1 -1
  14. package/higher-order/index.js +1 -1
  15. package/higher-order/with-speech-synthesis/index.js +33 -37
  16. package/higher-order/withSpeechSynthesis.js +1 -1
  17. package/hooks/create-deep-compare-effect/index.js +1 -1
  18. package/hooks/create-update-effect/index.js +1 -1
  19. package/hooks/create-use-storage-state/index.js +1 -1
  20. package/hooks/createDeepCompareEffect.js +1 -1
  21. package/hooks/createUpdateEffect.js +1 -1
  22. package/hooks/createUseStorageState.js +1 -1
  23. package/hooks/index.js +177 -171
  24. package/hooks/use-async-effect/index.js +1 -1
  25. package/hooks/use-boolean/index.js +1 -1
  26. package/hooks/use-click-away/index.js +19 -20
  27. package/hooks/use-computed-state/index.js +1 -1
  28. package/hooks/use-controllable-value/index.js +5 -5
  29. package/hooks/use-cookie-state/index.js +1 -1
  30. package/hooks/use-count-down/index.js +3 -3
  31. package/hooks/use-counter/index.js +1 -1
  32. package/hooks/use-create/index.js +1 -1
  33. package/hooks/use-creation/index.js +1 -1
  34. package/hooks/use-debounce/index.js +1 -1
  35. package/hooks/use-debounce-effect/index.js +1 -1
  36. package/hooks/use-debounce-fn/index.js +1 -1
  37. package/hooks/use-deep-compare-effect/index.js +1 -1
  38. package/hooks/use-deep-compare-layout-effect/index.js +1 -1
  39. package/hooks/use-document-visibility/index.js +1 -1
  40. package/hooks/use-drag/index.js +10 -10
  41. package/hooks/use-drop/index.js +1 -1
  42. package/hooks/use-event/index.js +10 -0
  43. package/hooks/use-event-listener/index.js +15 -16
  44. package/hooks/use-event-target/index.js +3 -3
  45. package/hooks/use-external/index.js +1 -1
  46. package/hooks/use-favicon/index.js +1 -1
  47. package/hooks/use-focus-within/index.js +1 -1
  48. package/hooks/use-force-update/index.js +1 -1
  49. package/hooks/use-fullscreen/index.js +13 -13
  50. package/hooks/use-get-state/index.js +6 -6
  51. package/hooks/use-history-travel/index.js +18 -18
  52. package/hooks/use-hover/index.js +1 -1
  53. package/hooks/use-id/index.js +1 -1
  54. package/hooks/use-in-view/index.js +1 -1
  55. package/hooks/use-in-viewport/index.js +17 -18
  56. package/hooks/use-infinite-scroll/index.js +1 -1
  57. package/hooks/use-intersection-observer/index.js +7 -6
  58. package/hooks/use-intersection-observers/index.js +34 -26
  59. package/hooks/use-interval/index.js +7 -7
  60. package/hooks/use-is-first-render/index.js +1 -1
  61. package/hooks/use-isomorphic-layout-effect/index.js +1 -1
  62. package/hooks/use-key-press/index.js +21 -21
  63. package/hooks/use-keyboard-event/index.js +1 -1
  64. package/hooks/use-latest/index.js +1 -1
  65. package/hooks/use-listen-window-resize/index.js +4 -4
  66. package/hooks/use-local-storage-state/index.js +1 -1
  67. package/hooks/use-lock-fn/index.js +1 -1
  68. package/hooks/use-long-press/index.js +24 -24
  69. package/hooks/use-map/index.js +1 -1
  70. package/hooks/use-media/index.js +1 -1
  71. package/hooks/use-memo/index.js +9 -0
  72. package/hooks/use-memoized-fn/index.js +1 -1
  73. package/hooks/use-merge-props/index.js +1 -1
  74. package/hooks/use-merge-value/index.js +1 -1
  75. package/hooks/use-mount/index.js +1 -1
  76. package/hooks/use-mouse/index.js +1 -1
  77. package/hooks/use-mutation-observer/index.js +9 -9
  78. package/hooks/use-mutation-observers/index.js +33 -25
  79. package/hooks/use-network/index.js +1 -1
  80. package/hooks/use-online-status/index.js +1 -1
  81. package/hooks/use-overflow-hidden/index.js +1 -1
  82. package/hooks/use-override-ref/index.js +3 -3
  83. package/hooks/use-pagination/index.js +1 -1
  84. package/hooks/use-persist-callback/index.js +1 -1
  85. package/hooks/use-prefers-color-scheme-dark/index.js +1 -1
  86. package/hooks/use-previous/index.js +1 -1
  87. package/hooks/use-raf-interval/index.js +15 -15
  88. package/hooks/use-raf-state/index.js +1 -1
  89. package/hooks/use-raf-timeout/index.js +3 -3
  90. package/hooks/use-reactive/index.js +7 -7
  91. package/hooks/use-ref-latest/index.js +1 -1
  92. package/hooks/use-refs/index.js +4 -4
  93. package/hooks/use-request/index.js +1 -1
  94. package/hooks/use-request/src/Fetch.js +1 -1
  95. package/hooks/use-request/src/plugins/useAutoRunPlugin.js +1 -1
  96. package/hooks/use-request/src/plugins/useCachePlugin.js +3 -3
  97. package/hooks/use-request/src/plugins/useDebouncePlugin.js +1 -1
  98. package/hooks/use-request/src/plugins/useLoadingDelayPlugin.js +8 -8
  99. package/hooks/use-request/src/plugins/usePollingPlugin.js +13 -13
  100. package/hooks/use-request/src/plugins/useRefreshOnWindowFocusPlugin.js +3 -3
  101. package/hooks/use-request/src/plugins/useRetryPlugin.js +5 -5
  102. package/hooks/use-request/src/plugins/useThrottlePlugin.js +3 -3
  103. package/hooks/use-request/src/useRequest.js +1 -1
  104. package/hooks/use-request/src/useRequestImplement.js +7 -7
  105. package/hooks/use-request/src/utils/cache.js +1 -1
  106. package/hooks/use-request/src/utils/cachePromise.js +1 -1
  107. package/hooks/use-request/src/utils/cacheSubscribe.js +1 -1
  108. package/hooks/use-request/src/utils/isDocumentVisible.js +1 -1
  109. package/hooks/use-request/src/utils/isOnline.js +1 -1
  110. package/hooks/use-request/src/utils/limit.js +1 -1
  111. package/hooks/use-request/src/utils/subscribeFocus.js +1 -1
  112. package/hooks/use-request/src/utils/subscribeReVisible.js +1 -1
  113. package/hooks/use-reset-state/index.js +7 -7
  114. package/hooks/use-resize-observer/index.js +1 -1
  115. package/hooks/use-resize-observers/index.js +34 -26
  116. package/hooks/use-responsive/index.js +1 -1
  117. package/hooks/use-safe-state/index.js +4 -4
  118. package/hooks/use-scroll/index.js +1 -1
  119. package/hooks/use-selections/index.js +1 -1
  120. package/hooks/use-session-storage-state/index.js +1 -1
  121. package/hooks/use-set/index.js +1 -1
  122. package/hooks/use-set-state/index.js +1 -1
  123. package/hooks/use-size/index.js +20 -23
  124. package/hooks/use-state-callback/index.js +6 -6
  125. package/hooks/use-state-with-promise/index.js +1 -1
  126. package/hooks/use-sync-state/index.js +15 -0
  127. package/hooks/use-text-selection/index.js +13 -13
  128. package/hooks/use-theme/index.js +1 -1
  129. package/hooks/use-throttle/index.js +1 -1
  130. package/hooks/use-throttle-effect/index.js +1 -1
  131. package/hooks/use-throttle-fn/index.js +6 -6
  132. package/hooks/use-timeout/index.js +3 -3
  133. package/hooks/use-title/index.js +1 -1
  134. package/hooks/use-toggle/index.js +1 -1
  135. package/hooks/use-tracked-effect/index.js +1 -1
  136. package/hooks/use-unmount/index.js +1 -1
  137. package/hooks/use-unmounted-ref/index.js +4 -4
  138. package/hooks/use-update/index.js +1 -1
  139. package/hooks/use-update-effect/index.js +1 -1
  140. package/hooks/use-update-layout-effect/index.js +1 -1
  141. package/hooks/use-url-state/index.js +3 -3
  142. package/hooks/use-virtual-list/index.js +10 -10
  143. package/hooks/use-watch/index.js +1 -1
  144. package/hooks/use-web-socket/index.js +30 -30
  145. package/hooks/use-why-did-you-update/index.js +1 -1
  146. package/hooks/use-window-size/index.js +28 -25
  147. package/hooks/useAsyncEffect.js +1 -1
  148. package/hooks/useBoolean.js +1 -1
  149. package/hooks/useClickAway.js +4 -5
  150. package/hooks/useComputedState.js +1 -1
  151. package/hooks/useControllableValue.js +1 -1
  152. package/hooks/useCookieState.js +1 -1
  153. package/hooks/useCountDown.js +1 -1
  154. package/hooks/useCounter.js +1 -1
  155. package/hooks/useCreate.js +1 -1
  156. package/hooks/useCreation.js +1 -1
  157. package/hooks/useDebounce.js +1 -1
  158. package/hooks/useDebounceEffect.js +1 -1
  159. package/hooks/useDebounceFn.js +1 -1
  160. package/hooks/useDeepCompareEffect.js +1 -1
  161. package/hooks/useDeepCompareLayoutEffect.js +1 -1
  162. package/hooks/useDocumentVisibility.js +1 -1
  163. package/hooks/useDrag.js +1 -1
  164. package/hooks/useDrop.js +1 -1
  165. package/hooks/useEvent.js +7 -0
  166. package/hooks/useEventListener.js +4 -5
  167. package/hooks/useEventTarget.js +1 -1
  168. package/hooks/useExternal.js +1 -1
  169. package/hooks/useFavicon.js +1 -1
  170. package/hooks/useFocusWithin.js +1 -1
  171. package/hooks/useForceUpdate.js +1 -1
  172. package/hooks/useFullscreen.js +1 -1
  173. package/hooks/useGetState.js +1 -1
  174. package/hooks/useHistoryTravel.js +1 -1
  175. package/hooks/useHover.js +1 -1
  176. package/hooks/useId.js +1 -1
  177. package/hooks/useInView.js +1 -1
  178. package/hooks/useInViewport.js +4 -5
  179. package/hooks/useInfiniteScroll.js +1 -1
  180. package/hooks/useIntersectionObserver.js +5 -4
  181. package/hooks/useIntersectionObservers.js +11 -7
  182. package/hooks/useInterval.js +1 -1
  183. package/hooks/useIsFirstRender.js +1 -1
  184. package/hooks/useIsomorphicLayoutEffect.js +1 -1
  185. package/hooks/useKeyPress.js +1 -1
  186. package/hooks/useKeyboardEvent.js +1 -1
  187. package/hooks/useLatest.js +1 -1
  188. package/hooks/useListenWindowResize.js +1 -1
  189. package/hooks/useLocalStorageState.js +1 -1
  190. package/hooks/useLockFn.js +1 -1
  191. package/hooks/useLongPress.js +1 -1
  192. package/hooks/useMap.js +1 -1
  193. package/hooks/useMedia.js +1 -1
  194. package/hooks/useMemo.js +6 -0
  195. package/hooks/useMemoizedFn.js +1 -1
  196. package/hooks/useMergeProps.js +1 -1
  197. package/hooks/useMergeValue.js +1 -1
  198. package/hooks/useMount.js +1 -1
  199. package/hooks/useMouse.js +1 -1
  200. package/hooks/useMutationObserver.js +1 -1
  201. package/hooks/useMutationObservers.js +11 -7
  202. package/hooks/useNetwork.js +1 -1
  203. package/hooks/useOnlineStatus.js +1 -1
  204. package/hooks/useOverflowHidden.js +1 -1
  205. package/hooks/useOverrideRef.js +3 -3
  206. package/hooks/usePagination.js +1 -1
  207. package/hooks/usePersistCallback.js +1 -1
  208. package/hooks/usePrefersColorSchemeDark.js +1 -1
  209. package/hooks/usePrevious.js +1 -1
  210. package/hooks/useRafInterval.js +1 -1
  211. package/hooks/useRafState.js +1 -1
  212. package/hooks/useRafTimeout.js +1 -1
  213. package/hooks/useReactive.js +1 -1
  214. package/hooks/useRefLatest.js +1 -1
  215. package/hooks/useRefs.js +1 -1
  216. package/hooks/useRequest.js +1 -1
  217. package/hooks/useResetState.js +1 -1
  218. package/hooks/useResizeObserver.js +1 -1
  219. package/hooks/useResizeObservers.js +11 -7
  220. package/hooks/useResponsive.js +1 -1
  221. package/hooks/useSafeState.js +1 -1
  222. package/hooks/useScroll.js +1 -1
  223. package/hooks/useSelections.js +1 -1
  224. package/hooks/useSessionStorageState.js +1 -1
  225. package/hooks/useSet.js +1 -1
  226. package/hooks/useSetState.js +1 -1
  227. package/hooks/useSize.js +4 -3
  228. package/hooks/useStateCallback.js +1 -1
  229. package/hooks/useStateWithPromise.js +1 -1
  230. package/hooks/useSyncState.js +10 -0
  231. package/hooks/useTextSelection.js +1 -1
  232. package/hooks/useTheme.js +1 -1
  233. package/hooks/useThrottle.js +1 -1
  234. package/hooks/useThrottleEffect.js +1 -1
  235. package/hooks/useThrottleFn.js +1 -1
  236. package/hooks/useTimeout.js +1 -1
  237. package/hooks/useTitle.js +1 -1
  238. package/hooks/useToggle.js +1 -1
  239. package/hooks/useTrackedEffect.js +1 -1
  240. package/hooks/useUnmount.js +1 -1
  241. package/hooks/useUnmountedRef.js +1 -1
  242. package/hooks/useUpdate.js +1 -1
  243. package/hooks/useUpdateEffect.js +1 -1
  244. package/hooks/useUpdateLayoutEffect.js +1 -1
  245. package/hooks/useUrlState.js +1 -1
  246. package/hooks/useVirtualList.js +1 -1
  247. package/hooks/useWatch.js +1 -1
  248. package/hooks/useWebSocket.js +1 -1
  249. package/hooks/useWhyDidYouUpdate.js +1 -1
  250. package/hooks/useWindowSize.js +4 -3
  251. package/hooks/utils/createEffectWithTarget.js +11 -12
  252. package/hooks/utils/depsAreSame.js +1 -1
  253. package/hooks/utils/depsEqual.js +1 -1
  254. package/hooks/utils/domTarget.js +1 -1
  255. package/hooks/utils/getDocumentOrShadow.js +5 -6
  256. package/hooks/utils/index.js +1 -1
  257. package/hooks/utils/isAppleDevice.js +1 -1
  258. package/hooks/utils/isBrowser.js +1 -1
  259. package/hooks/utils/isDev.js +1 -1
  260. package/hooks/utils/rect.js +1 -1
  261. package/hooks/utils/useDeepCompareWithTarget.js +4 -4
  262. package/hooks/utils/useEffectWithTarget.js +1 -1
  263. package/hooks/utils/useIsomorphicLayoutEffectWithTarget.js +1 -1
  264. package/hooks/utils/useLayoutEffectWithTarget.js +1 -1
  265. package/hooks/utils.js +1 -1
  266. package/icons/file/index.js +31 -24
  267. package/icons/file.js +1 -1
  268. package/index.js +47 -46
  269. package/motion/CSSMotion.js +102 -0
  270. package/motion/CSSMotionList.js +100 -0
  271. package/motion/context.js +14 -0
  272. package/motion/hooks/useDomMotionEvents.js +21 -0
  273. package/motion/hooks/useNextFrame.js +24 -0
  274. package/motion/hooks/useStatus.js +121 -0
  275. package/motion/hooks/useStepQueue.js +44 -0
  276. package/motion/index.js +9 -0
  277. package/motion/interface.js +14 -0
  278. package/motion/util/diff.js +56 -0
  279. package/motion/util/motion.js +56 -0
  280. package/package.json +1 -1
  281. package/progress/index.js +1 -1
  282. package/resize-observer/Collection.js +25 -0
  283. package/resize-observer/SingleObserver.js +48 -0
  284. package/resize-observer/index.js +27 -0
  285. package/resize-observer/observerUtil.js +22 -0
  286. package/space/index.js +65 -52
  287. package/suspense-fallback-test/index.js +1 -1
  288. package/transition-group/CSSTransition.js +59 -54
  289. package/transition-group/ChildMapping.js +68 -0
  290. package/transition-group/PqbCSSTransition.js +22 -18
  291. package/transition-group/ReplaceTransition.js +7 -7
  292. package/transition-group/SwitchTransition.js +1 -1
  293. package/transition-group/Transition.js +56 -52
  294. package/transition-group/TransitionGroup.js +2 -3
  295. package/transition-group/TransitionGroupContext.js +1 -1
  296. package/transition-group/index.js +30 -29
  297. package/types/hooks/index.d.ts +3 -0
  298. package/types/hooks/use-event/index.d.ts +2 -0
  299. package/types/hooks/use-intersection-observers/index.d.ts +3 -1
  300. package/types/hooks/use-listen-window-resize/index.d.ts +4 -4
  301. package/types/hooks/use-memo/index.d.ts +2 -0
  302. package/types/hooks/use-mutation-observers/index.d.ts +3 -1
  303. package/types/hooks/use-resize-observers/index.d.ts +3 -1
  304. package/types/hooks/use-size/index.d.ts +1 -1
  305. package/types/hooks/use-sync-state/index.d.ts +10 -0
  306. package/types/hooks/use-window-size/index.d.ts +2 -3
  307. package/types/motion/CSSMotion.d.ts +77 -0
  308. package/types/motion/CSSMotionList.d.ts +34 -0
  309. package/types/motion/context.d.ts +9 -0
  310. package/types/motion/hooks/useDomMotionEvents.d.ts +3 -0
  311. package/types/motion/hooks/useNextFrame.d.ts +7 -0
  312. package/types/motion/hooks/useStatus.d.ts +5 -0
  313. package/types/motion/hooks/useStepQueue.d.ts +8 -0
  314. package/types/motion/index.d.ts +9 -0
  315. package/types/motion/interface.d.ts +22 -0
  316. package/types/motion/util/diff.d.ts +20 -0
  317. package/types/motion/util/motion.d.ts +10 -0
  318. package/types/resize-observer/Collection.d.ts +9 -0
  319. package/types/resize-observer/SingleObserver.d.ts +7 -0
  320. package/types/resize-observer/index.d.ts +7 -0
  321. package/types/resize-observer/interface.d.ts +25 -0
  322. package/types/resize-observer/observerUtil.d.ts +3 -0
  323. package/types/space/interface.d.ts +1 -1
  324. package/types/transition-group/CSSTransition.d.ts +0 -1
  325. package/types/transition-group/{utils/ChildMapping.d.ts → ChildMapping.d.ts} +4 -4
  326. package/types/transition-group/SwitchTransition.d.ts +3 -3
  327. package/types/transition-group/Transition.d.ts +1 -1
  328. package/types/transition-group/TransitionGroup.d.ts +1 -1
  329. package/types/transition-group/index.d.ts +1 -1
  330. package/types/utils/callbackOriginRef.d.ts +4 -0
  331. package/types/utils/dom.d.ts +2 -1
  332. package/types/utils/findRootElement.d.ts +23 -0
  333. package/types/utils/index.d.ts +4 -2
  334. package/types/utils/is.d.ts +5 -4
  335. package/types/utils/lodash.d.ts +2 -1
  336. package/types/utils/ref.d.ts +27 -0
  337. package/types/utils/setCreateRoot.d.ts +13 -0
  338. package/types/utils/toArray.d.ts +3 -3
  339. package/utils/callbackOriginRef.js +11 -0
  340. package/utils/caseName.js +1 -1
  341. package/utils/className.js +1 -1
  342. package/utils/compute.js +1 -1
  343. package/utils/constant.js +1 -1
  344. package/utils/copy.js +1 -1
  345. package/utils/date.js +1 -1
  346. package/utils/dayjs.js +1 -1
  347. package/utils/dom.js +12 -10
  348. package/utils/emitter.js +1 -1
  349. package/utils/fileToURL.js +1 -1
  350. package/utils/fillNBSP.js +1 -1
  351. package/utils/findRootElement.js +28 -0
  352. package/utils/findScrollParent.js +1 -1
  353. package/utils/getHighlightText.js +1 -1
  354. package/utils/getHotkeyHandler.js +1 -1
  355. package/utils/getStringLength.js +1 -1
  356. package/utils/include.js +1 -1
  357. package/utils/index.js +341 -329
  358. package/utils/intersectionObserver.js +1 -1
  359. package/utils/is.js +72 -81
  360. package/utils/keyboardCode.js +1 -1
  361. package/utils/lodash.js +45 -43
  362. package/utils/math.js +1 -1
  363. package/utils/mergeProps.js +1 -1
  364. package/utils/mergedToString.js +1 -1
  365. package/utils/mutationObserver.js +1 -1
  366. package/utils/omit.js +1 -1
  367. package/utils/pad.js +1 -1
  368. package/utils/pick.js +1 -1
  369. package/utils/pinyin.js +1 -1
  370. package/utils/react19Adapter.js +2 -2
  371. package/utils/ref.js +41 -0
  372. package/utils/resizeObserver.js +1 -1
  373. package/utils/saveAs.js +1 -1
  374. package/utils/screenfull.js +1 -1
  375. package/utils/scrollIntoViewIfNeeded.js +1 -1
  376. package/utils/setCreateRoot.js +53 -0
  377. package/utils/setDarkTheme.js +1 -1
  378. package/utils/setDir.js +1 -1
  379. package/utils/setPrimaryColor.js +1 -1
  380. package/utils/setTheme.js +1 -1
  381. package/utils/string.js +1 -1
  382. package/utils/style.js +1 -1
  383. package/utils/throttleByRaf.js +1 -1
  384. package/utils/throttleByRaf2.js +1 -1
  385. package/utils/tinycolor.js +1 -1
  386. package/utils/toArray.js +9 -9
  387. package/utils/tree.js +1 -1
  388. package/utils/tween.js +1 -1
  389. package/utils/uuid.js +1 -1
  390. package/utils/validate.js +1 -1
  391. package/utils/warning.js +1 -1
  392. package/transition-group/utils/ChildMapping.js +0 -66
  393. package/types/utils/reactDOM.d.ts +0 -34
  394. package/types/utils/supportRef.d.ts +0 -3
  395. package/utils/reactDOM.js +0 -87
  396. package/utils/supportRef.js +0 -10
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * 监听页面resize事件的统一封装
3
3
  * @desc {en} Unified encapsulation for monitoring page resize events
4
- * @param resizeHandler resize事件回调
5
- * @param resizeHandler {en} Resize event callback
4
+ * @param callback resize事件回调
5
+ * @param callback {en} Resize event callback
6
6
  * @param deps 触发事件绑定更新的依赖
7
7
  * @param deps {en} Dependencies that trigger event binding updates
8
8
  * @example
9
9
  * ```
10
10
  * import { useListenWindowResize } from './hooks';
11
11
  *
12
- * useListenWindowResize(setSize, [], listenResize);
12
+ * useListenWindowResize(callback, []);
13
13
  * ```
14
14
  */
15
- declare function useListenWindowResize(resizeHandler: (e: any) => void, deps?: unknown[]): void;
15
+ declare function useListenWindowResize(callback: (e: any) => void, deps?: unknown[]): void;
16
16
  export default useListenWindowResize;
@@ -0,0 +1,2 @@
1
+ declare function useMemo<Value, Condition = unknown[]>(getValue: () => Value, condition: Condition, shouldUpdate: (prev: Condition, next: Condition) => boolean): Value | undefined;
2
+ export default useMemo;
@@ -1,4 +1,6 @@
1
1
  import { DependencyList } from 'react';
2
- declare function useMutationObservers(callback: MutationCallback, deps?: DependencyList, options?: MutationObserverInit): MutationRecord[] | undefined;
2
+ declare function useMutationObservers(callback: MutationCallback, deps?: DependencyList, options?: MutationObserverInit & {
3
+ immediate?: boolean;
4
+ }): MutationRecord[] | undefined;
3
5
  export { useMutationObservers };
4
6
  export default useMutationObservers;
@@ -1,4 +1,6 @@
1
1
  import { DependencyList } from 'react';
2
- declare function useResizeObservers(callback: ResizeObserverCallback, deps?: DependencyList, options?: ResizeObserverOptions): ResizeObserverEntry[] | undefined;
2
+ declare function useResizeObservers(callback: ResizeObserverCallback, deps?: DependencyList, options?: ResizeObserverOptions & {
3
+ immediate?: boolean;
4
+ }): ResizeObserverEntry[] | undefined;
3
5
  export { useResizeObservers };
4
6
  export default useResizeObservers;
@@ -3,5 +3,5 @@ type Size = {
3
3
  width: number;
4
4
  height: number;
5
5
  };
6
- declare function useSize(target: BasicTarget, onResize?: (size: Size | undefined) => void): Size | undefined;
6
+ declare function useSize(target: BasicTarget, callback?: (size: Size | undefined) => void): Size | undefined;
7
7
  export default useSize;
@@ -0,0 +1,10 @@
1
+ type Updater<T> = T | ((prevValue: T) => T);
2
+ export type SetState<T> = (nextValue: Updater<T>) => void;
3
+ /**
4
+ * Same as React.useState but will always get latest state.
5
+ * This is useful when React merge multiple state updates into one.
6
+ * e.g. onTransitionEnd trigger multiple event at once will be merged state update in React.
7
+ * 同步 state 能立即拿到状态
8
+ */
9
+ declare function useSyncState<T>(defaultValue?: T): [get: () => T, set: SetState<T>];
10
+ export default useSyncState;
@@ -1,8 +1,7 @@
1
1
  /**
2
2
  * 获取页面视口宽高大小,并在页面有 resize 时更新大小
3
3
  * @desc {en} Get the width and height of the page viewport, and update the size when the page is resized
4
- * @param debounceFlag 是否开启防抖处理
5
- * @param resizeCallback 回调函数
4
+ * @param callback 回调函数
6
5
  * @returns 页面宽高,{ width, height }
7
6
  * @example
8
7
  * ```
@@ -11,7 +10,7 @@
11
10
  * const { width, height } = useWindowSize();
12
11
  * ```
13
12
  */
14
- declare function useWindowSize(debounceFlag: boolean | undefined, resizeCallback: any): {
13
+ declare function useWindowSize(callback: any): {
15
14
  width: number;
16
15
  height: number;
17
16
  };
@@ -0,0 +1,77 @@
1
+ import React from 'react';
2
+ import type { MotionEndEventHandler, MotionEventHandler, MotionPrepareEventHandler, MotionStatus } from './interface';
3
+ export interface CSSMotionRef {
4
+ nativeElement: HTMLElement;
5
+ inMotion: () => boolean;
6
+ enableMotion: () => boolean;
7
+ }
8
+ export type CSSMotionConfig = boolean | {
9
+ transitionSupport?: boolean;
10
+ };
11
+ export type MotionName = string | {
12
+ appear?: string;
13
+ enter?: string;
14
+ leave?: string;
15
+ appearActive?: string;
16
+ enterActive?: string;
17
+ leaveActive?: string;
18
+ };
19
+ export interface CSSMotionProps {
20
+ motionName?: MotionName;
21
+ visible?: boolean;
22
+ motionAppear?: boolean;
23
+ motionEnter?: boolean;
24
+ motionLeave?: boolean;
25
+ motionLeaveImmediately?: boolean;
26
+ motionDeadline?: number;
27
+ /**
28
+ * Create element in view even the element is invisible.
29
+ * Will patch `display: none` style on it.
30
+ */
31
+ forceRender?: boolean;
32
+ /**
33
+ * Remove element when motion end. This will not work when `forceRender` is set.
34
+ */
35
+ removeOnLeave?: boolean;
36
+ leavedClassName?: string;
37
+ /** @private Used by CSSMotionList. Do not use in your production. */
38
+ eventProps?: object;
39
+ /** Prepare phase is used for measure element info. It will always trigger even motion is off */
40
+ onAppearPrepare?: MotionPrepareEventHandler;
41
+ /** Prepare phase is used for measure element info. It will always trigger even motion is off */
42
+ onEnterPrepare?: MotionPrepareEventHandler;
43
+ /** Prepare phase is used for measure element info. It will always trigger even motion is off */
44
+ onLeavePrepare?: MotionPrepareEventHandler;
45
+ onAppearStart?: MotionEventHandler;
46
+ onEnterStart?: MotionEventHandler;
47
+ onLeaveStart?: MotionEventHandler;
48
+ onAppearActive?: MotionEventHandler;
49
+ onEnterActive?: MotionEventHandler;
50
+ onLeaveActive?: MotionEventHandler;
51
+ onAppearEnd?: MotionEndEventHandler;
52
+ onEnterEnd?: MotionEndEventHandler;
53
+ onLeaveEnd?: MotionEndEventHandler;
54
+ /** This will always trigger after final visible changed. Even if no motion configured. */
55
+ onVisibleChanged?: (visible: boolean) => void;
56
+ internalRef?: React.Ref<any>;
57
+ children?: (props: {
58
+ visible?: boolean;
59
+ className?: string;
60
+ style?: React.CSSProperties;
61
+ [key: string]: any;
62
+ }, ref: React.Ref<any>) => React.ReactElement;
63
+ }
64
+ export interface CSSMotionState {
65
+ status?: MotionStatus;
66
+ statusActive?: boolean;
67
+ newStatus?: boolean;
68
+ statusStyle?: React.CSSProperties;
69
+ prevProps?: CSSMotionProps;
70
+ }
71
+ /**
72
+ * `transitionSupport` is used for none transition test case.
73
+ * Default we use browser transition event support check.
74
+ */
75
+ export declare function genCSSMotion(config: CSSMotionConfig): React.ForwardRefExoticComponent<CSSMotionProps & React.RefAttributes<CSSMotionRef>>;
76
+ declare const _default: React.ForwardRefExoticComponent<CSSMotionProps & React.RefAttributes<CSSMotionRef>>;
77
+ export default _default;
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import type { CSSMotionProps } from './CSSMotion';
3
+ import type { KeyObject } from './util/diff';
4
+ export interface CSSMotionListProps extends Omit<CSSMotionProps, 'onVisibleChanged' | 'children'>, Omit<React.HTMLAttributes<any>, 'children'> {
5
+ keys: (React.Key | {
6
+ key: React.Key;
7
+ [name: string]: any;
8
+ })[];
9
+ component?: string | React.ComponentType | false;
10
+ /** This will always trigger after final visible changed. Even if no motion configured. */
11
+ onVisibleChanged?: (visible: boolean, info: {
12
+ key: React.Key;
13
+ }) => void;
14
+ /** All motion leaves in the screen */
15
+ onAllRemoved?: () => void;
16
+ children?: (props: {
17
+ visible?: boolean;
18
+ className?: string;
19
+ style?: React.CSSProperties;
20
+ index?: number;
21
+ [key: string]: any;
22
+ }, ref: React.Ref<any>) => React.ReactElement;
23
+ }
24
+ export interface CSSMotionListState {
25
+ keyEntities: KeyObject[];
26
+ }
27
+ /**
28
+ * Generate a CSSMotionList component with config
29
+ * @param transitionSupport No need since CSSMotionList no longer depends on transition support
30
+ * @param CSSMotion CSSMotion component
31
+ */
32
+ export declare function genCSSMotionList(transitionSupport: boolean, CSSMotion?: React.ForwardRefExoticComponent<CSSMotionProps & React.RefAttributes<import("./CSSMotion").CSSMotionRef>>): React.ComponentClass<CSSMotionListProps>;
33
+ declare const _default: React.ComponentClass<CSSMotionListProps, any>;
34
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface MotionContextProps {
3
+ motion?: boolean;
4
+ }
5
+ export declare const Context: React.Context<MotionContextProps>;
6
+ export default function MotionProvider({ children, ...props }: MotionContextProps & {
7
+ children?: React.ReactNode;
8
+ }): React.JSX.Element;
9
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { MotionEvent } from '../interface';
2
+ declare function useDomMotionEvents(onInternalMotionEnd: (event: MotionEvent) => void): [(element: HTMLElement) => void, (element: HTMLElement) => void];
3
+ export default useDomMotionEvents;
@@ -0,0 +1,7 @@
1
+ declare function useNextFrame(): [
2
+ (callback: (info: {
3
+ isCanceled: () => boolean;
4
+ }) => void) => void,
5
+ () => void
6
+ ];
7
+ export default useNextFrame;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { CSSMotionProps } from '../CSSMotion';
3
+ import type { MotionStatus, StepStatus } from '../interface';
4
+ declare function useStatus(supportMotion: boolean, visible: boolean, getElement: () => HTMLElement, { motionEnter, motionAppear, motionLeave, motionDeadline, motionLeaveImmediately, onAppearPrepare, onEnterPrepare, onLeavePrepare, onAppearStart, onEnterStart, onLeaveStart, onAppearActive, onEnterActive, onLeaveActive, onAppearEnd, onEnterEnd, onLeaveEnd, onVisibleChanged, }: CSSMotionProps): [() => MotionStatus, StepStatus, React.CSSProperties, boolean];
5
+ export default useStatus;
@@ -0,0 +1,8 @@
1
+ import type { MotionStatus, StepStatus } from '../interface';
2
+ /** Skip current step */
3
+ export declare const SkipStep: false;
4
+ /** Current step should be update in */
5
+ export declare const DoStep: true;
6
+ export declare function isActive(step: StepStatus): step is "active" | "end";
7
+ declare function useStepQueue(status: MotionStatus, prepareOnly: boolean, callback: (step: StepStatus) => Promise<void> | void | typeof SkipStep | typeof DoStep): [() => void, StepStatus];
8
+ export default useStepQueue;
@@ -0,0 +1,9 @@
1
+ import type { CSSMotionProps } from './CSSMotion';
2
+ import CSSMotion from './CSSMotion';
3
+ import type { CSSMotionListProps } from './CSSMotionList';
4
+ import CSSMotionList from './CSSMotionList';
5
+ import type { MotionEndEventHandler, MotionEventHandler } from './interface';
6
+ export { default as Provider } from './context';
7
+ export { CSSMotionList };
8
+ export type { CSSMotionListProps, CSSMotionProps, MotionEndEventHandler, MotionEventHandler, };
9
+ export default CSSMotion;
@@ -0,0 +1,22 @@
1
+ export declare const STATUS_NONE: "none";
2
+ export declare const STATUS_APPEAR: "appear";
3
+ export declare const STATUS_ENTER: "enter";
4
+ export declare const STATUS_LEAVE: "leave";
5
+ export type MotionStatus = typeof STATUS_NONE | typeof STATUS_APPEAR | typeof STATUS_ENTER | typeof STATUS_LEAVE;
6
+ export declare const STEP_NONE: "none";
7
+ export declare const STEP_PREPARE: "prepare";
8
+ export declare const STEP_START: "start";
9
+ export declare const STEP_ACTIVE: "active";
10
+ export declare const STEP_ACTIVATED: "end";
11
+ /**
12
+ * Used for disabled motion case.
13
+ * Prepare stage will still work but start & active will be skipped.
14
+ */
15
+ export declare const STEP_PREPARED: "prepared";
16
+ export type StepStatus = typeof STEP_NONE | typeof STEP_PREPARE | typeof STEP_START | typeof STEP_ACTIVE | typeof STEP_ACTIVATED | typeof STEP_PREPARED;
17
+ export type MotionEvent = (TransitionEvent | AnimationEvent) & {
18
+ deadline?: boolean;
19
+ };
20
+ export type MotionPrepareEventHandler = (element: HTMLElement) => Promise<unknown> | void;
21
+ export type MotionEventHandler = (element: HTMLElement, event: MotionEvent) => React.CSSProperties | void;
22
+ export type MotionEndEventHandler = (element: HTMLElement, event: MotionEvent) => boolean | void;
@@ -0,0 +1,20 @@
1
+ export declare const STATUS_ADD: "add";
2
+ export declare const STATUS_KEEP: "keep";
3
+ export declare const STATUS_REMOVE: "remove";
4
+ export declare const STATUS_REMOVED: "removed";
5
+ export type DiffStatus = typeof STATUS_ADD | typeof STATUS_KEEP | typeof STATUS_REMOVE | typeof STATUS_REMOVED;
6
+ type RawKeyType = string | number;
7
+ export interface KeyObject {
8
+ key: RawKeyType;
9
+ status?: DiffStatus;
10
+ }
11
+ export declare function wrapKeyToObject(key: React.Key | KeyObject): {
12
+ key: string;
13
+ status?: DiffStatus;
14
+ };
15
+ export declare function parseKeys(keys?: never[]): {
16
+ key: string;
17
+ status?: DiffStatus;
18
+ }[];
19
+ export declare function diffKeys(prevKeys?: KeyObject[], currentKeys?: KeyObject[]): KeyObject[];
20
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { MotionName } from '../CSSMotion';
2
+ export declare function getVendorPrefixes(domSupport: boolean, win: object): {
3
+ animationend: Record<string, string>;
4
+ transitionend: Record<string, string>;
5
+ };
6
+ export declare function getVendorPrefixedEventName(eventName: string): any;
7
+ export declare const supportTransition: boolean;
8
+ export declare const animationEndName: any;
9
+ export declare const transitionEndName: any;
10
+ export declare function getTransitionName(transitionName: MotionName, transitionType: string): any;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { CollectionProps, SizeInfo } from './interface';
3
+ type onCollectionResize = (size: SizeInfo, element: HTMLElement, data: unknown) => void;
4
+ export declare const CollectionContext: React.Context<onCollectionResize>;
5
+ /**
6
+ * Collect all the resize event from children ResizeObserver
7
+ */
8
+ export declare function Collection({ children, onBatchResize }: CollectionProps): React.JSX.Element;
9
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { ResizeObserverProps } from './interface';
3
+ export interface SingleObserverProps extends ResizeObserverProps {
4
+ children: React.ReactElement | ((ref: React.RefObject<Element>) => React.ReactElement);
5
+ }
6
+ declare const RefSingleObserver: React.ForwardRefExoticComponent<SingleObserverProps & React.RefAttributes<HTMLElement>>;
7
+ export default RefSingleObserver;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { Collection } from './Collection';
3
+ import type { ResizeObserverProps } from './interface';
4
+ declare const ResizeObserver: React.ForwardRefExoticComponent<React.PropsWithoutRef<ResizeObserverProps> & React.RefAttributes<unknown>> & {
5
+ Collection: typeof Collection;
6
+ };
7
+ export default ResizeObserver;
@@ -0,0 +1,25 @@
1
+ export interface ResizeInfo {
2
+ size: SizeInfo;
3
+ data: unknown;
4
+ element: HTMLElement;
5
+ }
6
+ export interface CollectionProps {
7
+ /** Trigger when some children ResizeObserver changed. Collect by frame render level */
8
+ onBatchResize?: (resizeInfo: ResizeInfo[]) => void;
9
+ children?: React.ReactNode;
10
+ }
11
+ export interface SizeInfo {
12
+ width: number;
13
+ height: number;
14
+ offsetWidth: number;
15
+ offsetHeight: number;
16
+ }
17
+ export type OnResize = (size: SizeInfo, element: HTMLElement) => void;
18
+ export interface ResizeObserverProps {
19
+ /** Pass to ResizeObserver.Collection with additional data */
20
+ data?: unknown;
21
+ children: React.ReactNode | ((ref: React.RefObject<unknown>) => React.ReactElement);
22
+ disabled?: boolean;
23
+ /** Trigger if element resized. Will always trigger when first time render. */
24
+ onResize?: OnResize;
25
+ }
@@ -0,0 +1,3 @@
1
+ export type ResizeListener = (element: Element) => void;
2
+ export declare function observe(element: Element, callback: ResizeListener): void;
3
+ export declare function unobserve(element: Element, callback: ResizeListener): void;
@@ -39,7 +39,7 @@ export interface SpaceProps {
39
39
  /**
40
40
  * @zh 设置分隔符
41
41
  */
42
- split?: ReactNode;
42
+ separator?: ReactNode;
43
43
  /**
44
44
  * @zh 子元素
45
45
  */
@@ -73,7 +73,6 @@ declare class CSSTransition extends React.Component {
73
73
  static defaultProps: {
74
74
  classNames: string;
75
75
  };
76
- refElement: undefined;
77
76
  appliedClasses: {
78
77
  appear: {};
79
78
  enter: {};
@@ -4,7 +4,7 @@
4
4
  * @param {*} children `this.props.children`
5
5
  * @return {object} Mapping of key to child
6
6
  */
7
- export function getChildMapping(children: any, mapFn: any): object;
7
+ export declare function getChildMapping(children: any, mapFn: any): any;
8
8
  /**
9
9
  * When you're adding or removing children some may be added or removed in the
10
10
  * same render pass. We want to show *both* since we want to simultaneously
@@ -22,6 +22,6 @@ export function getChildMapping(children: any, mapFn: any): object;
22
22
  * @return {object} a key set that contains all keys in `prev` and all keys
23
23
  * in `next` in a reasonable order.
24
24
  */
25
- export function mergeChildMappings(prev: object, next: object): object;
26
- export function getInitialChildMapping(props: any, onExited: any): object;
27
- export function getNextChildMapping(nextProps: any, prevChildMapping: any, onExited: any): object;
25
+ export declare function mergeChildMappings(prev: any, next: any): {};
26
+ export declare function getInitialChildMapping(props: any, onExited: any): any;
27
+ export declare function getNextChildMapping(nextProps: any, prevChildMapping: any, onExited: any): {};
@@ -24,9 +24,9 @@ export declare const modes: {
24
24
  * ```jsx
25
25
  * function App() {
26
26
  * const [state, setState] = useState(false);
27
- * const helloRef = useRef(null);
28
- * const goodbyeRef = useRef(null);
29
- * const refElement = state ? goodbyeRef : helloRef;
27
+ * const refHello = useRef(null);
28
+ * const refGoodbye = useRef(null);
29
+ * const refElement = state ? refGoodbye : refHello;
30
30
  * return (
31
31
  * <SwitchTransition>
32
32
  * <CSSTransition
@@ -104,7 +104,7 @@ export declare const EXITING = "exiting";
104
104
  declare class Transition extends React.Component {
105
105
  static contextType: React.Context<null>;
106
106
  constructor(props: any, context: any);
107
- refElement: undefined;
107
+ private getElement;
108
108
  static getDerivedStateFromProps({ in: nextIn }: {
109
109
  in: any;
110
110
  }, prevState: any): {
@@ -22,7 +22,7 @@ declare class TransitionGroup extends React.Component {
22
22
  handleExited: any;
23
23
  firstRender: any;
24
24
  }): {
25
- children: object;
25
+ children: any;
26
26
  firstRender: boolean;
27
27
  };
28
28
  handleExited(child: any, element: any): void;
@@ -1,4 +1,5 @@
1
1
  export { forceReflow as TransitionGroupForceReflow } from '../utils/dom';
2
+ export { getChildMapping as TransitionGroupGetChildMapping, getInitialChildMapping as TransitionGroupGetInitialChildMapping, getNextChildMapping as TransitionGroupGetNextChildMapping, mergeChildMappings as TransitionGroupMergeChildMappings, } from './ChildMapping';
2
3
  export { default as CSSTransition } from './CSSTransition';
3
4
  export { default as PqbCSSTransition } from './PqbCSSTransition';
4
5
  export { default as ReplaceTransition } from './ReplaceTransition';
@@ -6,5 +7,4 @@ export { default as SwitchTransition, modes as SwitchTransitionModes, } from './
6
7
  export { default as Transition, ENTERED as TRANSITION_ENTERED, ENTERING as TRANSITION_ENTERING, EXITED as TRANSITION_EXITED, EXITING as TRANSITION_EXITING, UNMOUNTED as TRANSITION_UNMOUNTED, } from './Transition';
7
8
  export { default as TransitionGroup } from './TransitionGroup';
8
9
  export { default as TransitionGroupContext } from './TransitionGroupContext';
9
- export { getChildMapping as TransitionGroupGetChildMapping, getInitialChildMapping as TransitionGroupGetInitialChildMapping, getNextChildMapping as TransitionGroupGetNextChildMapping, mergeChildMappings as TransitionGroupMergeChildMappings, } from './utils/ChildMapping';
10
10
  export { default } from './TransitionGroup';
@@ -0,0 +1,4 @@
1
+ import { ChildrenProps } from './findRootElement';
2
+ declare function callbackOriginRef(children: ChildrenProps, node: Element | null): void;
3
+ export { callbackOriginRef };
4
+ export default callbackOriginRef;
@@ -1,3 +1,4 @@
1
+ import canUseDOM from '@unicom-cloud/utils/dom-helpers/canUseDOM';
1
2
  import forceReflow from '@unicom-cloud/utils/dom-helpers/reflow';
2
3
  import { isServerRendering } from './is';
3
4
  export declare function on(eventTarget: EventTarget, type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
@@ -24,4 +25,4 @@ export declare function getScrollElements(container: HTMLElement, top?: HTMLElem
24
25
  */
25
26
  export declare function parentContainsChildren(parentElement: HTMLElement | null, childrenElement: HTMLElement | null): boolean;
26
27
  export declare function getBodyContainer(): HTMLElement;
27
- export { forceReflow, isServerRendering, forceReflow as reflow };
28
+ export { canUseDOM, forceReflow, isServerRendering, forceReflow as reflow };
@@ -0,0 +1,23 @@
1
+ import { RefObject } from 'react';
2
+ type Ref = RefObject<Element> | ((instance: Element | null) => void);
3
+ export type ChildrenProps = {
4
+ ref?: Ref;
5
+ props?: {
6
+ ref?: Ref;
7
+ };
8
+ } | null;
9
+ type ElementLike = {
10
+ dom?: Element;
11
+ current?: Element | {
12
+ getRootElement: () => Element;
13
+ };
14
+ getRootElement?: () => Element | null;
15
+ } & ChildrenProps;
16
+ /**
17
+ *
18
+ * @param element
19
+ * @returns
20
+ */
21
+ declare function findRootElement(element: ElementLike): Element | null;
22
+ export { findRootElement };
23
+ export default findRootElement;
@@ -1,3 +1,4 @@
1
+ export * from './callbackOriginRef';
1
2
  export * from './caseName';
2
3
  export * from './className';
3
4
  export * from './constant';
@@ -8,6 +9,7 @@ export * from './dom';
8
9
  export * from './emitter';
9
10
  export * from './fileToURL';
10
11
  export * from './fillNBSP';
12
+ export * from './findRootElement';
11
13
  export * from './findScrollParent';
12
14
  export * from './getHighlightText';
13
15
  export * from './getHotkeyHandler';
@@ -24,18 +26,18 @@ export * from './omit';
24
26
  export * from './pad';
25
27
  export * from './pick';
26
28
  export * from './pinyin';
27
- export * from './reactDOM';
29
+ export * from './ref';
28
30
  export * from './resizeObserver';
29
31
  export * from './saveAs';
30
32
  export * from './screenfull';
31
33
  export * from './scrollIntoViewIfNeeded';
34
+ export * from './setCreateRoot';
32
35
  export * from './setDarkTheme';
33
36
  export * from './setDir';
34
37
  export * from './setPrimaryColor';
35
38
  export * from './setTheme';
36
39
  export * from './string';
37
40
  export * from './style';
38
- export * from './supportRef';
39
41
  export * from './throttleByRaf';
40
42
  export * from './tinycolor';
41
43
  export * from './toArray';
@@ -1,10 +1,11 @@
1
1
  import { is32Bit, isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isBlob, isBoolean, isBuffer, isColorValue, isDate, isElement, isEmpty, isEmptyArray, isEmptyObject, isEmptyValue, isEqual, isEqualWith, isError, isEventTarget, isExist, isFile, isFinite, isFunction, isInteger, isJSON, isLength, isMap, isMatch, isMatchWith, isNaN, isNative, isNil, isNull, isNullOrUndefined, isNumber, isObject, isObjectLike, isPlainObject, isPromise, isReadableStream, isRegExp, isSafeInteger, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, isWindow } from '@unicom-cloud/utils/is';
2
2
  import { isDayjs } from 'dayjs';
3
+ import React from 'react';
3
4
  declare const isServerRendering: boolean;
4
5
  declare const isReact18: boolean, isReact19: boolean;
5
- export declare function isEmptyReactNode(content: any, trim?: boolean): boolean;
6
+ export declare function isEmptyReactNode(element: any, trim?: boolean): boolean;
7
+ export declare function isReactComponentAndNotFragment(element: React.ReactElement): element is never;
6
8
  export declare function isReactComponent(element: any): boolean;
7
- export declare function isClassComponent(element: any): boolean;
8
- export declare function isDOMElement(element: any): boolean;
9
- export declare function isForwardRefReact(object: any): boolean;
9
+ export declare function isReactClassComponent(element: any): boolean;
10
+ export declare function isElementByInstanceof(element: Element): boolean;
10
11
  export { is32Bit, isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isBlob, isBoolean, isBuffer, isColorValue, isDate, isDayjs, isElement, isEmpty, isEmptyArray, isEmptyObject, isEmptyValue, isEqual, isEqualWith, isError, isEventTarget, isExist, isFile, isFinite, isFunction, isInteger, isJSON, isLength, isMap, isMatch, isMatchWith, isNaN, isNative, isNil, isNull, isNullOrUndefined, isNumber, isObject, isObjectLike, isPlainObject, isPromise, isReact18, isReact19, isReadableStream, isRegExp, isSafeInteger, isServerRendering, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, isWindow, };
@@ -42,6 +42,7 @@ import set from 'lodash/set';
42
42
  import setWith from 'lodash/setWith';
43
43
  import shuffle from 'lodash/shuffle';
44
44
  import snakeCase from 'lodash/snakeCase';
45
+ import sortBy from 'lodash/sortBy';
45
46
  import startCase from 'lodash/startCase';
46
47
  import throttle from 'lodash/throttle';
47
48
  import toPath from 'lodash/toPath';
@@ -57,4 +58,4 @@ import upperFirst from 'lodash/upperFirst';
57
58
  import without from 'lodash/without';
58
59
  import xor from 'lodash/xor';
59
60
  import zip from 'lodash/zip';
60
- export { assign, assignIn, at, camelCase, capitalize, castArray, chain, chunk, clone, cloneDeep, cloneDeepWith, cloneWith, compact, curry, debounce, defaults, defaultsDeep, defaultTo, difference, escape, findKey, flattenDeep, flow, get, groupBy, has, intersection, invert, invertBy, kebabCase, mean, memoize, merge, mergeWith, orderBy, partition, pullAll, result, sample, sampleSize, set, setWith, shuffle, snakeCase, startCase, throttle, toPath, truncate, union, uniq, uniqueId, unset, update, updateWith, upperCase, upperFirst, without, xor, zip, };
61
+ export { assign, assignIn, at, camelCase, capitalize, castArray, chain, chunk, clone, cloneDeep, cloneDeepWith, cloneWith, compact, curry, debounce, defaults, defaultsDeep, defaultTo, difference, escape, findKey, flattenDeep, flow, get, groupBy, has, intersection, invert, invertBy, kebabCase, mean, memoize, merge, mergeWith, orderBy, partition, pullAll, result, sample, sampleSize, set, setWith, shuffle, snakeCase, sortBy, startCase, throttle, toPath, truncate, union, uniq, uniqueId, unset, update, updateWith, upperCase, upperFirst, without, xor, zip, };
@@ -0,0 +1,27 @@
1
+ import React, { RefObject } from 'react';
2
+ export declare const fillRef: <T>(ref: RefObject<T>, node: T) => void;
3
+ /**
4
+ * Merge refs into one ref function to support ref passing.
5
+ */
6
+ export declare const composeRef: <T>(...refs: React.Ref<T>[]) => React.Ref<T>;
7
+ export declare const useComposeRef: <T>(...refs: React.Ref<T>[]) => React.Ref<T>;
8
+ export declare function supportRef(nodeOrComponent: React.ReactElement): boolean;
9
+ interface RefAttributes<T> extends React.Attributes {
10
+ ref: React.Ref<T>;
11
+ }
12
+ export declare const supportNodeRef: <T = unknown>(node: React.ReactNode) => node is React.ReactElement & RefAttributes<T>;
13
+ /**
14
+ * Returns the ref of a React element handling differences between React 19 and older versions.
15
+ * It will throw runtime error if the element is not a valid React element.
16
+ *
17
+ * @param element React.ReactElement
18
+ * @returns React.Ref<any> | null
19
+ */
20
+ export declare function getReactElementRef(element: React.ReactElement): React.Ref<unknown> | null;
21
+ /**
22
+ * In React 19. `ref` is not a property from node.
23
+ * But a property from `props.ref`.
24
+ * To check if `props.ref` exist or fallback to `ref`.
25
+ */
26
+ export declare const getNodeRef: typeof getReactElementRef;
27
+ export {};
@@ -0,0 +1,13 @@
1
+ import { ReactElement } from 'react';
2
+ type CreateRootFnType = (container: Element | DocumentFragment) => {
3
+ render: (element: ReactElement) => void;
4
+ unmount: () => void;
5
+ };
6
+ type RenderResult = {
7
+ render: (element: ReactElement) => void;
8
+ _unmount: () => void;
9
+ };
10
+ declare function setCreateRoot(v?: CreateRootFnType): void;
11
+ declare function render(node: ReactElement, el: Element | DocumentFragment): RenderResult;
12
+ export { render, setCreateRoot };
13
+ export default setCreateRoot;
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
- interface ToArrayOptions {
2
+ interface Option {
3
3
  keepEmpty?: boolean;
4
4
  }
5
5
  /**
6
6
  * 将React子节点转换为数组
7
7
  * @param children React子节点
8
- * @param options 配置选项
8
+ * @param option 配置选项
9
9
  * @returns React元素数组
10
10
  */
11
- declare function toArray(children: React.ReactNode, options?: ToArrayOptions): React.ReactElement[];
11
+ declare function toArray(children: React.ReactNode, option?: Option): React.ReactElement[];
12
12
  export { toArray };
13
13
  export default toArray;
@@ -0,0 +1,11 @@
1
+ /* 2025-11-27 12:10:58 */
2
+ import { getReactElementRef as r, fillRef as l } from "./ref.js";
3
+ function n(e, t) {
4
+ if (!e) return;
5
+ const f = r(e);
6
+ f && l(f, t);
7
+ }
8
+ export {
9
+ n as callbackOriginRef,
10
+ n as default
11
+ };