@unicom-cloud/ui-common 0.1.18 → 0.1.19

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 +86 -171
  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 +1 -1
  10. package/hooks/create-update-effect/index.js +1 -1
  11. package/hooks/create-use-storage-state/index.d.ts +2 -1
  12. package/hooks/create-use-storage-state/index.js +44 -35
  13. package/hooks/index.js +1 -1
  14. package/hooks/use-async-effect/index.js +1 -1
  15. package/hooks/use-boolean/index.js +1 -1
  16. package/hooks/use-click-away/index.js +1 -1
  17. package/hooks/use-computed-state/index.js +1 -1
  18. package/hooks/use-controllable-value/index.js +1 -1
  19. package/hooks/use-cookie-state/index.js +1 -1
  20. package/hooks/use-count-down/index.js +1 -1
  21. package/hooks/use-counter/index.js +1 -1
  22. package/hooks/use-create/index.js +1 -1
  23. package/hooks/use-creation/index.js +1 -1
  24. package/hooks/use-debounce/index.js +1 -1
  25. package/hooks/use-debounce-effect/index.js +1 -1
  26. package/hooks/use-debounce-fn/index.js +1 -1
  27. package/hooks/use-deep-compare-effect/index.js +1 -1
  28. package/hooks/use-deep-compare-layout-effect/index.js +1 -1
  29. package/hooks/use-document-visibility/index.js +1 -1
  30. package/hooks/use-drag/index.js +1 -1
  31. package/hooks/use-drop/index.js +1 -1
  32. package/hooks/use-effect-event/index.js +1 -1
  33. package/hooks/use-event/index.js +1 -1
  34. package/hooks/use-event-listener/index.d.ts +3 -2
  35. package/hooks/use-event-listener/index.js +1 -1
  36. package/hooks/use-event-target/index.js +1 -1
  37. package/hooks/use-external/index.js +1 -1
  38. package/hooks/use-favicon/index.js +1 -1
  39. package/hooks/use-focus-within/index.js +1 -1
  40. package/hooks/use-force-update/index.js +1 -1
  41. package/hooks/use-fullscreen/index.js +1 -1
  42. package/hooks/use-get-state/index.js +1 -1
  43. package/hooks/use-history-travel/index.js +1 -1
  44. package/hooks/use-hover/index.js +1 -1
  45. package/hooks/use-id/index.js +1 -1
  46. package/hooks/use-in-view/index.js +1 -1
  47. package/hooks/use-in-viewport/index.js +1 -1
  48. package/hooks/use-infinite-scroll/index.js +1 -1
  49. package/hooks/use-intersection-observer/index.js +1 -1
  50. package/hooks/use-intersection-observers/index.js +25 -25
  51. package/hooks/use-interval/index.js +1 -1
  52. package/hooks/use-is-first-render/index.js +1 -1
  53. package/hooks/use-isomorphic-layout-effect/index.js +1 -1
  54. package/hooks/use-key-press/index.js +1 -1
  55. package/hooks/use-keyboard-event/index.js +1 -1
  56. package/hooks/use-latest/index.js +1 -1
  57. package/hooks/use-listen-window-resize/index.js +1 -1
  58. package/hooks/use-local-storage-state/index.js +1 -1
  59. package/hooks/use-lock-fn/index.js +1 -1
  60. package/hooks/use-long-press/index.js +1 -1
  61. package/hooks/use-map/index.js +1 -1
  62. package/hooks/use-media/index.js +1 -1
  63. package/hooks/use-memo/index.js +1 -1
  64. package/hooks/use-memoized-fn/index.js +1 -1
  65. package/hooks/use-merge-props/index.js +1 -1
  66. package/hooks/use-merge-value/index.js +1 -1
  67. package/hooks/use-mobile/index.js +1 -1
  68. package/hooks/use-mount/index.js +1 -1
  69. package/hooks/use-mouse/index.js +1 -1
  70. package/hooks/use-move/index.js +1 -1
  71. package/hooks/use-mutation-observer/index.js +1 -1
  72. package/hooks/use-mutation-observers/index.js +24 -24
  73. package/hooks/use-network/index.js +1 -1
  74. package/hooks/use-online-status/index.js +1 -1
  75. package/hooks/use-overflow-hidden/index.js +17 -16
  76. package/hooks/use-override-ref/index.js +1 -1
  77. package/hooks/use-pagination/index.js +1 -1
  78. package/hooks/use-paste-image/index.js +1 -1
  79. package/hooks/use-persist-callback/index.js +1 -1
  80. package/hooks/use-prefers-color-scheme-dark/index.js +1 -1
  81. package/hooks/use-previous/index.js +1 -1
  82. package/hooks/use-raf-interval/index.js +1 -1
  83. package/hooks/use-raf-state/index.js +1 -1
  84. package/hooks/use-raf-timeout/index.js +1 -1
  85. package/hooks/use-reactive/index.js +1 -1
  86. package/hooks/use-ref-latest/index.js +1 -1
  87. package/hooks/use-refs/index.js +1 -1
  88. package/hooks/use-request/index.js +1 -1
  89. package/hooks/use-request/src/Fetch.js +1 -1
  90. package/hooks/use-request/src/plugins/useAutoRunPlugin.js +1 -1
  91. package/hooks/use-request/src/plugins/useCachePlugin.js +1 -1
  92. package/hooks/use-request/src/plugins/useDebouncePlugin.js +1 -1
  93. package/hooks/use-request/src/plugins/useLoadingDelayPlugin.js +1 -1
  94. package/hooks/use-request/src/plugins/usePollingPlugin.js +1 -1
  95. package/hooks/use-request/src/plugins/useRefreshOnWindowFocusPlugin.js +1 -1
  96. package/hooks/use-request/src/plugins/useRetryPlugin.js +1 -1
  97. package/hooks/use-request/src/plugins/useThrottlePlugin.js +1 -1
  98. package/hooks/use-request/src/useRequest.d.ts +6 -2
  99. package/hooks/use-request/src/useRequest.js +1 -1
  100. package/hooks/use-request/src/useRequestImplement.js +1 -1
  101. package/hooks/use-request/src/utils/cache.js +1 -1
  102. package/hooks/use-request/src/utils/cachePromise.js +1 -1
  103. package/hooks/use-request/src/utils/cacheSubscribe.js +1 -1
  104. package/hooks/use-request/src/utils/isDocumentVisible.js +1 -1
  105. package/hooks/use-request/src/utils/isOnline.js +1 -1
  106. package/hooks/use-request/src/utils/limit.js +1 -1
  107. package/hooks/use-request/src/utils/subscribeFocus.js +1 -1
  108. package/hooks/use-request/src/utils/subscribeReVisible.js +1 -1
  109. package/hooks/use-reset-state/index.js +1 -1
  110. package/hooks/use-resize-observer/index.js +1 -1
  111. package/hooks/use-resize-observers/index.js +25 -25
  112. package/hooks/use-responsive/index.js +1 -1
  113. package/hooks/use-safe-state/index.js +1 -1
  114. package/hooks/use-scroll/index.js +1 -1
  115. package/hooks/use-selections/index.js +1 -1
  116. package/hooks/use-session-storage-state/index.js +1 -1
  117. package/hooks/use-set/index.js +1 -1
  118. package/hooks/use-set-state/index.js +1 -1
  119. package/hooks/use-size/index.js +1 -1
  120. package/hooks/use-state-callback/index.js +1 -1
  121. package/hooks/use-state-with-promise/index.js +1 -1
  122. package/hooks/use-sync-state/index.js +1 -1
  123. package/hooks/use-text-selection/index.js +1 -1
  124. package/hooks/use-theme/index.js +1 -1
  125. package/hooks/use-throttle/index.js +1 -1
  126. package/hooks/use-throttle-effect/index.js +1 -1
  127. package/hooks/use-throttle-fn/index.js +1 -1
  128. package/hooks/use-timeout/index.js +1 -1
  129. package/hooks/use-title/index.js +1 -1
  130. package/hooks/use-toggle/index.js +1 -1
  131. package/hooks/use-tracked-effect/index.js +1 -1
  132. package/hooks/use-unmount/index.js +1 -1
  133. package/hooks/use-unmounted-ref/index.js +1 -1
  134. package/hooks/use-update/index.js +1 -1
  135. package/hooks/use-update-effect/index.js +1 -1
  136. package/hooks/use-update-layout-effect/index.js +1 -1
  137. package/hooks/use-url-state/index.js +1 -1
  138. package/hooks/use-virtual-list/index.js +1 -1
  139. package/hooks/use-watch/index.js +1 -1
  140. package/hooks/use-web-socket/index.js +1 -1
  141. package/hooks/use-why-did-you-update/index.js +1 -1
  142. package/hooks/use-window-size/index.js +1 -1
  143. package/hooks/utils/createEffectWithTarget.js +1 -1
  144. package/hooks/utils/depsAreSame.js +1 -1
  145. package/hooks/utils/depsEqual.js +1 -1
  146. package/hooks/utils/domTarget.js +1 -1
  147. package/hooks/utils/getDocumentOrShadow.js +1 -1
  148. package/hooks/utils/index.js +1 -1
  149. package/hooks/utils/isAppleDevice.js +1 -1
  150. package/hooks/utils/isBrowser.js +1 -1
  151. package/hooks/utils/isDev.js +1 -1
  152. package/hooks/utils/rect.js +1 -1
  153. package/hooks/utils/useDeepCompareWithTarget.js +1 -1
  154. package/hooks/utils/useEffectWithTarget.js +1 -1
  155. package/hooks/utils/useIsomorphicLayoutEffectWithTarget.js +1 -1
  156. package/hooks/utils/useLayoutEffectWithTarget.js +1 -1
  157. package/icons/file/index.js +1 -1
  158. package/index.js +487 -480
  159. package/package.json +1 -1
  160. package/progress/index.js +1 -1
  161. package/resize-observer/Collection.js +1 -1
  162. package/resize-observer/SingleObserver.js +1 -1
  163. package/resize-observer/index.js +2 -2
  164. package/resize-observer/observerUtil.js +1 -1
  165. package/space/index.js +1 -1
  166. package/style/animation.less +4 -4
  167. package/style.css +1 -1
  168. package/suspense-fallback-test/index.js +1 -1
  169. package/test.d.ts +0 -0
  170. package/test.js +5 -0
  171. package/timer/index.js +1 -1
  172. package/transition-group/ChildMapping.js +1 -1
  173. package/transition-group/Transition.d.ts +37 -41
  174. package/transition-group/Transition.js +96 -102
  175. package/transition-group/{CSSTransition.d.ts → TransitionCSS.d.ts} +9 -9
  176. package/transition-group/TransitionCSS.js +73 -0
  177. package/transition-group/TransitionGroup.d.ts +1 -1
  178. package/transition-group/TransitionGroup.js +2 -2
  179. package/transition-group/{ReplaceTransition.d.ts → TransitionReplace.d.ts} +5 -5
  180. package/transition-group/{ReplaceTransition.js → TransitionReplace.js} +2 -2
  181. package/transition-group/{SwitchTransition.d.ts → TransitionSwitch.d.ts} +10 -10
  182. package/transition-group/{SwitchTransition.js → TransitionSwitch.js} +3 -3
  183. package/transition-group/context.d.ts +2 -0
  184. package/transition-group/context.js +7 -0
  185. package/transition-group/index.d.ts +5 -5
  186. package/transition-group/index.js +6 -6
  187. package/utils/callOrReturn.js +1 -1
  188. package/utils/callbackOriginRef.js +1 -1
  189. package/utils/caseName.js +1 -1
  190. package/utils/className.js +1 -1
  191. package/utils/constant.js +1 -1
  192. package/utils/copy.js +1 -1
  193. package/utils/date.js +1 -1
  194. package/utils/dayjs.d.ts +1 -1
  195. package/utils/dayjs.js +19 -13
  196. package/utils/dom.js +15 -15
  197. package/utils/emitter.js +1 -1
  198. package/utils/fileRead.js +1 -1
  199. package/utils/fileToDataURL.js +1 -1
  200. package/utils/fillNBSP.js +1 -1
  201. package/utils/findRootElement.d.ts +4 -2
  202. package/utils/findRootElement.js +1 -1
  203. package/utils/findScrollParent.js +1 -1
  204. package/utils/getHighlightText.js +1 -1
  205. package/utils/getHotkeyHandler.js +1 -1
  206. package/utils/getScrollBarHeight.d.ts +3 -0
  207. package/utils/getScrollBarHeight.js +7 -0
  208. package/utils/getScrollBarSize.d.ts +3 -0
  209. package/utils/getScrollBarSize.js +10 -0
  210. package/utils/getScrollBarWidth.d.ts +3 -0
  211. package/utils/getScrollBarWidth.js +7 -0
  212. package/utils/getStringLength.js +1 -1
  213. package/utils/include.js +1 -1
  214. package/utils/index.d.ts +3 -0
  215. package/utils/index.js +221 -214
  216. package/utils/intersectionObserver.js +1 -1
  217. package/utils/is.d.ts +6 -6
  218. package/utils/is.js +15 -15
  219. package/utils/keyboardCode.js +1 -1
  220. package/utils/lodash.js +1 -1
  221. package/utils/math.js +1 -1
  222. package/utils/mergeProps.js +1 -1
  223. package/utils/mergedToString.js +1 -1
  224. package/utils/mutationObserver.js +1 -1
  225. package/utils/omit.d.ts +5 -1
  226. package/utils/omit.js +4 -8
  227. package/utils/pad.js +1 -1
  228. package/utils/pick.d.ts +4 -1
  229. package/utils/pick.js +5 -10
  230. package/utils/pinyin.js +1 -1
  231. package/utils/react19Adapter.js +1 -1
  232. package/utils/ref.js +1 -1
  233. package/utils/resizeObserver.js +21 -21
  234. package/utils/saveAs.js +1 -1
  235. package/utils/screenfull.js +1 -1
  236. package/utils/scrollIntoViewIfNeeded.js +1 -1
  237. package/utils/setCreateRoot.js +1 -1
  238. package/utils/setDarkTheme.js +1 -1
  239. package/utils/setDir.js +1 -1
  240. package/utils/setPrimaryColor.js +1 -1
  241. package/utils/setTheme.js +1 -1
  242. package/utils/string.js +1 -1
  243. package/utils/style.js +1 -1
  244. package/utils/throttleByRaf.js +1 -1
  245. package/utils/throttleByRaf2.js +1 -1
  246. package/utils/tinycolor.js +1 -1
  247. package/utils/toArray.js +1 -1
  248. package/utils/tree.js +1 -1
  249. package/utils/tween.js +1 -1
  250. package/utils/uuid.js +1 -1
  251. package/utils/validate.js +1 -1
  252. package/utils/warning.js +1 -1
  253. package/version/index.js +11 -14
  254. package/motion/CSSMotion.d.ts +0 -77
  255. package/motion/CSSMotion.js +0 -76
  256. package/motion/CSSMotionList.d.ts +0 -34
  257. package/motion/CSSMotionList.js +0 -82
  258. package/motion/context.d.ts +0 -9
  259. package/motion/context.js +0 -14
  260. package/motion/hooks/useDomMotionEvents.d.ts +0 -3
  261. package/motion/hooks/useDomMotionEvents.js +0 -19
  262. package/motion/hooks/useNextFrame.d.ts +0 -7
  263. package/motion/hooks/useNextFrame.js +0 -22
  264. package/motion/hooks/useStatus.d.ts +0 -5
  265. package/motion/hooks/useStatus.js +0 -92
  266. package/motion/hooks/useStepQueue.d.ts +0 -8
  267. package/motion/hooks/useStepQueue.js +0 -39
  268. package/motion/index.d.ts +0 -9
  269. package/motion/index.js +0 -9
  270. package/motion/interface.d.ts +0 -22
  271. package/motion/interface.js +0 -6
  272. package/motion/util/diff.d.ts +0 -20
  273. package/motion/util/diff.js +0 -50
  274. package/motion/util/motion.d.ts +0 -10
  275. package/motion/util/motion.js +0 -37
  276. package/transition-group/CSSTransition.js +0 -73
  277. package/transition-group/PqbCSSTransition.d.ts +0 -4
  278. package/transition-group/PqbCSSTransition.js +0 -34
  279. package/transition-group/TransitionGroupContext.d.ts +0 -3
  280. package/transition-group/TransitionGroupContext.js +0 -7
@@ -1,3 +0,0 @@
1
- import type { MotionEvent } from '../interface';
2
- declare function useDomMotionEvents(onInternalMotionEnd: (event: MotionEvent) => void): [(element: HTMLElement) => void, (element: HTMLElement) => void];
3
- export default useDomMotionEvents;
@@ -1,19 +0,0 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
- import { animationEndName as e, transitionEndName as t } from "../util/motion.js";
3
- import n, { useRef as r } from "react";
4
- //#region components/common/motion/hooks/useDomMotionEvents.ts
5
- function i(i) {
6
- let a = r(null);
7
- function o(n) {
8
- n && (n.removeEventListener(t, i), n.removeEventListener(e, i));
9
- }
10
- function s(n) {
11
- a.current && a.current !== n && o(a.current), n && n !== a.current && (n.addEventListener(t, i), n.addEventListener(e, i), a.current = n);
12
- }
13
- return n.useEffect(() => () => {
14
- o(a.current);
15
- }, []), [s, o];
16
- }
17
- //#endregion
18
- export { i as default };
19
- /* 独立思考,明辨是非 */
@@ -1,7 +0,0 @@
1
- declare function useNextFrame(): [
2
- (callback: (info: {
3
- isCanceled: () => boolean;
4
- }) => void) => void,
5
- () => void
6
- ];
7
- export default useNextFrame;
@@ -1,22 +0,0 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
- import e from "react";
3
- //#region components/common/motion/hooks/useNextFrame.ts
4
- function t() {
5
- let t = e.useRef(null);
6
- function n() {
7
- cancelAnimationFrame(t.current);
8
- }
9
- function r(e, i = 2) {
10
- n();
11
- let a = requestAnimationFrame(() => {
12
- i <= 1 ? e({ isCanceled: () => a !== t.current }) : r(e, i - 1);
13
- });
14
- t.current = a;
15
- }
16
- return e.useEffect(() => () => {
17
- n();
18
- }, []), [r, n];
19
- }
20
- //#endregion
21
- export { t as default };
22
- /* 独立思考,明辨是非 */
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import type { CSSMotionProps } from '../CSSMotion';
3
- import type { MotionStatus, StepStatus } from '../interface';
4
- declare function useStatus(supportMotion: boolean, visible: boolean, getElement: () => HTMLElement, { motionEnter, motionAppear, motionLeave, motionDeadline, motionLeaveImmediately, onAppearPrepare, onEnterPrepare, onLeavePrepare, onAppearStart, onEnterStart, onLeaveStart, onAppearActive, onEnterActive, onLeaveActive, onAppearEnd, onEnterEnd, onLeaveEnd, onVisibleChanged, }: CSSMotionProps): [() => MotionStatus, StepStatus, React.CSSProperties, boolean];
5
- export default useStatus;
@@ -1,92 +0,0 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
- import e from "../../hooks/use-event/index.js";
3
- import t from "../../hooks/use-isomorphic-layout-effect/index.js";
4
- import n from "../../hooks/use-safe-state/index.js";
5
- import r from "../../hooks/use-sync-state/index.js";
6
- import { STATUS_APPEAR as i, STATUS_ENTER as a, STATUS_LEAVE as o, STATUS_NONE as s, STEP_ACTIVE as c, STEP_PREPARE as l, STEP_START as u } from "../interface.js";
7
- import d from "./useDomMotionEvents.js";
8
- import f, { isActive as p } from "./useStepQueue.js";
9
- import m, { useEffect as h, useRef as g } from "react";
10
- //#region components/common/motion/hooks/useStatus.ts
11
- function _(_, v, y, { motionEnter: b = !0, motionAppear: x = !0, motionLeave: S = !0, motionDeadline: C, motionLeaveImmediately: ee, onAppearPrepare: te, onEnterPrepare: ne, onLeavePrepare: re, onAppearStart: w, onEnterStart: T, onLeaveStart: E, onAppearActive: D, onEnterActive: O, onLeaveActive: k, onAppearEnd: A, onEnterEnd: j, onLeaveEnd: M, onVisibleChanged: N }) {
12
- let [P, F] = n(), [I, L] = r(s), [R, z] = n(null), B = I(), V = g(!1), H = g(null);
13
- function U() {
14
- return y();
15
- }
16
- let W = g(!1);
17
- function G() {
18
- L(s), z(null, !0);
19
- }
20
- let K = e((e) => {
21
- let t = I();
22
- if (t === "none") return;
23
- let n = U();
24
- if (e && !e.deadline && e.target !== n) return;
25
- let r = W.current, i;
26
- t === "appear" && r ? i = A?.(n, e) : t === "enter" && r ? i = j?.(n, e) : t === "leave" && r && (i = M?.(n, e)), r && i !== !1 && G();
27
- }), [q] = d(K), J = (e) => {
28
- switch (e) {
29
- case i: return {
30
- [l]: te,
31
- [u]: w,
32
- [c]: D
33
- };
34
- case a: return {
35
- [l]: ne,
36
- [u]: T,
37
- [c]: O
38
- };
39
- case o: return {
40
- [l]: re,
41
- [u]: E,
42
- [c]: k
43
- };
44
- default: return {};
45
- }
46
- }, Y = m.useMemo(() => J(B), [B]), [ie, X] = f(B, !_, (e) => {
47
- if (e === "prepare") {
48
- let e = Y[l];
49
- return e ? e(U()) : !1;
50
- }
51
- return X in Y && z(Y[X]?.(U(), null) || null), X === "active" && B !== "none" && (q(U()), C > 0 && (clearTimeout(H.current), H.current = setTimeout(() => {
52
- K({ deadline: !0 });
53
- }, C))), X === "prepared" && G(), !0;
54
- });
55
- W.current = p(X);
56
- let Z = g(null);
57
- t(() => {
58
- if (V.current && Z.current === v) return;
59
- F(v);
60
- let e = V.current;
61
- V.current = !0;
62
- let t;
63
- !e && v && x && (t = i), e && v && b && (t = a), (e && !v && S || !e && ee && !v && S) && (t = o);
64
- let n = J(t);
65
- t && (_ || n.prepare) ? (L(t), ie()) : L(s), Z.current = v;
66
- }, [v]), h(() => {
67
- (B === "appear" && !x || B === "enter" && !b || B === "leave" && !S) && L(s);
68
- }, [
69
- x,
70
- b,
71
- S
72
- ]), h(() => () => {
73
- V.current = !1, clearTimeout(H.current);
74
- }, []);
75
- let Q = m.useRef(!1);
76
- h(() => {
77
- P && (Q.current = !0), P !== void 0 && B === "none" && ((Q.current || P) && N?.(P), Q.current = !0);
78
- }, [P, B]);
79
- let $ = R;
80
- return Y.prepare && X === "start" && ($ = {
81
- transition: "none",
82
- ...$
83
- }), [
84
- I,
85
- X,
86
- $,
87
- P ?? v
88
- ];
89
- }
90
- //#endregion
91
- export { _ as default };
92
- /* 独立思考,明辨是非 */
@@ -1,8 +0,0 @@
1
- import type { MotionStatus, StepStatus } from '../interface';
2
- /** Skip current step */
3
- export declare const SkipStep: false;
4
- /** Current step should be update in */
5
- export declare const DoStep: true;
6
- export declare function isActive(step: StepStatus): step is "end" | "active";
7
- declare function useStepQueue(status: MotionStatus, prepareOnly: boolean, callback: (step: StepStatus) => Promise<void> | void | typeof SkipStep | typeof DoStep): [() => void, StepStatus];
8
- export default useStepQueue;
@@ -1,39 +0,0 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
- import e from "../../hooks/use-isomorphic-layout-effect/index.js";
3
- import t from "../../hooks/use-safe-state/index.js";
4
- import { STEP_ACTIVE as n, STEP_NONE as r, STEP_PREPARE as i, STEP_PREPARED as a, STEP_START as o } from "../interface.js";
5
- import s from "./useNextFrame.js";
6
- import c from "react";
7
- //#region components/common/motion/hooks/useStepQueue.ts
8
- var l = [
9
- i,
10
- o,
11
- n,
12
- "end"
13
- ], u = [i, a];
14
- function d(e) {
15
- return e === "active" || e === "end";
16
- }
17
- function f(n, a, o) {
18
- let [d, f] = t(r), [p, m] = s();
19
- function h() {
20
- f(i, !0);
21
- }
22
- let g = a ? u : l;
23
- return e(() => {
24
- if (d !== "none" && d !== "end") {
25
- let e = g[g.indexOf(d) + 1], t = o(d);
26
- t === !1 ? f(e, !0) : e && p((n) => {
27
- function r() {
28
- n.isCanceled() || f(e, !0);
29
- }
30
- t === !0 ? r() : Promise.resolve(t).then(r);
31
- });
32
- }
33
- }, [n, d]), c.useEffect(() => () => {
34
- m();
35
- }, []), [h, d];
36
- }
37
- //#endregion
38
- export { f as default, d as isActive };
39
- /* 独立思考,明辨是非 */
package/motion/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import type { CSSMotionProps } from './CSSMotion';
2
- import CSSMotion from './CSSMotion';
3
- import type { CSSMotionListProps } from './CSSMotionList';
4
- import CSSMotionList from './CSSMotionList';
5
- import type { MotionEndEventHandler, MotionEventHandler } from './interface';
6
- export { default as Provider } from './context';
7
- export { CSSMotionList };
8
- export type { CSSMotionListProps, CSSMotionProps, MotionEndEventHandler, MotionEventHandler, };
9
- export default CSSMotion;
package/motion/index.js DELETED
@@ -1,9 +0,0 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
- import e from "./context.js";
3
- import t from "./CSSMotion.js";
4
- import n from "./CSSMotionList.js";
5
- //#region components/common/motion/index.tsx
6
- var r = t;
7
- //#endregion
8
- export { n as CSSMotionList, e as Provider, r as default };
9
- /* 独立思考,明辨是非 */
@@ -1,22 +0,0 @@
1
- export declare const STATUS_NONE: "none";
2
- export declare const STATUS_APPEAR: "appear";
3
- export declare const STATUS_ENTER: "enter";
4
- export declare const STATUS_LEAVE: "leave";
5
- export type MotionStatus = typeof STATUS_NONE | typeof STATUS_APPEAR | typeof STATUS_ENTER | typeof STATUS_LEAVE;
6
- export declare const STEP_NONE: "none";
7
- export declare const STEP_PREPARE: "prepare";
8
- export declare const STEP_START: "start";
9
- export declare const STEP_ACTIVE: "active";
10
- export declare const STEP_ACTIVATED: "end";
11
- /**
12
- * Used for disabled motion case.
13
- * Prepare stage will still work but start & active will be skipped.
14
- */
15
- export declare const STEP_PREPARED: "prepared";
16
- export type StepStatus = typeof STEP_NONE | typeof STEP_PREPARE | typeof STEP_START | typeof STEP_ACTIVE | typeof STEP_ACTIVATED | typeof STEP_PREPARED;
17
- export type MotionEvent = (TransitionEvent | AnimationEvent) & {
18
- deadline?: boolean;
19
- };
20
- export type MotionPrepareEventHandler = (element: HTMLElement) => Promise<unknown> | void;
21
- export type MotionEventHandler = (element: HTMLElement, event: MotionEvent) => React.CSSProperties | void;
22
- export type MotionEndEventHandler = (element: HTMLElement, event: MotionEvent) => boolean | void;
@@ -1,6 +0,0 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
- //#region components/common/motion/interface.ts
3
- var e = "none", t = "appear", n = "enter", r = "leave", i = "none", a = "prepare", o = "start", s = "active", c = "prepared";
4
- //#endregion
5
- export { t as STATUS_APPEAR, n as STATUS_ENTER, r as STATUS_LEAVE, e as STATUS_NONE, s as STEP_ACTIVE, i as STEP_NONE, a as STEP_PREPARE, c as STEP_PREPARED, o as STEP_START };
6
- /* 独立思考,明辨是非 */
@@ -1,20 +0,0 @@
1
- export declare const STATUS_ADD: "add";
2
- export declare const STATUS_KEEP: "keep";
3
- export declare const STATUS_REMOVE: "remove";
4
- export declare const STATUS_REMOVED: "removed";
5
- export type DiffStatus = typeof STATUS_ADD | typeof STATUS_KEEP | typeof STATUS_REMOVE | typeof STATUS_REMOVED;
6
- type RawKeyType = string | number;
7
- export interface KeyObject {
8
- key: RawKeyType;
9
- status?: DiffStatus;
10
- }
11
- export declare function wrapKeyToObject(key: React.Key | KeyObject): {
12
- key: string;
13
- status?: DiffStatus;
14
- };
15
- export declare function parseKeys(keys?: never[]): {
16
- key: string;
17
- status?: DiffStatus;
18
- }[];
19
- export declare function diffKeys(prevKeys?: KeyObject[], currentKeys?: KeyObject[]): KeyObject[];
20
- export {};
@@ -1,50 +0,0 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
- import { isObjectLike as e } from "../../utils/is.js";
3
- var t = "keep", n = "remove", r = "removed";
4
- function i(t) {
5
- let n;
6
- return n = t && e(t) && "key" in t ? t : { key: t }, {
7
- ...n,
8
- key: String(n.key)
9
- };
10
- }
11
- function a(e = []) {
12
- return e.map(i);
13
- }
14
- function o(e = [], r = []) {
15
- let i = [], o = 0, s = r.length, c = a(e), l = a(r);
16
- c.forEach((e) => {
17
- let r = !1;
18
- for (let n = o; n < s; n += 1) {
19
- let a = l[n];
20
- if (a.key === e.key) {
21
- o < n && (i = i.concat(l.slice(o, n).map((e) => ({
22
- ...e,
23
- status: "add"
24
- }))), o = n), i.push({
25
- ...a,
26
- status: t
27
- }), o += 1, r = !0;
28
- break;
29
- }
30
- }
31
- r || i.push({
32
- ...e,
33
- status: n
34
- });
35
- }), o < s && (i = i.concat(l.slice(o).map((e) => ({
36
- ...e,
37
- status: "add"
38
- }))));
39
- let u = {};
40
- return i.forEach(({ key: e }) => {
41
- u[e] = (u[e] || 0) + 1;
42
- }), Object.keys(u).filter((e) => u[e] > 1).forEach((e) => {
43
- i = i.filter(({ key: t, status: n }) => t !== e || n !== "remove"), i.forEach((n) => {
44
- n.key === e && (n.status = t);
45
- });
46
- }), i;
47
- }
48
- //#endregion
49
- export { t as STATUS_KEEP, n as STATUS_REMOVE, r as STATUS_REMOVED, o as diffKeys, a as parseKeys };
50
- /* 独立思考,明辨是非 */
@@ -1,10 +0,0 @@
1
- import type { MotionName } from '../CSSMotion';
2
- export declare function getVendorPrefixes(domSupport: boolean, win: object): {
3
- animationend: Record<string, string>;
4
- transitionend: Record<string, string>;
5
- };
6
- export declare function getVendorPrefixedEventName(eventName: string): any;
7
- export declare const supportTransition: boolean;
8
- export declare const animationEndName: any;
9
- export declare const transitionEndName: any;
10
- export declare function getTransitionName(transitionName: MotionName, transitionType: string): any;
@@ -1,37 +0,0 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
- import { isObjectLike as e } from "../../utils/is.js";
3
- import { canUseDOM as t } from "../../utils/dom.js";
4
- //#region components/common/motion/util/motion.ts
5
- function n(e, t) {
6
- let n = {};
7
- return n[e.toLowerCase()] = t.toLowerCase(), n[`Webkit${e}`] = `webkit${t}`, n[`Moz${e}`] = `moz${t}`, n[`ms${e}`] = `MS${t}`, n[`O${e}`] = `o${t.toLowerCase()}`, n;
8
- }
9
- function r(e, t) {
10
- let r = {
11
- animationend: n("Animation", "AnimationEnd"),
12
- transitionend: n("Transition", "TransitionEnd")
13
- };
14
- return e && ("AnimationEvent" in t || delete r.animationend.animation, "TransitionEvent" in t || delete r.transitionend.transition), r;
15
- }
16
- var i = r(t, typeof window < "u" ? window : {}), a = {};
17
- t && ({style: a} = document.createElement("div"));
18
- var o = {};
19
- function s(e) {
20
- if (o[e]) return o[e];
21
- let t = i[e];
22
- if (t) {
23
- let n = Object.keys(t), r = n.length;
24
- for (let i = 0; i < r; i += 1) {
25
- let r = n[i];
26
- if (Object.prototype.hasOwnProperty.call(t, r) && r in a) return o[e] = t[r], o[e];
27
- }
28
- }
29
- return "";
30
- }
31
- var c = s("animationend"), l = s("transitionend"), u = !!(c && l), d = c || "animationend", f = l || "transitionend";
32
- function p(t, n) {
33
- return t ? e(t) ? t[n.replace(/-\w/g, (e) => e[1].toUpperCase())] : `${t}-${n}` : null;
34
- }
35
- //#endregion
36
- export { d as animationEndName, p as getTransitionName, u as supportTransition, f as transitionEndName };
37
- /* 独立思考,明辨是非 */
@@ -1,73 +0,0 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
- import { isFunction as e, isString as t } from "../utils/is.js";
3
- import { forceReflow as n } from "../utils/dom.js";
4
- import r from "../utils/findRootElement.js";
5
- import i from "./Transition.js";
6
- import a from "react";
7
- import { jsx as o } from "react/jsx-runtime";
8
- //#region components/common/transition-group/CSSTransition.tsx
9
- function s(e, n, r = "add") {
10
- e instanceof Element && n && t(n) && n.split(" ").filter(Boolean).forEach((t, n, i) => {
11
- e.classList[r](t);
12
- });
13
- }
14
- var c = class extends a.Component {
15
- constructor(...n) {
16
- super(...n), this.appliedClasses = {
17
- appear: {},
18
- enter: {},
19
- exit: {}
20
- }, this.onEnter = (t, n) => {
21
- let [r, i] = this.resolveArguments(t, n);
22
- this.removeClasses(r, "exit"), this.addClass(r, i ? "appear" : "enter", "base"), e(this.props.onEnter) && this.props.onEnter(r, n);
23
- }, this.onEntering = (t, n) => {
24
- let [r, i] = this.resolveArguments(t, n), a = i ? "appear" : "enter";
25
- this.addClass(r, a, "active"), e(this.props.onEntering) && this.props.onEntering(r, n);
26
- }, this.onEntered = (t, n) => {
27
- let [r, i] = this.resolveArguments(t, n), a = i ? "appear" : "enter";
28
- this.removeClasses(r, a), this.addClass(r, a, "done"), e(this.props.onEntered) && this.props.onEntered(r, n);
29
- }, this.onExit = (t) => {
30
- let [n] = this.resolveArguments(t);
31
- this.removeClasses(n, "appear"), this.removeClasses(n, "enter"), this.addClass(n, "exit", "base"), e(this.props.onExit) && this.props.onExit(n);
32
- }, this.onExiting = (t) => {
33
- let [n] = this.resolveArguments(t);
34
- this.addClass(n, "exit", "active"), e(this.props.onExiting) && this.props.onExiting(n);
35
- }, this.onExited = (t) => {
36
- let [n] = this.resolveArguments(t);
37
- this.removeClasses(n, "exit"), this.addClass(n, "exit", "done"), e(this.props.onExited) && this.props.onExited(n);
38
- }, this.resolveArguments = (e, t) => [r(this.props.refElement) || e, t], this.getClassNames = (e) => {
39
- let { classNames: n } = this.props, r = t(n), i = r && n ? `${n}-` : "", a = r ? `${i}${e}` : n[e];
40
- return {
41
- baseClassName: a,
42
- activeClassName: r ? `${a}-active` : n[`${e}Active`],
43
- doneClassName: r ? `${a}-done` : n[`${e}Done`]
44
- };
45
- };
46
- }
47
- static {
48
- this.defaultProps = { classNames: "" };
49
- }
50
- addClass(e, t, r) {
51
- let i = this.getClassNames(t)[`${r}ClassName`], { doneClassName: a } = this.getClassNames("enter");
52
- t === "appear" && r === "done" && a && (i += ` ${a}`), r === "active" && e && n(e), i && (this.appliedClasses[t][r] = i, s(e, i, "add"));
53
- }
54
- removeClasses(e, t) {
55
- let { base: n, active: r, done: i } = this.appliedClasses[t];
56
- this.appliedClasses[t] = {}, n && s(e, n, "remove"), r && s(e, r, "remove"), i && s(e, i, "remove");
57
- }
58
- render() {
59
- let { classNames: e, ...t } = this.props;
60
- return /* @__PURE__ */ o(i, {
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 { c as default };
73
- /* 独立思考,明辨是非 */
@@ -1,4 +0,0 @@
1
- import CSSTransition from './CSSTransition';
2
- declare function PqbCSSTransition(props: CSSTransition): import("react/jsx-runtime").JSX.Element;
3
- export { PqbCSSTransition };
4
- export default PqbCSSTransition;
@@ -1,34 +0,0 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
- import { isUndefined as e } from "../utils/is.js";
3
- import { supportRef as t } from "../utils/ref.js";
4
- import n from "../utils/findRootElement.js";
5
- import { callbackOriginRef as r } from "../utils/callbackOriginRef.js";
6
- import i from "./CSSTransition.js";
7
- import { cloneElement as a, isValidElement as o, useMemo as s, useRef as c } from "react";
8
- import { jsx as l } from "react/jsx-runtime";
9
- //#region components/common/transition-group/PqbCSSTransition.tsx
10
- function u(u) {
11
- let { children: d, ...f } = u, p = c(void 0), m = c(void 0), h = s(() => e(u.refElement) && t(d) && o(d) ? (m.current = !0, a(d, { ref(e) {
12
- p.current = n(e), r(d, e);
13
- } })) : (m.current = !1, d), [d, u.refElement]);
14
- return m.current && [
15
- "onEnter",
16
- "onEntering",
17
- "onEntered",
18
- "onExit",
19
- "onExiting",
20
- "onExited"
21
- ].forEach((e) => {
22
- let t = u[e];
23
- t && (f[e] = (e, ...n) => {
24
- t(p.current || e, ...n);
25
- });
26
- }), /* @__PURE__ */ l(i, {
27
- ...f,
28
- refElement: m.current ? p : void 0,
29
- children: h
30
- });
31
- }
32
- //#endregion
33
- export { u as PqbCSSTransition, u as default };
34
- /* 独立思考,明辨是非 */
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const _default: React.Context<null>;
3
- export default _default;
@@ -1,7 +0,0 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
- import e from "react";
3
- //#region components/common/transition-group/TransitionGroupContext.ts
4
- var t = e.createContext(null);
5
- //#endregion
6
- export { t as default };
7
- /* 独立思考,明辨是非 */