@unicom-cloud/ui-common 0.1.19 → 0.1.21

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 (280) hide show
  1. package/.virtual/_rolldown/runtime.js +1 -1
  2. package/.vite/manifest.json +125 -74
  3. package/development/index.js +1 -1
  4. package/development/interface.d.ts +1 -1
  5. package/empty/index.js +1 -1
  6. package/empty/interface.d.ts +1 -1
  7. package/flex/index.js +1 -1
  8. package/flex/utils.js +1 -1
  9. package/higher-order/index.js +1 -1
  10. package/higher-order/with-speech-synthesis/index.js +1 -1
  11. package/hooks/create-deep-compare-effect/index.js +8 -7
  12. package/hooks/create-update-effect/index.d.ts +1 -1
  13. package/hooks/create-update-effect/index.js +9 -10
  14. package/hooks/create-use-storage-state/index.js +1 -1
  15. package/hooks/index.d.ts +1 -0
  16. package/hooks/index.js +82 -81
  17. package/hooks/use-async-effect/index.js +1 -1
  18. package/hooks/use-boolean/index.js +1 -1
  19. package/hooks/use-click-away/index.d.ts +2 -2
  20. package/hooks/use-click-away/index.js +7 -3
  21. package/hooks/use-computed-state/index.js +1 -1
  22. package/hooks/use-controllable-value/index.js +1 -1
  23. package/hooks/use-cookie-state/index.d.ts +34 -1
  24. package/hooks/use-cookie-state/index.js +16 -16
  25. package/hooks/use-count-down/index.js +1 -1
  26. package/hooks/use-counter/index.js +1 -1
  27. package/hooks/use-create/index.d.ts +4 -1
  28. package/hooks/use-create/index.js +1 -1
  29. package/hooks/use-creation/index.js +1 -1
  30. package/hooks/use-debounce/index.js +1 -1
  31. package/hooks/use-debounce-effect/index.js +1 -1
  32. package/hooks/use-debounce-fn/index.js +1 -1
  33. package/hooks/use-deep-compare-effect/index.js +1 -1
  34. package/hooks/use-deep-compare-layout-effect/index.js +1 -1
  35. package/hooks/use-document-visibility/index.js +1 -1
  36. package/hooks/use-drag/index.js +1 -1
  37. package/hooks/use-drop/index.js +3 -3
  38. package/hooks/use-effect-event/index.js +13 -12
  39. package/hooks/use-event/index.js +1 -1
  40. package/hooks/use-event-emitter/demo/demo1.d.ts +10 -0
  41. package/hooks/use-event-emitter/index.d.ts +8 -0
  42. package/hooks/use-event-emitter/index.js +26 -0
  43. package/hooks/use-event-listener/index.js +1 -1
  44. package/hooks/use-event-target/index.js +1 -1
  45. package/hooks/use-external/index.js +25 -24
  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 +1 -1
  50. package/hooks/use-get-state/index.js +1 -1
  51. package/hooks/use-history-travel/index.js +1 -1
  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 +1 -1
  56. package/hooks/use-infinite-scroll/index.js +54 -53
  57. package/hooks/use-intersection-observer/index.js +1 -1
  58. package/hooks/use-intersection-observers/index.js +1 -1
  59. package/hooks/use-interval/index.js +1 -1
  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 +1 -1
  63. package/hooks/use-keyboard-event/index.js +3 -3
  64. package/hooks/use-latest/index.js +1 -1
  65. package/hooks/use-listen-window-resize/index.d.ts +1 -1
  66. package/hooks/use-listen-window-resize/index.js +3 -3
  67. package/hooks/use-local-storage-state/index.js +1 -1
  68. package/hooks/use-lock-fn/index.js +1 -1
  69. package/hooks/use-long-press/index.js +1 -1
  70. package/hooks/use-map/index.js +1 -1
  71. package/hooks/use-media/index.js +12 -11
  72. package/hooks/use-memo/index.js +1 -1
  73. package/hooks/use-memoized-fn/index.d.ts +1 -1
  74. package/hooks/use-memoized-fn/index.js +3 -3
  75. package/hooks/use-merge-props/index.js +1 -1
  76. package/hooks/use-merge-value/index.js +1 -1
  77. package/hooks/use-mobile/index.js +1 -1
  78. package/hooks/use-mount/index.js +1 -1
  79. package/hooks/use-mouse/index.js +1 -1
  80. package/hooks/use-move/index.js +1 -1
  81. package/hooks/use-mutation-observer/index.js +1 -1
  82. package/hooks/use-mutation-observers/index.js +1 -1
  83. package/hooks/use-network/index.js +1 -1
  84. package/hooks/use-online-status/index.js +1 -1
  85. package/hooks/use-overflow-hidden/index.js +2 -2
  86. package/hooks/use-override-ref/index.js +1 -1
  87. package/hooks/use-pagination/index.js +1 -1
  88. package/hooks/use-paste-image/index.js +1 -1
  89. package/hooks/use-persist-callback/index.js +1 -1
  90. package/hooks/use-prefers-color-scheme-dark/index.js +1 -1
  91. package/hooks/use-previous/index.js +1 -1
  92. package/hooks/use-raf-interval/index.js +1 -1
  93. package/hooks/use-raf-state/index.js +1 -1
  94. package/hooks/use-raf-timeout/index.js +1 -1
  95. package/hooks/use-reactive/index.js +1 -1
  96. package/hooks/use-ref-latest/index.js +1 -1
  97. package/hooks/use-refs/index.js +11 -10
  98. package/hooks/use-request/index.js +1 -1
  99. package/hooks/use-request/src/Fetch.js +1 -1
  100. package/hooks/use-request/src/plugins/useAutoRunPlugin.js +1 -1
  101. package/hooks/use-request/src/plugins/useCachePlugin.js +1 -1
  102. package/hooks/use-request/src/plugins/useDebouncePlugin.js +20 -19
  103. package/hooks/use-request/src/plugins/useLoadingDelayPlugin.js +1 -1
  104. package/hooks/use-request/src/plugins/usePollingPlugin.js +1 -1
  105. package/hooks/use-request/src/plugins/useRefreshOnWindowFocusPlugin.js +1 -1
  106. package/hooks/use-request/src/plugins/useRetryPlugin.js +1 -1
  107. package/hooks/use-request/src/plugins/useThrottlePlugin.js +18 -17
  108. package/hooks/use-request/src/useRequest.js +1 -1
  109. package/hooks/use-request/src/useRequestImplement.js +1 -1
  110. package/hooks/use-request/src/utils/cache.js +1 -1
  111. package/hooks/use-request/src/utils/cachePromise.js +1 -1
  112. package/hooks/use-request/src/utils/cacheSubscribe.js +1 -1
  113. package/hooks/use-request/src/utils/isDocumentVisible.js +1 -1
  114. package/hooks/use-request/src/utils/isOnline.js +1 -1
  115. package/hooks/use-request/src/utils/limit.js +1 -1
  116. package/hooks/use-request/src/utils/subscribeFocus.js +1 -1
  117. package/hooks/use-request/src/utils/subscribeReVisible.js +1 -1
  118. package/hooks/use-reset-state/index.js +1 -1
  119. package/hooks/use-resize-observer/index.js +1 -1
  120. package/hooks/use-resize-observers/index.js +1 -1
  121. package/hooks/use-responsive/index.js +1 -1
  122. package/hooks/use-safe-state/index.js +1 -1
  123. package/hooks/use-scroll/index.js +1 -1
  124. package/hooks/use-selections/index.js +1 -1
  125. package/hooks/use-session-storage-state/index.js +1 -1
  126. package/hooks/use-set/index.js +1 -1
  127. package/hooks/use-set-state/index.js +1 -1
  128. package/hooks/use-size/index.js +1 -1
  129. package/hooks/use-state-callback/index.js +11 -9
  130. package/hooks/use-state-with-promise/index.d.ts +11 -1
  131. package/hooks/use-state-with-promise/index.js +21 -20
  132. package/hooks/use-sync-state/index.js +1 -1
  133. package/hooks/use-text-selection/index.js +1 -1
  134. package/hooks/use-theme/index.js +1 -1
  135. package/hooks/use-throttle/index.js +1 -1
  136. package/hooks/use-throttle-effect/index.js +1 -1
  137. package/hooks/use-throttle-fn/index.js +1 -1
  138. package/hooks/use-timeout/index.js +1 -1
  139. package/hooks/use-title/index.js +1 -1
  140. package/hooks/use-toggle/index.js +12 -11
  141. package/hooks/use-tracked-effect/index.js +1 -1
  142. package/hooks/use-unmount/index.js +1 -1
  143. package/hooks/use-unmounted-ref/index.js +1 -1
  144. package/hooks/use-update/index.d.ts +3 -1
  145. package/hooks/use-update/index.js +5 -5
  146. package/hooks/use-update-effect/index.js +1 -1
  147. package/hooks/use-update-layout-effect/index.js +1 -1
  148. package/hooks/use-url-state/index.js +1 -1
  149. package/hooks/use-virtual-list/index.js +1 -1
  150. package/hooks/use-watch/index.js +1 -1
  151. package/hooks/use-web-socket/index.js +1 -1
  152. package/hooks/use-why-did-you-update/index.js +1 -1
  153. package/hooks/use-window-size/index.d.ts +1 -1
  154. package/hooks/use-window-size/index.js +1 -1
  155. package/hooks/utils/createEffectWithTarget.js +1 -1
  156. package/hooks/utils/depsAreSame.js +1 -1
  157. package/hooks/utils/depsEqual.js +1 -1
  158. package/hooks/utils/domTarget.js +1 -1
  159. package/hooks/utils/getDocumentOrShadow.js +1 -1
  160. package/hooks/utils/index.js +1 -1
  161. package/hooks/utils/isAppleDevice.js +1 -1
  162. package/hooks/utils/isBrowser.js +1 -1
  163. package/hooks/utils/isDev.js +1 -1
  164. package/hooks/utils/rect.js +1 -1
  165. package/hooks/utils/useDeepCompareWithTarget.js +1 -1
  166. package/hooks/utils/useEffectWithTarget.js +1 -1
  167. package/hooks/utils/useIsomorphicLayoutEffectWithTarget.js +1 -1
  168. package/hooks/utils/useLayoutEffectWithTarget.js +1 -1
  169. package/icons/file/index.js +1 -1
  170. package/icons/file/interface.d.ts +1 -1
  171. package/index.d.ts +1 -1
  172. package/index.js +586 -549
  173. package/interface.d.ts +3 -0
  174. package/package.json +1 -1
  175. package/progress/index.js +43 -43
  176. package/resize-observer/Collection.d.ts +2 -2
  177. package/resize-observer/Collection.js +1 -1
  178. package/resize-observer/SingleObserver.js +1 -1
  179. package/resize-observer/index.js +1 -1
  180. package/resize-observer/observerUtil.js +1 -1
  181. package/space/index.js +49 -48
  182. package/space/interface.d.ts +1 -1
  183. package/style/animation.less +13 -1
  184. package/style.css +1 -1
  185. package/suspense-fallback-test/index.js +1 -1
  186. package/test.js +1 -1
  187. package/timer/index.js +25 -23
  188. package/timer/interface.d.ts +1 -1
  189. package/transition/Transition.d.ts +11 -0
  190. package/transition/Transition.js +102 -0
  191. package/transition/TransitionCSS.d.ts +11 -0
  192. package/transition/TransitionCSS.js +42 -0
  193. package/transition/TransitionGroup.d.ts +11 -0
  194. package/transition/TransitionGroup.js +57 -0
  195. package/transition/TransitionStyle.d.ts +11 -0
  196. package/transition/TransitionStyle.js +37 -0
  197. package/transition/constants.d.ts +49 -0
  198. package/transition/constants.js +48 -0
  199. package/transition/index.d.ts +10 -0
  200. package/transition/index.js +12 -0
  201. package/transition/interface.d.ts +197 -0
  202. package/transition/utils.d.ts +20 -0
  203. package/transition/utils.js +99 -0
  204. package/utils/callOrReturn.js +1 -1
  205. package/utils/callbackOriginRef.js +1 -1
  206. package/utils/caseName.js +1 -1
  207. package/utils/className.js +1 -1
  208. package/utils/constant.d.ts +2 -0
  209. package/utils/constant.js +3 -3
  210. package/utils/copy.js +1 -1
  211. package/utils/date.js +1 -1
  212. package/utils/dayjs.js +1 -1
  213. package/utils/dom.js +1 -1
  214. package/utils/emitter.js +1 -1
  215. package/utils/fileRead.js +1 -1
  216. package/utils/fileToDataURL.js +1 -1
  217. package/utils/fillNBSP.js +1 -1
  218. package/utils/findRootElement.d.ts +3 -3
  219. package/utils/findRootElement.js +2 -2
  220. package/utils/findScrollParent.js +1 -1
  221. package/utils/getHighlightText.js +2 -2
  222. package/utils/getHotkeyHandler.js +1 -1
  223. package/utils/getScrollBarHeight.js +1 -1
  224. package/utils/getScrollBarSize.js +16 -6
  225. package/utils/getScrollBarWidth.js +1 -1
  226. package/utils/getStringLength.js +1 -1
  227. package/utils/include.js +1 -1
  228. package/utils/index.js +289 -281
  229. package/utils/intersectionObserver.js +1 -1
  230. package/utils/is.d.ts +8 -7
  231. package/utils/is.js +22 -19
  232. package/utils/keyboardCode.js +1 -1
  233. package/utils/lodash.js +1 -1
  234. package/utils/math.js +1 -1
  235. package/utils/mergeProps.js +8 -7
  236. package/utils/mergedToString.js +1 -1
  237. package/utils/mutationObserver.js +1 -1
  238. package/utils/omit.js +1 -1
  239. package/utils/pad.js +1 -1
  240. package/utils/pick.js +1 -1
  241. package/utils/pinyin.js +1 -1
  242. package/utils/react19Adapter.js +1 -1
  243. package/utils/ref.js +2 -2
  244. package/utils/resizeObserver.js +1 -1
  245. package/utils/saveAs.js +1 -1
  246. package/utils/screenfull.js +1 -1
  247. package/utils/scrollIntoViewIfNeeded.js +1 -1
  248. package/utils/setCreateRoot.js +1 -1
  249. package/utils/setDarkTheme.js +1 -1
  250. package/utils/setDir.js +1 -1
  251. package/utils/setPrimaryColor.js +1 -1
  252. package/utils/setTheme.js +1 -1
  253. package/utils/string.js +1 -1
  254. package/utils/style.js +1 -1
  255. package/utils/throttleByRaf.js +1 -1
  256. package/utils/throttleByRaf2.js +1 -1
  257. package/utils/tinycolor.js +1 -1
  258. package/utils/toArray.js +1 -1
  259. package/utils/tree.js +1 -1
  260. package/utils/tween.js +1 -1
  261. package/utils/uuid.js +1 -1
  262. package/utils/validate.js +1 -1
  263. package/utils/warning.js +1 -1
  264. package/version/index.js +9 -9
  265. package/transition-group/ChildMapping.d.ts +0 -27
  266. package/transition-group/ChildMapping.js +0 -61
  267. package/transition-group/Transition.d.ts +0 -126
  268. package/transition-group/Transition.js +0 -133
  269. package/transition-group/TransitionCSS.d.ts +0 -97
  270. package/transition-group/TransitionCSS.js +0 -73
  271. package/transition-group/TransitionGroup.d.ts +0 -31
  272. package/transition-group/TransitionGroup.js +0 -54
  273. package/transition-group/TransitionReplace.d.ts +0 -23
  274. package/transition-group/TransitionReplace.js +0 -38
  275. package/transition-group/TransitionSwitch.d.ts +0 -88
  276. package/transition-group/TransitionSwitch.js +0 -84
  277. package/transition-group/context.d.ts +0 -2
  278. package/transition-group/context.js +0 -7
  279. package/transition-group/index.d.ts +0 -9
  280. package/transition-group/index.js +0 -11
package/interface.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export type RootElementRef = {
2
+ getRootElement: () => HTMLElement | null;
3
+ };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@unicom-cloud/ui-common","version":"0.1.19","dependencies":{"@unicom-cloud/utils":"^0.1.0","@unicom-cloud/icons":"^0.1.0"},"peerDependencies":{"dayjs":"^1.11.19","lodash":"^4.18.1","react":"^18.3.1","react-dom":"^18.3.1","react-is":"^18.3.1"},"type":"module","types":"types/index.d.ts","main":"./index.js","bin":{"ui":"./test.js"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
1
+ {"name":"@unicom-cloud/ui-common","version":"0.1.21","dependencies":{"@unicom-cloud/utils":"^0.1.0","@unicom-cloud/icons":"^0.1.0"},"peerDependencies":{"dayjs":"^1.11.19","lodash":"^4.18.1","react":"^18.3.1","react-dom":"^18.3.1","react-is":"^18.3.1"},"type":"module","types":"types/index.d.ts","main":"./index.js","bin":{"ui":"./test.js"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
package/progress/index.js CHANGED
@@ -1,8 +1,8 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
2
- import { isNumber as e } from "../utils/is.js";
3
- import { UI_COMMON_PREFIX as t } from "@unicom-cloud/utils/constant/ui";
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
+ import { isNumber as e, isUndefined as t } from "../utils/is.js";
3
+ import { UI_COMMON_PREFIX as n } from "@unicom-cloud/utils/constant/ui";
4
4
  //#region components/common/progress/index.js
5
- var n = {
5
+ var r = {
6
6
  status: null,
7
7
  settings: {
8
8
  parent: document.body,
@@ -16,75 +16,75 @@ var n = {
16
16
  trickleSpeed: 227
17
17
  },
18
18
  configure(e) {
19
- return Object.assign(n.settings, e), n;
19
+ return Object.assign(r.settings, e), r;
20
20
  },
21
21
  set(e) {
22
- let t = n.isStarted();
23
- e = r(e, n.settings.minimum, 1), n.status = e === 1 ? null : e;
24
- let i = n.render(!t), o = n.settings.speed;
25
- return i.offsetWidth, l(function(t) {
26
- u(n.settings.bar, a(e, o)), e === 1 ? (i.offsetWidth, setTimeout(function() {
27
- n.remove(), t();
28
- }, o)) : setTimeout(t, o);
29
- }), n;
22
+ let t = r.isStarted();
23
+ e = i(e, r.settings.minimum, 1), r.status = e === 1 ? null : e;
24
+ let n = r.render(!t), a = r.settings.speed;
25
+ return n.offsetWidth, u(function(t) {
26
+ d(r.settings.bar, o(e, a)), e === 1 ? (n.offsetWidth, setTimeout(function() {
27
+ r.remove(), t();
28
+ }, a)) : setTimeout(t, a);
29
+ }), r;
30
30
  },
31
31
  isStarted() {
32
- return e(n.status);
32
+ return e(r.status);
33
33
  },
34
34
  start() {
35
- return n.status || n.set(0), n.settings.trickle && o(), n;
35
+ return r.status || r.set(0), r.settings.trickle && s(), r;
36
36
  },
37
37
  done(e) {
38
- return e || n.status ? n.inc(.3 + .5 * Math.random()).set(1) : n;
38
+ return e || r.status ? r.inc(.3 + .5 * Math.random()).set(1) : r;
39
39
  },
40
40
  inc(t) {
41
- let i = n.status;
42
- if (!i) return n.start();
43
- if (!(i > 1)) return e(t) || (i >= 0 && i < .2 && (t = .1), i >= .2 && i < .5 && (t = .04), i >= .5 && i < .8 && (t = .02), i >= .8 && i < .99 && (t = .005)), t ??= 7e-4, i = r(i + t, 0, .994), n.set(i);
41
+ let n = r.status;
42
+ if (!n) return r.start();
43
+ if (!(n > 1)) return e(t) || (n >= 0 && n < .2 && (t = .1), n >= .2 && n < .5 && (t = .04), n >= .5 && n < .8 && (t = .02), n >= .8 && n < .99 && (t = .005)), t ??= 7e-4, n = i(n + t, 0, .994), r.set(n);
44
44
  },
45
45
  trickle() {
46
- return n.inc();
46
+ return r.inc();
47
47
  },
48
48
  render(e) {
49
- if (n.settings.parent.contains(n.settings.progress)) return n.settings.progress;
50
- n.settings.progress.hasAttribute("class"), n.settings.bar.hasAttribute("class"), n.settings.progress.setAttribute("class", `${t}-progress`), n.settings.bar.setAttribute("class", `${t}-progress-bar`), n.settings.progress.contains(n.settings.bar) || n.settings.progress.append(n.settings.bar);
51
- let r = e ? "-100" : i(n.status || 0);
52
- return u(n.settings.bar, a(0, r)), n.settings.parent.append(n.settings.progress), n.settings.progress;
49
+ if (r.settings.parent.contains(r.settings.progress)) return r.settings.progress;
50
+ r.settings.progress.hasAttribute("class"), r.settings.bar.hasAttribute("class"), r.settings.progress.setAttribute("class", `${n}-progress`), r.settings.bar.setAttribute("class", `${n}-progress-bar`), r.settings.progress.contains(r.settings.bar) || r.settings.progress.append(r.settings.bar);
51
+ let t = e ? "-100" : a(r.status || 0);
52
+ return d(r.settings.bar, o(0, t)), r.settings.parent.append(r.settings.progress), r.settings.progress;
53
53
  },
54
54
  remove() {
55
- n.settings.progress.remove();
55
+ r.settings.progress.remove();
56
56
  }
57
57
  };
58
- function r(e, t, n) {
58
+ function i(e, t, n) {
59
59
  return Math.max(Math.min(e, n), t);
60
60
  }
61
- function i(e) {
61
+ function a(e) {
62
62
  return (-1 + e) * 100;
63
63
  }
64
- function a(e, t, r = n.settings.easing) {
64
+ function o(e, t, n = r.settings.easing) {
65
65
  return {
66
- transform: `translate(${i(e)}%,0)`,
67
- transition: `transform ${t}ms ${r}`
66
+ transform: `translate(${a(e)}%,0)`,
67
+ transition: `transform ${t}ms ${n}`
68
68
  };
69
69
  }
70
- function o() {
70
+ function s() {
71
71
  setTimeout(() => {
72
- n.status && (n.trickle(), o());
73
- }, n.settings.trickleSpeed);
72
+ r.status && (r.trickle(), s());
73
+ }, r.settings.trickleSpeed);
74
74
  }
75
- var s = [];
76
- function c() {
77
- let e = s.shift();
78
- e && e(c);
75
+ var c = [];
76
+ function l() {
77
+ let e = c.shift();
78
+ e && e(l);
79
79
  }
80
- function l(e) {
81
- s.push(e), s.length && c();
80
+ function u(e) {
81
+ c.push(e), c.length && l();
82
82
  }
83
- function u(e, t) {
84
- Object.entries(t).forEach(([t, n], r, i) => {
85
- n === void 0 || (e.style[t] = n);
83
+ function d(e, n) {
84
+ Object.entries(n).forEach(([n, r], i, a) => {
85
+ t(r) || (e.style[n] = r);
86
86
  });
87
87
  }
88
88
  //#endregion
89
- export { n as default };
89
+ export { r as default };
90
90
  /* 独立思考,明辨是非 */
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
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>;
3
+ type OnCollectionResize = (size: SizeInfo, element: HTMLElement, data: unknown) => void;
4
+ export declare const CollectionContext: React.Context<OnCollectionResize>;
5
5
  /**
6
6
  * Collect all the resize event from children ResizeObserver
7
7
  */
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  import e from "react";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
4
  //#region components/common/resize-observer/Collection.tsx
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  import { isFunction as e } from "../utils/is.js";
3
3
  import { getReactElementRef as t, supportRef as n, useComposeRef as r } from "../utils/ref.js";
4
4
  import i from "../utils/findRootElement.js";
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  import { isFunction as e } from "../utils/is.js";
3
3
  import t from "../utils/toArray.js";
4
4
  import { Collection as n } from "./Collection.js";
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  //#region components/common/resize-observer/observerUtil.ts
3
3
  var e = /* @__PURE__ */ new Map();
4
4
  function t(t) {
package/space/index.js CHANGED
@@ -1,73 +1,74 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
2
- import e from "../hooks/use-merge-props/index.js";
3
- import t from "../utils/className.js";
4
- import n from "../utils/toArray.js";
5
- import r from "../flex/index.js";
6
- import { Fragment as i, forwardRef as a, useImperativeHandle as o, useRef as s } from "react";
7
- import { UI_COMMON_PREFIX as c } from "@unicom-cloud/utils/constant/ui";
8
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
+ import { isPresent as e } from "../utils/is.js";
3
+ import t from "../hooks/use-merge-props/index.js";
4
+ import n from "../utils/className.js";
5
+ import r from "../utils/toArray.js";
6
+ import i from "../flex/index.js";
7
+ import { Fragment as a, forwardRef as o, useImperativeHandle as s, useRef as c } from "react";
8
+ import { UI_COMMON_PREFIX as l } from "@unicom-cloud/utils/constant/ui";
9
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
10
  //#region components/common/space/index.tsx
10
- var d = {
11
+ var f = {
11
12
  gap: "small",
12
13
  direction: "horizontal"
13
14
  };
14
- function f(a, f) {
15
- let { className: p, style: m, children: h, size: g, gap: _, direction: v, justifyContent: y, align: b, alignItems: x, wrap: S, separator: C, rtl: w, legacy: T, ...E } = e(a, d, {}), D = `${c}-space`, O = [
15
+ function p(o, p) {
16
+ let { className: m, style: h, children: g, size: _, gap: v, direction: y, justifyContent: b, align: x, alignItems: S, wrap: C, separator: w, rtl: T, legacy: E, ...D } = t(o, f, {}), O = `${l}-space`, k = [
16
17
  "horizontal",
17
18
  "row-reverse",
18
19
  "row"
19
- ].includes(v);
20
+ ].includes(y);
20
21
  [
21
22
  "vertical",
22
23
  "column-reverse",
23
24
  "column"
24
- ].includes(v);
25
- let k = {
25
+ ].includes(y);
26
+ let A = {
26
27
  horizontal: "row",
27
28
  vertical: "column"
28
- }[v] ?? v, A = T ? {
29
+ }[y] ?? y, j = E ? {
29
30
  start: "flex-start",
30
31
  end: "flex-end"
31
- } : {}, j = A[y] ?? y, M = x ?? b ?? (O ? "center" : void 0);
32
- M = A[M] ?? M;
33
- let N = t(D, {
34
- [`${D}-${v}`]: v,
35
- [`${D}-justify-content-${j}`]: j,
36
- [`${D}-align-items-${M}`]: M,
37
- [`${D}-rtl`]: w
38
- }, S ? `${D}-wrap` : `${D}-no-wrap`, p), P = n(h), F = s(null);
39
- return o(f, () => ({ getRootElement() {
40
- return F.current.getRootElement();
41
- } })), /* @__PURE__ */ l(r, {
42
- ref: F,
43
- style: m,
44
- className: N,
45
- gap: _ ?? g,
46
- wrap: S,
47
- justifyContent: j,
48
- alignItems: M,
49
- direction: k,
50
- rtl: w,
32
+ } : {}, M = j[b] ?? b, N = S ?? x ?? (k ? "center" : void 0);
33
+ N = j[N] ?? N;
34
+ let P = n(O, {
35
+ [`${O}-${y}`]: y,
36
+ [`${O}-justify-content-${M}`]: M,
37
+ [`${O}-align-items-${N}`]: N,
38
+ [`${O}-rtl`]: T
39
+ }, C ? `${O}-wrap` : `${O}-no-wrap`, m), F = r(g), I = c(null);
40
+ return s(p, () => ({ getRootElement() {
41
+ return I.current.getRootElement();
42
+ } })), /* @__PURE__ */ u(i, {
43
+ ref: I,
44
+ style: h,
45
+ className: P,
46
+ gap: v ?? _,
47
+ wrap: C,
48
+ justifyContent: M,
49
+ alignItems: N,
50
+ direction: A,
51
+ rtl: T,
51
52
  inline: !0,
52
- ...E,
53
- children: P.map((e, t) => {
54
- let n = e?.key ?? t;
55
- return /* @__PURE__ */ u(i, { children: [C != null && t > 0 && /* @__PURE__ */ l("div", {
56
- className: `${D}-item-separator`,
57
- children: C
58
- }), /* @__PURE__ */ l("div", {
59
- className: `${D}-item`,
60
- children: e
61
- })] }, n);
53
+ ...D,
54
+ children: F.map((t, n) => {
55
+ let r = t?.key ?? n;
56
+ return /* @__PURE__ */ d(a, { children: [e(w) && n > 0 && /* @__PURE__ */ u("div", {
57
+ className: `${O}-item-separator`,
58
+ children: w
59
+ }), /* @__PURE__ */ u("div", {
60
+ className: `${O}-item`,
61
+ children: t
62
+ })] }, r);
62
63
  })
63
64
  });
64
65
  }
65
- var p = a(f), m = a((e, t) => /* @__PURE__ */ l(p, {
66
+ var m = o(p), h = o((e, t) => /* @__PURE__ */ u(m, {
66
67
  ...e,
67
68
  ref: t,
68
69
  direction: "vertical"
69
70
  }));
70
- m.displayName = "SpaceVertical", p.Vertical = m;
71
+ h.displayName = "SpaceVertical", m.Vertical = h;
71
72
  //#endregion
72
- export { m as SpaceVertical, p as default };
73
+ export { h as SpaceVertical, m as default };
73
74
  /* 独立思考,明辨是非 */
@@ -5,7 +5,7 @@ export type JustifyContent = 'start' | 'end' | 'center' | 'space-between';
5
5
  export type Direction = 'vertical' | 'horizontal';
6
6
  export interface SpaceProps {
7
7
  style?: CSSProperties;
8
- className?: string | string[];
8
+ className?: string;
9
9
  /**
10
10
  * @zh 交叉轴方向对齐方式
11
11
  * @deprecated 请用 alignItems 属性替代
@@ -7,6 +7,17 @@
7
7
  animation: ~'@{ui-common-prefix}-keyframes-vibrate' 0.3s linear infinite both;
8
8
  }
9
9
 
10
+ .@{ui-common-prefix}-animation-blink-appear,
11
+ .@{ui-common-prefix}-animation-blink-appear-active,
12
+ .@{ui-common-prefix}-animation-blink-appear-done,
13
+ .@{ui-common-prefix}-animation-blink-enter,
14
+ .@{ui-common-prefix}-animation-blink-enter-active,
15
+ .@{ui-common-prefix}-animation-blink-enter-done,
16
+ .@{ui-common-prefix}-animation-blink-exit,
17
+ .@{ui-common-prefix}-animation-blink-exit-active,
18
+ .@{ui-common-prefix}-animation-blink-exit-done {
19
+ transition: opacity 0.3s linear;
20
+ }
10
21
  .@{ui-common-prefix}-animation-blink-appear,
11
22
  .@{ui-common-prefix}-animation-blink-enter {
12
23
  opacity: 0;
@@ -14,8 +25,9 @@
14
25
  .@{ui-common-prefix}-animation-blink-appear-active,
15
26
  .@{ui-common-prefix}-animation-blink-enter-active {
16
27
  opacity: 1;
17
- transition: opacity 0.3s linear;
18
28
  }
29
+
30
+ .@{ui-common-prefix}-animation-blink-appear-done,
19
31
  .@{ui-common-prefix}-animation-blink-enter-done {
20
32
  animation: ~'@{ui-common-prefix}-keyframes-blink' 0.5s linear;
21
33
  }
package/style.css CHANGED
@@ -1,2 +1,2 @@
1
- :root{--pi:3.14159}@keyframes pqbc-keyframes-vibrate{0%{transform:translate(0)}20%{transform:translate(-2px,2px)}40%{transform:translate(-2px,-2px)}60%{transform:translate(2px,2px)}80%{transform:translate(2px,-2px)}to{transform:translate(0)}}@keyframes pqbc-keyframes-rotate-360deg{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes pqbc-keyframes-blink{0%{opacity:1}50%{opacity:0}to{opacity:1}}.pqbc-animation-rotate-360deg{animation:1s cubic-bezier(0,0,1,1) infinite pqbc-keyframes-rotate-360deg}.pqbc-animation-vibrate{animation:.3s linear infinite both pqbc-keyframes-vibrate}.pqbc-animation-blink-appear,.pqbc-animation-blink-enter{opacity:0}.pqbc-animation-blink-appear-active,.pqbc-animation-blink-enter-active{opacity:1;transition:opacity .3s linear}.pqbc-animation-blink-enter-done{animation:.5s linear pqbc-keyframes-blink}.pqbc-display-none{display:none!important}.pqbc-visibility-hidden{visibility:hidden!important}.pqbc-overflow-hidden{overflow:hidden}.pqbc-cursor-pointer{cursor:pointer}.pqbc-filter-invert-100{filter:invert()}.pqbc-filter-grayscale-100{filter:grayscale()}.pqbc-isolation-isolate{isolation:isolate}.pqbc-direction-rtl{direction:rtl}.pqbc-line-height-1{line-height:1}.pqbc-text-overflow-ellipsis{text-overflow:ellipsis;white-space:nowrap;word-break:break-all;overflow:hidden}.pqbc-line-clamp-2,.pqbc-line-clamp-3,.pqbc-line-clamp-4,.pqbc-line-clamp-5{text-overflow:ellipsis;white-space:normal;-webkit-box-orient:vertical;display:-webkit-box;display:-moz-box;overflow:hidden}.pqbc-line-clamp-2{line-clamp:2;-webkit-line-clamp:2}.pqbc-line-clamp-3{line-clamp:3;-webkit-line-clamp:3}.pqbc-line-clamp-4{line-clamp:4;-webkit-line-clamp:4}.pqbc-line-clamp-5{line-clamp:5;-webkit-line-clamp:5}.pqb-theme-dark,.pqbm-theme-dark,.pqb-theme-dark *,.pqbm-theme-dark *{color-scheme:dark}[dir=rtl] *,.pqbc-with-speech-synthesis-rtl{direction:rtl}.pqbc-empty{width:100%}.pqbc-empty .pqbc-empty-description{line-height:1}.pqbc-development{flex-direction:column;justify-content:center;align-items:center;gap:10px;width:100%;height:100%;min-height:300px;display:flex}.pqbc-development-icon,.pqbc-development-img{width:50px;height:50px}.pqbc-development-label{--color-neutral:#868788;color:var(--pqbc-color-neutral-6,var(--pqb-color-neutral-6,var(--pqbm-color-neutral-6,--color-neutral)));font-size:20px}.pqbc-space-vertical{width:100%}.pqbc-space-rtl{direction:rtl}.pqbc-icons-file{position:relative}.pqbc-icons-file-svg{width:30px;height:30px}.pqbc-icons-file-svg-bg{--primary:26, 94, 255;fill:rgb(var(--pqbc-primary-6,var(--pqb-primary-6,var(--pqbm-primary-6,--primary))))}.pqbc-icons-file-svg-tr{fill:#fff;fill-opacity:.7}.pqbc-icons-file-svg-text{fill:#fff;text-align:center;font-size:66px;font-weight:bolder}.pqbc-flex{box-sizing:border-box;margin:0;padding:0;display:flex}.pqbc-flex-inline{display:inline-flex}.pqbc-flex:empty{display:none}.pqbc-flex-rtl{direction:rtl}.pqbc-progress{pointer-events:none}.pqbc-progress-bar{--primary:26, 94, 255;background-color:rgb(var(--pqbc-primary-6,var(--pqb-primary-6,var(--pqbm-primary-6,--primary))));z-index:870227;width:100%;height:2px;position:fixed;inset-block-start:0;inset-inline-start:0}.pqbc-timer-rtl{direction:rtl}
1
+ :root{--pi:3.14159}@keyframes pqbc-keyframes-vibrate{0%{transform:translate(0)}20%{transform:translate(-2px,2px)}40%{transform:translate(-2px,-2px)}60%{transform:translate(2px,2px)}80%{transform:translate(2px,-2px)}to{transform:translate(0)}}@keyframes pqbc-keyframes-rotate-360deg{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes pqbc-keyframes-blink{0%{opacity:1}50%{opacity:0}to{opacity:1}}.pqbc-animation-rotate-360deg{animation:1s cubic-bezier(0,0,1,1) infinite pqbc-keyframes-rotate-360deg}.pqbc-animation-vibrate{animation:.3s linear infinite both pqbc-keyframes-vibrate}.pqbc-animation-blink-appear,.pqbc-animation-blink-appear-active,.pqbc-animation-blink-appear-done,.pqbc-animation-blink-enter,.pqbc-animation-blink-enter-active,.pqbc-animation-blink-enter-done,.pqbc-animation-blink-exit,.pqbc-animation-blink-exit-active,.pqbc-animation-blink-exit-done{transition:opacity .3s linear}.pqbc-animation-blink-appear,.pqbc-animation-blink-enter{opacity:0}.pqbc-animation-blink-appear-active,.pqbc-animation-blink-enter-active{opacity:1}.pqbc-animation-blink-appear-done,.pqbc-animation-blink-enter-done{animation:.5s linear pqbc-keyframes-blink}.pqbc-display-none{display:none!important}.pqbc-visibility-hidden{visibility:hidden!important}.pqbc-overflow-hidden{overflow:hidden}.pqbc-cursor-pointer{cursor:pointer}.pqbc-filter-invert-100{filter:invert()}.pqbc-filter-grayscale-100{filter:grayscale()}.pqbc-isolation-isolate{isolation:isolate}.pqbc-direction-rtl{direction:rtl}.pqbc-line-height-1{line-height:1}.pqbc-text-overflow-ellipsis{text-overflow:ellipsis;white-space:nowrap;word-break:break-all;overflow:hidden}.pqbc-line-clamp-2,.pqbc-line-clamp-3,.pqbc-line-clamp-4,.pqbc-line-clamp-5{text-overflow:ellipsis;white-space:normal;-webkit-box-orient:vertical;display:-webkit-box;display:-moz-box;overflow:hidden}.pqbc-line-clamp-2{line-clamp:2;-webkit-line-clamp:2}.pqbc-line-clamp-3{line-clamp:3;-webkit-line-clamp:3}.pqbc-line-clamp-4{line-clamp:4;-webkit-line-clamp:4}.pqbc-line-clamp-5{line-clamp:5;-webkit-line-clamp:5}.pqb-theme-dark,.pqbm-theme-dark,.pqb-theme-dark *,.pqbm-theme-dark *{color-scheme:dark}[dir=rtl] *,.pqbc-with-speech-synthesis-rtl{direction:rtl}.pqbc-empty{width:100%}.pqbc-empty .pqbc-empty-description{line-height:1}.pqbc-development{flex-direction:column;justify-content:center;align-items:center;gap:10px;width:100%;height:100%;min-height:300px;display:flex}.pqbc-development-icon,.pqbc-development-img{width:50px;height:50px}.pqbc-development-label{--color-neutral:#868788;color:var(--pqbc-color-neutral-6,var(--pqb-color-neutral-6,var(--pqbm-color-neutral-6,--color-neutral)));font-size:20px}.pqbc-space-vertical{width:100%}.pqbc-space-rtl{direction:rtl}.pqbc-icons-file{position:relative}.pqbc-icons-file-svg{width:30px;height:30px}.pqbc-icons-file-svg-bg{--primary:26, 94, 255;fill:rgb(var(--pqbc-primary-6,var(--pqb-primary-6,var(--pqbm-primary-6,--primary))))}.pqbc-icons-file-svg-tr{fill:#fff;fill-opacity:.7}.pqbc-icons-file-svg-text{fill:#fff;text-align:center;font-size:66px;font-weight:bolder}.pqbc-flex{box-sizing:border-box;margin:0;padding:0;display:flex}.pqbc-flex-inline{display:inline-flex}.pqbc-flex:empty{display:none}.pqbc-flex-rtl{direction:rtl}.pqbc-progress{pointer-events:none}.pqbc-progress-bar{--primary:26, 94, 255;background-color:rgb(var(--pqbc-primary-6,var(--pqb-primary-6,var(--pqbm-primary-6,--primary))));z-index:870227;width:100%;height:2px;position:fixed;inset-block-start:0;inset-inline-start:0}.pqbc-timer-rtl{direction:rtl}
2
2
  /*$vite$:1*/
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  import e from "react";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
4
  var n = e.forwardRef((n, r) => /* @__PURE__ */ t(e.useMemo(() => e.lazy(() => new Promise(() => {})), []), {}));
package/test.js CHANGED
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  //#region components/common/test.js
3
3
  console.log("我是潘启宝");
4
4
  //#endregion
package/timer/index.js CHANGED
@@ -1,37 +1,39 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  import { isFunction as e } from "../utils/is.js";
3
- import t from "../utils/className.js";
4
- import { forwardRef as n, useEffect as r, useImperativeHandle as i, useRef as a, useState as o } from "react";
5
- import s from "dayjs";
6
- import { UI_COMMON_PREFIX as c } from "@unicom-cloud/utils/constant/ui";
7
- import { jsx as l } from "react/jsx-runtime";
3
+ import { DAYJS_DEFAULT_FORMAT_WITH_TIME as t } from "../utils/constant.js";
4
+ import n from "../utils/className.js";
5
+ import "../utils/index.js";
6
+ import { forwardRef as r, useEffect as i, useImperativeHandle as a, useRef as o, useState as s } from "react";
7
+ import c from "dayjs";
8
+ import { UI_COMMON_PREFIX as l } from "@unicom-cloud/utils/constant/ui";
9
+ import { jsx as u } from "react/jsx-runtime";
8
10
  //#region components/common/timer/index.tsx
9
- function u(n, u) {
10
- let { style: d, className: f, format: p = "YYYY-MM-DD HH:mm:ss dddd", callback: m, ...h } = n, g = `${c}-timer`, [_, v] = o({ time: y() });
11
- function y() {
12
- return s().format(p);
11
+ function d(r, d) {
12
+ let { style: f, className: p, format: m = `${t} dddd`, callback: h, ...g } = r, _ = `${l}-timer`, [v, y] = s({ time: b() });
13
+ function b() {
14
+ return c().format(m);
13
15
  }
14
- r(() => {
16
+ i(() => {
15
17
  let t = n();
16
- function n(r = y()) {
17
- return e(m) && m(r), window.requestAnimationFrame(() => {
18
- v({ time: r }), t = n();
18
+ function n(r = b()) {
19
+ return e(h) && h(r), window.requestAnimationFrame(() => {
20
+ y({ time: r }), t = n();
19
21
  });
20
22
  }
21
23
  return () => {
22
24
  window.cancelAnimationFrame(t);
23
25
  };
24
26
  }, []);
25
- let b = a(null);
26
- return i(u, () => ({ getRootElement() {
27
- return b.current;
28
- } })), /* @__PURE__ */ l("div", {
29
- ref: b,
30
- className: t(g, f),
31
- children: _.time
27
+ let x = o(null);
28
+ return a(d, () => ({ getRootElement() {
29
+ return x.current;
30
+ } })), /* @__PURE__ */ u("div", {
31
+ ref: x,
32
+ className: n(_, p),
33
+ children: v.time
32
34
  });
33
35
  }
34
- var d = n(u);
36
+ var f = r(d);
35
37
  //#endregion
36
- export { d as default };
38
+ export { f as default };
37
39
  /* 独立思考,明辨是非 */
@@ -4,7 +4,7 @@ import { CSSProperties } from 'react';
4
4
  */
5
5
  export interface TimerProps {
6
6
  style?: CSSProperties;
7
- className?: string | string[];
7
+ className?: string;
8
8
  format?: string;
9
9
  callback?: (time: string) => unknown;
10
10
  }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { TransitionProps } from './interface';
3
+ /**
4
+ * `Transition` 组件处理组件进入和退出 DOM 时的动画生命周期。
5
+ * 该组件可以管理不同阶段的过渡:"appear"、"enter" 和 "exit",
6
+ * 每个阶段都有一个活动状态和一个完成状态。这些阶段可以根据组件的可见性(由 `in` 属性控制)触发和自定义。
7
+ */
8
+ declare function Component(baseProps: TransitionProps): React.ReactNode;
9
+ declare const Transition: React.MemoExoticComponent<typeof Component>;
10
+ export { Transition };
11
+ export default Transition;
@@ -0,0 +1,102 @@
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
+ import { isFunction as e, isNull as t, isUndefined as n } from "../utils/is.js";
3
+ import r from "../hooks/use-latest/index.js";
4
+ import i from "../hooks/use-create/index.js";
5
+ import a from "../hooks/use-update-effect/index.js";
6
+ import { forceReflow as o } from "../utils/dom.js";
7
+ import ee from "../utils/findRootElement.js";
8
+ import s from "../hooks/use-update-layout-effect/index.js";
9
+ import { defaults as te } from "../utils/lodash.js";
10
+ import c from "../hooks/use-is-first-render/index.js";
11
+ import "../hooks/index.js";
12
+ import { TRANSITION_ADD_END_LISTENER_KEY as l, TRANSITION_ALWAYS_MOUNTED_KEY as u, TRANSITION_DEFAULT_PROPS as d, TRANSITION_DURATION_KEY as ne, TRANSITION_EVENT_MAP as f, TRANSITION_EVENT_NAME_KEY as p, TRANSITION_MOUNT_ON_ENTER_KEY as re, TRANSITION_NEXT_PHASE_KEY as ie, TRANSITION_PHASE_APPEAR as m, TRANSITION_PHASE_APPEAR_DONE as h, TRANSITION_PHASE_ENTER as g, TRANSITION_PHASE_ENTER_DONE as _, TRANSITION_PHASE_EXIT as v, TRANSITION_PHASE_EXIT_DONE as y, TRANSITION_UNMOUNT_ON_EXIT_KEY as b } from "./constants.js";
13
+ import { getDurations as ae, isActivePhaseHandler as oe, isAppearPhaseHandler as se, isEnterPhaseHandler as ce, isExitDonePhaseHandler as le, isExitPhaseHandler as x } from "./utils.js";
14
+ import S, { useDeferredValue as ue, useEffect as C, useLayoutEffect as w, useRef as T, useState as E, useTransition as D } from "react";
15
+ //#region components/common/transition/Transition.tsx
16
+ var { setTimeout: O, clearTimeout: k, requestAnimationFrame: A, cancelAnimationFrame: j } = window, M = { ...d };
17
+ function N(d) {
18
+ let S = te({}, d, M), N = "hasShown", P = "refElement", { children: F, in: I, [m]: L, [g]: R, [v]: z, [ne]: B = 500, [u]: de, [l]: fe, [re]: V, [b]: H, [P]: pe } = S;
19
+ i(() => {}), c();
20
+ let U = T({ [N]: I }), W = U.current[N], G = de;
21
+ "unmountOnExit" in S && !n(H) && (G = !H);
22
+ let K = "mountOnEnter" in S && !n(V);
23
+ K && (W || (G = !V));
24
+ let [me, he] = E(() => X(ve())), { phase: q, destroy: J } = me, Y = ue(J, J), [ge, _e] = D();
25
+ r(q);
26
+ function ve() {
27
+ let e = y;
28
+ return I && (e = L ? m : h), e;
29
+ }
30
+ function X(e) {
31
+ return {
32
+ phase: e,
33
+ destroy: ye(e)
34
+ };
35
+ }
36
+ function Z() {
37
+ let { [P]: e } = S;
38
+ return ee(e);
39
+ }
40
+ function ye(e) {
41
+ return G ? void 0 : le(e);
42
+ }
43
+ function Q(t) {
44
+ if (t) {
45
+ {
46
+ let n = Z(), { onBeforePhaseChange: r } = S;
47
+ e(r) && r(t, n), o(n);
48
+ }
49
+ he((e) => ({
50
+ ...e,
51
+ ...X(t)
52
+ }));
53
+ }
54
+ }
55
+ w(() => {
56
+ if (!(K && !V && !W)) {
57
+ let t = f[q]?.[p], { [t]: n } = S;
58
+ e(n) && n(Z());
59
+ }
60
+ return () => {};
61
+ }, [q]), a(() => {
62
+ let { onAfterPhaseChange: t } = S;
63
+ return e(t) && t(q, Z()), () => {};
64
+ }, [q]), s(() => {
65
+ let e, t = x(q);
66
+ return I ? (U.current[N] = !0, t && (e = R ? g : _)) : t || (e = z ? v : y), Q(e || q), () => {};
67
+ }, [I]), C(() => {
68
+ let { [l]: n } = S, r = null, i = null, a = f[q]?.[ie];
69
+ if (a && q !== a) if (oe(q)) if (e(n)) n(q, (e) => {
70
+ Q(e || a);
71
+ }, Z());
72
+ else {
73
+ let e = ae(B), t = e[g];
74
+ t = se(q) ? e[m] : ce(q) ? e[g] : x(q) ? e[v] : e[g], r = O((e) => {
75
+ Q(e || a);
76
+ }, t, a);
77
+ }
78
+ else i = A(() => {
79
+ Q(a);
80
+ });
81
+ return () => {
82
+ t(r) || k(r), t(i) || j(i);
83
+ };
84
+ }, [q]), s(() => () => {}, []), w(() => () => {}, []), a(() => () => {}, []), C(() => () => {}, []);
85
+ {
86
+ let e = !0;
87
+ if (n(J) || (z ? I ? J && (e = !1) : Y && (e = !1) : I || Y && (e = !1)), !e) return null;
88
+ }
89
+ let $ = F;
90
+ if (e($)) {
91
+ let e = Object.keys(f).reduce((e, t, n, r) => ({
92
+ ...e,
93
+ [t]: q === t
94
+ }), {});
95
+ $ = $(e, q);
96
+ }
97
+ return $;
98
+ }
99
+ var P = S.memo(N);
100
+ //#endregion
101
+ export { P as Transition, P as default };
102
+ /* 独立思考,明辨是非 */
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { TransitionCSS_Props } from './interface';
3
+ /**
4
+ * `TransitionCSS` 组件根据过渡生命周期的阶段应用 CSS 过渡效果。
5
+ * 它自动管理每个过渡阶段的类名(例如,"appear"、"enter"、"exit")
6
+ * 并将它们应用到 `children` 元素上。
7
+ */
8
+ declare function Component(props: TransitionCSS_Props): import("react/jsx-runtime").JSX.Element;
9
+ declare const TransitionCSS: React.MemoExoticComponent<typeof Component>;
10
+ export { TransitionCSS };
11
+ export default TransitionCSS;
@@ -0,0 +1,42 @@
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
+ import { isPlainObject as e, isString as t, isStringAndExist as n } from "../utils/is.js";
3
+ import r from "../utils/className.js";
4
+ import { TRANSITION_CSS_CLASS_NAMES_SUFFIX as i, TRANSITION_PHASE_APPEAR as a } from "./constants.js";
5
+ import { fallbackAppearToEnter as o, isAppearPhaseHandler as s } from "./utils.js";
6
+ import { Transition as c } from "./Transition.js";
7
+ import l, { cloneElement as u, isValidElement as d } from "react";
8
+ import { jsx as f } from "react/jsx-runtime";
9
+ //#region components/common/transition/TransitionCSS.tsx
10
+ function p(c) {
11
+ let { children: l, classNames: f = "", phase: p, [a]: m } = c;
12
+ if (!d(l)) return null;
13
+ if (!f) return l;
14
+ let h = "";
15
+ if (t(f)) {
16
+ let e = i[p];
17
+ n(e) && (h = `${f}-${e}`);
18
+ } else if (e(f)) {
19
+ let e = { ...f };
20
+ m && s(p) && Object.assign(e, o(e)), h = e[p] ?? "";
21
+ }
22
+ if (!n(h)) return l;
23
+ let { className: g } = l.props;
24
+ return u(l, { className: r(g, h) });
25
+ }
26
+ function m(e) {
27
+ let { children: t, classNames: n = "", ...r } = e;
28
+ return /* @__PURE__ */ f(c, {
29
+ ...r,
30
+ children: (e, i) => /* @__PURE__ */ f(p, {
31
+ ...r,
32
+ classNames: n,
33
+ phase: i,
34
+ children: t
35
+ })
36
+ });
37
+ }
38
+ var h = l.memo(m);
39
+ h.displayName = "TransitionCSS";
40
+ //#endregion
41
+ export { h as TransitionCSS, h as default };
42
+ /* 独立思考,明辨是非 */
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { TransitionGroupProps } from './interface';
3
+ /**
4
+ * TransitionGroup 组件用于管理一组 Transition 子元素
5
+ * 并在元素进入和退出 DOM 时自动应用过渡动画。
6
+ * 该组件可用于为多个元素设置动画,控制它们在容器中的显示和移除。
7
+ */
8
+ declare function Component(baseProps: TransitionGroupProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>[];
9
+ declare const TransitionGroup: React.MemoExoticComponent<typeof Component>;
10
+ export { TransitionGroup };
11
+ export default TransitionGroup;