@unicom-cloud/ui-common 0.1.58 → 0.1.60
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/.virtual/_rolldown/runtime.js +1 -1
- package/animation/Animation.js +41 -42
- package/animation/constants.d.ts +2 -0
- package/animation/constants.js +4 -4
- package/animation/context.d.ts +0 -1
- package/animation/context.js +3 -3
- package/animation/index.d.ts +0 -6
- package/animation/index.js +6 -10
- package/animation/interface.d.ts +1 -1
- package/animation/style/index.js +1 -1
- package/animation/utils.js +1 -1
- package/base/Base.js +1 -1
- package/base/constants.d.ts +2 -0
- package/base/constants.js +4 -1
- package/base/context.d.ts +0 -1
- package/base/context.js +3 -3
- package/base/index.js +1 -1
- package/base/style/index.js +1 -1
- package/base/utils.js +1 -1
- package/border-beam/BorderBeam.js +14 -14
- package/border-beam/Effect.d.ts +1 -6
- package/border-beam/Effect.js +3 -3
- package/border-beam/constants.d.ts +2 -1
- package/border-beam/constants.js +8 -3
- package/border-beam/context.d.ts +0 -1
- package/border-beam/context.js +4 -10
- package/border-beam/hooks/useBorderSize.d.ts +1 -5
- package/border-beam/hooks/useBorderSize.js +1 -1
- package/border-beam/hooks/useChildDom.d.ts +1 -1
- package/border-beam/hooks/useChildDom.js +1 -1
- package/border-beam/index.d.ts +0 -6
- package/border-beam/index.js +5 -9
- package/border-beam/interface.d.ts +27 -4
- package/border-beam/style/index.js +1 -1
- package/border-beam/utils.d.ts +1 -9
- package/border-beam/utils.js +9 -9
- package/development/Development.js +6 -5
- package/development/constants.d.ts +2 -0
- package/development/constants.js +4 -1
- package/development/context.d.ts +0 -1
- package/development/context.js +3 -3
- package/development/index.d.ts +0 -6
- package/development/index.js +5 -9
- package/development/style/index.js +1 -1
- package/development/utils.js +1 -1
- package/empty/Empty.d.ts +1 -1
- package/empty/Empty.js +28 -27
- package/empty/constants.d.ts +2 -0
- package/empty/constants.js +4 -1
- package/empty/context.d.ts +0 -1
- package/empty/context.js +3 -3
- package/empty/index.d.ts +1 -7
- package/empty/index.js +5 -9
- package/empty/style/index.js +1 -1
- package/empty/utils.js +1 -1
- package/flex/Flex.js +5 -4
- package/flex/FlexVertical.js +1 -1
- package/flex/constants.d.ts +2 -0
- package/flex/constants.js +7 -1
- package/flex/context.d.ts +0 -1
- package/flex/context.js +3 -6
- package/flex/index.d.ts +1 -7
- package/flex/index.js +9 -11
- package/flex/interface.d.ts +1 -1
- package/flex/style/index.js +1 -1
- package/flex/utils.d.ts +1 -1
- package/flex/utils.js +10 -12
- package/grid/Grid.js +16 -15
- package/grid/Item.js +10 -9
- package/grid/constants.d.ts +3 -0
- package/grid/constants.js +8 -1
- package/grid/context.d.ts +0 -2
- package/grid/context.js +4 -8
- package/grid/index.d.ts +0 -6
- package/grid/index.js +9 -11
- package/grid/style/index.js +1 -1
- package/grid/utils.js +1 -1
- package/higher-order/with-speech-synthesis/constants.d.ts +2 -0
- package/higher-order/with-speech-synthesis/constants.js +7 -0
- package/higher-order/with-speech-synthesis/context.d.ts +0 -1
- package/higher-order/with-speech-synthesis/context.js +3 -3
- package/higher-order/with-speech-synthesis/index.d.ts +0 -6
- package/higher-order/with-speech-synthesis/index.js +5 -9
- package/higher-order/with-speech-synthesis/style/index.js +1 -1
- package/higher-order/with-speech-synthesis/withSpeechSynthesis.d.ts +8 -1
- package/higher-order/with-speech-synthesis/withSpeechSynthesis.js +28 -27
- package/hoc/withContext.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 +9 -9
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +93 -92
- package/hooks/use-async-effect/index.js +1 -1
- package/hooks/use-boolean/index.js +1 -1
- package/hooks/use-click-away/index.d.ts +7 -1
- package/hooks/use-click-away/index.js +20 -12
- 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 +2 -2
- package/hooks/use-count-down/index.js +1 -1
- package/hooks/use-counter/index.js +1 -1
- package/hooks/use-create/index.js +6 -5
- package/hooks/use-creation/index.js +7 -6
- package/hooks/use-debounce/debounceOptions.d.ts +1 -6
- package/hooks/use-debounce/index.js +1 -1
- package/hooks/use-debounce/interface.d.ts +14 -0
- package/hooks/use-debounce-effect/index.js +1 -1
- package/hooks/use-debounce-fn/index.js +5 -5
- 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 +7 -7
- package/hooks/use-drag/index.d.ts +1 -1
- package/hooks/use-drag/index.js +10 -10
- package/hooks/use-drag-move/index.js +1 -1
- package/hooks/use-drop/index.d.ts +1 -1
- package/hooks/use-drop/index.js +1 -1
- package/hooks/use-dynamic-list/index.d.ts +18 -0
- package/hooks/use-dynamic-list/index.js +105 -0
- package/hooks/use-effect-event/index.js +1 -1
- package/hooks/use-event/index.js +1 -1
- package/hooks/use-event-emitter/index.d.ts +13 -1
- package/hooks/use-event-emitter/index.js +15 -12
- package/hooks/use-event-listener/index.d.ts +2 -7
- package/hooks/use-event-listener/index.js +1 -1
- package/hooks/use-event-target/index.js +1 -1
- package/hooks/use-external/index.js +2 -2
- package/hooks/use-favicon/index.js +2 -2
- package/hooks/use-focus-within/index.d.ts +1 -5
- package/hooks/use-focus-within/index.js +1 -1
- package/hooks/use-focus-within/interface.d.ts +13 -0
- package/hooks/use-force-update/index.js +1 -1
- package/hooks/use-fullscreen/index.js +14 -14
- package/hooks/use-get-state/index.d.ts +1 -7
- package/hooks/use-get-state/index.js +1 -1
- package/hooks/use-history-travel/index.d.ts +1 -1
- package/hooks/use-history-travel/index.js +32 -26
- package/hooks/use-hover/index.js +1 -1
- package/hooks/use-id/index.js +1 -1
- package/hooks/use-in-viewport/index.js +10 -10
- package/hooks/use-infinite-scroll/index.js +33 -31
- package/hooks/use-intersection-observer/index.js +3 -3
- package/hooks/use-intersection-observers/index.js +10 -10
- 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.d.ts +1 -0
- 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 +4 -4
- 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 +1 -1
- package/hooks/use-merge-component-props/index.d.ts +2 -2
- package/hooks/use-merge-component-props/index.js +2 -1
- package/hooks/use-merge-value/index.d.ts +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.d.ts +1 -1
- package/hooks/use-mouse/index.js +9 -9
- package/hooks/use-mutation-observer/index.js +2 -2
- package/hooks/use-mutation-observers/index.js +10 -10
- 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.d.ts +3 -5
- package/hooks/use-override-ref/index.js +5 -5
- package/hooks/use-pagination/index.js +1 -1
- package/hooks/use-pagination/types.d.ts +5 -8
- package/hooks/use-paste-file/index.js +9 -9
- 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 +17 -17
- package/hooks/use-raf-state/index.d.ts +1 -6
- package/hooks/use-raf-state/index.js +1 -1
- package/hooks/use-raf-timeout/index.js +17 -17
- package/hooks/use-reactive/index.js +5 -5
- package/hooks/use-ref-latest/index.js +1 -1
- package/hooks/use-ref-map/index.d.ts +2 -1
- package/hooks/use-ref-map/index.js +1 -1
- package/hooks/use-refs/index.js +1 -1
- package/hooks/use-request/index.js +5 -5
- package/hooks/use-request/src/Fetch.d.ts +2 -0
- package/hooks/use-request/src/Fetch.js +32 -28
- package/hooks/use-request/src/plugins/useAutoRunPlugin.js +1 -1
- package/hooks/use-request/src/plugins/useCachePlugin.js +5 -5
- package/hooks/use-request/src/plugins/useDebouncePlugin.js +2 -2
- package/hooks/use-request/src/plugins/useLoadingDelayPlugin.js +13 -12
- package/hooks/use-request/src/plugins/usePollingPlugin.js +3 -3
- 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/types.d.ts +2 -1
- package/hooks/use-request/src/useRequest.d.ts +11 -4
- package/hooks/use-request/src/useRequest.js +1 -1
- package/hooks/use-request/src/useRequestImplement.js +18 -18
- 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 +3 -3
- 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 +6 -6
- package/hooks/use-resize-observer/index.d.ts +6 -1
- package/hooks/use-resize-observer/index.js +30 -4
- package/hooks/use-resize-observers/index.d.ts +1 -0
- package/hooks/use-resize-observers/index.js +23 -24
- package/hooks/use-responsive/index.js +2 -2
- package/hooks/use-safe-state/index.js +1 -1
- package/hooks/use-scroll/index.js +20 -20
- package/hooks/use-selections/index.d.ts +1 -1
- package/hooks/use-selections/index.js +45 -39
- package/hooks/use-session-storage-state/index.js +4 -4
- package/hooks/use-set/index.js +1 -1
- package/hooks/use-set-state/index.js +1 -1
- package/hooks/use-size/index.d.ts +1 -6
- package/hooks/use-size/index.js +4 -33
- package/hooks/use-state-callback/index.d.ts +1 -5
- package/hooks/use-state-callback/index.js +7 -7
- package/hooks/use-state-with-promise/index.d.ts +1 -4
- package/hooks/use-state-with-promise/index.js +1 -1
- package/hooks/use-sync-state/index.js +5 -5
- package/hooks/use-text-selection/index.js +1 -1
- package/hooks/use-theme/index.js +14 -14
- package/hooks/use-throttle/index.js +1 -1
- package/hooks/use-throttle/interface.d.ts +13 -0
- package/hooks/use-throttle/throttleOptions.d.ts +1 -5
- package/hooks/use-throttle-effect/index.js +5 -5
- package/hooks/use-throttle-fn/index.js +5 -5
- package/hooks/use-throttle-fn-with-raf/index.js +6 -6
- package/hooks/use-timeout/index.js +1 -1
- package/hooks/use-title/index.js +5 -5
- package/hooks/use-toggle/index.d.ts +6 -3
- 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.d.ts +1 -1
- package/hooks/use-url-state/index.js +1 -1
- package/hooks/use-virtual-list/index.js +13 -13
- package/hooks/use-watch/index.js +1 -1
- package/hooks/use-web-socket/index.js +7 -7
- package/hooks/use-why-did-you-update/index.js +1 -1
- package/hooks/use-window-size/index.js +7 -7
- package/hooks/utils/createEffectWithTarget.js +7 -7
- 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 +4 -4
- package/hooks/utils/useEffectWithTarget.js +1 -1
- package/hooks/utils/useIsomorphicLayoutEffectWithTarget.js +1 -1
- package/hooks/utils/useLayoutEffectWithTarget.js +1 -1
- package/icons/file/File.js +5 -4
- package/icons/file/constants.d.ts +2 -0
- package/icons/file/constants.js +7 -0
- package/icons/file/context.d.ts +0 -1
- package/icons/file/context.js +3 -3
- package/icons/file/index.js +2 -2
- package/icons/file/style/index.js +1 -1
- package/index.d.ts +2 -2
- package/index.js +542 -537
- package/morphicons/core/interpolate.js +1 -1
- package/morphicons/core/normalize.js +57 -57
- package/morphicons/core/parse.d.ts +1 -9
- package/morphicons/core/resample.js +1 -1
- package/morphicons/core/serialize.js +1 -1
- package/morphicons/core/spring.js +1 -1
- package/morphicons/dom/controller.d.ts +3 -3
- package/morphicons/dom/index.js +23 -23
- package/morphicons/element/index.d.ts +1 -1
- package/morphicons/index.d.ts +1 -1
- package/morphicons/index.js +6 -6
- package/morphicons/react/index.d.ts +1 -1
- package/morphicons/react/index.js +65 -65
- package/package.json +1 -1
- package/progress/Progress.js +20 -20
- package/progress/constants.js +1 -1
- package/progress/context.js +1 -1
- package/progress/index.js +1 -1
- package/progress/style/index.js +1 -1
- package/progress/utils.js +1 -1
- package/resize-observer/Collection.js +1 -1
- package/resize-observer/ResizeObserver.js +13 -12
- package/resize-observer/SingleObserver.d.ts +1 -5
- package/resize-observer/SingleObserver.js +4 -4
- package/resize-observer/constants.d.ts +2 -0
- package/resize-observer/constants.js +4 -1
- package/resize-observer/context.d.ts +0 -1
- package/resize-observer/context.js +3 -3
- package/resize-observer/index.d.ts +1 -7
- package/resize-observer/index.js +7 -9
- package/resize-observer/interface.d.ts +18 -0
- package/resize-observer/observerUtil.d.ts +1 -1
- package/resize-observer/observerUtil.js +1 -1
- package/resize-observer/style/index.js +1 -1
- package/resize-observer/utils.js +1 -1
- package/space/Space.d.ts +2 -1
- package/space/Space.js +12 -11
- package/space/SpaceVertical.js +1 -1
- package/space/constants.d.ts +2 -0
- package/space/constants.js +9 -1
- package/space/context.d.ts +0 -1
- package/space/context.js +3 -8
- package/space/index.d.ts +0 -6
- package/space/index.js +8 -10
- package/space/interface.d.ts +1 -0
- package/space/style/index.js +1 -1
- package/space/utils.js +1 -1
- package/style/animation.less +2 -8
- package/style/normalize.less +0 -13
- package/style.css +1 -1
- package/suspense-fallback-test/NeverLoadLazy.d.ts +3 -0
- package/suspense-fallback-test/NeverLoadLazy.js +8 -0
- package/suspense-fallback-test/SuspenseFallbackTest.js +14 -14
- package/suspense-fallback-test/constants.d.ts +2 -0
- package/suspense-fallback-test/constants.js +4 -1
- package/suspense-fallback-test/context.d.ts +0 -2
- package/suspense-fallback-test/context.js +3 -3
- package/suspense-fallback-test/index.d.ts +0 -6
- package/suspense-fallback-test/index.js +5 -9
- package/suspense-fallback-test/style/index.js +1 -1
- package/suspense-fallback-test/utils.js +1 -1
- package/test.js +1 -1
- package/timer/Timer.js +6 -5
- package/timer/constants.d.ts +2 -0
- package/timer/constants.js +4 -1
- package/timer/context.d.ts +0 -1
- package/timer/context.js +3 -3
- package/timer/index.d.ts +0 -6
- package/timer/index.js +5 -9
- package/timer/style/index.js +1 -1
- package/timer/utils.js +1 -1
- package/transition/Transition.d.ts +0 -1
- package/transition/Transition.js +55 -58
- package/transition/TransitionCSS.js +15 -15
- package/transition/TransitionGroup.js +13 -13
- package/transition/TransitionStyle.js +12 -12
- package/transition/constants.d.ts +4 -27
- package/transition/constants.js +37 -41
- package/transition/context.d.ts +2 -3
- package/transition/context.js +4 -5
- package/transition/index.d.ts +0 -7
- package/transition/index.js +15 -16
- package/transition/interface.d.ts +26 -1
- package/transition/interface.js +11 -0
- package/transition/style/index.js +1 -1
- package/transition/utils.d.ts +1 -1
- package/transition/utils.js +1 -1
- package/utils/callbackOriginRef.js +1 -1
- package/utils/confetti.js +1 -1
- package/utils/constants.d.ts +3 -2
- package/utils/constants.js +6 -5
- package/utils/copy.js +1 -1
- package/utils/createRoot.d.ts +1 -6
- package/utils/createRoot.js +11 -11
- package/utils/css.js +1 -1
- package/utils/date.d.ts +1 -1
- package/utils/date.js +1 -1
- package/utils/dayjs.js +1 -1
- package/utils/document.js +1 -1
- package/utils/dom.d.ts +1 -1
- package/utils/dom.js +9 -9
- package/utils/file.js +1 -1
- package/utils/fillNBSP.js +1 -1
- package/utils/getCompatProp.js +1 -1
- package/utils/getElement.js +1 -1
- package/utils/getHighlightText.js +1 -1
- package/utils/getHotkeyHandler.d.ts +1 -12
- package/utils/getHotkeyHandler.js +17 -17
- package/utils/getPrefixCls.js +1 -1
- package/utils/getScrollBarHeight.js +1 -1
- package/utils/getScrollBarSize.js +1 -1
- package/utils/getScrollBarWidth.js +1 -1
- package/utils/getScrollParent.js +1 -1
- package/utils/getStringLength.js +1 -1
- package/utils/getUrlSearchParam.js +1 -1
- package/utils/index.js +274 -273
- package/utils/initAllLineClamp.js +1 -1
- package/utils/injectLineClamp.js +1 -1
- package/utils/interface.d.ts +103 -0
- package/utils/interface.js +4 -0
- package/utils/intersectionObserver.js +1 -1
- package/utils/is.js +1 -1
- package/utils/keyboardCode.js +1 -1
- package/utils/lodash.d.ts +2 -1
- package/utils/lodash.js +19 -18
- package/utils/math.d.ts +1 -1
- package/utils/mergeProps.d.ts +1 -2
- package/utils/mergeProps.js +1 -1
- package/utils/mergedToString.js +1 -1
- package/utils/migrateLegacyProps.d.ts +1 -8
- package/utils/migrateLegacyProps.js +1 -1
- package/utils/mutationObserver.js +1 -1
- package/utils/names.d.ts +1 -8
- package/utils/names.js +1 -1
- package/utils/object.js +1 -1
- package/utils/omit.js +1 -1
- package/utils/pad.js +1 -1
- package/utils/pick.js +1 -1
- package/utils/react19Adapter.js +1 -1
- package/utils/reactNode.js +1 -1
- package/utils/ref.d.ts +2 -1
- package/utils/ref.js +13 -13
- package/utils/resizeObserver.js +1 -1
- package/utils/scrollIntoViewIfNeeded.js +1 -1
- package/utils/scrollTo.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/tinycolor.js +1 -1
- package/utils/toArray.js +1 -1
- package/utils/tunnel.d.ts +2 -12
- package/utils/tunnel.js +1 -1
- package/utils/warning.js +1 -1
- package/version/index.js +9 -9
- /package/{suspense-fallback-test → base}/style/index.css +0 -0
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/* 潘启宝 2026-11-
|
|
1
|
+
/* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
|
|
2
2
|
/* 世界因你而美丽 */
|
|
3
3
|
import { parsePath as e } from "./parse.js";
|
|
4
4
|
import { cubicsToPathD as t } from "./serialize.js";
|
|
5
|
-
import {
|
|
5
|
+
import { isNaN as n, isNumber as r, isString as i, isUndefined as a } from "@unicom-cloud/utils/is";
|
|
6
6
|
// components/common/morphicons/core/normalize.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
7
|
+
var o = 4 / 3 * Math.tan(Math.PI / 8), s = 2 * Math.PI;
|
|
8
|
+
function c(e, t) {
|
|
9
9
|
let n = [e, t], r = e, i = t, a = (e, t, a, o, s, c) => {
|
|
10
10
|
n.push(e, t, a, o, s, c), r = s, i = c;
|
|
11
|
-
},
|
|
11
|
+
}, o = (e, t) => {
|
|
12
12
|
Math.abs(e - r) < 1e-12 && Math.abs(t - i) < 1e-12 || a(r + (e - r) / 3, i + (t - i) / 3, r + 2 * (e - r) / 3, i + 2 * (t - i) / 3, e, t);
|
|
13
13
|
};
|
|
14
14
|
return [
|
|
15
15
|
a,
|
|
16
|
-
|
|
16
|
+
o,
|
|
17
17
|
(e, t, n, o) => {
|
|
18
18
|
a(r + 2 / 3 * (e - r), i + 2 / 3 * (t - i), n + 2 / 3 * (e - n), o + 2 / 3 * (t - o), n, o);
|
|
19
19
|
},
|
|
@@ -22,7 +22,7 @@ function s(e, t) {
|
|
|
22
22
|
if (Math.abs(u - f) < 1e-12 && Math.abs(d - p) < 1e-12) return;
|
|
23
23
|
let m = Math.abs(e), h = Math.abs(t);
|
|
24
24
|
if (m < 1e-12 || h < 1e-12) {
|
|
25
|
-
|
|
25
|
+
o(u, d);
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
let g = n * Math.PI / 180, _ = Math.cos(g), v = Math.sin(g), y = (f - u) / 2, b = (p - d) / 2, x = _ * y + v * b, S = -v * y + _ * b, C = x * x / (m * m) + S * S / (h * h);
|
|
@@ -33,21 +33,21 @@ function s(e, t) {
|
|
|
33
33
|
let w = m * m, T = h * h, E = x * x, D = S * S, O = (w * T - w * D - T * E) / (w * D + T * E);
|
|
34
34
|
O < 0 && (O = 0);
|
|
35
35
|
let k = (c === l ? -1 : 1) * Math.sqrt(O), A = k * m * S / h, j = -k * h * x / m, M = _ * A - v * j + (f + u) / 2, N = v * A + _ * j + (p + d) / 2, P = Math.atan2((S - j) / h, (x - A) / m), F = Math.atan2((-S - j) / h, (-x - A) / m) - P;
|
|
36
|
-
l === 0 && F > 0 ? F -=
|
|
36
|
+
l === 0 && F > 0 ? F -= s : l === 1 && F < 0 && (F += s);
|
|
37
37
|
let I = Math.max(1, Math.ceil(Math.abs(F) / (Math.PI / 2) - 1e-9)), L = F / I, R = 4 / 3 * Math.tan(L / 4), z = (e) => M + m * Math.cos(e) * _ - h * Math.sin(e) * v, B = (e) => N + m * Math.cos(e) * v + h * Math.sin(e) * _, V = (e) => -m * Math.sin(e) * _ - h * Math.cos(e) * v, H = (e) => -m * Math.sin(e) * v + h * Math.cos(e) * _, U = P, W = f, G = p;
|
|
38
38
|
for (let e = 1; e <= I; e++) {
|
|
39
39
|
let t = P + L * e, n = e === I ? u : z(t), r = e === I ? d : B(t);
|
|
40
40
|
a(W + R * V(U), G + R * H(U), n - R * V(t), r - R * H(t), n, r), U = t, W = n, G = r;
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
(e) => (e &&
|
|
43
|
+
(e) => (e && o(n[0], n[1]), n.length < 8 ? null : {
|
|
44
44
|
pts: Float64Array.from(n),
|
|
45
45
|
closed: e
|
|
46
46
|
})
|
|
47
47
|
];
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
let [t, n, r, i, a] =
|
|
49
|
+
function l(e) {
|
|
50
|
+
let [t, n, r, i, a] = c(e.x0, e.y0);
|
|
51
51
|
for (let a of e.segs) switch (a[0]) {
|
|
52
52
|
case "L":
|
|
53
53
|
n(a[1], a[2]);
|
|
@@ -62,105 +62,105 @@ function c(e) {
|
|
|
62
62
|
}
|
|
63
63
|
return a(e.closed);
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
let
|
|
67
|
-
if (i
|
|
68
|
-
let o =
|
|
69
|
-
return Number.isFinite(o) ? o :
|
|
65
|
+
function u(e, t, n = 0) {
|
|
66
|
+
let i = e[t];
|
|
67
|
+
if (a(i)) return n;
|
|
68
|
+
let o = r(i) ? i : Number(i);
|
|
69
|
+
return Number.isFinite(o) ? o : n;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function d(e) {
|
|
72
72
|
let t = String(e ?? "").trim();
|
|
73
73
|
if (!t) return [];
|
|
74
74
|
let n = t.split(/[\s,]+/).map(Number);
|
|
75
75
|
if (n.some((e) => !Number.isFinite(e))) throw Error(`morphicons: invalid points: "${t}"`);
|
|
76
76
|
return n;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function f(e, t) {
|
|
79
79
|
if (e.length < 4) return null;
|
|
80
|
-
let [, n, , , r] =
|
|
80
|
+
let [, n, , , r] = c(e[0], e[1]);
|
|
81
81
|
for (let t = 2; t + 1 < e.length; t += 2) n(e[t], e[t + 1]);
|
|
82
82
|
return r(t);
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function p(e, t, n, r) {
|
|
85
85
|
if (n < 1e-12 || r < 1e-12) return null;
|
|
86
|
-
let i =
|
|
87
|
-
return f(
|
|
86
|
+
let i = o * n, a = o * r, s = e + n, l = e - n, u = t + r, d = t - r, [f, , , , p] = c(s, t);
|
|
87
|
+
return f(s, t + a, e + i, u, e, u), f(e - i, u, l, t + a, l, t), f(l, t - a, e - i, d, e, d), f(e + i, d, s, t - a, s, t), p(!0);
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
let t =
|
|
91
|
-
if (
|
|
92
|
-
let
|
|
93
|
-
if (
|
|
89
|
+
function m(e) {
|
|
90
|
+
let t = u(e, "x"), r = u(e, "y"), i = u(e, "width"), a = u(e, "height");
|
|
91
|
+
if (i < 1e-12 || a < 1e-12) return null;
|
|
92
|
+
let s = u(e, "rx", NaN), l = u(e, "ry", NaN);
|
|
93
|
+
if (n(s) && (s = n(l) ? 0 : l), n(l) && (l = s), s = Math.min(Math.max(s, 0), i / 2), l = Math.min(Math.max(l, 0), a / 2), s < 1e-12 || l < 1e-12) return f([
|
|
94
94
|
t,
|
|
95
|
-
|
|
96
|
-
t +
|
|
97
|
-
|
|
98
|
-
t +
|
|
99
|
-
|
|
95
|
+
r,
|
|
96
|
+
t + i,
|
|
97
|
+
r,
|
|
98
|
+
t + i,
|
|
99
|
+
r + a,
|
|
100
100
|
t,
|
|
101
|
-
|
|
101
|
+
r + a
|
|
102
102
|
], !0);
|
|
103
|
-
let
|
|
104
|
-
return
|
|
103
|
+
let d = t + s, p = t + i - s, m = t + i, h = r + l, g = r + a - l, _ = r + a, v = o * s, y = o * l, [b, x, , , S] = c(d, r);
|
|
104
|
+
return x(p, r), b(p + v, r, m, h - y, m, h), x(m, g), b(m, g + y, p + v, _, p, _), x(d, _), b(d - v, _, t, g + y, t, g), x(t, h), b(t, h - y, d - v, r, d, r), S(!0);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
let n = [],
|
|
106
|
+
function h(t) {
|
|
107
|
+
let n = [], r = (e) => {
|
|
108
108
|
e && n.push(e);
|
|
109
109
|
};
|
|
110
|
-
if (
|
|
111
|
-
for (let n of e(t))
|
|
110
|
+
if (i(t)) {
|
|
111
|
+
for (let n of e(t)) r(l(n));
|
|
112
112
|
return n;
|
|
113
113
|
}
|
|
114
|
-
for (let [n,
|
|
114
|
+
for (let [n, i] of t) switch (n) {
|
|
115
115
|
case "path":
|
|
116
|
-
for (let t of e(String(
|
|
116
|
+
for (let t of e(String(i.d ?? ""))) r(l(t));
|
|
117
117
|
break;
|
|
118
118
|
case "line": {
|
|
119
|
-
let [, e, , , t] =
|
|
120
|
-
e(
|
|
119
|
+
let [, e, , , t] = c(u(i, "x1"), u(i, "y1"));
|
|
120
|
+
e(u(i, "x2"), u(i, "y2")), r(t(!1));
|
|
121
121
|
break;
|
|
122
122
|
}
|
|
123
123
|
case "circle": {
|
|
124
|
-
let e =
|
|
125
|
-
|
|
124
|
+
let e = u(i, "r");
|
|
125
|
+
r(p(u(i, "cx"), u(i, "cy"), e, e));
|
|
126
126
|
break;
|
|
127
127
|
}
|
|
128
128
|
case "ellipse":
|
|
129
|
-
|
|
129
|
+
r(p(u(i, "cx"), u(i, "cy"), u(i, "rx"), u(i, "ry")));
|
|
130
130
|
break;
|
|
131
131
|
case "rect":
|
|
132
|
-
|
|
132
|
+
r(m(i));
|
|
133
133
|
break;
|
|
134
134
|
case "polyline":
|
|
135
|
-
|
|
135
|
+
r(f(d(i.points), !1));
|
|
136
136
|
break;
|
|
137
137
|
case "polygon":
|
|
138
|
-
|
|
138
|
+
r(f(d(i.points), !0));
|
|
139
139
|
break;
|
|
140
140
|
default: throw Error(`morphicons: unsupported tag <${n}>`);
|
|
141
141
|
}
|
|
142
142
|
return n;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
let t =
|
|
144
|
+
function g(e) {
|
|
145
|
+
let t = r(e) ? [
|
|
146
146
|
0,
|
|
147
147
|
0,
|
|
148
148
|
e,
|
|
149
149
|
e
|
|
150
|
-
] :
|
|
151
|
-
if (t.length !== 4 || !(o > 0) || !(s > 0) || !Number.isFinite(
|
|
150
|
+
] : i(e) ? e.trim().split(/[\s,]+/).map(Number) : e, [n, a, o, s] = t;
|
|
151
|
+
if (t.length !== 4 || !(o > 0) || !(s > 0) || !Number.isFinite(n) || !Number.isFinite(a)) throw Error(`morphicons: invalid viewBox "${String(e)}"`);
|
|
152
152
|
return [
|
|
153
|
-
|
|
153
|
+
n,
|
|
154
154
|
a,
|
|
155
155
|
o,
|
|
156
156
|
s
|
|
157
157
|
];
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
let [i, a, o, s] =
|
|
159
|
+
function _(e, n, r = 24) {
|
|
160
|
+
let [i, a, o, s] = g(n), c = Math.min(r / o, r / s), l = (r - o * c) / 2 - i * c, u = (r - s * c) / 2 - a * c, d = h(e);
|
|
161
161
|
for (let { pts: e } of d) for (let t = 0; t < e.length; t += 2) e[t] = e[t] * c + l, e[t + 1] = e[t + 1] * c + u;
|
|
162
162
|
return t(d);
|
|
163
163
|
}
|
|
164
|
-
export {
|
|
164
|
+
export { o as KAPPA, _ as fitIcon, h as iconToCubics };
|
|
165
165
|
/* 欲穷千里目,更上一层楼 */
|
|
166
166
|
/* 独立思考,明辨是非 */
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
/** Raw absolute segment (shorthands already resolved), as a labeled tuple —
|
|
2
2
|
* compact in the bundle (no object keys the minifier can't mangle). */
|
|
3
|
-
export type RawSeg = readonly ['L', x: number, y: number] | readonly [
|
|
4
|
-
'C',
|
|
5
|
-
x1: number,
|
|
6
|
-
y1: number,
|
|
7
|
-
x2: number,
|
|
8
|
-
y2: number,
|
|
9
|
-
x: number,
|
|
10
|
-
y: number
|
|
11
|
-
] | readonly ['Q', x1: number, y1: number, x: number, y: number] | readonly [
|
|
3
|
+
export type RawSeg = readonly ['L', x: number, y: number] | readonly ['C', x1: number, y1: number, x2: number, y2: number, x: number, y: number] | readonly ['Q', x1: number, y1: number, x: number, y: number] | readonly [
|
|
12
4
|
'A',
|
|
13
5
|
rx: number,
|
|
14
6
|
ry: number,
|
|
@@ -24,7 +24,7 @@ export interface MorphWatchProps extends MorphCtrlProps {
|
|
|
24
24
|
* mount-time props (server and client produce the same string → hydration
|
|
25
25
|
* without mismatch) and from then on only the driver mutates it outside the
|
|
26
26
|
* template. */
|
|
27
|
-
export declare function computeInitialD({ icon, from, to, progress
|
|
27
|
+
export declare function computeInitialD({ icon, from, to, progress }: MorphModeProps): string;
|
|
28
28
|
/** Per-instance driver state — the exact logic of the React/Vue bindings
|
|
29
29
|
* (mount, mode watch, controlled seek with re-basing, imperative). Takes the
|
|
30
30
|
* init-time props: they seed the watch baselines so a watcher that fires on
|
|
@@ -41,13 +41,13 @@ export declare function computeInitialD({ icon, from, to, progress, }: MorphMode
|
|
|
41
41
|
* path back to `icon`.
|
|
42
42
|
* - Every exit from controlled mode (imperative call or icon takeover)
|
|
43
43
|
* invalidates the frozen pair, so returning to it re-bases on `from`. */
|
|
44
|
-
export declare function createController({ icon, from, to, progress, reducedMotion
|
|
44
|
+
export declare function createController({ icon, from, to, progress, reducedMotion }: MorphCtrlProps): {
|
|
45
45
|
mount(mountEl: PathEl, { icon, from, to, progress, reducedMotion }: MorphCtrlProps): void;
|
|
46
46
|
destroy(): void;
|
|
47
47
|
/** Prop watcher: ONE owner decides per run — the controlled pair while it
|
|
48
48
|
* is fully present, `icon` otherwise (mount doesn't fire thanks to the
|
|
49
49
|
* init-time baselines). */
|
|
50
|
-
watch({ icon, from, to, progress, spring, reducedMotion
|
|
50
|
+
watch({ icon, from, to, progress, spring, reducedMotion }: MorphWatchProps): void;
|
|
51
51
|
morphTo(icon: IconInput, spring?: SpringPreset | MorphOptions): void;
|
|
52
52
|
set(icon: IconInput): void;
|
|
53
53
|
};
|
package/morphicons/dom/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/* 潘启宝 2026-11-
|
|
1
|
+
/* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
|
|
2
2
|
/* 世界因你而美丽 */
|
|
3
3
|
import { allocOutputs as e, interpPolar as t } from "../core/interpolate.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { iconToCubics as n } from "../core/normalize.js";
|
|
5
|
+
import { buildPlan as r } from "../core/plan.js";
|
|
6
|
+
import { resampleIcon as i } from "../core/resample.js";
|
|
7
|
+
import { cubicsToPathD as a, serialize as o } from "../core/serialize.js";
|
|
8
8
|
import { SPRING_PRESETS as s, Spring as c } from "../core/spring.js";
|
|
9
|
-
import {
|
|
9
|
+
import { isGlobalUndefined as l, isString as u } from "@unicom-cloud/utils/is";
|
|
10
10
|
// components/common/morphicons/dom/index.ts
|
|
11
11
|
var d = /* @__PURE__ */ new Set(), f = 0, p = -1;
|
|
12
12
|
function m(e) {
|
|
@@ -23,36 +23,36 @@ function g(e) {
|
|
|
23
23
|
}
|
|
24
24
|
var _ = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap();
|
|
25
25
|
function b(e) {
|
|
26
|
-
if (
|
|
26
|
+
if (u(e)) return i(e);
|
|
27
27
|
let t = _.get(e);
|
|
28
|
-
return t || (t =
|
|
28
|
+
return t || (t = i(e), _.set(e, t)), t;
|
|
29
29
|
}
|
|
30
30
|
function x(e) {
|
|
31
|
-
if (
|
|
31
|
+
if (u(e)) return e;
|
|
32
32
|
let t = v.get(e);
|
|
33
|
-
return t || (t = n(
|
|
33
|
+
return t || (t = a(n(e)), v.set(e, t)), t;
|
|
34
34
|
}
|
|
35
35
|
function S(e, t) {
|
|
36
|
-
if (
|
|
36
|
+
if (u(e) || u(t)) return r(b(e), b(t));
|
|
37
37
|
let n = y.get(e);
|
|
38
38
|
n || (n = /* @__PURE__ */ new WeakMap(), y.set(e, n));
|
|
39
|
-
let
|
|
40
|
-
return
|
|
39
|
+
let i = n.get(t);
|
|
40
|
+
return i || (i = r(b(e), b(t)), n.set(t, i)), i;
|
|
41
41
|
}
|
|
42
42
|
function C(e) {
|
|
43
|
-
if (
|
|
43
|
+
if (u(e)) return s[e];
|
|
44
44
|
let t = s.snappy;
|
|
45
45
|
return {
|
|
46
46
|
k: e?.stiffness ?? t.k,
|
|
47
47
|
c: e?.damping ?? t.c
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
function w(n, i,
|
|
51
|
-
let s = new c(),
|
|
50
|
+
function w(n, i, a) {
|
|
51
|
+
let s = new c(), u = a?.reducedMotion ?? "never", d = i, f = !0, p = null, m = null, _ = null, v = 1, y = !1, w = !1;
|
|
52
52
|
n.setAttribute("d", x(i));
|
|
53
53
|
let T = (e) => {
|
|
54
|
-
let
|
|
55
|
-
|
|
54
|
+
let r = p, i = m, a = _;
|
|
55
|
+
r && i && a && (v = e, t(r, e, i), n.setAttribute("d", o(i, a)));
|
|
56
56
|
}, E = () => {
|
|
57
57
|
y && (y = !1, g(D));
|
|
58
58
|
}, D = (e) => {
|
|
@@ -67,11 +67,11 @@ function w(n, i, o) {
|
|
|
67
67
|
closed: e.items[n].closed
|
|
68
68
|
}));
|
|
69
69
|
}, A = (t) => {
|
|
70
|
-
p = f ? S(d, t) :
|
|
70
|
+
p = f ? S(d, t) : r(k(), b(t)), m = e(p), _ = p.items.map((e) => e.closed), d = t, f = !1;
|
|
71
71
|
}, j = (e) => {
|
|
72
72
|
E(), d = e, O();
|
|
73
|
-
}, M = () =>
|
|
74
|
-
if (w) return;
|
|
73
|
+
}, M = () => u === "always" ? !0 : u !== "user" || l("matchMedia") ? !1 : matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1, N = (e, t) => {
|
|
74
|
+
if (!w) return;
|
|
75
75
|
let n = !f && p !== null && e === d;
|
|
76
76
|
E(), s.v = 0, n || A(e), T(t);
|
|
77
77
|
};
|
|
@@ -96,10 +96,10 @@ function w(n, i, o) {
|
|
|
96
96
|
w || N(d, e);
|
|
97
97
|
},
|
|
98
98
|
get reducedMotion() {
|
|
99
|
-
return
|
|
99
|
+
return u;
|
|
100
100
|
},
|
|
101
101
|
set reducedMotion(e) {
|
|
102
|
-
|
|
102
|
+
u = e;
|
|
103
103
|
},
|
|
104
104
|
destroy() {
|
|
105
105
|
E(), w = !0, p = null, m = null, _ = null;
|
|
@@ -35,5 +35,5 @@ declare global {
|
|
|
35
35
|
export type { IconInput, IconNode, Sampled } from '../core/types';
|
|
36
36
|
export { computeInitialD } from '../dom/controller';
|
|
37
37
|
export type { MorphHandle } from '../dom/controller';
|
|
38
|
-
export type { Morph, MorphOptions, PathEl, ReducedMotionMode
|
|
38
|
+
export type { Morph, MorphOptions, PathEl, ReducedMotionMode } from '../dom/index';
|
|
39
39
|
export type { SpringPreset };
|
package/morphicons/index.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export { buildPlan, type MorphPlan, type PlanItem } from './core/plan';
|
|
|
4
4
|
export { resampleIcon, resamplePath } from './core/resample';
|
|
5
5
|
export { cubicsToPathD, serialize } from './core/serialize';
|
|
6
6
|
export { Spring, SPRING_PRESETS, type SpringPreset } from './core/spring';
|
|
7
|
-
export type { CubicPath, IconInput, IconNode, IconNodeAttrs, Sampled
|
|
7
|
+
export type { CubicPath, IconInput, IconNode, IconNodeAttrs, Sampled } from './core/types';
|
|
8
8
|
export { MorphIcon } from './react';
|
package/morphicons/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/* 潘启宝 2026-11-
|
|
1
|
+
/* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
|
|
2
2
|
/* 世界因你而美丽 */
|
|
3
3
|
import { allocOutputs as e, interpLinear as t, interpPolar as n } from "./core/interpolate.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { fitIcon as r, iconToCubics as i } from "./core/normalize.js";
|
|
5
|
+
import { buildPlan as a } from "./core/plan.js";
|
|
6
|
+
import { resampleIcon as o, resamplePath as s } from "./core/resample.js";
|
|
7
|
+
import { cubicsToPathD as c, serialize as l } from "./core/serialize.js";
|
|
8
8
|
import { SPRING_PRESETS as u, Spring as d } from "./core/spring.js";
|
|
9
9
|
import { MorphIcon as f } from "./react/index.js";
|
|
10
|
-
export { f as MorphIcon, u as SPRING_PRESETS, d as Spring, e as allocOutputs,
|
|
10
|
+
export { f as MorphIcon, u as SPRING_PRESETS, d as Spring, e as allocOutputs, a as buildPlan, c as cubicsToPathD, r as fitIcon, i as iconToCubics, t as interpLinear, n as interpPolar, o as resampleIcon, s as resamplePath, l as serialize };
|
|
11
11
|
/* 欲穷千里目,更上一层楼 */
|
|
12
12
|
/* 独立思考,明辨是非 */
|
|
@@ -32,5 +32,5 @@ export interface MorphIconProps extends Omit<SVGProps<SVGSVGElement>, 'from' | '
|
|
|
32
32
|
}
|
|
33
33
|
export declare const MorphIcon: import("react").ForwardRefExoticComponent<MorphIconProps & import("react").RefAttributes<MorphHandle>>;
|
|
34
34
|
export type { IconInput, IconNode, Sampled } from '../core/types';
|
|
35
|
-
export type { Morph, MorphOptions, PathEl, ReducedMotionMode
|
|
35
|
+
export type { Morph, MorphOptions, PathEl, ReducedMotionMode } from '../dom/index';
|
|
36
36
|
export type { SpringPreset };
|
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
/* 潘启宝 2026-11-
|
|
1
|
+
/* 潘启宝 2026-11-20 17:53:57 星期五 山东省济南市 */
|
|
2
2
|
/* 世界因你而美丽 */
|
|
3
3
|
import { allocOutputs as e, interpPolar as t } from "../core/interpolate.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { buildPlan as n } from "../core/plan.js";
|
|
5
|
+
import { resampleIcon as r } from "../core/resample.js";
|
|
6
|
+
import { serialize as i } from "../core/serialize.js";
|
|
7
7
|
import { canonicalD as a, createMorph as o } from "../dom/index.js";
|
|
8
8
|
import { forwardRef as s, useCallback as c, useEffect as l, useImperativeHandle as u, useLayoutEffect as d, useRef as f, useState as p } from "react";
|
|
9
|
-
import {
|
|
10
|
-
import { jsx as
|
|
9
|
+
import { isDefined as m, isGlobalUndefined as h, isUndefined as g } from "@unicom-cloud/utils/is";
|
|
10
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
11
11
|
// components/common/morphicons/react/index.tsx
|
|
12
|
-
var
|
|
13
|
-
function
|
|
12
|
+
var y = h("document") ? l : d;
|
|
13
|
+
function b(o, s, c) {
|
|
14
14
|
if (c <= 0) return a(o);
|
|
15
15
|
if (c >= 1) return a(s);
|
|
16
|
-
let l = r(
|
|
17
|
-
return t(l, c, u),
|
|
16
|
+
let l = n(r(o), r(s)), u = e(l);
|
|
17
|
+
return t(l, c, u), i(u, l.items.map((e) => e.closed));
|
|
18
18
|
}
|
|
19
|
-
var
|
|
20
|
-
let { icon: n, from: r, to: i, progress: s, spring: d, reducedMotion:
|
|
21
|
-
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
let
|
|
25
|
-
if (
|
|
26
|
-
let t =
|
|
27
|
-
return
|
|
19
|
+
var x = s(function(e, t) {
|
|
20
|
+
let { icon: n, from: r, to: i, progress: s, spring: d, reducedMotion: h, size: x = 24, color: S = "currentColor", strokeWidth: C = 2, absoluteStrokeWidth: w, label: T, ...E } = e, D = m(r) && m(i), O = n ?? r ?? i, [k] = p(() => D ? b(r, i, s ?? 0) : g(O) ? "" : a(O)), A = f(null), j = f(null), M = f(d);
|
|
21
|
+
M.current = d;
|
|
22
|
+
let N = f(h);
|
|
23
|
+
N.current = h;
|
|
24
|
+
let P = f(n), F = f(D), I = f(!1), L = f(!1), R = f(null), z = c((e) => {
|
|
25
|
+
if (j.current) return j.current;
|
|
26
|
+
let t = A.current;
|
|
27
|
+
return I.current || !t ? null : (j.current = o(t, e, { reducedMotion: N.current }), j.current);
|
|
28
28
|
}, []);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
let e =
|
|
32
|
-
if (e &&
|
|
33
|
-
let t = o(e,
|
|
34
|
-
if (
|
|
35
|
-
|
|
29
|
+
y(() => {
|
|
30
|
+
I.current = !1;
|
|
31
|
+
let e = A.current;
|
|
32
|
+
if (e && m(O)) {
|
|
33
|
+
let t = o(e, D ? r : O, { reducedMotion: N.current });
|
|
34
|
+
if (j.current = t, D) {
|
|
35
|
+
R.current = [r, i];
|
|
36
36
|
let e = s ?? 0;
|
|
37
|
-
e <= 0 ? t.set(r) : e >= 1 ? t.set(i) : (t.seek(i, e),
|
|
37
|
+
e <= 0 ? t.set(r) : e >= 1 ? t.set(i) : (t.seek(i, e), L.current = !0);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
return () => {
|
|
41
|
-
|
|
41
|
+
I.current = !0, j.current?.destroy(), j.current = null, L.current = !1, R.current = null;
|
|
42
42
|
};
|
|
43
43
|
}, []), l(() => {
|
|
44
|
-
let e =
|
|
45
|
-
e && (e.reducedMotion =
|
|
46
|
-
}, [
|
|
47
|
-
let e =
|
|
48
|
-
|
|
49
|
-
let t = n !==
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
let r =
|
|
53
|
-
r ? r.morphTo(n,
|
|
44
|
+
let e = j.current;
|
|
45
|
+
e && (e.reducedMotion = h ?? "never");
|
|
46
|
+
}, [h]), l(() => {
|
|
47
|
+
let e = F.current && !D;
|
|
48
|
+
F.current = D;
|
|
49
|
+
let t = n !== P.current;
|
|
50
|
+
if (P.current = n, D || g(n) || !t && !e) return;
|
|
51
|
+
R.current = null, L.current = !1;
|
|
52
|
+
let r = j.current;
|
|
53
|
+
r ? r.morphTo(n, M.current) : z(n);
|
|
54
54
|
}, [
|
|
55
55
|
n,
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
D,
|
|
57
|
+
z
|
|
58
58
|
]), l(() => {
|
|
59
|
-
if (!
|
|
60
|
-
let e =
|
|
59
|
+
if (!D) return;
|
|
60
|
+
let e = j.current ?? z(r);
|
|
61
61
|
if (!e) return;
|
|
62
62
|
let t = s ?? 0;
|
|
63
|
-
|
|
63
|
+
R.current && R.current[0] === r && R.current[1] === i || (R.current = [r, i], L.current = !1), t <= 0 ? (e.set(r), L.current = !1) : t >= 1 ? (e.set(i), L.current = !1) : (L.current ||= (e.set(r), !0), e.seek(i, t));
|
|
64
64
|
}, [
|
|
65
|
-
|
|
65
|
+
D,
|
|
66
66
|
r,
|
|
67
67
|
i,
|
|
68
68
|
s,
|
|
69
|
-
|
|
69
|
+
z
|
|
70
70
|
]), u(t, () => ({
|
|
71
71
|
morphTo: (e, t) => {
|
|
72
|
-
|
|
73
|
-
let n =
|
|
74
|
-
n ? n.morphTo(e, t ??
|
|
72
|
+
R.current = null, L.current = !1;
|
|
73
|
+
let n = j.current;
|
|
74
|
+
n ? n.morphTo(e, t ?? M.current) : z(e);
|
|
75
75
|
},
|
|
76
76
|
set: (e) => {
|
|
77
|
-
|
|
78
|
-
let t =
|
|
79
|
-
t ? t.set(e) :
|
|
77
|
+
R.current = null, L.current = !1;
|
|
78
|
+
let t = j.current;
|
|
79
|
+
t ? t.set(e) : z(e);
|
|
80
80
|
}
|
|
81
|
-
}), [
|
|
82
|
-
let
|
|
83
|
-
return /* @__PURE__ */
|
|
81
|
+
}), [z]);
|
|
82
|
+
let B = w ? Number(C) * 24 / Number(x) : C;
|
|
83
|
+
return /* @__PURE__ */ v("svg", {
|
|
84
84
|
xmlns: "http://www.w3.org/2000/svg",
|
|
85
|
-
width:
|
|
86
|
-
height:
|
|
85
|
+
width: x,
|
|
86
|
+
height: x,
|
|
87
87
|
viewBox: "0 0 24 24",
|
|
88
88
|
fill: "none",
|
|
89
|
-
stroke:
|
|
90
|
-
strokeWidth:
|
|
89
|
+
stroke: S,
|
|
90
|
+
strokeWidth: B,
|
|
91
91
|
strokeLinecap: "round",
|
|
92
92
|
strokeLinejoin: "round",
|
|
93
|
-
role:
|
|
94
|
-
"aria-hidden": !
|
|
95
|
-
...
|
|
96
|
-
children: [
|
|
97
|
-
ref:
|
|
98
|
-
d:
|
|
93
|
+
role: T ? "img" : void 0,
|
|
94
|
+
"aria-hidden": !T || void 0,
|
|
95
|
+
...E,
|
|
96
|
+
children: [T ? /* @__PURE__ */ _("title", { children: T }) : null, /* @__PURE__ */ _("path", {
|
|
97
|
+
ref: A,
|
|
98
|
+
d: k
|
|
99
99
|
})]
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
|
-
export {
|
|
102
|
+
export { x as MorphIcon };
|
|
103
103
|
/* 欲穷千里目,更上一层楼 */
|
|
104
104
|
/* 独立思考,明辨是非 */
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@unicom-cloud/ui-common","version":"0.1.
|
|
1
|
+
{"name":"@unicom-cloud/ui-common","version":"0.1.60","dependencies":{"@unicom-cloud/utils":"^0.1.0","@unicom-cloud/icons":"^0.1.0","react-compiler-runtime":"^1.0.0"},"peerDependencies":{"dayjs":"^1.11.23","lodash":"^4.18.1","react":"^18.3.1","react-dom":"^18.3.1","react-is":"^18.3.1"},"type":"module","types":"./index.d.ts","main":"./index.js","bin":{"ui":"./test.js"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
|