@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,37 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import "../../utils/is.js";
|
|
3
|
+
import i from "../use-latest/index.js";
|
|
4
|
+
import { getTargetElement as m } from "../utils/domTarget.js";
|
|
5
|
+
import E from "../utils/useEffectWithTarget.js";
|
|
6
|
+
import { isArray as d } from "@unicom-cloud/utils/is";
|
|
7
|
+
function p(t, f, e = {}) {
|
|
8
|
+
const { enable: n = !0 } = e, s = i(f);
|
|
9
|
+
E(
|
|
10
|
+
() => {
|
|
11
|
+
if (!n)
|
|
12
|
+
return;
|
|
13
|
+
const a = m(e.target, window);
|
|
14
|
+
if (!a?.addEventListener)
|
|
15
|
+
return;
|
|
16
|
+
const c = (r) => s.current(r), u = d(t) ? t : [t];
|
|
17
|
+
return u.forEach((r) => {
|
|
18
|
+
a.addEventListener(r, c, {
|
|
19
|
+
capture: e.capture,
|
|
20
|
+
once: e.once,
|
|
21
|
+
passive: e.passive
|
|
22
|
+
});
|
|
23
|
+
}), () => {
|
|
24
|
+
u.forEach((r) => {
|
|
25
|
+
a.removeEventListener(r, c, {
|
|
26
|
+
capture: e.capture
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
[t, e.capture, e.once, e.passive, n],
|
|
32
|
+
e.target
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
p as default
|
|
37
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useState as l, useCallback as o } from "react";
|
|
3
|
+
import "../../utils/is.js";
|
|
4
|
+
import m from "../use-latest/index.js";
|
|
5
|
+
import { isFunction as p } from "@unicom-cloud/utils/is";
|
|
6
|
+
function b(a) {
|
|
7
|
+
const { initialValue: e, transformer: s } = a || {}, [u, t] = l(e), r = m(s), c = o(() => t(e), []), i = o((f) => {
|
|
8
|
+
const n = f.target.value;
|
|
9
|
+
return p(r.current) ? t(r.current(n)) : t(n);
|
|
10
|
+
}, []);
|
|
11
|
+
return [
|
|
12
|
+
u,
|
|
13
|
+
{
|
|
14
|
+
onChange: i,
|
|
15
|
+
reset: c
|
|
16
|
+
}
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
b as default
|
|
21
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useState as i, useRef as l, useEffect as f } from "react";
|
|
3
|
+
const a = {}, y = (t, s = {}) => {
|
|
4
|
+
const n = document.querySelector(`script[src="${t}"]`);
|
|
5
|
+
if (!n) {
|
|
6
|
+
const e = document.createElement("script");
|
|
7
|
+
return e.src = t, Object.keys(s).forEach((r) => {
|
|
8
|
+
e[r] = s[r];
|
|
9
|
+
}), e.setAttribute("data-status", "loading"), document.body.appendChild(e), {
|
|
10
|
+
ref: e,
|
|
11
|
+
status: "loading"
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
ref: n,
|
|
16
|
+
status: n.getAttribute("data-status") || "ready"
|
|
17
|
+
};
|
|
18
|
+
}, E = (t, s = {}) => {
|
|
19
|
+
const n = document.querySelector(`link[href="${t}"]`);
|
|
20
|
+
if (!n) {
|
|
21
|
+
const e = document.createElement("link");
|
|
22
|
+
return e.rel = "stylesheet", e.href = t, Object.keys(s).forEach((u) => {
|
|
23
|
+
e[u] = s[u];
|
|
24
|
+
}), "hideFocus" in e && e.relList && (e.rel = "preload", e.as = "style"), e.setAttribute("data-status", "loading"), document.head.appendChild(e), {
|
|
25
|
+
ref: e,
|
|
26
|
+
status: "loading"
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
ref: n,
|
|
31
|
+
status: n.getAttribute("data-status") || "ready"
|
|
32
|
+
};
|
|
33
|
+
}, v = (t, s) => {
|
|
34
|
+
const [n, e] = i(t ? "loading" : "unset"), r = l(void 0);
|
|
35
|
+
return f(() => {
|
|
36
|
+
if (!t) {
|
|
37
|
+
e("unset");
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const u = t.replace(/[|#].*$/, "");
|
|
41
|
+
if (s?.type === "css" || !s?.type && /(^css!|\.css$)/.test(u)) {
|
|
42
|
+
const c = E(t, s?.css);
|
|
43
|
+
r.current = c.ref, e(c.status);
|
|
44
|
+
} else if (s?.type === "js" || !s?.type && /(^js!|\.js$)/.test(u)) {
|
|
45
|
+
const c = y(t, s?.js);
|
|
46
|
+
r.current = c.ref, e(c.status);
|
|
47
|
+
} else
|
|
48
|
+
console.error(
|
|
49
|
+
"Cannot infer the type of external resource, and please provide a type ('js' | 'css'). "
|
|
50
|
+
);
|
|
51
|
+
if (!r.current)
|
|
52
|
+
return;
|
|
53
|
+
a[t] === void 0 ? a[t] = 1 : a[t] += 1;
|
|
54
|
+
const d = (c) => {
|
|
55
|
+
const o = c.type === "load" ? "ready" : "error";
|
|
56
|
+
r.current?.setAttribute("data-status", o), e(o);
|
|
57
|
+
};
|
|
58
|
+
return r.current.addEventListener("load", d), r.current.addEventListener("error", d), () => {
|
|
59
|
+
r.current?.removeEventListener("load", d), r.current?.removeEventListener("error", d), a[t] -= 1, a[t] === 0 && !s?.keepWhenUnused && r.current?.remove(), r.current = void 0;
|
|
60
|
+
};
|
|
61
|
+
}, [t]), n;
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
v as default
|
|
65
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useEffect as c } from "react";
|
|
3
|
+
const i = {
|
|
4
|
+
SVG: "image/svg+xml",
|
|
5
|
+
ICO: "image/x-icon",
|
|
6
|
+
GIF: "image/gif",
|
|
7
|
+
PNG: "image/png"
|
|
8
|
+
}, l = (e) => {
|
|
9
|
+
c(() => {
|
|
10
|
+
if (!e)
|
|
11
|
+
return;
|
|
12
|
+
const n = e.split("."), o = n[n.length - 1].toLocaleUpperCase(), t = document.querySelector("link[rel*='icon']") || document.createElement("link");
|
|
13
|
+
t.type = i[o], t.href = e, t.rel = "shortcut icon", document.getElementsByTagName("head")[0].appendChild(t);
|
|
14
|
+
}, [e]);
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
l as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useState as f } from "react";
|
|
3
|
+
import u from "../use-event-listener/index.js";
|
|
4
|
+
function h(e, i) {
|
|
5
|
+
const [s, o] = f(!1), { onFocus: r, onBlur: c, onChange: n } = i || {};
|
|
6
|
+
return u(
|
|
7
|
+
"focusin",
|
|
8
|
+
(t) => {
|
|
9
|
+
s || (r?.(t), n?.(!0), o(!0));
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
target: e
|
|
13
|
+
}
|
|
14
|
+
), u(
|
|
15
|
+
"focusout",
|
|
16
|
+
(t) => {
|
|
17
|
+
s && !t.currentTarget?.contains?.(t.relatedTarget) && (c?.(t), n?.(!1), o(!1));
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
target: e
|
|
21
|
+
}
|
|
22
|
+
), s;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
h as default
|
|
26
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import t from "@unicom-cloud/utils/screenfull";
|
|
3
|
+
import { useState as z, useRef as I, useEffect as L } from "react";
|
|
4
|
+
import "../../utils/is.js";
|
|
5
|
+
import F from "../use-latest/index.js";
|
|
6
|
+
import u from "../use-memoized-fn/index.js";
|
|
7
|
+
import { getTargetElement as i } from "../utils/domTarget.js";
|
|
8
|
+
import { isBoolean as q } from "@unicom-cloud/utils/is";
|
|
9
|
+
const T = (l, b) => {
|
|
10
|
+
const { onExit: h, onEnter: x, pageFullscreen: r = !1 } = b || {}, { className: o = "@unicom-cloud-ui-hooks-page-fullscreen", zIndex: y = 999999 } = q(r) || !r ? {} : r, C = F(h), R = F(x), [a, S] = z(c), f = I(c());
|
|
11
|
+
function c() {
|
|
12
|
+
return t.isEnabled && !!t.element && t.element === i(l);
|
|
13
|
+
}
|
|
14
|
+
const k = (e) => {
|
|
15
|
+
e ? R.current?.() : C.current?.();
|
|
16
|
+
}, m = (e) => {
|
|
17
|
+
f.current !== e && (k(e), S(e), f.current = e);
|
|
18
|
+
}, d = () => {
|
|
19
|
+
const e = c();
|
|
20
|
+
m(e);
|
|
21
|
+
}, p = (e) => {
|
|
22
|
+
const s = i(l);
|
|
23
|
+
if (!s)
|
|
24
|
+
return;
|
|
25
|
+
let n = document.getElementById(o);
|
|
26
|
+
e ? (s.classList.add(o), n || (n = document.createElement("style"), n.setAttribute("id", o), n.textContent = `
|
|
27
|
+
.${o} {
|
|
28
|
+
position: fixed; left: 0; top: 0; right: 0; bottom: 0;
|
|
29
|
+
width: 100% !important; height: 100% !important;
|
|
30
|
+
z-index: ${y};
|
|
31
|
+
}`, s.appendChild(n))) : (s.classList.remove(o), n && n.remove()), m(e);
|
|
32
|
+
}, g = () => {
|
|
33
|
+
const e = i(l);
|
|
34
|
+
if (e) {
|
|
35
|
+
if (r) {
|
|
36
|
+
p(!0);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (t.isEnabled)
|
|
40
|
+
try {
|
|
41
|
+
t.request(e);
|
|
42
|
+
} catch (s) {
|
|
43
|
+
console.error(s);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, E = () => {
|
|
47
|
+
const e = i(l);
|
|
48
|
+
if (e) {
|
|
49
|
+
if (r) {
|
|
50
|
+
p(!1);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
t.isEnabled && t.element === e && t.exit();
|
|
54
|
+
}
|
|
55
|
+
}, v = () => {
|
|
56
|
+
a ? E() : g();
|
|
57
|
+
};
|
|
58
|
+
return L(() => {
|
|
59
|
+
if (!(!t.isEnabled || r))
|
|
60
|
+
return t.on("change", d), () => {
|
|
61
|
+
t.off("change", d);
|
|
62
|
+
};
|
|
63
|
+
}, []), [
|
|
64
|
+
a,
|
|
65
|
+
{
|
|
66
|
+
enterFullscreen: u(g),
|
|
67
|
+
exitFullscreen: u(E),
|
|
68
|
+
toggleFullscreen: u(v),
|
|
69
|
+
isEnabled: t.isEnabled
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
};
|
|
73
|
+
export {
|
|
74
|
+
T as default
|
|
75
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useState as r, useCallback as u } from "react";
|
|
3
|
+
import n from "../use-latest/index.js";
|
|
4
|
+
function m(e) {
|
|
5
|
+
const [t, s] = r(e), a = n(t), o = u(() => a.current, []);
|
|
6
|
+
return [t, s, o];
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
m as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useState as w, useRef as k } from "react";
|
|
3
|
+
import "../../utils/is.js";
|
|
4
|
+
import c from "../use-memoized-fn/index.js";
|
|
5
|
+
import { isNumber as m } from "@unicom-cloud/utils/is";
|
|
6
|
+
const x = (s, t) => {
|
|
7
|
+
let r = s > 0 ? s - 1 : t.length + s;
|
|
8
|
+
return r >= t.length - 1 && (r = t.length - 1), r < 0 && (r = 0), r;
|
|
9
|
+
}, d = (s, t) => {
|
|
10
|
+
const r = x(s, t);
|
|
11
|
+
return {
|
|
12
|
+
_current: t[r],
|
|
13
|
+
_before: t.slice(0, r),
|
|
14
|
+
_after: t.slice(r + 1)
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
function V(s, t = 0) {
|
|
18
|
+
const [r, f] = w({
|
|
19
|
+
present: s,
|
|
20
|
+
past: [],
|
|
21
|
+
future: []
|
|
22
|
+
}), { present: i, past: o, future: l } = r, _ = k(s), h = (...n) => {
|
|
23
|
+
const e = n.length > 0 ? n[0] : _.current;
|
|
24
|
+
_.current = e, f({
|
|
25
|
+
present: e,
|
|
26
|
+
future: [],
|
|
27
|
+
past: []
|
|
28
|
+
});
|
|
29
|
+
}, b = (n) => {
|
|
30
|
+
const e = [...o, i], u = m(t) ? t : Number(t);
|
|
31
|
+
u > 0 && e.length > u && e.splice(0, 1), f({
|
|
32
|
+
present: n,
|
|
33
|
+
future: [],
|
|
34
|
+
past: e
|
|
35
|
+
});
|
|
36
|
+
}, g = (n = 1) => {
|
|
37
|
+
if (l.length === 0)
|
|
38
|
+
return;
|
|
39
|
+
const { _before: e, _current: u, _after: p } = d(n, l);
|
|
40
|
+
f({
|
|
41
|
+
past: [...o, i, ...e],
|
|
42
|
+
present: u,
|
|
43
|
+
future: p
|
|
44
|
+
});
|
|
45
|
+
}, N = (n = -1) => {
|
|
46
|
+
if (o.length === 0)
|
|
47
|
+
return;
|
|
48
|
+
const { _before: e, _current: u, _after: p } = d(n, o);
|
|
49
|
+
f({
|
|
50
|
+
past: e,
|
|
51
|
+
present: u,
|
|
52
|
+
future: [...p, i, ...l]
|
|
53
|
+
});
|
|
54
|
+
}, a = (n) => {
|
|
55
|
+
const e = m(n) ? n : Number(n);
|
|
56
|
+
if (e !== 0) {
|
|
57
|
+
if (e > 0)
|
|
58
|
+
return g(e);
|
|
59
|
+
N(e);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return {
|
|
63
|
+
value: i,
|
|
64
|
+
backLength: o.length,
|
|
65
|
+
forwardLength: l.length,
|
|
66
|
+
setValue: c(b),
|
|
67
|
+
go: c(a),
|
|
68
|
+
back: c(() => {
|
|
69
|
+
a(-1);
|
|
70
|
+
}),
|
|
71
|
+
forward: c(() => {
|
|
72
|
+
a(1);
|
|
73
|
+
}),
|
|
74
|
+
reset: c(h)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
V as default
|
|
79
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import m from "../use-boolean/index.js";
|
|
3
|
+
import s from "../use-event-listener/index.js";
|
|
4
|
+
const c = (e, t) => {
|
|
5
|
+
const { onEnter: n, onLeave: r, onChange: o } = t || {}, [a, { setTrue: u, setFalse: l }] = m(!1);
|
|
6
|
+
return s(
|
|
7
|
+
"mouseenter",
|
|
8
|
+
() => {
|
|
9
|
+
n?.(), u(), o?.(!0);
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
target: e
|
|
13
|
+
}
|
|
14
|
+
), s(
|
|
15
|
+
"mouseleave",
|
|
16
|
+
() => {
|
|
17
|
+
r?.(), l(), o?.(!1);
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
target: e
|
|
21
|
+
}
|
|
22
|
+
), a;
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
c as default
|
|
26
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useState as I, useCallback as w, useEffect as m } from "react";
|
|
3
|
+
import p, { supportIntersectionObserver as O } from "../use-intersection-observer/index.js";
|
|
4
|
+
function k(u) {
|
|
5
|
+
const {
|
|
6
|
+
defaultInView: t,
|
|
7
|
+
unobserverOnEnter: r = !0,
|
|
8
|
+
onChange: o,
|
|
9
|
+
target: s,
|
|
10
|
+
...a
|
|
11
|
+
} = u, [f, l] = I(
|
|
12
|
+
O ? t : !0
|
|
13
|
+
), b = w(
|
|
14
|
+
([e], c) => {
|
|
15
|
+
const n = c.thresholds.some(
|
|
16
|
+
(v) => e.intersectionRatio >= v
|
|
17
|
+
) && e.isIntersecting;
|
|
18
|
+
l(n), o?.(n, e), n && r && c.unobserve(e.target);
|
|
19
|
+
},
|
|
20
|
+
[o, r]
|
|
21
|
+
), { cor: d, dor: i, observer: h } = p(
|
|
22
|
+
b,
|
|
23
|
+
a
|
|
24
|
+
);
|
|
25
|
+
return m(() => (t && r ? i() : s && d(s), i), [s, t, r]), {
|
|
26
|
+
inView: f,
|
|
27
|
+
observer: h
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
k as default
|
|
32
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useState as c } from "react";
|
|
3
|
+
import "../../utils/is.js";
|
|
4
|
+
import { getTargetElement as a } from "../utils/domTarget.js";
|
|
5
|
+
import g from "../utils/useEffectWithTarget.js";
|
|
6
|
+
import { isArray as h } from "@unicom-cloud/utils/is";
|
|
7
|
+
function y(e, r) {
|
|
8
|
+
const { callback: n, ...f } = r || {}, [m, l] = c(), [u, p] = c();
|
|
9
|
+
return g(
|
|
10
|
+
() => {
|
|
11
|
+
const s = (h(e) ? e : [e]).map((t) => a(t)).filter(Boolean);
|
|
12
|
+
if (!s.length)
|
|
13
|
+
return;
|
|
14
|
+
const i = new IntersectionObserver(
|
|
15
|
+
(t) => {
|
|
16
|
+
for (const o of t)
|
|
17
|
+
p(o.intersectionRatio), l(o.isIntersecting), n?.(o);
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
...f,
|
|
21
|
+
root: a(r?.root)
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
return s.forEach((t) => i.observe(t)), () => {
|
|
25
|
+
i.disconnect();
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
[r?.rootMargin, r?.threshold, n],
|
|
29
|
+
e
|
|
30
|
+
), [m, u];
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
y as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useState as S, useRef as T, useMemo as _ } from "react";
|
|
3
|
+
import k from "../use-event-listener/index.js";
|
|
4
|
+
import s from "../use-memoized-fn/index.js";
|
|
5
|
+
import G from "../use-request/src/useRequest.js";
|
|
6
|
+
import "lodash/castArray";
|
|
7
|
+
import J from "../use-update-effect/index.js";
|
|
8
|
+
import { getTargetElement as A } from "../utils/domTarget.js";
|
|
9
|
+
import { getScrollTop as K, getScrollHeight as F, getClientHeight as O } from "../utils/rect.js";
|
|
10
|
+
const et = (H, v = {}) => {
|
|
11
|
+
const {
|
|
12
|
+
target: c,
|
|
13
|
+
isNoMore: g,
|
|
14
|
+
threshold: p = 100,
|
|
15
|
+
direction: B = "bottom",
|
|
16
|
+
reloadDeps: w = [],
|
|
17
|
+
manual: C,
|
|
18
|
+
onBefore: L,
|
|
19
|
+
onSuccess: R,
|
|
20
|
+
onError: b,
|
|
21
|
+
onFinally: j
|
|
22
|
+
} = v, [o, l] = S(), [a, n] = S(!1), i = B === "top", u = T(void 0), D = T(0), m = _(() => g ? g(o) : !1, [o]), { loading: y, error: q, run: f, runAsync: x, cancel: z } = G(
|
|
23
|
+
async (t) => ({ currentData: await H(t), lastData: t }),
|
|
24
|
+
{
|
|
25
|
+
manual: C,
|
|
26
|
+
onFinally: (t, e, r) => {
|
|
27
|
+
n(!1), j?.(e?.currentData, r);
|
|
28
|
+
},
|
|
29
|
+
onBefore: () => L?.(),
|
|
30
|
+
onSuccess: (t) => {
|
|
31
|
+
t.lastData ? l({
|
|
32
|
+
...t.currentData,
|
|
33
|
+
list: i ? [...t.currentData.list, ...t.lastData.list ?? []] : [...t.lastData.list ?? [], ...t.currentData.list]
|
|
34
|
+
}) : l({
|
|
35
|
+
...t.currentData,
|
|
36
|
+
list: [...t.currentData.list ?? []]
|
|
37
|
+
}), setTimeout(() => {
|
|
38
|
+
if (i) {
|
|
39
|
+
let e = A(c);
|
|
40
|
+
if (e = e === document ? document.documentElement : e, e) {
|
|
41
|
+
const r = F(e);
|
|
42
|
+
e.scrollTo(0, r - D.current);
|
|
43
|
+
}
|
|
44
|
+
} else
|
|
45
|
+
h();
|
|
46
|
+
}), R?.(t.currentData);
|
|
47
|
+
},
|
|
48
|
+
onError: (t) => b?.(t)
|
|
49
|
+
}
|
|
50
|
+
), d = s(() => {
|
|
51
|
+
m || (n(!0), f(o));
|
|
52
|
+
}), M = async (t) => (await x(t)).currentData, I = s(() => m ? Promise.reject() : (n(!0), M(o))), N = () => (n(!1), f()), P = () => (n(!1), M()), h = () => {
|
|
53
|
+
const t = A(c);
|
|
54
|
+
if (!t)
|
|
55
|
+
return;
|
|
56
|
+
const e = t === document ? document.documentElement : t, r = K(e), E = F(e), U = O(e);
|
|
57
|
+
i ? (u.current !== void 0 && u.current > r && r <= p && d(), u.current = r, D.current = E - r) : E - r <= U + p && d();
|
|
58
|
+
};
|
|
59
|
+
return k(
|
|
60
|
+
"scroll",
|
|
61
|
+
() => {
|
|
62
|
+
y || a || h();
|
|
63
|
+
},
|
|
64
|
+
{ target: c }
|
|
65
|
+
), J(() => {
|
|
66
|
+
f();
|
|
67
|
+
}, [...w]), {
|
|
68
|
+
data: o,
|
|
69
|
+
loading: !a && y,
|
|
70
|
+
error: q,
|
|
71
|
+
loadingMore: a,
|
|
72
|
+
noMore: m,
|
|
73
|
+
loadMore: d,
|
|
74
|
+
loadMoreAsync: I,
|
|
75
|
+
reload: s(N),
|
|
76
|
+
reloadAsync: s(P),
|
|
77
|
+
mutate: l,
|
|
78
|
+
cancel: z
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
et as default
|
|
83
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useRef as i } from "react";
|
|
3
|
+
import "@unicom-cloud/utils/dom-helpers/reflow";
|
|
4
|
+
import { isServerRendering as c } from "../../utils/is.js";
|
|
5
|
+
import { isUndefined as u } from "@unicom-cloud/utils/is";
|
|
6
|
+
const v = !c && !u(window?.IntersectionObserver);
|
|
7
|
+
function O(t, o = {}) {
|
|
8
|
+
const r = i(void 0), e = () => {
|
|
9
|
+
r.current && (r.current.disconnect(), r.current = null);
|
|
10
|
+
}, s = (n) => {
|
|
11
|
+
n && (e(), v && (r.current = new IntersectionObserver(
|
|
12
|
+
t,
|
|
13
|
+
o
|
|
14
|
+
), r.current.observe(n)));
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
observer: r.current,
|
|
18
|
+
cor: s,
|
|
19
|
+
dor: e
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
O as default,
|
|
24
|
+
v as supportIntersectionObserver
|
|
25
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { useRef as u, useCallback as c, useEffect as f } from "react";
|
|
3
|
+
import "../../utils/is.js";
|
|
4
|
+
import o from "../use-memoized-fn/index.js";
|
|
5
|
+
import { isNumber as s } from "@unicom-cloud/utils/is";
|
|
6
|
+
const v = (n, e, t = {}) => {
|
|
7
|
+
const m = o(n), r = u(null), i = c(() => {
|
|
8
|
+
r.current && clearInterval(r.current);
|
|
9
|
+
}, []);
|
|
10
|
+
return f(() => {
|
|
11
|
+
if (!(!s(e) || e < 0))
|
|
12
|
+
return t.immediate && m(), r.current = setInterval(m, e), i;
|
|
13
|
+
}, [e, t.immediate]), i;
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
v as default
|
|
17
|
+
};
|