@unicom-cloud/ui-common 0.1.1
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 +10 -0
- package/Empty.js +14 -0
- package/Flex.js +14 -0
- package/Progress.js +8 -0
- package/Space.js +15 -0
- package/SuspenseFallbackTest.js +7 -0
- package/TransitionGroup.js +32 -0
- package/development/index.js +48 -0
- package/empty/index.js +52 -0
- package/flex/index.js +78 -0
- package/flex/interface.js +10 -0
- package/higher-order/index.js +5 -0
- package/higher-order/with-speech-synthesis/index.js +83 -0
- package/higher-order/withSpeechSynthesis.js +11 -0
- package/hooks/create-deep-compare-effect/index.js +10 -0
- package/hooks/create-update-effect/index.js +15 -0
- package/hooks/create-use-storage-state/index.js +79 -0
- package/hooks/createDeepCompareEffect.js +7 -0
- package/hooks/createUpdateEffect.js +6 -0
- package/hooks/createUseStorageState.js +12 -0
- package/hooks/index.js +197 -0
- package/hooks/use-async-effect/index.js +26 -0
- package/hooks/use-boolean/index.js +15 -0
- package/hooks/use-click-away/index.js +32 -0
- package/hooks/use-computed-state/index.js +12 -0
- package/hooks/use-controllable-value/index.js +27 -0
- package/hooks/use-cookie-state/index.js +21 -0
- package/hooks/use-count-down/index.js +37 -0
- package/hooks/use-counter/index.js +44 -0
- package/hooks/use-create/index.js +9 -0
- package/hooks/use-creation/index.js +14 -0
- package/hooks/use-debounce/index.js +14 -0
- package/hooks/use-debounce-effect/index.js +13 -0
- package/hooks/use-debounce-fn/index.js +31 -0
- package/hooks/use-deep-compare-effect/index.js +7 -0
- package/hooks/use-deep-compare-layout-effect/index.js +7 -0
- package/hooks/use-document-visibility/index.js +20 -0
- package/hooks/use-drag/index.js +47 -0
- package/hooks/use-drop/index.js +60 -0
- package/hooks/use-event-listener/index.js +37 -0
- package/hooks/use-event-target/index.js +21 -0
- package/hooks/use-external/index.js +65 -0
- package/hooks/use-favicon/index.js +18 -0
- package/hooks/use-focus-within/index.js +26 -0
- package/hooks/use-force-update/index.js +5 -0
- package/hooks/use-fullscreen/index.js +75 -0
- package/hooks/use-get-state/index.js +10 -0
- package/hooks/use-history-travel/index.js +79 -0
- package/hooks/use-hover/index.js +26 -0
- package/hooks/use-id/index.js +11 -0
- package/hooks/use-in-view/index.js +32 -0
- package/hooks/use-in-viewport/index.js +34 -0
- package/hooks/use-infinite-scroll/index.js +83 -0
- package/hooks/use-intersection-observer/index.js +25 -0
- package/hooks/use-interval/index.js +17 -0
- package/hooks/use-is-first-render/index.js +10 -0
- package/hooks/use-isomorphic-layout-effect/index.js +7 -0
- package/hooks/use-key-press/index.js +169 -0
- package/hooks/use-keyboard-event/index.js +17 -0
- package/hooks/use-latest/index.js +9 -0
- package/hooks/use-listen-window-resize/index.js +10 -0
- package/hooks/use-local-storage-state/index.js +9 -0
- package/hooks/use-lock-fn/index.js +23 -0
- package/hooks/use-long-press/index.js +59 -0
- package/hooks/use-map/index.js +31 -0
- package/hooks/use-media/index.js +16 -0
- package/hooks/use-memoized-fn/index.js +19 -0
- package/hooks/use-merge-props/index.js +18 -0
- package/hooks/use-merge-value/index.js +21 -0
- package/hooks/use-mount/index.js +13 -0
- package/hooks/use-mouse/index.js +50 -0
- package/hooks/use-mutation-observer/index.js +23 -0
- package/hooks/use-network/index.js +57 -0
- package/hooks/use-online-status/index.js +21 -0
- package/hooks/use-overflow-hidden/index.js +27 -0
- package/hooks/use-override-ref/index.js +15 -0
- package/hooks/use-pagination/index.js +49 -0
- package/hooks/use-persist-callback/index.js +9 -0
- package/hooks/use-prefers-color-scheme-dark/index.js +25 -0
- package/hooks/use-previous/index.js +10 -0
- package/hooks/use-raf-interval/index.js +36 -0
- package/hooks/use-raf-state/index.js +16 -0
- package/hooks/use-raf-timeout/index.js +35 -0
- package/hooks/use-reactive/index.js +38 -0
- package/hooks/use-ref-latest/index.js +5 -0
- package/hooks/use-refs/index.js +11 -0
- package/hooks/use-request/index.js +7 -0
- package/hooks/use-request/src/Fetch.js +93 -0
- package/hooks/use-request/src/plugins/useAutoRunPlugin.js +30 -0
- package/hooks/use-request/src/plugins/useCachePlugin.js +66 -0
- package/hooks/use-request/src/plugins/useDebouncePlugin.js +34 -0
- package/hooks/use-request/src/plugins/useLoadingDelayPlugin.js +28 -0
- package/hooks/use-request/src/plugins/usePollingPlugin.js +37 -0
- package/hooks/use-request/src/plugins/useRefreshOnWindowFocusPlugin.js +29 -0
- package/hooks/use-request/src/plugins/useRetryPlugin.js +28 -0
- package/hooks/use-request/src/plugins/useThrottlePlugin.js +31 -0
- package/hooks/use-request/src/useRequest.js +26 -0
- package/hooks/use-request/src/useRequestImplement.js +54 -0
- package/hooks/use-request/src/utils/cache.js +20 -0
- package/hooks/use-request/src/utils/cachePromise.js +10 -0
- package/hooks/use-request/src/utils/cacheSubscribe.js +11 -0
- package/hooks/use-request/src/utils/isDocumentVisible.js +8 -0
- package/hooks/use-request/src/utils/isOnline.js +8 -0
- package/hooks/use-request/src/utils/limit.js +12 -0
- package/hooks/use-request/src/utils/subscribeFocus.js +19 -0
- package/hooks/use-request/src/utils/subscribeReVisible.js +18 -0
- package/hooks/use-reset-state/index.js +18 -0
- package/hooks/use-resize-observer/index.js +5 -0
- package/hooks/use-responsive/index.js +47 -0
- package/hooks/use-safe-state/index.js +12 -0
- package/hooks/use-scroll/index.js +44 -0
- package/hooks/use-selections/index.js +58 -0
- package/hooks/use-session-storage-state/index.js +9 -0
- package/hooks/use-set/index.js +23 -0
- package/hooks/use-set-state/index.js +17 -0
- package/hooks/use-size/index.js +41 -0
- package/hooks/use-state-callback/index.js +16 -0
- package/hooks/use-state-with-promise/index.js +36 -0
- package/hooks/use-text-selection/index.js +56 -0
- package/hooks/use-theme/index.js +36 -0
- package/hooks/use-throttle/index.js +14 -0
- package/hooks/use-throttle-effect/index.js +13 -0
- package/hooks/use-throttle-fn/index.js +31 -0
- package/hooks/use-timeout/index.js +17 -0
- package/hooks/use-title/index.js +18 -0
- package/hooks/use-toggle/index.js +17 -0
- package/hooks/use-tracked-effect/index.js +12 -0
- package/hooks/use-unmount/index.js +21 -0
- package/hooks/use-unmounted-ref/index.js +11 -0
- package/hooks/use-update/index.js +9 -0
- package/hooks/use-update-effect/index.js +7 -0
- package/hooks/use-update-layout-effect/index.js +7 -0
- package/hooks/use-url-state/index.js +60 -0
- package/hooks/use-virtual-list/index.js +83 -0
- package/hooks/use-watch/index.js +14 -0
- package/hooks/use-web-socket/index.js +74 -0
- package/hooks/use-why-did-you-update/index.js +20 -0
- package/hooks/use-window-size/index.js +40 -0
- package/hooks/useAsyncEffect.js +8 -0
- package/hooks/useBoolean.js +7 -0
- package/hooks/useClickAway.js +11 -0
- package/hooks/useComputedState.js +6 -0
- package/hooks/useControllableValue.js +10 -0
- package/hooks/useCookieState.js +10 -0
- package/hooks/useCountDown.js +10 -0
- package/hooks/useCounter.js +9 -0
- package/hooks/useCreate.js +6 -0
- package/hooks/useCreation.js +7 -0
- package/hooks/useDebounce.js +7 -0
- package/hooks/useDebounceEffect.js +8 -0
- package/hooks/useDebounceFn.js +12 -0
- package/hooks/useDeepCompareEffect.js +7 -0
- package/hooks/useDeepCompareLayoutEffect.js +7 -0
- package/hooks/useDocumentVisibility.js +8 -0
- package/hooks/useDrag.js +12 -0
- package/hooks/useDrop.js +9 -0
- package/hooks/useEventListener.js +10 -0
- package/hooks/useEventTarget.js +9 -0
- package/hooks/useExternal.js +6 -0
- package/hooks/useFavicon.js +6 -0
- package/hooks/useFocusWithin.js +7 -0
- package/hooks/useForceUpdate.js +5 -0
- package/hooks/useFullscreen.js +12 -0
- package/hooks/useGetState.js +7 -0
- package/hooks/useHistoryTravel.js +9 -0
- package/hooks/useHover.js +7 -0
- package/hooks/useId.js +8 -0
- package/hooks/useInView.js +7 -0
- package/hooks/useInViewport.js +10 -0
- package/hooks/useInfiniteScroll.js +13 -0
- package/hooks/useIntersectionObserver.js +10 -0
- package/hooks/useInterval.js +9 -0
- package/hooks/useIsFirstRender.js +6 -0
- package/hooks/useIsomorphicLayoutEffect.js +7 -0
- package/hooks/useKeyPress.js +11 -0
- package/hooks/useKeyboardEvent.js +7 -0
- package/hooks/useLatest.js +6 -0
- package/hooks/useListenWindowResize.js +6 -0
- package/hooks/useLocalStorageState.js +7 -0
- package/hooks/useLockFn.js +6 -0
- package/hooks/useLongPress.js +9 -0
- package/hooks/useMap.js +7 -0
- package/hooks/useMedia.js +6 -0
- package/hooks/useMemoizedFn.js +9 -0
- package/hooks/useMergeProps.js +7 -0
- package/hooks/useMergeValue.js +9 -0
- package/hooks/useMount.js +9 -0
- package/hooks/useMouse.js +8 -0
- package/hooks/useMutationObserver.js +8 -0
- package/hooks/useNetwork.js +8 -0
- package/hooks/useOnlineStatus.js +6 -0
- package/hooks/useOverflowHidden.js +6 -0
- package/hooks/useOverrideRef.js +8 -0
- package/hooks/usePagination.js +9 -0
- package/hooks/usePersistCallback.js +6 -0
- package/hooks/usePrefersColorSchemeDark.js +7 -0
- package/hooks/usePrevious.js +6 -0
- package/hooks/useRafInterval.js +9 -0
- package/hooks/useRafState.js +7 -0
- package/hooks/useRafTimeout.js +9 -0
- package/hooks/useReactive.js +10 -0
- package/hooks/useRefLatest.js +5 -0
- package/hooks/useRefs.js +6 -0
- package/hooks/useRequest.js +7 -0
- package/hooks/useResetState.js +10 -0
- package/hooks/useResizeObserver.js +5 -0
- package/hooks/useResponsive.js +8 -0
- package/hooks/useSafeState.js +7 -0
- package/hooks/useScroll.js +9 -0
- package/hooks/useSelections.js +9 -0
- package/hooks/useSessionStorageState.js +7 -0
- package/hooks/useSet.js +7 -0
- package/hooks/useSetState.js +9 -0
- package/hooks/useSize.js +11 -0
- package/hooks/useStateCallback.js +6 -0
- package/hooks/useStateWithPromise.js +8 -0
- package/hooks/useTextSelection.js +8 -0
- package/hooks/useTheme.js +9 -0
- package/hooks/useThrottle.js +7 -0
- package/hooks/useThrottleEffect.js +8 -0
- package/hooks/useThrottleFn.js +12 -0
- package/hooks/useTimeout.js +9 -0
- package/hooks/useTitle.js +8 -0
- package/hooks/useToggle.js +6 -0
- package/hooks/useTrackedEffect.js +6 -0
- package/hooks/useUnmount.js +10 -0
- package/hooks/useUnmountedRef.js +6 -0
- package/hooks/useUpdate.js +6 -0
- package/hooks/useUpdateEffect.js +7 -0
- package/hooks/useUpdateLayoutEffect.js +7 -0
- package/hooks/useUrlState.js +12 -0
- package/hooks/useVirtualList.js +14 -0
- package/hooks/useWatch.js +9 -0
- package/hooks/useWebSocket.js +10 -0
- package/hooks/useWhyDidYouUpdate.js +6 -0
- package/hooks/useWindowSize.js +10 -0
- package/hooks/utils/createEffectWithTarget.js +23 -0
- package/hooks/utils/depsAreSame.js +12 -0
- package/hooks/utils/depsEqual.js +7 -0
- package/hooks/utils/domTarget.js +16 -0
- package/hooks/utils/getDocumentOrShadow.js +16 -0
- package/hooks/utils/index.js +5 -0
- package/hooks/utils/isAppleDevice.js +6 -0
- package/hooks/utils/isBrowser.js +6 -0
- package/hooks/utils/isDev.js +5 -0
- package/hooks/utils/rect.js +19 -0
- package/hooks/utils/useDeepCompareWithTarget.js +11 -0
- package/hooks/utils/useEffectWithTarget.js +7 -0
- package/hooks/utils/useIsomorphicLayoutEffectWithTarget.js +8 -0
- package/hooks/utils/useLayoutEffectWithTarget.js +7 -0
- package/hooks/utils.js +5 -0
- package/icons/file/index.js +59 -0
- package/icons/file.js +9 -0
- package/index.js +49 -0
- package/package.json +1 -0
- package/progress/index.js +153 -0
- package/space/index.js +77 -0
- package/style/animation.less +21 -0
- package/style/global.less +69 -0
- package/style/index.less +41 -0
- package/style/keyframes.less +48 -0
- package/style/normalize.less +0 -0
- package/style/override.less +0 -0
- package/style/style.less +2 -0
- package/style/variables.css +3 -0
- package/style/variables.less +0 -0
- package/style.css +1 -0
- package/suspense-fallback-test/index.js +17 -0
- package/transition-group/CSSTransition.js +91 -0
- package/transition-group/PqbCSSTransition.js +36 -0
- package/transition-group/ReplaceTransition.js +34 -0
- package/transition-group/SwitchTransition.js +102 -0
- package/transition-group/Transition.js +188 -0
- package/transition-group/TransitionGroup.js +50 -0
- package/transition-group/TransitionGroupContext.js +6 -0
- package/transition-group/index.js +32 -0
- package/transition-group/utils/ChildMapping.js +66 -0
- package/types/development/index.d.ts +8 -0
- package/types/development/interface.d.ts +22 -0
- package/types/empty/index.d.ts +5 -0
- package/types/empty/interface.d.ts +24 -0
- package/types/flex/index.d.ts +8 -0
- package/types/flex/interface.d.ts +73 -0
- package/types/higher-order/index.d.ts +1 -0
- package/types/higher-order/with-speech-synthesis/index.d.ts +7 -0
- package/types/higher-order/with-speech-synthesis/interface.d.ts +13 -0
- package/types/hooks/create-deep-compare-effect/index.d.ts +5 -0
- package/types/hooks/create-update-effect/index.d.ts +4 -0
- package/types/hooks/create-use-storage-state/index.d.ts +11 -0
- package/types/hooks/index.d.ts +97 -0
- package/types/hooks/use-async-effect/index.d.ts +3 -0
- package/types/hooks/use-boolean/index.d.ts +7 -0
- package/types/hooks/use-click-away/index.d.ts +4 -0
- package/types/hooks/use-computed-state/index.d.ts +4 -0
- package/types/hooks/use-controllable-value/index.d.ts +16 -0
- package/types/hooks/use-cookie-state/index.d.ts +7 -0
- package/types/hooks/use-count-down/index.d.ts +17 -0
- package/types/hooks/use-counter/index.d.ts +18 -0
- package/types/hooks/use-create/index.d.ts +2 -0
- package/types/hooks/use-creation/index.d.ts +3 -0
- package/types/hooks/use-debounce/debounceOptions.d.ts +6 -0
- package/types/hooks/use-debounce/index.d.ts +3 -0
- package/types/hooks/use-debounce-effect/index.d.ts +4 -0
- package/types/hooks/use-debounce-fn/index.d.ts +8 -0
- package/types/hooks/use-deep-compare-effect/index.d.ts +3 -0
- package/types/hooks/use-deep-compare-layout-effect/index.d.ts +3 -0
- package/types/hooks/use-document-visibility/index.d.ts +3 -0
- package/types/hooks/use-drag/index.d.ts +13 -0
- package/types/hooks/use-drop/index.d.ts +15 -0
- package/types/hooks/use-event-listener/index.d.ts +17 -0
- package/types/hooks/use-event-target/index.d.ts +14 -0
- package/types/hooks/use-external/index.d.ts +20 -0
- package/types/hooks/use-favicon/index.d.ts +2 -0
- package/types/hooks/use-focus-within/index.d.ts +7 -0
- package/types/hooks/use-force-update/index.d.ts +16 -0
- package/types/hooks/use-fullscreen/index.d.ts +17 -0
- package/types/hooks/use-get-state/index.d.ts +9 -0
- package/types/hooks/use-history-travel/index.d.ts +10 -0
- package/types/hooks/use-hover/index.d.ts +8 -0
- package/types/hooks/use-id/index.d.ts +6 -0
- package/types/hooks/use-in-view/index.d.ts +11 -0
- package/types/hooks/use-in-viewport/index.d.ts +10 -0
- package/types/hooks/use-infinite-scroll/index.d.ts +15 -0
- package/types/hooks/use-infinite-scroll/types.d.ts +32 -0
- package/types/hooks/use-intersection-observer/index.d.ts +7 -0
- package/types/hooks/use-interval/index.d.ts +4 -0
- package/types/hooks/use-is-first-render/index.d.ts +2 -0
- package/types/hooks/use-isomorphic-layout-effect/index.d.ts +3 -0
- package/types/hooks/use-key-press/index.d.ts +14 -0
- package/types/hooks/use-keyboard-event/index.d.ts +8 -0
- package/types/hooks/use-latest/index.d.ts +2 -0
- package/types/hooks/use-listen-window-resize/index.d.ts +16 -0
- package/types/hooks/use-local-storage-state/index.d.ts +2 -0
- package/types/hooks/use-lock-fn/index.d.ts +2 -0
- package/types/hooks/use-long-press/index.d.ts +13 -0
- package/types/hooks/use-map/index.d.ts +8 -0
- package/types/hooks/use-media/index.d.ts +2 -0
- package/types/hooks/use-memoized-fn/index.d.ts +4 -0
- package/types/hooks/use-merge-props/index.d.ts +5 -0
- package/types/hooks/use-merge-value/index.d.ts +6 -0
- package/types/hooks/use-mount/index.d.ts +3 -0
- package/types/hooks/use-mouse/index.d.ts +17 -0
- package/types/hooks/use-mutation-observer/index.d.ts +3 -0
- package/types/hooks/use-network/index.d.ts +12 -0
- package/types/hooks/use-online-status/index.d.ts +2 -0
- package/types/hooks/use-overflow-hidden/index.d.ts +5 -0
- package/types/hooks/use-override-ref/index.d.ts +3 -0
- package/types/hooks/use-pagination/index.d.ts +3 -0
- package/types/hooks/use-pagination/types.d.ts +29 -0
- package/types/hooks/use-persist-callback/index.d.ts +2 -0
- package/types/hooks/use-prefers-color-scheme-dark/index.d.ts +2 -0
- package/types/hooks/use-previous/index.d.ts +3 -0
- package/types/hooks/use-raf-interval/index.d.ts +4 -0
- package/types/hooks/use-raf-state/index.d.ts +7 -0
- package/types/hooks/use-raf-timeout/index.d.ts +2 -0
- package/types/hooks/use-reactive/index.d.ts +2 -0
- package/types/hooks/use-ref-latest/index.d.ts +2 -0
- package/types/hooks/use-refs/index.d.ts +2 -0
- package/types/hooks/use-request/index.d.ts +4 -0
- package/types/hooks/use-request/src/Fetch.d.ts +20 -0
- package/types/hooks/use-request/src/plugins/useAutoRunPlugin.d.ts +3 -0
- package/types/hooks/use-request/src/plugins/useCachePlugin.d.ts +3 -0
- package/types/hooks/use-request/src/plugins/useDebouncePlugin.d.ts +3 -0
- package/types/hooks/use-request/src/plugins/useLoadingDelayPlugin.d.ts +3 -0
- package/types/hooks/use-request/src/plugins/usePollingPlugin.d.ts +3 -0
- package/types/hooks/use-request/src/plugins/useRefreshOnWindowFocusPlugin.d.ts +3 -0
- package/types/hooks/use-request/src/plugins/useRetryPlugin.d.ts +3 -0
- package/types/hooks/use-request/src/plugins/useThrottlePlugin.d.ts +3 -0
- package/types/hooks/use-request/src/types.d.ts +73 -0
- package/types/hooks/use-request/src/useRequest.d.ts +3 -0
- package/types/hooks/use-request/src/useRequestImplement.d.ts +3 -0
- package/types/hooks/use-request/src/utils/cache.d.ts +14 -0
- package/types/hooks/use-request/src/utils/cachePromise.d.ts +4 -0
- package/types/hooks/use-request/src/utils/cacheSubscribe.d.ts +4 -0
- package/types/hooks/use-request/src/utils/isDocumentVisible.d.ts +1 -0
- package/types/hooks/use-request/src/utils/isOnline.d.ts +2 -0
- package/types/hooks/use-request/src/utils/limit.d.ts +1 -0
- package/types/hooks/use-request/src/utils/subscribeFocus.d.ts +3 -0
- package/types/hooks/use-request/src/utils/subscribeReVisible.d.ts +3 -0
- package/types/hooks/use-reset-state/index.d.ts +4 -0
- package/types/hooks/use-resize-observer/index.d.ts +2 -0
- package/types/hooks/use-responsive/index.d.ts +5 -0
- package/types/hooks/use-safe-state/index.d.ts +7 -0
- package/types/hooks/use-scroll/index.d.ts +9 -0
- package/types/hooks/use-selections/index.d.ts +21 -0
- package/types/hooks/use-session-storage-state/index.d.ts +2 -0
- package/types/hooks/use-set/index.d.ts +6 -0
- package/types/hooks/use-set-state/index.d.ts +3 -0
- package/types/hooks/use-size/index.d.ts +7 -0
- package/types/hooks/use-state-callback/index.d.ts +5 -0
- package/types/hooks/use-state-with-promise/index.d.ts +2 -0
- package/types/hooks/use-text-selection/index.d.ts +14 -0
- package/types/hooks/use-theme/index.d.ts +16 -0
- package/types/hooks/use-throttle/index.d.ts +3 -0
- package/types/hooks/use-throttle/throttleOptions.d.ts +5 -0
- package/types/hooks/use-throttle-effect/index.d.ts +4 -0
- package/types/hooks/use-throttle-fn/index.d.ts +8 -0
- package/types/hooks/use-timeout/index.d.ts +2 -0
- package/types/hooks/use-title/index.d.ts +5 -0
- package/types/hooks/use-toggle/index.d.ts +10 -0
- package/types/hooks/use-tracked-effect/index.d.ts +4 -0
- package/types/hooks/use-unmount/index.d.ts +2 -0
- package/types/hooks/use-unmounted-ref/index.d.ts +2 -0
- package/types/hooks/use-update/index.d.ts +2 -0
- package/types/hooks/use-update-effect/index.d.ts +3 -0
- package/types/hooks/use-update-layout-effect/index.d.ts +3 -0
- package/types/hooks/use-url-state/index.d.ts +10 -0
- package/types/hooks/use-virtual-list/index.d.ts +13 -0
- package/types/hooks/use-watch/index.d.ts +3 -0
- package/types/hooks/use-web-socket/index.d.ts +26 -0
- package/types/hooks/use-why-did-you-update/index.d.ts +3 -0
- package/types/hooks/use-window-size/index.d.ts +18 -0
- package/types/hooks/utils/createEffectWithTarget.d.ts +4 -0
- package/types/hooks/utils/depsAreSame.d.ts +3 -0
- package/types/hooks/utils/depsEqual.d.ts +2 -0
- package/types/hooks/utils/domTarget.d.ts +6 -0
- package/types/hooks/utils/getDocumentOrShadow.d.ts +3 -0
- package/types/hooks/utils/index.d.ts +2 -0
- package/types/hooks/utils/isAppleDevice.d.ts +2 -0
- package/types/hooks/utils/isBrowser.d.ts +2 -0
- package/types/hooks/utils/isDev.d.ts +2 -0
- package/types/hooks/utils/rect.d.ts +4 -0
- package/types/hooks/utils/useDeepCompareWithTarget.d.ts +4 -0
- package/types/hooks/utils/useEffectWithTarget.d.ts +2 -0
- package/types/hooks/utils/useIsomorphicLayoutEffectWithTarget.d.ts +2 -0
- package/types/hooks/utils/useLayoutEffectWithTarget.d.ts +2 -0
- package/types/icons/file/index.d.ts +4 -0
- package/types/icons/file/interface.d.ts +20 -0
- package/types/index.d.ts +16 -0
- package/types/progress/index.d.ts +437 -0
- package/types/space/index.d.ts +7 -0
- package/types/space/interface.d.ts +53 -0
- package/types/suspense-fallback-test/index.d.ts +7 -0
- package/types/suspense-fallback-test/interface.d.ts +1 -0
- package/types/transition-group/CSSTransition.d.ts +98 -0
- package/types/transition-group/PqbCSSTransition.d.ts +4 -0
- package/types/transition-group/ReplaceTransition.d.ts +23 -0
- package/types/transition-group/SwitchTransition.d.ts +88 -0
- package/types/transition-group/Transition.d.ts +130 -0
- package/types/transition-group/TransitionGroup.d.ts +31 -0
- package/types/transition-group/TransitionGroupContext.d.ts +3 -0
- package/types/transition-group/index.d.ts +10 -0
- package/types/transition-group/utils/ChildMapping.d.ts +27 -0
- package/types/utils/caseName.d.ts +1 -0
- package/types/utils/className.d.ts +1 -0
- package/types/utils/compute.d.ts +100 -0
- package/types/utils/constant.d.ts +3 -0
- package/types/utils/copy.d.ts +3 -0
- package/types/utils/date.d.ts +1 -0
- package/types/utils/dayjs.d.ts +3 -0
- package/types/utils/dom.d.ts +27 -0
- package/types/utils/emitter.d.ts +1 -0
- package/types/utils/fileToURL.d.ts +1 -0
- package/types/utils/fillNBSP.d.ts +3 -0
- package/types/utils/findScrollParent.d.ts +2 -0
- package/types/utils/getHighlightText.d.ts +7 -0
- package/types/utils/getHotkeyHandler.d.ts +18 -0
- package/types/utils/getStringLength.d.ts +3 -0
- package/types/utils/include.d.ts +3 -0
- package/types/utils/index.d.ts +46 -0
- package/types/utils/intersectionObserver.d.ts +3 -0
- package/types/utils/is.d.ts +10 -0
- package/types/utils/keyboardCode.d.ts +4 -0
- package/types/utils/lodash.d.ts +60 -0
- package/types/utils/math.d.ts +1 -0
- package/types/utils/mergeProps.d.ts +3 -0
- package/types/utils/mergedToString.d.ts +4 -0
- package/types/utils/mutationObserver.d.ts +3 -0
- package/types/utils/omit.d.ts +3 -0
- package/types/utils/pad.d.ts +2 -0
- package/types/utils/pick.d.ts +6 -0
- package/types/utils/pinyin.d.ts +1 -0
- package/types/utils/react19Adapter.d.ts +1 -0
- package/types/utils/reactDOM.d.ts +34 -0
- package/types/utils/resizeObserver.d.ts +3 -0
- package/types/utils/saveAs.d.ts +1 -0
- package/types/utils/screenfull.d.ts +1 -0
- package/types/utils/scrollIntoViewIfNeeded.d.ts +12 -0
- package/types/utils/setDarkTheme.d.ts +4 -0
- package/types/utils/setDir.d.ts +3 -0
- package/types/utils/setPrimaryColor.d.ts +3 -0
- package/types/utils/setTheme.d.ts +3 -0
- package/types/utils/style.d.ts +3 -0
- package/types/utils/supportRef.d.ts +3 -0
- package/types/utils/throttleByRaf.d.ts +6 -0
- package/types/utils/throttleByRaf2.d.ts +6 -0
- package/types/utils/tinycolor.d.ts +2 -0
- package/types/utils/toArray.d.ts +13 -0
- package/types/utils/tree.d.ts +1 -0
- package/types/utils/tween.d.ts +1 -0
- package/types/utils/uuid.d.ts +1 -0
- package/types/utils/validate.d.ts +1 -0
- package/types/utils/warning.d.ts +3 -0
- package/utils/caseName.js +6 -0
- package/utils/className.js +6 -0
- package/utils/compute.js +142 -0
- package/utils/constant.js +10 -0
- package/utils/copy.js +8 -0
- package/utils/date.js +2 -0
- package/utils/dayjs.js +23 -0
- package/utils/dom.js +63 -0
- package/utils/emitter.js +6 -0
- package/utils/fileToURL.js +6 -0
- package/utils/fillNBSP.js +10 -0
- package/utils/findScrollParent.js +18 -0
- package/utils/getHighlightText.js +45 -0
- package/utils/getHotkeyHandler.js +29 -0
- package/utils/getStringLength.js +11 -0
- package/utils/include.js +11 -0
- package/utils/index.js +334 -0
- package/utils/intersectionObserver.js +23 -0
- package/utils/is.js +98 -0
- package/utils/keyboardCode.js +7 -0
- package/utils/lodash.js +121 -0
- package/utils/math.js +10 -0
- package/utils/mergeProps.js +13 -0
- package/utils/mergedToString.js +16 -0
- package/utils/mutationObserver.js +21 -0
- package/utils/omit.js +13 -0
- package/utils/pad.js +19 -0
- package/utils/pick.js +19 -0
- package/utils/pinyin.js +6 -0
- package/utils/react19Adapter.js +4 -0
- package/utils/reactDOM.js +87 -0
- package/utils/resizeObserver.js +33 -0
- package/utils/saveAs.js +6 -0
- package/utils/screenfull.js +6 -0
- package/utils/scrollIntoViewIfNeeded.js +75 -0
- package/utils/setDarkTheme.js +28 -0
- package/utils/setDir.js +14 -0
- package/utils/setPrimaryColor.js +31 -0
- package/utils/setTheme.js +56 -0
- package/utils/style.js +40 -0
- package/utils/supportRef.js +10 -0
- package/utils/throttleByRaf.js +17 -0
- package/utils/throttleByRaf2.js +9 -0
- package/utils/tinycolor.js +7 -0
- package/utils/toArray.js +15 -0
- package/utils/tree.js +14 -0
- package/utils/tween.js +7 -0
- package/utils/uuid.js +6 -0
- package/utils/validate.js +18 -0
- package/utils/warning.js +12 -0
package/hooks/index.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { default as a } from "./create-update-effect/index.js";
|
|
3
|
+
import { default as r } from "./use-async-effect/index.js";
|
|
4
|
+
import { default as f } from "./use-boolean/index.js";
|
|
5
|
+
import { default as l } from "./use-click-away/index.js";
|
|
6
|
+
import { default as p } from "./use-computed-state/index.js";
|
|
7
|
+
import { default as x } from "./use-controllable-value/index.js";
|
|
8
|
+
import { default as i } from "./use-cookie-state/index.js";
|
|
9
|
+
import { default as S } from "./use-count-down/index.js";
|
|
10
|
+
import { default as R } from "./use-counter/index.js";
|
|
11
|
+
import { default as E } from "./use-create/index.js";
|
|
12
|
+
import { default as T } from "./use-creation/index.js";
|
|
13
|
+
import { default as h } from "./use-debounce/index.js";
|
|
14
|
+
import { default as L } from "./use-debounce-effect/index.js";
|
|
15
|
+
import { default as k } from "./use-debounce-fn/index.js";
|
|
16
|
+
import { default as I } from "./use-deep-compare-effect/index.js";
|
|
17
|
+
import { default as w } from "./use-deep-compare-layout-effect/index.js";
|
|
18
|
+
import { default as M } from "./use-document-visibility/index.js";
|
|
19
|
+
import { default as O } from "./use-drag/index.js";
|
|
20
|
+
import { default as z } from "./use-drop/index.js";
|
|
21
|
+
import { default as A } from "./use-event-listener/index.js";
|
|
22
|
+
import { default as q } from "./use-event-target/index.js";
|
|
23
|
+
import { default as G } from "./use-external/index.js";
|
|
24
|
+
import { default as Y } from "./use-favicon/index.js";
|
|
25
|
+
import { default as J } from "./use-focus-within/index.js";
|
|
26
|
+
import { default as X } from "./use-fullscreen/index.js";
|
|
27
|
+
import { default as _ } from "./use-get-state/index.js";
|
|
28
|
+
import { default as ee } from "./use-history-travel/index.js";
|
|
29
|
+
import { default as ae } from "./use-hover/index.js";
|
|
30
|
+
import { default as re } from "./use-in-viewport/index.js";
|
|
31
|
+
import { default as fe } from "./use-infinite-scroll/index.js";
|
|
32
|
+
import { default as le } from "./use-interval/index.js";
|
|
33
|
+
import { default as pe } from "./use-isomorphic-layout-effect/index.js";
|
|
34
|
+
import { default as xe } from "./use-key-press/index.js";
|
|
35
|
+
import { default as ie, default as ce } from "./use-latest/index.js";
|
|
36
|
+
import { default as ve } from "./use-local-storage-state/index.js";
|
|
37
|
+
import { default as Ce } from "./use-lock-fn/index.js";
|
|
38
|
+
import { default as be } from "./use-long-press/index.js";
|
|
39
|
+
import { default as ge } from "./use-memoized-fn/index.js";
|
|
40
|
+
import { default as De } from "./use-mount/index.js";
|
|
41
|
+
import { default as ye } from "./use-mouse/index.js";
|
|
42
|
+
import { default as Fe } from "./use-mutation-observer/index.js";
|
|
43
|
+
import { default as Ue } from "./use-network/index.js";
|
|
44
|
+
import { default as Pe } from "./use-pagination/index.js";
|
|
45
|
+
import { default as We } from "./use-previous/index.js";
|
|
46
|
+
import { default as Ve } from "./use-raf-interval/index.js";
|
|
47
|
+
import { default as He } from "./use-raf-state/index.js";
|
|
48
|
+
import { default as Ke } from "./use-raf-timeout/index.js";
|
|
49
|
+
import { default as Be } from "./use-reactive/index.js";
|
|
50
|
+
import { default as Ne } from "./use-request/src/useRequest.js";
|
|
51
|
+
import { clearCache as je } from "./use-request/src/utils/cache.js";
|
|
52
|
+
import { default as Qe } from "./use-reset-state/index.js";
|
|
53
|
+
import { configResponsive as Ze, default as _e } from "./use-responsive/index.js";
|
|
54
|
+
import { default as et } from "./use-safe-state/index.js";
|
|
55
|
+
import { default as at } from "./use-scroll/index.js";
|
|
56
|
+
import { default as rt } from "./use-selections/index.js";
|
|
57
|
+
import { default as ft } from "./use-session-storage-state/index.js";
|
|
58
|
+
import { default as lt } from "./use-set-state/index.js";
|
|
59
|
+
import { default as pt, default as mt } from "./use-size/index.js";
|
|
60
|
+
import { default as nt } from "./use-text-selection/index.js";
|
|
61
|
+
import { default as ct } from "./use-theme/index.js";
|
|
62
|
+
import { default as vt } from "./use-throttle/index.js";
|
|
63
|
+
import { default as Ct } from "./use-throttle-effect/index.js";
|
|
64
|
+
import { default as bt } from "./use-throttle-fn/index.js";
|
|
65
|
+
import { default as gt } from "./use-timeout/index.js";
|
|
66
|
+
import { default as Dt } from "./use-title/index.js";
|
|
67
|
+
import { default as yt } from "./use-toggle/index.js";
|
|
68
|
+
import { default as Ft } from "./use-tracked-effect/index.js";
|
|
69
|
+
import { default as Ut } from "./use-unmount/index.js";
|
|
70
|
+
import { default as Pt } from "./use-unmounted-ref/index.js";
|
|
71
|
+
import { default as Wt, default as Ot } from "./use-update/index.js";
|
|
72
|
+
import { default as zt } from "./use-update-effect/index.js";
|
|
73
|
+
import { default as At } from "./use-update-layout-effect/index.js";
|
|
74
|
+
import { default as qt } from "./use-url-state/index.js";
|
|
75
|
+
import { default as Gt } from "./use-virtual-list/index.js";
|
|
76
|
+
import { default as Yt } from "./use-web-socket/index.js";
|
|
77
|
+
import { default as Jt } from "./use-why-did-you-update/index.js";
|
|
78
|
+
import { default as Xt } from "./use-id/index.js";
|
|
79
|
+
import { default as _t } from "./use-in-view/index.js";
|
|
80
|
+
import { default as ea } from "./use-intersection-observer/index.js";
|
|
81
|
+
import { default as aa } from "./use-is-first-render/index.js";
|
|
82
|
+
import { default as ra } from "./use-keyboard-event/index.js";
|
|
83
|
+
import { default as fa } from "./use-listen-window-resize/index.js";
|
|
84
|
+
import { default as la } from "./use-media/index.js";
|
|
85
|
+
import { default as pa } from "./use-merge-props/index.js";
|
|
86
|
+
import { default as xa } from "./use-merge-value/index.js";
|
|
87
|
+
import { default as ia } from "./use-online-status/index.js";
|
|
88
|
+
import { default as Sa } from "./use-overflow-hidden/index.js";
|
|
89
|
+
import { default as Ra } from "./use-override-ref/index.js";
|
|
90
|
+
import { default as Ea } from "./use-persist-callback/index.js";
|
|
91
|
+
import { default as Ta } from "./use-prefers-color-scheme-dark/index.js";
|
|
92
|
+
import { default as ha } from "./use-refs/index.js";
|
|
93
|
+
import { default as La } from "./use-state-callback/index.js";
|
|
94
|
+
import { default as ka } from "./use-state-with-promise/index.js";
|
|
95
|
+
import { default as Ia } from "./use-watch/index.js";
|
|
96
|
+
import { default as wa } from "./use-window-size/index.js";
|
|
97
|
+
export {
|
|
98
|
+
je as clearCache,
|
|
99
|
+
Ze as configResponsive,
|
|
100
|
+
a as createUpdateEffect,
|
|
101
|
+
r as useAsyncEffect,
|
|
102
|
+
f as useBoolean,
|
|
103
|
+
l as useClickAway,
|
|
104
|
+
p as useComputedState,
|
|
105
|
+
x as useControllableValue,
|
|
106
|
+
i as useCookieState,
|
|
107
|
+
S as useCountDown,
|
|
108
|
+
R as useCounter,
|
|
109
|
+
E as useCreate,
|
|
110
|
+
T as useCreation,
|
|
111
|
+
h as useDebounce,
|
|
112
|
+
L as useDebounceEffect,
|
|
113
|
+
k as useDebounceFn,
|
|
114
|
+
I as useDeepCompareEffect,
|
|
115
|
+
w as useDeepCompareLayoutEffect,
|
|
116
|
+
M as useDocumentVisibility,
|
|
117
|
+
O as useDrag,
|
|
118
|
+
z as useDrop,
|
|
119
|
+
A as useEventListener,
|
|
120
|
+
q as useEventTarget,
|
|
121
|
+
G as useExternal,
|
|
122
|
+
Y as useFavicon,
|
|
123
|
+
J as useFocusWithin,
|
|
124
|
+
Wt as useForceUpdate,
|
|
125
|
+
X as useFullscreen,
|
|
126
|
+
_ as useGetState,
|
|
127
|
+
ee as useHistoryTravel,
|
|
128
|
+
ae as useHover,
|
|
129
|
+
Xt as useId,
|
|
130
|
+
_t as useInView,
|
|
131
|
+
re as useInViewport,
|
|
132
|
+
fe as useInfiniteScroll,
|
|
133
|
+
ea as useIntersectionObserver,
|
|
134
|
+
le as useInterval,
|
|
135
|
+
aa as useIsFirstRender,
|
|
136
|
+
pe as useIsomorphicLayoutEffect,
|
|
137
|
+
xe as useKeyPress,
|
|
138
|
+
ra as useKeyboardEvent,
|
|
139
|
+
ie as useLatest,
|
|
140
|
+
fa as useListenWindowResize,
|
|
141
|
+
ve as useLocalStorageState,
|
|
142
|
+
Ce as useLockFn,
|
|
143
|
+
be as useLongPress,
|
|
144
|
+
la as useMedia,
|
|
145
|
+
ge as useMemoizedFn,
|
|
146
|
+
pa as useMergeProps,
|
|
147
|
+
xa as useMergeValue,
|
|
148
|
+
De as useMount,
|
|
149
|
+
ye as useMouse,
|
|
150
|
+
Fe as useMutationObserver,
|
|
151
|
+
Ue as useNetwork,
|
|
152
|
+
ia as useOnlineStatus,
|
|
153
|
+
Sa as useOverflowHidden,
|
|
154
|
+
Ra as useOverrideRef,
|
|
155
|
+
Pe as usePagination,
|
|
156
|
+
Ea as usePersistCallback,
|
|
157
|
+
Ta as usePrefersColorSchemeDark,
|
|
158
|
+
We as usePrevious,
|
|
159
|
+
Ve as useRafInterval,
|
|
160
|
+
He as useRafState,
|
|
161
|
+
Ke as useRafTimeout,
|
|
162
|
+
Be as useReactive,
|
|
163
|
+
ce as useRefLatest,
|
|
164
|
+
ha as useRefs,
|
|
165
|
+
Ne as useRequest,
|
|
166
|
+
Qe as useResetState,
|
|
167
|
+
pt as useResizeObserver,
|
|
168
|
+
_e as useResponsive,
|
|
169
|
+
et as useSafeState,
|
|
170
|
+
at as useScroll,
|
|
171
|
+
rt as useSelections,
|
|
172
|
+
ft as useSessionStorageState,
|
|
173
|
+
lt as useSetState,
|
|
174
|
+
mt as useSize,
|
|
175
|
+
La as useStateCallback,
|
|
176
|
+
ka as useStateWithPromise,
|
|
177
|
+
nt as useTextSelection,
|
|
178
|
+
ct as useTheme,
|
|
179
|
+
vt as useThrottle,
|
|
180
|
+
Ct as useThrottleEffect,
|
|
181
|
+
bt as useThrottleFn,
|
|
182
|
+
gt as useTimeout,
|
|
183
|
+
Dt as useTitle,
|
|
184
|
+
yt as useToggle,
|
|
185
|
+
Ft as useTrackedEffect,
|
|
186
|
+
Ut as useUnmount,
|
|
187
|
+
Pt as useUnmountedRef,
|
|
188
|
+
Ot as useUpdate,
|
|
189
|
+
zt as useUpdateEffect,
|
|
190
|
+
At as useUpdateLayoutEffect,
|
|
191
|
+
qt as useUrlState,
|
|
192
|
+
Gt as useVirtualList,
|
|
193
|
+
Ia as useWatch,
|
|
194
|
+
Yt as useWebSocket,
|
|
195
|
+
Jt as useWhyDidYouUpdate,
|
|
196
|
+
wa as useWindowSize
|
|
197
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useEffect as c } from "react";
|
|
3
|
+
import "../../utils/is.js";
|
|
4
|
+
import { isFunction as s } from "@unicom-cloud/utils/is";
|
|
5
|
+
function i(e) {
|
|
6
|
+
return s(e[Symbol.asyncIterator]);
|
|
7
|
+
}
|
|
8
|
+
function m(e, r) {
|
|
9
|
+
c(() => {
|
|
10
|
+
const t = e();
|
|
11
|
+
let n = !1;
|
|
12
|
+
async function o() {
|
|
13
|
+
if (i(t))
|
|
14
|
+
for (; !((await t.next()).done || n); )
|
|
15
|
+
;
|
|
16
|
+
else
|
|
17
|
+
await t;
|
|
18
|
+
}
|
|
19
|
+
return o(), () => {
|
|
20
|
+
n = !0;
|
|
21
|
+
};
|
|
22
|
+
}, r);
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
m as default
|
|
26
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useMemo as u } from "react";
|
|
3
|
+
import a from "../use-toggle/index.js";
|
|
4
|
+
function g(t = !1) {
|
|
5
|
+
const [s, { toggle: o, set: e }] = a(!!t), r = u(() => ({
|
|
6
|
+
toggle: o,
|
|
7
|
+
set: (n) => e(!!n),
|
|
8
|
+
setTrue: () => e(!0),
|
|
9
|
+
setFalse: () => e(!1)
|
|
10
|
+
}), []);
|
|
11
|
+
return [s, r];
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
g as default
|
|
15
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import "../../utils/is.js";
|
|
3
|
+
import u from "../use-latest/index.js";
|
|
4
|
+
import { getTargetElement as d } from "../utils/domTarget.js";
|
|
5
|
+
import l from "../utils/getDocumentOrShadow.js";
|
|
6
|
+
import p from "../utils/useEffectWithTarget.js";
|
|
7
|
+
import { isArray as n } from "@unicom-cloud/utils/is";
|
|
8
|
+
function L(f, o, r = "click") {
|
|
9
|
+
const m = u(f);
|
|
10
|
+
p(
|
|
11
|
+
() => {
|
|
12
|
+
const s = (t) => {
|
|
13
|
+
(n(o) ? o : [o]).some((a) => {
|
|
14
|
+
const i = d(a);
|
|
15
|
+
return !i || i.contains(t.target);
|
|
16
|
+
}) || m.current(t);
|
|
17
|
+
}, c = l(o), e = n(r) ? r : [r];
|
|
18
|
+
return e.forEach(
|
|
19
|
+
(t) => c.addEventListener(t, s)
|
|
20
|
+
), () => {
|
|
21
|
+
e.forEach(
|
|
22
|
+
(t) => c.removeEventListener(t, s)
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
n(r) ? r : [r],
|
|
27
|
+
o
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
L as default
|
|
32
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useMemo as y, useRef as O } from "react";
|
|
3
|
+
import "../../utils/is.js";
|
|
4
|
+
import P from "../use-memoized-fn/index.js";
|
|
5
|
+
import b from "../use-update/index.js";
|
|
6
|
+
import { isFunction as g } from "@unicom-cloud/utils/is";
|
|
7
|
+
function M(i, c = {}) {
|
|
8
|
+
const e = i ?? {}, {
|
|
9
|
+
defaultValue: p,
|
|
10
|
+
defaultValuePropName: n = "defaultValue",
|
|
11
|
+
valuePropName: u = "value",
|
|
12
|
+
trigger: a = "onChange"
|
|
13
|
+
} = c, l = e[u], r = Object.prototype.hasOwnProperty.call(
|
|
14
|
+
e,
|
|
15
|
+
u
|
|
16
|
+
), f = y(() => r ? l : Object.prototype.hasOwnProperty.call(e, n) ? e[n] : p, []), t = O(f);
|
|
17
|
+
r && (t.current = l);
|
|
18
|
+
const m = b();
|
|
19
|
+
function d(o, ...V) {
|
|
20
|
+
const s = g(o) ? o(t.current) : o;
|
|
21
|
+
r || (t.current = s, m()), e[a] && e[a](s, ...V);
|
|
22
|
+
}
|
|
23
|
+
return [t.current, P(d)];
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
M as default
|
|
27
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import o from "@unicom-cloud/utils/js-cookie";
|
|
3
|
+
import { useState as l } from "react";
|
|
4
|
+
import "../../utils/is.js";
|
|
5
|
+
import d from "../use-memoized-fn/index.js";
|
|
6
|
+
import { isString as c, isFunction as s } from "@unicom-cloud/utils/is";
|
|
7
|
+
function F(r, e = {}) {
|
|
8
|
+
const [a, i] = l(() => {
|
|
9
|
+
const t = o.get(r);
|
|
10
|
+
return c(t) ? t : s(e.defaultValue) ? e.defaultValue() : e.defaultValue;
|
|
11
|
+
}), f = d(
|
|
12
|
+
(t, m = {}) => {
|
|
13
|
+
const { defaultValue: p, ...n } = { ...e, ...m }, u = s(t) ? t(a) : t;
|
|
14
|
+
i(u), u === void 0 ? o.remove(r) : o.set(r, u, n);
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
return [a, f];
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
F as default
|
|
21
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import h from "dayjs";
|
|
3
|
+
import { useMemo as m, useState as p, useEffect as v } from "react";
|
|
4
|
+
import "../../utils/is.js";
|
|
5
|
+
import L from "../use-latest/index.js";
|
|
6
|
+
import { isNumber as T } from "@unicom-cloud/utils/is";
|
|
7
|
+
const a = (t) => {
|
|
8
|
+
if (!t)
|
|
9
|
+
return 0;
|
|
10
|
+
const e = h(t).valueOf() - Date.now();
|
|
11
|
+
return e < 0 ? 0 : e;
|
|
12
|
+
}, w = (t) => ({
|
|
13
|
+
days: Math.floor(t / 864e5),
|
|
14
|
+
hours: Math.floor(t / 36e5) % 24,
|
|
15
|
+
minutes: Math.floor(t / 6e4) % 60,
|
|
16
|
+
seconds: Math.floor(t / 1e3) % 60,
|
|
17
|
+
milliseconds: Math.floor(t) % 1e3
|
|
18
|
+
}), R = (t = {}) => {
|
|
19
|
+
const { leftTime: e, targetDate: c, interval: f = 1e3, onEnd: i } = t || {}, l = m(() => T(e) && e > 0 ? Date.now() + e : void 0, [e]), r = "leftTime" in t ? l : c, [o, n] = p(() => a(r)), M = L(i);
|
|
20
|
+
v(() => {
|
|
21
|
+
if (!r) {
|
|
22
|
+
n(0);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
n(a(r));
|
|
26
|
+
const s = setInterval(() => {
|
|
27
|
+
const u = a(r);
|
|
28
|
+
n(u), u === 0 && (clearInterval(s), M.current?.());
|
|
29
|
+
}, f);
|
|
30
|
+
return () => clearInterval(s);
|
|
31
|
+
}, [r, f]);
|
|
32
|
+
const d = m(() => w(o), [o]);
|
|
33
|
+
return [o, d];
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
R as default
|
|
37
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useState as h } from "react";
|
|
3
|
+
import "../../utils/is.js";
|
|
4
|
+
import m from "../use-memoized-fn/index.js";
|
|
5
|
+
import { isNumber as i } from "@unicom-cloud/utils/is";
|
|
6
|
+
function a(s, u = {}) {
|
|
7
|
+
const { min: r, max: n } = u;
|
|
8
|
+
let e = s;
|
|
9
|
+
return i(n) && (e = Math.min(n, e)), i(r) && (e = Math.max(r, e)), e;
|
|
10
|
+
}
|
|
11
|
+
function N(s = 0, u = {}) {
|
|
12
|
+
const { min: r, max: n } = u, [e, f] = h(() => a(s, {
|
|
13
|
+
min: r,
|
|
14
|
+
max: n
|
|
15
|
+
})), c = (t) => {
|
|
16
|
+
f((o) => {
|
|
17
|
+
const M = i(t) ? t : t(o);
|
|
18
|
+
return a(M, {
|
|
19
|
+
max: n,
|
|
20
|
+
min: r
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}, p = (t = 1) => {
|
|
24
|
+
c((o) => o + t);
|
|
25
|
+
}, d = (t = 1) => {
|
|
26
|
+
c((o) => o - t);
|
|
27
|
+
}, g = (t) => {
|
|
28
|
+
c(t);
|
|
29
|
+
}, x = () => {
|
|
30
|
+
c(s);
|
|
31
|
+
};
|
|
32
|
+
return [
|
|
33
|
+
e,
|
|
34
|
+
{
|
|
35
|
+
inc: m(p),
|
|
36
|
+
dec: m(d),
|
|
37
|
+
set: m(g),
|
|
38
|
+
reset: m(x)
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
N as default
|
|
44
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useRef as o } from "react";
|
|
3
|
+
import r from "../utils/depsAreSame.js";
|
|
4
|
+
const s = (t, i) => {
|
|
5
|
+
const { current: e } = o({
|
|
6
|
+
deps: i,
|
|
7
|
+
obj: void 0,
|
|
8
|
+
initialized: !1
|
|
9
|
+
});
|
|
10
|
+
return (e.initialized === !1 || !r(e.deps, i)) && (e.deps = i, e.obj = t(), e.initialized = !0), e.obj;
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
s as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useState as c, useEffect as r } from "react";
|
|
3
|
+
import s from "../use-debounce-fn/index.js";
|
|
4
|
+
function d(e, o) {
|
|
5
|
+
const [t, n] = c(e), { run: u } = s(() => {
|
|
6
|
+
n(e);
|
|
7
|
+
}, o);
|
|
8
|
+
return r(() => {
|
|
9
|
+
u();
|
|
10
|
+
}, [e]), t;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
d as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useState as n, useEffect as s } from "react";
|
|
3
|
+
import c from "../use-debounce-fn/index.js";
|
|
4
|
+
import a from "../use-update-effect/index.js";
|
|
5
|
+
function l(e, t, f) {
|
|
6
|
+
const [o, u] = n({}), { run: r } = c(() => {
|
|
7
|
+
u({});
|
|
8
|
+
}, f);
|
|
9
|
+
s(() => r(), t), a(e, [o]);
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
l as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import c from "lodash/debounce";
|
|
3
|
+
import { useMemo as i } from "react";
|
|
4
|
+
import "../../utils/is.js";
|
|
5
|
+
import m from "../use-latest/index.js";
|
|
6
|
+
import s from "../use-unmount/index.js";
|
|
7
|
+
import f from "../utils/isDev.js";
|
|
8
|
+
import { isFunction as a } from "@unicom-cloud/utils/is";
|
|
9
|
+
function w(o, r) {
|
|
10
|
+
f && (a(o) || console.error(
|
|
11
|
+
`useDebounceFn expected parameter is a function, got ${typeof o}`
|
|
12
|
+
));
|
|
13
|
+
const t = m(o), n = r?.wait ?? 1e3, e = i(
|
|
14
|
+
() => c(
|
|
15
|
+
(...u) => t.current(...u),
|
|
16
|
+
n,
|
|
17
|
+
r
|
|
18
|
+
),
|
|
19
|
+
[]
|
|
20
|
+
);
|
|
21
|
+
return s(() => {
|
|
22
|
+
e.cancel();
|
|
23
|
+
}), {
|
|
24
|
+
run: e,
|
|
25
|
+
cancel: e.cancel,
|
|
26
|
+
flush: e.flush
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
w as default
|
|
31
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useState as r } from "react";
|
|
3
|
+
import s from "../use-event-listener/index.js";
|
|
4
|
+
import { isBrowser as o } from "@unicom-cloud/utils/constant/platform";
|
|
5
|
+
const i = () => o ? document.visibilityState : "visible";
|
|
6
|
+
function c() {
|
|
7
|
+
const [t, e] = r(i);
|
|
8
|
+
return s(
|
|
9
|
+
"visibilitychange",
|
|
10
|
+
() => {
|
|
11
|
+
e(i());
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
target: () => document
|
|
15
|
+
}
|
|
16
|
+
), t;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
c as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useRef as E } from "react";
|
|
3
|
+
import "../../utils/is.js";
|
|
4
|
+
import m from "../use-latest/index.js";
|
|
5
|
+
import p from "../use-mount/index.js";
|
|
6
|
+
import { getTargetElement as l } from "../utils/domTarget.js";
|
|
7
|
+
import D from "../utils/useEffectWithTarget.js";
|
|
8
|
+
import { isString as v } from "@unicom-cloud/utils/is";
|
|
9
|
+
const w = (g, s, f = {}) => {
|
|
10
|
+
const o = m(f), c = m(g), n = E(void 0), { dragImage: a } = o.current;
|
|
11
|
+
p(() => {
|
|
12
|
+
if (a?.image) {
|
|
13
|
+
const { image: t } = a;
|
|
14
|
+
if (v(t)) {
|
|
15
|
+
const e = new Image();
|
|
16
|
+
e.src = t, n.current = e;
|
|
17
|
+
} else
|
|
18
|
+
n.current = t;
|
|
19
|
+
}
|
|
20
|
+
}), D(
|
|
21
|
+
() => {
|
|
22
|
+
const t = l(s);
|
|
23
|
+
if (!t?.addEventListener)
|
|
24
|
+
return;
|
|
25
|
+
const e = (r) => {
|
|
26
|
+
if (o.current.onDragStart?.(r), r.dataTransfer.setData("custom", JSON.stringify(c.current)), a?.image && n.current) {
|
|
27
|
+
const { offsetX: d = 0, offsetY: u = 0 } = a;
|
|
28
|
+
r.dataTransfer.setDragImage(
|
|
29
|
+
n.current,
|
|
30
|
+
d,
|
|
31
|
+
u
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}, i = (r) => {
|
|
35
|
+
o.current.onDragEnd?.(r);
|
|
36
|
+
};
|
|
37
|
+
return t.setAttribute("draggable", "true"), t.addEventListener("dragstart", e), t.addEventListener("dragend", i), () => {
|
|
38
|
+
t.removeEventListener("dragstart", e), t.removeEventListener("dragend", i);
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
[],
|
|
42
|
+
s
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
w as default
|
|
47
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useRef as E } from "react";
|
|
3
|
+
import f from "../use-latest/index.js";
|
|
4
|
+
import { getTargetElement as v } from "../utils/domTarget.js";
|
|
5
|
+
import L from "../utils/useEffectWithTarget.js";
|
|
6
|
+
const y = (i, D = {}) => {
|
|
7
|
+
const r = f(D), a = E(void 0);
|
|
8
|
+
L(
|
|
9
|
+
() => {
|
|
10
|
+
const t = v(i);
|
|
11
|
+
if (!t?.addEventListener)
|
|
12
|
+
return;
|
|
13
|
+
const c = (e, o) => {
|
|
14
|
+
const l = e.getData("text/uri-list"), s = e.getData("custom");
|
|
15
|
+
if (s && r.current.onDom) {
|
|
16
|
+
let n = s;
|
|
17
|
+
try {
|
|
18
|
+
n = JSON.parse(s);
|
|
19
|
+
} catch {
|
|
20
|
+
n = s;
|
|
21
|
+
}
|
|
22
|
+
r.current.onDom(n, o);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (l && r.current.onUri) {
|
|
26
|
+
r.current.onUri(l, o);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (e.files && e.files.length && r.current.onFiles) {
|
|
30
|
+
r.current.onFiles(
|
|
31
|
+
Array.from(e.files),
|
|
32
|
+
o
|
|
33
|
+
);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
e.items && e.items.length && r.current.onText && e.items[0].getAsString((n) => {
|
|
37
|
+
r.current.onText(n, o);
|
|
38
|
+
});
|
|
39
|
+
}, u = (e) => {
|
|
40
|
+
e.preventDefault(), e.stopPropagation(), a.current = e.target, r.current.onDragEnter?.(e);
|
|
41
|
+
}, g = (e) => {
|
|
42
|
+
e.preventDefault(), r.current.onDragOver?.(e);
|
|
43
|
+
}, m = (e) => {
|
|
44
|
+
e.target === a.current && r.current.onDragLeave?.(e);
|
|
45
|
+
}, d = (e) => {
|
|
46
|
+
e.preventDefault(), c(e.dataTransfer, e), r.current.onDrop?.(e);
|
|
47
|
+
}, p = (e) => {
|
|
48
|
+
c(e.clipboardData, e), r.current.onPaste?.(e);
|
|
49
|
+
};
|
|
50
|
+
return t.addEventListener("dragenter", u), t.addEventListener("dragover", g), t.addEventListener("dragleave", m), t.addEventListener("drop", d), t.addEventListener("paste", p), () => {
|
|
51
|
+
t.removeEventListener("dragenter", u), t.removeEventListener("dragover", g), t.removeEventListener("dragleave", m), t.removeEventListener("drop", d), t.removeEventListener("paste", p);
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
[],
|
|
55
|
+
i
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
y as default
|
|
60
|
+
};
|