@unicom-cloud/ui-common 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Development.js +1 -1
- package/Empty.js +1 -1
- package/Flex.js +1 -1
- package/Motion.js +1 -1
- package/Progress.js +1 -1
- package/ResizeObserver.js +1 -1
- package/Space.js +1 -1
- package/SuspenseFallbackTest.js +1 -1
- package/Timer.js +1 -1
- package/TransitionGroup.js +1 -1
- package/development/index.js +1 -1
- package/empty/index.js +1 -1
- package/flex/index.js +1 -1
- package/flex/utils.js +1 -1
- package/higher-order/index.js +1 -1
- package/higher-order/with-speech-synthesis/index.js +1 -1
- package/higher-order/withSpeechSynthesis.js +1 -1
- package/hooks/create-deep-compare-effect/index.js +1 -1
- package/hooks/create-update-effect/index.js +1 -1
- package/hooks/create-use-storage-state/index.js +1 -1
- package/hooks/createDeepCompareEffect.js +1 -1
- package/hooks/createUpdateEffect.js +1 -1
- package/hooks/createUseStorageState.js +1 -1
- package/hooks/index.js +1 -1
- package/hooks/use-async-effect/index.js +1 -1
- package/hooks/use-boolean/index.js +1 -1
- package/hooks/use-click-away/index.js +1 -1
- package/hooks/use-computed-state/index.js +1 -1
- package/hooks/use-controllable-value/index.js +1 -1
- package/hooks/use-cookie-state/index.js +1 -1
- package/hooks/use-count-down/index.js +1 -1
- package/hooks/use-counter/index.js +1 -1
- package/hooks/use-create/index.js +1 -1
- package/hooks/use-creation/index.js +1 -1
- package/hooks/use-debounce/index.js +1 -1
- package/hooks/use-debounce-effect/index.js +1 -1
- package/hooks/use-debounce-fn/index.js +1 -1
- package/hooks/use-deep-compare-effect/index.js +1 -1
- package/hooks/use-deep-compare-layout-effect/index.js +1 -1
- package/hooks/use-document-visibility/index.js +1 -1
- package/hooks/use-drag/index.js +1 -1
- package/hooks/use-drop/index.js +1 -1
- package/hooks/use-event/index.js +1 -1
- package/hooks/use-event-listener/index.js +1 -1
- package/hooks/use-event-target/index.js +1 -1
- package/hooks/use-external/index.js +1 -1
- package/hooks/use-favicon/index.js +1 -1
- package/hooks/use-focus-within/index.js +1 -1
- package/hooks/use-force-update/index.js +1 -1
- package/hooks/use-fullscreen/index.js +1 -1
- package/hooks/use-get-state/index.js +1 -1
- package/hooks/use-history-travel/index.js +1 -1
- package/hooks/use-hover/index.js +1 -1
- package/hooks/use-id/index.js +1 -1
- package/hooks/use-in-view/index.js +1 -1
- package/hooks/use-in-viewport/index.js +1 -1
- package/hooks/use-infinite-scroll/index.js +1 -1
- package/hooks/use-intersection-observer/index.js +1 -1
- package/hooks/use-intersection-observers/index.js +1 -1
- package/hooks/use-interval/index.js +1 -1
- package/hooks/use-is-first-render/index.js +1 -1
- package/hooks/use-isomorphic-layout-effect/index.js +1 -1
- package/hooks/use-key-press/index.js +1 -1
- package/hooks/use-keyboard-event/index.js +1 -1
- package/hooks/use-latest/index.js +1 -1
- package/hooks/use-listen-window-resize/index.js +1 -1
- package/hooks/use-local-storage-state/index.js +1 -1
- package/hooks/use-lock-fn/index.js +1 -1
- package/hooks/use-long-press/index.js +1 -1
- package/hooks/use-map/index.js +1 -1
- package/hooks/use-media/index.js +1 -1
- package/hooks/use-memo/index.js +1 -1
- package/hooks/use-memoized-fn/index.js +4 -4
- package/hooks/use-merge-props/index.js +1 -1
- package/hooks/use-merge-value/index.js +1 -1
- package/hooks/use-mobile/index.js +1 -1
- package/hooks/use-mount/index.js +1 -1
- package/hooks/use-mouse/index.js +1 -1
- package/hooks/use-move/index.js +1 -1
- package/hooks/use-mutation-observer/index.js +1 -1
- package/hooks/use-mutation-observers/index.js +1 -1
- package/hooks/use-network/index.js +1 -1
- package/hooks/use-online-status/index.js +1 -1
- package/hooks/use-overflow-hidden/index.js +1 -1
- package/hooks/use-override-ref/index.js +1 -1
- package/hooks/use-pagination/index.js +1 -1
- package/hooks/use-paste-image/index.js +1 -1
- package/hooks/use-persist-callback/index.js +1 -1
- package/hooks/use-prefers-color-scheme-dark/index.js +1 -1
- package/hooks/use-previous/index.js +1 -1
- package/hooks/use-raf-interval/index.js +1 -1
- package/hooks/use-raf-state/index.js +1 -1
- package/hooks/use-raf-timeout/index.js +1 -1
- package/hooks/use-reactive/index.js +1 -1
- package/hooks/use-ref-latest/index.js +1 -1
- package/hooks/use-refs/index.js +1 -1
- package/hooks/use-request/index.js +1 -1
- package/hooks/use-request/src/Fetch.js +1 -1
- package/hooks/use-request/src/plugins/useAutoRunPlugin.js +1 -1
- package/hooks/use-request/src/plugins/useCachePlugin.js +1 -1
- package/hooks/use-request/src/plugins/useDebouncePlugin.js +1 -1
- package/hooks/use-request/src/plugins/useLoadingDelayPlugin.js +1 -1
- package/hooks/use-request/src/plugins/usePollingPlugin.js +1 -1
- package/hooks/use-request/src/plugins/useRefreshOnWindowFocusPlugin.js +1 -1
- package/hooks/use-request/src/plugins/useRetryPlugin.js +1 -1
- package/hooks/use-request/src/plugins/useThrottlePlugin.js +1 -1
- package/hooks/use-request/src/useRequest.js +1 -1
- package/hooks/use-request/src/useRequestImplement.js +1 -1
- package/hooks/use-request/src/utils/cache.js +1 -1
- package/hooks/use-request/src/utils/cachePromise.js +1 -1
- package/hooks/use-request/src/utils/cacheSubscribe.js +1 -1
- package/hooks/use-request/src/utils/isDocumentVisible.js +1 -1
- package/hooks/use-request/src/utils/isOnline.js +1 -1
- package/hooks/use-request/src/utils/limit.js +1 -1
- package/hooks/use-request/src/utils/subscribeFocus.js +1 -1
- package/hooks/use-request/src/utils/subscribeReVisible.js +1 -1
- package/hooks/use-reset-state/index.js +1 -1
- package/hooks/use-resize-observer/index.js +1 -1
- package/hooks/use-resize-observers/index.js +1 -1
- package/hooks/use-responsive/index.js +1 -1
- package/hooks/use-safe-state/index.js +1 -1
- package/hooks/use-scroll/index.js +1 -1
- package/hooks/use-selections/index.js +1 -1
- package/hooks/use-session-storage-state/index.js +1 -1
- package/hooks/use-set/index.js +1 -1
- package/hooks/use-set-state/index.js +1 -1
- package/hooks/use-size/index.js +1 -1
- package/hooks/use-state-callback/index.js +1 -1
- package/hooks/use-state-with-promise/index.js +1 -1
- package/hooks/use-sync-state/index.js +1 -1
- package/hooks/use-text-selection/index.js +1 -1
- package/hooks/use-theme/index.js +1 -1
- package/hooks/use-throttle/index.js +1 -1
- package/hooks/use-throttle-effect/index.js +1 -1
- package/hooks/use-throttle-fn/index.js +1 -1
- package/hooks/use-timeout/index.js +1 -1
- package/hooks/use-title/index.js +1 -1
- package/hooks/use-toggle/index.js +1 -1
- package/hooks/use-tracked-effect/index.js +1 -1
- package/hooks/use-unmount/index.js +1 -1
- package/hooks/use-unmounted-ref/index.js +1 -1
- package/hooks/use-update/index.js +1 -1
- package/hooks/use-update-effect/index.js +1 -1
- package/hooks/use-update-layout-effect/index.js +1 -1
- package/hooks/use-url-state/index.js +1 -1
- package/hooks/use-virtual-list/index.js +1 -1
- package/hooks/use-watch/index.js +1 -1
- package/hooks/use-web-socket/index.js +1 -1
- package/hooks/use-why-did-you-update/index.js +1 -1
- package/hooks/use-window-size/index.js +1 -1
- package/hooks/useAsyncEffect.js +1 -1
- package/hooks/useBoolean.js +1 -1
- package/hooks/useClickAway.js +1 -1
- package/hooks/useComputedState.js +1 -1
- package/hooks/useControllableValue.js +1 -1
- package/hooks/useCookieState.js +1 -1
- package/hooks/useCountDown.js +1 -1
- package/hooks/useCounter.js +1 -1
- package/hooks/useCreate.js +1 -1
- package/hooks/useCreation.js +1 -1
- package/hooks/useDebounce.js +1 -1
- package/hooks/useDebounceEffect.js +1 -1
- package/hooks/useDebounceFn.js +1 -1
- package/hooks/useDeepCompareEffect.js +1 -1
- package/hooks/useDeepCompareLayoutEffect.js +1 -1
- package/hooks/useDocumentVisibility.js +1 -1
- package/hooks/useDrag.js +1 -1
- package/hooks/useDrop.js +1 -1
- package/hooks/useEvent.js +1 -1
- package/hooks/useEventListener.js +1 -1
- package/hooks/useEventTarget.js +1 -1
- package/hooks/useExternal.js +1 -1
- package/hooks/useFavicon.js +1 -1
- package/hooks/useFocusWithin.js +1 -1
- package/hooks/useForceUpdate.js +1 -1
- package/hooks/useFullscreen.js +1 -1
- package/hooks/useGetState.js +1 -1
- package/hooks/useHistoryTravel.js +1 -1
- package/hooks/useHover.js +1 -1
- package/hooks/useId.js +1 -1
- package/hooks/useInView.js +1 -1
- package/hooks/useInViewport.js +1 -1
- package/hooks/useInfiniteScroll.js +1 -1
- package/hooks/useIntersectionObserver.js +1 -1
- package/hooks/useIntersectionObservers.js +1 -1
- package/hooks/useInterval.js +1 -1
- package/hooks/useIsFirstRender.js +1 -1
- package/hooks/useIsomorphicLayoutEffect.js +1 -1
- package/hooks/useKeyPress.js +1 -1
- package/hooks/useKeyboardEvent.js +1 -1
- package/hooks/useLatest.js +1 -1
- package/hooks/useListenWindowResize.js +1 -1
- package/hooks/useLocalStorageState.js +1 -1
- package/hooks/useLockFn.js +1 -1
- package/hooks/useLongPress.js +1 -1
- package/hooks/useMap.js +1 -1
- package/hooks/useMedia.js +1 -1
- package/hooks/useMemo.js +1 -1
- package/hooks/useMemoizedFn.js +1 -1
- package/hooks/useMergeProps.js +1 -1
- package/hooks/useMergeValue.js +1 -1
- package/hooks/useMobile.js +1 -1
- package/hooks/useMount.js +1 -1
- package/hooks/useMouse.js +1 -1
- package/hooks/useMove.js +1 -1
- package/hooks/useMutationObserver.js +1 -1
- package/hooks/useMutationObservers.js +1 -1
- package/hooks/useNetwork.js +1 -1
- package/hooks/useOnlineStatus.js +1 -1
- package/hooks/useOverflowHidden.js +1 -1
- package/hooks/useOverrideRef.js +1 -1
- package/hooks/usePagination.js +1 -1
- package/hooks/usePasteImage.js +1 -1
- package/hooks/usePersistCallback.js +1 -1
- package/hooks/usePrefersColorSchemeDark.js +1 -1
- package/hooks/usePrevious.js +1 -1
- package/hooks/useRafInterval.js +1 -1
- package/hooks/useRafState.js +1 -1
- package/hooks/useRafTimeout.js +1 -1
- package/hooks/useReactive.js +1 -1
- package/hooks/useRefLatest.js +1 -1
- package/hooks/useRefs.js +1 -1
- package/hooks/useRequest.js +1 -1
- package/hooks/useResetState.js +1 -1
- package/hooks/useResizeObserver.js +1 -1
- package/hooks/useResizeObservers.js +1 -1
- package/hooks/useResponsive.js +1 -1
- package/hooks/useSafeState.js +1 -1
- package/hooks/useScroll.js +1 -1
- package/hooks/useSelections.js +1 -1
- package/hooks/useSessionStorageState.js +1 -1
- package/hooks/useSet.js +1 -1
- package/hooks/useSetState.js +1 -1
- package/hooks/useSize.js +1 -1
- package/hooks/useStateCallback.js +1 -1
- package/hooks/useStateWithPromise.js +1 -1
- package/hooks/useSyncState.js +1 -1
- package/hooks/useTextSelection.js +1 -1
- package/hooks/useTheme.js +1 -1
- package/hooks/useThrottle.js +1 -1
- package/hooks/useThrottleEffect.js +1 -1
- package/hooks/useThrottleFn.js +1 -1
- package/hooks/useTimeout.js +1 -1
- package/hooks/useTitle.js +1 -1
- package/hooks/useToggle.js +1 -1
- package/hooks/useTrackedEffect.js +1 -1
- package/hooks/useUnmount.js +1 -1
- package/hooks/useUnmountedRef.js +1 -1
- package/hooks/useUpdate.js +1 -1
- package/hooks/useUpdateEffect.js +1 -1
- package/hooks/useUpdateLayoutEffect.js +1 -1
- package/hooks/useUrlState.js +1 -1
- package/hooks/useVirtualList.js +1 -1
- package/hooks/useWatch.js +1 -1
- package/hooks/useWebSocket.js +1 -1
- package/hooks/useWhyDidYouUpdate.js +1 -1
- package/hooks/useWindowSize.js +1 -1
- package/hooks/utils/createEffectWithTarget.js +1 -1
- package/hooks/utils/depsAreSame.js +1 -1
- package/hooks/utils/depsEqual.js +1 -1
- package/hooks/utils/domTarget.js +1 -1
- package/hooks/utils/getDocumentOrShadow.js +1 -1
- package/hooks/utils/index.js +1 -1
- package/hooks/utils/isAppleDevice.js +1 -1
- package/hooks/utils/isBrowser.js +1 -1
- package/hooks/utils/isDev.js +1 -1
- package/hooks/utils/rect.js +1 -1
- package/hooks/utils/useDeepCompareWithTarget.js +1 -1
- package/hooks/utils/useEffectWithTarget.js +1 -1
- package/hooks/utils/useIsomorphicLayoutEffectWithTarget.js +1 -1
- package/hooks/utils/useLayoutEffectWithTarget.js +1 -1
- package/hooks/utils.js +1 -1
- package/icons/file/index.js +1 -1
- package/icons/file.js +1 -1
- package/index.js +432 -446
- package/motion/CSSMotion.js +1 -1
- package/motion/CSSMotionList.js +1 -1
- package/motion/context.js +1 -1
- package/motion/hooks/useDomMotionEvents.js +1 -1
- package/motion/hooks/useNextFrame.js +1 -1
- package/motion/hooks/useStatus.js +1 -1
- package/motion/hooks/useStepQueue.js +1 -1
- package/motion/index.js +1 -1
- package/motion/interface.js +1 -1
- package/motion/util/diff.js +1 -1
- package/motion/util/motion.js +1 -1
- package/package.json +1 -1
- package/progress/index.js +1 -1
- package/resize-observer/Collection.js +1 -1
- package/resize-observer/SingleObserver.js +1 -1
- package/resize-observer/index.js +1 -1
- package/resize-observer/observerUtil.js +1 -1
- package/space/index.js +1 -1
- package/suspense-fallback-test/index.js +1 -1
- package/timer/index.js +1 -1
- package/transition-group/CSSTransition.js +1 -1
- package/transition-group/ChildMapping.js +1 -1
- package/transition-group/PqbCSSTransition.js +1 -1
- package/transition-group/ReplaceTransition.js +1 -1
- package/transition-group/SwitchTransition.js +1 -1
- package/transition-group/Transition.js +30 -34
- package/transition-group/TransitionGroup.js +1 -1
- package/transition-group/TransitionGroupContext.js +1 -1
- package/transition-group/index.js +1 -1
- package/types/hooks/use-cookie-state/index.d.ts +1 -1
- package/types/hooks/use-counter/index.d.ts +3 -3
- package/types/hooks/use-history-travel/index.d.ts +2 -2
- package/types/hooks/use-map/index.d.ts +4 -4
- package/types/hooks/use-memoized-fn/index.d.ts +1 -1
- package/types/hooks/use-selections/index.d.ts +3 -3
- package/types/hooks/use-set/index.d.ts +2 -2
- package/types/hooks/use-set-state/index.d.ts +2 -2
- package/types/hooks/use-theme/index.d.ts +1 -1
- package/types/hooks/use-url-state/index.d.ts +1 -2
- package/types/hooks/use-virtual-list/index.d.ts +1 -1
- package/types/motion/context.d.ts +1 -1
- package/types/resize-observer/Collection.d.ts +1 -1
- package/types/transition-group/CSSTransition.d.ts +1 -1
- package/types/transition-group/PqbCSSTransition.d.ts +1 -1
- package/types/transition-group/ReplaceTransition.d.ts +1 -1
- package/types/transition-group/SwitchTransition.d.ts +1 -1
- package/types/transition-group/Transition.d.ts +1 -1
- package/types/transition-group/TransitionGroup.d.ts +1 -1
- package/types/utils/className.d.ts +1 -1
- package/types/utils/scrollIntoViewIfNeeded.d.ts +2 -11
- package/utils/callOrReturn.js +1 -1
- package/utils/callbackOriginRef.js +1 -1
- package/utils/caseName.js +1 -1
- package/utils/className.js +4 -3
- package/utils/constant.js +1 -1
- package/utils/copy.js +1 -1
- package/utils/date.js +1 -1
- package/utils/dayjs.js +1 -1
- package/utils/dom.js +1 -1
- package/utils/emitter.js +1 -1
- package/utils/fileRead.js +1 -1
- package/utils/fileToDataURL.js +1 -1
- package/utils/fillNBSP.js +1 -1
- package/utils/findRootElement.js +1 -1
- package/utils/findScrollParent.js +1 -1
- package/utils/getHighlightText.js +1 -1
- package/utils/getHotkeyHandler.js +1 -1
- package/utils/getStringLength.js +1 -1
- package/utils/include.js +1 -1
- package/utils/index.js +338 -352
- package/utils/intersectionObserver.js +1 -1
- package/utils/is.js +1 -1
- package/utils/keyboardCode.js +1 -1
- package/utils/lodash.js +1 -1
- package/utils/math.js +1 -1
- package/utils/mergeProps.js +1 -1
- package/utils/mergedToString.js +1 -1
- package/utils/mutationObserver.js +1 -1
- package/utils/omit.js +1 -1
- package/utils/pad.js +1 -1
- package/utils/pick.js +1 -1
- package/utils/pinyin.js +1 -1
- package/utils/react19Adapter.js +1 -1
- package/utils/ref.js +1 -1
- package/utils/resizeObserver.js +1 -1
- package/utils/saveAs.js +1 -1
- package/utils/screenfull.js +1 -1
- package/utils/scrollIntoViewIfNeeded.js +5 -72
- package/utils/setCreateRoot.js +1 -1
- package/utils/setDarkTheme.js +1 -1
- package/utils/setDir.js +1 -1
- package/utils/setPrimaryColor.js +1 -1
- package/utils/setTheme.js +1 -1
- package/utils/string.js +1 -1
- package/utils/style.js +1 -1
- package/utils/throttleByRaf.js +1 -1
- package/utils/throttleByRaf2.js +1 -1
- package/utils/tinycolor.js +1 -1
- package/utils/toArray.js +1 -1
- package/utils/tree.js +1 -1
- package/utils/tween.js +1 -1
- package/utils/uuid.js +1 -1
- package/utils/validate.js +1 -1
- package/utils/warning.js +1 -1
- package/types/utils/compute.d.ts +0 -100
- package/utils/compute.js +0 -142
package/utils/is.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 2026-01-
|
|
1
|
+
/* 2026-01-27 10:43:58 */
|
|
2
2
|
import { isBrowser as o } from "@unicom-cloud/utils/constant/platform";
|
|
3
3
|
import { isNullOrUndefined as n, isString as a, isEmptyArray as c, isFunction as l } from "@unicom-cloud/utils/is";
|
|
4
4
|
import { is32Bit as B, isAllChinese as F, isArguments as w, isArray as L, isArrayBuffer as P, isArrayLike as H, isArrayLikeObject as U, isAscii as V, isAsyncFunction as j, isBase64 as x, isBigInt as D, isBlob as k, isBoolean as T, isBuffer as J, isChinese as q, isColorValue as X, isDataURI as Y, isDate as _, isElement as z, isEmail as G, isEmpty as K, isEmptyArray as Q, isEmptyObject as Z, isEmptyValue as $, isEqual as ii, isEqualWith as si, isError as ti, isEventTarget as ei, isExist as ri, isFile as oi, isFinite as ni, isFullWidth as ai, isFunction as ci, isHSL as li, isHalfWidth as ui, isHash as fi, isHexColor as di, isIMEI as mi, isIP as pi, isIPRange as yi, isIdentityCard as gi, isInteger as Ei, isJSON as hi, isJSON_String as Si, isJWT as Ri, isLength as Ai, isMACAddress as bi, isMD5 as Ci, isMap as Mi, isMatch as Ni, isMatchWith as Ii, isMimeType as Wi, isMobilePhone as vi, isMobilePhoneLocales as Oi, isNaN as Bi, isNative as Fi, isNil as wi, isNull as Li, isNullOrUndefined as Pi, isNumber as Hi, isObject as Ui, isObjectLike as Vi, isPlainObject as ji, isPort as xi, isPromise as Di, isReadableStream as ki, isRegExp as Ti, isRgbColor as Ji, isSafeInteger as qi, isSemVer as Xi, isSet as Yi, isSlug as _i, isString as zi, isStrongPassword as Gi, isSymbol as Ki, isTypedArray as Qi, isURL as Zi, isUUID as $i, isUndefined as is, isVariableWidth as ss, isWeakMap as ts, isWeakSet as es, isWindow as rs } from "@unicom-cloud/utils/is";
|
package/utils/keyboardCode.js
CHANGED
package/utils/lodash.js
CHANGED
package/utils/math.js
CHANGED
package/utils/mergeProps.js
CHANGED
package/utils/mergedToString.js
CHANGED
package/utils/omit.js
CHANGED
package/utils/pad.js
CHANGED
package/utils/pick.js
CHANGED
package/utils/pinyin.js
CHANGED
package/utils/react19Adapter.js
CHANGED
package/utils/ref.js
CHANGED
package/utils/resizeObserver.js
CHANGED
package/utils/saveAs.js
CHANGED
package/utils/screenfull.js
CHANGED
|
@@ -1,75 +1,8 @@
|
|
|
1
|
-
/* 2026-01-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import "./is.js";
|
|
5
|
-
import { isObjectLike as a, isFunction as i, isArray as s, isString as m, isBoolean as b } from "@unicom-cloud/utils/is";
|
|
6
|
-
const v = (e) => !!e && a(e) && !s(e) && Object.keys(e).length > 0 && ("behavior" in e ? m(e.behavior) : !0), g = (e) => !!e && a(e) && !s(e) && i(e.behavior), w = (e) => e === !1 ? { block: "end", inline: "nearest" } : v(e) ? e : { block: "start", inline: "nearest" }, y = (e) => {
|
|
7
|
-
let r = e;
|
|
8
|
-
for (; r; ) {
|
|
9
|
-
if (r === document)
|
|
10
|
-
return !0;
|
|
11
|
-
r = r.parentNode instanceof ShadowRoot ? r.parentNode.host : r.parentNode;
|
|
12
|
-
}
|
|
13
|
-
return !1;
|
|
14
|
-
};
|
|
15
|
-
function S(e, r) {
|
|
16
|
-
if (!e?.isConnected || !y(e))
|
|
17
|
-
return;
|
|
18
|
-
const t = d(e);
|
|
19
|
-
if (g(r))
|
|
20
|
-
try {
|
|
21
|
-
return r.behavior(c(e, r));
|
|
22
|
-
} catch (n) {
|
|
23
|
-
console.error("Custom scroll behavior failed:", n);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const l = b(r) ? void 0 : r?.behavior, o = w(r);
|
|
27
|
-
for (const { el: n, top: f, left: u } of c(e, o))
|
|
28
|
-
try {
|
|
29
|
-
n.scroll({
|
|
30
|
-
top: Math.max(0, f - t.top + t.bottom),
|
|
31
|
-
left: Math.max(0, u - t.left + t.right),
|
|
32
|
-
behavior: l
|
|
33
|
-
});
|
|
34
|
-
} catch (h) {
|
|
35
|
-
console.warn("Scroll failed on element:", n, h);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function B(e, r) {
|
|
39
|
-
e?.scrollIntoView && e.scrollIntoView(r);
|
|
40
|
-
}
|
|
41
|
-
function M(e, r) {
|
|
42
|
-
if (e) {
|
|
43
|
-
S(e, {
|
|
44
|
-
block: "start",
|
|
45
|
-
behavior: "auto",
|
|
46
|
-
scrollMode: "if-needed",
|
|
47
|
-
...r
|
|
48
|
-
});
|
|
49
|
-
const t = e.offsetHeight, { height: l } = e.getBoundingClientRect();
|
|
50
|
-
if (r && r.boundary && t !== l) {
|
|
51
|
-
const o = i(r.boundary) ? r.boundary(e) : r.boundary;
|
|
52
|
-
o.scrollTop = Math.round(
|
|
53
|
-
o.scrollTop * (t / l)
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
1
|
+
/* 2026-01-27 10:43:58 */
|
|
2
|
+
function l(e, o) {
|
|
3
|
+
e.scrollIntoView(o);
|
|
57
4
|
}
|
|
58
5
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
c as compute,
|
|
62
|
-
M as default,
|
|
63
|
-
F as getFrameElement,
|
|
64
|
-
w as getOptions,
|
|
65
|
-
H as getParentElement,
|
|
66
|
-
d as getScrollMargins,
|
|
67
|
-
g as isCustomScrollBehavior,
|
|
68
|
-
j as isHiddenByFrame,
|
|
69
|
-
y as isInDocument,
|
|
70
|
-
E as isScrollable,
|
|
71
|
-
v as isStandardScrollBehavior,
|
|
72
|
-
S as scrollIntoView,
|
|
73
|
-
M as scrollIntoViewIfNeeded,
|
|
74
|
-
B as scrollIntoViewNative
|
|
6
|
+
l as default,
|
|
7
|
+
l as scrollIntoViewIfNeeded
|
|
75
8
|
};
|
package/utils/setCreateRoot.js
CHANGED
package/utils/setDarkTheme.js
CHANGED
package/utils/setDir.js
CHANGED
package/utils/setPrimaryColor.js
CHANGED
package/utils/setTheme.js
CHANGED
package/utils/string.js
CHANGED
package/utils/style.js
CHANGED
package/utils/throttleByRaf.js
CHANGED
package/utils/throttleByRaf2.js
CHANGED
package/utils/tinycolor.js
CHANGED
package/utils/toArray.js
CHANGED
package/utils/tree.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 2026-01-
|
|
1
|
+
/* 2026-01-27 10:43:58 */
|
|
2
2
|
import { default as a, findNodeBy as r, getChildWithParentBy as y, getItemBy as d, getItemByID as i, getLabelFromDictionaryByValue as l, searchTree as o, default as B } from "@unicom-cloud/utils/tree";
|
|
3
3
|
export {
|
|
4
4
|
a as default,
|
package/utils/tween.js
CHANGED
package/utils/uuid.js
CHANGED
package/utils/validate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* 2026-01-
|
|
1
|
+
/* 2026-01-27 10:43:58 */
|
|
2
2
|
import { PqbValidator as r, Validator as t, ValidatorArray as l, ValidatorBase as i, ValidatorBoolean as d, ValidatorCustom as V, ValidatorNumber as e, ValidatorObject as m, ValidatorSchema as b, ValidatorString as c, ValidatorType as n, validatorLocale as p } from "@unicom-cloud/utils/validate";
|
|
3
3
|
export {
|
|
4
4
|
r as PqbValidator,
|
package/utils/warning.js
CHANGED
package/types/utils/compute.d.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
type ScrollBehavior = 'auto' | 'smooth';
|
|
2
|
-
type ScrollLogicalPosition = 'start' | 'center' | 'end' | 'nearest';
|
|
3
|
-
/**
|
|
4
|
-
* 滚动模式类型
|
|
5
|
-
* - 'always':总是执行滚动
|
|
6
|
-
* - 'if-needed':仅当元素不可见时滚动
|
|
7
|
-
*/
|
|
8
|
-
type ScrollMode = 'always' | 'if-needed';
|
|
9
|
-
type SkipOverflowHiddenElements = boolean;
|
|
10
|
-
type CustomScrollBoundaryCallback = (parent: Element) => boolean;
|
|
11
|
-
type CustomScrollBoundary = Element | CustomScrollBoundaryCallback | null;
|
|
12
|
-
type CustomScrollBehaviorCallback<T = unknown> = (actions: CustomScrollAction[]) => T;
|
|
13
|
-
type Options<T = unknown> = StandardBehaviorOptions | CustomBehaviorOptions<T>;
|
|
14
|
-
interface BaseOptions {
|
|
15
|
-
block?: ScrollLogicalPosition;
|
|
16
|
-
inline?: ScrollLogicalPosition;
|
|
17
|
-
scrollMode?: ScrollMode;
|
|
18
|
-
boundary?: CustomScrollBoundary;
|
|
19
|
-
skipOverflowHiddenElements?: SkipOverflowHiddenElements;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* 滚动动作描述
|
|
23
|
-
*/
|
|
24
|
-
interface ScrollAction {
|
|
25
|
-
el: Element;
|
|
26
|
-
top: number;
|
|
27
|
-
left: number;
|
|
28
|
-
}
|
|
29
|
-
interface CustomScrollAction {
|
|
30
|
-
el: Element;
|
|
31
|
-
top: number;
|
|
32
|
-
left: number;
|
|
33
|
-
}
|
|
34
|
-
interface StandardBehaviorOptions extends BaseOptions {
|
|
35
|
-
behavior?: ScrollBehavior;
|
|
36
|
-
}
|
|
37
|
-
interface CustomBehaviorOptions<T = unknown> extends BaseOptions {
|
|
38
|
-
behavior: CustomScrollBehaviorCallback<T>;
|
|
39
|
-
}
|
|
40
|
-
interface SmoothScrollExtensions {
|
|
41
|
-
duration?: number;
|
|
42
|
-
ease?: (t: number) => number;
|
|
43
|
-
onScrollChange?: (state: {
|
|
44
|
-
target: Element;
|
|
45
|
-
elapsed: number;
|
|
46
|
-
value: number;
|
|
47
|
-
left: number;
|
|
48
|
-
top: number;
|
|
49
|
-
}) => void;
|
|
50
|
-
}
|
|
51
|
-
interface SmoothBehaviorOptions extends StandardBehaviorOptions, SmoothScrollExtensions {
|
|
52
|
-
behavior?: 'smooth';
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* 检查overflow属性是否允许滚动
|
|
56
|
-
*/
|
|
57
|
-
declare const canOverflow: (overflow: string | null, skipOverflowHiddenElements?: boolean) => boolean;
|
|
58
|
-
/**
|
|
59
|
-
* 获取iframe元素(如果存在)
|
|
60
|
-
*/
|
|
61
|
-
declare const getFrameElement: (el: Element) => Element | null;
|
|
62
|
-
/**
|
|
63
|
-
* 检查元素是否被iframe裁剪
|
|
64
|
-
*/
|
|
65
|
-
declare const isHiddenByFrame: (el: Element) => boolean;
|
|
66
|
-
/**
|
|
67
|
-
* 检查元素是否可滚动
|
|
68
|
-
*/
|
|
69
|
-
declare const isScrollable: (el: Element, skipOverflowHiddenElements?: boolean) => boolean;
|
|
70
|
-
/**
|
|
71
|
-
* 计算"nearest"对齐方式的最佳滚动位置
|
|
72
|
-
*
|
|
73
|
-
* 图例说明:
|
|
74
|
-
* ┌────────┐ ┏ ━ ━ ━ ┓
|
|
75
|
-
* │ target │ frame
|
|
76
|
-
* └────────┘ ┗ ━ ━ ━ ┛
|
|
77
|
-
*/
|
|
78
|
-
declare const alignNearest: (scrollingEdgeStart: number, scrollingEdgeEnd: number, scrollingSize: number, scrollingBorderStart: number, scrollingBorderEnd: number, elementEdgeStart: number, elementEdgeEnd: number, elementSize: number) => number;
|
|
79
|
-
/**
|
|
80
|
-
* 获取元素的父元素(支持Shadow DOM)
|
|
81
|
-
*/
|
|
82
|
-
declare const getParentElement: (element: Node) => Element | null;
|
|
83
|
-
/**
|
|
84
|
-
* 获取元素的滚动边距
|
|
85
|
-
*/
|
|
86
|
-
declare const getScrollMargins: (target: Element) => {
|
|
87
|
-
top: number;
|
|
88
|
-
right: number;
|
|
89
|
-
bottom: number;
|
|
90
|
-
left: number;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* 计算需要执行的滚动动作
|
|
94
|
-
* @param target 目标元素
|
|
95
|
-
* @param options 滚动选项
|
|
96
|
-
*/
|
|
97
|
-
declare const compute: (target: Element, options: Options) => ScrollAction[];
|
|
98
|
-
export { alignNearest, canOverflow, compute, getFrameElement, getParentElement, getScrollMargins, isHiddenByFrame, isScrollable, };
|
|
99
|
-
export default compute;
|
|
100
|
-
export type { BaseOptions, CustomBehaviorOptions, CustomScrollAction, CustomScrollBehaviorCallback, CustomScrollBoundary, CustomScrollBoundaryCallback, Options, ScrollAction, ScrollBehavior, ScrollLogicalPosition, ScrollMode, SkipOverflowHiddenElements, SmoothBehaviorOptions, SmoothScrollExtensions, StandardBehaviorOptions, };
|
package/utils/compute.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/* 2026-01-12 10:48:24 */
|
|
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
|
-
};
|