@unicom-cloud/ui-common 0.1.6 → 0.1.8

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 (399) 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 +181 -173
  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-move/index.js +69 -0
  78. package/hooks/use-mutation-observer/index.js +9 -9
  79. package/hooks/use-mutation-observers/index.js +33 -25
  80. package/hooks/use-network/index.js +1 -1
  81. package/hooks/use-online-status/index.js +1 -1
  82. package/hooks/use-overflow-hidden/index.js +1 -1
  83. package/hooks/use-override-ref/index.js +3 -3
  84. package/hooks/use-pagination/index.js +1 -1
  85. package/hooks/use-persist-callback/index.js +1 -1
  86. package/hooks/use-prefers-color-scheme-dark/index.js +1 -1
  87. package/hooks/use-previous/index.js +1 -1
  88. package/hooks/use-raf-interval/index.js +15 -15
  89. package/hooks/use-raf-state/index.js +1 -1
  90. package/hooks/use-raf-timeout/index.js +3 -3
  91. package/hooks/use-reactive/index.js +7 -7
  92. package/hooks/use-ref-latest/index.js +1 -1
  93. package/hooks/use-refs/index.js +4 -4
  94. package/hooks/use-request/index.js +1 -1
  95. package/hooks/use-request/src/Fetch.js +1 -1
  96. package/hooks/use-request/src/plugins/useAutoRunPlugin.js +1 -1
  97. package/hooks/use-request/src/plugins/useCachePlugin.js +3 -3
  98. package/hooks/use-request/src/plugins/useDebouncePlugin.js +1 -1
  99. package/hooks/use-request/src/plugins/useLoadingDelayPlugin.js +8 -8
  100. package/hooks/use-request/src/plugins/usePollingPlugin.js +13 -13
  101. package/hooks/use-request/src/plugins/useRefreshOnWindowFocusPlugin.js +3 -3
  102. package/hooks/use-request/src/plugins/useRetryPlugin.js +5 -5
  103. package/hooks/use-request/src/plugins/useThrottlePlugin.js +3 -3
  104. package/hooks/use-request/src/useRequest.js +1 -1
  105. package/hooks/use-request/src/useRequestImplement.js +7 -7
  106. package/hooks/use-request/src/utils/cache.js +1 -1
  107. package/hooks/use-request/src/utils/cachePromise.js +1 -1
  108. package/hooks/use-request/src/utils/cacheSubscribe.js +1 -1
  109. package/hooks/use-request/src/utils/isDocumentVisible.js +1 -1
  110. package/hooks/use-request/src/utils/isOnline.js +1 -1
  111. package/hooks/use-request/src/utils/limit.js +1 -1
  112. package/hooks/use-request/src/utils/subscribeFocus.js +1 -1
  113. package/hooks/use-request/src/utils/subscribeReVisible.js +1 -1
  114. package/hooks/use-reset-state/index.js +7 -7
  115. package/hooks/use-resize-observer/index.js +1 -1
  116. package/hooks/use-resize-observers/index.js +34 -26
  117. package/hooks/use-responsive/index.js +1 -1
  118. package/hooks/use-safe-state/index.js +4 -4
  119. package/hooks/use-scroll/index.js +1 -1
  120. package/hooks/use-selections/index.js +1 -1
  121. package/hooks/use-session-storage-state/index.js +1 -1
  122. package/hooks/use-set/index.js +1 -1
  123. package/hooks/use-set-state/index.js +1 -1
  124. package/hooks/use-size/index.js +20 -23
  125. package/hooks/use-state-callback/index.js +6 -6
  126. package/hooks/use-state-with-promise/index.js +1 -1
  127. package/hooks/use-sync-state/index.js +15 -0
  128. package/hooks/use-text-selection/index.js +13 -13
  129. package/hooks/use-theme/index.js +1 -1
  130. package/hooks/use-throttle/index.js +1 -1
  131. package/hooks/use-throttle-effect/index.js +1 -1
  132. package/hooks/use-throttle-fn/index.js +6 -6
  133. package/hooks/use-timeout/index.js +3 -3
  134. package/hooks/use-title/index.js +1 -1
  135. package/hooks/use-toggle/index.js +1 -1
  136. package/hooks/use-tracked-effect/index.js +1 -1
  137. package/hooks/use-unmount/index.js +1 -1
  138. package/hooks/use-unmounted-ref/index.js +4 -4
  139. package/hooks/use-update/index.js +1 -1
  140. package/hooks/use-update-effect/index.js +1 -1
  141. package/hooks/use-update-layout-effect/index.js +1 -1
  142. package/hooks/use-url-state/index.js +3 -3
  143. package/hooks/use-virtual-list/index.js +10 -10
  144. package/hooks/use-watch/index.js +1 -1
  145. package/hooks/use-web-socket/index.js +30 -30
  146. package/hooks/use-why-did-you-update/index.js +1 -1
  147. package/hooks/use-window-size/index.js +28 -25
  148. package/hooks/useAsyncEffect.js +1 -1
  149. package/hooks/useBoolean.js +1 -1
  150. package/hooks/useClickAway.js +4 -5
  151. package/hooks/useComputedState.js +1 -1
  152. package/hooks/useControllableValue.js +1 -1
  153. package/hooks/useCookieState.js +1 -1
  154. package/hooks/useCountDown.js +1 -1
  155. package/hooks/useCounter.js +1 -1
  156. package/hooks/useCreate.js +1 -1
  157. package/hooks/useCreation.js +1 -1
  158. package/hooks/useDebounce.js +1 -1
  159. package/hooks/useDebounceEffect.js +1 -1
  160. package/hooks/useDebounceFn.js +1 -1
  161. package/hooks/useDeepCompareEffect.js +1 -1
  162. package/hooks/useDeepCompareLayoutEffect.js +1 -1
  163. package/hooks/useDocumentVisibility.js +1 -1
  164. package/hooks/useDrag.js +1 -1
  165. package/hooks/useDrop.js +1 -1
  166. package/hooks/useEvent.js +7 -0
  167. package/hooks/useEventListener.js +4 -5
  168. package/hooks/useEventTarget.js +1 -1
  169. package/hooks/useExternal.js +1 -1
  170. package/hooks/useFavicon.js +1 -1
  171. package/hooks/useFocusWithin.js +1 -1
  172. package/hooks/useForceUpdate.js +1 -1
  173. package/hooks/useFullscreen.js +1 -1
  174. package/hooks/useGetState.js +1 -1
  175. package/hooks/useHistoryTravel.js +1 -1
  176. package/hooks/useHover.js +1 -1
  177. package/hooks/useId.js +1 -1
  178. package/hooks/useInView.js +1 -1
  179. package/hooks/useInViewport.js +4 -5
  180. package/hooks/useInfiniteScroll.js +1 -1
  181. package/hooks/useIntersectionObserver.js +5 -4
  182. package/hooks/useIntersectionObservers.js +11 -7
  183. package/hooks/useInterval.js +1 -1
  184. package/hooks/useIsFirstRender.js +1 -1
  185. package/hooks/useIsomorphicLayoutEffect.js +1 -1
  186. package/hooks/useKeyPress.js +1 -1
  187. package/hooks/useKeyboardEvent.js +1 -1
  188. package/hooks/useLatest.js +1 -1
  189. package/hooks/useListenWindowResize.js +1 -1
  190. package/hooks/useLocalStorageState.js +1 -1
  191. package/hooks/useLockFn.js +1 -1
  192. package/hooks/useLongPress.js +1 -1
  193. package/hooks/useMap.js +1 -1
  194. package/hooks/useMedia.js +1 -1
  195. package/hooks/useMemo.js +6 -0
  196. package/hooks/useMemoizedFn.js +1 -1
  197. package/hooks/useMergeProps.js +1 -1
  198. package/hooks/useMergeValue.js +1 -1
  199. package/hooks/useMount.js +1 -1
  200. package/hooks/useMouse.js +1 -1
  201. package/hooks/useMove.js +10 -0
  202. package/hooks/useMutationObserver.js +1 -1
  203. package/hooks/useMutationObservers.js +11 -7
  204. package/hooks/useNetwork.js +1 -1
  205. package/hooks/useOnlineStatus.js +1 -1
  206. package/hooks/useOverflowHidden.js +1 -1
  207. package/hooks/useOverrideRef.js +3 -3
  208. package/hooks/usePagination.js +1 -1
  209. package/hooks/usePersistCallback.js +1 -1
  210. package/hooks/usePrefersColorSchemeDark.js +1 -1
  211. package/hooks/usePrevious.js +1 -1
  212. package/hooks/useRafInterval.js +1 -1
  213. package/hooks/useRafState.js +1 -1
  214. package/hooks/useRafTimeout.js +1 -1
  215. package/hooks/useReactive.js +1 -1
  216. package/hooks/useRefLatest.js +1 -1
  217. package/hooks/useRefs.js +1 -1
  218. package/hooks/useRequest.js +1 -1
  219. package/hooks/useResetState.js +1 -1
  220. package/hooks/useResizeObserver.js +1 -1
  221. package/hooks/useResizeObservers.js +11 -7
  222. package/hooks/useResponsive.js +1 -1
  223. package/hooks/useSafeState.js +1 -1
  224. package/hooks/useScroll.js +1 -1
  225. package/hooks/useSelections.js +1 -1
  226. package/hooks/useSessionStorageState.js +1 -1
  227. package/hooks/useSet.js +1 -1
  228. package/hooks/useSetState.js +1 -1
  229. package/hooks/useSize.js +4 -3
  230. package/hooks/useStateCallback.js +1 -1
  231. package/hooks/useStateWithPromise.js +1 -1
  232. package/hooks/useSyncState.js +10 -0
  233. package/hooks/useTextSelection.js +1 -1
  234. package/hooks/useTheme.js +1 -1
  235. package/hooks/useThrottle.js +1 -1
  236. package/hooks/useThrottleEffect.js +1 -1
  237. package/hooks/useThrottleFn.js +1 -1
  238. package/hooks/useTimeout.js +1 -1
  239. package/hooks/useTitle.js +1 -1
  240. package/hooks/useToggle.js +1 -1
  241. package/hooks/useTrackedEffect.js +1 -1
  242. package/hooks/useUnmount.js +1 -1
  243. package/hooks/useUnmountedRef.js +1 -1
  244. package/hooks/useUpdate.js +1 -1
  245. package/hooks/useUpdateEffect.js +1 -1
  246. package/hooks/useUpdateLayoutEffect.js +1 -1
  247. package/hooks/useUrlState.js +1 -1
  248. package/hooks/useVirtualList.js +1 -1
  249. package/hooks/useWatch.js +1 -1
  250. package/hooks/useWebSocket.js +1 -1
  251. package/hooks/useWhyDidYouUpdate.js +1 -1
  252. package/hooks/useWindowSize.js +4 -3
  253. package/hooks/utils/createEffectWithTarget.js +11 -12
  254. package/hooks/utils/depsAreSame.js +1 -1
  255. package/hooks/utils/depsEqual.js +1 -1
  256. package/hooks/utils/domTarget.js +1 -1
  257. package/hooks/utils/getDocumentOrShadow.js +5 -6
  258. package/hooks/utils/index.js +1 -1
  259. package/hooks/utils/isAppleDevice.js +1 -1
  260. package/hooks/utils/isBrowser.js +1 -1
  261. package/hooks/utils/isDev.js +1 -1
  262. package/hooks/utils/rect.js +1 -1
  263. package/hooks/utils/useDeepCompareWithTarget.js +4 -4
  264. package/hooks/utils/useEffectWithTarget.js +1 -1
  265. package/hooks/utils/useIsomorphicLayoutEffectWithTarget.js +1 -1
  266. package/hooks/utils/useLayoutEffectWithTarget.js +1 -1
  267. package/hooks/utils.js +1 -1
  268. package/icons/file/index.js +31 -24
  269. package/icons/file.js +1 -1
  270. package/index.js +47 -46
  271. package/motion/CSSMotion.js +102 -0
  272. package/motion/CSSMotionList.js +100 -0
  273. package/motion/context.js +14 -0
  274. package/motion/hooks/useDomMotionEvents.js +21 -0
  275. package/motion/hooks/useNextFrame.js +24 -0
  276. package/motion/hooks/useStatus.js +121 -0
  277. package/motion/hooks/useStepQueue.js +44 -0
  278. package/motion/index.js +9 -0
  279. package/motion/interface.js +14 -0
  280. package/motion/util/diff.js +56 -0
  281. package/motion/util/motion.js +56 -0
  282. package/package.json +1 -1
  283. package/progress/index.js +1 -1
  284. package/resize-observer/Collection.js +25 -0
  285. package/resize-observer/SingleObserver.js +48 -0
  286. package/resize-observer/index.js +27 -0
  287. package/resize-observer/observerUtil.js +22 -0
  288. package/space/index.js +65 -52
  289. package/suspense-fallback-test/index.js +1 -1
  290. package/transition-group/CSSTransition.js +59 -54
  291. package/transition-group/ChildMapping.js +68 -0
  292. package/transition-group/PqbCSSTransition.js +22 -18
  293. package/transition-group/ReplaceTransition.js +7 -7
  294. package/transition-group/SwitchTransition.js +1 -1
  295. package/transition-group/Transition.js +56 -52
  296. package/transition-group/TransitionGroup.js +2 -3
  297. package/transition-group/TransitionGroupContext.js +1 -1
  298. package/transition-group/index.js +30 -29
  299. package/types/hooks/index.d.ts +4 -0
  300. package/types/hooks/use-event/index.d.ts +2 -0
  301. package/types/hooks/use-intersection-observers/index.d.ts +3 -1
  302. package/types/hooks/use-listen-window-resize/index.d.ts +4 -4
  303. package/types/hooks/use-memo/index.d.ts +2 -0
  304. package/types/hooks/use-move/index.d.ts +4 -0
  305. package/types/hooks/use-mutation-observers/index.d.ts +3 -1
  306. package/types/hooks/use-resize-observers/index.d.ts +3 -1
  307. package/types/hooks/use-size/index.d.ts +1 -1
  308. package/types/hooks/use-sync-state/index.d.ts +10 -0
  309. package/types/hooks/use-window-size/index.d.ts +2 -3
  310. package/types/motion/CSSMotion.d.ts +77 -0
  311. package/types/motion/CSSMotionList.d.ts +34 -0
  312. package/types/motion/context.d.ts +9 -0
  313. package/types/motion/hooks/useDomMotionEvents.d.ts +3 -0
  314. package/types/motion/hooks/useNextFrame.d.ts +7 -0
  315. package/types/motion/hooks/useStatus.d.ts +5 -0
  316. package/types/motion/hooks/useStepQueue.d.ts +8 -0
  317. package/types/motion/index.d.ts +9 -0
  318. package/types/motion/interface.d.ts +22 -0
  319. package/types/motion/util/diff.d.ts +20 -0
  320. package/types/motion/util/motion.d.ts +10 -0
  321. package/types/resize-observer/Collection.d.ts +9 -0
  322. package/types/resize-observer/SingleObserver.d.ts +7 -0
  323. package/types/resize-observer/index.d.ts +7 -0
  324. package/types/resize-observer/interface.d.ts +25 -0
  325. package/types/resize-observer/observerUtil.d.ts +3 -0
  326. package/types/space/interface.d.ts +1 -1
  327. package/types/transition-group/CSSTransition.d.ts +0 -1
  328. package/types/transition-group/{utils/ChildMapping.d.ts → ChildMapping.d.ts} +4 -4
  329. package/types/transition-group/SwitchTransition.d.ts +3 -3
  330. package/types/transition-group/Transition.d.ts +1 -1
  331. package/types/transition-group/TransitionGroup.d.ts +1 -1
  332. package/types/transition-group/index.d.ts +1 -1
  333. package/types/utils/callbackOriginRef.d.ts +4 -0
  334. package/types/utils/dom.d.ts +2 -1
  335. package/types/utils/findRootElement.d.ts +23 -0
  336. package/types/utils/index.d.ts +4 -2
  337. package/types/utils/is.d.ts +5 -4
  338. package/types/utils/lodash.d.ts +2 -1
  339. package/types/utils/ref.d.ts +27 -0
  340. package/types/utils/setCreateRoot.d.ts +13 -0
  341. package/types/utils/toArray.d.ts +3 -3
  342. package/utils/callbackOriginRef.js +11 -0
  343. package/utils/caseName.js +1 -1
  344. package/utils/className.js +1 -1
  345. package/utils/compute.js +1 -1
  346. package/utils/constant.js +1 -1
  347. package/utils/copy.js +1 -1
  348. package/utils/date.js +1 -1
  349. package/utils/dayjs.js +1 -1
  350. package/utils/dom.js +12 -10
  351. package/utils/emitter.js +1 -1
  352. package/utils/fileToURL.js +1 -1
  353. package/utils/fillNBSP.js +1 -1
  354. package/utils/findRootElement.js +28 -0
  355. package/utils/findScrollParent.js +1 -1
  356. package/utils/getHighlightText.js +1 -1
  357. package/utils/getHotkeyHandler.js +1 -1
  358. package/utils/getStringLength.js +1 -1
  359. package/utils/include.js +1 -1
  360. package/utils/index.js +341 -329
  361. package/utils/intersectionObserver.js +1 -1
  362. package/utils/is.js +72 -81
  363. package/utils/keyboardCode.js +1 -1
  364. package/utils/lodash.js +45 -43
  365. package/utils/math.js +1 -1
  366. package/utils/mergeProps.js +1 -1
  367. package/utils/mergedToString.js +1 -1
  368. package/utils/mutationObserver.js +1 -1
  369. package/utils/omit.js +1 -1
  370. package/utils/pad.js +1 -1
  371. package/utils/pick.js +1 -1
  372. package/utils/pinyin.js +1 -1
  373. package/utils/react19Adapter.js +2 -2
  374. package/utils/ref.js +41 -0
  375. package/utils/resizeObserver.js +1 -1
  376. package/utils/saveAs.js +1 -1
  377. package/utils/screenfull.js +1 -1
  378. package/utils/scrollIntoViewIfNeeded.js +1 -1
  379. package/utils/setCreateRoot.js +53 -0
  380. package/utils/setDarkTheme.js +1 -1
  381. package/utils/setDir.js +1 -1
  382. package/utils/setPrimaryColor.js +1 -1
  383. package/utils/setTheme.js +1 -1
  384. package/utils/string.js +1 -1
  385. package/utils/style.js +1 -1
  386. package/utils/throttleByRaf.js +1 -1
  387. package/utils/throttleByRaf2.js +1 -1
  388. package/utils/tinycolor.js +1 -1
  389. package/utils/toArray.js +9 -9
  390. package/utils/tree.js +1 -1
  391. package/utils/tween.js +1 -1
  392. package/utils/uuid.js +1 -1
  393. package/utils/validate.js +1 -1
  394. package/utils/warning.js +1 -1
  395. package/transition-group/utils/ChildMapping.js +0 -66
  396. package/types/utils/reactDOM.d.ts +0 -34
  397. package/types/utils/supportRef.d.ts +0 -3
  398. package/utils/reactDOM.js +0 -87
  399. package/utils/supportRef.js +0 -10
@@ -0,0 +1,100 @@
1
+ /* 2025-11-28 16:31:16 */
2
+ import { jsx as f } from "react/jsx-runtime";
3
+ import l, { createElement as A } from "react";
4
+ import h from "./CSSMotion.js";
5
+ import { STATUS_REMOVED as c, parseKeys as k, diffKeys as K, STATUS_REMOVE as C, STATUS_ADD as L, STATUS_KEEP as T } from "./util/diff.js";
6
+ import "./util/motion.js";
7
+ const M = [
8
+ "eventProps",
9
+ "visible",
10
+ "children",
11
+ "motionName",
12
+ "motionAppear",
13
+ "motionEnter",
14
+ "motionLeave",
15
+ "motionLeaveImmediately",
16
+ "motionDeadline",
17
+ "removeOnLeave",
18
+ "leavedClassName",
19
+ "onAppearPrepare",
20
+ "onAppearStart",
21
+ "onAppearActive",
22
+ "onAppearEnd",
23
+ "onEnterStart",
24
+ "onEnterActive",
25
+ "onEnterEnd",
26
+ "onLeaveStart",
27
+ "onLeaveActive",
28
+ "onLeaveEnd"
29
+ ];
30
+ function x(O, E = h) {
31
+ class y extends l.Component {
32
+ constructor() {
33
+ super(...arguments), this.state = {
34
+ keyEntities: []
35
+ }, this.removeKey = (i) => {
36
+ this.setState(
37
+ (e) => ({
38
+ keyEntities: e.keyEntities.map((t) => t.key !== i ? t : {
39
+ ...t,
40
+ status: c
41
+ })
42
+ }),
43
+ () => {
44
+ const { keyEntities: e } = this.state;
45
+ e.filter(
46
+ ({ status: t }) => t !== c
47
+ ).length === 0 && this.props.onAllRemoved && this.props.onAllRemoved();
48
+ }
49
+ );
50
+ };
51
+ }
52
+ static {
53
+ this.defaultProps = {
54
+ component: "div"
55
+ };
56
+ }
57
+ static getDerivedStateFromProps({ keys: i }, { keyEntities: e }) {
58
+ const s = k(i);
59
+ return {
60
+ keyEntities: K(e, s).filter((m) => {
61
+ const n = e.find(({ key: p }) => m.key === p);
62
+ return !(n && n.status === c && m.status === C);
63
+ })
64
+ };
65
+ }
66
+ render() {
67
+ const { keyEntities: i } = this.state, {
68
+ component: e,
69
+ children: s,
70
+ onVisibleChanged: t,
71
+ onAllRemoved: m,
72
+ ...n
73
+ } = this.props, p = e || l.Fragment, d = {};
74
+ return M.forEach((o) => {
75
+ d[o] = n[o], delete n[o];
76
+ }), delete n.keys, /* @__PURE__ */ f(p, { ...n, children: i.map(({ status: o, ...r }, S) => {
77
+ const u = o === L || o === T;
78
+ return /* @__PURE__ */ A(
79
+ E,
80
+ {
81
+ ...d,
82
+ key: r.key,
83
+ visible: u,
84
+ eventProps: r,
85
+ onVisibleChanged: (a) => {
86
+ t?.(a, { key: r.key }), a || this.removeKey(r.key);
87
+ }
88
+ },
89
+ (a, v) => s({ ...a, index: S }, v)
90
+ );
91
+ }) });
92
+ }
93
+ }
94
+ return y;
95
+ }
96
+ const N = x();
97
+ export {
98
+ N as default,
99
+ x as genCSSMotionList
100
+ };
@@ -0,0 +1,14 @@
1
+ /* 2025-11-28 16:31:16 */
2
+ import { jsx as r } from "react/jsx-runtime";
3
+ import e from "react";
4
+ const n = e.createContext({});
5
+ function c({
6
+ children: t,
7
+ ...o
8
+ }) {
9
+ return /* @__PURE__ */ r(n.Provider, { value: o, children: t });
10
+ }
11
+ export {
12
+ n as Context,
13
+ c as default
14
+ };
@@ -0,0 +1,21 @@
1
+ /* 2025-11-28 16:31:16 */
2
+ import f, { useRef as s } from "react";
3
+ import { transitionEndName as c, animationEndName as u } from "../util/motion.js";
4
+ function a(e) {
5
+ const t = s(null);
6
+ function i(r) {
7
+ r && (r.removeEventListener(c, e), r.removeEventListener(u, e));
8
+ }
9
+ function n(r) {
10
+ t.current && t.current !== r && i(t.current), r && r !== t.current && (r.addEventListener(c, e), r.addEventListener(u, e), t.current = r);
11
+ }
12
+ return f.useEffect(
13
+ () => () => {
14
+ i(t.current);
15
+ },
16
+ []
17
+ ), [n, i];
18
+ }
19
+ export {
20
+ a as default
21
+ };
@@ -0,0 +1,24 @@
1
+ /* 2025-11-28 16:31:16 */
2
+ import a from "react";
3
+ function f() {
4
+ const e = a.useRef(null);
5
+ function n() {
6
+ cancelAnimationFrame(e.current);
7
+ }
8
+ function t(r, c = 2) {
9
+ n();
10
+ const u = requestAnimationFrame(() => {
11
+ c <= 1 ? r({ isCanceled: () => u !== e.current }) : t(r, c - 1);
12
+ });
13
+ e.current = u;
14
+ }
15
+ return a.useEffect(
16
+ () => () => {
17
+ n();
18
+ },
19
+ []
20
+ ), [t, n];
21
+ }
22
+ export {
23
+ f as default
24
+ };
@@ -0,0 +1,121 @@
1
+ /* 2025-11-28 16:31:16 */
2
+ import Q, { useRef as d, useEffect as x } from "react";
3
+ import st from "../../hooks/use-event/index.js";
4
+ import ct from "../../hooks/use-isomorphic-layout-effect/index.js";
5
+ import j from "../../hooks/use-safe-state/index.js";
6
+ import ft from "../../hooks/use-sync-state/index.js";
7
+ import { STEP_PREPARE as s, STATUS_NONE as c, STATUS_APPEAR as R, STATUS_ENTER as p, STATUS_LEAVE as A, STEP_START as P, STEP_ACTIVE as _, STEP_PREPARED as ot } from "../interface.js";
8
+ import at from "./useDomMotionEvents.js";
9
+ import it, { isActive as lt, SkipStep as St, DoStep as Et } from "./useStepQueue.js";
10
+ function yt(D, r, q, {
11
+ motionEnter: y = !0,
12
+ motionAppear: g = !0,
13
+ motionLeave: a = !0,
14
+ motionDeadline: H,
15
+ motionLeaveImmediately: z,
16
+ onAppearPrepare: B,
17
+ onEnterPrepare: F,
18
+ onLeavePrepare: G,
19
+ onAppearStart: J,
20
+ onEnterStart: K,
21
+ onLeaveStart: W,
22
+ onAppearActive: X,
23
+ onEnterActive: Y,
24
+ onLeaveActive: Z,
25
+ onAppearEnd: $,
26
+ onEnterEnd: L,
27
+ onLeaveEnd: v,
28
+ onVisibleChanged: b
29
+ }) {
30
+ const [f, tt] = j(), [M, i] = ft(c), [et, I] = j(null), n = M(), l = d(!1), h = d(null);
31
+ function S() {
32
+ return q();
33
+ }
34
+ const N = d(!1);
35
+ function C() {
36
+ i(c), I(null, !0);
37
+ }
38
+ const k = st((t) => {
39
+ const e = M();
40
+ if (e === c)
41
+ return;
42
+ const o = S();
43
+ if (t && !t.deadline && t.target !== o)
44
+ return;
45
+ const m = N.current;
46
+ let T;
47
+ e === R && m ? T = $?.(o, t) : e === p && m ? T = L?.(o, t) : e === A && m && (T = v?.(o, t)), m && T !== !1 && C();
48
+ }), [rt] = at(k), w = (t) => {
49
+ switch (t) {
50
+ case R:
51
+ return {
52
+ [s]: B,
53
+ [P]: J,
54
+ [_]: X
55
+ };
56
+ case p:
57
+ return {
58
+ [s]: F,
59
+ [P]: K,
60
+ [_]: Y
61
+ };
62
+ case A:
63
+ return {
64
+ [s]: G,
65
+ [P]: W,
66
+ [_]: Z
67
+ };
68
+ default:
69
+ return {};
70
+ }
71
+ }, E = Q.useMemo(() => w(n), [n]), [nt, u] = it(
72
+ n,
73
+ !D,
74
+ (t) => {
75
+ if (t === s) {
76
+ const e = E[s];
77
+ return e ? e(S()) : St;
78
+ }
79
+ return u in E && I(E[u]?.(S(), null) || null), u === _ && n !== c && (rt(S()), H > 0 && (clearTimeout(h.current), h.current = setTimeout(() => {
80
+ k({
81
+ deadline: !0
82
+ });
83
+ }, H))), u === ot && C(), Et;
84
+ }
85
+ ), ut = lt(u);
86
+ N.current = ut;
87
+ const O = d(null);
88
+ ct(() => {
89
+ if (l.current && O.current === r)
90
+ return;
91
+ tt(r);
92
+ const t = l.current;
93
+ l.current = !0;
94
+ let e;
95
+ !t && r && g && (e = R), t && r && y && (e = p), (t && !r && a || !t && z && !r && a) && (e = A);
96
+ const o = w(e);
97
+ e && (D || o[s]) ? (i(e), nt()) : i(c), O.current = r;
98
+ }, [r]), x(() => {
99
+ // Cancel appear
100
+ (n === R && !g || // Cancel enter
101
+ n === p && !y || // Cancel leave
102
+ n === A && !a) && i(c);
103
+ }, [g, y, a]), x(
104
+ () => () => {
105
+ l.current = !1, clearTimeout(h.current);
106
+ },
107
+ []
108
+ );
109
+ const U = Q.useRef(!1);
110
+ x(() => {
111
+ f && (U.current = !0), f !== void 0 && n === c && ((U.current || f) && b?.(f), U.current = !0);
112
+ }, [f, n]);
113
+ let V = et;
114
+ return E[s] && u === P && (V = {
115
+ transition: "none",
116
+ ...V
117
+ }), [M, u, V, f ?? r];
118
+ }
119
+ export {
120
+ yt as default
121
+ };
@@ -0,0 +1,44 @@
1
+ /* 2025-11-28 16:31:16 */
2
+ import l from "react";
3
+ import x from "../../hooks/use-isomorphic-layout-effect/index.js";
4
+ import A from "../../hooks/use-safe-state/index.js";
5
+ import { STEP_NONE as f, STEP_ACTIVATED as s, STEP_PREPARE as E, STEP_PREPARED as U, STEP_START as R, STEP_ACTIVE as i } from "../interface.js";
6
+ import d from "./useNextFrame.js";
7
+ const N = [
8
+ E,
9
+ R,
10
+ i,
11
+ s
12
+ ], Q = [E, U], F = !1, v = !0;
13
+ function O(t) {
14
+ return t === i || t === s;
15
+ }
16
+ function V(t, S, m) {
17
+ const [e, o] = A(f), [P, T] = d();
18
+ function a() {
19
+ o(E, !0);
20
+ }
21
+ const u = S ? Q : N;
22
+ return x(() => {
23
+ if (e !== f && e !== s) {
24
+ const p = u.indexOf(e), r = u[p + 1], n = m(e);
25
+ n === F ? o(r, !0) : r && P((_) => {
26
+ function c() {
27
+ _.isCanceled() || o(r, !0);
28
+ }
29
+ n === !0 ? c() : Promise.resolve(n).then(c);
30
+ });
31
+ }
32
+ }, [t, e]), l.useEffect(
33
+ () => () => {
34
+ T();
35
+ },
36
+ []
37
+ ), [a, e];
38
+ }
39
+ export {
40
+ v as DoStep,
41
+ F as SkipStep,
42
+ V as default,
43
+ O as isActive
44
+ };
@@ -0,0 +1,9 @@
1
+ /* 2025-11-28 16:31:16 */
2
+ import t from "./CSSMotion.js";
3
+ import { default as a } from "./CSSMotionList.js";
4
+ import { default as i } from "./context.js";
5
+ export {
6
+ a as CSSMotionList,
7
+ i as Provider,
8
+ t as default
9
+ };
@@ -0,0 +1,14 @@
1
+ /* 2025-11-28 16:31:16 */
2
+ const T = "none", E = "appear", n = "enter", t = "leave", S = "none", e = "prepare", o = "start", A = "active", P = "end", c = "prepared";
3
+ export {
4
+ E as STATUS_APPEAR,
5
+ n as STATUS_ENTER,
6
+ t as STATUS_LEAVE,
7
+ T as STATUS_NONE,
8
+ P as STEP_ACTIVATED,
9
+ A as STEP_ACTIVE,
10
+ S as STEP_NONE,
11
+ e as STEP_PREPARE,
12
+ c as STEP_PREPARED,
13
+ o as STEP_START
14
+ };
@@ -0,0 +1,56 @@
1
+ /* 2025-11-28 16:31:16 */
2
+ const d = "add", l = "keep", p = "remove", b = "removed";
3
+ function E(s) {
4
+ let n;
5
+ return s && typeof s == "object" && "key" in s ? n = s : n = { key: s }, {
6
+ ...n,
7
+ key: String(n.key)
8
+ };
9
+ }
10
+ function S(s = []) {
11
+ return s.map(E);
12
+ }
13
+ function h(s = [], n = []) {
14
+ let e = [], r = 0;
15
+ const f = n.length, T = S(s), a = S(n);
16
+ T.forEach((t) => {
17
+ let o = !1;
18
+ for (let c = r; c < f; c += 1) {
19
+ const u = a[c];
20
+ if (u.key === t.key) {
21
+ r < c && (e = e.concat(
22
+ a.slice(r, c).map((y) => ({ ...y, status: "add" }))
23
+ ), r = c), e.push({
24
+ ...u,
25
+ status: l
26
+ }), r += 1, o = !0;
27
+ break;
28
+ }
29
+ }
30
+ o || e.push({
31
+ ...t,
32
+ status: p
33
+ });
34
+ }), r < f && (e = e.concat(
35
+ a.slice(r).map((t) => ({ ...t, status: "add" }))
36
+ ));
37
+ const i = {};
38
+ return e.forEach(({ key: t }) => {
39
+ i[t] = (i[t] || 0) + 1;
40
+ }), Object.keys(i).filter((t) => i[t] > 1).forEach((t) => {
41
+ e = e.filter(
42
+ ({ key: o, status: c }) => o !== t || c !== p
43
+ ), e.forEach((o) => {
44
+ o.key === t && (o.status = l);
45
+ });
46
+ }), e;
47
+ }
48
+ export {
49
+ d as STATUS_ADD,
50
+ l as STATUS_KEEP,
51
+ p as STATUS_REMOVE,
52
+ b as STATUS_REMOVED,
53
+ h as diffKeys,
54
+ S as parseKeys,
55
+ E as wrapKeyToObject
56
+ };
@@ -0,0 +1,56 @@
1
+ /* 2025-11-28 16:31:16 */
2
+ import d from "@unicom-cloud/utils/dom-helpers/canUseDOM";
3
+ import "@unicom-cloud/utils/dom-helpers/reflow";
4
+ import "../../utils/is.js";
5
+ function a(n, t) {
6
+ const i = {};
7
+ return i[n.toLowerCase()] = t.toLowerCase(), i[`Webkit${n}`] = `webkit${t}`, i[`Moz${n}`] = `moz${t}`, i[`ms${n}`] = `MS${t}`, i[`O${n}`] = `o${t.toLowerCase()}`, i;
8
+ }
9
+ function m(n, t) {
10
+ const i = {
11
+ animationend: a("Animation", "AnimationEnd"),
12
+ transitionend: a("Transition", "TransitionEnd")
13
+ };
14
+ return n && ("AnimationEvent" in t || delete i.animationend.animation, "TransitionEvent" in t || delete i.transitionend.transition), i;
15
+ }
16
+ const l = m(
17
+ d,
18
+ typeof window < "u" ? window : {}
19
+ );
20
+ let c = {};
21
+ d && ({ style: c } = document.createElement("div"));
22
+ const o = {};
23
+ function f(n) {
24
+ if (o[n])
25
+ return o[n];
26
+ const t = l[n];
27
+ if (t) {
28
+ const i = Object.keys(t), e = i.length;
29
+ for (let r = 0; r < e; r += 1) {
30
+ const s = i[r];
31
+ if (Object.prototype.hasOwnProperty.call(t, s) && s in c)
32
+ return o[n] = t[s], o[n];
33
+ }
34
+ }
35
+ return "";
36
+ }
37
+ const p = f("animationend"), u = f("transitionend"), x = !!(p && u), b = p || "animationend", g = u || "transitionend";
38
+ function M(n, t) {
39
+ if (!n) return null;
40
+ if (typeof n == "object") {
41
+ const i = t.replace(
42
+ /-\w/g,
43
+ (e) => e[1].toUpperCase()
44
+ );
45
+ return n[i];
46
+ }
47
+ return `${n}-${t}`;
48
+ }
49
+ export {
50
+ b as animationEndName,
51
+ M as getTransitionName,
52
+ f as getVendorPrefixedEventName,
53
+ m as getVendorPrefixes,
54
+ x as supportTransition,
55
+ g as transitionEndName
56
+ };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@unicom-cloud/ui-common","version":"0.1.6","dependencies":{"dayjs":"^1.11.19","lodash":"^4.17.21","@unicom-cloud/utils":"^0.1.0","@unicom-cloud/icons":"^0.1.0"},"peerDependencies":{"react":"^18.3.1","react-dom":"^18.3.1","react-is":"^18.3.1"},"type":"module","types":"types/index.d.ts","main":"./index.js","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
1
+ {"name":"@unicom-cloud/ui-common","version":"0.1.8","dependencies":{"dayjs":"^1.11.19","lodash":"^4.17.21","@unicom-cloud/utils":"^0.1.0","@unicom-cloud/icons":"^0.1.0"},"peerDependencies":{"react":"^18.3.1","react-dom":"^18.3.1","react-is":"^18.3.1"},"type":"module","types":"types/index.d.ts","main":"./index.js","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
package/progress/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* 2025-11-19 10:00:01 */
1
+ /* 2025-11-28 16:31:16 */
2
2
  import { UI_COMMON_PREFIX as u } from "@unicom-cloud/utils/constant/ui";
3
3
  import "../utils/is.js";
4
4
  import { isNumber as f } from "@unicom-cloud/utils/is";
@@ -0,0 +1,25 @@
1
+ /* 2025-11-28 16:31:16 */
2
+ import { jsx as R } from "react/jsx-runtime";
3
+ import e from "react";
4
+ const i = e.createContext(null);
5
+ function p({ children: l, onBatchResize: o }) {
6
+ const r = e.useRef(0), t = e.useRef([]), n = e.useContext(i), f = e.useCallback(
7
+ (c, s, u) => {
8
+ r.current += 1;
9
+ const C = r.current;
10
+ t.current.push({
11
+ size: c,
12
+ element: s,
13
+ data: u
14
+ }), Promise.resolve().then(() => {
15
+ C === r.current && (o?.(t.current), t.current = []);
16
+ }), n?.(c, s, u);
17
+ },
18
+ [o, n]
19
+ );
20
+ return /* @__PURE__ */ R(i.Provider, { value: f, children: l });
21
+ }
22
+ export {
23
+ p as Collection,
24
+ i as CollectionContext
25
+ };
@@ -0,0 +1,48 @@
1
+ /* 2025-11-28 16:31:16 */
2
+ import e from "react";
3
+ import { findRootElement as I } from "../utils/findRootElement.js";
4
+ import { supportRef as S, getReactElementRef as y, useComposeRef as P } from "../utils/ref.js";
5
+ import { CollectionContext as k } from "./Collection.js";
6
+ import { observe as B, unobserve as D } from "./observerUtil.js";
7
+ function N(f, H) {
8
+ const { children: c, disabled: h } = f, r = e.useRef(null), z = e.useContext(k), u = typeof c == "function", n = u ? c(r) : c, o = e.useRef({
9
+ width: -1,
10
+ height: -1,
11
+ offsetWidth: -1,
12
+ offsetHeight: -1
13
+ }), m = !u && e.isValidElement(n) && S(n), W = m ? y(n) : null, w = P(W, r), R = () => I(r);
14
+ e.useImperativeHandle(H, () => R());
15
+ const g = e.useRef(f);
16
+ g.current = f;
17
+ const a = e.useCallback((t) => {
18
+ const { onResize: p, data: x } = g.current, { width: l, height: d } = t.getBoundingClientRect(), { offsetWidth: s, offsetHeight: i } = t, C = Math.floor(l), b = Math.floor(d);
19
+ if (o.current.width !== C || o.current.height !== b || o.current.offsetWidth !== s || o.current.offsetHeight !== i) {
20
+ const v = {
21
+ width: C,
22
+ height: b,
23
+ offsetWidth: s,
24
+ offsetHeight: i
25
+ };
26
+ o.current = v;
27
+ const O = s === Math.round(l) ? l : s, M = i === Math.round(d) ? d : i, E = {
28
+ ...v,
29
+ offsetWidth: O,
30
+ offsetHeight: M
31
+ };
32
+ z?.(E, t, x), p && Promise.resolve().then(() => {
33
+ p(E, t);
34
+ });
35
+ }
36
+ }, []);
37
+ return e.useEffect(() => {
38
+ const t = R();
39
+ return t && !h && B(t, a), () => D(t, a);
40
+ }, [r.current, h]), m ? e.cloneElement(n, {
41
+ ref: w
42
+ }) : n;
43
+ }
44
+ const V = e.forwardRef(N);
45
+ V.displayName = "SingleObserver";
46
+ export {
47
+ V as default
48
+ };
@@ -0,0 +1,27 @@
1
+ /* 2025-11-28 16:31:16 */
2
+ import c, { createElement as m } from "react";
3
+ import { toArray as a } from "../utils/toArray.js";
4
+ import { warning as t } from "../utils/warning.js";
5
+ import { Collection as d } from "./Collection.js";
6
+ import p from "./SingleObserver.js";
7
+ function v(o, f) {
8
+ const { children: e } = o, r = typeof e == "function" ? [e] : a(e);
9
+ return process.env.NODE_ENV !== "production" && (r.length > 1 ? t(
10
+ !1,
11
+ "Find more than one child node with `children` in ResizeObserver. Please use ResizeObserver.Collection instead."
12
+ ) : r.length === 0 && t(
13
+ !1,
14
+ "`children` of ResizeObserver is empty. Nothing is in observe."
15
+ )), r.map((i, n) => {
16
+ const l = i?.key || `observer-key-${n}`;
17
+ return /* @__PURE__ */ m(p, { ...o, key: l, ref: n === 0 ? f : void 0 }, i);
18
+ });
19
+ }
20
+ const s = c.forwardRef(
21
+ v
22
+ );
23
+ process.env.NODE_ENV !== "production" && (s.displayName = "ResizeObserver");
24
+ s.Collection = d;
25
+ export {
26
+ s as default
27
+ };
@@ -0,0 +1,22 @@
1
+ /* 2025-11-28 16:31:16 */
2
+ const s = /* @__PURE__ */ new Map();
3
+ function f(e) {
4
+ e.forEach((r) => {
5
+ const { target: t } = r;
6
+ s.get(t)?.forEach((n) => n(t));
7
+ });
8
+ }
9
+ let o;
10
+ function i() {
11
+ return o || (o = new ResizeObserver(f)), o;
12
+ }
13
+ function c(e, r) {
14
+ s.has(e) || (s.set(e, /* @__PURE__ */ new Set()), i().observe(e)), s.get(e).add(r);
15
+ }
16
+ function u(e, r) {
17
+ s.has(e) && (s.get(e).delete(r), s.get(e).size || (i().unobserve(e), s.delete(e)));
18
+ }
19
+ export {
20
+ c as observe,
21
+ u as unobserve
22
+ };