@unicom-cloud/ui-common 0.1.14 → 0.1.16
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 +1 -1
- package/Motion.js +1 -1
- package/Progress.js +1 -1
- package/ResizeObserver.js +1 -1
- package/Space.js +1 -1
- package/SuspenseFallbackTest.js +1 -1
- package/Timer.js +1 -1
- package/TransitionGroup.js +1 -1
- package/development/index.js +1 -1
- package/empty/index.js +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/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 +13 -13
- 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-effect-event/index.js +17 -0
- 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 +1 -1
- 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 +54 -39
- 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 +6 -6
- 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 +4 -4
- package/hooks/use-merge-props/index.js +2 -2
- 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 +2 -2
- 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 +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 +18 -17
- 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 +23 -26
- 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 +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 +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 +6 -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.js +25 -22
- 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/useEffectEvent.js +6 -0
- 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 +1 -1
- package/hooks/useIntersectionObservers.js +4 -4
- 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 +1 -1
- package/hooks/useMobile.js +1 -1
- package/hooks/useMount.js +1 -1
- package/hooks/useMouse.js +1 -1
- package/hooks/useMove.js +1 -1
- package/hooks/useMutationObserver.js +1 -1
- package/hooks/useMutationObservers.js +4 -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 +1 -1
- 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 +5 -5
- package/hooks/useRequest.js +1 -1
- package/hooks/useResetState.js +1 -1
- package/hooks/useResizeObserver.js +1 -1
- package/hooks/useResizeObservers.js +2 -2
- 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 +4 -3
- 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 +6 -7
- 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 +510 -524
- package/motion/CSSMotion.js +2 -2
- 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 +1 -1
- package/package.json +1 -1
- package/progress/index.js +1 -1
- package/resize-observer/Collection.js +1 -1
- package/resize-observer/SingleObserver.js +2 -2
- package/resize-observer/index.js +3 -3
- package/resize-observer/observerUtil.js +1 -1
- package/space/index.js +2 -2
- package/suspense-fallback-test/index.js +1 -1
- package/timer/index.js +1 -1
- package/transition-group/CSSTransition.js +2 -2
- package/transition-group/ChildMapping.js +1 -1
- package/transition-group/PqbCSSTransition.js +2 -2
- package/transition-group/ReplaceTransition.js +2 -2
- package/transition-group/SwitchTransition.js +1 -1
- package/transition-group/Transition.js +31 -35
- package/transition-group/TransitionGroup.js +1 -1
- package/transition-group/TransitionGroupContext.js +1 -1
- package/transition-group/index.js +1 -1
- package/types/hooks/use-cookie-state/index.d.ts +1 -1
- package/types/hooks/use-counter/index.d.ts +3 -3
- package/types/hooks/use-effect-event/index.d.ts +3 -0
- package/types/hooks/use-history-travel/index.d.ts +2 -2
- package/types/hooks/use-listen-window-resize/index.d.ts +1 -3
- package/types/hooks/use-map/index.d.ts +4 -4
- package/types/hooks/use-memoized-fn/index.d.ts +1 -1
- package/types/hooks/use-selections/index.d.ts +3 -3
- package/types/hooks/use-set/index.d.ts +2 -2
- package/types/hooks/use-set-state/index.d.ts +2 -2
- package/types/hooks/use-theme/index.d.ts +1 -1
- package/types/hooks/use-update/index.d.ts +1 -1
- package/types/hooks/use-url-state/index.d.ts +1 -2
- package/types/hooks/use-virtual-list/index.d.ts +1 -1
- package/types/hooks/use-window-size/index.d.ts +1 -1
- package/types/hooks/utils/noop.d.ts +2 -0
- package/types/motion/context.d.ts +1 -1
- package/types/resize-observer/Collection.d.ts +1 -1
- package/types/transition-group/CSSTransition.d.ts +1 -1
- package/types/transition-group/PqbCSSTransition.d.ts +1 -1
- package/types/transition-group/ReplaceTransition.d.ts +1 -1
- package/types/transition-group/SwitchTransition.d.ts +1 -1
- package/types/transition-group/Transition.d.ts +1 -1
- package/types/transition-group/TransitionGroup.d.ts +1 -1
- package/types/utils/className.d.ts +1 -1
- package/types/utils/emitter.d.ts +1 -1
- package/types/utils/scrollIntoViewIfNeeded.d.ts +2 -11
- package/types/utils/setDarkTheme.d.ts +2 -2
- package/utils/callOrReturn.js +1 -1
- package/utils/callbackOriginRef.js +1 -1
- package/utils/caseName.js +1 -1
- package/utils/className.js +4 -3
- 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 +3 -3
- package/utils/fileRead.js +1 -1
- package/utils/fileToDataURL.js +1 -1
- package/utils/fillNBSP.js +1 -1
- package/utils/findRootElement.js +1 -1
- 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 +1 -1
- package/utils/index.js +336 -350
- package/utils/intersectionObserver.js +1 -1
- package/utils/is.js +1 -1
- 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 +2 -2
- 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 +5 -72
- package/utils/setCreateRoot.js +1 -1
- package/utils/setDarkTheme.js +20 -19
- 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 +2 -2
- 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/types/utils/compute.d.ts +0 -100
- package/utils/compute.js +0 -142
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/* 2026-
|
|
1
|
+
/* 2026-02-26 14:43:01 */
|
|
2
2
|
import "../../utils/is.js";
|
|
3
|
-
import
|
|
4
|
-
import { getTargetElement as
|
|
5
|
-
import { isAppleDevice as
|
|
6
|
-
import
|
|
7
|
-
import { isFunction as
|
|
8
|
-
const
|
|
3
|
+
import m from "../use-latest/index.js";
|
|
4
|
+
import { getTargetElement as b } from "../utils/domTarget.js";
|
|
5
|
+
import { isAppleDevice as C } from "@unicom-cloud/utils/constant/platform";
|
|
6
|
+
import E from "../utils/useDeepCompareWithTarget.js";
|
|
7
|
+
import { isFunction as v, isArray as L, isString as q, isNumber as y } from "@unicom-cloud/utils/is";
|
|
8
|
+
const w = {
|
|
9
9
|
0: 48,
|
|
10
10
|
1: 49,
|
|
11
11
|
2: 50,
|
|
@@ -20,20 +20,33 @@ const y = {
|
|
|
20
20
|
tab: 9,
|
|
21
21
|
enter: 13,
|
|
22
22
|
shift: 16,
|
|
23
|
+
// Legacy alias kept for compatibility; standard name is "control".
|
|
23
24
|
ctrl: 17,
|
|
25
|
+
control: 17,
|
|
24
26
|
alt: 18,
|
|
27
|
+
// Legacy alias kept for compatibility; standard name is "pause".
|
|
25
28
|
pausebreak: 19,
|
|
29
|
+
pause: 19,
|
|
26
30
|
capslock: 20,
|
|
31
|
+
// Legacy alias kept for compatibility; standard name is "escape".
|
|
27
32
|
esc: 27,
|
|
33
|
+
escape: 27,
|
|
34
|
+
// Legacy alias kept for compatibility; standard name is "spacebar" (non-standard but widely used).
|
|
28
35
|
space: 32,
|
|
36
|
+
spacebar: 32,
|
|
29
37
|
pageup: 33,
|
|
30
38
|
pagedown: 34,
|
|
31
39
|
end: 35,
|
|
32
40
|
home: 36,
|
|
41
|
+
// Legacy aliases kept for compatibility; standard names are "arrowleft/arrowup/arrowright/arrowdown".
|
|
33
42
|
leftarrow: 37,
|
|
43
|
+
arrowleft: 37,
|
|
34
44
|
uparrow: 38,
|
|
45
|
+
arrowup: 38,
|
|
35
46
|
rightarrow: 39,
|
|
47
|
+
arrowright: 39,
|
|
36
48
|
downarrow: 40,
|
|
49
|
+
arrowdown: 40,
|
|
37
50
|
insert: 45,
|
|
38
51
|
delete: 46,
|
|
39
52
|
a: 65,
|
|
@@ -64,8 +77,10 @@ const y = {
|
|
|
64
77
|
z: 90,
|
|
65
78
|
leftwindowkey: 91,
|
|
66
79
|
rightwindowkey: 92,
|
|
67
|
-
meta:
|
|
80
|
+
meta: C ? [91, 93] : [91, 92],
|
|
81
|
+
// Legacy alias kept for compatibility; standard name is "contextmenu".
|
|
68
82
|
selectkey: 93,
|
|
83
|
+
contextmenu: 93,
|
|
69
84
|
numpad0: 96,
|
|
70
85
|
numpad1: 97,
|
|
71
86
|
numpad2: 98,
|
|
@@ -106,64 +121,64 @@ const y = {
|
|
|
106
121
|
backslash: 220,
|
|
107
122
|
closebracket: 221,
|
|
108
123
|
singlequote: 222
|
|
109
|
-
},
|
|
124
|
+
}, p = {
|
|
110
125
|
ctrl: (e) => e.ctrlKey,
|
|
111
126
|
shift: (e) => e.shiftKey,
|
|
112
127
|
alt: (e) => e.altKey,
|
|
113
|
-
meta: (e) => e.type === "keyup" ?
|
|
128
|
+
meta: (e) => e.type === "keyup" ? w.meta.includes(e.keyCode) : e.metaKey
|
|
114
129
|
};
|
|
115
|
-
function
|
|
116
|
-
return q(e) ||
|
|
130
|
+
function h(e) {
|
|
131
|
+
return q(e) || y(e);
|
|
117
132
|
}
|
|
118
|
-
function
|
|
119
|
-
const r = Object.keys(
|
|
133
|
+
function x(e) {
|
|
134
|
+
const r = Object.keys(p).reduce((t, n) => p[n](e) ? t + 1 : t, 0);
|
|
120
135
|
return [16, 17, 18, 91, 92].includes(e.keyCode) ? r : r + 1;
|
|
121
136
|
}
|
|
122
|
-
function
|
|
137
|
+
function g(e, r, t) {
|
|
123
138
|
if (!e.key)
|
|
124
139
|
return !1;
|
|
125
|
-
if (
|
|
140
|
+
if (y(r))
|
|
126
141
|
return e.keyCode === r ? r : !1;
|
|
127
142
|
const n = r.split(".");
|
|
128
|
-
let
|
|
129
|
-
for (const
|
|
130
|
-
const
|
|
131
|
-
(
|
|
143
|
+
let o = 0;
|
|
144
|
+
for (const c of n) {
|
|
145
|
+
const a = p[c], f = w[c.toLowerCase()];
|
|
146
|
+
(a && a(e) || f && f === e.keyCode) && o++;
|
|
132
147
|
}
|
|
133
|
-
return t ?
|
|
148
|
+
return t ? o === n.length && x(e) === n.length ? r : !1 : o === n.length ? r : !1;
|
|
134
149
|
}
|
|
135
150
|
function A(e, r) {
|
|
136
|
-
return
|
|
151
|
+
return v(e) ? e : h(e) ? (t) => g(t, e, r) : L(e) ? (t) => e.find((n) => g(t, n, r)) : () => !!e;
|
|
137
152
|
}
|
|
138
153
|
const G = ["keydown"];
|
|
139
|
-
function
|
|
154
|
+
function O(e, r, t) {
|
|
140
155
|
const {
|
|
141
156
|
events: n = G,
|
|
142
|
-
target:
|
|
143
|
-
exactMatch:
|
|
144
|
-
useCapture:
|
|
145
|
-
} = t || {},
|
|
146
|
-
|
|
157
|
+
target: o,
|
|
158
|
+
exactMatch: c = !1,
|
|
159
|
+
useCapture: a = !1
|
|
160
|
+
} = t || {}, f = m(r), k = m(e);
|
|
161
|
+
E(
|
|
147
162
|
() => {
|
|
148
|
-
const u =
|
|
163
|
+
const u = b(o, window);
|
|
149
164
|
if (!u)
|
|
150
165
|
return;
|
|
151
|
-
const
|
|
152
|
-
const i = A(
|
|
153
|
-
if (
|
|
154
|
-
return
|
|
166
|
+
const l = (s) => {
|
|
167
|
+
const i = s, d = A(k.current, c)(i), K = h(d) ? d : i.key;
|
|
168
|
+
if (d)
|
|
169
|
+
return f.current?.(i, K);
|
|
155
170
|
};
|
|
156
|
-
for (const
|
|
157
|
-
u?.addEventListener?.(
|
|
171
|
+
for (const s of n)
|
|
172
|
+
u?.addEventListener?.(s, l, a);
|
|
158
173
|
return () => {
|
|
159
|
-
for (const
|
|
160
|
-
u?.removeEventListener?.(
|
|
174
|
+
for (const s of n)
|
|
175
|
+
u?.removeEventListener?.(s, l, a);
|
|
161
176
|
};
|
|
162
177
|
},
|
|
163
178
|
[n],
|
|
164
|
-
|
|
179
|
+
o
|
|
165
180
|
);
|
|
166
181
|
}
|
|
167
182
|
export {
|
|
168
|
-
|
|
183
|
+
O as default
|
|
169
184
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/* 2026-
|
|
2
|
-
import { useEffect as
|
|
3
|
-
function
|
|
4
|
-
|
|
1
|
+
/* 2026-02-26 14:43:01 */
|
|
2
|
+
import { useEffect as n } from "react";
|
|
3
|
+
function t(e) {
|
|
4
|
+
n(() => (window.addEventListener("resize", e), window.addEventListener("orientationchange", e), () => {
|
|
5
5
|
window.removeEventListener("resize", e), window.removeEventListener("orientationchange", e);
|
|
6
|
-
}),
|
|
6
|
+
}), []);
|
|
7
7
|
}
|
|
8
8
|
export {
|
|
9
|
-
|
|
9
|
+
t as default
|
|
10
10
|
};
|
package/hooks/use-map/index.js
CHANGED
package/hooks/use-media/index.js
CHANGED
package/hooks/use-memo/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/* 2026-
|
|
1
|
+
/* 2026-02-26 14:43:01 */
|
|
2
2
|
import { useRef as t, useMemo as n } from "react";
|
|
3
3
|
import "../../utils/is.js";
|
|
4
|
-
import
|
|
5
|
-
import { isFunction as
|
|
4
|
+
import s from "../utils/isDev.js";
|
|
5
|
+
import { isFunction as u } from "@unicom-cloud/utils/is";
|
|
6
6
|
const a = (e) => {
|
|
7
|
-
|
|
7
|
+
s && (u(e) || console.error(
|
|
8
8
|
`useMemoizedFn expected parameter is a function, got ${typeof e}`
|
|
9
9
|
));
|
|
10
10
|
const o = t(e);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* 2026-
|
|
1
|
+
/* 2026-02-26 14:43:01 */
|
|
2
2
|
import { useMemo as m } from "react";
|
|
3
|
-
import
|
|
3
|
+
import u from "../../utils/omit.js";
|
|
4
4
|
function c(r, e, i = {}) {
|
|
5
5
|
const { _ignorePropsFromGlobal: p } = r, o = m(() => ({
|
|
6
6
|
...e,
|
package/hooks/use-mount/index.js
CHANGED
package/hooks/use-mouse/index.js
CHANGED
package/hooks/use-move/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* 2026-
|
|
1
|
+
/* 2026-02-26 14:43:01 */
|
|
2
2
|
import { useState as k, useRef as F, useEffect as v } from "react";
|
|
3
3
|
import { on as m, off as g } from "../../utils/dom.js";
|
|
4
|
-
import
|
|
4
|
+
import w from "../../utils/findRootElement.js";
|
|
5
5
|
import { isElementByInstanceof as X } from "../../utils/is.js";
|
|
6
6
|
import I from "../use-update/index.js";
|
|
7
7
|
import { isPlainObject as L } from "@unicom-cloud/utils/is";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 2026-
|
|
1
|
+
/* 2026-02-26 14:43:01 */
|
|
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
|
-
/* 2026-
|
|
1
|
+
/* 2026-02-26 14:43:01 */
|
|
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";
|
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
/* 2026-
|
|
1
|
+
/* 2026-02-26 14:43:01 */
|
|
2
2
|
import { useRef as s, useCallback as m, useEffect as u } from "react";
|
|
3
3
|
import "../../utils/is.js";
|
|
4
4
|
import f from "../use-latest/index.js";
|
|
5
5
|
import { isNumber as d, isUndefined as c } from "@unicom-cloud/utils/is";
|
|
6
|
-
const l = (
|
|
6
|
+
const l = (t, e = 0) => {
|
|
7
7
|
if (c(requestAnimationFrame))
|
|
8
8
|
return {
|
|
9
|
-
id: setInterval(
|
|
9
|
+
id: setInterval(t, e)
|
|
10
10
|
};
|
|
11
|
-
let
|
|
11
|
+
let o = Date.now();
|
|
12
12
|
const r = {
|
|
13
13
|
id: 0
|
|
14
14
|
}, n = () => {
|
|
15
|
-
|
|
15
|
+
const i = Date.now();
|
|
16
|
+
r.id = requestAnimationFrame(n), i - o >= e && (t(), o = Date.now());
|
|
16
17
|
};
|
|
17
18
|
return r.id = requestAnimationFrame(n), r;
|
|
18
|
-
},
|
|
19
|
-
if (
|
|
20
|
-
return clearInterval(
|
|
21
|
-
cancelAnimationFrame(
|
|
19
|
+
}, p = (t) => c(cancelAnimationFrame), v = (t) => {
|
|
20
|
+
if (p(t.id))
|
|
21
|
+
return clearInterval(t.id);
|
|
22
|
+
cancelAnimationFrame(t.id);
|
|
22
23
|
};
|
|
23
|
-
function
|
|
24
|
-
const r =
|
|
25
|
-
|
|
24
|
+
function D(t, e, o) {
|
|
25
|
+
const r = o?.immediate, n = f(t), i = s(void 0), a = m(() => {
|
|
26
|
+
i.current && v(i.current);
|
|
26
27
|
}, []);
|
|
27
28
|
return u(() => {
|
|
28
|
-
if (!(!d(
|
|
29
|
-
return r && n.current(),
|
|
29
|
+
if (!(!d(e) || e < 0))
|
|
30
|
+
return r && n.current(), i.current = l(() => {
|
|
30
31
|
n.current();
|
|
31
|
-
},
|
|
32
|
-
}, [
|
|
32
|
+
}, e), a;
|
|
33
|
+
}, [e]), a;
|
|
33
34
|
}
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
+
D as default
|
|
36
37
|
};
|
package/hooks/use-refs/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/* 2026-
|
|
1
|
+
/* 2026-02-26 14:43:01 */
|
|
2
2
|
import "../../../utils/is.js";
|
|
3
3
|
import { isFunction as u } from "@unicom-cloud/utils/is";
|
|
4
4
|
class c {
|
|
5
|
-
constructor(t,
|
|
6
|
-
this.serviceRef = t, this.options =
|
|
5
|
+
constructor(t, s, r, n = {}) {
|
|
6
|
+
this.serviceRef = t, this.options = s, this.subscribe = r, this.initState = n, this.pluginImpls = [], this.count = 0, this.state = {
|
|
7
7
|
loading: !1,
|
|
8
8
|
params: void 0,
|
|
9
9
|
data: void 0,
|
|
10
10
|
error: void 0
|
|
11
11
|
}, this.state = {
|
|
12
12
|
...this.state,
|
|
13
|
-
loading: !
|
|
13
|
+
loading: !s.manual,
|
|
14
14
|
...n
|
|
15
15
|
};
|
|
16
16
|
}
|
|
@@ -20,54 +20,51 @@ class c {
|
|
|
20
20
|
...t
|
|
21
21
|
}, this.subscribe();
|
|
22
22
|
}
|
|
23
|
-
runPluginHandler(t, ...
|
|
24
|
-
const r = this.pluginImpls.map((n) => n[t]?.(...
|
|
23
|
+
runPluginHandler(t, ...s) {
|
|
24
|
+
const r = this.pluginImpls.map((n) => n[t]?.(...s)).filter(Boolean);
|
|
25
25
|
return Object.assign({}, ...r);
|
|
26
26
|
}
|
|
27
27
|
async runAsync(...t) {
|
|
28
28
|
this.count += 1;
|
|
29
|
-
const
|
|
29
|
+
const s = this.count, {
|
|
30
30
|
stopNow: r = !1,
|
|
31
31
|
returnNow: n = !1,
|
|
32
32
|
...o
|
|
33
33
|
} = this.runPluginHandler("onBefore", t);
|
|
34
|
-
if (r
|
|
35
|
-
return new Promise(() => {
|
|
36
|
-
});
|
|
37
|
-
if (this.setState({
|
|
34
|
+
if (r || (this.setState({
|
|
38
35
|
loading: !0,
|
|
39
36
|
params: t,
|
|
40
37
|
...o
|
|
41
|
-
}), n)
|
|
38
|
+
}), n))
|
|
42
39
|
return Promise.resolve(o.data);
|
|
43
40
|
this.options.onBefore?.(t);
|
|
44
41
|
try {
|
|
45
|
-
let { servicePromise:
|
|
42
|
+
let { servicePromise: i } = this.runPluginHandler(
|
|
46
43
|
"onRequest",
|
|
47
44
|
this.serviceRef.current,
|
|
48
45
|
t
|
|
49
46
|
);
|
|
50
|
-
|
|
51
|
-
const e = await
|
|
52
|
-
return
|
|
47
|
+
i || (i = this.serviceRef.current(...t));
|
|
48
|
+
const e = await i;
|
|
49
|
+
return s !== this.count ? new Promise(() => {
|
|
53
50
|
}) : (this.setState({
|
|
54
51
|
data: e,
|
|
55
52
|
error: void 0,
|
|
56
53
|
loading: !1
|
|
57
|
-
}), this.options.onSuccess?.(e, t), this.runPluginHandler("onSuccess", e, t), this.options.onFinally?.(t, e, void 0),
|
|
58
|
-
} catch (
|
|
59
|
-
if (
|
|
54
|
+
}), this.options.onSuccess?.(e, t), this.runPluginHandler("onSuccess", e, t), this.options.onFinally?.(t, e, void 0), s === this.count && this.runPluginHandler("onFinally", t, e, void 0), e);
|
|
55
|
+
} catch (i) {
|
|
56
|
+
if (s !== this.count)
|
|
60
57
|
return new Promise(() => {
|
|
61
58
|
});
|
|
62
59
|
throw this.setState({
|
|
63
|
-
error:
|
|
60
|
+
error: i,
|
|
64
61
|
loading: !1
|
|
65
|
-
}), this.options.onError?.(
|
|
62
|
+
}), this.options.onError?.(i, t), this.runPluginHandler("onError", i, t), this.options.onFinally?.(t, void 0, i), s === this.count && this.runPluginHandler("onFinally", t, void 0, i), i;
|
|
66
63
|
}
|
|
67
64
|
}
|
|
68
65
|
run(...t) {
|
|
69
|
-
this.runAsync(...t).catch((
|
|
70
|
-
this.options.onError || console.error(
|
|
66
|
+
this.runAsync(...t).catch((s) => {
|
|
67
|
+
this.options.onError || console.error(s);
|
|
71
68
|
});
|
|
72
69
|
}
|
|
73
70
|
cancel() {
|
|
@@ -82,9 +79,9 @@ class c {
|
|
|
82
79
|
return this.runAsync(...this.state.params || []);
|
|
83
80
|
}
|
|
84
81
|
mutate(t) {
|
|
85
|
-
const
|
|
86
|
-
this.runPluginHandler("onMutate",
|
|
87
|
-
data:
|
|
82
|
+
const s = u(t) ? t(this.state.data) : t;
|
|
83
|
+
this.runPluginHandler("onMutate", s), this.setState({
|
|
84
|
+
data: s
|
|
88
85
|
});
|
|
89
86
|
}
|
|
90
87
|
}
|