@unicom-cloud/ui-common 0.1.19 → 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 (273) hide show
  1. package/.virtual/_rolldown/runtime.js +1 -1
  2. package/.vite/manifest.json +88 -67
  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.js +1 -1
  13. package/hooks/index.d.ts +1 -0
  14. package/hooks/index.js +82 -81
  15. package/hooks/use-async-effect/index.js +1 -1
  16. package/hooks/use-boolean/index.js +1 -1
  17. package/hooks/use-click-away/index.d.ts +2 -2
  18. package/hooks/use-click-away/index.js +7 -3
  19. package/hooks/use-computed-state/index.js +1 -1
  20. package/hooks/use-controllable-value/index.js +1 -1
  21. package/hooks/use-cookie-state/index.d.ts +34 -1
  22. package/hooks/use-cookie-state/index.js +16 -16
  23. package/hooks/use-count-down/index.js +1 -1
  24. package/hooks/use-counter/index.js +1 -1
  25. package/hooks/use-create/index.d.ts +4 -1
  26. package/hooks/use-create/index.js +1 -1
  27. package/hooks/use-creation/index.js +1 -1
  28. package/hooks/use-debounce/index.js +1 -1
  29. package/hooks/use-debounce-effect/index.js +1 -1
  30. package/hooks/use-debounce-fn/index.js +1 -1
  31. package/hooks/use-deep-compare-effect/index.js +1 -1
  32. package/hooks/use-deep-compare-layout-effect/index.js +1 -1
  33. package/hooks/use-document-visibility/index.js +1 -1
  34. package/hooks/use-drag/index.js +1 -1
  35. package/hooks/use-drop/index.js +1 -1
  36. package/hooks/use-effect-event/index.js +1 -1
  37. package/hooks/use-event/index.js +1 -1
  38. package/hooks/use-event-emitter/demo/demo1.d.ts +10 -0
  39. package/hooks/use-event-emitter/index.d.ts +8 -0
  40. package/hooks/use-event-emitter/index.js +26 -0
  41. package/hooks/use-event-listener/index.js +1 -1
  42. package/hooks/use-event-target/index.js +1 -1
  43. package/hooks/use-external/index.js +25 -24
  44. package/hooks/use-favicon/index.js +1 -1
  45. package/hooks/use-focus-within/index.js +1 -1
  46. package/hooks/use-force-update/index.js +1 -1
  47. package/hooks/use-fullscreen/index.js +1 -1
  48. package/hooks/use-get-state/index.js +1 -1
  49. package/hooks/use-history-travel/index.js +1 -1
  50. package/hooks/use-hover/index.js +1 -1
  51. package/hooks/use-id/index.js +1 -1
  52. package/hooks/use-in-view/index.js +1 -1
  53. package/hooks/use-in-viewport/index.js +1 -1
  54. package/hooks/use-infinite-scroll/index.js +1 -1
  55. package/hooks/use-intersection-observer/index.js +1 -1
  56. package/hooks/use-intersection-observers/index.js +1 -1
  57. package/hooks/use-interval/index.js +1 -1
  58. package/hooks/use-is-first-render/index.js +1 -1
  59. package/hooks/use-isomorphic-layout-effect/index.js +1 -1
  60. package/hooks/use-key-press/index.js +1 -1
  61. package/hooks/use-keyboard-event/index.js +3 -3
  62. package/hooks/use-latest/index.js +1 -1
  63. package/hooks/use-listen-window-resize/index.d.ts +1 -1
  64. package/hooks/use-listen-window-resize/index.js +3 -3
  65. package/hooks/use-local-storage-state/index.js +1 -1
  66. package/hooks/use-lock-fn/index.js +1 -1
  67. package/hooks/use-long-press/index.js +1 -1
  68. package/hooks/use-map/index.js +1 -1
  69. package/hooks/use-media/index.js +1 -1
  70. package/hooks/use-memo/index.js +1 -1
  71. package/hooks/use-memoized-fn/index.d.ts +1 -1
  72. package/hooks/use-memoized-fn/index.js +3 -3
  73. package/hooks/use-merge-props/index.js +1 -1
  74. package/hooks/use-merge-value/index.js +1 -1
  75. package/hooks/use-mobile/index.js +1 -1
  76. package/hooks/use-mount/index.js +1 -1
  77. package/hooks/use-mouse/index.js +1 -1
  78. package/hooks/use-move/index.js +1 -1
  79. package/hooks/use-mutation-observer/index.js +1 -1
  80. package/hooks/use-mutation-observers/index.js +1 -1
  81. package/hooks/use-network/index.js +1 -1
  82. package/hooks/use-online-status/index.js +1 -1
  83. package/hooks/use-overflow-hidden/index.js +1 -1
  84. package/hooks/use-override-ref/index.js +1 -1
  85. package/hooks/use-pagination/index.js +1 -1
  86. package/hooks/use-paste-image/index.js +1 -1
  87. package/hooks/use-persist-callback/index.js +1 -1
  88. package/hooks/use-prefers-color-scheme-dark/index.js +1 -1
  89. package/hooks/use-previous/index.js +1 -1
  90. package/hooks/use-raf-interval/index.js +1 -1
  91. package/hooks/use-raf-state/index.js +1 -1
  92. package/hooks/use-raf-timeout/index.js +1 -1
  93. package/hooks/use-reactive/index.js +1 -1
  94. package/hooks/use-ref-latest/index.js +1 -1
  95. package/hooks/use-refs/index.js +13 -12
  96. package/hooks/use-request/index.js +1 -1
  97. package/hooks/use-request/src/Fetch.js +1 -1
  98. package/hooks/use-request/src/plugins/useAutoRunPlugin.js +1 -1
  99. package/hooks/use-request/src/plugins/useCachePlugin.js +1 -1
  100. package/hooks/use-request/src/plugins/useDebouncePlugin.js +1 -1
  101. package/hooks/use-request/src/plugins/useLoadingDelayPlugin.js +1 -1
  102. package/hooks/use-request/src/plugins/usePollingPlugin.js +1 -1
  103. package/hooks/use-request/src/plugins/useRefreshOnWindowFocusPlugin.js +1 -1
  104. package/hooks/use-request/src/plugins/useRetryPlugin.js +1 -1
  105. package/hooks/use-request/src/plugins/useThrottlePlugin.js +1 -1
  106. package/hooks/use-request/src/useRequest.js +1 -1
  107. package/hooks/use-request/src/useRequestImplement.js +1 -1
  108. package/hooks/use-request/src/utils/cache.js +1 -1
  109. package/hooks/use-request/src/utils/cachePromise.js +1 -1
  110. package/hooks/use-request/src/utils/cacheSubscribe.js +1 -1
  111. package/hooks/use-request/src/utils/isDocumentVisible.js +1 -1
  112. package/hooks/use-request/src/utils/isOnline.js +1 -1
  113. package/hooks/use-request/src/utils/limit.js +1 -1
  114. package/hooks/use-request/src/utils/subscribeFocus.js +1 -1
  115. package/hooks/use-request/src/utils/subscribeReVisible.js +1 -1
  116. package/hooks/use-reset-state/index.js +1 -1
  117. package/hooks/use-resize-observer/index.js +1 -1
  118. package/hooks/use-resize-observers/index.js +1 -1
  119. package/hooks/use-responsive/index.js +1 -1
  120. package/hooks/use-safe-state/index.js +1 -1
  121. package/hooks/use-scroll/index.js +1 -1
  122. package/hooks/use-selections/index.js +1 -1
  123. package/hooks/use-session-storage-state/index.js +1 -1
  124. package/hooks/use-set/index.js +1 -1
  125. package/hooks/use-set-state/index.js +1 -1
  126. package/hooks/use-size/index.js +1 -1
  127. package/hooks/use-state-callback/index.js +1 -1
  128. package/hooks/use-state-with-promise/index.d.ts +11 -1
  129. package/hooks/use-state-with-promise/index.js +21 -20
  130. package/hooks/use-sync-state/index.js +1 -1
  131. package/hooks/use-text-selection/index.js +1 -1
  132. package/hooks/use-theme/index.js +1 -1
  133. package/hooks/use-throttle/index.js +1 -1
  134. package/hooks/use-throttle-effect/index.js +1 -1
  135. package/hooks/use-throttle-fn/index.js +1 -1
  136. package/hooks/use-timeout/index.js +1 -1
  137. package/hooks/use-title/index.js +1 -1
  138. package/hooks/use-toggle/index.js +12 -11
  139. package/hooks/use-tracked-effect/index.js +1 -1
  140. package/hooks/use-unmount/index.js +1 -1
  141. package/hooks/use-unmounted-ref/index.js +1 -1
  142. package/hooks/use-update/index.d.ts +3 -1
  143. package/hooks/use-update/index.js +5 -5
  144. package/hooks/use-update-effect/index.js +1 -1
  145. package/hooks/use-update-layout-effect/index.js +1 -1
  146. package/hooks/use-url-state/index.js +1 -1
  147. package/hooks/use-virtual-list/index.js +1 -1
  148. package/hooks/use-watch/index.js +1 -1
  149. package/hooks/use-web-socket/index.js +1 -1
  150. package/hooks/use-why-did-you-update/index.js +1 -1
  151. package/hooks/use-window-size/index.d.ts +1 -1
  152. package/hooks/use-window-size/index.js +1 -1
  153. package/hooks/utils/createEffectWithTarget.js +1 -1
  154. package/hooks/utils/depsAreSame.js +1 -1
  155. package/hooks/utils/depsEqual.js +1 -1
  156. package/hooks/utils/domTarget.js +1 -1
  157. package/hooks/utils/getDocumentOrShadow.js +1 -1
  158. package/hooks/utils/index.js +1 -1
  159. package/hooks/utils/isAppleDevice.js +1 -1
  160. package/hooks/utils/isBrowser.js +1 -1
  161. package/hooks/utils/isDev.js +1 -1
  162. package/hooks/utils/rect.js +1 -1
  163. package/hooks/utils/useDeepCompareWithTarget.js +1 -1
  164. package/hooks/utils/useEffectWithTarget.js +1 -1
  165. package/hooks/utils/useIsomorphicLayoutEffectWithTarget.js +1 -1
  166. package/hooks/utils/useLayoutEffectWithTarget.js +1 -1
  167. package/icons/file/index.js +1 -1
  168. package/index.d.ts +1 -1
  169. package/index.js +574 -544
  170. package/package.json +1 -1
  171. package/progress/index.js +43 -43
  172. package/resize-observer/Collection.d.ts +2 -2
  173. package/resize-observer/Collection.js +1 -1
  174. package/resize-observer/SingleObserver.js +1 -1
  175. package/resize-observer/index.js +1 -1
  176. package/resize-observer/observerUtil.js +1 -1
  177. package/space/index.js +1 -1
  178. package/style/animation.less +13 -1
  179. package/style.css +1 -1
  180. package/suspense-fallback-test/index.js +1 -1
  181. package/test.js +1 -1
  182. package/timer/index.js +1 -1
  183. package/transition/Transition.d.ts +11 -0
  184. package/transition/Transition.js +92 -0
  185. package/transition/TransitionCSS.d.ts +11 -0
  186. package/transition/TransitionCSS.js +33 -0
  187. package/transition/TransitionGroup.d.ts +11 -0
  188. package/transition/TransitionGroup.js +62 -0
  189. package/transition/TransitionStyle.d.ts +11 -0
  190. package/transition/TransitionStyle.js +46 -0
  191. package/transition/constants.d.ts +43 -0
  192. package/transition/constants.js +46 -0
  193. package/transition/index.d.ts +12 -0
  194. package/transition/index.js +12 -0
  195. package/transition/interface.d.ts +192 -0
  196. package/transition/utils.d.ts +19 -0
  197. package/transition/utils.js +97 -0
  198. package/utils/callOrReturn.js +1 -1
  199. package/utils/callbackOriginRef.js +1 -1
  200. package/utils/caseName.js +1 -1
  201. package/utils/className.js +1 -1
  202. package/utils/constant.js +1 -1
  203. package/utils/copy.js +1 -1
  204. package/utils/date.js +1 -1
  205. package/utils/dayjs.js +1 -1
  206. package/utils/dom.js +1 -1
  207. package/utils/emitter.js +1 -1
  208. package/utils/fileRead.js +1 -1
  209. package/utils/fileToDataURL.js +1 -1
  210. package/utils/fillNBSP.js +1 -1
  211. package/utils/findRootElement.d.ts +3 -3
  212. package/utils/findRootElement.js +2 -2
  213. package/utils/findScrollParent.js +1 -1
  214. package/utils/getHighlightText.js +1 -1
  215. package/utils/getHotkeyHandler.js +1 -1
  216. package/utils/getScrollBarHeight.js +1 -1
  217. package/utils/getScrollBarSize.js +1 -1
  218. package/utils/getScrollBarWidth.js +1 -1
  219. package/utils/getStringLength.js +1 -1
  220. package/utils/include.js +1 -1
  221. package/utils/index.js +277 -276
  222. package/utils/intersectionObserver.js +1 -1
  223. package/utils/is.d.ts +6 -5
  224. package/utils/is.js +23 -20
  225. package/utils/keyboardCode.js +1 -1
  226. package/utils/lodash.js +1 -1
  227. package/utils/math.js +1 -1
  228. package/utils/mergeProps.js +1 -1
  229. package/utils/mergedToString.js +1 -1
  230. package/utils/mutationObserver.js +1 -1
  231. package/utils/omit.js +1 -1
  232. package/utils/pad.js +1 -1
  233. package/utils/pick.js +1 -1
  234. package/utils/pinyin.js +1 -1
  235. package/utils/react19Adapter.js +1 -1
  236. package/utils/ref.js +2 -2
  237. package/utils/resizeObserver.js +1 -1
  238. package/utils/saveAs.js +1 -1
  239. package/utils/screenfull.js +1 -1
  240. package/utils/scrollIntoViewIfNeeded.js +1 -1
  241. package/utils/setCreateRoot.js +1 -1
  242. package/utils/setDarkTheme.js +1 -1
  243. package/utils/setDir.js +1 -1
  244. package/utils/setPrimaryColor.js +1 -1
  245. package/utils/setTheme.js +1 -1
  246. package/utils/string.js +1 -1
  247. package/utils/style.js +1 -1
  248. package/utils/throttleByRaf.js +1 -1
  249. package/utils/throttleByRaf2.js +1 -1
  250. package/utils/tinycolor.js +1 -1
  251. package/utils/toArray.js +1 -1
  252. package/utils/tree.js +1 -1
  253. package/utils/tween.js +1 -1
  254. package/utils/uuid.js +1 -1
  255. package/utils/validate.js +1 -1
  256. package/utils/warning.js +1 -1
  257. package/version/index.js +9 -9
  258. package/transition-group/ChildMapping.d.ts +0 -27
  259. package/transition-group/ChildMapping.js +0 -61
  260. package/transition-group/Transition.d.ts +0 -126
  261. package/transition-group/Transition.js +0 -133
  262. package/transition-group/TransitionCSS.d.ts +0 -97
  263. package/transition-group/TransitionCSS.js +0 -73
  264. package/transition-group/TransitionGroup.d.ts +0 -31
  265. package/transition-group/TransitionGroup.js +0 -54
  266. package/transition-group/TransitionReplace.d.ts +0 -23
  267. package/transition-group/TransitionReplace.js +0 -38
  268. package/transition-group/TransitionSwitch.d.ts +0 -88
  269. package/transition-group/TransitionSwitch.js +0 -84
  270. package/transition-group/context.d.ts +0 -2
  271. package/transition-group/context.js +0 -7
  272. package/transition-group/index.d.ts +0 -9
  273. package/transition-group/index.js +0 -11
@@ -1,133 +0,0 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
2
- import { isFunction as e, isNull as t, isNullOrUndefined as n, isNumber as r, isObject as i } from "../utils/is.js";
3
- import { forceReflow as a } from "../utils/dom.js";
4
- import o from "../utils/findRootElement.js";
5
- import { NOOP as s } from "../utils/constant.js";
6
- import { TransitionGroupContext as c } from "./context.js";
7
- import l from "react";
8
- import { jsx as u } from "react/jsx-runtime";
9
- //#region components/common/transition-group/Transition.tsx
10
- var d = "entering", f = "entered", p = "exiting", m = "exited", h = "unmounted", g = class extends l.Component {
11
- static {
12
- this.contextType = c;
13
- }
14
- constructor(o, s) {
15
- super(o, s), this.getDurations = () => {
16
- let { duration: e } = this.props, t, n, r;
17
- return t = n = r = e, i(e) && (t = e.exit, n = e.enter, r = e.appear ?? n), {
18
- exit: t,
19
- enter: n,
20
- appear: r
21
- };
22
- }, this.updateStatus = (e = !1, n) => {
23
- if (t(n)) this.props.unmountOnExit && this.state.status === "exited" && this.setState({ status: h });
24
- else if (this.cancelNextCallback(), n === "entering") {
25
- if (this.props.unmountOnExit || this.props.mountOnEnter) {
26
- let e = this.#n();
27
- e && a(e);
28
- }
29
- this.performEnter(e);
30
- } else this.performExit();
31
- }, this.performEnter = (e) => {
32
- let { enter: t } = this.props, n = this.context ? this.context.isMounting : e, [r, i] = [this.#n(), n], a = this.getDurations(), o = n ? a.appear : a.enter;
33
- if (!(e || t)) {
34
- this.safeSetState({ status: f }, () => {
35
- this.props.onEntered(r);
36
- });
37
- return;
38
- }
39
- this.props.onEnter(r, i), this.safeSetState({ status: d }, () => {
40
- this.props.onEntering(r, i), this.onTransitionEnd(o, () => {
41
- this.safeSetState({ status: f }, () => {
42
- this.props.onEntered(r, i);
43
- });
44
- });
45
- });
46
- }, this.performExit = () => {
47
- let { exit: e } = this.props, t = this.getDurations(), n = this.#n();
48
- if (!e) {
49
- this.safeSetState({ status: m }, () => {
50
- this.props.onExited(n);
51
- });
52
- return;
53
- }
54
- this.props.onExit(n), this.safeSetState({ status: p }, () => {
55
- this.props.onExiting(n), this.onTransitionEnd(t.exit, () => {
56
- this.safeSetState({ status: m }, () => {
57
- this.props.onExited(n);
58
- });
59
- });
60
- });
61
- }, this.cancelNextCallback = () => {
62
- n(this.#t) || (this.#t.cancel(), this.#t = null);
63
- }, this.setNextCallback = (e) => {
64
- let t = !0;
65
- return this.#t = (n) => {
66
- t && (t = !1, this.#t = null, e(n));
67
- }, this.#t.cancel = () => {
68
- t = !1;
69
- }, this.#t;
70
- }, this.onTransitionEnd = (t, n) => {
71
- let { setTimeout: i, clearTimeout: a } = window;
72
- this.setNextCallback(n);
73
- let o = this.#n(), s = this.props.addEndListener;
74
- if (!o || !r(t) && !e(s)) {
75
- a(this.#e), this.#e = i(this.#t, 0);
76
- return;
77
- }
78
- e(s) && s(o, this.#t), r(t) && (a(this.#e), this.#e = i(this.#t, t));
79
- };
80
- let c = s, l = c && !c.isMounting ? o.enter : o.appear, u;
81
- this.appearStatus = null, o.in ? l ? (u = m, this.appearStatus = d) : u = f : u = o.unmountOnExit || o.mountOnEnter ? h : m, this.state = { status: u };
82
- }
83
- #e = -1;
84
- #t = null;
85
- #n = () => o(this.props.refElement) || o(this);
86
- static getDerivedStateFromProps({ in: e }, t) {
87
- return e && t.status === "unmounted" ? { status: m } : null;
88
- }
89
- componentDidMount() {
90
- this.updateStatus(!0, this.appearStatus);
91
- }
92
- componentDidUpdate(e) {
93
- let t = null;
94
- if (e !== this.props) {
95
- let { status: e } = this.state;
96
- this.props.in ? e !== "entering" && e !== "entered" && (t = d) : (e === "entering" || e === "entered") && (t = p);
97
- }
98
- this.updateStatus(!1, t);
99
- }
100
- componentWillUnmount() {
101
- this.cancelNextCallback();
102
- }
103
- safeSetState(e, t) {
104
- t = this.setNextCallback(t), this.setState(e, t);
105
- }
106
- render() {
107
- let t = this.state.status;
108
- if (t === "unmounted") return null;
109
- let { children: n, in: r, mountOnEnter: i, unmountOnExit: a, appear: o, enter: s, exit: d, duration: f, addEndListener: p, onEnter: m, onEntering: h, onEntered: g, onExit: _, onExiting: v, onExited: y, refElement: b, ...x } = this.props;
110
- return /* @__PURE__ */ u(c.Provider, {
111
- value: null,
112
- children: e(n) ? n(t, x) : l.cloneElement(l.Children.only(n), x)
113
- });
114
- }
115
- };
116
- g.defaultProps = {
117
- in: !1,
118
- mountOnEnter: !1,
119
- unmountOnExit: !1,
120
- appear: !1,
121
- enter: !0,
122
- exit: !0,
123
- refElement: void 0,
124
- onEnter: s,
125
- onEntering: s,
126
- onEntered: s,
127
- onExit: s,
128
- onExiting: s,
129
- onExited: s
130
- }, g.UNMOUNTED = h, g.EXITED = m, g.ENTERING = d, g.ENTERED = f, g.EXITING = p;
131
- //#endregion
132
- export { f as ENTERED, d as ENTERING, m as EXITED, p as EXITING, h as UNMOUNTED, g as default };
133
- /* 独立思考,明辨是非 */
@@ -1,97 +0,0 @@
1
- import React from 'react';
2
- /**
3
- * A transition component inspired by the excellent
4
- * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should
5
- * use it if you're using CSS transitions or animations. It's built upon the
6
- * [`Transition`](https://reactcommunity.org/react-transition-group/transition)
7
- * component, so it inherits all of its props.
8
- *
9
- * `TransitionCSS` applies a pair of class names during the `appear`, `enter`,
10
- * and `exit` states of the transition. The first class is applied and then a
11
- * second `*-active` class in order to activate the CSS transition. After the
12
- * transition, matching `*-done` class names are applied to persist the
13
- * transition state.
14
- *
15
- * ```jsx
16
- * function App() {
17
- * const [inProp, setInProp] = useState(false);
18
- * const refElement = useRef(null);
19
- * return (
20
- * <div>
21
- * <TransitionCSS refElement={refElement} in={inProp} duration={200} classNames="my-element">
22
- * <div ref={refElement}>
23
- * {"I'll receive my-element-* classes"}
24
- * </div>
25
- * </TransitionCSS>
26
- * <button type="button" onClick={() => setInProp(true)}>
27
- * Click to Enter
28
- * </button>
29
- * </div>
30
- * );
31
- * }
32
- * ```
33
- *
34
- * When the `in` prop is set to `true`, the child component will first receive
35
- * the class `example-enter`, then the `example-enter-active` will be added in
36
- * the next tick. `TransitionCSS` [forces a
37
- * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/TransitionCSS.js#L208-L215)
38
- * between before adding the `example-enter-active`. This is an important trick
39
- * because it allows us to transition between `example-enter` and
40
- * `example-enter-active` even though they were added immediately one after
41
- * another. Most notably, this is what makes it possible for us to animate
42
- * _appearance_.
43
- *
44
- * ```css
45
- * .my-element-enter {
46
- * opacity: 0;
47
- * }
48
- * .my-element-enter-active {
49
- * opacity: 1;
50
- * transition: opacity 200ms;
51
- * }
52
- * .my-element-exit {
53
- * opacity: 1;
54
- * }
55
- * .my-element-exit-active {
56
- * opacity: 0;
57
- * transition: opacity 200ms;
58
- * }
59
- * ```
60
- *
61
- * `*-active` classes represent which styles you want to animate **to**, so it's
62
- * important to add `transition` declaration only to them, otherwise transitions
63
- * might not behave as intended! This might not be obvious when the transitions
64
- * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in
65
- * the example above (minus `transition`), but it becomes apparent in more
66
- * complex transitions.
67
- *
68
- * **Note**: If you're using the
69
- * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear)
70
- * prop, make sure to define styles for `.appear-*` classes as well.
71
- */
72
- declare class TransitionCSS extends React.Component {
73
- static defaultProps: {
74
- classNames: string;
75
- };
76
- appliedClasses: {
77
- appear: {};
78
- enter: {};
79
- exit: {};
80
- };
81
- onEnter: (maybeElement: any, maybeAppearing: any) => void;
82
- onEntering: (maybeElement: any, maybeAppearing: any) => void;
83
- onEntered: (maybeElement: any, maybeAppearing: any) => void;
84
- onExit: (maybeElement: any) => void;
85
- onExiting: (maybeElement: any) => void;
86
- onExited: (maybeElement: any) => void;
87
- resolveArguments: (maybeElement: any, maybeAppearing: any) => any[];
88
- getClassNames: (type: any) => {
89
- baseClassName: any;
90
- activeClassName: any;
91
- doneClassName: any;
92
- };
93
- addClass: (element: any, type: any, phase: any) => void;
94
- removeClasses: (element: any, type: any) => void;
95
- render(): import("react/jsx-runtime").JSX.Element;
96
- }
97
- export default TransitionCSS;
@@ -1,73 +0,0 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
2
- import { isElementByInstanceof as e, isFunction as t, isString as n } from "../utils/is.js";
3
- import { forceReflow as r } from "../utils/dom.js";
4
- import i from "../utils/findRootElement.js";
5
- import a from "./Transition.js";
6
- import o from "react";
7
- import { jsx as s } from "react/jsx-runtime";
8
- //#region components/common/transition-group/TransitionCSS.tsx
9
- function c(t, r, i = "add") {
10
- e(t) && r && n(r) && r.split(" ").filter(Boolean).forEach((e, n, r) => {
11
- t.classList[i](e);
12
- });
13
- }
14
- var l = class extends o.Component {
15
- constructor(...e) {
16
- super(...e), this.appliedClasses = {
17
- appear: {},
18
- enter: {},
19
- exit: {}
20
- }, this.onEnter = (e, n) => {
21
- let [r, i] = this.resolveArguments(e, n);
22
- this.removeClasses(r, "exit"), this.addClass(r, i ? "appear" : "enter", "base"), t(this.props.onEnter) && this.props.onEnter(r, n);
23
- }, this.onEntering = (e, n) => {
24
- let [r, i] = this.resolveArguments(e, n), a = i ? "appear" : "enter";
25
- this.addClass(r, a, "active"), t(this.props.onEntering) && this.props.onEntering(r, n);
26
- }, this.onEntered = (e, n) => {
27
- let [r, i] = this.resolveArguments(e, n), a = i ? "appear" : "enter";
28
- this.removeClasses(r, a), this.addClass(r, a, "done"), t(this.props.onEntered) && this.props.onEntered(r, n);
29
- }, this.onExit = (e) => {
30
- let [n] = this.resolveArguments(e);
31
- this.removeClasses(n, "appear"), this.removeClasses(n, "enter"), this.addClass(n, "exit", "base"), t(this.props.onExit) && this.props.onExit(n);
32
- }, this.onExiting = (e) => {
33
- let [n] = this.resolveArguments(e);
34
- this.addClass(n, "exit", "active"), t(this.props.onExiting) && this.props.onExiting(n);
35
- }, this.onExited = (e) => {
36
- let [n] = this.resolveArguments(e);
37
- this.removeClasses(n, "exit"), this.addClass(n, "exit", "done"), t(this.props.onExited) && this.props.onExited(n);
38
- }, this.resolveArguments = (e, t) => [i(this.props.refElement) || e, t], this.getClassNames = (e) => {
39
- let { classNames: t, duration: r } = this.props;
40
- r == 0 && (t = "");
41
- let i = n(t), a = i && t ? `${t}-` : "", o = i ? `${a}${e}` : t[e];
42
- return {
43
- baseClassName: o,
44
- activeClassName: i ? `${o}-active` : t[`${e}Active`],
45
- doneClassName: i ? `${o}-done` : t[`${e}Done`]
46
- };
47
- }, this.addClass = (e, t, n) => {
48
- let i = this.getClassNames(t)[`${n}ClassName`], { doneClassName: a } = this.getClassNames("enter");
49
- t === "appear" && n === "done" && a && (i += ` ${a}`), n === "active" && e && r(e), i && (this.appliedClasses[t][n] = i, c(e, i, "add"));
50
- }, this.removeClasses = (e, t) => {
51
- let { base: n, active: r, done: i } = this.appliedClasses[t];
52
- this.appliedClasses[t] = {}, n && c(e, n, "remove"), r && c(e, r, "remove"), i && c(e, i, "remove");
53
- };
54
- }
55
- static {
56
- this.defaultProps = { classNames: "" };
57
- }
58
- render() {
59
- let { classNames: e, ...t } = this.props;
60
- return /* @__PURE__ */ s(a, {
61
- ...t,
62
- onEnter: this.onEnter,
63
- onEntered: this.onEntered,
64
- onEntering: this.onEntering,
65
- onExit: this.onExit,
66
- onExiting: this.onExiting,
67
- onExited: this.onExited
68
- });
69
- }
70
- };
71
- //#endregion
72
- export { l as default };
73
- /* 独立思考,明辨是非 */
@@ -1,31 +0,0 @@
1
- import React from 'react';
2
- /**
3
- * The `<TransitionGroup>` component manages a set of transition components
4
- * (`<Transition>` and `<TransitionCSS>`) in a list. Like with the transition
5
- * components, `<TransitionGroup>` is a state machine for managing the mounting
6
- * and unmounting of components over time.
7
- *
8
- * Consider the example below. As items are removed or added to the TodoList the
9
- * `in` prop is toggled automatically by the `<TransitionGroup>`.
10
- *
11
- * Note that `<TransitionGroup>` does not define any animation behavior!
12
- * Exactly _how_ a list item animates is up to the individual transition
13
- * component. This means you can mix and match animations across different list
14
- * items.
15
- */
16
- declare class TransitionGroup extends React.Component {
17
- constructor(props: any, context: any);
18
- componentDidMount(): void;
19
- componentWillUnmount(): void;
20
- static getDerivedStateFromProps(nextProps: any, { children: prevChildMapping, handleExited, firstRender }: {
21
- children: any;
22
- handleExited: any;
23
- firstRender: any;
24
- }): {
25
- children: any;
26
- firstRender: boolean;
27
- };
28
- handleExited(child: any, element: any): void;
29
- render(): import("react/jsx-runtime").JSX.Element;
30
- }
31
- export default TransitionGroup;
@@ -1,54 +0,0 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
2
- import { getChildMapping as e, getInitialChildMapping as t, getNextChildMapping as n } from "./ChildMapping.js";
3
- import { TransitionGroupContext as r } from "./context.js";
4
- import i from "react";
5
- import { jsx as a } from "react/jsx-runtime";
6
- //#region components/common/transition-group/TransitionGroup.tsx
7
- var o = {
8
- component: "div",
9
- childFactory: (e) => e
10
- }, s = class extends i.Component {
11
- constructor(e, t) {
12
- super(e, t), this.state = {
13
- contextValue: { isMounting: !0 },
14
- handleExited: this.handleExited.bind(this),
15
- firstRender: !0
16
- };
17
- }
18
- componentDidMount() {
19
- this.mounted = !0, this.setState({ contextValue: { isMounting: !1 } });
20
- }
21
- componentWillUnmount() {
22
- this.mounted = !1;
23
- }
24
- static getDerivedStateFromProps(e, { children: r, handleExited: i, firstRender: a }) {
25
- return {
26
- children: a ? t(e, i) : n(e, r, i),
27
- firstRender: !1
28
- };
29
- }
30
- handleExited(t, n) {
31
- let r = e(this.props.children);
32
- t.key in r || (t.props.onExited && t.props.onExited(n), this.mounted && this.setState((e) => {
33
- let n = { ...e.children };
34
- return delete n[t.key], { children: n };
35
- }));
36
- }
37
- render() {
38
- let { component: e, childFactory: t, ...n } = this.props, { contextValue: i } = this.state, o = Object.values(this.state.children).map(t);
39
- return delete n.appear, delete n.enter, delete n.exit, e === null ? /* @__PURE__ */ a(r.Provider, {
40
- value: i,
41
- children: o
42
- }) : /* @__PURE__ */ a(r.Provider, {
43
- value: i,
44
- children: /* @__PURE__ */ a(e, {
45
- ...n,
46
- children: o
47
- })
48
- });
49
- }
50
- };
51
- s.defaultProps = o;
52
- //#endregion
53
- export { s as default };
54
- /* 独立思考,明辨是非 */
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- /**
3
- * The `<TransitionReplace>` component is a specialized `Transition` component
4
- * that animates between two children.
5
- *
6
- * ```jsx
7
- * <TransitionReplace in>
8
- * <Fade><div>I appear first</div></Fade>
9
- * <Fade><div>I replace the above</div></Fade>
10
- * </TransitionReplace>
11
- * ```
12
- */
13
- declare class TransitionReplace extends React.Component {
14
- handleEnter: (...args: any[]) => void;
15
- handleEntering: (...args: any[]) => void;
16
- handleEntered: (...args: any[]) => void;
17
- handleExit: (...args: any[]) => void;
18
- handleExiting: (...args: any[]) => void;
19
- handleExited: (...args: any[]) => void;
20
- handleLifecycle(handler: any, idx: any, originalArgs: any): void;
21
- render(): import("react/jsx-runtime").JSX.Element;
22
- }
23
- export default TransitionReplace;
@@ -1,38 +0,0 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
2
- import e from "../utils/findRootElement.js";
3
- import t from "./TransitionGroup.js";
4
- import n from "react";
5
- import { jsx as r } from "react/jsx-runtime";
6
- //#region components/common/transition-group/TransitionReplace.tsx
7
- var i = class extends n.Component {
8
- constructor(...e) {
9
- super(...e), this.handleEnter = (...e) => this.handleLifecycle("onEnter", 0, e), this.handleEntering = (...e) => this.handleLifecycle("onEntering", 0, e), this.handleEntered = (...e) => this.handleLifecycle("onEntered", 0, e), this.handleExit = (...e) => this.handleLifecycle("onExit", 1, e), this.handleExiting = (...e) => this.handleLifecycle("onExiting", 1, e), this.handleExited = (...e) => this.handleLifecycle("onExited", 1, e);
10
- }
11
- handleLifecycle(t, r, i) {
12
- let { children: a } = this.props, o = n.Children.toArray(a)[r];
13
- if (o.props[t] && o.props[t](...i), this.props[t]) {
14
- let n = e(o.props.refElement) || e(this);
15
- this.props[t](n);
16
- }
17
- }
18
- render() {
19
- let { children: e, in: i, ...a } = this.props, [o, s] = n.Children.toArray(e);
20
- return delete a.onEnter, delete a.onEntering, delete a.onEntered, delete a.onExit, delete a.onExiting, delete a.onExited, /* @__PURE__ */ r(t, {
21
- ...a,
22
- children: i ? n.cloneElement(o, {
23
- key: "first",
24
- onEnter: this.handleEnter,
25
- onEntering: this.handleEntering,
26
- onEntered: this.handleEntered
27
- }) : n.cloneElement(s, {
28
- key: "second",
29
- onEnter: this.handleExit,
30
- onEntering: this.handleExiting,
31
- onEntered: this.handleExited
32
- })
33
- });
34
- }
35
- };
36
- //#endregion
37
- export { i as default };
38
- /* 独立思考,明辨是非 */
@@ -1,88 +0,0 @@
1
- import React from 'react';
2
- /**
3
- * Enum of modes for TransitionSwitch component
4
- * @enum { string }
5
- */
6
- export declare const modes: {
7
- out: string;
8
- in: string;
9
- };
10
- /**
11
- * A transition component inspired by the [vue transition modes](https://vuejs.org/v2/guide/transitions.html#Transition-Modes).
12
- * You can use it when you want to control the render between state transitions.
13
- * Based on the selected mode and the child's key which is the `Transition` or `TransitionCSS` component, the `TransitionSwitch` makes a consistent transition between them.
14
- *
15
- * If the `out-in` mode is selected, the `TransitionSwitch` waits until the old child leaves and then inserts a new child.
16
- * If the `in-out` mode is selected, the `TransitionSwitch` inserts a new child first, waits for the new child to enter and then removes the old child.
17
- *
18
- * **Note**: If you want the animation to happen simultaneously
19
- * (that is, to have the old child removed and a new child inserted **at the same time**),
20
- * you should use
21
- * [`TransitionGroup`](https://reactcommunity.org/react-transition-group/transition-group)
22
- * instead.
23
- *
24
- * ```jsx
25
- * function App() {
26
- * const [state, setState] = useState(false);
27
- * const refHello = useRef(null);
28
- * const refGoodbye = useRef(null);
29
- * const refElement = state ? refGoodbye : refHello;
30
- * return (
31
- * <TransitionSwitch>
32
- * <TransitionCSS
33
- * key={state ? "Goodbye, world!" : "Hello, world!"}
34
- * refElement={refElement}
35
- * addEndListener={(element, done) => element.addEventListener("transitionend", done, false)}
36
- * classNames='fade'
37
- * >
38
- * <button ref={refElement} onClick={() => setState(state => !state)}>
39
- * {state ? "Goodbye, world!" : "Hello, world!"}
40
- * </button>
41
- * </TransitionCSS>
42
- * </TransitionSwitch>
43
- * );
44
- * }
45
- * ```
46
- *
47
- * ```css
48
- * .fade-enter{
49
- * opacity: 0;
50
- * }
51
- * .fade-exit{
52
- * opacity: 1;
53
- * }
54
- * .fade-enter-active{
55
- * opacity: 1;
56
- * }
57
- * .fade-exit-active{
58
- * opacity: 0;
59
- * }
60
- * .fade-enter-active,
61
- * .fade-exit-active{
62
- * transition: opacity 500ms;
63
- * }
64
- * ```
65
- */
66
- declare class TransitionSwitch extends React.Component {
67
- state: {
68
- status: string;
69
- current: null;
70
- };
71
- appeared: boolean;
72
- componentDidMount(): void;
73
- static getDerivedStateFromProps(props: any, state: any): {
74
- current: null;
75
- status?: undefined;
76
- } | {
77
- status: string;
78
- current?: undefined;
79
- } | {
80
- current: React.FunctionComponentElement<{
81
- in: boolean;
82
- }>;
83
- status?: undefined;
84
- };
85
- changeState: (status: any, current?: null) => void;
86
- render(): import("react/jsx-runtime").JSX.Element;
87
- }
88
- export default TransitionSwitch;
@@ -1,84 +0,0 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
2
- import { TransitionGroupContext as e } from "./context.js";
3
- import { ENTERED as t, ENTERING as n, EXITING as r } from "./Transition.js";
4
- import i from "react";
5
- import { jsx as a } from "react/jsx-runtime";
6
- //#region components/common/transition-group/TransitionSwitch.tsx
7
- function o(e, t) {
8
- return !(e === t || i.isValidElement(e) && i.isValidElement(t) && e.key != null && e.key === t.key);
9
- }
10
- var s = {
11
- out: "out-in",
12
- in: "in-out"
13
- }, c = (e, t, n) => (...r) => {
14
- e.props[t] && e.props[t](...r), n();
15
- }, l = {
16
- [s.out]: ({ current: e, changeState: t }) => i.cloneElement(e, {
17
- in: !1,
18
- onExited: c(e, "onExited", () => {
19
- t(n, null);
20
- })
21
- }),
22
- [s.in]: ({ current: e, changeState: t, children: r }) => [e, i.cloneElement(r, {
23
- in: !0,
24
- onEntered: c(r, "onEntered", () => {
25
- t(n);
26
- })
27
- })]
28
- }, u = {
29
- [s.out]: ({ children: e, changeState: n }) => i.cloneElement(e, {
30
- in: !0,
31
- onEntered: c(e, "onEntered", () => {
32
- n(t, i.cloneElement(e, { in: !0 }));
33
- })
34
- }),
35
- [s.in]: ({ current: e, children: n, changeState: r }) => [i.cloneElement(e, {
36
- in: !1,
37
- onExited: c(e, "onExited", () => {
38
- r(t, i.cloneElement(n, { in: !0 }));
39
- })
40
- }), i.cloneElement(n, { in: !0 })]
41
- }, d = class extends i.Component {
42
- constructor(...e) {
43
- super(...e), this.state = {
44
- status: t,
45
- current: null
46
- }, this.appeared = !1, this.changeState = (e, t = this.state.current) => {
47
- this.setState({
48
- status: e,
49
- current: t
50
- });
51
- };
52
- }
53
- componentDidMount() {
54
- this.appeared = !0;
55
- }
56
- static getDerivedStateFromProps(e, t) {
57
- return e.children == null ? { current: null } : t.status === "entering" && e.mode === s.in ? { status: n } : t.current && o(t.current, e.children) ? { status: r } : { current: i.cloneElement(e.children, { in: !0 }) };
58
- }
59
- render() {
60
- let { props: { children: i, mode: o }, state: { status: s, current: c } } = this, d = {
61
- children: i,
62
- current: c,
63
- changeState: this.changeState,
64
- status: s
65
- }, f;
66
- switch (s) {
67
- case n:
68
- f = u[o](d);
69
- break;
70
- case r:
71
- f = l[o](d);
72
- break;
73
- case t: f = c;
74
- }
75
- return /* @__PURE__ */ a(e.Provider, {
76
- value: { isMounting: !this.appeared },
77
- children: f
78
- });
79
- }
80
- };
81
- d.defaultProps = { mode: s.out };
82
- //#endregion
83
- export { d as default, s as modes };
84
- /* 独立思考,明辨是非 */
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const TransitionGroupContext: React.Context<null>;
@@ -1,7 +0,0 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
2
- import e from "react";
3
- //#region components/common/transition-group/context.ts
4
- var t = e.createContext(null);
5
- //#endregion
6
- export { t as TransitionGroupContext };
7
- /* 独立思考,明辨是非 */
@@ -1,9 +0,0 @@
1
- import { forceReflow as TransitionGroupForceReflow } from '../utils/dom';
2
- import { getChildMapping as TransitionGroupGetChildMapping, getInitialChildMapping as TransitionGroupGetInitialChildMapping, getNextChildMapping as TransitionGroupGetNextChildMapping, mergeChildMappings as TransitionGroupMergeChildMappings } from './ChildMapping';
3
- import { TransitionGroupContext } from './context';
4
- import { default as Transition, ENTERED as TRANSITION_ENTERED, ENTERING as TRANSITION_ENTERING, EXITED as TRANSITION_EXITED, EXITING as TRANSITION_EXITING, UNMOUNTED as TRANSITION_UNMOUNTED } from './Transition';
5
- import { default as TransitionCSS } from './TransitionCSS';
6
- import { default as TransitionGroup } from './TransitionGroup';
7
- import { default as TransitionReplace } from './TransitionReplace';
8
- import { default as TransitionSwitch, modes as TransitionSwitchModes } from './TransitionSwitch';
9
- export { TransitionGroup as default, Transition, TRANSITION_ENTERED, TRANSITION_ENTERING, TRANSITION_EXITED, TRANSITION_EXITING, TRANSITION_UNMOUNTED, TransitionCSS, TransitionGroup, TransitionGroupContext, TransitionGroupForceReflow, TransitionGroupGetChildMapping, TransitionGroupGetInitialChildMapping, TransitionGroupGetNextChildMapping, TransitionGroupMergeChildMappings, TransitionReplace, TransitionSwitch, TransitionSwitchModes, };
@@ -1,11 +0,0 @@
1
- /* 潘启宝 2026-04-03 14:07:44 星期五 */
2
- import { forceReflow as e } from "../utils/dom.js";
3
- import { getChildMapping as t, getInitialChildMapping as n, getNextChildMapping as r, mergeChildMappings as i } from "./ChildMapping.js";
4
- import { TransitionGroupContext as a } from "./context.js";
5
- import o, { ENTERED as s, ENTERING as c, EXITED as l, EXITING as u, UNMOUNTED as d } from "./Transition.js";
6
- import f from "./TransitionCSS.js";
7
- import p from "./TransitionGroup.js";
8
- import m from "./TransitionReplace.js";
9
- import h, { modes as g } from "./TransitionSwitch.js";
10
- export { s as TRANSITION_ENTERED, c as TRANSITION_ENTERING, l as TRANSITION_EXITED, u as TRANSITION_EXITING, d as TRANSITION_UNMOUNTED, o as Transition, f as TransitionCSS, p as TransitionGroup, p as default, a as TransitionGroupContext, e as TransitionGroupForceReflow, t as TransitionGroupGetChildMapping, n as TransitionGroupGetInitialChildMapping, r as TransitionGroupGetNextChildMapping, i as TransitionGroupMergeChildMappings, m as TransitionReplace, h as TransitionSwitch, g as TransitionSwitchModes };
11
- /* 独立思考,明辨是非 */