@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
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { MATCH_MEDIA_PREFERS_COLOR_SCHEME_DARK as e } from "@unicom-cloud/utils/constant";
|
|
3
|
+
import { useState as o, useEffect as s } from "react";
|
|
4
|
+
function m() {
|
|
5
|
+
const [r, a] = o(
|
|
6
|
+
e.matches
|
|
7
|
+
);
|
|
8
|
+
return s(() => {
|
|
9
|
+
function t(n) {
|
|
10
|
+
a(!!n.matches);
|
|
11
|
+
}
|
|
12
|
+
return e.addEventListener(
|
|
13
|
+
"change",
|
|
14
|
+
t
|
|
15
|
+
), () => {
|
|
16
|
+
e.removeEventListener(
|
|
17
|
+
"change",
|
|
18
|
+
t
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
}, []), r;
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
m as default
|
|
25
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useRef as s, useCallback as m, useEffect as u } from "react";
|
|
3
|
+
import "../../utils/is.js";
|
|
4
|
+
import f from "../use-latest/index.js";
|
|
5
|
+
import { isNumber as d, isUndefined as c } from "@unicom-cloud/utils/is";
|
|
6
|
+
const l = (t, e = 0) => {
|
|
7
|
+
if (c(requestAnimationFrame))
|
|
8
|
+
return {
|
|
9
|
+
id: setInterval(t, e)
|
|
10
|
+
};
|
|
11
|
+
let i = Date.now();
|
|
12
|
+
const r = {
|
|
13
|
+
id: 0
|
|
14
|
+
}, n = () => {
|
|
15
|
+
Date.now() - i >= e && (t(), i = Date.now()), r.id = requestAnimationFrame(n);
|
|
16
|
+
};
|
|
17
|
+
return r.id = requestAnimationFrame(n), r;
|
|
18
|
+
}, p = (t) => c(cancelAnimationFrame), v = (t) => {
|
|
19
|
+
if (p(t.id))
|
|
20
|
+
return clearInterval(t.id);
|
|
21
|
+
cancelAnimationFrame(t.id);
|
|
22
|
+
};
|
|
23
|
+
function D(t, e, i) {
|
|
24
|
+
const r = i?.immediate, n = f(t), o = s(void 0), a = m(() => {
|
|
25
|
+
o.current && v(o.current);
|
|
26
|
+
}, []);
|
|
27
|
+
return u(() => {
|
|
28
|
+
if (!(!d(e) || e < 0))
|
|
29
|
+
return r && n.current(), o.current = l(() => {
|
|
30
|
+
n.current();
|
|
31
|
+
}, e), a;
|
|
32
|
+
}, [e]), a;
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
D as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useRef as s, useState as u, useCallback as c } from "react";
|
|
3
|
+
import m from "../use-unmount/index.js";
|
|
4
|
+
function l(e) {
|
|
5
|
+
const t = s(0), [a, n] = u(e), r = c((o) => {
|
|
6
|
+
cancelAnimationFrame(t.current), t.current = requestAnimationFrame(() => {
|
|
7
|
+
n(o);
|
|
8
|
+
});
|
|
9
|
+
}, []);
|
|
10
|
+
return m(() => {
|
|
11
|
+
cancelAnimationFrame(t.current);
|
|
12
|
+
}), [a, r];
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
l as default
|
|
16
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useRef as u, useCallback as m, useEffect as s } from "react";
|
|
3
|
+
import "../../utils/is.js";
|
|
4
|
+
import c from "../use-latest/index.js";
|
|
5
|
+
import { isNumber as a, isUndefined as o } from "@unicom-cloud/utils/is";
|
|
6
|
+
const f = (e, t = 0) => {
|
|
7
|
+
if (o(requestAnimationFrame))
|
|
8
|
+
return {
|
|
9
|
+
id: setTimeout(e, t)
|
|
10
|
+
};
|
|
11
|
+
const r = {
|
|
12
|
+
id: 0
|
|
13
|
+
}, n = Date.now(), i = () => {
|
|
14
|
+
Date.now() - n >= t ? e() : r.id = requestAnimationFrame(i);
|
|
15
|
+
};
|
|
16
|
+
return r.id = requestAnimationFrame(i), r;
|
|
17
|
+
}, d = (e) => o(cancelAnimationFrame), p = (e) => {
|
|
18
|
+
if (d(e.id))
|
|
19
|
+
return clearTimeout(e.id);
|
|
20
|
+
cancelAnimationFrame(e.id);
|
|
21
|
+
};
|
|
22
|
+
function q(e, t) {
|
|
23
|
+
const r = c(e), n = u(void 0), i = m(() => {
|
|
24
|
+
n.current && p(n.current);
|
|
25
|
+
}, []);
|
|
26
|
+
return s(() => {
|
|
27
|
+
if (!(!a(t) || t < 0))
|
|
28
|
+
return n.current = f(() => {
|
|
29
|
+
r.current();
|
|
30
|
+
}, t), i;
|
|
31
|
+
}, [t]), i;
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
q as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useRef as y } from "react";
|
|
3
|
+
import "../../utils/is.js";
|
|
4
|
+
import R from "../use-creation/index.js";
|
|
5
|
+
import d from "../use-update/index.js";
|
|
6
|
+
import { isPlainObject as i, isArray as w } from "@unicom-cloud/utils/is";
|
|
7
|
+
const f = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
function m(e, s) {
|
|
9
|
+
const c = f.get(e);
|
|
10
|
+
if (c)
|
|
11
|
+
return c;
|
|
12
|
+
if (a.has(e))
|
|
13
|
+
return e;
|
|
14
|
+
const p = new Proxy(e, {
|
|
15
|
+
get(r, o, n) {
|
|
16
|
+
const t = Reflect.get(r, o, n), u = Reflect.getOwnPropertyDescriptor(r, o);
|
|
17
|
+
return !u?.configurable && !u?.writable ? t : i(t) || w(t) ? m(t, s) : t;
|
|
18
|
+
},
|
|
19
|
+
set(r, o, n) {
|
|
20
|
+
const t = Reflect.set(r, o, n);
|
|
21
|
+
return s(), t;
|
|
22
|
+
},
|
|
23
|
+
deleteProperty(r, o) {
|
|
24
|
+
const n = Reflect.deleteProperty(r, o);
|
|
25
|
+
return s(), n;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return f.set(e, p), a.set(p, e), p;
|
|
29
|
+
}
|
|
30
|
+
function v(e) {
|
|
31
|
+
const s = d(), c = y(e);
|
|
32
|
+
return R(() => m(c.current, () => {
|
|
33
|
+
s();
|
|
34
|
+
}), []);
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
v as default
|
|
38
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import "../../../utils/is.js";
|
|
3
|
+
import { isFunction as u } from "@unicom-cloud/utils/is";
|
|
4
|
+
class c {
|
|
5
|
+
constructor(t, i, r, n = {}) {
|
|
6
|
+
this.serviceRef = t, this.options = i, this.subscribe = r, this.initState = n, this.count = 0, this.state = {
|
|
7
|
+
loading: !1,
|
|
8
|
+
params: void 0,
|
|
9
|
+
data: void 0,
|
|
10
|
+
error: void 0
|
|
11
|
+
}, this.state = {
|
|
12
|
+
...this.state,
|
|
13
|
+
loading: !i.manual,
|
|
14
|
+
...n
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
setState(t = {}) {
|
|
18
|
+
this.state = {
|
|
19
|
+
...this.state,
|
|
20
|
+
...t
|
|
21
|
+
}, this.subscribe();
|
|
22
|
+
}
|
|
23
|
+
runPluginHandler(t, ...i) {
|
|
24
|
+
const r = this.pluginImpls.map((n) => n[t]?.(...i)).filter(Boolean);
|
|
25
|
+
return Object.assign({}, ...r);
|
|
26
|
+
}
|
|
27
|
+
async runAsync(...t) {
|
|
28
|
+
this.count += 1;
|
|
29
|
+
const i = this.count, {
|
|
30
|
+
stopNow: r = !1,
|
|
31
|
+
returnNow: n = !1,
|
|
32
|
+
...o
|
|
33
|
+
} = this.runPluginHandler("onBefore", t);
|
|
34
|
+
if (r)
|
|
35
|
+
return new Promise(() => {
|
|
36
|
+
});
|
|
37
|
+
if (this.setState({
|
|
38
|
+
loading: !0,
|
|
39
|
+
params: t,
|
|
40
|
+
...o
|
|
41
|
+
}), n)
|
|
42
|
+
return Promise.resolve(o.data);
|
|
43
|
+
this.options.onBefore?.(t);
|
|
44
|
+
try {
|
|
45
|
+
let { servicePromise: s } = this.runPluginHandler(
|
|
46
|
+
"onRequest",
|
|
47
|
+
this.serviceRef.current,
|
|
48
|
+
t
|
|
49
|
+
);
|
|
50
|
+
s || (s = this.serviceRef.current(...t));
|
|
51
|
+
const e = await s;
|
|
52
|
+
return i !== this.count ? new Promise(() => {
|
|
53
|
+
}) : (this.setState({
|
|
54
|
+
data: e,
|
|
55
|
+
error: void 0,
|
|
56
|
+
loading: !1
|
|
57
|
+
}), this.options.onSuccess?.(e, t), this.runPluginHandler("onSuccess", e, t), this.options.onFinally?.(t, e, void 0), i === this.count && this.runPluginHandler("onFinally", t, e, void 0), e);
|
|
58
|
+
} catch (s) {
|
|
59
|
+
if (i !== this.count)
|
|
60
|
+
return new Promise(() => {
|
|
61
|
+
});
|
|
62
|
+
throw this.setState({
|
|
63
|
+
error: s,
|
|
64
|
+
loading: !1
|
|
65
|
+
}), this.options.onError?.(s, t), this.runPluginHandler("onError", s, t), this.options.onFinally?.(t, void 0, s), i === this.count && this.runPluginHandler("onFinally", t, void 0, s), s;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
run(...t) {
|
|
69
|
+
this.runAsync(...t).catch((i) => {
|
|
70
|
+
this.options.onError || console.error(i);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
cancel() {
|
|
74
|
+
this.count += 1, this.setState({
|
|
75
|
+
loading: !1
|
|
76
|
+
}), this.runPluginHandler("onCancel");
|
|
77
|
+
}
|
|
78
|
+
refresh() {
|
|
79
|
+
this.run(...this.state.params || []);
|
|
80
|
+
}
|
|
81
|
+
refreshAsync() {
|
|
82
|
+
return this.runAsync(...this.state.params || []);
|
|
83
|
+
}
|
|
84
|
+
mutate(t) {
|
|
85
|
+
const i = u(t) ? t(this.state.data) : t;
|
|
86
|
+
this.runPluginHandler("onMutate", i), this.setState({
|
|
87
|
+
data: i
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
c as default
|
|
93
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useRef as s } from "react";
|
|
3
|
+
import o from "../../../use-update-effect/index.js";
|
|
4
|
+
const l = (r, {
|
|
5
|
+
manual: e,
|
|
6
|
+
ready: u = !0,
|
|
7
|
+
defaultParams: f = [],
|
|
8
|
+
refreshDeps: i = [],
|
|
9
|
+
refreshDepsAction: n
|
|
10
|
+
}) => {
|
|
11
|
+
const t = s(!1);
|
|
12
|
+
return t.current = !1, o(() => {
|
|
13
|
+
!e && u && (t.current = !0, r.run(...f));
|
|
14
|
+
}, [u]), o(() => {
|
|
15
|
+
t.current || e || (t.current = !0, n ? n() : r.refresh());
|
|
16
|
+
}, [...i]), {
|
|
17
|
+
onBefore: () => {
|
|
18
|
+
if (!u)
|
|
19
|
+
return {
|
|
20
|
+
stopNow: !0
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
l.onInit = ({ ready: r = !0, manual: e }) => ({
|
|
26
|
+
loading: !e && r
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
l as default
|
|
30
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useRef as l } from "react";
|
|
3
|
+
import C from "../../../use-creation/index.js";
|
|
4
|
+
import w from "../../../use-unmount/index.js";
|
|
5
|
+
import { getCache as P, setCache as b } from "../utils/cache.js";
|
|
6
|
+
import { getCachePromise as v, setCachePromise as D } from "../utils/cachePromise.js";
|
|
7
|
+
import { subscribe as n, trigger as O } from "../utils/cacheSubscribe.js";
|
|
8
|
+
const B = (a, {
|
|
9
|
+
cacheKey: e,
|
|
10
|
+
cacheTime: g = 300 * 1e3,
|
|
11
|
+
staleTime: s = 0,
|
|
12
|
+
setCache: u,
|
|
13
|
+
getCache: m
|
|
14
|
+
}) => {
|
|
15
|
+
const i = l(void 0), f = l(void 0), d = (t, r) => {
|
|
16
|
+
u ? u(r) : b(t, g, r), O(t, r.data);
|
|
17
|
+
}, p = (t, r = []) => m ? m(r) : P(t);
|
|
18
|
+
return C(() => {
|
|
19
|
+
if (!e)
|
|
20
|
+
return;
|
|
21
|
+
const t = p(e);
|
|
22
|
+
t && Object.hasOwnProperty.call(t, "data") && (a.state.data = t.data, a.state.params = t.params, (s === -1 || Date.now() - t.time <= s) && (a.state.loading = !1)), i.current = n(e, (r) => {
|
|
23
|
+
a.setState({ data: r });
|
|
24
|
+
});
|
|
25
|
+
}, []), w(() => {
|
|
26
|
+
i.current?.();
|
|
27
|
+
}), e ? {
|
|
28
|
+
onBefore: (t) => {
|
|
29
|
+
const r = p(e, t);
|
|
30
|
+
return !r || !Object.hasOwnProperty.call(r, "data") ? {} : s === -1 || Date.now() - r.time <= s ? {
|
|
31
|
+
loading: !1,
|
|
32
|
+
data: r?.data,
|
|
33
|
+
error: void 0,
|
|
34
|
+
returnNow: !0
|
|
35
|
+
} : {
|
|
36
|
+
data: r?.data,
|
|
37
|
+
error: void 0
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
onRequest: (t, r) => {
|
|
41
|
+
let o = v(e);
|
|
42
|
+
return o && o !== f.current ? { servicePromise: o } : (o = t(...r), f.current = o, D(e, o), { servicePromise: o });
|
|
43
|
+
},
|
|
44
|
+
onSuccess: (t, r) => {
|
|
45
|
+
e && (i.current?.(), d(e, {
|
|
46
|
+
data: t,
|
|
47
|
+
params: r,
|
|
48
|
+
time: Date.now()
|
|
49
|
+
}), i.current = n(e, (o) => {
|
|
50
|
+
a.setState({ data: o });
|
|
51
|
+
}));
|
|
52
|
+
},
|
|
53
|
+
onMutate: (t) => {
|
|
54
|
+
e && (i.current?.(), d(e, {
|
|
55
|
+
data: t,
|
|
56
|
+
params: a.state.params,
|
|
57
|
+
time: Date.now()
|
|
58
|
+
}), i.current = n(e, (r) => {
|
|
59
|
+
a.setState({ data: r });
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
} : {};
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
B as default
|
|
66
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import l from "lodash/debounce";
|
|
3
|
+
import { useRef as p, useMemo as v, useEffect as y } from "react";
|
|
4
|
+
const P = (n, { debounceWait: o, debounceLeading: s, debounceTrailing: u, debounceMaxWait: i }) => {
|
|
5
|
+
const t = p(void 0), f = v(() => {
|
|
6
|
+
const r = {};
|
|
7
|
+
return s !== void 0 && (r.leading = s), u !== void 0 && (r.trailing = u), i !== void 0 && (r.maxWait = i), r;
|
|
8
|
+
}, [s, u, i]);
|
|
9
|
+
return y(() => {
|
|
10
|
+
if (o) {
|
|
11
|
+
const r = n.runAsync.bind(n);
|
|
12
|
+
return t.current = l(
|
|
13
|
+
(c) => {
|
|
14
|
+
c();
|
|
15
|
+
},
|
|
16
|
+
o,
|
|
17
|
+
f
|
|
18
|
+
), n.runAsync = (...c) => new Promise((e, m) => {
|
|
19
|
+
t.current?.(() => {
|
|
20
|
+
r(...c).then(e).catch(m);
|
|
21
|
+
});
|
|
22
|
+
}), () => {
|
|
23
|
+
t.current?.cancel(), n.runAsync = r;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}, [o, f]), o ? {
|
|
27
|
+
onCancel: () => {
|
|
28
|
+
t.current?.cancel();
|
|
29
|
+
}
|
|
30
|
+
} : {};
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
P as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useRef as u } from "react";
|
|
3
|
+
const a = (n, { loadingDelay: r, ready: o }) => {
|
|
4
|
+
const e = u(void 0);
|
|
5
|
+
if (!r)
|
|
6
|
+
return {};
|
|
7
|
+
const t = () => {
|
|
8
|
+
e.current && clearTimeout(e.current);
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
onBefore: () => (t(), o !== !1 && (e.current = setTimeout(() => {
|
|
12
|
+
n.setState({
|
|
13
|
+
loading: !0
|
|
14
|
+
});
|
|
15
|
+
}, r)), {
|
|
16
|
+
loading: !1
|
|
17
|
+
}),
|
|
18
|
+
onFinally: () => {
|
|
19
|
+
t();
|
|
20
|
+
},
|
|
21
|
+
onCancel: () => {
|
|
22
|
+
t();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
a as default
|
|
28
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useRef as c } from "react";
|
|
3
|
+
import n from "../../../use-update-effect/index.js";
|
|
4
|
+
import m from "../utils/isDocumentVisible.js";
|
|
5
|
+
import b from "../utils/subscribeReVisible.js";
|
|
6
|
+
const R = (o, { pollingInterval: e, pollingWhenHidden: i = !0, pollingErrorRetryCount: t = -1 }) => {
|
|
7
|
+
const u = c(void 0), f = c(void 0), r = c(0), s = () => {
|
|
8
|
+
u.current && clearTimeout(u.current), f.current?.();
|
|
9
|
+
};
|
|
10
|
+
return n(() => {
|
|
11
|
+
e || s();
|
|
12
|
+
}, [e]), e ? {
|
|
13
|
+
onBefore: () => {
|
|
14
|
+
s();
|
|
15
|
+
},
|
|
16
|
+
onError: () => {
|
|
17
|
+
r.current += 1;
|
|
18
|
+
},
|
|
19
|
+
onSuccess: () => {
|
|
20
|
+
r.current = 0;
|
|
21
|
+
},
|
|
22
|
+
onFinally: () => {
|
|
23
|
+
t === -1 || // When an error occurs, the request is not repeated after pollingErrorRetryCount retries
|
|
24
|
+
t !== -1 && r.current <= t ? u.current = setTimeout(() => {
|
|
25
|
+
!i && !m() ? f.current = b(() => {
|
|
26
|
+
o.refresh();
|
|
27
|
+
}) : o.refresh();
|
|
28
|
+
}, e) : r.current = 0;
|
|
29
|
+
},
|
|
30
|
+
onCancel: () => {
|
|
31
|
+
s();
|
|
32
|
+
}
|
|
33
|
+
} : {};
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
R as default
|
|
37
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useRef as u, useEffect as f } from "react";
|
|
3
|
+
import m from "../../../use-unmount/index.js";
|
|
4
|
+
import n from "../utils/limit.js";
|
|
5
|
+
import b from "../utils/subscribeFocus.js";
|
|
6
|
+
const d = (r, { refreshOnWindowFocus: e, focusTimespan: t = 5e3 }) => {
|
|
7
|
+
const o = u(void 0), i = () => {
|
|
8
|
+
o.current?.();
|
|
9
|
+
};
|
|
10
|
+
return f(() => {
|
|
11
|
+
if (e) {
|
|
12
|
+
const s = n(
|
|
13
|
+
r.refresh.bind(r),
|
|
14
|
+
t
|
|
15
|
+
);
|
|
16
|
+
o.current = b(() => {
|
|
17
|
+
s();
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return () => {
|
|
21
|
+
i();
|
|
22
|
+
};
|
|
23
|
+
}, [e, t]), m(() => {
|
|
24
|
+
i();
|
|
25
|
+
}), {};
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
d as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useRef as c } from "react";
|
|
3
|
+
const f = (u, { retryInterval: o, retryCount: t }) => {
|
|
4
|
+
const e = c(void 0), r = c(0), n = c(!1);
|
|
5
|
+
return t ? {
|
|
6
|
+
onBefore: () => {
|
|
7
|
+
n.current || (r.current = 0), n.current = !1, e.current && clearTimeout(e.current);
|
|
8
|
+
},
|
|
9
|
+
onSuccess: () => {
|
|
10
|
+
r.current = 0;
|
|
11
|
+
},
|
|
12
|
+
onError: () => {
|
|
13
|
+
if (r.current += 1, t === -1 || r.current <= t) {
|
|
14
|
+
const i = o ?? Math.min(1e3 * 2 ** r.current, 3e4);
|
|
15
|
+
e.current = setTimeout(() => {
|
|
16
|
+
n.current = !0, u.refresh();
|
|
17
|
+
}, i);
|
|
18
|
+
} else
|
|
19
|
+
r.current = 0;
|
|
20
|
+
},
|
|
21
|
+
onCancel: () => {
|
|
22
|
+
r.current = 0, e.current && clearTimeout(e.current);
|
|
23
|
+
}
|
|
24
|
+
} : {};
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
f as default
|
|
28
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import m from "lodash/throttle";
|
|
3
|
+
import { useRef as p, useEffect as y } from "react";
|
|
4
|
+
const R = (n, { throttleWait: r, throttleLeading: c, throttleTrailing: o }) => {
|
|
5
|
+
const u = p(void 0), e = {};
|
|
6
|
+
return c !== void 0 && (e.leading = c), o !== void 0 && (e.trailing = o), y(() => {
|
|
7
|
+
if (r) {
|
|
8
|
+
const i = n.runAsync.bind(n);
|
|
9
|
+
return u.current = m(
|
|
10
|
+
(s) => {
|
|
11
|
+
s();
|
|
12
|
+
},
|
|
13
|
+
r,
|
|
14
|
+
e
|
|
15
|
+
), n.runAsync = (...s) => new Promise((f, d) => {
|
|
16
|
+
u.current?.(() => {
|
|
17
|
+
i(...s).then(f).catch(d);
|
|
18
|
+
});
|
|
19
|
+
}), () => {
|
|
20
|
+
n.runAsync = i, u.current?.cancel();
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}, [r, c, o]), r ? {
|
|
24
|
+
onCancel: () => {
|
|
25
|
+
u.current?.cancel();
|
|
26
|
+
}
|
|
27
|
+
} : {};
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
R as default
|
|
31
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import r from "./plugins/useAutoRunPlugin.js";
|
|
3
|
+
import i from "./plugins/useCachePlugin.js";
|
|
4
|
+
import m from "./plugins/useDebouncePlugin.js";
|
|
5
|
+
import t from "./plugins/useLoadingDelayPlugin.js";
|
|
6
|
+
import n from "./plugins/usePollingPlugin.js";
|
|
7
|
+
import s from "./plugins/useRefreshOnWindowFocusPlugin.js";
|
|
8
|
+
import l from "./plugins/useRetryPlugin.js";
|
|
9
|
+
import f from "./plugins/useThrottlePlugin.js";
|
|
10
|
+
import p from "./useRequestImplement.js";
|
|
11
|
+
function D(e, o, u) {
|
|
12
|
+
return p(e, o, [
|
|
13
|
+
...u || [],
|
|
14
|
+
m,
|
|
15
|
+
t,
|
|
16
|
+
n,
|
|
17
|
+
s,
|
|
18
|
+
f,
|
|
19
|
+
r,
|
|
20
|
+
i,
|
|
21
|
+
l
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
D as default
|
|
26
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import "../../../utils/is.js";
|
|
3
|
+
import p from "../../use-creation/index.js";
|
|
4
|
+
import l from "../../use-latest/index.js";
|
|
5
|
+
import t from "../../use-memoized-fn/index.js";
|
|
6
|
+
import y from "../../use-mount/index.js";
|
|
7
|
+
import b from "../../use-unmount/index.js";
|
|
8
|
+
import h from "../../use-update/index.js";
|
|
9
|
+
import A from "../../utils/isDev.js";
|
|
10
|
+
import P from "./Fetch.js";
|
|
11
|
+
import { isArray as g } from "@unicom-cloud/utils/is";
|
|
12
|
+
function q(i, r = {}, n = []) {
|
|
13
|
+
const { manual: m = !1, ready: o = !0, ...f } = r;
|
|
14
|
+
A && r.defaultParams && !g(r.defaultParams) && console.warn(
|
|
15
|
+
`expected defaultParams is array, got ${typeof r.defaultParams}`
|
|
16
|
+
);
|
|
17
|
+
const s = {
|
|
18
|
+
manual: m,
|
|
19
|
+
ready: o,
|
|
20
|
+
...f
|
|
21
|
+
}, u = l(i), c = h(), e = p(() => {
|
|
22
|
+
const a = n.map((d) => d?.onInit?.(s)).filter(Boolean);
|
|
23
|
+
return new P(
|
|
24
|
+
u,
|
|
25
|
+
s,
|
|
26
|
+
c,
|
|
27
|
+
Object.assign({}, ...a)
|
|
28
|
+
);
|
|
29
|
+
}, []);
|
|
30
|
+
return e.options = s, e.pluginImpls = n.map(
|
|
31
|
+
(a) => a(e, s)
|
|
32
|
+
), y(() => {
|
|
33
|
+
if (!m && o) {
|
|
34
|
+
const a = e.state.params || r.defaultParams || [];
|
|
35
|
+
e.run(...a);
|
|
36
|
+
}
|
|
37
|
+
}), b(() => {
|
|
38
|
+
e.cancel();
|
|
39
|
+
}), {
|
|
40
|
+
loading: e.state.loading,
|
|
41
|
+
data: e.state.data,
|
|
42
|
+
error: e.state.error,
|
|
43
|
+
params: e.state.params || [],
|
|
44
|
+
cancel: t(e.cancel.bind(e)),
|
|
45
|
+
refresh: t(e.refresh.bind(e)),
|
|
46
|
+
refreshAsync: t(e.refreshAsync.bind(e)),
|
|
47
|
+
run: t(e.run.bind(e)),
|
|
48
|
+
runAsync: t(e.runAsync.bind(e)),
|
|
49
|
+
mutate: t(e.mutate.bind(e))
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
q as default
|
|
54
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import s from "lodash/castArray";
|
|
3
|
+
const t = /* @__PURE__ */ new Map(), n = (e, c, r) => {
|
|
4
|
+
const a = t.get(e);
|
|
5
|
+
a?.timer && clearTimeout(a.timer);
|
|
6
|
+
let o;
|
|
7
|
+
c > -1 && (o = setTimeout(() => {
|
|
8
|
+
t.delete(e);
|
|
9
|
+
}, c)), t.set(e, {
|
|
10
|
+
...r,
|
|
11
|
+
timer: o
|
|
12
|
+
});
|
|
13
|
+
}, h = (e) => t.get(e), l = (e) => {
|
|
14
|
+
e ? s(e).forEach((r) => t.delete(r)) : t.clear();
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
l as clearCache,
|
|
18
|
+
h as getCache,
|
|
19
|
+
n as setCache
|
|
20
|
+
};
|