@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,6 @@
|
|
|
1
|
+
declare function pick<T extends object, K extends keyof T>(o: T, keys: Array<K | string>): Pick<T, K>;
|
|
2
|
+
declare function pickDataAttributes<T extends object, K extends keyof T>(o: T | undefined): {
|
|
3
|
+
[key in K]: unknown;
|
|
4
|
+
};
|
|
5
|
+
export { pick, pickDataAttributes };
|
|
6
|
+
export default pick;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, default as pinyin } from '@unicom-cloud/utils/pinyin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReactElement, ReactInstance, RefObject } from 'react';
|
|
2
|
+
type CreateRootFnType = (container: Element | DocumentFragment) => {
|
|
3
|
+
render: (element: ReactElement) => void;
|
|
4
|
+
unmount: () => void;
|
|
5
|
+
};
|
|
6
|
+
type RenderResult = {
|
|
7
|
+
render: (element: ReactElement) => void;
|
|
8
|
+
_unmount: () => void;
|
|
9
|
+
};
|
|
10
|
+
type ElementLike = {
|
|
11
|
+
dom?: Element;
|
|
12
|
+
current?: Element;
|
|
13
|
+
props?: {
|
|
14
|
+
ref?: RefObject<Element> | ((instance: Element | null) => void);
|
|
15
|
+
};
|
|
16
|
+
ref?: RefObject<Element> | ((instance: Element | null) => void);
|
|
17
|
+
getRootDOMNode?: () => Element | null;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param element
|
|
22
|
+
* @param instance 兜底 findDOMNode 查找,一般都是 this
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
export declare function findDOMNode(element: ElementLike, instance?: ReactInstance): Element | null;
|
|
26
|
+
export declare function callbackOriginRef(children: {
|
|
27
|
+
ref?: RefObject<Element> | ((instance: Element | null) => void);
|
|
28
|
+
props?: {
|
|
29
|
+
ref?: RefObject<Element> | ((instance: Element | null) => void);
|
|
30
|
+
};
|
|
31
|
+
} | null, node: Element | null): void;
|
|
32
|
+
export declare function setCreateRoot(v: CreateRootFnType): void;
|
|
33
|
+
export declare function render(node: ReactElement, el: Element | DocumentFragment): RenderResult;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, default as saveAs } from '@unicom-cloud/utils/file/saveAs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, default as screenfull } from '@unicom-cloud/utils/screenfull';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CustomBehaviorOptions, Options, StandardBehaviorOptions } from './compute';
|
|
2
|
+
import compute, { alignNearest, canOverflow, getFrameElement, getParentElement, getScrollMargins, isHiddenByFrame, isScrollable } from './compute';
|
|
3
|
+
declare const isStandardScrollBehavior: (options: unknown) => options is StandardBehaviorOptions;
|
|
4
|
+
declare const isCustomScrollBehavior: <T = unknown>(options: unknown) => options is CustomBehaviorOptions<T>;
|
|
5
|
+
declare const getOptions: (options: unknown) => StandardBehaviorOptions;
|
|
6
|
+
declare const isInDocument: (element: Node) => boolean;
|
|
7
|
+
declare function scrollIntoView<T = unknown>(target: Element, options?: StandardBehaviorOptions | CustomBehaviorOptions<T> | boolean): T | void;
|
|
8
|
+
declare function scrollIntoViewNative(target: Element, options?: boolean | ScrollIntoViewOptions): void;
|
|
9
|
+
declare function scrollIntoViewIfNeeded(node: HTMLElement, options?: Options): void;
|
|
10
|
+
export { alignNearest, canOverflow, compute, getFrameElement, getOptions, getParentElement, getScrollMargins, isCustomScrollBehavior, isHiddenByFrame, isInDocument, isScrollable, isStandardScrollBehavior, scrollIntoView, scrollIntoViewIfNeeded, scrollIntoViewNative, };
|
|
11
|
+
export default scrollIntoViewIfNeeded;
|
|
12
|
+
export type * from './compute';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ToArrayOptions {
|
|
3
|
+
keepEmpty?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* 将React子节点转换为数组
|
|
7
|
+
* @param children React子节点
|
|
8
|
+
* @param options 配置选项
|
|
9
|
+
* @returns React元素数组
|
|
10
|
+
*/
|
|
11
|
+
declare function toArray(children: React.ReactNode, options?: ToArrayOptions): React.ReactElement[];
|
|
12
|
+
export { toArray };
|
|
13
|
+
export default toArray;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, findNodeBy, getChildWithParentBy, getItemBy, getItemBy2, getItemBy3, getItemByID, getLabelFromDictionaryByValue, searchTree, default as tree, } from '@unicom-cloud/utils/tree';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, easing, default as Tween } from '@unicom-cloud/utils/tween';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { v4 as uuid, v4 as uuidv4 } from 'uuid';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ArrayValidator, BooleanValidator, CustomValidator, defaultValidateLocale, DefaultValidateMessage, enUSValidateLocale, mergeTemplate, NumberValidator, ObjectValidator, Schema, StringValidator, TypeValidator, default as validate, zhCNValidateLocale, } from '@unicom-cloud/utils/validate';
|
package/utils/compute.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import "./is.js";
|
|
3
|
+
import { isFunction as z, isElement as _ } from "@unicom-cloud/utils/is";
|
|
4
|
+
const Y = (t, e) => !(e && t === "hidden" || t === "visible" || t === "clip"), E = (t) => {
|
|
5
|
+
if (!t.ownerDocument || !t.ownerDocument.defaultView)
|
|
6
|
+
return null;
|
|
7
|
+
try {
|
|
8
|
+
return t.ownerDocument.defaultView.frameElement;
|
|
9
|
+
} catch {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
}, $ = (t) => {
|
|
13
|
+
const e = E(t);
|
|
14
|
+
return e ? e.clientHeight < t.scrollHeight || e.clientWidth < t.scrollWidth : !1;
|
|
15
|
+
}, k = (t, e) => {
|
|
16
|
+
if (t.clientHeight < t.scrollHeight) {
|
|
17
|
+
const i = getComputedStyle(t);
|
|
18
|
+
if (Y(i.overflowY, e) || Y(i.overflowX, e) || $(t))
|
|
19
|
+
return !0;
|
|
20
|
+
}
|
|
21
|
+
if (t.clientWidth < t.scrollWidth) {
|
|
22
|
+
const i = getComputedStyle(t);
|
|
23
|
+
if (Y(i.overflowX, e) || Y(i.overflowY, e) || $(t))
|
|
24
|
+
return !0;
|
|
25
|
+
}
|
|
26
|
+
return !1;
|
|
27
|
+
}, D = (t, e, i, s, a, u, d, p) => u < t && d > e || u > t && d < e ? 0 : u <= t && p <= i || d >= e && p >= i ? u - t - s : d > e && p < i || u < t && p > i ? d - e + a : 0, tt = (t) => t.parentElement ? t.parentElement : t.getRootNode() instanceof ShadowRoot ? t.getRootNode().host : null, et = (t) => {
|
|
28
|
+
const e = window.getComputedStyle(t);
|
|
29
|
+
return {
|
|
30
|
+
top: parseFloat(e.scrollMarginTop) || 0,
|
|
31
|
+
right: parseFloat(e.scrollMarginRight) || 0,
|
|
32
|
+
bottom: parseFloat(e.scrollMarginBottom) || 0,
|
|
33
|
+
left: parseFloat(e.scrollMarginLeft) || 0
|
|
34
|
+
};
|
|
35
|
+
}, nt = (t, e) => {
|
|
36
|
+
if (typeof document > "u")
|
|
37
|
+
return [];
|
|
38
|
+
const {
|
|
39
|
+
scrollMode: i = "always",
|
|
40
|
+
block: s = "center",
|
|
41
|
+
inline: a = "nearest",
|
|
42
|
+
boundary: u = null,
|
|
43
|
+
skipOverflowHiddenElements: d = !1
|
|
44
|
+
} = e, p = z(u) ? u : (r) => r !== u;
|
|
45
|
+
if (!_(t))
|
|
46
|
+
throw new TypeError("Invalid target");
|
|
47
|
+
const N = document.scrollingElement || document.documentElement, P = [];
|
|
48
|
+
let f = t;
|
|
49
|
+
for (; _(f) && p(f); ) {
|
|
50
|
+
if (f = tt(f), f === N) {
|
|
51
|
+
P.push(f);
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
f === document.body && k(f) && !k(document.documentElement) || f && k(f, d) && P.push(f);
|
|
55
|
+
}
|
|
56
|
+
const m = window.visualViewport?.width ?? innerWidth, g = window.visualViewport?.height ?? innerHeight, { scrollX: w, scrollY: b } = window, O = t.getBoundingClientRect(), {
|
|
57
|
+
height: W,
|
|
58
|
+
width: y,
|
|
59
|
+
top: H,
|
|
60
|
+
right: j,
|
|
61
|
+
bottom: q,
|
|
62
|
+
left: M
|
|
63
|
+
} = O, h = et(t);
|
|
64
|
+
let c = s === "start" || s === "nearest" ? H - h.top : s === "end" ? q + h.bottom : H + W / 2 - h.top + h.bottom, l = a === "center" ? M + y / 2 - h.left + h.right : a === "end" ? j + h.right : M - h.left;
|
|
65
|
+
const A = [];
|
|
66
|
+
for (const r of P) {
|
|
67
|
+
const S = r.getBoundingClientRect(), { height: R, width: B, top: v, right: G, bottom: J, left: F } = S;
|
|
68
|
+
if (i === "if-needed" && H >= 0 && M >= 0 && q <= g && j <= m && (r === N && !k(r) || H >= v && q <= J && M >= F && j <= G))
|
|
69
|
+
return A;
|
|
70
|
+
const C = getComputedStyle(r), I = parseInt(C.borderLeftWidth, 10) || 0, T = parseInt(C.borderTopWidth, 10) || 0, x = parseInt(C.borderRightWidth, 10) || 0, L = parseInt(C.borderBottomWidth, 10) || 0;
|
|
71
|
+
let o = 0, n = 0;
|
|
72
|
+
const V = "offsetWidth" in r ? r.offsetWidth - r.clientWidth - I - x : 0, X = "offsetHeight" in r ? r.offsetHeight - r.clientHeight - T - L : 0, K = "offsetWidth" in r && r.offsetWidth !== 0 ? B / r.offsetWidth : 1, Q = "offsetHeight" in r && r.offsetHeight !== 0 ? R / r.offsetHeight : 1;
|
|
73
|
+
if (N === r)
|
|
74
|
+
s === "start" ? o = c : s === "end" ? o = c - g : s === "nearest" ? o = D(
|
|
75
|
+
b,
|
|
76
|
+
b + g,
|
|
77
|
+
g,
|
|
78
|
+
T,
|
|
79
|
+
L,
|
|
80
|
+
b + c,
|
|
81
|
+
b + c + W,
|
|
82
|
+
W
|
|
83
|
+
) : o = c - g / 2, a === "start" ? n = l : a === "center" ? n = l - m / 2 : a === "end" ? n = l - m : n = D(
|
|
84
|
+
w,
|
|
85
|
+
w + m,
|
|
86
|
+
m,
|
|
87
|
+
I,
|
|
88
|
+
x,
|
|
89
|
+
w + l,
|
|
90
|
+
w + l + y,
|
|
91
|
+
y
|
|
92
|
+
), o = Math.max(0, o + b), n = Math.max(0, n + w);
|
|
93
|
+
else {
|
|
94
|
+
s === "start" ? o = c - v - T : s === "end" ? o = c - J + L + X : s === "nearest" ? o = D(
|
|
95
|
+
v,
|
|
96
|
+
J,
|
|
97
|
+
R,
|
|
98
|
+
T,
|
|
99
|
+
L + X,
|
|
100
|
+
c,
|
|
101
|
+
c + W,
|
|
102
|
+
W
|
|
103
|
+
) : o = c - (v + R / 2) + X / 2, a === "start" ? n = l - F - I : a === "center" ? n = l - (F + B / 2) + V / 2 : a === "end" ? n = l - G + x + V : n = D(
|
|
104
|
+
F,
|
|
105
|
+
G,
|
|
106
|
+
B,
|
|
107
|
+
I,
|
|
108
|
+
x + V,
|
|
109
|
+
l,
|
|
110
|
+
l + y,
|
|
111
|
+
y
|
|
112
|
+
);
|
|
113
|
+
const { scrollLeft: U, scrollTop: Z } = r;
|
|
114
|
+
o = Math.max(
|
|
115
|
+
0,
|
|
116
|
+
Math.min(
|
|
117
|
+
Z + o / Q,
|
|
118
|
+
r.scrollHeight - R / Q + X
|
|
119
|
+
)
|
|
120
|
+
), n = Math.max(
|
|
121
|
+
0,
|
|
122
|
+
Math.min(
|
|
123
|
+
U + n / K,
|
|
124
|
+
r.scrollWidth - B / K + V
|
|
125
|
+
)
|
|
126
|
+
), c += Z - o, l += U - n;
|
|
127
|
+
}
|
|
128
|
+
A.push({ el: r, top: o, left: n });
|
|
129
|
+
}
|
|
130
|
+
return A;
|
|
131
|
+
};
|
|
132
|
+
export {
|
|
133
|
+
D as alignNearest,
|
|
134
|
+
Y as canOverflow,
|
|
135
|
+
nt as compute,
|
|
136
|
+
nt as default,
|
|
137
|
+
E as getFrameElement,
|
|
138
|
+
tt as getParentElement,
|
|
139
|
+
et as getScrollMargins,
|
|
140
|
+
$ as isHiddenByFrame,
|
|
141
|
+
k as isScrollable
|
|
142
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { UI_PC_KEY as e, UI_PC_THEME_DARK_CLASS_NAME as n } from "@unicom-cloud/utils/constant/ui";
|
|
3
|
+
const E = window.document.documentElement, _ = () => {
|
|
4
|
+
};
|
|
5
|
+
export {
|
|
6
|
+
E as CSS_VARIABLE_ELEMENT,
|
|
7
|
+
_ as NOOP,
|
|
8
|
+
e as UI_PC_KEY,
|
|
9
|
+
n as UI_PC_THEME_DARK_CLASS_NAME
|
|
10
|
+
};
|
package/utils/copy.js
ADDED
package/utils/date.js
ADDED
package/utils/dayjs.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import e from "dayjs";
|
|
3
|
+
import { default as y, default as F } from "dayjs";
|
|
4
|
+
import r from "dayjs/plugin/advancedFormat";
|
|
5
|
+
import t from "dayjs/plugin/customParseFormat";
|
|
6
|
+
import o from "dayjs/plugin/isBetween";
|
|
7
|
+
import m from "dayjs/plugin/quarterOfYear";
|
|
8
|
+
import d from "dayjs/plugin/timezone";
|
|
9
|
+
import f from "dayjs/plugin/utc";
|
|
10
|
+
import a from "dayjs/plugin/weekOfYear";
|
|
11
|
+
import i from "dayjs/plugin/weekYear";
|
|
12
|
+
e.extend(t);
|
|
13
|
+
e.extend(o);
|
|
14
|
+
e.extend(a);
|
|
15
|
+
e.extend(r);
|
|
16
|
+
e.extend(i);
|
|
17
|
+
e.extend(m);
|
|
18
|
+
e.extend(f);
|
|
19
|
+
e.extend(d);
|
|
20
|
+
export {
|
|
21
|
+
y as dayjs,
|
|
22
|
+
F as default
|
|
23
|
+
};
|
package/utils/dom.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import { default as h, default as g } from "@unicom-cloud/utils/dom-helpers/reflow";
|
|
3
|
+
import { isServerRendering as o } from "./is.js";
|
|
4
|
+
import { isEventTarget as i } from "@unicom-cloud/utils/is";
|
|
5
|
+
function u(e, n, t, r) {
|
|
6
|
+
o || i(e) && e.addEventListener(n, t, r || !1);
|
|
7
|
+
}
|
|
8
|
+
function c(e, n, t, r) {
|
|
9
|
+
o || i(e) && e.removeEventListener(n, t, r || !1);
|
|
10
|
+
}
|
|
11
|
+
function a(e, n) {
|
|
12
|
+
if (!e) return !1;
|
|
13
|
+
if (e.contains)
|
|
14
|
+
return e.contains(n);
|
|
15
|
+
let t = n;
|
|
16
|
+
for (; t; ) {
|
|
17
|
+
if (t === e)
|
|
18
|
+
return !0;
|
|
19
|
+
t = t.parentNode;
|
|
20
|
+
}
|
|
21
|
+
return !1;
|
|
22
|
+
}
|
|
23
|
+
function f(e) {
|
|
24
|
+
if (!(e instanceof HTMLElement) || [document.documentElement].includes(e))
|
|
25
|
+
return !1;
|
|
26
|
+
const n = window.getComputedStyle(e), t = ["auto", "scroll", "overlay"];
|
|
27
|
+
return e.scrollHeight > e.offsetHeight && t.includes(n.overflowY) || e.scrollWidth > e.offsetWidth && t.includes(n.overflowX);
|
|
28
|
+
}
|
|
29
|
+
function d(e, n = document.documentElement) {
|
|
30
|
+
const t = [];
|
|
31
|
+
let r = e;
|
|
32
|
+
for (; r && r !== n; )
|
|
33
|
+
f(r) && t.push(r), r = r.parentElement;
|
|
34
|
+
return t;
|
|
35
|
+
}
|
|
36
|
+
function w(e, n) {
|
|
37
|
+
if (!e || !n)
|
|
38
|
+
return !1;
|
|
39
|
+
if (e.contains)
|
|
40
|
+
return e.contains(n);
|
|
41
|
+
let t = n;
|
|
42
|
+
for (; t; ) {
|
|
43
|
+
if (e === t)
|
|
44
|
+
return !0;
|
|
45
|
+
t = t.parentNode;
|
|
46
|
+
}
|
|
47
|
+
return !1;
|
|
48
|
+
}
|
|
49
|
+
function m() {
|
|
50
|
+
return window.document.body;
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
a as contains,
|
|
54
|
+
h as forceReflow,
|
|
55
|
+
m as getBodyContainer,
|
|
56
|
+
d as getScrollElements,
|
|
57
|
+
f as isScrollElement,
|
|
58
|
+
o as isServerRendering,
|
|
59
|
+
c as off,
|
|
60
|
+
u as on,
|
|
61
|
+
w as parentContainsChildren,
|
|
62
|
+
g as reflow
|
|
63
|
+
};
|
package/utils/emitter.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
function i(o, l = !1) {
|
|
3
|
+
if (!o) return document.documentElement;
|
|
4
|
+
const n = getComputedStyle(o), r = n.position === "absolute", c = l ? /(auto|scroll|hidden)/ : /(auto|scroll)/;
|
|
5
|
+
if (n.position === "fixed")
|
|
6
|
+
return document.documentElement;
|
|
7
|
+
for (let t = o; t = t.parentElement; ) {
|
|
8
|
+
const e = getComputedStyle(t);
|
|
9
|
+
if (!(r && e.position === "static") && (c.test(
|
|
10
|
+
e.overflow + e.overflowY + e.overflowX
|
|
11
|
+
) || t.scrollHeight > t.clientHeight))
|
|
12
|
+
return t;
|
|
13
|
+
}
|
|
14
|
+
return document.documentElement;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
i as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import l from "lodash/escapeRegExp";
|
|
3
|
+
import { cloneElement as m, createElement as n } from "react";
|
|
4
|
+
import "./is.js";
|
|
5
|
+
import { isArray as f, isString as a } from "@unicom-cloud/utils/is";
|
|
6
|
+
function E({
|
|
7
|
+
nodeList: e,
|
|
8
|
+
pattern: t,
|
|
9
|
+
highlightClassName: p
|
|
10
|
+
}) {
|
|
11
|
+
if (!t)
|
|
12
|
+
return e;
|
|
13
|
+
const i = (r) => r && r.props && a(r.props.children) ? m(
|
|
14
|
+
r,
|
|
15
|
+
void 0,
|
|
16
|
+
n(u, {
|
|
17
|
+
text: r.props.children,
|
|
18
|
+
keyword: t,
|
|
19
|
+
highlightClassName: p
|
|
20
|
+
})
|
|
21
|
+
) : r;
|
|
22
|
+
return f(e) ? e.map((r) => i(r)) : i(e);
|
|
23
|
+
}
|
|
24
|
+
function u({
|
|
25
|
+
text: e,
|
|
26
|
+
keyword: t,
|
|
27
|
+
highlightClassName: p
|
|
28
|
+
}) {
|
|
29
|
+
if (!t)
|
|
30
|
+
return e;
|
|
31
|
+
t.length > 1e3 && (t = t.slice(0, 1e3));
|
|
32
|
+
const i = new RegExp(`(${l(t)})`, "i");
|
|
33
|
+
return e.split(i).map((s, c) => n(
|
|
34
|
+
"span",
|
|
35
|
+
{
|
|
36
|
+
key: c,
|
|
37
|
+
className: i.test(s) ? p : ""
|
|
38
|
+
},
|
|
39
|
+
s
|
|
40
|
+
));
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
E as default,
|
|
44
|
+
E as getHighlightText
|
|
45
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* 2025-11-14 09:11:19 */
|
|
2
|
+
import "./is.js";
|
|
3
|
+
import { isNumber as o, isString as s } from "@unicom-cloud/utils/is";
|
|
4
|
+
const e = (a) => JSON.stringify({
|
|
5
|
+
code: a.code,
|
|
6
|
+
ctrl: !!a.ctrl,
|
|
7
|
+
shift: !!a.shift,
|
|
8
|
+
alt: !!a.alt,
|
|
9
|
+
meta: !!a.meta
|
|
10
|
+
});
|
|
11
|
+
function n(a) {
|
|
12
|
+
const c = {};
|
|
13
|
+
return a.forEach((t, r) => {
|
|
14
|
+
r = o(r) || s(r) ? { code: r } : r, c[e(r)] = t;
|
|
15
|
+
}), (t) => {
|
|
16
|
+
const r = e({
|
|
17
|
+
code: t.code,
|
|
18
|
+
ctrl: !!t.ctrlKey,
|
|
19
|
+
shift: !!t.shiftKey,
|
|
20
|
+
alt: !!t.altKey,
|
|
21
|
+
meta: !!t.metaKey
|
|
22
|
+
}), i = c[r];
|
|
23
|
+
i && (t.stopPropagation(), i(t) === !1 && t.preventDefault());
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
n as default,
|
|
28
|
+
n as getHotkeyHandler
|
|
29
|
+
};
|