@unicom-cloud/ui-common 0.1.18 → 0.1.20

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 (308) hide show
  1. package/.virtual/_rolldown/runtime.js +1 -1
  2. package/.vite/manifest.json +127 -191
  3. package/development/index.js +1 -1
  4. package/empty/index.js +1 -1
  5. package/flex/index.js +1 -1
  6. package/flex/utils.js +1 -1
  7. package/higher-order/index.js +1 -1
  8. package/higher-order/with-speech-synthesis/index.js +1 -1
  9. package/hooks/create-deep-compare-effect/index.js +8 -7
  10. package/hooks/create-update-effect/index.d.ts +1 -1
  11. package/hooks/create-update-effect/index.js +9 -10
  12. package/hooks/create-use-storage-state/index.d.ts +2 -1
  13. package/hooks/create-use-storage-state/index.js +44 -35
  14. package/hooks/index.d.ts +1 -0
  15. package/hooks/index.js +82 -81
  16. package/hooks/use-async-effect/index.js +1 -1
  17. package/hooks/use-boolean/index.js +1 -1
  18. package/hooks/use-click-away/index.d.ts +2 -2
  19. package/hooks/use-click-away/index.js +7 -3
  20. package/hooks/use-computed-state/index.js +1 -1
  21. package/hooks/use-controllable-value/index.js +1 -1
  22. package/hooks/use-cookie-state/index.d.ts +34 -1
  23. package/hooks/use-cookie-state/index.js +16 -16
  24. package/hooks/use-count-down/index.js +1 -1
  25. package/hooks/use-counter/index.js +1 -1
  26. package/hooks/use-create/index.d.ts +4 -1
  27. package/hooks/use-create/index.js +1 -1
  28. package/hooks/use-creation/index.js +1 -1
  29. package/hooks/use-debounce/index.js +1 -1
  30. package/hooks/use-debounce-effect/index.js +1 -1
  31. package/hooks/use-debounce-fn/index.js +1 -1
  32. package/hooks/use-deep-compare-effect/index.js +1 -1
  33. package/hooks/use-deep-compare-layout-effect/index.js +1 -1
  34. package/hooks/use-document-visibility/index.js +1 -1
  35. package/hooks/use-drag/index.js +1 -1
  36. package/hooks/use-drop/index.js +1 -1
  37. package/hooks/use-effect-event/index.js +1 -1
  38. package/hooks/use-event/index.js +1 -1
  39. package/hooks/use-event-emitter/demo/demo1.d.ts +10 -0
  40. package/hooks/use-event-emitter/index.d.ts +8 -0
  41. package/hooks/use-event-emitter/index.js +26 -0
  42. package/hooks/use-event-listener/index.d.ts +3 -2
  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 +1 -1
  57. package/hooks/use-intersection-observer/index.js +1 -1
  58. package/hooks/use-intersection-observers/index.js +25 -25
  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 +1 -1
  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 +24 -24
  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 +17 -16
  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 +13 -12
  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 +1 -1
  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 +1 -1
  108. package/hooks/use-request/src/useRequest.d.ts +6 -2
  109. package/hooks/use-request/src/useRequest.js +1 -1
  110. package/hooks/use-request/src/useRequestImplement.js +1 -1
  111. package/hooks/use-request/src/utils/cache.js +1 -1
  112. package/hooks/use-request/src/utils/cachePromise.js +1 -1
  113. package/hooks/use-request/src/utils/cacheSubscribe.js +1 -1
  114. package/hooks/use-request/src/utils/isDocumentVisible.js +1 -1
  115. package/hooks/use-request/src/utils/isOnline.js +1 -1
  116. package/hooks/use-request/src/utils/limit.js +1 -1
  117. package/hooks/use-request/src/utils/subscribeFocus.js +1 -1
  118. package/hooks/use-request/src/utils/subscribeReVisible.js +1 -1
  119. package/hooks/use-reset-state/index.js +1 -1
  120. package/hooks/use-resize-observer/index.js +1 -1
  121. package/hooks/use-resize-observers/index.js +25 -25
  122. package/hooks/use-responsive/index.js +1 -1
  123. package/hooks/use-safe-state/index.js +1 -1
  124. package/hooks/use-scroll/index.js +1 -1
  125. package/hooks/use-selections/index.js +1 -1
  126. package/hooks/use-session-storage-state/index.js +1 -1
  127. package/hooks/use-set/index.js +1 -1
  128. package/hooks/use-set-state/index.js +1 -1
  129. package/hooks/use-size/index.js +1 -1
  130. package/hooks/use-state-callback/index.js +1 -1
  131. package/hooks/use-state-with-promise/index.d.ts +11 -1
  132. package/hooks/use-state-with-promise/index.js +21 -20
  133. package/hooks/use-sync-state/index.js +1 -1
  134. package/hooks/use-text-selection/index.js +1 -1
  135. package/hooks/use-theme/index.js +1 -1
  136. package/hooks/use-throttle/index.js +1 -1
  137. package/hooks/use-throttle-effect/index.js +1 -1
  138. package/hooks/use-throttle-fn/index.js +1 -1
  139. package/hooks/use-timeout/index.js +1 -1
  140. package/hooks/use-title/index.js +1 -1
  141. package/hooks/use-toggle/index.js +12 -11
  142. package/hooks/use-tracked-effect/index.js +1 -1
  143. package/hooks/use-unmount/index.js +1 -1
  144. package/hooks/use-unmounted-ref/index.js +1 -1
  145. package/hooks/use-update/index.d.ts +3 -1
  146. package/hooks/use-update/index.js +5 -5
  147. package/hooks/use-update-effect/index.js +1 -1
  148. package/hooks/use-update-layout-effect/index.js +1 -1
  149. package/hooks/use-url-state/index.js +1 -1
  150. package/hooks/use-virtual-list/index.js +1 -1
  151. package/hooks/use-watch/index.js +1 -1
  152. package/hooks/use-web-socket/index.js +1 -1
  153. package/hooks/use-why-did-you-update/index.js +1 -1
  154. package/hooks/use-window-size/index.d.ts +1 -1
  155. package/hooks/use-window-size/index.js +1 -1
  156. package/hooks/utils/createEffectWithTarget.js +1 -1
  157. package/hooks/utils/depsAreSame.js +1 -1
  158. package/hooks/utils/depsEqual.js +1 -1
  159. package/hooks/utils/domTarget.js +1 -1
  160. package/hooks/utils/getDocumentOrShadow.js +1 -1
  161. package/hooks/utils/index.js +1 -1
  162. package/hooks/utils/isAppleDevice.js +1 -1
  163. package/hooks/utils/isBrowser.js +1 -1
  164. package/hooks/utils/isDev.js +1 -1
  165. package/hooks/utils/rect.js +1 -1
  166. package/hooks/utils/useDeepCompareWithTarget.js +1 -1
  167. package/hooks/utils/useEffectWithTarget.js +1 -1
  168. package/hooks/utils/useIsomorphicLayoutEffectWithTarget.js +1 -1
  169. package/hooks/utils/useLayoutEffectWithTarget.js +1 -1
  170. package/icons/file/index.js +1 -1
  171. package/index.d.ts +1 -1
  172. package/index.js +574 -537
  173. package/package.json +1 -1
  174. package/progress/index.js +43 -43
  175. package/resize-observer/Collection.d.ts +2 -2
  176. package/resize-observer/Collection.js +1 -1
  177. package/resize-observer/SingleObserver.js +1 -1
  178. package/resize-observer/index.js +2 -2
  179. package/resize-observer/observerUtil.js +1 -1
  180. package/space/index.js +1 -1
  181. package/style/animation.less +16 -4
  182. package/style.css +1 -1
  183. package/suspense-fallback-test/index.js +1 -1
  184. package/test.d.ts +0 -0
  185. package/test.js +5 -0
  186. package/timer/index.js +1 -1
  187. package/transition/Transition.d.ts +11 -0
  188. package/transition/Transition.js +92 -0
  189. package/transition/TransitionCSS.d.ts +11 -0
  190. package/transition/TransitionCSS.js +33 -0
  191. package/transition/TransitionGroup.d.ts +11 -0
  192. package/transition/TransitionGroup.js +62 -0
  193. package/transition/TransitionStyle.d.ts +11 -0
  194. package/transition/TransitionStyle.js +46 -0
  195. package/transition/constants.d.ts +43 -0
  196. package/transition/constants.js +46 -0
  197. package/transition/index.d.ts +12 -0
  198. package/transition/index.js +12 -0
  199. package/transition/interface.d.ts +192 -0
  200. package/transition/utils.d.ts +19 -0
  201. package/transition/utils.js +97 -0
  202. package/utils/callOrReturn.js +1 -1
  203. package/utils/callbackOriginRef.js +1 -1
  204. package/utils/caseName.js +1 -1
  205. package/utils/className.js +1 -1
  206. package/utils/constant.js +1 -1
  207. package/utils/copy.js +1 -1
  208. package/utils/date.js +1 -1
  209. package/utils/dayjs.d.ts +1 -1
  210. package/utils/dayjs.js +19 -13
  211. package/utils/dom.js +15 -15
  212. package/utils/emitter.js +1 -1
  213. package/utils/fileRead.js +1 -1
  214. package/utils/fileToDataURL.js +1 -1
  215. package/utils/fillNBSP.js +1 -1
  216. package/utils/findRootElement.d.ts +6 -4
  217. package/utils/findRootElement.js +2 -2
  218. package/utils/findScrollParent.js +1 -1
  219. package/utils/getHighlightText.js +1 -1
  220. package/utils/getHotkeyHandler.js +1 -1
  221. package/utils/getScrollBarHeight.d.ts +3 -0
  222. package/utils/getScrollBarHeight.js +7 -0
  223. package/utils/getScrollBarSize.d.ts +3 -0
  224. package/utils/getScrollBarSize.js +10 -0
  225. package/utils/getScrollBarWidth.d.ts +3 -0
  226. package/utils/getScrollBarWidth.js +7 -0
  227. package/utils/getStringLength.js +1 -1
  228. package/utils/include.js +1 -1
  229. package/utils/index.d.ts +3 -0
  230. package/utils/index.js +277 -269
  231. package/utils/intersectionObserver.js +1 -1
  232. package/utils/is.d.ts +8 -7
  233. package/utils/is.js +23 -20
  234. package/utils/keyboardCode.js +1 -1
  235. package/utils/lodash.js +1 -1
  236. package/utils/math.js +1 -1
  237. package/utils/mergeProps.js +1 -1
  238. package/utils/mergedToString.js +1 -1
  239. package/utils/mutationObserver.js +1 -1
  240. package/utils/omit.d.ts +5 -1
  241. package/utils/omit.js +4 -8
  242. package/utils/pad.js +1 -1
  243. package/utils/pick.d.ts +4 -1
  244. package/utils/pick.js +5 -10
  245. package/utils/pinyin.js +1 -1
  246. package/utils/react19Adapter.js +1 -1
  247. package/utils/ref.js +2 -2
  248. package/utils/resizeObserver.js +21 -21
  249. package/utils/saveAs.js +1 -1
  250. package/utils/screenfull.js +1 -1
  251. package/utils/scrollIntoViewIfNeeded.js +1 -1
  252. package/utils/setCreateRoot.js +1 -1
  253. package/utils/setDarkTheme.js +1 -1
  254. package/utils/setDir.js +1 -1
  255. package/utils/setPrimaryColor.js +1 -1
  256. package/utils/setTheme.js +1 -1
  257. package/utils/string.js +1 -1
  258. package/utils/style.js +1 -1
  259. package/utils/throttleByRaf.js +1 -1
  260. package/utils/throttleByRaf2.js +1 -1
  261. package/utils/tinycolor.js +1 -1
  262. package/utils/toArray.js +1 -1
  263. package/utils/tree.js +1 -1
  264. package/utils/tween.js +1 -1
  265. package/utils/uuid.js +1 -1
  266. package/utils/validate.js +1 -1
  267. package/utils/warning.js +1 -1
  268. package/version/index.js +11 -14
  269. package/motion/CSSMotion.d.ts +0 -77
  270. package/motion/CSSMotion.js +0 -76
  271. package/motion/CSSMotionList.d.ts +0 -34
  272. package/motion/CSSMotionList.js +0 -82
  273. package/motion/context.d.ts +0 -9
  274. package/motion/context.js +0 -14
  275. package/motion/hooks/useDomMotionEvents.d.ts +0 -3
  276. package/motion/hooks/useDomMotionEvents.js +0 -19
  277. package/motion/hooks/useNextFrame.d.ts +0 -7
  278. package/motion/hooks/useNextFrame.js +0 -22
  279. package/motion/hooks/useStatus.d.ts +0 -5
  280. package/motion/hooks/useStatus.js +0 -92
  281. package/motion/hooks/useStepQueue.d.ts +0 -8
  282. package/motion/hooks/useStepQueue.js +0 -39
  283. package/motion/index.d.ts +0 -9
  284. package/motion/index.js +0 -9
  285. package/motion/interface.d.ts +0 -22
  286. package/motion/interface.js +0 -6
  287. package/motion/util/diff.d.ts +0 -20
  288. package/motion/util/diff.js +0 -50
  289. package/motion/util/motion.d.ts +0 -10
  290. package/motion/util/motion.js +0 -37
  291. package/transition-group/CSSTransition.d.ts +0 -97
  292. package/transition-group/CSSTransition.js +0 -73
  293. package/transition-group/ChildMapping.d.ts +0 -27
  294. package/transition-group/ChildMapping.js +0 -61
  295. package/transition-group/PqbCSSTransition.d.ts +0 -4
  296. package/transition-group/PqbCSSTransition.js +0 -34
  297. package/transition-group/ReplaceTransition.d.ts +0 -23
  298. package/transition-group/ReplaceTransition.js +0 -38
  299. package/transition-group/SwitchTransition.d.ts +0 -88
  300. package/transition-group/SwitchTransition.js +0 -84
  301. package/transition-group/Transition.d.ts +0 -130
  302. package/transition-group/Transition.js +0 -139
  303. package/transition-group/TransitionGroup.d.ts +0 -31
  304. package/transition-group/TransitionGroup.js +0 -54
  305. package/transition-group/TransitionGroupContext.d.ts +0 -3
  306. package/transition-group/TransitionGroupContext.js +0 -7
  307. package/transition-group/index.d.ts +0 -9
  308. package/transition-group/index.js +0 -11
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@unicom-cloud/ui-common","version":"0.1.18","dependencies":{"@unicom-cloud/utils":"^0.1.0","@unicom-cloud/icons":"^0.1.0"},"peerDependencies":{"dayjs":"^1.11.19","lodash":"^4.17.23","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.20","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-03-24 15:26:24 星期二 */
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-14 16:51:31 星期二 */
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-03-24 15:26:24 星期二 */
1
+ /* 潘启宝 2026-04-14 16:51:31 星期二 */
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-03-24 15:26:24 星期二 */
1
+ /* 潘启宝 2026-04-14 16:51:31 星期二 */
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-03-24 15:26:24 星期二 */
1
+ /* 潘启宝 2026-04-14 16:51:31 星期二 */
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";
@@ -17,7 +17,7 @@ function o(n, i) {
17
17
  });
18
18
  }
19
19
  var s = i.forwardRef(o);
20
- s.Collection = n;
20
+ s.displayName = "ResizeObserver", s.Collection = n;
21
21
  //#endregion
22
22
  export { s as default };
23
23
  /* 独立思考,明辨是非 */
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
1
+ /* 潘启宝 2026-04-14 16:51:31 星期二 */
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,4 +1,4 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
1
+ /* 潘启宝 2026-04-14 16:51:31 星期二 */
2
2
  import e from "../hooks/use-merge-props/index.js";
3
3
  import t from "../utils/className.js";
4
4
  import n from "../utils/toArray.js";
@@ -7,15 +7,27 @@
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,
10
13
  .@{ui-common-prefix}-animation-blink-enter,
11
- .@{ui-common-prefix}-animation-blink-appear {
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
+ }
21
+ .@{ui-common-prefix}-animation-blink-appear,
22
+ .@{ui-common-prefix}-animation-blink-enter {
12
23
  opacity: 0;
13
24
  }
14
- .@{ui-common-prefix}-animation-blink-enter-active,
15
- .@{ui-common-prefix}-animation-blink-appear-active {
25
+ .@{ui-common-prefix}-animation-blink-appear-active,
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-enter,.pqbc-animation-blink-appear{opacity:0}.pqbc-animation-blink-enter-active,.pqbc-animation-blink-appear-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-03-24 15:26:24 星期二 */
1
+ /* 潘启宝 2026-04-14 16:51:31 星期二 */
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.d.ts ADDED
File without changes
package/test.js ADDED
@@ -0,0 +1,5 @@
1
+ /* 潘启宝 2026-04-14 16:51:31 星期二 */
2
+ //#region components/common/test.js
3
+ console.log("我是潘启宝");
4
+ //#endregion
5
+ /* 独立思考,明辨是非 */
package/timer/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
1
+ /* 潘启宝 2026-04-14 16:51:31 星期二 */
2
2
  import { isFunction as e } from "../utils/is.js";
3
3
  import t from "../utils/className.js";
4
4
  import { forwardRef as n, useEffect as r, useImperativeHandle as i, useRef as a, useState as o } from "react";
@@ -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,92 @@
1
+ /* 潘启宝 2026-04-14 16:51:31 星期二 */
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 ee } from "../utils/dom.js";
7
+ import o from "../utils/findRootElement.js";
8
+ import s from "../hooks/use-update-layout-effect/index.js";
9
+ import { defaults as c } from "../utils/lodash.js";
10
+ import l from "../hooks/use-is-first-render/index.js";
11
+ import "../hooks/index.js";
12
+ import { TRANSITION_DEFAULT_PROPS as u, TRANSITION_EVENT_MAP as d, TRANSITION_EVENT_NAME_KEY as f, TRANSITION_MOUNT_ON_ENTER_KEY as p, TRANSITION_NEXT_PHASE_KEY as te, TRANSITION_UNMOUNT_ON_EXIT_KEY as ne, TransitionPhase as m, TransitionPhaseEvent as h } from "./constants.js";
13
+ import { getDurations as re, isActivePhaseHandler as g, isAppearPhaseHandler as _, isEnterPhaseHandler as v, isExitDonePhaseHandler as y, isExitPhaseHandler as b } from "./utils.js";
14
+ import x, { useDeferredValue as S, useEffect as C, useLayoutEffect as ie, useRef as ae, useState as oe, useTransition as se } from "react";
15
+ //#region components/common/transition/Transition.tsx
16
+ var { APPEAR: w, APPEAR_ACTIVE: T, APPEAR_DONE: E, ENTER: D, ENTER_ACTIVE: O, ENTER_DONE: k, EXIT: A, EXIT_ACTIVE: j, EXIT_DONE: M } = m, { ON_ENTER: N, ON_ENTERING: P, ON_ENTERED: F, ON_EXIT: I, ON_EXITING: L, ON_EXITED: R } = h, { setTimeout: ce, clearTimeout: z, requestAnimationFrame: B, cancelAnimationFrame: V } = window, H = u;
17
+ function U(u) {
18
+ let m = c({}, u, H), { children: h, in: x, [w]: T, [D]: O, [A]: j, duration: N = 500, alwaysMounted: P, addEndListener: F, refElement: I, [p]: L, [ne]: R } = m;
19
+ i(() => {});
20
+ let U = l(), W = ae({ hasShown: x }), G = P;
21
+ "unmountOnExit" in m && (G = !R), "mountOnEnter" in m && (U || !W.current.hasShown) && (G = !L);
22
+ let [le, ue] = oe(() => {
23
+ let e = pe();
24
+ return {
25
+ phase: e,
26
+ destroy: X(e)
27
+ };
28
+ }), { phase: K, destroy: q } = le, J = S(q), [de, fe] = se();
29
+ r(K);
30
+ function pe() {
31
+ let e = M;
32
+ return x && (e = T ? w : E), e;
33
+ }
34
+ function Y() {
35
+ return o(I);
36
+ }
37
+ function X(e) {
38
+ return G ? void 0 : y(e);
39
+ }
40
+ function Z(e) {
41
+ e && (ee(Y()), x || Q(e), ue((t) => ({
42
+ ...t,
43
+ phase: e,
44
+ destroy: X(e)
45
+ })));
46
+ }
47
+ function Q(t) {
48
+ let n = d[t]?.[f], { [n]: r } = m;
49
+ return e(r) && r(Y()), t;
50
+ }
51
+ ie(() => {
52
+ let { onPhaseChange: t } = m;
53
+ return e(t) && t(K, Y()), () => {};
54
+ }, [K]), C(() => (x && Q(K), () => {}), [K, L]), s(() => {
55
+ let e, t = b(K);
56
+ return x ? (W.current.hasShown = !0, t && (e = O ? D : k)) : t || (e = j ? A : M), Z(e || K), () => {};
57
+ }, [x]), C(() => {
58
+ let n = null, r = null, i = d[K]?.[te];
59
+ if (i && K !== i) if (g(K)) if (e(F)) F(K, (e) => {
60
+ Z(i);
61
+ });
62
+ else {
63
+ let e = re(N), t = e[D];
64
+ _(K) ? t = e[w] : v(K) ? t = e[D] : b(K) && (t = e[A]), n = ce((e) => {
65
+ Z(e || i);
66
+ }, t, i);
67
+ }
68
+ else r = B(() => {
69
+ Z(i);
70
+ });
71
+ return () => {
72
+ t(n) || z(n), t(r) || V(r);
73
+ };
74
+ }, [K]), a(() => () => {}, []), C(() => () => {}, []);
75
+ {
76
+ let e = !0;
77
+ if (n(q) || (j ? x ? q && (e = !1) : J && (e = !1) : x || J && (e = !1)), !e) return null;
78
+ }
79
+ let $ = h;
80
+ if (e($)) {
81
+ let e = Object.keys(d).reduce((e, t, n, r) => ({
82
+ ...e,
83
+ [t]: K === t
84
+ }), {});
85
+ $ = $(e, K);
86
+ }
87
+ return $;
88
+ }
89
+ var W = x.memo(U);
90
+ //#endregion
91
+ export { W as Transition, W as default };
92
+ /* 独立思考,明辨是非 */
@@ -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,33 @@
1
+ /* 潘启宝 2026-04-14 16:51:31 星期二 */
2
+ import { isObjectLike as e, isString as t } from "../utils/is.js";
3
+ import n from "../utils/className.js";
4
+ import { TRANSITION_CSS_CLASS_NAMES_SUFFIX as r, TransitionPhase as i, TransitionPhaseEvent as a } from "./constants.js";
5
+ import { Transition as o } from "./Transition.js";
6
+ import s, { cloneElement as c, isValidElement as l } from "react";
7
+ import { jsx as u } from "react/jsx-runtime";
8
+ //#region components/common/transition/TransitionCSS.tsx
9
+ var { APPEAR: d, APPEAR_ACTIVE: f, APPEAR_DONE: p, ENTER: m, ENTER_ACTIVE: h, ENTER_DONE: g, EXIT: _, EXIT_ACTIVE: v, EXIT_DONE: y } = i, { ON_ENTER: b, ON_ENTERING: x, ON_ENTERED: S, ON_EXIT: C, ON_EXITING: w, ON_EXITED: T } = a;
10
+ function E(i) {
11
+ let { children: a, classNames: o, phase: s } = i;
12
+ if (!l(a)) return null;
13
+ if (!o) return a;
14
+ let u;
15
+ if (t(o) ? u = `${o}-${r[s]}` : e(o) && (u = o[s]), !u) return a;
16
+ let { className: d } = a.props;
17
+ return c(a, { className: n(d, u) });
18
+ }
19
+ function D(e) {
20
+ let { children: t, classNames: n, ...r } = e;
21
+ return /* @__PURE__ */ u(o, {
22
+ ...r,
23
+ children: (e, r) => /* @__PURE__ */ u(E, {
24
+ classNames: n,
25
+ phase: r,
26
+ children: t
27
+ })
28
+ });
29
+ }
30
+ var O = s.memo(D);
31
+ //#endregion
32
+ export { O as TransitionCSS, O as default };
33
+ /* 独立思考,明辨是非 */
@@ -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;
@@ -0,0 +1,62 @@
1
+ /* 潘启宝 2026-04-14 16:51:31 星期二 */
2
+ import e from "../hooks/use-isomorphic-layout-effect/index.js";
3
+ import { defaults as t } from "../utils/lodash.js";
4
+ import { TRANSITION_DEFAULT_PROPS as n, TransitionPhase as r, TransitionPhaseEvent as i } from "./constants.js";
5
+ import { getDurations as a } from "./utils.js";
6
+ import o, { Children as s, cloneElement as c, isValidElement as l, useRef as u } from "react";
7
+ //#region components/common/transition/TransitionGroup.tsx
8
+ var { APPEAR: d, APPEAR_ACTIVE: f, APPEAR_DONE: p, ENTER: m, ENTER_ACTIVE: h, ENTER_DONE: g, EXIT: _, EXIT_ACTIVE: v, EXIT_DONE: y } = r, { ON_ENTER: b, ON_ENTERING: x, ON_ENTERED: S, ON_EXIT: C, ON_EXITING: w, ON_EXITED: T } = i, { setTimeout: E, clearTimeout: D, requestAnimationFrame: O, cancelAnimationFrame: k } = window, A = {
9
+ [d]: n[d],
10
+ [m]: n[m],
11
+ [_]: n[_],
12
+ duration: n.duration,
13
+ alwaysMounted: n.alwaysMounted
14
+ };
15
+ function j(n) {
16
+ let { children: r, [d]: i = !0, [m]: o = !0, [_]: f = !0, duration: p = 500, alwaysMounted: h = !1 } = t({}, n, A), g = u(!1), v = u([]), y = [], b = [], x = {}, S = [];
17
+ s.toArray(r).forEach((e, t, n) => {
18
+ l(e) && (x[e.key] = S.length, S.push(e));
19
+ });
20
+ function C(e, t) {
21
+ let { alwaysMounted: n = h, duration: r = p, [d]: a = i, [m]: s = o, [_]: l = f } = e.props ?? {}, u = c(e, {
22
+ in: !t,
23
+ alwaysMounted: n,
24
+ duration: r,
25
+ [_]: l,
26
+ [m]: s,
27
+ [d]: g.current ? s : a
28
+ });
29
+ y.push({
30
+ element: e,
31
+ removeTimeout: t
32
+ }), b.push(u);
33
+ }
34
+ function w(e) {
35
+ let { alwaysMounted: t = h, duration: n = p, [d]: r = i, [m]: s = o, [_]: c = f } = e.props ?? {};
36
+ return E(() => {
37
+ let { current: t } = v, n = t.findIndex((t, n, r) => {
38
+ let { element: i } = t ?? {};
39
+ return i.key === e.key;
40
+ });
41
+ n === -1 || t.splice(n, 1);
42
+ }, a(n).exit);
43
+ }
44
+ let T = 0;
45
+ v.current.forEach((e, t, n) => {
46
+ let { element: r, removeTimeout: a } = e ?? {}, { alwaysMounted: s = h, duration: c = p, [d]: l = i, [m]: u = o, [_]: g = f } = r.props ?? {}, v = x[r.key] ?? -1;
47
+ if (v < 0) a ? C(r, a) : g && C(r, w(r));
48
+ else {
49
+ a && D(a);
50
+ for (let e = T; e <= v; e += 1) C(S[e]);
51
+ }
52
+ T = Math.max(T, v + 1);
53
+ });
54
+ for (let e = T; e < S.length; e += 1) C(S[e]);
55
+ return e(() => {
56
+ g.current = !0;
57
+ }, []), v.current = y, b;
58
+ }
59
+ var M = o.memo(j);
60
+ //#endregion
61
+ export { M as TransitionGroup, M as default };
62
+ /* 独立思考,明辨是非 */
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { TransitionStyleProps } from './interface';
3
+ /**
4
+ * `TransitionStyle` 组件允许你在不同的过渡阶段为组件设置动画样式。
5
+ * 它自动管理每个过渡阶段的样式(例如,"appear"、"enter"、"exit")
6
+ * 并将它们应用到 `children` 元素上。
7
+ */
8
+ declare function Component(props: TransitionStyleProps): import("react/jsx-runtime").JSX.Element;
9
+ declare const TransitionStyle: React.MemoExoticComponent<typeof Component>;
10
+ export { TransitionStyle };
11
+ export default TransitionStyle;
@@ -0,0 +1,46 @@
1
+ /* 潘启宝 2026-04-14 16:51:31 星期二 */
2
+ import { TransitionPhase as e, TransitionPhaseEvent as t } from "./constants.js";
3
+ import { Transition as n } from "./Transition.js";
4
+ import r, { cloneElement as i, isValidElement as a } from "react";
5
+ import { jsx as o } from "react/jsx-runtime";
6
+ //#region components/common/transition/TransitionStyle.tsx
7
+ var { APPEAR: s, APPEAR_ACTIVE: c, APPEAR_DONE: l, ENTER: u, ENTER_ACTIVE: d, ENTER_DONE: f, EXIT: p, EXIT_ACTIVE: m, EXIT_DONE: h } = e, { ON_ENTER: g, ON_ENTERING: _, ON_ENTERED: v, ON_EXIT: y, ON_EXITING: b, ON_EXITED: x } = t;
8
+ function S(e, t) {
9
+ let n = t[e];
10
+ switch (e) {
11
+ case c: return {
12
+ ...t[s],
13
+ ...n
14
+ };
15
+ case d: return {
16
+ ...t[u],
17
+ ...n
18
+ };
19
+ case m: return {
20
+ ...t[p],
21
+ ...n
22
+ };
23
+ default: return n;
24
+ }
25
+ }
26
+ function C(e) {
27
+ let { children: t, styles: n, phase: r } = e;
28
+ if (!a(t)) return null;
29
+ let { style: o } = t.props;
30
+ return i(t, { style: Object.assign({}, o, S(r, n)) });
31
+ }
32
+ function w(e) {
33
+ let { children: t, styles: r, ...i } = e;
34
+ return /* @__PURE__ */ o(n, {
35
+ ...i,
36
+ children: (e, n) => /* @__PURE__ */ o(C, {
37
+ styles: r,
38
+ phase: n,
39
+ children: t
40
+ })
41
+ });
42
+ }
43
+ var T = r.memo(w);
44
+ //#endregion
45
+ export { T as TransitionStyle, T as default };
46
+ /* 独立思考,明辨是非 */
@@ -0,0 +1,43 @@
1
+ import type { TransitionProps } from './interface';
2
+ export declare const TRANSITION_DURATION_DEFAULT = 500;
3
+ /**
4
+ * 枚举表示过渡的不同阶段。
5
+ * 每个阶段对应过渡生命周期的特定阶段。
6
+ */
7
+ export declare enum TransitionPhase {
8
+ APPEAR = "appear",
9
+ APPEAR_ACTIVE = "appearActive",
10
+ APPEAR_DONE = "appearDone",
11
+ ENTER = "enter",
12
+ ENTER_ACTIVE = "enterActive",
13
+ ENTER_DONE = "enterDone",
14
+ EXIT = "exit",
15
+ EXIT_ACTIVE = "exitActive",
16
+ EXIT_DONE = "exitDone"
17
+ }
18
+ /**
19
+ * 枚举表示各种过渡阶段的事件回调。
20
+ */
21
+ export declare enum TransitionPhaseEvent {
22
+ ON_ENTER = "onEnter",
23
+ ON_ENTERING = "onEntering",
24
+ ON_ENTERED = "onEntered",
25
+ ON_EXIT = "onExit",
26
+ ON_EXITING = "onExiting",
27
+ ON_EXITED = "onExited"
28
+ }
29
+ export declare const TRANSITION_CSS_CLASS_NAMES_SUFFIX: {
30
+ [key in TransitionPhase]: string;
31
+ };
32
+ /**
33
+ * 默认属性
34
+ */
35
+ export declare const TRANSITION_DEFAULT_PROPS: Omit<TransitionProps, 'children'>;
36
+ export declare const TRANSITION_MOUNT_ON_ENTER_KEY = "mountOnEnter";
37
+ export declare const TRANSITION_UNMOUNT_ON_EXIT_KEY = "unmountOnExit";
38
+ export declare const TRANSITION_EVENT_NAME_KEY = "eventName";
39
+ export declare const TRANSITION_NEXT_PHASE_KEY = "nextPhase";
40
+ export declare const TRANSITION_EVENT_MAP: Record<TransitionPhase, {
41
+ [TRANSITION_EVENT_NAME_KEY]: TransitionPhaseEvent;
42
+ [TRANSITION_NEXT_PHASE_KEY]?: TransitionPhase;
43
+ }>;
@@ -0,0 +1,46 @@
1
+ /* 潘启宝 2026-04-14 16:51:31 星期二 */
2
+ import { kebabCase as e } from "../utils/lodash.js";
3
+ //#region components/common/transition/constants.ts
4
+ var t = 500, n = /* @__PURE__ */ function(e) {
5
+ return e.APPEAR = "appear", e.APPEAR_ACTIVE = "appearActive", e.APPEAR_DONE = "appearDone", e.ENTER = "enter", e.ENTER_ACTIVE = "enterActive", e.ENTER_DONE = "enterDone", e.EXIT = "exit", e.EXIT_ACTIVE = "exitActive", e.EXIT_DONE = "exitDone", e;
6
+ }({}), r = /* @__PURE__ */ function(e) {
7
+ return e.ON_ENTER = "onEnter", e.ON_ENTERING = "onEntering", e.ON_ENTERED = "onEntered", e.ON_EXIT = "onExit", e.ON_EXITING = "onExiting", e.ON_EXITED = "onExited", e;
8
+ }({}), i = Object.fromEntries(Object.entries(n).map(([t, n], r, i) => [n, e(n)])), { APPEAR: a, APPEAR_ACTIVE: o, APPEAR_DONE: s, ENTER: c, ENTER_ACTIVE: l, ENTER_DONE: u, EXIT: d, EXIT_ACTIVE: f, EXIT_DONE: p } = n, { ON_ENTER: m, ON_ENTERING: h, ON_ENTERED: g, ON_EXIT: _, ON_EXITING: v, ON_EXITED: y } = r, b = {
9
+ in: !1,
10
+ [a]: !1,
11
+ [c]: !0,
12
+ [d]: !0,
13
+ duration: 500,
14
+ alwaysMounted: !1
15
+ }, x = "mountOnEnter", S = "unmountOnExit", C = "eventName", w = "nextPhase", T = {
16
+ [a]: {
17
+ [C]: m,
18
+ [w]: o
19
+ },
20
+ [o]: {
21
+ [C]: h,
22
+ [w]: s
23
+ },
24
+ [s]: { [C]: g },
25
+ [c]: {
26
+ [C]: m,
27
+ [w]: l
28
+ },
29
+ [l]: {
30
+ [C]: h,
31
+ [w]: u
32
+ },
33
+ [u]: { [C]: g },
34
+ [d]: {
35
+ [C]: _,
36
+ [w]: f
37
+ },
38
+ [f]: {
39
+ [C]: v,
40
+ [w]: p
41
+ },
42
+ [p]: { [C]: y }
43
+ };
44
+ //#endregion
45
+ export { i as TRANSITION_CSS_CLASS_NAMES_SUFFIX, b as TRANSITION_DEFAULT_PROPS, t as TRANSITION_DURATION_DEFAULT, T as TRANSITION_EVENT_MAP, C as TRANSITION_EVENT_NAME_KEY, x as TRANSITION_MOUNT_ON_ENTER_KEY, w as TRANSITION_NEXT_PHASE_KEY, S as TRANSITION_UNMOUNT_ON_EXIT_KEY, n as TransitionPhase, r as TransitionPhaseEvent };
46
+ /* 独立思考,明辨是非 */