@unicom-cloud/ui-common 0.1.19 → 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.
- package/.virtual/_rolldown/runtime.js +1 -1
- package/.vite/manifest.json +125 -74
- package/development/index.js +1 -1
- package/development/interface.d.ts +1 -1
- package/empty/index.js +1 -1
- package/empty/interface.d.ts +1 -1
- package/flex/index.js +1 -1
- package/flex/utils.js +1 -1
- package/higher-order/index.js +1 -1
- package/higher-order/with-speech-synthesis/index.js +1 -1
- package/hooks/create-deep-compare-effect/index.js +8 -7
- package/hooks/create-update-effect/index.d.ts +1 -1
- package/hooks/create-update-effect/index.js +9 -10
- package/hooks/create-use-storage-state/index.js +1 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +82 -81
- package/hooks/use-async-effect/index.js +1 -1
- package/hooks/use-boolean/index.js +1 -1
- package/hooks/use-click-away/index.d.ts +2 -2
- package/hooks/use-click-away/index.js +7 -3
- package/hooks/use-computed-state/index.js +1 -1
- package/hooks/use-controllable-value/index.js +1 -1
- package/hooks/use-cookie-state/index.d.ts +34 -1
- package/hooks/use-cookie-state/index.js +16 -16
- package/hooks/use-count-down/index.js +1 -1
- package/hooks/use-counter/index.js +1 -1
- package/hooks/use-create/index.d.ts +4 -1
- package/hooks/use-create/index.js +1 -1
- package/hooks/use-creation/index.js +1 -1
- package/hooks/use-debounce/index.js +1 -1
- package/hooks/use-debounce-effect/index.js +1 -1
- package/hooks/use-debounce-fn/index.js +1 -1
- package/hooks/use-deep-compare-effect/index.js +1 -1
- package/hooks/use-deep-compare-layout-effect/index.js +1 -1
- package/hooks/use-document-visibility/index.js +1 -1
- package/hooks/use-drag/index.js +1 -1
- package/hooks/use-drop/index.js +3 -3
- package/hooks/use-effect-event/index.js +13 -12
- package/hooks/use-event/index.js +1 -1
- package/hooks/use-event-emitter/demo/demo1.d.ts +10 -0
- package/hooks/use-event-emitter/index.d.ts +8 -0
- package/hooks/use-event-emitter/index.js +26 -0
- package/hooks/use-event-listener/index.js +1 -1
- package/hooks/use-event-target/index.js +1 -1
- package/hooks/use-external/index.js +25 -24
- package/hooks/use-favicon/index.js +1 -1
- package/hooks/use-focus-within/index.js +1 -1
- package/hooks/use-force-update/index.js +1 -1
- package/hooks/use-fullscreen/index.js +1 -1
- package/hooks/use-get-state/index.js +1 -1
- package/hooks/use-history-travel/index.js +1 -1
- package/hooks/use-hover/index.js +1 -1
- package/hooks/use-id/index.js +1 -1
- package/hooks/use-in-view/index.js +1 -1
- package/hooks/use-in-viewport/index.js +1 -1
- package/hooks/use-infinite-scroll/index.js +54 -53
- package/hooks/use-intersection-observer/index.js +1 -1
- package/hooks/use-intersection-observers/index.js +1 -1
- package/hooks/use-interval/index.js +1 -1
- package/hooks/use-is-first-render/index.js +1 -1
- package/hooks/use-isomorphic-layout-effect/index.js +1 -1
- package/hooks/use-key-press/index.js +1 -1
- package/hooks/use-keyboard-event/index.js +3 -3
- package/hooks/use-latest/index.js +1 -1
- package/hooks/use-listen-window-resize/index.d.ts +1 -1
- package/hooks/use-listen-window-resize/index.js +3 -3
- package/hooks/use-local-storage-state/index.js +1 -1
- package/hooks/use-lock-fn/index.js +1 -1
- package/hooks/use-long-press/index.js +1 -1
- package/hooks/use-map/index.js +1 -1
- package/hooks/use-media/index.js +12 -11
- package/hooks/use-memo/index.js +1 -1
- package/hooks/use-memoized-fn/index.d.ts +1 -1
- package/hooks/use-memoized-fn/index.js +3 -3
- package/hooks/use-merge-props/index.js +1 -1
- package/hooks/use-merge-value/index.js +1 -1
- package/hooks/use-mobile/index.js +1 -1
- package/hooks/use-mount/index.js +1 -1
- package/hooks/use-mouse/index.js +1 -1
- package/hooks/use-move/index.js +1 -1
- package/hooks/use-mutation-observer/index.js +1 -1
- package/hooks/use-mutation-observers/index.js +1 -1
- package/hooks/use-network/index.js +1 -1
- package/hooks/use-online-status/index.js +1 -1
- package/hooks/use-overflow-hidden/index.js +2 -2
- package/hooks/use-override-ref/index.js +1 -1
- package/hooks/use-pagination/index.js +1 -1
- package/hooks/use-paste-image/index.js +1 -1
- package/hooks/use-persist-callback/index.js +1 -1
- package/hooks/use-prefers-color-scheme-dark/index.js +1 -1
- package/hooks/use-previous/index.js +1 -1
- package/hooks/use-raf-interval/index.js +1 -1
- package/hooks/use-raf-state/index.js +1 -1
- package/hooks/use-raf-timeout/index.js +1 -1
- package/hooks/use-reactive/index.js +1 -1
- package/hooks/use-ref-latest/index.js +1 -1
- package/hooks/use-refs/index.js +11 -10
- package/hooks/use-request/index.js +1 -1
- package/hooks/use-request/src/Fetch.js +1 -1
- package/hooks/use-request/src/plugins/useAutoRunPlugin.js +1 -1
- package/hooks/use-request/src/plugins/useCachePlugin.js +1 -1
- package/hooks/use-request/src/plugins/useDebouncePlugin.js +20 -19
- package/hooks/use-request/src/plugins/useLoadingDelayPlugin.js +1 -1
- package/hooks/use-request/src/plugins/usePollingPlugin.js +1 -1
- package/hooks/use-request/src/plugins/useRefreshOnWindowFocusPlugin.js +1 -1
- package/hooks/use-request/src/plugins/useRetryPlugin.js +1 -1
- package/hooks/use-request/src/plugins/useThrottlePlugin.js +18 -17
- package/hooks/use-request/src/useRequest.js +1 -1
- package/hooks/use-request/src/useRequestImplement.js +1 -1
- package/hooks/use-request/src/utils/cache.js +1 -1
- package/hooks/use-request/src/utils/cachePromise.js +1 -1
- package/hooks/use-request/src/utils/cacheSubscribe.js +1 -1
- package/hooks/use-request/src/utils/isDocumentVisible.js +1 -1
- package/hooks/use-request/src/utils/isOnline.js +1 -1
- package/hooks/use-request/src/utils/limit.js +1 -1
- package/hooks/use-request/src/utils/subscribeFocus.js +1 -1
- package/hooks/use-request/src/utils/subscribeReVisible.js +1 -1
- package/hooks/use-reset-state/index.js +1 -1
- package/hooks/use-resize-observer/index.js +1 -1
- package/hooks/use-resize-observers/index.js +1 -1
- package/hooks/use-responsive/index.js +1 -1
- package/hooks/use-safe-state/index.js +1 -1
- package/hooks/use-scroll/index.js +1 -1
- package/hooks/use-selections/index.js +1 -1
- package/hooks/use-session-storage-state/index.js +1 -1
- package/hooks/use-set/index.js +1 -1
- package/hooks/use-set-state/index.js +1 -1
- package/hooks/use-size/index.js +1 -1
- package/hooks/use-state-callback/index.js +11 -9
- package/hooks/use-state-with-promise/index.d.ts +11 -1
- package/hooks/use-state-with-promise/index.js +21 -20
- package/hooks/use-sync-state/index.js +1 -1
- package/hooks/use-text-selection/index.js +1 -1
- package/hooks/use-theme/index.js +1 -1
- package/hooks/use-throttle/index.js +1 -1
- package/hooks/use-throttle-effect/index.js +1 -1
- package/hooks/use-throttle-fn/index.js +1 -1
- package/hooks/use-timeout/index.js +1 -1
- package/hooks/use-title/index.js +1 -1
- package/hooks/use-toggle/index.js +12 -11
- package/hooks/use-tracked-effect/index.js +1 -1
- package/hooks/use-unmount/index.js +1 -1
- package/hooks/use-unmounted-ref/index.js +1 -1
- package/hooks/use-update/index.d.ts +3 -1
- package/hooks/use-update/index.js +5 -5
- package/hooks/use-update-effect/index.js +1 -1
- package/hooks/use-update-layout-effect/index.js +1 -1
- package/hooks/use-url-state/index.js +1 -1
- package/hooks/use-virtual-list/index.js +1 -1
- package/hooks/use-watch/index.js +1 -1
- package/hooks/use-web-socket/index.js +1 -1
- package/hooks/use-why-did-you-update/index.js +1 -1
- package/hooks/use-window-size/index.d.ts +1 -1
- package/hooks/use-window-size/index.js +1 -1
- package/hooks/utils/createEffectWithTarget.js +1 -1
- package/hooks/utils/depsAreSame.js +1 -1
- package/hooks/utils/depsEqual.js +1 -1
- package/hooks/utils/domTarget.js +1 -1
- package/hooks/utils/getDocumentOrShadow.js +1 -1
- package/hooks/utils/index.js +1 -1
- package/hooks/utils/isAppleDevice.js +1 -1
- package/hooks/utils/isBrowser.js +1 -1
- package/hooks/utils/isDev.js +1 -1
- package/hooks/utils/rect.js +1 -1
- package/hooks/utils/useDeepCompareWithTarget.js +1 -1
- package/hooks/utils/useEffectWithTarget.js +1 -1
- package/hooks/utils/useIsomorphicLayoutEffectWithTarget.js +1 -1
- package/hooks/utils/useLayoutEffectWithTarget.js +1 -1
- package/icons/file/index.js +1 -1
- package/icons/file/interface.d.ts +1 -1
- package/index.d.ts +1 -1
- package/index.js +586 -549
- package/interface.d.ts +3 -0
- package/package.json +1 -1
- package/progress/index.js +43 -43
- package/resize-observer/Collection.d.ts +2 -2
- package/resize-observer/Collection.js +1 -1
- package/resize-observer/SingleObserver.js +1 -1
- package/resize-observer/index.js +1 -1
- package/resize-observer/observerUtil.js +1 -1
- package/space/index.js +49 -48
- package/space/interface.d.ts +1 -1
- package/style/animation.less +13 -1
- package/style.css +1 -1
- package/suspense-fallback-test/index.js +1 -1
- package/test.js +1 -1
- package/timer/index.js +25 -23
- package/timer/interface.d.ts +1 -1
- package/transition/Transition.d.ts +11 -0
- package/transition/Transition.js +102 -0
- package/transition/TransitionCSS.d.ts +11 -0
- package/transition/TransitionCSS.js +42 -0
- package/transition/TransitionGroup.d.ts +11 -0
- package/transition/TransitionGroup.js +57 -0
- package/transition/TransitionStyle.d.ts +11 -0
- package/transition/TransitionStyle.js +37 -0
- package/transition/constants.d.ts +49 -0
- package/transition/constants.js +48 -0
- package/transition/index.d.ts +10 -0
- package/transition/index.js +12 -0
- package/transition/interface.d.ts +197 -0
- package/transition/utils.d.ts +20 -0
- package/transition/utils.js +99 -0
- package/utils/callOrReturn.js +1 -1
- package/utils/callbackOriginRef.js +1 -1
- package/utils/caseName.js +1 -1
- package/utils/className.js +1 -1
- package/utils/constant.d.ts +2 -0
- package/utils/constant.js +3 -3
- package/utils/copy.js +1 -1
- package/utils/date.js +1 -1
- package/utils/dayjs.js +1 -1
- package/utils/dom.js +1 -1
- package/utils/emitter.js +1 -1
- package/utils/fileRead.js +1 -1
- package/utils/fileToDataURL.js +1 -1
- package/utils/fillNBSP.js +1 -1
- package/utils/findRootElement.d.ts +3 -3
- package/utils/findRootElement.js +2 -2
- package/utils/findScrollParent.js +1 -1
- package/utils/getHighlightText.js +2 -2
- package/utils/getHotkeyHandler.js +1 -1
- package/utils/getScrollBarHeight.js +1 -1
- package/utils/getScrollBarSize.js +16 -6
- package/utils/getScrollBarWidth.js +1 -1
- package/utils/getStringLength.js +1 -1
- package/utils/include.js +1 -1
- package/utils/index.js +289 -281
- package/utils/intersectionObserver.js +1 -1
- package/utils/is.d.ts +8 -7
- package/utils/is.js +22 -19
- package/utils/keyboardCode.js +1 -1
- package/utils/lodash.js +1 -1
- package/utils/math.js +1 -1
- package/utils/mergeProps.js +8 -7
- package/utils/mergedToString.js +1 -1
- package/utils/mutationObserver.js +1 -1
- package/utils/omit.js +1 -1
- package/utils/pad.js +1 -1
- package/utils/pick.js +1 -1
- package/utils/pinyin.js +1 -1
- package/utils/react19Adapter.js +1 -1
- package/utils/ref.js +2 -2
- package/utils/resizeObserver.js +1 -1
- package/utils/saveAs.js +1 -1
- package/utils/screenfull.js +1 -1
- package/utils/scrollIntoViewIfNeeded.js +1 -1
- package/utils/setCreateRoot.js +1 -1
- package/utils/setDarkTheme.js +1 -1
- package/utils/setDir.js +1 -1
- package/utils/setPrimaryColor.js +1 -1
- package/utils/setTheme.js +1 -1
- package/utils/string.js +1 -1
- package/utils/style.js +1 -1
- package/utils/throttleByRaf.js +1 -1
- package/utils/throttleByRaf2.js +1 -1
- package/utils/tinycolor.js +1 -1
- package/utils/toArray.js +1 -1
- package/utils/tree.js +1 -1
- package/utils/tween.js +1 -1
- package/utils/uuid.js +1 -1
- package/utils/validate.js +1 -1
- package/utils/warning.js +1 -1
- package/version/index.js +9 -9
- package/transition-group/ChildMapping.d.ts +0 -27
- package/transition-group/ChildMapping.js +0 -61
- package/transition-group/Transition.d.ts +0 -126
- package/transition-group/Transition.js +0 -133
- package/transition-group/TransitionCSS.d.ts +0 -97
- package/transition-group/TransitionCSS.js +0 -73
- package/transition-group/TransitionGroup.d.ts +0 -31
- package/transition-group/TransitionGroup.js +0 -54
- package/transition-group/TransitionReplace.d.ts +0 -23
- package/transition-group/TransitionReplace.js +0 -38
- package/transition-group/TransitionSwitch.d.ts +0 -88
- package/transition-group/TransitionSwitch.js +0 -84
- package/transition-group/context.d.ts +0 -2
- package/transition-group/context.js +0 -7
- package/transition-group/index.d.ts +0 -9
- package/transition-group/index.js +0 -11
package/interface.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@unicom-cloud/ui-common","version":"0.1.
|
|
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,8 +1,8 @@
|
|
|
1
|
-
/* 潘启宝 2026-04-
|
|
2
|
-
import { isNumber as e } from "../utils/is.js";
|
|
3
|
-
import { UI_COMMON_PREFIX as
|
|
1
|
+
/* 潘启宝 2026-04-23 09:23:27 星期四 */
|
|
2
|
+
import { isNumber as e, isUndefined as t } from "../utils/is.js";
|
|
3
|
+
import { UI_COMMON_PREFIX as n } from "@unicom-cloud/utils/constant/ui";
|
|
4
4
|
//#region components/common/progress/index.js
|
|
5
|
-
var
|
|
5
|
+
var r = {
|
|
6
6
|
status: null,
|
|
7
7
|
settings: {
|
|
8
8
|
parent: document.body,
|
|
@@ -16,75 +16,75 @@ var n = {
|
|
|
16
16
|
trickleSpeed: 227
|
|
17
17
|
},
|
|
18
18
|
configure(e) {
|
|
19
|
-
return Object.assign(
|
|
19
|
+
return Object.assign(r.settings, e), r;
|
|
20
20
|
},
|
|
21
21
|
set(e) {
|
|
22
|
-
let t =
|
|
23
|
-
e =
|
|
24
|
-
let
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
}),
|
|
22
|
+
let t = r.isStarted();
|
|
23
|
+
e = i(e, r.settings.minimum, 1), r.status = e === 1 ? null : e;
|
|
24
|
+
let n = r.render(!t), a = r.settings.speed;
|
|
25
|
+
return n.offsetWidth, u(function(t) {
|
|
26
|
+
d(r.settings.bar, o(e, a)), e === 1 ? (n.offsetWidth, setTimeout(function() {
|
|
27
|
+
r.remove(), t();
|
|
28
|
+
}, a)) : setTimeout(t, a);
|
|
29
|
+
}), r;
|
|
30
30
|
},
|
|
31
31
|
isStarted() {
|
|
32
|
-
return e(
|
|
32
|
+
return e(r.status);
|
|
33
33
|
},
|
|
34
34
|
start() {
|
|
35
|
-
return
|
|
35
|
+
return r.status || r.set(0), r.settings.trickle && s(), r;
|
|
36
36
|
},
|
|
37
37
|
done(e) {
|
|
38
|
-
return e ||
|
|
38
|
+
return e || r.status ? r.inc(.3 + .5 * Math.random()).set(1) : r;
|
|
39
39
|
},
|
|
40
40
|
inc(t) {
|
|
41
|
-
let
|
|
42
|
-
if (!
|
|
43
|
-
if (!(
|
|
41
|
+
let n = r.status;
|
|
42
|
+
if (!n) return r.start();
|
|
43
|
+
if (!(n > 1)) return e(t) || (n >= 0 && n < .2 && (t = .1), n >= .2 && n < .5 && (t = .04), n >= .5 && n < .8 && (t = .02), n >= .8 && n < .99 && (t = .005)), t ??= 7e-4, n = i(n + t, 0, .994), r.set(n);
|
|
44
44
|
},
|
|
45
45
|
trickle() {
|
|
46
|
-
return
|
|
46
|
+
return r.inc();
|
|
47
47
|
},
|
|
48
48
|
render(e) {
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
let
|
|
52
|
-
return
|
|
49
|
+
if (r.settings.parent.contains(r.settings.progress)) return r.settings.progress;
|
|
50
|
+
r.settings.progress.hasAttribute("class"), r.settings.bar.hasAttribute("class"), r.settings.progress.setAttribute("class", `${n}-progress`), r.settings.bar.setAttribute("class", `${n}-progress-bar`), r.settings.progress.contains(r.settings.bar) || r.settings.progress.append(r.settings.bar);
|
|
51
|
+
let t = e ? "-100" : a(r.status || 0);
|
|
52
|
+
return d(r.settings.bar, o(0, t)), r.settings.parent.append(r.settings.progress), r.settings.progress;
|
|
53
53
|
},
|
|
54
54
|
remove() {
|
|
55
|
-
|
|
55
|
+
r.settings.progress.remove();
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
function
|
|
58
|
+
function i(e, t, n) {
|
|
59
59
|
return Math.max(Math.min(e, n), t);
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function a(e) {
|
|
62
62
|
return (-1 + e) * 100;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function o(e, t, n = r.settings.easing) {
|
|
65
65
|
return {
|
|
66
|
-
transform: `translate(${
|
|
67
|
-
transition: `transform ${t}ms ${
|
|
66
|
+
transform: `translate(${a(e)}%,0)`,
|
|
67
|
+
transition: `transform ${t}ms ${n}`
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function s() {
|
|
71
71
|
setTimeout(() => {
|
|
72
|
-
|
|
73
|
-
},
|
|
72
|
+
r.status && (r.trickle(), s());
|
|
73
|
+
}, r.settings.trickleSpeed);
|
|
74
74
|
}
|
|
75
|
-
var
|
|
76
|
-
function
|
|
77
|
-
let e =
|
|
78
|
-
e && e(
|
|
75
|
+
var c = [];
|
|
76
|
+
function l() {
|
|
77
|
+
let e = c.shift();
|
|
78
|
+
e && e(l);
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
|
|
80
|
+
function u(e) {
|
|
81
|
+
c.push(e), c.length && l();
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
Object.entries(
|
|
85
|
-
|
|
83
|
+
function d(e, n) {
|
|
84
|
+
Object.entries(n).forEach(([n, r], i, a) => {
|
|
85
|
+
t(r) || (e.style[n] = r);
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
//#endregion
|
|
89
|
-
export {
|
|
89
|
+
export { r as default };
|
|
90
90
|
/* 独立思考,明辨是非 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { CollectionProps, SizeInfo } from './interface';
|
|
3
|
-
type
|
|
4
|
-
export declare const CollectionContext: React.Context<
|
|
3
|
+
type OnCollectionResize = (size: SizeInfo, element: HTMLElement, data: unknown) => void;
|
|
4
|
+
export declare const CollectionContext: React.Context<OnCollectionResize>;
|
|
5
5
|
/**
|
|
6
6
|
* Collect all the resize event from children ResizeObserver
|
|
7
7
|
*/
|
package/resize-observer/index.js
CHANGED
package/space/index.js
CHANGED
|
@@ -1,73 +1,74 @@
|
|
|
1
|
-
/* 潘启宝 2026-04-
|
|
2
|
-
import e from "../
|
|
3
|
-
import t from "../
|
|
4
|
-
import n from "../utils/
|
|
5
|
-
import r from "../
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
|
11
|
+
var f = {
|
|
11
12
|
gap: "small",
|
|
12
13
|
direction: "horizontal"
|
|
13
14
|
};
|
|
14
|
-
function
|
|
15
|
-
let { className:
|
|
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(
|
|
20
|
+
].includes(y);
|
|
20
21
|
[
|
|
21
22
|
"vertical",
|
|
22
23
|
"column-reverse",
|
|
23
24
|
"column"
|
|
24
|
-
].includes(
|
|
25
|
-
let
|
|
25
|
+
].includes(y);
|
|
26
|
+
let A = {
|
|
26
27
|
horizontal: "row",
|
|
27
28
|
vertical: "column"
|
|
28
|
-
}[
|
|
29
|
+
}[y] ?? y, j = E ? {
|
|
29
30
|
start: "flex-start",
|
|
30
31
|
end: "flex-end"
|
|
31
|
-
} : {},
|
|
32
|
-
|
|
33
|
-
let
|
|
34
|
-
[`${
|
|
35
|
-
[`${
|
|
36
|
-
[`${
|
|
37
|
-
[`${
|
|
38
|
-
},
|
|
39
|
-
return
|
|
40
|
-
return
|
|
41
|
-
} })), /* @__PURE__ */
|
|
42
|
-
ref:
|
|
43
|
-
style:
|
|
44
|
-
className:
|
|
45
|
-
gap:
|
|
46
|
-
wrap:
|
|
47
|
-
justifyContent:
|
|
48
|
-
alignItems:
|
|
49
|
-
direction:
|
|
50
|
-
rtl:
|
|
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
|
-
...
|
|
53
|
-
children:
|
|
54
|
-
let
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
className: `${
|
|
57
|
-
children:
|
|
58
|
-
}), /* @__PURE__ */
|
|
59
|
-
className: `${
|
|
60
|
-
children:
|
|
61
|
-
})] },
|
|
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
|
|
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
|
-
|
|
71
|
+
h.displayName = "SpaceVertical", m.Vertical = h;
|
|
71
72
|
//#endregion
|
|
72
|
-
export {
|
|
73
|
+
export { h as SpaceVertical, m as default };
|
|
73
74
|
/* 独立思考,明辨是非 */
|
package/space/interface.d.ts
CHANGED
|
@@ -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
|
|
8
|
+
className?: string;
|
|
9
9
|
/**
|
|
10
10
|
* @zh 交叉轴方向对齐方式
|
|
11
11
|
* @deprecated 请用 alignItems 属性替代
|
package/style/animation.less
CHANGED
|
@@ -7,6 +7,17 @@
|
|
|
7
7
|
animation: ~'@{ui-common-prefix}-keyframes-vibrate' 0.3s linear infinite both;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
.@{ui-common-prefix}-animation-blink-appear,
|
|
11
|
+
.@{ui-common-prefix}-animation-blink-appear-active,
|
|
12
|
+
.@{ui-common-prefix}-animation-blink-appear-done,
|
|
13
|
+
.@{ui-common-prefix}-animation-blink-enter,
|
|
14
|
+
.@{ui-common-prefix}-animation-blink-enter-active,
|
|
15
|
+
.@{ui-common-prefix}-animation-blink-enter-done,
|
|
16
|
+
.@{ui-common-prefix}-animation-blink-exit,
|
|
17
|
+
.@{ui-common-prefix}-animation-blink-exit-active,
|
|
18
|
+
.@{ui-common-prefix}-animation-blink-exit-done {
|
|
19
|
+
transition: opacity 0.3s linear;
|
|
20
|
+
}
|
|
10
21
|
.@{ui-common-prefix}-animation-blink-appear,
|
|
11
22
|
.@{ui-common-prefix}-animation-blink-enter {
|
|
12
23
|
opacity: 0;
|
|
@@ -14,8 +25,9 @@
|
|
|
14
25
|
.@{ui-common-prefix}-animation-blink-appear-active,
|
|
15
26
|
.@{ui-common-prefix}-animation-blink-enter-active {
|
|
16
27
|
opacity: 1;
|
|
17
|
-
transition: opacity 0.3s linear;
|
|
18
28
|
}
|
|
29
|
+
|
|
30
|
+
.@{ui-common-prefix}-animation-blink-appear-done,
|
|
19
31
|
.@{ui-common-prefix}-animation-blink-enter-done {
|
|
20
32
|
animation: ~'@{ui-common-prefix}-keyframes-blink' 0.5s linear;
|
|
21
33
|
}
|
package/style.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
:root{--pi:3.14159}@keyframes pqbc-keyframes-vibrate{0%{transform:translate(0)}20%{transform:translate(-2px,2px)}40%{transform:translate(-2px,-2px)}60%{transform:translate(2px,2px)}80%{transform:translate(2px,-2px)}to{transform:translate(0)}}@keyframes pqbc-keyframes-rotate-360deg{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes pqbc-keyframes-blink{0%{opacity:1}50%{opacity:0}to{opacity:1}}.pqbc-animation-rotate-360deg{animation:1s cubic-bezier(0,0,1,1) infinite pqbc-keyframes-rotate-360deg}.pqbc-animation-vibrate{animation:.3s linear infinite both pqbc-keyframes-vibrate}.pqbc-animation-blink-appear,.pqbc-animation-blink-enter{opacity:0}.pqbc-animation-blink-appear-active,.pqbc-animation-blink-enter-active{opacity:1
|
|
1
|
+
:root{--pi:3.14159}@keyframes pqbc-keyframes-vibrate{0%{transform:translate(0)}20%{transform:translate(-2px,2px)}40%{transform:translate(-2px,-2px)}60%{transform:translate(2px,2px)}80%{transform:translate(2px,-2px)}to{transform:translate(0)}}@keyframes pqbc-keyframes-rotate-360deg{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes pqbc-keyframes-blink{0%{opacity:1}50%{opacity:0}to{opacity:1}}.pqbc-animation-rotate-360deg{animation:1s cubic-bezier(0,0,1,1) infinite pqbc-keyframes-rotate-360deg}.pqbc-animation-vibrate{animation:.3s linear infinite both pqbc-keyframes-vibrate}.pqbc-animation-blink-appear,.pqbc-animation-blink-appear-active,.pqbc-animation-blink-appear-done,.pqbc-animation-blink-enter,.pqbc-animation-blink-enter-active,.pqbc-animation-blink-enter-done,.pqbc-animation-blink-exit,.pqbc-animation-blink-exit-active,.pqbc-animation-blink-exit-done{transition:opacity .3s linear}.pqbc-animation-blink-appear,.pqbc-animation-blink-enter{opacity:0}.pqbc-animation-blink-appear-active,.pqbc-animation-blink-enter-active{opacity:1}.pqbc-animation-blink-appear-done,.pqbc-animation-blink-enter-done{animation:.5s linear pqbc-keyframes-blink}.pqbc-display-none{display:none!important}.pqbc-visibility-hidden{visibility:hidden!important}.pqbc-overflow-hidden{overflow:hidden}.pqbc-cursor-pointer{cursor:pointer}.pqbc-filter-invert-100{filter:invert()}.pqbc-filter-grayscale-100{filter:grayscale()}.pqbc-isolation-isolate{isolation:isolate}.pqbc-direction-rtl{direction:rtl}.pqbc-line-height-1{line-height:1}.pqbc-text-overflow-ellipsis{text-overflow:ellipsis;white-space:nowrap;word-break:break-all;overflow:hidden}.pqbc-line-clamp-2,.pqbc-line-clamp-3,.pqbc-line-clamp-4,.pqbc-line-clamp-5{text-overflow:ellipsis;white-space:normal;-webkit-box-orient:vertical;display:-webkit-box;display:-moz-box;overflow:hidden}.pqbc-line-clamp-2{line-clamp:2;-webkit-line-clamp:2}.pqbc-line-clamp-3{line-clamp:3;-webkit-line-clamp:3}.pqbc-line-clamp-4{line-clamp:4;-webkit-line-clamp:4}.pqbc-line-clamp-5{line-clamp:5;-webkit-line-clamp:5}.pqb-theme-dark,.pqbm-theme-dark,.pqb-theme-dark *,.pqbm-theme-dark *{color-scheme:dark}[dir=rtl] *,.pqbc-with-speech-synthesis-rtl{direction:rtl}.pqbc-empty{width:100%}.pqbc-empty .pqbc-empty-description{line-height:1}.pqbc-development{flex-direction:column;justify-content:center;align-items:center;gap:10px;width:100%;height:100%;min-height:300px;display:flex}.pqbc-development-icon,.pqbc-development-img{width:50px;height:50px}.pqbc-development-label{--color-neutral:#868788;color:var(--pqbc-color-neutral-6,var(--pqb-color-neutral-6,var(--pqbm-color-neutral-6,--color-neutral)));font-size:20px}.pqbc-space-vertical{width:100%}.pqbc-space-rtl{direction:rtl}.pqbc-icons-file{position:relative}.pqbc-icons-file-svg{width:30px;height:30px}.pqbc-icons-file-svg-bg{--primary:26, 94, 255;fill:rgb(var(--pqbc-primary-6,var(--pqb-primary-6,var(--pqbm-primary-6,--primary))))}.pqbc-icons-file-svg-tr{fill:#fff;fill-opacity:.7}.pqbc-icons-file-svg-text{fill:#fff;text-align:center;font-size:66px;font-weight:bolder}.pqbc-flex{box-sizing:border-box;margin:0;padding:0;display:flex}.pqbc-flex-inline{display:inline-flex}.pqbc-flex:empty{display:none}.pqbc-flex-rtl{direction:rtl}.pqbc-progress{pointer-events:none}.pqbc-progress-bar{--primary:26, 94, 255;background-color:rgb(var(--pqbc-primary-6,var(--pqb-primary-6,var(--pqbm-primary-6,--primary))));z-index:870227;width:100%;height:2px;position:fixed;inset-block-start:0;inset-inline-start:0}.pqbc-timer-rtl{direction:rtl}
|
|
2
2
|
/*$vite$:1*/
|
package/test.js
CHANGED
package/timer/index.js
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
/* 潘启宝 2026-04-
|
|
1
|
+
/* 潘启宝 2026-04-23 09:23:27 星期四 */
|
|
2
2
|
import { isFunction as e } from "../utils/is.js";
|
|
3
|
-
import t from "../utils/
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
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
|
|
10
|
-
let { style:
|
|
11
|
-
function
|
|
12
|
-
return
|
|
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
|
-
|
|
16
|
+
i(() => {
|
|
15
17
|
let t = n();
|
|
16
|
-
function n(r =
|
|
17
|
-
return e(
|
|
18
|
-
|
|
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
|
|
26
|
-
return
|
|
27
|
-
return
|
|
28
|
-
} })), /* @__PURE__ */
|
|
29
|
-
ref:
|
|
30
|
-
className:
|
|
31
|
-
children:
|
|
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
|
|
36
|
+
var f = r(d);
|
|
35
37
|
//#endregion
|
|
36
|
-
export {
|
|
38
|
+
export { f as default };
|
|
37
39
|
/* 独立思考,明辨是非 */
|
package/timer/interface.d.ts
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TransitionProps } from './interface';
|
|
3
|
+
/**
|
|
4
|
+
* `Transition` 组件处理组件进入和退出 DOM 时的动画生命周期。
|
|
5
|
+
* 该组件可以管理不同阶段的过渡:"appear"、"enter" 和 "exit",
|
|
6
|
+
* 每个阶段都有一个活动状态和一个完成状态。这些阶段可以根据组件的可见性(由 `in` 属性控制)触发和自定义。
|
|
7
|
+
*/
|
|
8
|
+
declare function Component(baseProps: TransitionProps): React.ReactNode;
|
|
9
|
+
declare const Transition: React.MemoExoticComponent<typeof Component>;
|
|
10
|
+
export { Transition };
|
|
11
|
+
export default Transition;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/* 潘启宝 2026-04-23 09:23:27 星期四 */
|
|
2
|
+
import { isFunction as e, isNull as t, isUndefined as n } from "../utils/is.js";
|
|
3
|
+
import r from "../hooks/use-latest/index.js";
|
|
4
|
+
import i from "../hooks/use-create/index.js";
|
|
5
|
+
import a from "../hooks/use-update-effect/index.js";
|
|
6
|
+
import { forceReflow as o } from "../utils/dom.js";
|
|
7
|
+
import ee from "../utils/findRootElement.js";
|
|
8
|
+
import s from "../hooks/use-update-layout-effect/index.js";
|
|
9
|
+
import { defaults as te } from "../utils/lodash.js";
|
|
10
|
+
import c from "../hooks/use-is-first-render/index.js";
|
|
11
|
+
import "../hooks/index.js";
|
|
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
|
+
//#region components/common/transition/Transition.tsx
|
|
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) {
|
|
31
|
+
return {
|
|
32
|
+
phase: e,
|
|
33
|
+
destroy: ye(e)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function Z() {
|
|
37
|
+
let { [P]: e } = S;
|
|
38
|
+
return ee(e);
|
|
39
|
+
}
|
|
40
|
+
function ye(e) {
|
|
41
|
+
return G ? void 0 : le(e);
|
|
42
|
+
}
|
|
43
|
+
function Q(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
|
+
}
|
|
54
|
+
}
|
|
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());
|
|
72
|
+
else {
|
|
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);
|
|
77
|
+
}
|
|
78
|
+
else i = A(() => {
|
|
79
|
+
Q(a);
|
|
80
|
+
});
|
|
81
|
+
return () => {
|
|
82
|
+
t(r) || k(r), t(i) || j(i);
|
|
83
|
+
};
|
|
84
|
+
}, [q]), s(() => () => {}, []), w(() => () => {}, []), a(() => () => {}, []), C(() => () => {}, []);
|
|
85
|
+
{
|
|
86
|
+
let e = !0;
|
|
87
|
+
if (n(J) || (z ? I ? J && (e = !1) : Y && (e = !1) : I || Y && (e = !1)), !e) return null;
|
|
88
|
+
}
|
|
89
|
+
let $ = F;
|
|
90
|
+
if (e($)) {
|
|
91
|
+
let e = Object.keys(f).reduce((e, t, n, r) => ({
|
|
92
|
+
...e,
|
|
93
|
+
[t]: q === t
|
|
94
|
+
}), {});
|
|
95
|
+
$ = $(e, q);
|
|
96
|
+
}
|
|
97
|
+
return $;
|
|
98
|
+
}
|
|
99
|
+
var P = S.memo(N);
|
|
100
|
+
//#endregion
|
|
101
|
+
export { P as Transition, P as default };
|
|
102
|
+
/* 独立思考,明辨是非 */
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TransitionCSS_Props } from './interface';
|
|
3
|
+
/**
|
|
4
|
+
* `TransitionCSS` 组件根据过渡生命周期的阶段应用 CSS 过渡效果。
|
|
5
|
+
* 它自动管理每个过渡阶段的类名(例如,"appear"、"enter"、"exit")
|
|
6
|
+
* 并将它们应用到 `children` 元素上。
|
|
7
|
+
*/
|
|
8
|
+
declare function Component(props: TransitionCSS_Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const TransitionCSS: React.MemoExoticComponent<typeof Component>;
|
|
10
|
+
export { TransitionCSS };
|
|
11
|
+
export default TransitionCSS;
|
|
@@ -0,0 +1,42 @@
|
|
|
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";
|
|
9
|
+
//#region components/common/transition/TransitionCSS.tsx
|
|
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) });
|
|
25
|
+
}
|
|
26
|
+
function m(e) {
|
|
27
|
+
let { children: t, classNames: n = "", ...r } = e;
|
|
28
|
+
return /* @__PURE__ */ f(c, {
|
|
29
|
+
...r,
|
|
30
|
+
children: (e, i) => /* @__PURE__ */ f(p, {
|
|
31
|
+
...r,
|
|
32
|
+
classNames: n,
|
|
33
|
+
phase: i,
|
|
34
|
+
children: t
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
var h = l.memo(m);
|
|
39
|
+
h.displayName = "TransitionCSS";
|
|
40
|
+
//#endregion
|
|
41
|
+
export { h as TransitionCSS, h as default };
|
|
42
|
+
/* 独立思考,明辨是非 */
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TransitionGroupProps } from './interface';
|
|
3
|
+
/**
|
|
4
|
+
* TransitionGroup 组件用于管理一组 Transition 子元素
|
|
5
|
+
* 并在元素进入和退出 DOM 时自动应用过渡动画。
|
|
6
|
+
* 该组件可用于为多个元素设置动画,控制它们在容器中的显示和移除。
|
|
7
|
+
*/
|
|
8
|
+
declare function Component(baseProps: TransitionGroupProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>[];
|
|
9
|
+
declare const TransitionGroup: React.MemoExoticComponent<typeof Component>;
|
|
10
|
+
export { TransitionGroup };
|
|
11
|
+
export default TransitionGroup;
|