@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
@@ -1,76 +0,0 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
- import { isObjectLike as e, isString as t } from "../utils/is.js";
3
- import { getReactElementRef as n, supportRef as r } from "../utils/ref.js";
4
- import i from "../utils/findRootElement.js";
5
- import a from "../utils/className.js";
6
- import { Context as o } from "./context.js";
7
- import { STATUS_NONE as s } from "./interface.js";
8
- import { getTransitionName as c, supportTransition as l } from "./util/motion.js";
9
- import { isActive as u } from "./hooks/useStepQueue.js";
10
- import d from "./hooks/useStatus.js";
11
- import f, { useRef as p } from "react";
12
- //#region components/common/motion/CSSMotion.tsx
13
- function m(l) {
14
- let m = l;
15
- e(l) && ({transitionSupport: m} = l);
16
- function h(e, t) {
17
- return !!(e.motionName && m && t !== !1);
18
- }
19
- let g = f.forwardRef((e, l) => {
20
- let { visible: m = !0, removeOnLeave: g = !0, forceRender: _, children: v, motionName: y, leavedClassName: b, eventProps: x } = e, { motion: S } = f.useContext(o), C = h(e, S), w = p(null);
21
- function T() {
22
- return i(w);
23
- }
24
- let [E, D, O, k] = d(C, m, T, e), A = E(), j = f.useRef(k);
25
- k && (j.current = !0);
26
- let M = f.useMemo(() => {
27
- let e = {};
28
- return Object.defineProperties(e, {
29
- nativeElement: {
30
- enumerable: !0,
31
- get: T
32
- },
33
- inMotion: {
34
- enumerable: !0,
35
- get: () => () => E() !== s
36
- },
37
- enableMotion: {
38
- enumerable: !0,
39
- get: () => () => C
40
- }
41
- }), e;
42
- }, []);
43
- f.useImperativeHandle(l, () => M, []);
44
- let N, P = {
45
- ...x,
46
- visible: m
47
- };
48
- if (!v) N = null;
49
- else if (A === "none") N = k ? v({ ...P }, w) : !g && j.current && b ? v({
50
- ...P,
51
- className: b
52
- }, w) : _ || !g && !b ? v({
53
- ...P,
54
- style: { display: "none" }
55
- }, w) : null;
56
- else {
57
- let e;
58
- D === "prepare" ? e = "prepare" : u(D) ? e = "active" : D === "start" && (e = "start");
59
- let n = c(y, `${A}-${e}`);
60
- N = v({
61
- ...P,
62
- className: a(c(y, A), {
63
- [n]: n && e,
64
- [y]: t(y)
65
- }),
66
- style: O
67
- }, w);
68
- }
69
- return f.isValidElement(N) && r(N) && (n(N) || (N = f.cloneElement(N, { ref: w }))), N;
70
- });
71
- return g.displayName = "CSSMotion", g;
72
- }
73
- var h = m(l);
74
- //#endregion
75
- export { h as default, m as genCSSMotion };
76
- /* 独立思考,明辨是非 */
@@ -1,34 +0,0 @@
1
- import React from 'react';
2
- import type { CSSMotionProps } from './CSSMotion';
3
- import type { KeyObject } from './util/diff';
4
- export interface CSSMotionListProps extends Omit<CSSMotionProps, 'onVisibleChanged' | 'children'>, Omit<React.HTMLAttributes<unknown>, 'children'> {
5
- keys: (React.Key | {
6
- key: React.Key;
7
- [name: string]: unknown;
8
- })[];
9
- component?: string | React.ComponentType | false;
10
- /** This will always trigger after final visible changed. Even if no motion configured. */
11
- onVisibleChanged?: (visible: boolean, info: {
12
- key: React.Key;
13
- }) => void;
14
- /** All motion leaves in the screen */
15
- onAllRemoved?: () => void;
16
- children?: (props: {
17
- visible?: boolean;
18
- className?: string;
19
- style?: React.CSSProperties;
20
- index?: number;
21
- [key: string]: unknown;
22
- }, ref: React.Ref<unknown>) => React.ReactElement;
23
- }
24
- export interface CSSMotionListState {
25
- keyEntities: KeyObject[];
26
- }
27
- /**
28
- * Generate a CSSMotionList component with config
29
- * @param transitionSupport No need since CSSMotionList no longer depends on transition support
30
- * @param CSSMotion CSSMotion component
31
- */
32
- export declare function genCSSMotionList(transitionSupport: boolean, CSSMotion?: React.ForwardRefExoticComponent<CSSMotionProps & React.RefAttributes<import("./CSSMotion").CSSMotionRef>>): React.ComponentClass<CSSMotionListProps>;
33
- declare const _default: React.ComponentClass<CSSMotionListProps, any>;
34
- export default _default;
@@ -1,82 +0,0 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
- import { supportTransition as e } from "./util/motion.js";
3
- import t from "./CSSMotion.js";
4
- import { STATUS_REMOVED as n, diffKeys as r, parseKeys as i } from "./util/diff.js";
5
- import a, { createElement as o } from "react";
6
- import { jsx as s } from "react/jsx-runtime";
7
- //#region components/common/motion/CSSMotionList.tsx
8
- var c = [
9
- "eventProps",
10
- "visible",
11
- "children",
12
- "motionName",
13
- "motionAppear",
14
- "motionEnter",
15
- "motionLeave",
16
- "motionLeaveImmediately",
17
- "motionDeadline",
18
- "removeOnLeave",
19
- "leavedClassName",
20
- "onAppearPrepare",
21
- "onAppearStart",
22
- "onAppearActive",
23
- "onAppearEnd",
24
- "onEnterStart",
25
- "onEnterActive",
26
- "onEnterEnd",
27
- "onLeaveStart",
28
- "onLeaveActive",
29
- "onLeaveEnd"
30
- ];
31
- function l(e, l = t) {
32
- class u extends a.Component {
33
- constructor(...e) {
34
- super(...e), this.state = { keyEntities: [] }, this.removeKey = (e) => {
35
- this.setState((t) => ({ keyEntities: t.keyEntities.map((t) => t.key === e ? {
36
- ...t,
37
- status: n
38
- } : t) }), () => {
39
- let { keyEntities: e } = this.state;
40
- e.filter(({ status: e }) => e !== "removed").length === 0 && this.props.onAllRemoved && this.props.onAllRemoved();
41
- });
42
- };
43
- }
44
- static {
45
- this.defaultProps = { component: "div" };
46
- }
47
- static getDerivedStateFromProps({ keys: e }, { keyEntities: t }) {
48
- return { keyEntities: r(t, i(e)).filter((e) => {
49
- let n = t.find(({ key: t }) => e.key === t);
50
- return !(n && n.status === "removed" && e.status === "remove");
51
- }) };
52
- }
53
- render() {
54
- let { keyEntities: e } = this.state, { component: t, children: n, onVisibleChanged: r, onAllRemoved: i, ...u } = this.props, d = t || a.Fragment, f = {};
55
- return c.forEach((e) => {
56
- f[e] = u[e], delete u[e];
57
- }), delete u.keys, /* @__PURE__ */ s(d, {
58
- ...u,
59
- children: e.map(({ status: e, ...t }, i) => {
60
- let a = e === "add" || e === "keep";
61
- return /* @__PURE__ */ o(l, {
62
- ...f,
63
- key: t.key,
64
- visible: a,
65
- eventProps: t,
66
- onVisibleChanged: (e) => {
67
- r?.(e, { key: t.key }), e || this.removeKey(t.key);
68
- }
69
- }, (e, t) => n({
70
- ...e,
71
- index: i
72
- }, t));
73
- })
74
- });
75
- }
76
- }
77
- return u;
78
- }
79
- var u = l(e);
80
- //#endregion
81
- export { u as default, l as genCSSMotionList };
82
- /* 独立思考,明辨是非 */
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- interface MotionContextProps {
3
- motion?: boolean;
4
- }
5
- export declare const Context: React.Context<MotionContextProps>;
6
- export default function MotionProvider({ children, ...props }: MotionContextProps & {
7
- children?: React.ReactNode;
8
- }): import("react/jsx-runtime").JSX.Element;
9
- export {};
package/motion/context.js DELETED
@@ -1,14 +0,0 @@
1
- /* 潘启宝 2026-03-24 15:26:24 星期二 */
2
- import e from "react";
3
- import { jsx as t } from "react/jsx-runtime";
4
- //#region components/common/motion/context.tsx
5
- var n = e.createContext({});
6
- function r({ children: e, ...r }) {
7
- return /* @__PURE__ */ t(n.Provider, {
8
- value: r,
9
- children: e
10
- });
11
- }
12
- //#endregion
13
- export { n as Context, r as default };
14
- /* 独立思考,明辨是非 */
@@ -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
- /* 独立思考,明辨是非 */