@unicom-cloud/ui-common 0.1.8 → 0.1.9
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/Development.js +1 -1
- package/Empty.js +1 -1
- package/Flex.js +7 -5
- package/Motion.js +1 -1
- package/Progress.js +1 -1
- package/ResizeObserver.js +1 -1
- package/Space.js +5 -7
- package/SuspenseFallbackTest.js +1 -1
- package/TransitionGroup.js +27 -26
- package/development/index.js +27 -25
- package/empty/index.js +1 -1
- package/flex/index.js +63 -67
- package/flex/utils.js +31 -0
- package/higher-order/index.js +1 -1
- package/higher-order/with-speech-synthesis/index.js +1 -1
- package/higher-order/withSpeechSynthesis.js +1 -1
- package/hooks/create-deep-compare-effect/index.js +1 -1
- package/hooks/create-update-effect/index.js +1 -1
- package/hooks/create-use-storage-state/index.js +1 -1
- package/hooks/createDeepCompareEffect.js +1 -1
- package/hooks/createUpdateEffect.js +1 -1
- package/hooks/createUseStorageState.js +1 -1
- package/hooks/index.js +54 -52
- 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.js +1 -1
- 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 +1 -1
- package/hooks/use-drop/index.js +1 -1
- package/hooks/use-event/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.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 +34 -29
- package/hooks/use-intersection-observer/index.js +10 -12
- package/hooks/use-intersection-observers/index.js +5 -32
- 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 +1 -1
- package/hooks/use-memoized-fn/index.js +1 -1
- package/hooks/use-merge-props/index.js +1 -1
- package/hooks/use-merge-value/index.js +9 -12
- package/hooks/use-mount/index.js +1 -1
- package/hooks/use-mouse/index.js +1 -1
- package/hooks/use-move/index.js +59 -49
- package/hooks/use-mutation-observer/index.js +1 -1
- package/hooks/use-mutation-observers/index.js +5 -4
- 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 +1 -1
- package/hooks/use-pagination/index.js +1 -1
- package/hooks/use-paste-image/index.js +20 -0
- 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 +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 +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 +5 -4
- 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 +1 -1
- package/hooks/use-state-with-promise/index.js +1 -1
- 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 +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 +1 -1
- 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/useAsyncEffect.js +1 -1
- package/hooks/useBoolean.js +1 -1
- package/hooks/useClickAway.js +1 -1
- package/hooks/useComputedState.js +1 -1
- package/hooks/useControllableValue.js +1 -1
- package/hooks/useCookieState.js +1 -1
- package/hooks/useCountDown.js +1 -1
- package/hooks/useCounter.js +1 -1
- package/hooks/useCreate.js +1 -1
- package/hooks/useCreation.js +1 -1
- package/hooks/useDebounce.js +1 -1
- package/hooks/useDebounceEffect.js +1 -1
- package/hooks/useDebounceFn.js +1 -1
- package/hooks/useDeepCompareEffect.js +1 -1
- package/hooks/useDeepCompareLayoutEffect.js +1 -1
- package/hooks/useDocumentVisibility.js +1 -1
- package/hooks/useDrag.js +1 -1
- package/hooks/useDrop.js +1 -1
- package/hooks/useEvent.js +1 -1
- package/hooks/useEventListener.js +1 -1
- package/hooks/useEventTarget.js +1 -1
- package/hooks/useExternal.js +1 -1
- package/hooks/useFavicon.js +1 -1
- package/hooks/useFocusWithin.js +1 -1
- package/hooks/useForceUpdate.js +1 -1
- package/hooks/useFullscreen.js +1 -1
- package/hooks/useGetState.js +1 -1
- package/hooks/useHistoryTravel.js +1 -1
- package/hooks/useHover.js +1 -1
- package/hooks/useId.js +1 -1
- package/hooks/useInView.js +1 -1
- package/hooks/useInViewport.js +1 -1
- package/hooks/useInfiniteScroll.js +1 -1
- package/hooks/useIntersectionObserver.js +4 -6
- package/hooks/useIntersectionObservers.js +5 -32
- package/hooks/useInterval.js +1 -1
- package/hooks/useIsFirstRender.js +1 -1
- package/hooks/useIsomorphicLayoutEffect.js +1 -1
- package/hooks/useKeyPress.js +1 -1
- package/hooks/useKeyboardEvent.js +1 -1
- package/hooks/useLatest.js +1 -1
- package/hooks/useListenWindowResize.js +1 -1
- package/hooks/useLocalStorageState.js +1 -1
- package/hooks/useLockFn.js +1 -1
- package/hooks/useLongPress.js +1 -1
- package/hooks/useMap.js +1 -1
- package/hooks/useMedia.js +1 -1
- package/hooks/useMemo.js +1 -1
- package/hooks/useMemoizedFn.js +1 -1
- package/hooks/useMergeProps.js +1 -1
- package/hooks/useMergeValue.js +4 -3
- package/hooks/useMount.js +1 -1
- package/hooks/useMouse.js +1 -1
- package/hooks/useMove.js +4 -3
- package/hooks/useMutationObserver.js +1 -1
- package/hooks/useMutationObservers.js +5 -4
- package/hooks/useNetwork.js +1 -1
- package/hooks/useOnlineStatus.js +1 -1
- package/hooks/useOverflowHidden.js +1 -1
- package/hooks/useOverrideRef.js +1 -1
- package/hooks/usePagination.js +1 -1
- package/hooks/usePasteImage.js +9 -0
- package/hooks/usePersistCallback.js +1 -1
- package/hooks/usePrefersColorSchemeDark.js +1 -1
- package/hooks/usePrevious.js +1 -1
- package/hooks/useRafInterval.js +1 -1
- package/hooks/useRafState.js +1 -1
- package/hooks/useRafTimeout.js +1 -1
- package/hooks/useReactive.js +1 -1
- package/hooks/useRefLatest.js +1 -1
- package/hooks/useRefs.js +1 -1
- package/hooks/useRequest.js +1 -1
- package/hooks/useResetState.js +1 -1
- package/hooks/useResizeObserver.js +1 -1
- package/hooks/useResizeObservers.js +5 -4
- package/hooks/useResponsive.js +1 -1
- package/hooks/useSafeState.js +1 -1
- package/hooks/useScroll.js +1 -1
- package/hooks/useSelections.js +1 -1
- package/hooks/useSessionStorageState.js +1 -1
- package/hooks/useSet.js +1 -1
- package/hooks/useSetState.js +1 -1
- package/hooks/useSize.js +1 -1
- package/hooks/useStateCallback.js +1 -1
- package/hooks/useStateWithPromise.js +1 -1
- package/hooks/useSyncState.js +1 -1
- package/hooks/useTextSelection.js +1 -1
- package/hooks/useTheme.js +1 -1
- package/hooks/useThrottle.js +1 -1
- package/hooks/useThrottleEffect.js +1 -1
- package/hooks/useThrottleFn.js +1 -1
- package/hooks/useTimeout.js +1 -1
- package/hooks/useTitle.js +1 -1
- package/hooks/useToggle.js +1 -1
- package/hooks/useTrackedEffect.js +1 -1
- package/hooks/useUnmount.js +1 -1
- package/hooks/useUnmountedRef.js +1 -1
- package/hooks/useUpdate.js +1 -1
- package/hooks/useUpdateEffect.js +1 -1
- package/hooks/useUpdateLayoutEffect.js +1 -1
- package/hooks/useUrlState.js +1 -1
- package/hooks/useVirtualList.js +1 -1
- package/hooks/useWatch.js +1 -1
- package/hooks/useWebSocket.js +1 -1
- package/hooks/useWhyDidYouUpdate.js +1 -1
- package/hooks/useWindowSize.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/hooks/utils.js +1 -1
- package/icons/file/index.js +1 -1
- package/icons/file.js +1 -1
- package/index.js +635 -48
- package/motion/CSSMotion.js +1 -1
- package/motion/CSSMotionList.js +1 -1
- package/motion/context.js +1 -1
- package/motion/hooks/useDomMotionEvents.js +1 -1
- package/motion/hooks/useNextFrame.js +1 -1
- package/motion/hooks/useStatus.js +1 -1
- package/motion/hooks/useStepQueue.js +1 -1
- package/motion/index.js +1 -1
- package/motion/interface.js +1 -1
- package/motion/util/diff.js +1 -1
- package/motion/util/motion.js +11 -10
- package/package.json +1 -1
- package/progress/index.js +40 -53
- 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 +79 -88
- package/style.css +1 -1
- package/suspense-fallback-test/index.js +1 -1
- package/transition-group/CSSTransition.js +36 -35
- package/transition-group/ChildMapping.js +1 -1
- package/transition-group/PqbCSSTransition.js +1 -1
- package/transition-group/ReplaceTransition.js +1 -1
- package/transition-group/SwitchTransition.js +1 -1
- package/transition-group/Transition.js +2 -1
- package/transition-group/TransitionGroup.js +1 -1
- package/transition-group/TransitionGroupContext.js +1 -1
- package/transition-group/index.js +27 -26
- package/types/development/interface.d.ts +3 -2
- package/types/flex/index.d.ts +6 -5
- package/types/flex/interface.d.ts +13 -12
- package/types/flex/utils.d.ts +19 -0
- package/types/hooks/index.d.ts +1 -0
- package/types/hooks/use-paste-image/index.d.ts +3 -0
- package/types/hooks/use-theme/index.d.ts +2 -2
- package/types/index.d.ts +3 -1
- package/types/motion/hooks/useStepQueue.d.ts +1 -1
- package/types/progress/index.d.ts +0 -28
- package/types/space/index.d.ts +4 -4
- package/types/space/interface.d.ts +17 -10
- package/types/transition-group/index.d.ts +10 -10
- package/types/utils/date.d.ts +1 -1
- package/types/utils/dom.d.ts +8 -9
- package/types/utils/is.d.ts +3 -2
- package/types/utils/ref.d.ts +11 -11
- package/types/utils/scrollIntoViewIfNeeded.d.ts +1 -1
- package/types/utils/tree.d.ts +1 -1
- package/types/utils/uuid.d.ts +1 -1
- package/types/utils/validate.d.ts +2 -1
- package/utils/callbackOriginRef.js +1 -1
- package/utils/caseName.js +1 -1
- package/utils/className.js +1 -1
- package/utils/compute.js +1 -1
- package/utils/constant.js +1 -1
- package/utils/copy.js +1 -1
- package/utils/date.js +8 -2
- package/utils/dayjs.js +1 -1
- package/utils/dom.js +19 -25
- package/utils/emitter.js +1 -1
- package/utils/fileToURL.js +1 -1
- package/utils/fillNBSP.js +1 -1
- package/utils/findRootElement.js +15 -15
- package/utils/findScrollParent.js +1 -1
- package/utils/getHighlightText.js +1 -1
- package/utils/getHotkeyHandler.js +1 -1
- package/utils/getStringLength.js +1 -1
- package/utils/include.js +6 -6
- package/utils/index.js +355 -323
- package/utils/intersectionObserver.js +1 -1
- package/utils/is.js +113 -76
- package/utils/keyboardCode.js +1 -1
- package/utils/lodash.js +1 -1
- package/utils/math.js +1 -1
- package/utils/mergeProps.js +1 -1
- 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 +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.js +1 -1
- package/utils/tinycolor.js +1 -1
- package/utils/toArray.js +1 -1
- package/utils/tree.js +7 -9
- package/utils/tween.js +1 -1
- package/utils/uuid.js +5 -4
- package/utils/validate.js +14 -16
- package/utils/warning.js +1 -1
- package/flex/interface.js +0 -10
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
/* 2025-
|
|
1
|
+
/* 2025-12-17 18:27:04 */
|
|
2
2
|
import v from "lodash/throttle";
|
|
3
3
|
import { useState as d, useDeferredValue as E, useEffect as O } from "react";
|
|
4
|
-
import "react-is";
|
|
5
|
-
import "../../utils/is.js";
|
|
6
|
-
import "@unicom-cloud/utils/case-name";
|
|
7
|
-
import "@unicom-cloud/utils/class-name";
|
|
8
4
|
import { NOOP as s } from "../../utils/constant.js";
|
|
9
|
-
import "
|
|
10
|
-
import "@unicom-cloud/utils/date";
|
|
11
|
-
import "../../utils/dayjs.js";
|
|
12
|
-
import "@unicom-cloud/utils/dom-helpers/canUseDOM";
|
|
13
|
-
import "@unicom-cloud/utils/dom-helpers/reflow";
|
|
14
|
-
import "@unicom-cloud/utils/emitter";
|
|
15
|
-
import "@unicom-cloud/utils/file/fileToURL";
|
|
16
|
-
import "../../utils/findRootElement.js";
|
|
17
|
-
import "lodash/escapeRegExp";
|
|
5
|
+
import "../../utils/is.js";
|
|
18
6
|
import "lodash/assign";
|
|
19
7
|
import "lodash/assignIn";
|
|
20
8
|
import "lodash/at";
|
|
@@ -74,24 +62,9 @@ import "lodash/upperFirst";
|
|
|
74
62
|
import "lodash/without";
|
|
75
63
|
import "lodash/xor";
|
|
76
64
|
import "lodash/zip";
|
|
77
|
-
import "@unicom-cloud/utils/math";
|
|
78
|
-
import "@unicom-cloud/utils/pinyin";
|
|
79
|
-
import "@unicom-cloud/utils/file/saveAs";
|
|
80
|
-
import "@unicom-cloud/utils/screenfull";
|
|
81
|
-
import "../../utils/setCreateRoot.js";
|
|
82
|
-
import "@unicom-cloud/utils/constant/ui";
|
|
83
|
-
import "@unicom-cloud/utils/constant/ui.js";
|
|
84
|
-
import "@unicom-cloud/utils/tinycolor";
|
|
85
|
-
import "@unicom-cloud/utils/ui-color";
|
|
86
|
-
import "@unicom-cloud/utils/string";
|
|
87
|
-
import "@unicom-cloud/utils/tree";
|
|
88
|
-
import "@unicom-cloud/utils/tween";
|
|
89
|
-
import "uuid";
|
|
90
|
-
import "@unicom-cloud/utils/validate";
|
|
91
|
-
import "@unicom-cloud/utils/constant/keyboardCode";
|
|
92
65
|
import k from "../use-latest/index.js";
|
|
93
66
|
import { isFunction as C } from "@unicom-cloud/utils/is";
|
|
94
|
-
function
|
|
67
|
+
function jt(c, i = [], f = {}) {
|
|
95
68
|
const { immediate: m, ...a } = f, [u, l] = d(), b = E(u), h = k(c);
|
|
96
69
|
return O(() => {
|
|
97
70
|
if (!(i.length || m)) return s;
|
|
@@ -116,6 +89,6 @@ function nr(c, i = [], f = {}) {
|
|
|
116
89
|
}, i), b;
|
|
117
90
|
}
|
|
118
91
|
export {
|
|
119
|
-
|
|
120
|
-
|
|
92
|
+
jt as default,
|
|
93
|
+
jt as useIntersectionObservers
|
|
121
94
|
};
|
package/hooks/use-map/index.js
CHANGED
package/hooks/use-media/index.js
CHANGED
package/hooks/use-memo/index.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
/* 2025-
|
|
2
|
-
import {
|
|
1
|
+
/* 2025-12-17 18:27:04 */
|
|
2
|
+
import { useState as n, useEffect as m } from "react";
|
|
3
3
|
import "../../utils/is.js";
|
|
4
|
-
import d from "../use-
|
|
4
|
+
import d from "../use-is-first-render/index.js";
|
|
5
|
+
import p from "../use-previous/index.js";
|
|
5
6
|
import { isUndefined as r } from "@unicom-cloud/utils/is";
|
|
6
|
-
function R(
|
|
7
|
-
const { defaultValue:
|
|
7
|
+
function R(f, a) {
|
|
8
|
+
const { defaultValue: s, value: e } = a || {}, l = d(), u = p(e), [o, i] = n(() => {
|
|
8
9
|
let t = e;
|
|
9
|
-
return r(e) ? r(
|
|
10
|
+
return r(e) ? r(s) ? t = f : t = s : t = e, t;
|
|
10
11
|
});
|
|
11
12
|
return m(() => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
e === void 0 && (f === e || a(e));
|
|
17
|
-
}, [f, e]), [r(e) ? o : e, a, o];
|
|
13
|
+
l || e === void 0 && (u === e || i(e));
|
|
14
|
+
}, [u, e]), [r(e) ? o : e, i, o];
|
|
18
15
|
}
|
|
19
16
|
export {
|
|
20
17
|
R as default
|
package/hooks/use-mount/index.js
CHANGED
package/hooks/use-mouse/index.js
CHANGED
package/hooks/use-move/index.js
CHANGED
|
@@ -1,69 +1,79 @@
|
|
|
1
|
-
/* 2025-
|
|
2
|
-
import { useState as
|
|
3
|
-
import { on as
|
|
4
|
-
import { findRootElement as
|
|
5
|
-
import { isElementByInstanceof as
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
/* 2025-12-17 18:27:04 */
|
|
2
|
+
import { useState as k, useRef as F, useEffect as v } from "react";
|
|
3
|
+
import { on as m, off as g } from "../../utils/dom.js";
|
|
4
|
+
import { findRootElement as w } from "../../utils/findRootElement.js";
|
|
5
|
+
import { isElementByInstanceof as X } from "../../utils/is.js";
|
|
6
|
+
import I from "../use-update/index.js";
|
|
7
|
+
import { isPlainObject as L } from "@unicom-cloud/utils/is";
|
|
8
|
+
function Y() {
|
|
8
9
|
return {
|
|
9
10
|
screenX: 0,
|
|
10
11
|
screenY: 0,
|
|
11
|
-
prewTranslateX: 0,
|
|
12
|
-
prewTranslateY: 0,
|
|
13
12
|
translateX: 0,
|
|
14
13
|
translateY: 0,
|
|
15
14
|
boundingClientRect: null,
|
|
16
15
|
offsetParentBoundingClientRect: null
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
|
-
function
|
|
20
|
-
let {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
function K(o, i = !1) {
|
|
19
|
+
let {
|
|
20
|
+
trigger: n,
|
|
21
|
+
target: r,
|
|
22
|
+
draggable: l = !0
|
|
23
|
+
} = { trigger: null, target: null, draggable: !0 };
|
|
24
|
+
L(o) && ("trigger" in o || "target" in o) ? (n = w(o.trigger), r = w(o.target), l = o.draggable ?? l) : n = r = w(o), n ||= r, r ||= n;
|
|
25
|
+
const s = document.documentElement, [x, b] = k(i ? { translate: void 0 } : {}), B = I(), d = F(Y());
|
|
26
|
+
function E(t) {
|
|
27
|
+
if (!X(r)) return;
|
|
27
28
|
t.preventDefault();
|
|
28
|
-
const e =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
s = Math.min(s, O - h), a += e.prewTranslateX, s += e.prewTranslateY, e.translateX = a, e.translateY = s;
|
|
33
|
-
const p = `translate(${a}px, ${s}px)`;
|
|
34
|
-
l ? E({ translate: p }) : R(r) && (r.style.transform = p);
|
|
29
|
+
const e = d.current, a = window.getComputedStyle(r).transform.split(",");
|
|
30
|
+
a.length > 1 && (e.translateX = parseFloat(a.at(-2)) || e.translateX, e.translateY = parseFloat(a.at(-1)) || e.translateY), e.screenX = t.screenX, e.screenY = t.screenY, e.boundingClientRect = r.getBoundingClientRect();
|
|
31
|
+
const u = r.parentElement;
|
|
32
|
+
e.offsetParentBoundingClientRect = u ? u.getBoundingClientRect() : new DOMRect(), y();
|
|
35
33
|
}
|
|
36
|
-
function
|
|
37
|
-
t
|
|
34
|
+
function D(t) {
|
|
35
|
+
if (!(t instanceof Event)) return;
|
|
36
|
+
t.preventDefault();
|
|
37
|
+
const e = d.current, { left: a, right: u, top: O, bottom: H } = e.boundingClientRect || new DOMRect(), {
|
|
38
|
+
left: P,
|
|
39
|
+
right: $,
|
|
40
|
+
top: R,
|
|
41
|
+
bottom: j,
|
|
42
|
+
width: S,
|
|
43
|
+
height: U
|
|
44
|
+
} = e.offsetParentBoundingClientRect || new DOMRect();
|
|
45
|
+
let c = Math.max(t.screenX - e.screenX, -(a - P));
|
|
46
|
+
c = Math.min(c, P + S - u);
|
|
47
|
+
let f = Math.max(t.screenY - e.screenY, -(O - R));
|
|
48
|
+
f = Math.min(f, R + U - H), c += e.translateX, f += e.translateY;
|
|
49
|
+
const C = `translate(${c}px, ${f}px)`;
|
|
50
|
+
i ? b({ translate: C }) : X(r) && (r.style.transform = C);
|
|
38
51
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
52
|
+
function h(t) {
|
|
53
|
+
t.preventDefault(), p();
|
|
41
54
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
55
|
+
function M(t) {
|
|
56
|
+
d.current = Y(), i ? b({}) : D(new MouseEvent("mousemove"));
|
|
44
57
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
58
|
+
function y() {
|
|
59
|
+
p(), m(s, "mousemove", D), m(s, "mouseup", h);
|
|
47
60
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
t.preventDefault();
|
|
51
|
-
const e = g.current;
|
|
52
|
-
e.screenX = t.screenX, e.screenY = t.screenY, e.prewTranslateX = e.translateX, e.prewTranslateY = e.translateY, e.boundingClientRect = r.getBoundingClientRect();
|
|
53
|
-
const c = r.offsetParent;
|
|
54
|
-
e.offsetParentBoundingClientRect = c ? c.getBoundingClientRect() : new DOMRect(), x();
|
|
61
|
+
function p() {
|
|
62
|
+
g(s, "mousemove", D), g(s, "mouseup", h);
|
|
55
63
|
}
|
|
56
|
-
if (
|
|
57
|
-
if (n &&
|
|
58
|
-
return
|
|
59
|
-
|
|
64
|
+
if (v(() => {
|
|
65
|
+
if (n && l)
|
|
66
|
+
return m(n, "mousedown", E), m(n, "dblclick", M), () => {
|
|
67
|
+
g(n, "mousedown", E), g(n, "dblclick", M);
|
|
60
68
|
};
|
|
61
|
-
}, [n,
|
|
62
|
-
|
|
63
|
-
}, []),
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
}, [n, l]), v(() => () => {
|
|
70
|
+
M(), p();
|
|
71
|
+
}, []), v(() => (setTimeout(() => {
|
|
72
|
+
B();
|
|
73
|
+
}, 227), () => {
|
|
74
|
+
}), []), i)
|
|
75
|
+
return x;
|
|
66
76
|
}
|
|
67
77
|
export {
|
|
68
|
-
|
|
78
|
+
K as default
|
|
69
79
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 2025-
|
|
1
|
+
/* 2025-12-17 18:27:04 */
|
|
2
2
|
import h from "lodash/throttle";
|
|
3
3
|
import { useState as v, useDeferredValue as O, useEffect as E } from "react";
|
|
4
4
|
import "react-is";
|
|
@@ -10,6 +10,7 @@ import "@unicom-cloud/utils/clipboard-copy";
|
|
|
10
10
|
import "@unicom-cloud/utils/date";
|
|
11
11
|
import "../../utils/dayjs.js";
|
|
12
12
|
import "@unicom-cloud/utils/dom-helpers/canUseDOM";
|
|
13
|
+
import "@unicom-cloud/utils/dom-helpers/getElementCoordinates";
|
|
13
14
|
import "@unicom-cloud/utils/dom-helpers/reflow";
|
|
14
15
|
import "@unicom-cloud/utils/emitter";
|
|
15
16
|
import "@unicom-cloud/utils/file/fileToURL";
|
|
@@ -91,7 +92,7 @@ import "@unicom-cloud/utils/validate";
|
|
|
91
92
|
import "@unicom-cloud/utils/constant/keyboardCode";
|
|
92
93
|
import k from "../use-latest/index.js";
|
|
93
94
|
import { isFunction as C } from "@unicom-cloud/utils/is";
|
|
94
|
-
function
|
|
95
|
+
function sr(c, o = [], u = {}) {
|
|
95
96
|
const { immediate: i, ...a } = u, [f, l] = v(), b = O(f), d = k(c);
|
|
96
97
|
return E(() => {
|
|
97
98
|
if (!(o.length || i)) return s;
|
|
@@ -119,6 +120,6 @@ function nr(c, o = [], u = {}) {
|
|
|
119
120
|
}, o), b;
|
|
120
121
|
}
|
|
121
122
|
export {
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
sr as default,
|
|
124
|
+
sr as useMutationObservers
|
|
124
125
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 2025-
|
|
1
|
+
/* 2025-12-17 18:27:04 */
|
|
2
2
|
import { useRef as d, useEffect as f } from "react";
|
|
3
3
|
function a(o, { hidden: s }) {
|
|
4
4
|
const c = d(!1), r = d({}), u = (t) => t === document.body || t.tagName?.toLowerCase?.() === "body" ? window.innerWidth - (document.body.clientWidth || document.documentElement.clientWidth) : t.offsetWidth - t.clientWidth, l = () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 2025-
|
|
1
|
+
/* 2025-12-17 18:27:04 */
|
|
2
2
|
import f, { useCallback as l, isValidElement as u, cloneElement as c } from "react";
|
|
3
3
|
import { callbackOriginRef as a } from "../../utils/callbackOriginRef.js";
|
|
4
4
|
import { supportRef as m } from "../../utils/ref.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* 2025-12-17 18:27:04 */
|
|
2
|
+
import { useState as l, useEffect as d } from "react";
|
|
3
|
+
import "../../utils/is.js";
|
|
4
|
+
import y from "../use-latest/index.js";
|
|
5
|
+
import { isArray as A, isEmptyArray as E, isFunction as b } from "@unicom-cloud/utils/is";
|
|
6
|
+
function F(a, i = []) {
|
|
7
|
+
const n = y(a), [o, m] = l([]);
|
|
8
|
+
return d(() => {
|
|
9
|
+
function r(c) {
|
|
10
|
+
const u = c.clipboardData.items, t = Array.from(u).filter((e, f, p) => e.kind === "file" && e.type.startsWith("image/")).map((e, f, p) => e.getAsFile()), s = n.current;
|
|
11
|
+
A(t) && !E(t) && b(s) && s(t), m(t);
|
|
12
|
+
}
|
|
13
|
+
return document.addEventListener("paste", r), () => {
|
|
14
|
+
document.removeEventListener("paste", r);
|
|
15
|
+
};
|
|
16
|
+
}, i), o;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
F as default
|
|
20
|
+
};
|
package/hooks/use-refs/index.js
CHANGED