@unicom-cloud/ui-common 0.1.21 → 0.1.22
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 +191 -67
- package/development/Development.d.ts +8 -0
- package/development/Development.js +36 -0
- package/development/index.d.ts +2 -7
- package/development/index.js +5 -32
- package/empty/Empty.d.ts +5 -0
- package/empty/Empty.js +40 -0
- package/empty/index.d.ts +2 -4
- package/empty/index.js +5 -36
- package/flex/Flex.d.ts +6 -0
- package/flex/Flex.js +52 -0
- package/flex/index.d.ts +4 -5
- package/flex/index.js +6 -50
- package/flex/utils.d.ts +2 -12
- package/flex/utils.js +1 -1
- package/higher-order/index.js +1 -1
- package/higher-order/with-speech-synthesis/index.d.ts +3 -6
- package/higher-order/with-speech-synthesis/index.js +5 -73
- package/higher-order/with-speech-synthesis/withSpeechSynthesis.d.ts +7 -0
- package/higher-order/with-speech-synthesis/withSpeechSynthesis.js +75 -0
- package/hooks/create-deep-compare-effect/index.js +1 -1
- package/hooks/create-update-effect/index.js +3 -3
- package/hooks/create-use-storage-state/index.d.ts +1 -1
- package/hooks/create-use-storage-state/index.js +2 -2
- package/hooks/index.d.ts +1 -2
- package/hooks/index.js +90 -91
- package/hooks/use-async-effect/index.js +1 -1
- package/hooks/use-boolean/index.js +1 -1
- package/hooks/use-click-away/index.js +1 -1
- package/hooks/use-computed-state/index.js +1 -1
- package/hooks/use-controllable-value/index.d.ts +5 -5
- package/hooks/use-controllable-value/index.js +29 -14
- package/hooks/use-cookie-state/index.js +1 -1
- package/hooks/use-count-down/index.js +1 -1
- package/hooks/use-counter/index.js +1 -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 +2 -2
- package/hooks/use-drop/index.js +1 -1
- package/hooks/use-effect-event/index.d.ts +2 -2
- package/hooks/use-effect-event/index.js +5 -15
- package/hooks/use-event/index.js +1 -1
- package/hooks/use-event-emitter/index.d.ts +2 -2
- package/hooks/use-event-emitter/index.js +1 -1
- package/hooks/use-event-listener/index.js +1 -1
- package/hooks/use-event-target/index.js +1 -1
- package/hooks/use-external/index.js +1 -1
- 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.d.ts +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-viewport/index.d.ts +3 -1
- package/hooks/use-in-viewport/index.js +16 -15
- package/hooks/use-infinite-scroll/index.js +1 -1
- package/hooks/use-intersection-observer/index.d.ts +1 -1
- package/hooks/use-intersection-observer/index.js +2 -2
- 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 +1 -1
- package/hooks/use-latest/index.js +1 -1
- package/hooks/use-listen-window-resize/index.js +1 -1
- 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 +1 -1
- package/hooks/use-memo/index.js +3 -3
- package/hooks/use-memoized-fn/index.js +1 -1
- package/hooks/use-merge-props/index.d.ts +1 -1
- package/hooks/use-merge-props/index.js +5 -9
- package/hooks/use-merge-value/index.js +5 -5
- package/hooks/use-mobile/index.js +3 -3
- package/hooks/use-mount/index.d.ts +2 -1
- package/hooks/use-mount/index.js +10 -7
- 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 +1 -1
- package/hooks/use-override-ref/index.js +6 -6
- package/hooks/use-pagination/index.js +1 -1
- package/hooks/use-paste-image/index.js +1 -1
- package/hooks/use-persist-callback/index.d.ts +2 -1
- package/hooks/use-persist-callback/index.js +4 -7
- package/hooks/use-prefers-color-scheme-dark/index.js +1 -1
- package/hooks/use-previous/index.d.ts +1 -1
- package/hooks/use-previous/index.js +4 -4
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +17 -10
- 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.d.ts +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.d.ts +4 -2
- package/hooks/use-set-state/index.js +19 -14
- package/hooks/use-size/index.js +1 -1
- package/hooks/use-state-callback/index.d.ts +8 -3
- package/hooks/use-state-callback/index.js +12 -7
- package/hooks/use-state-with-promise/index.js +14 -13
- package/hooks/use-sync-state/index.js +3 -3
- 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 +1 -1
- 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.js +5 -2
- 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.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/IconFile.d.ts +4 -0
- package/icons/file/IconFile.js +55 -0
- package/icons/file/index.d.ts +2 -3
- package/icons/file/index.js +5 -53
- package/index.js +652 -623
- package/package.json +1 -1
- package/progress/Progress.d.ts +409 -0
- package/progress/Progress.js +90 -0
- package/progress/index.d.ts +22 -407
- package/progress/index.js +4 -87
- package/resize-observer/Collection.d.ts +1 -2
- package/resize-observer/Collection.js +16 -16
- package/resize-observer/ResizeObserver.d.ts +6 -0
- package/resize-observer/ResizeObserver.js +23 -0
- package/resize-observer/SingleObserver.d.ts +3 -3
- package/resize-observer/SingleObserver.js +20 -20
- package/resize-observer/index.d.ts +4 -4
- package/resize-observer/index.js +6 -21
- package/resize-observer/observerUtil.js +1 -1
- package/space/Space.d.ts +5 -0
- package/space/Space.js +76 -0
- package/space/index.d.ts +4 -4
- package/space/index.js +5 -72
- package/style/animation.less +1 -4
- package/style.css +1 -1
- package/suspense-fallback-test/SuspenseFallbackTest.d.ts +6 -0
- package/suspense-fallback-test/SuspenseFallbackTest.js +13 -0
- package/suspense-fallback-test/index.d.ts +2 -6
- package/suspense-fallback-test/index.js +5 -6
- package/test.js +1 -1
- package/timer/Timer.d.ts +3 -0
- package/timer/Timer.js +40 -0
- package/timer/index.d.ts +2 -2
- package/timer/index.js +5 -37
- package/transition/Transition.d.ts +1 -8
- package/transition/Transition.js +62 -64
- package/transition/TransitionCSS.d.ts +1 -2
- package/transition/TransitionCSS.js +30 -26
- package/transition/TransitionGroup.d.ts +3 -3
- package/transition/TransitionGroup.js +46 -40
- package/transition/TransitionStyle.d.ts +1 -2
- package/transition/TransitionStyle.js +27 -23
- package/transition/constants.js +9 -3
- package/transition/context.d.ts +15 -0
- package/transition/context.js +8 -0
- package/transition/index.d.ts +13 -4
- package/transition/index.js +10 -9
- package/transition/interface.d.ts +8 -6
- package/transition/utils.d.ts +3 -3
- package/transition/utils.js +9 -9
- 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.js +1 -1
- 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.d.ts +1 -1
- package/utils/fillNBSP.js +1 -1
- package/utils/findRootElement.js +1 -1
- package/utils/findScrollParent.d.ts +1 -1
- package/utils/findScrollParent.js +1 -1
- package/utils/getHighlightText.js +1 -1
- package/utils/getHotkeyHandler.js +1 -1
- package/utils/getScrollBarHeight.js +1 -1
- package/utils/getScrollBarSize.js +1 -1
- package/utils/getScrollBarWidth.js +1 -1
- package/utils/getStringLength.js +1 -1
- package/utils/include.js +1 -1
- package/utils/index.d.ts +1 -0
- package/utils/index.js +331 -324
- package/utils/intersectionObserver.d.ts +1 -1
- package/utils/intersectionObserver.js +1 -1
- package/utils/is.d.ts +2 -2
- package/utils/is.js +14 -14
- package/utils/keyboardCode.js +1 -1
- package/utils/lodash.d.ts +5 -1
- package/utils/lodash.js +31 -27
- package/utils/math.js +1 -1
- package/utils/mergeProps.d.ts +1 -1
- package/utils/mergeProps.js +7 -8
- package/utils/mergedToString.js +1 -1
- package/utils/mutationObserver.d.ts +1 -1
- package/utils/mutationObserver.js +1 -1
- package/utils/object.d.ts +1 -0
- package/utils/object.js +10 -0
- package/utils/omit.d.ts +1 -5
- package/utils/omit.js +3 -3
- package/utils/pad.js +1 -1
- package/utils/pick.d.ts +2 -7
- package/utils/pick.js +6 -6
- package/utils/pinyin.js +1 -1
- package/utils/react19Adapter.js +1 -1
- package/utils/ref.js +1 -1
- package/utils/resizeObserver.d.ts +1 -1
- 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.d.ts +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 +11 -11
- package/hooks/use-in-view/index.d.ts +0 -11
- package/hooks/use-in-view/index.js +0 -21
package/empty/Empty.d.ts
ADDED
package/empty/Empty.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* 潘启宝 2026-05-08 09:02:53 星期五 */
|
|
2
|
+
import { isString as e } from "../utils/is.js";
|
|
3
|
+
import t from "../utils/className.js";
|
|
4
|
+
import n from "../space/index.js";
|
|
5
|
+
import { forwardRef as r, memo as i, useImperativeHandle as a, useRef as o } from "react";
|
|
6
|
+
import { UI_COMMON_PREFIX as s } from "@unicom-cloud/utils/constant/ui";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
|
+
import u from "@unicom-cloud/icons/IconUiEmpty";
|
|
9
|
+
//#region components/common/empty/Empty.tsx
|
|
10
|
+
function d(r, i) {
|
|
11
|
+
let { style: d, className: f, description: p = "无数据", icon: m, imgSrc: h, prefixCls: g, ..._ } = r, v = `${s}-empty`, y = g || v, b = e(p) ? p : "empty", x = () => h ? /* @__PURE__ */ c("img", {
|
|
12
|
+
className: t(`${v}-img`, `${y}-img`),
|
|
13
|
+
alt: b,
|
|
14
|
+
src: h,
|
|
15
|
+
loading: "lazy"
|
|
16
|
+
}) : m ? /* @__PURE__ */ c("div", {
|
|
17
|
+
className: t(`${v}-icon`, `${y}-icon`),
|
|
18
|
+
children: m
|
|
19
|
+
}) : /* @__PURE__ */ c(u, { className: t(`${v}-icon`, `${y}-icon`) }), S = o(null);
|
|
20
|
+
return a(i, () => ({ getRootElement() {
|
|
21
|
+
return S.current;
|
|
22
|
+
} })), /* @__PURE__ */ l(n.Vertical, {
|
|
23
|
+
ref: S,
|
|
24
|
+
className: t(v, y, f),
|
|
25
|
+
style: d,
|
|
26
|
+
justifyContent: "center",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
gap: 5,
|
|
29
|
+
..._,
|
|
30
|
+
children: [x(), /* @__PURE__ */ c("div", {
|
|
31
|
+
className: t(`${v}-description`, `${y}-description`),
|
|
32
|
+
children: p
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
var f = i(r(d));
|
|
37
|
+
f.displayName = "Empty";
|
|
38
|
+
//#endregion
|
|
39
|
+
export { f as Empty, f as default };
|
|
40
|
+
/* 独立思考,明辨是非 */
|
package/empty/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import type { EmptyProps } from './interface';
|
|
3
|
-
export declare const Empty: React.NamedExoticComponent<EmptyProps & React.RefAttributes<HTMLDivElement>>;
|
|
1
|
+
declare const Empty: import("react").NamedExoticComponent<import("./interface").EmptyProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
2
|
export default Empty;
|
|
5
|
-
export type { EmptyProps };
|
|
3
|
+
export type { EmptyProps } from './interface';
|
package/empty/index.js
CHANGED
|
@@ -1,38 +1,7 @@
|
|
|
1
|
-
/* 潘启宝 2026-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { forwardRef as r, memo as i, useImperativeHandle as a, useRef as o } from "react";
|
|
6
|
-
import { UI_COMMON_PREFIX as s } from "@unicom-cloud/utils/constant/ui";
|
|
7
|
-
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
|
-
import u from "@unicom-cloud/icons/IconUiEmpty";
|
|
9
|
-
var d = i(r((r, i) => {
|
|
10
|
-
let { style: d, className: f, description: p = "无数据", icon: m, imgSrc: h, prefixCls: g, ..._ } = r, v = `${s}-empty`, y = g || v, b = e(p) ? p : "empty", x = () => h ? /* @__PURE__ */ c("img", {
|
|
11
|
-
className: t(`${v}-img`, `${y}-img`),
|
|
12
|
-
alt: b,
|
|
13
|
-
src: h,
|
|
14
|
-
loading: "lazy"
|
|
15
|
-
}) : m ? /* @__PURE__ */ c("div", {
|
|
16
|
-
className: t(`${v}-icon`, `${y}-icon`),
|
|
17
|
-
children: m
|
|
18
|
-
}) : /* @__PURE__ */ c(u, { className: t(`${v}-icon`, `${y}-icon`) }), S = o(null);
|
|
19
|
-
return a(i, () => ({ getRootElement() {
|
|
20
|
-
return S.current;
|
|
21
|
-
} })), /* @__PURE__ */ l(n.Vertical, {
|
|
22
|
-
ref: S,
|
|
23
|
-
className: t(v, y, f),
|
|
24
|
-
style: d,
|
|
25
|
-
justifyContent: "center",
|
|
26
|
-
alignItems: "center",
|
|
27
|
-
gap: 5,
|
|
28
|
-
..._,
|
|
29
|
-
children: [x(), /* @__PURE__ */ c("div", {
|
|
30
|
-
className: t(`${v}-description`, `${y}-description`),
|
|
31
|
-
children: p
|
|
32
|
-
})]
|
|
33
|
-
});
|
|
34
|
-
}));
|
|
35
|
-
d.displayName = "Empty";
|
|
1
|
+
/* 潘启宝 2026-05-08 09:02:53 星期五 */
|
|
2
|
+
import { Empty as e } from "./Empty.js";
|
|
3
|
+
//#region components/common/empty/index.ts
|
|
4
|
+
var t = Object.assign(e, {});
|
|
36
5
|
//#endregion
|
|
37
|
-
export {
|
|
6
|
+
export { t as default };
|
|
38
7
|
/* 独立思考,明辨是非 */
|
package/flex/Flex.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FlexProps, FlexVerticalProps } from './interface';
|
|
3
|
+
declare const Flex: React.ForwardRefExoticComponent<FlexProps & React.RefAttributes<unknown>>;
|
|
4
|
+
declare const FlexVertical: React.ForwardRefExoticComponent<FlexVerticalProps & React.RefAttributes<HTMLElement>>;
|
|
5
|
+
export { FlexVertical };
|
|
6
|
+
export default Flex;
|
package/flex/Flex.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* 潘启宝 2026-05-08 09:02:53 星期五 */
|
|
2
|
+
import { isBoolean 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 { processGap as r } from "./utils.js";
|
|
6
|
+
import { forwardRef as i, useImperativeHandle as a, useRef as o } from "react";
|
|
7
|
+
import { UI_COMMON_PREFIX as s } from "@unicom-cloud/utils/constant/ui";
|
|
8
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
9
|
+
//#region components/common/flex/Flex.tsx
|
|
10
|
+
var l = {
|
|
11
|
+
component: "div",
|
|
12
|
+
gap: "small"
|
|
13
|
+
};
|
|
14
|
+
function u(i, u) {
|
|
15
|
+
let d = t(i, l, {}), { className: f, style: p, gap: m, children: h, direction: g, justify: _, justifyContent: v, align: y, alignItems: b, component: x = "div", wrap: S, rtl: C, inline: w, ...T } = d, E = v ?? _, D = b ?? y, O = `${s}-flex`, k = { display: w ? "inline-flex" : "flex" };
|
|
16
|
+
if ("wrap" in d) {
|
|
17
|
+
let t = S;
|
|
18
|
+
t = e(t) ? t ? "wrap" : "nowrap" : S, k.flexWrap = t;
|
|
19
|
+
}
|
|
20
|
+
D && (k.alignItems = D), E && (k.justifyContent = E), g && (k.flexDirection = g);
|
|
21
|
+
let A = o(null);
|
|
22
|
+
return a(u, () => ({ getRootElement() {
|
|
23
|
+
return A.current;
|
|
24
|
+
} })), /* @__PURE__ */ c(x, {
|
|
25
|
+
ref: A,
|
|
26
|
+
style: {
|
|
27
|
+
...k,
|
|
28
|
+
...r(m),
|
|
29
|
+
...p
|
|
30
|
+
},
|
|
31
|
+
className: n(O, {
|
|
32
|
+
[`${O}-rtl`]: C,
|
|
33
|
+
[`${O}-inline`]: w
|
|
34
|
+
}, !!g && `${O}-flex-direction-${g}`, !!E && `${O}-justify-content-${E}`, !!D && `${O}-align-items-${D}`, f),
|
|
35
|
+
...T,
|
|
36
|
+
children: h
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
var d = i(u);
|
|
40
|
+
d.displayName = "Flex";
|
|
41
|
+
var f = i((e, t) => {
|
|
42
|
+
let { direction: n = "column", ...r } = e;
|
|
43
|
+
return /* @__PURE__ */ c(d, {
|
|
44
|
+
...r,
|
|
45
|
+
ref: t,
|
|
46
|
+
direction: n
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
f.displayName = "FlexVertical";
|
|
50
|
+
//#endregion
|
|
51
|
+
export { f as FlexVertical, d as default };
|
|
52
|
+
/* 独立思考,明辨是非 */
|
package/flex/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { FlexVerticalProps } from './interface';
|
|
1
|
+
import { FlexVertical } from './Flex';
|
|
3
2
|
import { GAP_SIZE_MAP, processGap } from './utils';
|
|
4
|
-
declare const Flex:
|
|
5
|
-
Vertical:
|
|
3
|
+
declare const Flex: import("react").ForwardRefExoticComponent<import("./interface").FlexProps & import("react").RefAttributes<unknown>> & {
|
|
4
|
+
Vertical: import("react").ForwardRefExoticComponent<import("./interface").FlexVerticalProps & import("react").RefAttributes<HTMLElement>>;
|
|
6
5
|
};
|
|
7
|
-
declare const FlexVertical: React.ForwardRefExoticComponent<FlexVerticalProps & React.RefAttributes<HTMLElement>>;
|
|
8
6
|
export { GAP_SIZE_MAP as FLEX_GAP_SIZE_MAP, processGap as flexProcessGap, FlexVertical, };
|
|
9
7
|
export default Flex;
|
|
8
|
+
export type { FlexProps } from './interface';
|
package/flex/index.js
CHANGED
|
@@ -1,52 +1,8 @@
|
|
|
1
|
-
/* 潘启宝 2026-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { 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 } from "react/jsx-runtime";
|
|
9
|
-
//#region components/common/flex/index.tsx
|
|
10
|
-
var u = {
|
|
11
|
-
component: "div",
|
|
12
|
-
gap: "small"
|
|
13
|
-
};
|
|
14
|
-
function d(r, a) {
|
|
15
|
-
let d = t(r, u, {}), { className: f, style: p, gap: m, children: h, direction: g, justify: _, justifyContent: v, align: y, alignItems: b, component: x = "div", wrap: S, rtl: C, inline: w, ...T } = d, E = v ?? _, D = b ?? y, O = `${c}-flex`, k = { display: w ? "inline-flex" : "flex" };
|
|
16
|
-
if ("wrap" in d) {
|
|
17
|
-
let t = S;
|
|
18
|
-
t = e(t) ? t ? "wrap" : "nowrap" : S, k.flexWrap = t;
|
|
19
|
-
}
|
|
20
|
-
D && (k.alignItems = D), E && (k.justifyContent = E), g && (k.flexDirection = g);
|
|
21
|
-
let A = s(null);
|
|
22
|
-
return o(a, () => ({ getRootElement() {
|
|
23
|
-
return A.current;
|
|
24
|
-
} })), /* @__PURE__ */ l(x, {
|
|
25
|
-
ref: A,
|
|
26
|
-
style: {
|
|
27
|
-
...k,
|
|
28
|
-
...i(m),
|
|
29
|
-
...p
|
|
30
|
-
},
|
|
31
|
-
className: n(O, {
|
|
32
|
-
[`${O}-rtl`]: C,
|
|
33
|
-
[`${O}-inline`]: w
|
|
34
|
-
}, !!g && `${O}-flex-direction-${g}`, !!E && `${O}-justify-content-${E}`, !!D && `${O}-align-items-${D}`, f),
|
|
35
|
-
...T,
|
|
36
|
-
children: h
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
var f = a(d);
|
|
40
|
-
f.displayName = "Flex";
|
|
41
|
-
var p = a((e, t) => {
|
|
42
|
-
let { direction: n = "column", ...r } = e;
|
|
43
|
-
return /* @__PURE__ */ l(f, {
|
|
44
|
-
...r,
|
|
45
|
-
ref: t,
|
|
46
|
-
direction: n
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
p.displayName = "FlexVertical", f.Vertical = p;
|
|
1
|
+
/* 潘启宝 2026-05-08 09:02:53 星期五 */
|
|
2
|
+
import { GAP_SIZE_MAP as e, processGap as t } from "./utils.js";
|
|
3
|
+
import n, { FlexVertical as r } from "./Flex.js";
|
|
4
|
+
//#region components/common/flex/index.ts
|
|
5
|
+
var i = Object.assign(n, { Vertical: r });
|
|
50
6
|
//#endregion
|
|
51
|
-
export {
|
|
7
|
+
export { e as FLEX_GAP_SIZE_MAP, r as FlexVertical, i as default, t as flexProcessGap };
|
|
52
8
|
/* 独立思考,明辨是非 */
|
package/flex/utils.d.ts
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { FlexProps } from './interface';
|
|
3
|
-
declare const GAP_SIZE_MAP:
|
|
4
|
-
|
|
5
|
-
'2x': number;
|
|
6
|
-
'3x': number;
|
|
7
|
-
'4x': number;
|
|
8
|
-
'5x': number;
|
|
9
|
-
'6x': number;
|
|
10
|
-
'7x': number;
|
|
11
|
-
'8x': number;
|
|
12
|
-
'9x': number;
|
|
13
|
-
};
|
|
14
|
-
declare function getGapFromSizeString(value: any): any;
|
|
3
|
+
declare const GAP_SIZE_MAP: Record<string, unknown>;
|
|
4
|
+
declare function getGapFromSizeString(value: string | number | undefined): string;
|
|
15
5
|
/**
|
|
16
6
|
* 处理间距属性
|
|
17
7
|
*/
|
package/flex/utils.js
CHANGED
package/higher-order/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
declare const withSpeechSynthesis: {
|
|
4
|
-
<P extends object>(WrappedComponent: React.ComponentType<P>): React.NamedExoticComponent<React.PropsWithoutRef<SpeechSynthesisProps & P> & React.RefAttributes<SpeechSynthesisHandles>>;
|
|
5
|
-
displayName: string;
|
|
6
|
-
};
|
|
1
|
+
import Component from './withSpeechSynthesis';
|
|
2
|
+
declare const withSpeechSynthesis: typeof Component;
|
|
7
3
|
export default withSpeechSynthesis;
|
|
4
|
+
export type { SpeechSynthesisHandles, SpeechSynthesisProps } from './interface';
|
|
@@ -1,75 +1,7 @@
|
|
|
1
|
-
/* 潘启宝 2026-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import l from "@unicom-cloud/icons/IconUiPauseCircleFill";
|
|
6
|
-
import u from "@unicom-cloud/icons/IconUiPlayCircleFill";
|
|
7
|
-
import d from "@unicom-cloud/icons/IconUiSound";
|
|
8
|
-
//#region components/common/higher-order/with-speech-synthesis/index.tsx
|
|
9
|
-
var f = (f) => {
|
|
10
|
-
let p = e((e, t) => {
|
|
11
|
-
let { useButton: p = !0, buttonProps: m = {}, ...h } = e, [g, _] = o(!1), [v, y] = o(null), b = a(() => "speechSynthesis" in window && "SpeechSynthesisUtterance" in window, []), x = n(() => {
|
|
12
|
-
b && (window.speechSynthesis.cancel(), _(!1), y(null));
|
|
13
|
-
}, [b]), S = n(() => {
|
|
14
|
-
if (!b) return;
|
|
15
|
-
x();
|
|
16
|
-
let e = h.getText?.() ?? h.text;
|
|
17
|
-
if (!e) return;
|
|
18
|
-
let t = new SpeechSynthesisUtterance(e);
|
|
19
|
-
y(t);
|
|
20
|
-
let n = () => {
|
|
21
|
-
_(!1), y(null);
|
|
22
|
-
};
|
|
23
|
-
t.onstart = () => _(!0), t.onend = n, t.onerror = n, t.onpause = () => _(!1), t.onresume = () => _(!0);
|
|
24
|
-
try {
|
|
25
|
-
window.speechSynthesis.speak(t);
|
|
26
|
-
} catch (e) {
|
|
27
|
-
console.error("Speech synthesis failed:", e), n();
|
|
28
|
-
}
|
|
29
|
-
}, [
|
|
30
|
-
x,
|
|
31
|
-
b,
|
|
32
|
-
h.getText,
|
|
33
|
-
h.text
|
|
34
|
-
]), C = n(() => {
|
|
35
|
-
b && v && window.speechSynthesis.pause();
|
|
36
|
-
}, [b, v]), w = n(() => {
|
|
37
|
-
b && v && window.speechSynthesis.resume();
|
|
38
|
-
}, [b, v]), T = n((e) => {
|
|
39
|
-
e.preventDefault(), e.stopPropagation(), g ? C() : S(), m.onClick?.(e);
|
|
40
|
-
}, [
|
|
41
|
-
g,
|
|
42
|
-
C,
|
|
43
|
-
S,
|
|
44
|
-
m.onClick
|
|
45
|
-
]);
|
|
46
|
-
if (r(() => x, [x]), i(t, () => ({
|
|
47
|
-
cancel: x,
|
|
48
|
-
speak: S,
|
|
49
|
-
pause: C,
|
|
50
|
-
resume: w
|
|
51
|
-
})), !b) return null;
|
|
52
|
-
if (p) {
|
|
53
|
-
let { label: e, text: t, children: n, ...r } = m;
|
|
54
|
-
return /* @__PURE__ */ s(f, {
|
|
55
|
-
...h,
|
|
56
|
-
type: "text",
|
|
57
|
-
size: "mini",
|
|
58
|
-
icon: s(g ? c : d, {}),
|
|
59
|
-
...r,
|
|
60
|
-
onClick: T,
|
|
61
|
-
children: e || t || n
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return /* @__PURE__ */ s(g ? l : u, {
|
|
65
|
-
...h.iconProps,
|
|
66
|
-
onClick: T,
|
|
67
|
-
style: { cursor: "pointer" }
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
return p.displayName = `WithSpeechSynthesis.${f.displayName || f.name || "SpeechSynthesis"}`, t(p);
|
|
71
|
-
};
|
|
72
|
-
f.displayName = "withSpeechSynthesis";
|
|
1
|
+
/* 潘启宝 2026-05-08 09:02:53 星期五 */
|
|
2
|
+
import e from "./withSpeechSynthesis.js";
|
|
3
|
+
//#region components/common/higher-order/with-speech-synthesis/index.ts
|
|
4
|
+
var t = Object.assign(e, {});
|
|
73
5
|
//#endregion
|
|
74
|
-
export {
|
|
6
|
+
export { t as default };
|
|
75
7
|
/* 独立思考,明辨是非 */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SpeechSynthesisHandles, SpeechSynthesisProps } from './interface';
|
|
3
|
+
declare function withSpeechSynthesis<P extends object>(WrappedComponent: React.ComponentType<P>): React.NamedExoticComponent<React.PropsWithoutRef<SpeechSynthesisProps & P> & React.RefAttributes<SpeechSynthesisHandles>>;
|
|
4
|
+
declare namespace withSpeechSynthesis {
|
|
5
|
+
var displayName: string;
|
|
6
|
+
}
|
|
7
|
+
export default withSpeechSynthesis;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/* 潘启宝 2026-05-08 09:02:53 星期五 */
|
|
2
|
+
import { forwardRef as e, memo as t, useCallback as n, useEffect as r, useImperativeHandle as i, useMemo as a, useState as o } from "react";
|
|
3
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
4
|
+
import c from "@unicom-cloud/icons/IconUiMute";
|
|
5
|
+
import l from "@unicom-cloud/icons/IconUiPauseCircleFill";
|
|
6
|
+
import u from "@unicom-cloud/icons/IconUiPlayCircleFill";
|
|
7
|
+
import d from "@unicom-cloud/icons/IconUiSound";
|
|
8
|
+
//#region components/common/higher-order/with-speech-synthesis/withSpeechSynthesis.tsx
|
|
9
|
+
function f(f) {
|
|
10
|
+
let p = e((e, t) => {
|
|
11
|
+
let { useButton: p = !0, buttonProps: m = {}, ...h } = e, [g, _] = o(!1), [v, y] = o(null), b = a(() => "speechSynthesis" in window && "SpeechSynthesisUtterance" in window, []), x = n(() => {
|
|
12
|
+
b && (window.speechSynthesis.cancel(), _(!1), y(null));
|
|
13
|
+
}, [b]), S = n(() => {
|
|
14
|
+
if (!b) return;
|
|
15
|
+
x();
|
|
16
|
+
let e = h.getText?.() ?? h.text;
|
|
17
|
+
if (!e) return;
|
|
18
|
+
let t = new SpeechSynthesisUtterance(e);
|
|
19
|
+
y(t);
|
|
20
|
+
let n = () => {
|
|
21
|
+
_(!1), y(null);
|
|
22
|
+
};
|
|
23
|
+
t.onstart = () => _(!0), t.onend = n, t.onerror = n, t.onpause = () => _(!1), t.onresume = () => _(!0);
|
|
24
|
+
try {
|
|
25
|
+
window.speechSynthesis.speak(t);
|
|
26
|
+
} catch (e) {
|
|
27
|
+
console.error("Speech synthesis failed:", e), n();
|
|
28
|
+
}
|
|
29
|
+
}, [
|
|
30
|
+
x,
|
|
31
|
+
b,
|
|
32
|
+
h.getText,
|
|
33
|
+
h.text
|
|
34
|
+
]), C = n(() => {
|
|
35
|
+
b && v && window.speechSynthesis.pause();
|
|
36
|
+
}, [b, v]), w = n(() => {
|
|
37
|
+
b && v && window.speechSynthesis.resume();
|
|
38
|
+
}, [b, v]), T = n((e) => {
|
|
39
|
+
e.preventDefault(), e.stopPropagation(), g ? C() : S(), m.onClick?.(e);
|
|
40
|
+
}, [
|
|
41
|
+
g,
|
|
42
|
+
C,
|
|
43
|
+
S,
|
|
44
|
+
m.onClick
|
|
45
|
+
]);
|
|
46
|
+
if (r(() => x, [x]), i(t, () => ({
|
|
47
|
+
cancel: x,
|
|
48
|
+
speak: S,
|
|
49
|
+
pause: C,
|
|
50
|
+
resume: w
|
|
51
|
+
})), !b) return null;
|
|
52
|
+
if (p) {
|
|
53
|
+
let { label: e, text: t, children: n, ...r } = m;
|
|
54
|
+
return /* @__PURE__ */ s(f, {
|
|
55
|
+
...h,
|
|
56
|
+
type: "text",
|
|
57
|
+
size: "mini",
|
|
58
|
+
icon: s(g ? c : d, {}),
|
|
59
|
+
...r,
|
|
60
|
+
onClick: T,
|
|
61
|
+
children: e || t || n
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return /* @__PURE__ */ s(g ? l : u, {
|
|
65
|
+
...h.iconProps,
|
|
66
|
+
onClick: T,
|
|
67
|
+
style: { cursor: "pointer" }
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
return p.displayName = `WithSpeechSynthesis.${f.displayName || f.name || "SpeechSynthesis"}`, t(p);
|
|
71
|
+
}
|
|
72
|
+
f.displayName = "withSpeechSynthesis";
|
|
73
|
+
//#endregion
|
|
74
|
+
export { f as default };
|
|
75
|
+
/* 独立思考,明辨是非 */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/* 潘启宝 2026-
|
|
2
|
-
import e from "react";
|
|
1
|
+
/* 潘启宝 2026-05-08 09:02:53 星期五 */
|
|
2
|
+
import { useRef as e } from "react";
|
|
3
3
|
//#region components/common/hooks/create-update-effect/index.ts
|
|
4
4
|
function t(t) {
|
|
5
5
|
return (n, r) => {
|
|
6
|
-
let i = e
|
|
6
|
+
let i = e(!1);
|
|
7
7
|
t(() => () => {
|
|
8
8
|
i.current = !1;
|
|
9
9
|
}, []), t(() => i.current ? n() : (i.current = !0, () => {}), r);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SYNC_STORAGE_EVENT_NAME = "
|
|
1
|
+
export declare const SYNC_STORAGE_EVENT_NAME = "PQB_HOOKS_SYNC_STORAGE_EVENT_NAME";
|
|
2
2
|
export type SetState<S> = S | ((prevState?: S) => S);
|
|
3
3
|
export interface Options<T> {
|
|
4
4
|
defaultValue?: T | (() => T);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 潘启宝 2026-
|
|
1
|
+
/* 潘启宝 2026-05-08 09:02:53 星期五 */
|
|
2
2
|
import { isFunction as e, isUndefined as t } from "../../utils/is.js";
|
|
3
3
|
import n from "../use-memoized-fn/index.js";
|
|
4
4
|
import r from "../use-update-effect/index.js";
|
|
@@ -6,7 +6,7 @@ import i from "../use-event-listener/index.js";
|
|
|
6
6
|
import a from "../use-mount/index.js";
|
|
7
7
|
import { useRef as o, useState as s } from "react";
|
|
8
8
|
//#region components/common/hooks/create-use-storage-state/index.ts
|
|
9
|
-
var c = "
|
|
9
|
+
var c = "PQB_HOOKS_SYNC_STORAGE_EVENT_NAME";
|
|
10
10
|
function l(l) {
|
|
11
11
|
function u(u, d = {}) {
|
|
12
12
|
let f, { listenStorageChange: p = !1, getInitialValueInEffect: m = !1 } = d, h = e(d.serializer) ? d.serializer : JSON.stringify, g = e(d.deserializer) ? d.deserializer : JSON.parse, _ = e(d.onError) ? d.onError : console.error;
|
package/hooks/index.d.ts
CHANGED
|
@@ -80,9 +80,9 @@ export { default as useUrlState } from './use-url-state';
|
|
|
80
80
|
export { default as useVirtualList } from './use-virtual-list';
|
|
81
81
|
export { default as useWebSocket } from './use-web-socket';
|
|
82
82
|
export { default as useWhyDidYouUpdate } from './use-why-did-you-update';
|
|
83
|
+
export { default as useEffectEvent } from './use-effect-event';
|
|
83
84
|
export { default as useForceUpdate } from './use-force-update';
|
|
84
85
|
export { default as useId } from './use-id';
|
|
85
|
-
export { default as useInView } from './use-in-view';
|
|
86
86
|
export { default as useIntersectionObserver } from './use-intersection-observer';
|
|
87
87
|
export { default as useIntersectionObservers } from './use-intersection-observers';
|
|
88
88
|
export { default as useIsFirstRender } from './use-is-first-render';
|
|
@@ -90,7 +90,6 @@ export { default as useKeyboardEvent } from './use-keyboard-event';
|
|
|
90
90
|
export { default as useListenWindowResize } from './use-listen-window-resize';
|
|
91
91
|
export { default as useMedia } from './use-media';
|
|
92
92
|
export { default as useMergeProps } from './use-merge-props';
|
|
93
|
-
export { default as useMergeValue } from './use-merge-value';
|
|
94
93
|
export { default as useMutationObservers } from './use-mutation-observers';
|
|
95
94
|
export { default as useOnlineStatus } from './use-online-status';
|
|
96
95
|
export { default as useOverflowHidden } from './use-overflow-hidden';
|