@unicom-cloud/ui-common 0.1.20 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/.virtual/_rolldown/runtime.js +1 -1
  2. package/.vite/manifest.json +40 -10
  3. package/development/index.js +1 -1
  4. package/development/interface.d.ts +1 -1
  5. package/empty/index.js +1 -1
  6. package/empty/interface.d.ts +1 -1
  7. package/flex/index.js +1 -1
  8. package/flex/utils.js +1 -1
  9. package/higher-order/index.js +1 -1
  10. package/higher-order/with-speech-synthesis/index.js +1 -1
  11. package/hooks/create-deep-compare-effect/index.js +1 -1
  12. package/hooks/create-update-effect/index.js +1 -1
  13. package/hooks/create-use-storage-state/index.js +1 -1
  14. package/hooks/index.js +1 -1
  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.js +1 -1
  18. package/hooks/use-computed-state/index.js +1 -1
  19. package/hooks/use-controllable-value/index.js +1 -1
  20. package/hooks/use-cookie-state/index.js +1 -1
  21. package/hooks/use-count-down/index.js +1 -1
  22. package/hooks/use-counter/index.js +1 -1
  23. package/hooks/use-create/index.js +1 -1
  24. package/hooks/use-creation/index.js +1 -1
  25. package/hooks/use-debounce/index.js +1 -1
  26. package/hooks/use-debounce-effect/index.js +1 -1
  27. package/hooks/use-debounce-fn/index.js +1 -1
  28. package/hooks/use-deep-compare-effect/index.js +1 -1
  29. package/hooks/use-deep-compare-layout-effect/index.js +1 -1
  30. package/hooks/use-document-visibility/index.js +1 -1
  31. package/hooks/use-drag/index.js +1 -1
  32. package/hooks/use-drop/index.js +3 -3
  33. package/hooks/use-effect-event/index.js +13 -12
  34. package/hooks/use-event/index.js +1 -1
  35. package/hooks/use-event-emitter/index.js +1 -1
  36. package/hooks/use-event-listener/index.js +1 -1
  37. package/hooks/use-event-target/index.js +1 -1
  38. package/hooks/use-external/index.js +1 -1
  39. package/hooks/use-favicon/index.js +1 -1
  40. package/hooks/use-focus-within/index.js +1 -1
  41. package/hooks/use-force-update/index.js +1 -1
  42. package/hooks/use-fullscreen/index.js +1 -1
  43. package/hooks/use-get-state/index.js +1 -1
  44. package/hooks/use-history-travel/index.js +1 -1
  45. package/hooks/use-hover/index.js +1 -1
  46. package/hooks/use-id/index.js +1 -1
  47. package/hooks/use-in-view/index.js +1 -1
  48. package/hooks/use-in-viewport/index.js +1 -1
  49. package/hooks/use-infinite-scroll/index.js +54 -53
  50. package/hooks/use-intersection-observer/index.js +1 -1
  51. package/hooks/use-intersection-observers/index.js +1 -1
  52. package/hooks/use-interval/index.js +1 -1
  53. package/hooks/use-is-first-render/index.js +1 -1
  54. package/hooks/use-isomorphic-layout-effect/index.js +1 -1
  55. package/hooks/use-key-press/index.js +1 -1
  56. package/hooks/use-keyboard-event/index.js +1 -1
  57. package/hooks/use-latest/index.js +1 -1
  58. package/hooks/use-listen-window-resize/index.js +1 -1
  59. package/hooks/use-local-storage-state/index.js +1 -1
  60. package/hooks/use-lock-fn/index.js +1 -1
  61. package/hooks/use-long-press/index.js +1 -1
  62. package/hooks/use-map/index.js +1 -1
  63. package/hooks/use-media/index.js +12 -11
  64. package/hooks/use-memo/index.js +1 -1
  65. package/hooks/use-memoized-fn/index.js +1 -1
  66. package/hooks/use-merge-props/index.js +1 -1
  67. package/hooks/use-merge-value/index.js +1 -1
  68. package/hooks/use-mobile/index.js +1 -1
  69. package/hooks/use-mount/index.js +1 -1
  70. package/hooks/use-mouse/index.js +1 -1
  71. package/hooks/use-move/index.js +1 -1
  72. package/hooks/use-mutation-observer/index.js +1 -1
  73. package/hooks/use-mutation-observers/index.js +1 -1
  74. package/hooks/use-network/index.js +1 -1
  75. package/hooks/use-online-status/index.js +1 -1
  76. package/hooks/use-overflow-hidden/index.js +2 -2
  77. package/hooks/use-override-ref/index.js +1 -1
  78. package/hooks/use-pagination/index.js +1 -1
  79. package/hooks/use-paste-image/index.js +1 -1
  80. package/hooks/use-persist-callback/index.js +1 -1
  81. package/hooks/use-prefers-color-scheme-dark/index.js +1 -1
  82. package/hooks/use-previous/index.js +1 -1
  83. package/hooks/use-raf-interval/index.js +1 -1
  84. package/hooks/use-raf-state/index.js +1 -1
  85. package/hooks/use-raf-timeout/index.js +1 -1
  86. package/hooks/use-reactive/index.js +1 -1
  87. package/hooks/use-ref-latest/index.js +1 -1
  88. package/hooks/use-refs/index.js +13 -13
  89. package/hooks/use-request/index.js +1 -1
  90. package/hooks/use-request/src/Fetch.js +1 -1
  91. package/hooks/use-request/src/plugins/useAutoRunPlugin.js +1 -1
  92. package/hooks/use-request/src/plugins/useCachePlugin.js +1 -1
  93. package/hooks/use-request/src/plugins/useDebouncePlugin.js +20 -19
  94. package/hooks/use-request/src/plugins/useLoadingDelayPlugin.js +1 -1
  95. package/hooks/use-request/src/plugins/usePollingPlugin.js +1 -1
  96. package/hooks/use-request/src/plugins/useRefreshOnWindowFocusPlugin.js +1 -1
  97. package/hooks/use-request/src/plugins/useRetryPlugin.js +1 -1
  98. package/hooks/use-request/src/plugins/useThrottlePlugin.js +18 -17
  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 +1 -1
  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 +11 -9
  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/icons/file/interface.d.ts +1 -1
  159. package/index.js +586 -579
  160. package/interface.d.ts +3 -0
  161. package/package.json +1 -1
  162. package/progress/index.js +1 -1
  163. package/resize-observer/Collection.js +1 -1
  164. package/resize-observer/SingleObserver.js +1 -1
  165. package/resize-observer/index.js +1 -1
  166. package/resize-observer/observerUtil.js +1 -1
  167. package/space/index.js +49 -48
  168. package/space/interface.d.ts +1 -1
  169. package/suspense-fallback-test/index.js +1 -1
  170. package/test.js +1 -1
  171. package/timer/index.js +25 -23
  172. package/timer/interface.d.ts +1 -1
  173. package/transition/Transition.js +71 -61
  174. package/transition/TransitionCSS.js +32 -23
  175. package/transition/TransitionGroup.d.ts +3 -3
  176. package/transition/TransitionGroup.js +44 -49
  177. package/transition/TransitionStyle.js +29 -38
  178. package/transition/constants.d.ts +8 -2
  179. package/transition/constants.js +32 -30
  180. package/transition/index.d.ts +3 -5
  181. package/transition/index.js +9 -9
  182. package/transition/interface.d.ts +22 -17
  183. package/transition/utils.d.ts +2 -1
  184. package/transition/utils.js +69 -67
  185. package/utils/callOrReturn.js +1 -1
  186. package/utils/callbackOriginRef.js +1 -1
  187. package/utils/caseName.js +1 -1
  188. package/utils/className.js +1 -1
  189. package/utils/constant.d.ts +2 -0
  190. package/utils/constant.js +3 -3
  191. package/utils/copy.js +1 -1
  192. package/utils/date.js +1 -1
  193. package/utils/dayjs.js +1 -1
  194. package/utils/dom.js +1 -1
  195. package/utils/emitter.js +1 -1
  196. package/utils/fileRead.js +1 -1
  197. package/utils/fileToDataURL.js +1 -1
  198. package/utils/fillNBSP.js +1 -1
  199. package/utils/findRootElement.d.ts +1 -1
  200. package/utils/findRootElement.js +1 -1
  201. package/utils/findScrollParent.js +1 -1
  202. package/utils/getHighlightText.js +2 -2
  203. package/utils/getHotkeyHandler.js +1 -1
  204. package/utils/getScrollBarHeight.js +1 -1
  205. package/utils/getScrollBarSize.js +16 -6
  206. package/utils/getScrollBarWidth.js +1 -1
  207. package/utils/getStringLength.js +1 -1
  208. package/utils/include.js +1 -1
  209. package/utils/index.js +289 -282
  210. package/utils/intersectionObserver.js +1 -1
  211. package/utils/is.d.ts +2 -2
  212. package/utils/is.js +15 -15
  213. package/utils/keyboardCode.js +1 -1
  214. package/utils/lodash.js +1 -1
  215. package/utils/math.js +1 -1
  216. package/utils/mergeProps.js +8 -7
  217. package/utils/mergedToString.js +1 -1
  218. package/utils/mutationObserver.js +1 -1
  219. package/utils/omit.js +1 -1
  220. package/utils/pad.js +1 -1
  221. package/utils/pick.js +1 -1
  222. package/utils/pinyin.js +1 -1
  223. package/utils/react19Adapter.js +1 -1
  224. package/utils/ref.js +1 -1
  225. package/utils/resizeObserver.js +1 -1
  226. package/utils/saveAs.js +1 -1
  227. package/utils/screenfull.js +1 -1
  228. package/utils/scrollIntoViewIfNeeded.js +1 -1
  229. package/utils/setCreateRoot.js +1 -1
  230. package/utils/setDarkTheme.js +1 -1
  231. package/utils/setDir.js +1 -1
  232. package/utils/setPrimaryColor.js +1 -1
  233. package/utils/setTheme.js +1 -1
  234. package/utils/string.js +1 -1
  235. package/utils/style.js +1 -1
  236. package/utils/throttleByRaf.js +1 -1
  237. package/utils/throttleByRaf2.js +1 -1
  238. package/utils/tinycolor.js +1 -1
  239. package/utils/toArray.js +1 -1
  240. package/utils/tree.js +1 -1
  241. package/utils/tween.js +1 -1
  242. package/utils/uuid.js +1 -1
  243. package/utils/validate.js +1 -1
  244. package/utils/warning.js +1 -1
  245. package/version/index.js +8 -8
package/interface.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export type RootElementRef = {
2
+ getRootElement: () => HTMLElement | null;
3
+ };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@unicom-cloud/ui-common","version":"0.1.20","dependencies":{"@unicom-cloud/utils":"^0.1.0","@unicom-cloud/icons":"^0.1.0"},"peerDependencies":{"dayjs":"^1.11.19","lodash":"^4.18.1","react":"^18.3.1","react-dom":"^18.3.1","react-is":"^18.3.1"},"type":"module","types":"types/index.d.ts","main":"./index.js","bin":{"ui":"./test.js"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
1
+ {"name":"@unicom-cloud/ui-common","version":"0.1.21","dependencies":{"@unicom-cloud/utils":"^0.1.0","@unicom-cloud/icons":"^0.1.0"},"peerDependencies":{"dayjs":"^1.11.19","lodash":"^4.18.1","react":"^18.3.1","react-dom":"^18.3.1","react-is":"^18.3.1"},"type":"module","types":"types/index.d.ts","main":"./index.js","bin":{"ui":"./test.js"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
package/progress/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-04-14 16:51:31 星期二 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  import { isNumber as e, isUndefined as t } from "../utils/is.js";
3
3
  import { UI_COMMON_PREFIX as n } from "@unicom-cloud/utils/constant/ui";
4
4
  //#region components/common/progress/index.js
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-04-14 16:51:31 星期二 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  import e from "react";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
4
  //#region components/common/resize-observer/Collection.tsx
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-04-14 16:51:31 星期二 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  import { isFunction as e } from "../utils/is.js";
3
3
  import { getReactElementRef as t, supportRef as n, useComposeRef as r } from "../utils/ref.js";
4
4
  import i from "../utils/findRootElement.js";
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-04-14 16:51:31 星期二 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  import { isFunction as e } from "../utils/is.js";
3
3
  import t from "../utils/toArray.js";
4
4
  import { Collection as n } from "./Collection.js";
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-04-14 16:51:31 星期二 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  //#region components/common/resize-observer/observerUtil.ts
3
3
  var e = /* @__PURE__ */ new Map();
4
4
  function t(t) {
package/space/index.js CHANGED
@@ -1,73 +1,74 @@
1
- /* 潘启宝 2026-04-14 16:51:31 星期二 */
2
- import e from "../hooks/use-merge-props/index.js";
3
- import t from "../utils/className.js";
4
- import n from "../utils/toArray.js";
5
- import r from "../flex/index.js";
6
- import { Fragment as i, forwardRef as a, useImperativeHandle as o, useRef as s } from "react";
7
- import { UI_COMMON_PREFIX as c } from "@unicom-cloud/utils/constant/ui";
8
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
+ import { isPresent as e } from "../utils/is.js";
3
+ import t from "../hooks/use-merge-props/index.js";
4
+ import n from "../utils/className.js";
5
+ import r from "../utils/toArray.js";
6
+ import i from "../flex/index.js";
7
+ import { Fragment as a, forwardRef as o, useImperativeHandle as s, useRef as c } from "react";
8
+ import { UI_COMMON_PREFIX as l } from "@unicom-cloud/utils/constant/ui";
9
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
10
  //#region components/common/space/index.tsx
10
- var d = {
11
+ var f = {
11
12
  gap: "small",
12
13
  direction: "horizontal"
13
14
  };
14
- function f(a, f) {
15
- let { className: p, style: m, children: h, size: g, gap: _, direction: v, justifyContent: y, align: b, alignItems: x, wrap: S, separator: C, rtl: w, legacy: T, ...E } = e(a, d, {}), D = `${c}-space`, O = [
15
+ function p(o, p) {
16
+ let { className: m, style: h, children: g, size: _, gap: v, direction: y, justifyContent: b, align: x, alignItems: S, wrap: C, separator: w, rtl: T, legacy: E, ...D } = t(o, f, {}), O = `${l}-space`, k = [
16
17
  "horizontal",
17
18
  "row-reverse",
18
19
  "row"
19
- ].includes(v);
20
+ ].includes(y);
20
21
  [
21
22
  "vertical",
22
23
  "column-reverse",
23
24
  "column"
24
- ].includes(v);
25
- let k = {
25
+ ].includes(y);
26
+ let A = {
26
27
  horizontal: "row",
27
28
  vertical: "column"
28
- }[v] ?? v, A = T ? {
29
+ }[y] ?? y, j = E ? {
29
30
  start: "flex-start",
30
31
  end: "flex-end"
31
- } : {}, j = A[y] ?? y, M = x ?? b ?? (O ? "center" : void 0);
32
- M = A[M] ?? M;
33
- let N = t(D, {
34
- [`${D}-${v}`]: v,
35
- [`${D}-justify-content-${j}`]: j,
36
- [`${D}-align-items-${M}`]: M,
37
- [`${D}-rtl`]: w
38
- }, S ? `${D}-wrap` : `${D}-no-wrap`, p), P = n(h), F = s(null);
39
- return o(f, () => ({ getRootElement() {
40
- return F.current.getRootElement();
41
- } })), /* @__PURE__ */ l(r, {
42
- ref: F,
43
- style: m,
44
- className: N,
45
- gap: _ ?? g,
46
- wrap: S,
47
- justifyContent: j,
48
- alignItems: M,
49
- direction: k,
50
- rtl: w,
32
+ } : {}, M = j[b] ?? b, N = S ?? x ?? (k ? "center" : void 0);
33
+ N = j[N] ?? N;
34
+ let P = n(O, {
35
+ [`${O}-${y}`]: y,
36
+ [`${O}-justify-content-${M}`]: M,
37
+ [`${O}-align-items-${N}`]: N,
38
+ [`${O}-rtl`]: T
39
+ }, C ? `${O}-wrap` : `${O}-no-wrap`, m), F = r(g), I = c(null);
40
+ return s(p, () => ({ getRootElement() {
41
+ return I.current.getRootElement();
42
+ } })), /* @__PURE__ */ u(i, {
43
+ ref: I,
44
+ style: h,
45
+ className: P,
46
+ gap: v ?? _,
47
+ wrap: C,
48
+ justifyContent: M,
49
+ alignItems: N,
50
+ direction: A,
51
+ rtl: T,
51
52
  inline: !0,
52
- ...E,
53
- children: P.map((e, t) => {
54
- let n = e?.key ?? t;
55
- return /* @__PURE__ */ u(i, { children: [C != null && t > 0 && /* @__PURE__ */ l("div", {
56
- className: `${D}-item-separator`,
57
- children: C
58
- }), /* @__PURE__ */ l("div", {
59
- className: `${D}-item`,
60
- children: e
61
- })] }, n);
53
+ ...D,
54
+ children: F.map((t, n) => {
55
+ let r = t?.key ?? n;
56
+ return /* @__PURE__ */ d(a, { children: [e(w) && n > 0 && /* @__PURE__ */ u("div", {
57
+ className: `${O}-item-separator`,
58
+ children: w
59
+ }), /* @__PURE__ */ u("div", {
60
+ className: `${O}-item`,
61
+ children: t
62
+ })] }, r);
62
63
  })
63
64
  });
64
65
  }
65
- var p = a(f), m = a((e, t) => /* @__PURE__ */ l(p, {
66
+ var m = o(p), h = o((e, t) => /* @__PURE__ */ u(m, {
66
67
  ...e,
67
68
  ref: t,
68
69
  direction: "vertical"
69
70
  }));
70
- m.displayName = "SpaceVertical", p.Vertical = m;
71
+ h.displayName = "SpaceVertical", m.Vertical = h;
71
72
  //#endregion
72
- export { m as SpaceVertical, p as default };
73
+ export { h as SpaceVertical, m as default };
73
74
  /* 独立思考,明辨是非 */
@@ -5,7 +5,7 @@ export type JustifyContent = 'start' | 'end' | 'center' | 'space-between';
5
5
  export type Direction = 'vertical' | 'horizontal';
6
6
  export interface SpaceProps {
7
7
  style?: CSSProperties;
8
- className?: string | string[];
8
+ className?: string;
9
9
  /**
10
10
  * @zh 交叉轴方向对齐方式
11
11
  * @deprecated 请用 alignItems 属性替代
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-04-14 16:51:31 星期二 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  import e from "react";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
4
  var n = e.forwardRef((n, r) => /* @__PURE__ */ t(e.useMemo(() => e.lazy(() => new Promise(() => {})), []), {}));
package/test.js CHANGED
@@ -1,4 +1,4 @@
1
- /* 潘启宝 2026-04-14 16:51:31 星期二 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  //#region components/common/test.js
3
3
  console.log("我是潘启宝");
4
4
  //#endregion
package/timer/index.js CHANGED
@@ -1,37 +1,39 @@
1
- /* 潘启宝 2026-04-14 16:51:31 星期二 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  import { isFunction as e } from "../utils/is.js";
3
- import t from "../utils/className.js";
4
- import { forwardRef as n, useEffect as r, useImperativeHandle as i, useRef as a, useState as o } from "react";
5
- import s from "dayjs";
6
- import { UI_COMMON_PREFIX as c } from "@unicom-cloud/utils/constant/ui";
7
- import { jsx as l } from "react/jsx-runtime";
3
+ import { DAYJS_DEFAULT_FORMAT_WITH_TIME as t } from "../utils/constant.js";
4
+ import n from "../utils/className.js";
5
+ import "../utils/index.js";
6
+ import { forwardRef as r, useEffect as i, useImperativeHandle as a, useRef as o, useState as s } from "react";
7
+ import c from "dayjs";
8
+ import { UI_COMMON_PREFIX as l } from "@unicom-cloud/utils/constant/ui";
9
+ import { jsx as u } from "react/jsx-runtime";
8
10
  //#region components/common/timer/index.tsx
9
- function u(n, u) {
10
- let { style: d, className: f, format: p = "YYYY-MM-DD HH:mm:ss dddd", callback: m, ...h } = n, g = `${c}-timer`, [_, v] = o({ time: y() });
11
- function y() {
12
- return s().format(p);
11
+ function d(r, d) {
12
+ let { style: f, className: p, format: m = `${t} dddd`, callback: h, ...g } = r, _ = `${l}-timer`, [v, y] = s({ time: b() });
13
+ function b() {
14
+ return c().format(m);
13
15
  }
14
- r(() => {
16
+ i(() => {
15
17
  let t = n();
16
- function n(r = y()) {
17
- return e(m) && m(r), window.requestAnimationFrame(() => {
18
- v({ time: r }), t = n();
18
+ function n(r = b()) {
19
+ return e(h) && h(r), window.requestAnimationFrame(() => {
20
+ y({ time: r }), t = n();
19
21
  });
20
22
  }
21
23
  return () => {
22
24
  window.cancelAnimationFrame(t);
23
25
  };
24
26
  }, []);
25
- let b = a(null);
26
- return i(u, () => ({ getRootElement() {
27
- return b.current;
28
- } })), /* @__PURE__ */ l("div", {
29
- ref: b,
30
- className: t(g, f),
31
- children: _.time
27
+ let x = o(null);
28
+ return a(d, () => ({ getRootElement() {
29
+ return x.current;
30
+ } })), /* @__PURE__ */ u("div", {
31
+ ref: x,
32
+ className: n(_, p),
33
+ children: v.time
32
34
  });
33
35
  }
34
- var d = n(u);
36
+ var f = r(d);
35
37
  //#endregion
36
- export { d as default };
38
+ export { f as default };
37
39
  /* 独立思考,明辨是非 */
@@ -4,7 +4,7 @@ import { CSSProperties } from 'react';
4
4
  */
5
5
  export interface TimerProps {
6
6
  style?: CSSProperties;
7
- className?: string | string[];
7
+ className?: string;
8
8
  format?: string;
9
9
  callback?: (time: string) => unknown;
10
10
  }
@@ -1,92 +1,102 @@
1
- /* 潘启宝 2026-04-14 16:51:31 星期二 */
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
2
  import { isFunction as e, isNull as t, isUndefined as n } from "../utils/is.js";
3
3
  import r from "../hooks/use-latest/index.js";
4
4
  import i from "../hooks/use-create/index.js";
5
5
  import a from "../hooks/use-update-effect/index.js";
6
- import { forceReflow as ee } from "../utils/dom.js";
7
- import o from "../utils/findRootElement.js";
6
+ import { forceReflow as o } from "../utils/dom.js";
7
+ import ee from "../utils/findRootElement.js";
8
8
  import s from "../hooks/use-update-layout-effect/index.js";
9
- import { defaults as c } from "../utils/lodash.js";
10
- import l from "../hooks/use-is-first-render/index.js";
9
+ import { defaults as te } from "../utils/lodash.js";
10
+ import c from "../hooks/use-is-first-render/index.js";
11
11
  import "../hooks/index.js";
12
- import { TRANSITION_DEFAULT_PROPS as u, TRANSITION_EVENT_MAP as d, TRANSITION_EVENT_NAME_KEY as f, TRANSITION_MOUNT_ON_ENTER_KEY as p, TRANSITION_NEXT_PHASE_KEY as te, TRANSITION_UNMOUNT_ON_EXIT_KEY as ne, TransitionPhase as m, TransitionPhaseEvent as h } from "./constants.js";
13
- import { getDurations as re, isActivePhaseHandler as g, isAppearPhaseHandler as _, isEnterPhaseHandler as v, isExitDonePhaseHandler as y, isExitPhaseHandler as b } from "./utils.js";
14
- import x, { useDeferredValue as S, useEffect as C, useLayoutEffect as ie, useRef as ae, useState as oe, useTransition as se } from "react";
12
+ import { TRANSITION_ADD_END_LISTENER_KEY as l, TRANSITION_ALWAYS_MOUNTED_KEY as u, TRANSITION_DEFAULT_PROPS as d, TRANSITION_DURATION_KEY as ne, TRANSITION_EVENT_MAP as f, TRANSITION_EVENT_NAME_KEY as p, TRANSITION_MOUNT_ON_ENTER_KEY as re, TRANSITION_NEXT_PHASE_KEY as ie, TRANSITION_PHASE_APPEAR as m, TRANSITION_PHASE_APPEAR_DONE as h, TRANSITION_PHASE_ENTER as g, TRANSITION_PHASE_ENTER_DONE as _, TRANSITION_PHASE_EXIT as v, TRANSITION_PHASE_EXIT_DONE as y, TRANSITION_UNMOUNT_ON_EXIT_KEY as b } from "./constants.js";
13
+ import { getDurations as ae, isActivePhaseHandler as oe, isAppearPhaseHandler as se, isEnterPhaseHandler as ce, isExitDonePhaseHandler as le, isExitPhaseHandler as x } from "./utils.js";
14
+ import S, { useDeferredValue as ue, useEffect as C, useLayoutEffect as w, useRef as T, useState as E, useTransition as D } from "react";
15
15
  //#region components/common/transition/Transition.tsx
16
- var { APPEAR: w, APPEAR_ACTIVE: T, APPEAR_DONE: E, ENTER: D, ENTER_ACTIVE: O, ENTER_DONE: k, EXIT: A, EXIT_ACTIVE: j, EXIT_DONE: M } = m, { ON_ENTER: N, ON_ENTERING: P, ON_ENTERED: F, ON_EXIT: I, ON_EXITING: L, ON_EXITED: R } = h, { setTimeout: ce, clearTimeout: z, requestAnimationFrame: B, cancelAnimationFrame: V } = window, H = u;
17
- function U(u) {
18
- let m = c({}, u, H), { children: h, in: x, [w]: T, [D]: O, [A]: j, duration: N = 500, alwaysMounted: P, addEndListener: F, refElement: I, [p]: L, [ne]: R } = m;
19
- i(() => {});
20
- let U = l(), W = ae({ hasShown: x }), G = P;
21
- "unmountOnExit" in m && (G = !R), "mountOnEnter" in m && (U || !W.current.hasShown) && (G = !L);
22
- let [le, ue] = oe(() => {
23
- let e = pe();
16
+ var { setTimeout: O, clearTimeout: k, requestAnimationFrame: A, cancelAnimationFrame: j } = window, M = { ...d };
17
+ function N(d) {
18
+ let S = te({}, d, M), N = "hasShown", P = "refElement", { children: F, in: I, [m]: L, [g]: R, [v]: z, [ne]: B = 500, [u]: de, [l]: fe, [re]: V, [b]: H, [P]: pe } = S;
19
+ i(() => {}), c();
20
+ let U = T({ [N]: I }), W = U.current[N], G = de;
21
+ "unmountOnExit" in S && !n(H) && (G = !H);
22
+ let K = "mountOnEnter" in S && !n(V);
23
+ K && (W || (G = !V));
24
+ let [me, he] = E(() => X(ve())), { phase: q, destroy: J } = me, Y = ue(J, J), [ge, _e] = D();
25
+ r(q);
26
+ function ve() {
27
+ let e = y;
28
+ return I && (e = L ? m : h), e;
29
+ }
30
+ function X(e) {
24
31
  return {
25
32
  phase: e,
26
- destroy: X(e)
33
+ destroy: ye(e)
27
34
  };
28
- }), { phase: K, destroy: q } = le, J = S(q), [de, fe] = se();
29
- r(K);
30
- function pe() {
31
- let e = M;
32
- return x && (e = T ? w : E), e;
33
35
  }
34
- function Y() {
35
- return o(I);
36
- }
37
- function X(e) {
38
- return G ? void 0 : y(e);
36
+ function Z() {
37
+ let { [P]: e } = S;
38
+ return ee(e);
39
39
  }
40
- function Z(e) {
41
- e && (ee(Y()), x || Q(e), ue((t) => ({
42
- ...t,
43
- phase: e,
44
- destroy: X(e)
45
- })));
40
+ function ye(e) {
41
+ return G ? void 0 : le(e);
46
42
  }
47
43
  function Q(t) {
48
- let n = d[t]?.[f], { [n]: r } = m;
49
- return e(r) && r(Y()), t;
44
+ if (t) {
45
+ {
46
+ let n = Z(), { onBeforePhaseChange: r } = S;
47
+ e(r) && r(t, n), o(n);
48
+ }
49
+ he((e) => ({
50
+ ...e,
51
+ ...X(t)
52
+ }));
53
+ }
50
54
  }
51
- ie(() => {
52
- let { onPhaseChange: t } = m;
53
- return e(t) && t(K, Y()), () => {};
54
- }, [K]), C(() => (x && Q(K), () => {}), [K, L]), s(() => {
55
- let e, t = b(K);
56
- return x ? (W.current.hasShown = !0, t && (e = O ? D : k)) : t || (e = j ? A : M), Z(e || K), () => {};
57
- }, [x]), C(() => {
58
- let n = null, r = null, i = d[K]?.[te];
59
- if (i && K !== i) if (g(K)) if (e(F)) F(K, (e) => {
60
- Z(i);
61
- });
55
+ w(() => {
56
+ if (!(K && !V && !W)) {
57
+ let t = f[q]?.[p], { [t]: n } = S;
58
+ e(n) && n(Z());
59
+ }
60
+ return () => {};
61
+ }, [q]), a(() => {
62
+ let { onAfterPhaseChange: t } = S;
63
+ return e(t) && t(q, Z()), () => {};
64
+ }, [q]), s(() => {
65
+ let e, t = x(q);
66
+ return I ? (U.current[N] = !0, t && (e = R ? g : _)) : t || (e = z ? v : y), Q(e || q), () => {};
67
+ }, [I]), C(() => {
68
+ let { [l]: n } = S, r = null, i = null, a = f[q]?.[ie];
69
+ if (a && q !== a) if (oe(q)) if (e(n)) n(q, (e) => {
70
+ Q(e || a);
71
+ }, Z());
62
72
  else {
63
- let e = re(N), t = e[D];
64
- _(K) ? t = e[w] : v(K) ? t = e[D] : b(K) && (t = e[A]), n = ce((e) => {
65
- Z(e || i);
66
- }, t, i);
73
+ let e = ae(B), t = e[g];
74
+ t = se(q) ? e[m] : ce(q) ? e[g] : x(q) ? e[v] : e[g], r = O((e) => {
75
+ Q(e || a);
76
+ }, t, a);
67
77
  }
68
- else r = B(() => {
69
- Z(i);
78
+ else i = A(() => {
79
+ Q(a);
70
80
  });
71
81
  return () => {
72
- t(n) || z(n), t(r) || V(r);
82
+ t(r) || k(r), t(i) || j(i);
73
83
  };
74
- }, [K]), a(() => () => {}, []), C(() => () => {}, []);
84
+ }, [q]), s(() => () => {}, []), w(() => () => {}, []), a(() => () => {}, []), C(() => () => {}, []);
75
85
  {
76
86
  let e = !0;
77
- if (n(q) || (j ? x ? q && (e = !1) : J && (e = !1) : x || J && (e = !1)), !e) return null;
87
+ if (n(J) || (z ? I ? J && (e = !1) : Y && (e = !1) : I || Y && (e = !1)), !e) return null;
78
88
  }
79
- let $ = h;
89
+ let $ = F;
80
90
  if (e($)) {
81
- let e = Object.keys(d).reduce((e, t, n, r) => ({
91
+ let e = Object.keys(f).reduce((e, t, n, r) => ({
82
92
  ...e,
83
- [t]: K === t
93
+ [t]: q === t
84
94
  }), {});
85
- $ = $(e, K);
95
+ $ = $(e, q);
86
96
  }
87
97
  return $;
88
98
  }
89
- var W = x.memo(U);
99
+ var P = S.memo(N);
90
100
  //#endregion
91
- export { W as Transition, W as default };
101
+ export { P as Transition, P as default };
92
102
  /* 独立思考,明辨是非 */
@@ -1,33 +1,42 @@
1
- /* 潘启宝 2026-04-14 16:51:31 星期二 */
2
- import { isObjectLike as e, isString as t } from "../utils/is.js";
3
- import n from "../utils/className.js";
4
- import { TRANSITION_CSS_CLASS_NAMES_SUFFIX as r, TransitionPhase as i, TransitionPhaseEvent as a } from "./constants.js";
5
- import { Transition as o } from "./Transition.js";
6
- import s, { cloneElement as c, isValidElement as l } from "react";
7
- import { jsx as u } from "react/jsx-runtime";
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
+ import { isPlainObject as e, isString as t, isStringAndExist as n } from "../utils/is.js";
3
+ import r from "../utils/className.js";
4
+ import { TRANSITION_CSS_CLASS_NAMES_SUFFIX as i, TRANSITION_PHASE_APPEAR as a } from "./constants.js";
5
+ import { fallbackAppearToEnter as o, isAppearPhaseHandler as s } from "./utils.js";
6
+ import { Transition as c } from "./Transition.js";
7
+ import l, { cloneElement as u, isValidElement as d } from "react";
8
+ import { jsx as f } from "react/jsx-runtime";
8
9
  //#region components/common/transition/TransitionCSS.tsx
9
- var { APPEAR: d, APPEAR_ACTIVE: f, APPEAR_DONE: p, ENTER: m, ENTER_ACTIVE: h, ENTER_DONE: g, EXIT: _, EXIT_ACTIVE: v, EXIT_DONE: y } = i, { ON_ENTER: b, ON_ENTERING: x, ON_ENTERED: S, ON_EXIT: C, ON_EXITING: w, ON_EXITED: T } = a;
10
- function E(i) {
11
- let { children: a, classNames: o, phase: s } = i;
12
- if (!l(a)) return null;
13
- if (!o) return a;
14
- let u;
15
- if (t(o) ? u = `${o}-${r[s]}` : e(o) && (u = o[s]), !u) return a;
16
- let { className: d } = a.props;
17
- return c(a, { className: n(d, u) });
10
+ function p(c) {
11
+ let { children: l, classNames: f = "", phase: p, [a]: m } = c;
12
+ if (!d(l)) return null;
13
+ if (!f) return l;
14
+ let h = "";
15
+ if (t(f)) {
16
+ let e = i[p];
17
+ n(e) && (h = `${f}-${e}`);
18
+ } else if (e(f)) {
19
+ let e = { ...f };
20
+ m && s(p) && Object.assign(e, o(e)), h = e[p] ?? "";
21
+ }
22
+ if (!n(h)) return l;
23
+ let { className: g } = l.props;
24
+ return u(l, { className: r(g, h) });
18
25
  }
19
- function D(e) {
20
- let { children: t, classNames: n, ...r } = e;
21
- return /* @__PURE__ */ u(o, {
26
+ function m(e) {
27
+ let { children: t, classNames: n = "", ...r } = e;
28
+ return /* @__PURE__ */ f(c, {
22
29
  ...r,
23
- children: (e, r) => /* @__PURE__ */ u(E, {
30
+ children: (e, i) => /* @__PURE__ */ f(p, {
31
+ ...r,
24
32
  classNames: n,
25
- phase: r,
33
+ phase: i,
26
34
  children: t
27
35
  })
28
36
  });
29
37
  }
30
- var O = s.memo(D);
38
+ var h = l.memo(m);
39
+ h.displayName = "TransitionCSS";
31
40
  //#endregion
32
- export { O as TransitionCSS, O as default };
41
+ export { h as TransitionCSS, h as default };
33
42
  /* 独立思考,明辨是非 */
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { TransitionGroupProps } from './interface';
3
3
  /**
4
- * `TransitionGroup` 组件处理一组 `Transition` 子元素
5
- * 并在元素进入和退出 DOM 时应用过渡动画。
6
- * 它可用于为多个元素设置动画,控制它们在容器中的出现和移除。
4
+ * TransitionGroup 组件用于管理一组 Transition 子元素
5
+ * 并在元素进入和退出 DOM 时自动应用过渡动画。
6
+ * 该组件可用于为多个元素设置动画,控制它们在容器中的显示和移除。
7
7
  */
8
8
  declare function Component(baseProps: TransitionGroupProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>[];
9
9
  declare const TransitionGroup: React.MemoExoticComponent<typeof Component>;
@@ -1,62 +1,57 @@
1
- /* 潘启宝 2026-04-14 16:51:31 星期二 */
2
- import e from "../hooks/use-isomorphic-layout-effect/index.js";
1
+ /* 潘启宝 2026-04-23 09:23:27 星期四 */
2
+ import { isNumber as e } from "../utils/is.js";
3
3
  import { defaults as t } from "../utils/lodash.js";
4
- import { TRANSITION_DEFAULT_PROPS as n, TransitionPhase as r, TransitionPhaseEvent as i } from "./constants.js";
5
- import { getDurations as a } from "./utils.js";
6
- import o, { Children as s, cloneElement as c, isValidElement as l, useRef as u } from "react";
4
+ import n from "../hooks/use-is-first-render/index.js";
5
+ import "../hooks/index.js";
6
+ import { TRANSITION_ALWAYS_MOUNTED_KEY as r, TRANSITION_DEFAULT_PROPS as i, TRANSITION_DURATION_KEY as a, TRANSITION_PHASE_APPEAR as o, TRANSITION_PHASE_ENTER as s, TRANSITION_PHASE_EXIT as c } from "./constants.js";
7
+ import { getDurations as l } from "./utils.js";
8
+ import u, { Children as d, cloneElement as f, isValidElement as p, useEffect as m, useRef as h } from "react";
7
9
  //#region components/common/transition/TransitionGroup.tsx
8
- var { APPEAR: d, APPEAR_ACTIVE: f, APPEAR_DONE: p, ENTER: m, ENTER_ACTIVE: h, ENTER_DONE: g, EXIT: _, EXIT_ACTIVE: v, EXIT_DONE: y } = r, { ON_ENTER: b, ON_ENTERING: x, ON_ENTERED: S, ON_EXIT: C, ON_EXITING: w, ON_EXITED: T } = i, { setTimeout: E, clearTimeout: D, requestAnimationFrame: O, cancelAnimationFrame: k } = window, A = {
9
- [d]: n[d],
10
- [m]: n[m],
11
- [_]: n[_],
12
- duration: n.duration,
13
- alwaysMounted: n.alwaysMounted
14
- };
15
- function j(n) {
16
- let { children: r, [d]: i = !0, [m]: o = !0, [_]: f = !0, duration: p = 500, alwaysMounted: h = !1 } = t({}, n, A), g = u(!1), v = u([]), y = [], b = [], x = {}, S = [];
17
- s.toArray(r).forEach((e, t, n) => {
18
- l(e) && (x[e.key] = S.length, S.push(e));
19
- });
20
- function C(e, t) {
21
- let { alwaysMounted: n = h, duration: r = p, [d]: a = i, [m]: s = o, [_]: l = f } = e.props ?? {}, u = c(e, {
22
- in: !t,
23
- alwaysMounted: n,
24
- duration: r,
25
- [_]: l,
26
- [m]: s,
27
- [d]: g.current ? s : a
10
+ var { setTimeout: g, clearTimeout: _, requestAnimationFrame: v, cancelAnimationFrame: y } = window, b = { ...i };
11
+ function x(i) {
12
+ let { children: u, [o]: v = !0, [s]: y = !0, [c]: x = !0, [a]: S = 500, [r]: C = !1 } = t({}, i, b), w = n(), T = h([]), E = [], D = [], O = d.toArray(u).filter((e, t, n) => p(e));
13
+ function k(t, n) {
14
+ let i = t.props ?? {}, { [r]: l = C, [a]: u = S, [o]: d = v, [s]: p = y, [c]: m = x } = i;
15
+ E.push({
16
+ element: t,
17
+ removeTimeout: n
28
18
  });
29
- y.push({
30
- element: e,
31
- removeTimeout: t
32
- }), b.push(u);
19
+ let h = {
20
+ ...i,
21
+ in: !e(n),
22
+ [r]: l,
23
+ [a]: u,
24
+ [c]: m,
25
+ [s]: p,
26
+ [o]: w ? d : p
27
+ };
28
+ D.push(f(t, h));
33
29
  }
34
- function w(e) {
35
- let { alwaysMounted: t = h, duration: n = p, [d]: r = i, [m]: s = o, [_]: c = f } = e.props ?? {};
36
- return E(() => {
37
- let { current: t } = v, n = t.findIndex((t, n, r) => {
30
+ function A(e) {
31
+ let { [r]: t = C, [a]: n = S, [o]: i = v, [s]: u = y, [c]: d = x } = e.props ?? {}, f = l(n)[c];
32
+ return g(() => {
33
+ let t = T.current.findIndex((t, n, r) => {
38
34
  let { element: i } = t ?? {};
39
- return i.key === e.key;
35
+ return i === e || i.key === e.key;
40
36
  });
41
- n === -1 || t.splice(n, 1);
42
- }, a(n).exit);
37
+ t === -1 || T.current.splice(t, 1);
38
+ }, f);
43
39
  }
44
- let T = 0;
45
- v.current.forEach((e, t, n) => {
46
- let { element: r, removeTimeout: a } = e ?? {}, { alwaysMounted: s = h, duration: c = p, [d]: l = i, [m]: u = o, [_]: g = f } = r.props ?? {}, v = x[r.key] ?? -1;
47
- if (v < 0) a ? C(r, a) : g && C(r, w(r));
40
+ let j = 0;
41
+ T.current.forEach((t, n, i) => {
42
+ let { element: l, removeTimeout: u } = t ?? {}, d = e(u), { [r]: f = C, [a]: p = S, [o]: m = v, [s]: h = y, [c]: g = x } = l.props ?? {}, b = O.findIndex((e, t, n) => e === l || e.key === l.key);
43
+ if (b === -1) d ? k(l, u) : g && k(l, A(l));
48
44
  else {
49
- a && D(a);
50
- for (let e = T; e <= v; e += 1) C(S[e]);
45
+ d && _(u);
46
+ for (let e = j; e <= b; e += 1) k(O[e]);
51
47
  }
52
- T = Math.max(T, v + 1);
48
+ j = Math.max(j, b + 1);
53
49
  });
54
- for (let e = T; e < S.length; e += 1) C(S[e]);
55
- return e(() => {
56
- g.current = !0;
57
- }, []), v.current = y, b;
50
+ for (let e = j; e < O.length; e += 1) k(O[e]);
51
+ return T.current = E, m(() => () => {}, []), D;
58
52
  }
59
- var M = o.memo(j);
53
+ var S = u.memo(x);
54
+ S.displayName = "TransitionGroup";
60
55
  //#endregion
61
- export { M as TransitionGroup, M as default };
56
+ export { S as TransitionGroup, S as default };
62
57
  /* 独立思考,明辨是非 */