@unicom-cloud/ui-common 0.1.45 → 0.1.47
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 +3 -1
- package/animation/Animation.d.ts +2 -1
- package/animation/Animation.js +30 -28
- package/animation/constants.js +3 -1
- package/animation/context.js +3 -1
- package/animation/index.d.ts +4 -0
- package/animation/index.js +5 -3
- package/animation/style/index.js +3 -1
- package/animation/utils.js +3 -1
- package/base/Base.js +3 -1
- package/base/constants.js +3 -1
- package/base/context.js +3 -1
- package/base/index.d.ts +0 -1
- package/base/index.js +3 -1
- package/base/style/index.js +3 -1
- package/base/utils.js +3 -1
- package/border-beam/BorderBeam.d.ts +8 -1
- package/border-beam/BorderBeam.js +37 -32
- package/border-beam/Effect.js +3 -1
- package/border-beam/constants.js +3 -1
- package/border-beam/context.js +3 -1
- package/border-beam/hooks/useBorderSize.js +3 -1
- package/border-beam/hooks/useChildDom.js +10 -8
- package/border-beam/index.d.ts +9 -0
- package/border-beam/index.js +4 -2
- package/border-beam/style/index.js +3 -1
- package/border-beam/utils.js +4 -2
- package/development/Development.d.ts +8 -2
- package/development/Development.js +24 -17
- package/development/constants.js +3 -1
- package/development/context.js +3 -1
- package/development/index.d.ts +9 -1
- package/development/index.js +4 -2
- package/development/style/index.js +3 -1
- package/development/utils.js +3 -1
- package/empty/Empty.d.ts +8 -2
- package/empty/Empty.js +21 -15
- package/empty/constants.js +3 -1
- package/empty/context.js +3 -1
- package/empty/index.d.ts +9 -1
- package/empty/index.js +5 -3
- package/empty/style/index.js +3 -1
- package/empty/utils.js +3 -1
- package/flex/Flex.d.ts +9 -4
- package/flex/Flex.js +45 -45
- package/flex/FlexVertical.d.ts +10 -0
- package/flex/FlexVertical.js +19 -0
- package/flex/constants.js +3 -1
- package/flex/context.js +3 -1
- package/flex/index.d.ts +20 -5
- package/flex/index.js +8 -5
- package/flex/interface.d.ts +14 -7
- package/flex/style/index.js +3 -1
- package/flex/utils.d.ts +7 -3
- package/flex/utils.js +27 -18
- package/globe/Globe.d.ts +10 -0
- package/globe/Globe.js +140 -0
- package/globe/constants.d.ts +0 -0
- package/globe/constants.js +4 -0
- package/globe/context.d.ts +3 -0
- package/globe/context.js +26 -0
- package/globe/globe.json.js +42585 -0
- package/globe/hooks/index.d.ts +0 -0
- package/globe/index.d.ts +19 -0
- package/globe/index.js +15 -0
- package/globe/interface.d.ts +46 -0
- package/globe/style/index.css +1 -0
- package/globe/style/index.d.ts +1 -0
- package/globe/style/index.js +5 -0
- package/globe/utils.d.ts +0 -0
- package/globe/utils.js +4 -0
- package/grid/Grid.d.ts +10 -0
- package/grid/Grid.js +58 -0
- package/grid/Item.d.ts +10 -0
- package/grid/Item.js +40 -0
- package/grid/constants.d.ts +0 -0
- package/grid/constants.js +4 -0
- package/grid/context.d.ts +12 -0
- package/grid/context.js +13 -0
- package/grid/hooks/index.d.ts +0 -0
- package/grid/index.d.ts +35 -0
- package/grid/index.js +18 -0
- package/grid/interface.d.ts +89 -0
- package/grid/style/index.css +1 -0
- package/grid/style/index.d.ts +1 -0
- package/grid/style/index.js +5 -0
- package/grid/utils.d.ts +3 -0
- package/grid/utils.js +26 -0
- package/higher-order/index.js +3 -1
- package/higher-order/with-speech-synthesis/context.js +5 -3
- package/higher-order/with-speech-synthesis/index.d.ts +2 -1
- package/higher-order/with-speech-synthesis/index.js +4 -2
- package/higher-order/with-speech-synthesis/style/index.js +3 -1
- package/higher-order/with-speech-synthesis/withSpeechSynthesis.js +62 -57
- package/hoc/withContext.js +3 -1
- package/hooks/create-deep-compare-effect/index.js +8 -6
- package/hooks/create-update-effect/index.js +3 -1
- package/hooks/create-use-storage-state/index.js +24 -22
- package/hooks/index.d.ts +3 -2
- package/hooks/index.js +7 -4
- package/hooks/use-async-effect/index.js +12 -10
- package/hooks/use-boolean/index.js +3 -1
- package/hooks/use-click-away/index.js +3 -1
- package/hooks/use-computed-state/index.js +3 -1
- package/hooks/use-controllable-value/index.js +34 -39
- package/hooks/use-cookie-state/index.js +14 -12
- package/hooks/use-count-down/index.js +9 -7
- package/hooks/use-counter/index.js +16 -14
- package/hooks/use-create/index.js +3 -1
- package/hooks/use-creation/index.js +3 -1
- package/hooks/use-debounce/index.js +3 -1
- package/hooks/use-debounce-effect/index.js +3 -1
- package/hooks/use-debounce-fn/index.js +11 -9
- package/hooks/use-deep-compare-effect/index.js +3 -1
- package/hooks/use-deep-compare-layout-effect/index.js +3 -1
- package/hooks/use-document-visibility/index.js +3 -1
- package/hooks/use-drag/index.js +21 -19
- package/hooks/use-drag-move/index.js +31 -29
- package/hooks/use-drop/index.js +31 -29
- package/hooks/use-effect-event/index.js +3 -1
- package/hooks/use-event/index.js +5 -3
- package/hooks/use-event-emitter/index.js +3 -1
- package/hooks/use-event-listener/index.js +3 -1
- package/hooks/use-event-target/index.js +10 -8
- package/hooks/use-external/index.js +30 -28
- package/hooks/use-favicon/index.js +3 -1
- package/hooks/use-focus-within/index.js +3 -1
- package/hooks/use-force-update/index.js +3 -1
- package/hooks/use-fullscreen/index.js +20 -18
- package/hooks/use-get-state/index.d.ts +1 -1
- package/hooks/use-get-state/index.js +3 -1
- package/hooks/use-history-travel/index.js +23 -21
- package/hooks/use-hover/index.js +3 -1
- package/hooks/use-id/index.js +7 -5
- package/hooks/use-in-viewport/index.js +17 -14
- package/hooks/use-infinite-scroll/index.js +47 -45
- package/hooks/use-intersection-observer/index.js +11 -8
- package/hooks/use-intersection-observers/index.js +22 -20
- package/hooks/use-interval/index.js +9 -7
- package/hooks/use-is-first-render/index.js +3 -1
- package/hooks/use-isomorphic-layout-effect/index.js +3 -1
- package/hooks/use-key-press/index.js +30 -28
- package/hooks/use-keyboard-event/index.js +3 -1
- package/hooks/use-latest/index.js +3 -1
- package/hooks/use-listen-window-resize/index.js +3 -1
- package/hooks/use-local-storage-state/index.js +3 -1
- package/hooks/use-lock-fn/index.js +3 -1
- package/hooks/use-long-press/index.js +3 -1
- package/hooks/use-map/index.js +3 -1
- package/hooks/use-media/index.js +13 -11
- package/hooks/use-memo/index.js +3 -1
- package/hooks/use-memoized-fn/index.js +9 -7
- package/hooks/use-merge-component-props/index.d.ts +14 -0
- package/hooks/use-merge-component-props/index.js +14 -0
- package/hooks/use-merge-value/index.js +13 -11
- package/hooks/use-mobile/index.js +3 -1
- package/hooks/use-mount/index.js +8 -6
- package/hooks/use-mouse/index.js +3 -1
- package/hooks/use-move/index.js +3 -1
- package/hooks/use-mutation-observer/index.js +3 -1
- package/hooks/use-mutation-observers/index.js +22 -20
- package/hooks/use-network/index.js +10 -8
- package/hooks/use-online-status/index.js +3 -1
- package/hooks/use-overflow-hidden/index.js +3 -1
- package/hooks/use-override-ref/index.js +3 -1
- package/hooks/use-pagination/index.js +3 -1
- package/hooks/use-paste-image/index.js +15 -13
- package/hooks/use-persist-callback/index.js +3 -1
- package/hooks/use-prefers-color-scheme-dark/index.js +3 -1
- package/hooks/use-previous/index.js +3 -1
- package/hooks/use-raf-interval/index.js +17 -15
- package/hooks/use-raf-state/index.js +3 -1
- package/hooks/use-raf-timeout/index.js +16 -14
- package/hooks/use-reactive/index.js +26 -24
- package/hooks/use-ref-latest/index.js +3 -1
- package/hooks/use-ref-map/index.d.ts +3 -0
- package/hooks/use-ref-map/index.js +14 -0
- package/hooks/use-refs/index.d.ts +1 -2
- package/hooks/use-refs/index.js +8 -12
- package/hooks/use-request/index.js +3 -1
- package/hooks/use-request/src/Fetch.js +11 -9
- package/hooks/use-request/src/plugins/useAutoRunPlugin.js +3 -1
- package/hooks/use-request/src/plugins/useCachePlugin.js +3 -1
- package/hooks/use-request/src/plugins/useDebouncePlugin.js +28 -19
- package/hooks/use-request/src/plugins/useLoadingDelayPlugin.js +3 -1
- package/hooks/use-request/src/plugins/usePollingPlugin.js +3 -1
- package/hooks/use-request/src/plugins/useRefreshOnWindowFocusPlugin.js +3 -1
- package/hooks/use-request/src/plugins/useRetryPlugin.js +3 -1
- package/hooks/use-request/src/plugins/useThrottlePlugin.js +7 -5
- package/hooks/use-request/src/useRequest.js +3 -1
- package/hooks/use-request/src/useRequestImplement.js +39 -37
- package/hooks/use-request/src/utils/cache.js +3 -1
- package/hooks/use-request/src/utils/cachePromise.js +3 -1
- package/hooks/use-request/src/utils/cacheSubscribe.js +3 -1
- package/hooks/use-request/src/utils/isDocumentVisible.js +3 -1
- package/hooks/use-request/src/utils/isOnline.js +6 -4
- package/hooks/use-request/src/utils/limit.js +3 -1
- package/hooks/use-request/src/utils/subscribeFocus.js +4 -2
- package/hooks/use-request/src/utils/subscribeReVisible.js +3 -1
- package/hooks/use-reset-state/index.js +9 -7
- package/hooks/use-resize-observer/index.js +3 -1
- package/hooks/use-resize-observers/index.js +22 -20
- package/hooks/use-responsive/index.js +3 -1
- package/hooks/use-safe-state/index.d.ts +1 -1
- package/hooks/use-safe-state/index.js +3 -1
- package/hooks/use-scroll/index.js +3 -1
- package/hooks/use-selections/index.js +21 -19
- package/hooks/use-session-storage-state/index.js +3 -1
- package/hooks/use-set/index.js +3 -1
- package/hooks/use-set-state/index.d.ts +7 -2
- package/hooks/use-set-state/index.js +15 -13
- package/hooks/use-size/index.js +22 -20
- package/hooks/use-state-callback/index.d.ts +2 -2
- package/hooks/use-state-callback/index.js +13 -11
- package/hooks/use-state-with-promise/index.js +15 -13
- package/hooks/use-sync-state/index.d.ts +1 -1
- package/hooks/use-sync-state/index.js +10 -8
- package/hooks/use-text-selection/index.js +3 -1
- package/hooks/use-theme/index.js +3 -1
- package/hooks/use-throttle/index.js +3 -1
- package/hooks/use-throttle-effect/index.js +3 -1
- package/hooks/use-throttle-fn/index.js +11 -9
- package/hooks/use-throttle-fn-with-raf/index.js +14 -12
- package/hooks/use-timeout/index.js +9 -7
- package/hooks/use-title/index.js +3 -1
- package/hooks/use-toggle/index.js +10 -8
- package/hooks/use-tracked-effect/index.js +3 -1
- package/hooks/use-unmount/index.js +10 -8
- package/hooks/use-unmounted-ref/index.js +3 -1
- package/hooks/use-update/index.js +13 -11
- package/hooks/use-update-effect/index.js +3 -1
- package/hooks/use-update-layout-effect/index.js +3 -1
- package/hooks/use-url-state/index.js +11 -9
- package/hooks/use-virtual-list/index.js +35 -33
- package/hooks/use-watch/index.js +9 -7
- package/hooks/use-web-socket/index.js +3 -1
- package/hooks/use-why-did-you-update/index.js +3 -1
- package/hooks/use-window-size/index.js +17 -15
- package/hooks/utils/createEffectWithTarget.js +3 -1
- package/hooks/utils/depsAreSame.js +3 -1
- package/hooks/utils/depsEqual.js +4 -2
- package/hooks/utils/domTarget.js +7 -5
- package/hooks/utils/getDocumentOrShadow.js +3 -1
- package/hooks/utils/index.js +3 -1
- package/hooks/utils/isAppleDevice.js +3 -1
- package/hooks/utils/isBrowser.js +3 -1
- package/hooks/utils/isDev.js +3 -1
- package/hooks/utils/rect.js +3 -1
- package/hooks/utils/useDeepCompareWithTarget.js +3 -1
- package/hooks/utils/useEffectWithTarget.js +3 -1
- package/hooks/utils/useIsomorphicLayoutEffectWithTarget.js +3 -1
- package/hooks/utils/useLayoutEffectWithTarget.js +3 -1
- package/icons/file/File.d.ts +8 -2
- package/icons/file/File.js +39 -35
- package/icons/file/context.js +5 -3
- package/icons/file/index.d.ts +9 -1
- package/icons/file/index.js +4 -2
- package/icons/file/style/index.js +3 -1
- package/index.d.ts +3 -1
- package/index.js +572 -651
- package/liquid-logo/LiquidLogo.d.ts +10 -0
- package/liquid-logo/LiquidLogo.js +122 -0
- package/liquid-logo/constants.d.ts +0 -0
- package/liquid-logo/constants.js +4 -0
- package/liquid-logo/context.d.ts +3 -0
- package/liquid-logo/context.js +17 -0
- package/liquid-logo/hooks/index.d.ts +0 -0
- package/liquid-logo/index.d.ts +21 -0
- package/liquid-logo/index.js +17 -0
- package/liquid-logo/interface.d.ts +12 -0
- package/liquid-logo/parseLogoImage.d.ts +4 -0
- package/liquid-logo/parseLogoImage.js +77 -0
- package/liquid-logo/shader.d.ts +2 -0
- package/liquid-logo/shader.js +8 -0
- package/liquid-logo/style/index.d.ts +1 -0
- package/liquid-logo/style/index.js +5 -0
- package/liquid-logo/utils.d.ts +0 -0
- package/liquid-logo/utils.js +4 -0
- package/morphicons/adapters/canvas.d.ts +43 -0
- package/morphicons/adapters/index.d.ts +3 -0
- package/morphicons/adapters/mask.d.ts +42 -0
- package/morphicons/adapters/svg.d.ts +8 -0
- package/morphicons/core/interpolate.d.ts +6 -0
- package/morphicons/core/interpolate.js +29 -0
- package/morphicons/core/normalize.d.ts +16 -0
- package/morphicons/core/normalize.js +166 -0
- package/morphicons/core/parse.d.ts +27 -0
- package/morphicons/core/parse.js +131 -0
- package/morphicons/core/plan.d.ts +64 -0
- package/morphicons/core/plan.js +198 -0
- package/morphicons/core/resample.d.ts +18 -0
- package/morphicons/core/resample.js +132 -0
- package/morphicons/core/serialize.d.ts +7 -0
- package/morphicons/core/serialize.js +32 -0
- package/morphicons/core/spring.d.ts +30 -0
- package/morphicons/core/spring.js +39 -0
- package/morphicons/core/types.d.ts +27 -0
- package/morphicons/dom/controller.d.ts +53 -0
- package/morphicons/dom/index.d.ts +46 -0
- package/morphicons/element/index.d.ts +39 -0
- package/morphicons/index.d.ts +7 -0
- package/morphicons/index.js +11 -0
- package/morphicons/react/index.d.ts +36 -0
- package/package.json +1 -1
- package/progress/Progress.js +24 -22
- package/progress/constants.js +3 -1
- package/progress/context.d.ts +0 -0
- package/progress/context.js +4 -0
- package/progress/index.js +3 -1
- package/progress/style/index.js +3 -1
- package/progress/utils.js +3 -1
- package/resize-observer/Collection.js +3 -1
- package/resize-observer/ResizeObserver.d.ts +8 -1
- package/resize-observer/ResizeObserver.js +23 -17
- package/resize-observer/SingleObserver.js +24 -19
- package/resize-observer/constants.js +3 -1
- package/resize-observer/context.js +3 -1
- package/resize-observer/index.d.ts +9 -1
- package/resize-observer/index.js +4 -2
- package/resize-observer/observerUtil.js +3 -1
- package/resize-observer/style/index.js +3 -1
- package/resize-observer/utils.js +3 -1
- package/space/Space.d.ts +9 -4
- package/space/Space.js +60 -54
- package/space/SpaceVertical.d.ts +10 -0
- package/space/SpaceVertical.js +16 -0
- package/space/constants.js +3 -1
- package/space/context.js +3 -1
- package/space/index.d.ts +18 -3
- package/space/index.js +6 -3
- package/space/interface.d.ts +3 -25
- package/space/style/index.js +3 -1
- package/space/utils.js +3 -1
- package/splash-cursor/FluidCursor.d.ts +2 -0
- package/splash-cursor/FluidCursor.js +9 -0
- package/splash-cursor/SplashCursor.d.ts +10 -0
- package/splash-cursor/SplashCursor.js +437 -0
- package/splash-cursor/constants.d.ts +0 -0
- package/splash-cursor/constants.js +4 -0
- package/splash-cursor/context.d.ts +3 -0
- package/splash-cursor/context.js +9 -0
- package/splash-cursor/hooks/index.d.ts +0 -0
- package/splash-cursor/index.d.ts +21 -0
- package/splash-cursor/index.js +16 -0
- package/splash-cursor/interface.d.ts +59 -0
- package/splash-cursor/style/index.css +1 -0
- package/splash-cursor/style/index.d.ts +1 -0
- package/splash-cursor/style/index.js +5 -0
- package/splash-cursor/utils.d.ts +2 -0
- package/splash-cursor/utils.js +25 -0
- package/style/global.less +22 -1
- package/style.css +1 -1
- package/suspense-fallback-test/SuspenseFallbackTest.d.ts +8 -1
- package/suspense-fallback-test/SuspenseFallbackTest.js +12 -6
- package/suspense-fallback-test/constants.js +3 -1
- package/suspense-fallback-test/context.js +3 -1
- package/suspense-fallback-test/index.d.ts +9 -1
- package/suspense-fallback-test/index.js +4 -2
- package/suspense-fallback-test/style/index.js +3 -1
- package/suspense-fallback-test/utils.js +3 -1
- package/test.js +3 -1
- package/timer/Timer.d.ts +8 -1
- package/timer/Timer.js +24 -19
- package/timer/constants.js +3 -1
- package/timer/context.js +3 -1
- package/timer/index.d.ts +9 -1
- package/timer/index.js +4 -2
- package/timer/style/index.js +3 -1
- package/timer/utils.js +3 -1
- package/transition/Transition.d.ts +2 -1
- package/transition/Transition.js +77 -67
- package/transition/TransitionCSS.d.ts +2 -1
- package/transition/TransitionCSS.js +28 -26
- package/transition/TransitionGroup.d.ts +2 -1
- package/transition/TransitionGroup.js +38 -36
- package/transition/TransitionStyle.d.ts +2 -1
- package/transition/TransitionStyle.js +22 -20
- package/transition/constants.js +3 -1
- package/transition/context.js +3 -1
- package/transition/index.d.ts +21 -13
- package/transition/index.js +8 -6
- package/transition/style/index.js +3 -1
- package/transition/utils.js +45 -43
- package/typewriter/Typewriter.d.ts +8 -1
- package/typewriter/Typewriter.js +26 -20
- package/typewriter/constants.js +3 -1
- package/typewriter/context.js +3 -1
- package/typewriter/index.d.ts +9 -0
- package/typewriter/index.js +4 -2
- package/typewriter/style/index.js +3 -1
- package/typewriter/utils.js +3 -1
- package/utils/callOrReturn.js +3 -1
- package/utils/callbackOriginRef.d.ts +1 -2
- package/utils/callbackOriginRef.js +3 -1
- package/utils/caseName.d.ts +1 -1
- package/utils/caseName.js +5 -3
- package/utils/className.d.ts +1 -1
- package/utils/className.js +5 -3
- package/utils/confetti.d.ts +20 -0
- package/utils/confetti.js +31 -0
- package/utils/constants.js +3 -1
- package/utils/copy.js +3 -1
- package/utils/css.js +3 -1
- package/utils/date.js +3 -1
- package/utils/dayjs.js +3 -1
- package/utils/document.js +3 -1
- package/utils/dom.d.ts +4 -4
- package/utils/dom.js +34 -31
- package/utils/emitter.js +3 -1
- package/utils/file.js +3 -1
- package/utils/fileRead.js +3 -1
- package/utils/fileToDataURL.js +3 -1
- package/utils/fillNBSP.js +4 -2
- package/utils/getCompatProp.d.ts +9 -0
- package/utils/getCompatProp.js +12 -0
- package/utils/getElement.js +16 -14
- package/utils/getHighlightText.js +20 -17
- package/utils/getHotkeyHandler.js +13 -11
- package/utils/getPrefixCls.d.ts +2 -0
- package/utils/getPrefixCls.js +11 -0
- package/utils/getScrollBarHeight.js +3 -1
- package/utils/getScrollBarSize.js +9 -7
- package/utils/getScrollBarWidth.js +3 -1
- package/utils/getScrollParent.js +3 -1
- package/utils/getStringLength.js +3 -1
- package/utils/include.js +3 -1
- package/utils/index.d.ts +6 -0
- package/utils/index.js +264 -347
- package/utils/initAllLineClamp.js +3 -1
- package/utils/intersectionObserver.js +17 -15
- package/utils/is.d.ts +2 -6
- package/utils/is.js +30 -141
- package/utils/keyboardCode.js +3 -1
- package/utils/lodash.d.ts +3 -1
- package/utils/lodash.js +75 -71
- package/utils/math.js +3 -1
- package/utils/mergeProps.d.ts +3 -1
- package/utils/mergeProps.js +15 -8
- package/utils/mergedToString.js +14 -11
- package/utils/migrateLegacyProps.d.ts +14 -0
- package/utils/migrateLegacyProps.js +19 -0
- package/utils/mutationObserver.js +15 -13
- package/utils/names.d.ts +31 -19
- package/utils/names.js +63 -31
- package/utils/object.js +3 -1
- package/utils/omit.js +3 -1
- package/utils/pad.js +3 -1
- package/utils/pick.d.ts +7 -2
- package/utils/pick.js +11 -9
- package/utils/pinyin.js +3 -1
- package/utils/react19Adapter.js +3 -1
- package/utils/reactNode.js +11 -9
- package/utils/ref.js +23 -19
- package/utils/resizeObserver.js +7 -5
- package/utils/saveAs.js +3 -1
- package/utils/screenfull.js +3 -1
- package/utils/scrollIntoViewIfNeeded.js +3 -1
- package/utils/scrollTo.js +7 -5
- package/utils/setCreateRoot.js +14 -11
- package/utils/setDarkTheme.js +16 -14
- package/utils/setDir.js +7 -5
- package/utils/setPrimaryColor.js +4 -2
- package/utils/setTheme.js +14 -12
- package/utils/string.js +3 -1
- package/utils/style.js +3 -1
- package/utils/tinycolor.js +3 -1
- package/utils/toArray.js +7 -5
- package/utils/tree.js +3 -1
- package/utils/tunnel.d.ts +6 -5
- package/utils/tunnel.js +22 -20
- package/utils/tween.js +3 -1
- package/utils/uuid.js +3 -1
- package/utils/validate.js +3 -1
- package/utils/warning.js +3 -1
- package/version/index.d.ts +0 -1
- package/version/index.js +10 -8
- package/hooks/use-merge-props/index.d.ts +0 -5
- package/hooks/use-merge-props/index.js +0 -10
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LiquidLogoProps } from './interface';
|
|
2
|
+
declare const LiquidLogo: import("react").ForwardRefExoticComponent<LiquidLogoProps & import("react").RefAttributes<unknown>> & {
|
|
3
|
+
zh: string;
|
|
4
|
+
en: string;
|
|
5
|
+
displayName: string;
|
|
6
|
+
id: string;
|
|
7
|
+
legacy?: string;
|
|
8
|
+
descriptions?: string;
|
|
9
|
+
};
|
|
10
|
+
export default LiquidLogo;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/* 潘启宝 2026-09-03 10:06:59 星期四 山东省济南市 */
|
|
2
|
+
/* 世界因你而美丽 */
|
|
3
|
+
import { noop as e } from "../utils/lodash.js";
|
|
4
|
+
import t from "../hooks/use-merge-component-props/index.js";
|
|
5
|
+
import { cs as n } from "../utils/className.js";
|
|
6
|
+
import r from "../utils/getPrefixCls.js";
|
|
7
|
+
import { COMPONENT_INFO_LIQUID_LOGO as i } from "../utils/names.js";
|
|
8
|
+
import "../utils/index.js";
|
|
9
|
+
import { PropsContext as a, defaultProps as o } from "./context.js";
|
|
10
|
+
import { parseLogoImage as s } from "./parseLogoImage.js";
|
|
11
|
+
import { liquidFragSource as c, vertexShaderSource as l } from "./shader.js";
|
|
12
|
+
import { forwardRef as u, useContext as d, useEffect as f, useImperativeHandle as p, useRef as m } from "react";
|
|
13
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
14
|
+
//#region components/common/liquid-logo/LiquidLogo.tsx
|
|
15
|
+
function g(i, u) {
|
|
16
|
+
let g = d(a), _ = r("liquid-logo"), v = t({
|
|
17
|
+
internalProps: i,
|
|
18
|
+
contextProps: g,
|
|
19
|
+
globalProps: {},
|
|
20
|
+
defaultProps: o
|
|
21
|
+
}, !0), { style: y, className: b } = v, x = m(null), S = m(null), C = m({}), w = m(0), T = m(0), E = m(null), D = m(!1), O = m(0), k = m(e);
|
|
22
|
+
function A() {
|
|
23
|
+
!S.current || !C.current || (S.current.uniform1f(C.current.u_edge, v.edge), S.current.uniform1f(C.current.u_patternBlur, v.patternBlur), S.current.uniform1f(C.current.u_time, 0), S.current.uniform1f(C.current.u_patternScale, v.patternScale), S.current.uniform1f(C.current.u_refraction, v.refraction), S.current.uniform1f(C.current.u_liquid, v.liquid));
|
|
24
|
+
}
|
|
25
|
+
function j() {
|
|
26
|
+
let e = E.current, t = e?.getContext("webgl2", {
|
|
27
|
+
antialias: !0,
|
|
28
|
+
alpha: !0
|
|
29
|
+
});
|
|
30
|
+
if (!e || !t) return;
|
|
31
|
+
t.enable(t.BLEND), t.blendFunc(t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA);
|
|
32
|
+
function n(e, t, n) {
|
|
33
|
+
let r = e.createShader(n);
|
|
34
|
+
return r ? (e.shaderSource(r, t), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (e.deleteShader(r), null)) : null;
|
|
35
|
+
}
|
|
36
|
+
let r = n(t, l, t.VERTEX_SHADER), i = n(t, c, t.FRAGMENT_SHADER), a = t.createProgram();
|
|
37
|
+
if (!a || !r || !i) return;
|
|
38
|
+
if (t.attachShader(a, r), t.attachShader(a, i), t.linkProgram(a), !t.getProgramParameter(a, t.LINK_STATUS)) return null;
|
|
39
|
+
function o(e, t) {
|
|
40
|
+
let n = {}, r = t.getProgramParameter(e, t.ACTIVE_UNIFORMS);
|
|
41
|
+
for (let i = 0; i < r; i++) {
|
|
42
|
+
let r = t.getActiveUniform(e, i)?.name;
|
|
43
|
+
r && (n[r] = t.getUniformLocation(e, r));
|
|
44
|
+
}
|
|
45
|
+
return n;
|
|
46
|
+
}
|
|
47
|
+
let s = o(a, t);
|
|
48
|
+
C.current = s;
|
|
49
|
+
let u = new Float32Array([
|
|
50
|
+
-1,
|
|
51
|
+
-1,
|
|
52
|
+
1,
|
|
53
|
+
-1,
|
|
54
|
+
-1,
|
|
55
|
+
1,
|
|
56
|
+
1,
|
|
57
|
+
1
|
|
58
|
+
]), d = t.createBuffer();
|
|
59
|
+
t.bindBuffer(t.ARRAY_BUFFER, d), t.bufferData(t.ARRAY_BUFFER, u, t.STATIC_DRAW), t.useProgram(a);
|
|
60
|
+
let f = t.getAttribLocation(a, "a_position");
|
|
61
|
+
t.enableVertexAttribArray(f), t.bindBuffer(t.ARRAY_BUFFER, d), t.vertexAttribPointer(f, 2, t.FLOAT, !1, 0, 0), S.current = t;
|
|
62
|
+
}
|
|
63
|
+
function M(e) {
|
|
64
|
+
let t = e - T.current;
|
|
65
|
+
T.current = e, w.current += t * v.speed, S.current.uniform1f(C.current.u_time, w.current), S.current.drawArrays(S.current.TRIANGLE_STRIP, 0, 4), O.current = requestAnimationFrame(M);
|
|
66
|
+
}
|
|
67
|
+
function N() {
|
|
68
|
+
return T.current = performance.now(), O.current = requestAnimationFrame(M), () => {
|
|
69
|
+
cancelAnimationFrame(O.current);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function P() {
|
|
73
|
+
let e = E.current, t = S.current;
|
|
74
|
+
if (!e || !t || !C.current) return;
|
|
75
|
+
let n = x.current ? x.current.width / x.current.height : 1;
|
|
76
|
+
t.uniform1f(C.current.u_img_ratio, n);
|
|
77
|
+
let r = 1e3;
|
|
78
|
+
e.width = r * devicePixelRatio, e.height = r * devicePixelRatio, t.viewport(0, 0, e.height, e.height), t.uniform1f(C.current.u_ratio, 1), t.uniform1f(C.current.u_img_ratio, n);
|
|
79
|
+
}
|
|
80
|
+
async function F() {
|
|
81
|
+
try {
|
|
82
|
+
let { imageData: e } = await s(v.imageUrl);
|
|
83
|
+
x.current = e;
|
|
84
|
+
} catch {}
|
|
85
|
+
}
|
|
86
|
+
async function I() {
|
|
87
|
+
let e = S.current;
|
|
88
|
+
if (!e || !C.current || !x.current) return;
|
|
89
|
+
let t = e.getParameter(e.TEXTURE_BINDING_2D);
|
|
90
|
+
t && e.deleteTexture(t);
|
|
91
|
+
let n = e.createTexture();
|
|
92
|
+
e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_2D, n), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.pixelStorei(e.UNPACK_ALIGNMENT, 1);
|
|
93
|
+
try {
|
|
94
|
+
e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, x.current.width, x.current.height, 0, e.RGBA, e.UNSIGNED_BYTE, x.current.data), e.uniform1i(C.current.u_image_texture, 0);
|
|
95
|
+
} catch {}
|
|
96
|
+
return () => {
|
|
97
|
+
n && e.deleteTexture(n);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return f(() => (D.current = !0, F().then((e) => (j(), A(), I())).then((e) => {
|
|
101
|
+
k.current = e, D.current = !1, window.addEventListener("resize", P), P(), N();
|
|
102
|
+
}), () => {
|
|
103
|
+
window.removeEventListener("resize", P), cancelAnimationFrame(O.current), k.current && k.current();
|
|
104
|
+
}), []), f(() => (A(), () => {}), [
|
|
105
|
+
v.edge,
|
|
106
|
+
v.patternBlur,
|
|
107
|
+
v.patternScale,
|
|
108
|
+
v.refraction,
|
|
109
|
+
v.liquid
|
|
110
|
+
]), p(u, () => ({ getRootElement() {
|
|
111
|
+
return E.current;
|
|
112
|
+
} })), /* @__PURE__ */ h("canvas", {
|
|
113
|
+
ref: E,
|
|
114
|
+
style: { ...y },
|
|
115
|
+
className: n(_, D ? "hidden" : "", b)
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
var _ = Object.assign(u(g), { ...i });
|
|
119
|
+
//#endregion
|
|
120
|
+
export { _ as default };
|
|
121
|
+
/* 欲穷千里目,更上一层楼 */
|
|
122
|
+
/* 独立思考,明辨是非 */
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* 潘启宝 2026-09-03 10:06:59 星期四 山东省济南市 */
|
|
2
|
+
/* 世界因你而美丽 */
|
|
3
|
+
import { createContext as e } from "react";
|
|
4
|
+
//#region components/common/liquid-logo/context.ts
|
|
5
|
+
var t = {
|
|
6
|
+
refraction: .015,
|
|
7
|
+
edge: .4,
|
|
8
|
+
patternScale: 2,
|
|
9
|
+
patternBlur: .005,
|
|
10
|
+
liquid: .07,
|
|
11
|
+
speed: .3,
|
|
12
|
+
showProcessing: !0
|
|
13
|
+
}, n = e({});
|
|
14
|
+
//#endregion
|
|
15
|
+
export { n as PropsContext, t as defaultProps };
|
|
16
|
+
/* 欲穷千里目,更上一层楼 */
|
|
17
|
+
/* 独立思考,明辨是非 */
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import './style';
|
|
2
|
+
declare const LiquidLogo: import("react").ForwardRefExoticComponent<import("./interface").LiquidLogoProps & import("react").RefAttributes<unknown>> & {
|
|
3
|
+
zh: string;
|
|
4
|
+
en: string;
|
|
5
|
+
displayName: string;
|
|
6
|
+
id: string;
|
|
7
|
+
legacy?: string;
|
|
8
|
+
descriptions?: string;
|
|
9
|
+
} & {
|
|
10
|
+
PropsContext: import("react").Context<Partial<import("./interface").LiquidLogoProps>>;
|
|
11
|
+
zh: string;
|
|
12
|
+
en: string;
|
|
13
|
+
displayName: string;
|
|
14
|
+
id: string;
|
|
15
|
+
legacy?: string;
|
|
16
|
+
descriptions?: string;
|
|
17
|
+
};
|
|
18
|
+
export default LiquidLogo;
|
|
19
|
+
export type * from './interface';
|
|
20
|
+
export * from './parseLogoImage';
|
|
21
|
+
export * from './shader';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* 潘启宝 2026-09-03 10:06:59 星期四 山东省济南市 */
|
|
2
|
+
/* 世界因你而美丽 */
|
|
3
|
+
import { COMPONENT_INFO_LIQUID_LOGO as e } from "../utils/names.js";
|
|
4
|
+
import { PropsContext as t } from "./context.js";
|
|
5
|
+
import { parseLogoImage as n } from "./parseLogoImage.js";
|
|
6
|
+
import { liquidFragSource as r, vertexShaderSource as i } from "./shader.js";
|
|
7
|
+
import a from "./LiquidLogo.js";
|
|
8
|
+
import "./style/index.js";
|
|
9
|
+
//#region components/common/liquid-logo/index.ts
|
|
10
|
+
var o = Object.assign(a, {
|
|
11
|
+
...e,
|
|
12
|
+
PropsContext: t
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
export { o as default, r as liquidFragSource, n as parseLogoImage, i as vertexShaderSource };
|
|
16
|
+
/* 欲穷千里目,更上一层楼 */
|
|
17
|
+
/* 独立思考,明辨是非 */
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
export interface LiquidLogoProps extends HTMLAttributes<HTMLCanvasElement> {
|
|
3
|
+
className?: string;
|
|
4
|
+
imageUrl: string;
|
|
5
|
+
patternScale?: number;
|
|
6
|
+
refraction?: number;
|
|
7
|
+
edge?: number;
|
|
8
|
+
patternBlur?: number;
|
|
9
|
+
liquid?: number;
|
|
10
|
+
speed?: number;
|
|
11
|
+
showProcessing?: boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/* 潘启宝 2026-09-03 10:06:59 星期四 山东省济南市 */
|
|
2
|
+
/* 世界因你而美丽 */
|
|
3
|
+
//#region components/common/liquid-logo/parseLogoImage.ts
|
|
4
|
+
function e(e) {
|
|
5
|
+
let t = document.createElement("canvas"), n = t.getContext("2d");
|
|
6
|
+
return new Promise((r, i) => {
|
|
7
|
+
if (!e || !n) {
|
|
8
|
+
i(/* @__PURE__ */ Error("Invalid image URL or context"));
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
let a = new Image();
|
|
12
|
+
a.crossOrigin = "anonymous", a.onload = function() {
|
|
13
|
+
let e = 1e3, o = a.naturalWidth, s = a.naturalHeight;
|
|
14
|
+
(o > e || s > e || o < 500 || s < 500) && (o > s ? o > e ? (s = Math.round(s * e / o), o = e) : o < 500 && (s = Math.round(s * 500 / o), o = 500) : s > e ? (o = Math.round(o * e / s), s = e) : s < 500 && (o = Math.round(o * 500 / s), s = 500)), t.width = o, t.height = s;
|
|
15
|
+
let c = document.createElement("canvas");
|
|
16
|
+
c.width = o, c.height = s;
|
|
17
|
+
let l = c.getContext("2d");
|
|
18
|
+
l.drawImage(a, 0, 0, o, s);
|
|
19
|
+
let u = l.getImageData(0, 0, o, s).data, d = Array(o * s).fill(!1);
|
|
20
|
+
for (let e = 0; e < s; e++) for (let t = 0; t < o; t++) {
|
|
21
|
+
let n = (e * o + t) * 4, r = u[n], i = u[n + 1], a = u[n + 2], s = u[n + 3];
|
|
22
|
+
d[e * o + t] = !(r === 255 && i === 255 && a === 255 && s === 255 || s === 0);
|
|
23
|
+
}
|
|
24
|
+
function f(e, t) {
|
|
25
|
+
return e < 0 || e >= o || t < 0 || t >= s ? !1 : d[t * o + e];
|
|
26
|
+
}
|
|
27
|
+
let p = Array(o * s).fill(!1);
|
|
28
|
+
for (let e = 0; e < s; e++) for (let t = 0; t < o; t++) {
|
|
29
|
+
let n = e * o + t;
|
|
30
|
+
if (!d[n]) continue;
|
|
31
|
+
let r = !1;
|
|
32
|
+
for (let n = e - 1; n <= e + 1 && !r; n++) for (let e = t - 1; e <= t + 1 && !r; e++) f(e, n) || (r = !0);
|
|
33
|
+
r && (p[n] = !0);
|
|
34
|
+
}
|
|
35
|
+
let m = new Float32Array(o * s).fill(0), h = new Float32Array(o * s).fill(0);
|
|
36
|
+
function g(e, t, n) {
|
|
37
|
+
return e < 0 || e >= o || t < 0 || t >= s || !d[t * o + e] ? 0 : n[t * o + e];
|
|
38
|
+
}
|
|
39
|
+
for (let e = 0; e < 300; e++) {
|
|
40
|
+
for (let e = 0; e < s; e++) for (let t = 0; t < o; t++) {
|
|
41
|
+
let n = e * o + t;
|
|
42
|
+
if (!d[n] || p[n]) {
|
|
43
|
+
h[n] = 0;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
h[n] = (.01 + (g(t + 1, e, m) + g(t - 1, e, m) + g(t, e + 1, m) + g(t, e - 1, m))) / 4;
|
|
47
|
+
}
|
|
48
|
+
m.set(h);
|
|
49
|
+
}
|
|
50
|
+
let _ = 0;
|
|
51
|
+
for (let e = 0; e < o * s; e++) m[e] > _ && (_ = m[e]);
|
|
52
|
+
let v = n.createImageData(o, s);
|
|
53
|
+
for (let e = 0; e < s; e++) for (let t = 0; t < o; t++) {
|
|
54
|
+
let n = e * o + t, r = n * 4;
|
|
55
|
+
if (!d[n]) v.data[r] = 255, v.data[r + 1] = 255, v.data[r + 2] = 255, v.data[r + 3] = 255;
|
|
56
|
+
else {
|
|
57
|
+
let e = 255 * (1 - (m[n] / _) ** 2);
|
|
58
|
+
v.data[r] = e, v.data[r + 1] = e, v.data[r + 2] = e, v.data[r + 3] = 255;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
n.putImageData(v, 0, 0), t.toBlob((e) => {
|
|
62
|
+
if (!e) {
|
|
63
|
+
i(/* @__PURE__ */ Error("Failed to create PNG blob"));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
r({
|
|
67
|
+
imageData: v,
|
|
68
|
+
pngBlob: e
|
|
69
|
+
});
|
|
70
|
+
}, "image/png");
|
|
71
|
+
}, a.onerror = () => i(/* @__PURE__ */ Error("Failed to load image")), a.src = e;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { e as parseLogoImage };
|
|
76
|
+
/* 欲穷千里目,更上一层楼 */
|
|
77
|
+
/* 独立思考,明辨是非 */
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const vertexShaderSource = "#version 300 es\nprecision mediump float;\n\nin vec2 a_position;\nout vec2 vUv;\n\nvoid main() {\n vUv = .5 * (a_position + 1.);\n gl_Position = vec4(a_position, 0.0, 1.0);\n}";
|
|
2
|
+
export declare const liquidFragSource = "#version 300 es\nprecision mediump float;\n\nin vec2 vUv;\nout vec4 fragColor;\n\nuniform sampler2D u_image_texture;\nuniform float u_time;\nuniform float u_ratio;\nuniform float u_img_ratio;\nuniform float u_patternScale;\nuniform float u_refraction;\nuniform float u_edge;\nuniform float u_patternBlur;\nuniform float u_liquid;\n\n\n#define TWO_PI 6.28318530718\n#define PI 3.14159265358979323846\n\n\nvec3 mod289(vec3 x) { return x - floor(x * (1. / 289.)) * 289.; }\nvec2 mod289(vec2 x) { return x - floor(x * (1. / 289.)) * 289.; }\nvec3 permute(vec3 x) { return mod289(((x*34.)+1.)*x); }\nfloat snoise(vec2 v) {\n const vec4 C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439);\n vec2 i = floor(v + dot(v, C.yy));\n vec2 x0 = v - i + dot(i, C.xx);\n vec2 i1;\n i1 = (x0.x > x0.y) ? vec2(1., 0.) : vec2(0., 1.);\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n i = mod289(i);\n vec3 p = permute(permute(i.y + vec3(0., i1.y, 1.)) + i.x + vec3(0., i1.x, 1.));\n vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.);\n m = m*m;\n m = m*m;\n vec3 x = 2. * fract(p * C.www) - 1.;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n m *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130. * dot(m, g);\n}\n\nvec2 get_img_uv() {\n vec2 img_uv = vUv;\n img_uv -= .5;\n if (u_ratio > u_img_ratio) {\n img_uv.x = img_uv.x * u_ratio / u_img_ratio;\n } else {\n img_uv.y = img_uv.y * u_img_ratio / u_ratio;\n }\n float scale_factor = 1.;\n img_uv *= scale_factor;\n img_uv += .5;\n\n img_uv.y = 1. - img_uv.y;\n\n return img_uv;\n}\nvec2 rotate(vec2 uv, float th) {\n return mat2(cos(th), sin(th), -sin(th), cos(th)) * uv;\n}\nfloat get_color_channel(float c1, float c2, float stripe_p, vec3 w, float extra_blur, float b) {\n float ch = c2;\n float border = 0.;\n float blur = u_patternBlur + extra_blur;\n\n ch = mix(ch, c1, smoothstep(.0, blur, stripe_p));\n\n border = w[0];\n ch = mix(ch, c2, smoothstep(border - blur, border + blur, stripe_p));\n\n b = smoothstep(.2, .8, b);\n border = w[0] + .4 * (1. - b) * w[1];\n ch = mix(ch, c1, smoothstep(border - blur, border + blur, stripe_p));\n\n border = w[0] + .5 * (1. - b) * w[1];\n ch = mix(ch, c2, smoothstep(border - blur, border + blur, stripe_p));\n\n border = w[0] + w[1];\n ch = mix(ch, c1, smoothstep(border - blur, border + blur, stripe_p));\n\n float gradient_t = (stripe_p - w[0] - w[1]) / w[2];\n float gradient = mix(c1, c2, smoothstep(0., 1., gradient_t));\n ch = mix(ch, gradient, smoothstep(border - blur, border + blur, stripe_p));\n\n return ch;\n}\n\nfloat get_img_frame_alpha(vec2 uv, float img_frame_width) {\n float img_frame_alpha = smoothstep(0., img_frame_width, uv.x) * smoothstep(1., 1. - img_frame_width, uv.x);\n img_frame_alpha *= smoothstep(0., img_frame_width, uv.y) * smoothstep(1., 1. - img_frame_width, uv.y);\n return img_frame_alpha;\n}\n\nvoid main() {\n vec2 uv = vUv;\n uv.y = 1. - uv.y;\n uv.x *= u_ratio;\n\n float diagonal = uv.x - uv.y;\n\n float t = .001 * u_time;\n\n vec2 img_uv = get_img_uv();\n vec4 img = texture(u_image_texture, img_uv);\n\n vec3 color = vec3(0.);\n float opacity = 1.;\n\n vec3 color1 = vec3(.98, 0.98, 1.);\n vec3 color2 = vec3(.1, .1, .1 + .1 * smoothstep(.7, 1.3, uv.x + uv.y));\n\n float edge = img.r;\n\n\n vec2 grad_uv = uv;\n grad_uv -= .5;\n\n float dist = length(grad_uv + vec2(0., .2 * diagonal));\n\n grad_uv = rotate(grad_uv, (.25 - .2 * diagonal) * PI);\n\n float bulge = pow(1.8 * dist, 1.2);\n bulge = 1. - bulge;\n bulge *= pow(uv.y, .3);\n\n\n float cycle_width = u_patternScale;\n float thin_strip_1_ratio = .12 / cycle_width * (1. - .4 * bulge);\n float thin_strip_2_ratio = .07 / cycle_width * (1. + .4 * bulge);\n float wide_strip_ratio = (1. - thin_strip_1_ratio - thin_strip_2_ratio);\n\n float thin_strip_1_width = cycle_width * thin_strip_1_ratio;\n float thin_strip_2_width = cycle_width * thin_strip_2_ratio;\n\n opacity = 1. - smoothstep(.9 - .5 * u_edge, 1. - .5 * u_edge, edge);\n opacity *= get_img_frame_alpha(img_uv, 0.01);\n\n\n float noise = snoise(uv - t);\n\n edge += (1. - edge) * u_liquid * noise;\n\n float refr = 0.;\n refr += (1. - bulge);\n refr = clamp(refr, 0., 1.);\n\n float dir = grad_uv.x;\n\n\n dir += diagonal;\n\n dir -= 2. * noise * diagonal * (smoothstep(0., 1., edge) * smoothstep(1., 0., edge));\n\n bulge *= clamp(pow(uv.y, .1), .3, 1.);\n dir *= (.1 + (1.1 - edge) * bulge);\n\n dir *= smoothstep(1., .7, edge);\n\n dir += .18 * (smoothstep(.1, .2, uv.y) * smoothstep(.4, .2, uv.y));\n dir += .03 * (smoothstep(.1, .2, 1. - uv.y) * smoothstep(.4, .2, 1. - uv.y));\n\n dir *= (.5 + .5 * pow(uv.y, 2.));\n\n dir *= cycle_width;\n\n dir -= t;\n\n float refr_r = refr;\n refr_r += .03 * bulge * noise;\n float refr_b = 1.3 * refr;\n\n refr_r += 5. * (smoothstep(-.1, .2, uv.y) * smoothstep(.5, .1, uv.y)) * (smoothstep(.4, .6, bulge) * smoothstep(1., .4, bulge));\n refr_r -= diagonal;\n\n refr_b += (smoothstep(0., .4, uv.y) * smoothstep(.8, .1, uv.y)) * (smoothstep(.4, .6, bulge) * smoothstep(.8, .4, bulge));\n refr_b -= .2 * edge;\n\n refr_r *= u_refraction;\n refr_b *= u_refraction;\n\n vec3 w = vec3(thin_strip_1_width, thin_strip_2_width, wide_strip_ratio);\n w[1] -= .02 * smoothstep(.0, 1., edge + bulge);\n float stripe_r = mod(dir + refr_r, 1.);\n float r = get_color_channel(color1.r, color2.r, stripe_r, w, 0.02 + .03 * u_refraction * bulge, bulge);\n float stripe_g = mod(dir, 1.);\n float g = get_color_channel(color1.g, color2.g, stripe_g, w, 0.01 / (1. - diagonal), bulge);\n float stripe_b = mod(dir - refr_b, 1.);\n float b = get_color_channel(color1.b, color2.b, stripe_b, w, .01, bulge);\n\n color = vec3(r, g, b);\n\n color *= opacity;\n\n fragColor = vec4(color, opacity);\n}\n";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* 潘启宝 2026-09-03 10:06:59 星期四 山东省济南市 */
|
|
2
|
+
/* 世界因你而美丽 */
|
|
3
|
+
//#region components/common/liquid-logo/shader.ts
|
|
4
|
+
var e = "#version 300 es\nprecision mediump float;\n\nin vec2 a_position;\nout vec2 vUv;\n\nvoid main() {\n vUv = .5 * (a_position + 1.);\n gl_Position = vec4(a_position, 0.0, 1.0);\n}", t = "#version 300 es\nprecision mediump float;\n\nin vec2 vUv;\nout vec4 fragColor;\n\nuniform sampler2D u_image_texture;\nuniform float u_time;\nuniform float u_ratio;\nuniform float u_img_ratio;\nuniform float u_patternScale;\nuniform float u_refraction;\nuniform float u_edge;\nuniform float u_patternBlur;\nuniform float u_liquid;\n\n\n#define TWO_PI 6.28318530718\n#define PI 3.14159265358979323846\n\n\nvec3 mod289(vec3 x) { return x - floor(x * (1. / 289.)) * 289.; }\nvec2 mod289(vec2 x) { return x - floor(x * (1. / 289.)) * 289.; }\nvec3 permute(vec3 x) { return mod289(((x*34.)+1.)*x); }\nfloat snoise(vec2 v) {\n const vec4 C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439);\n vec2 i = floor(v + dot(v, C.yy));\n vec2 x0 = v - i + dot(i, C.xx);\n vec2 i1;\n i1 = (x0.x > x0.y) ? vec2(1., 0.) : vec2(0., 1.);\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n i = mod289(i);\n vec3 p = permute(permute(i.y + vec3(0., i1.y, 1.)) + i.x + vec3(0., i1.x, 1.));\n vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.);\n m = m*m;\n m = m*m;\n vec3 x = 2. * fract(p * C.www) - 1.;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n m *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130. * dot(m, g);\n}\n\nvec2 get_img_uv() {\n vec2 img_uv = vUv;\n img_uv -= .5;\n if (u_ratio > u_img_ratio) {\n img_uv.x = img_uv.x * u_ratio / u_img_ratio;\n } else {\n img_uv.y = img_uv.y * u_img_ratio / u_ratio;\n }\n float scale_factor = 1.;\n img_uv *= scale_factor;\n img_uv += .5;\n\n img_uv.y = 1. - img_uv.y;\n\n return img_uv;\n}\nvec2 rotate(vec2 uv, float th) {\n return mat2(cos(th), sin(th), -sin(th), cos(th)) * uv;\n}\nfloat get_color_channel(float c1, float c2, float stripe_p, vec3 w, float extra_blur, float b) {\n float ch = c2;\n float border = 0.;\n float blur = u_patternBlur + extra_blur;\n\n ch = mix(ch, c1, smoothstep(.0, blur, stripe_p));\n\n border = w[0];\n ch = mix(ch, c2, smoothstep(border - blur, border + blur, stripe_p));\n\n b = smoothstep(.2, .8, b);\n border = w[0] + .4 * (1. - b) * w[1];\n ch = mix(ch, c1, smoothstep(border - blur, border + blur, stripe_p));\n\n border = w[0] + .5 * (1. - b) * w[1];\n ch = mix(ch, c2, smoothstep(border - blur, border + blur, stripe_p));\n\n border = w[0] + w[1];\n ch = mix(ch, c1, smoothstep(border - blur, border + blur, stripe_p));\n\n float gradient_t = (stripe_p - w[0] - w[1]) / w[2];\n float gradient = mix(c1, c2, smoothstep(0., 1., gradient_t));\n ch = mix(ch, gradient, smoothstep(border - blur, border + blur, stripe_p));\n\n return ch;\n}\n\nfloat get_img_frame_alpha(vec2 uv, float img_frame_width) {\n float img_frame_alpha = smoothstep(0., img_frame_width, uv.x) * smoothstep(1., 1. - img_frame_width, uv.x);\n img_frame_alpha *= smoothstep(0., img_frame_width, uv.y) * smoothstep(1., 1. - img_frame_width, uv.y);\n return img_frame_alpha;\n}\n\nvoid main() {\n vec2 uv = vUv;\n uv.y = 1. - uv.y;\n uv.x *= u_ratio;\n\n float diagonal = uv.x - uv.y;\n\n float t = .001 * u_time;\n\n vec2 img_uv = get_img_uv();\n vec4 img = texture(u_image_texture, img_uv);\n\n vec3 color = vec3(0.);\n float opacity = 1.;\n\n vec3 color1 = vec3(.98, 0.98, 1.);\n vec3 color2 = vec3(.1, .1, .1 + .1 * smoothstep(.7, 1.3, uv.x + uv.y));\n\n float edge = img.r;\n\n\n vec2 grad_uv = uv;\n grad_uv -= .5;\n\n float dist = length(grad_uv + vec2(0., .2 * diagonal));\n\n grad_uv = rotate(grad_uv, (.25 - .2 * diagonal) * PI);\n\n float bulge = pow(1.8 * dist, 1.2);\n bulge = 1. - bulge;\n bulge *= pow(uv.y, .3);\n\n\n float cycle_width = u_patternScale;\n float thin_strip_1_ratio = .12 / cycle_width * (1. - .4 * bulge);\n float thin_strip_2_ratio = .07 / cycle_width * (1. + .4 * bulge);\n float wide_strip_ratio = (1. - thin_strip_1_ratio - thin_strip_2_ratio);\n\n float thin_strip_1_width = cycle_width * thin_strip_1_ratio;\n float thin_strip_2_width = cycle_width * thin_strip_2_ratio;\n\n opacity = 1. - smoothstep(.9 - .5 * u_edge, 1. - .5 * u_edge, edge);\n opacity *= get_img_frame_alpha(img_uv, 0.01);\n\n\n float noise = snoise(uv - t);\n\n edge += (1. - edge) * u_liquid * noise;\n\n float refr = 0.;\n refr += (1. - bulge);\n refr = clamp(refr, 0., 1.);\n\n float dir = grad_uv.x;\n\n\n dir += diagonal;\n\n dir -= 2. * noise * diagonal * (smoothstep(0., 1., edge) * smoothstep(1., 0., edge));\n\n bulge *= clamp(pow(uv.y, .1), .3, 1.);\n dir *= (.1 + (1.1 - edge) * bulge);\n\n dir *= smoothstep(1., .7, edge);\n\n dir += .18 * (smoothstep(.1, .2, uv.y) * smoothstep(.4, .2, uv.y));\n dir += .03 * (smoothstep(.1, .2, 1. - uv.y) * smoothstep(.4, .2, 1. - uv.y));\n\n dir *= (.5 + .5 * pow(uv.y, 2.));\n\n dir *= cycle_width;\n\n dir -= t;\n\n float refr_r = refr;\n refr_r += .03 * bulge * noise;\n float refr_b = 1.3 * refr;\n\n refr_r += 5. * (smoothstep(-.1, .2, uv.y) * smoothstep(.5, .1, uv.y)) * (smoothstep(.4, .6, bulge) * smoothstep(1., .4, bulge));\n refr_r -= diagonal;\n\n refr_b += (smoothstep(0., .4, uv.y) * smoothstep(.8, .1, uv.y)) * (smoothstep(.4, .6, bulge) * smoothstep(.8, .4, bulge));\n refr_b -= .2 * edge;\n\n refr_r *= u_refraction;\n refr_b *= u_refraction;\n\n vec3 w = vec3(thin_strip_1_width, thin_strip_2_width, wide_strip_ratio);\n w[1] -= .02 * smoothstep(.0, 1., edge + bulge);\n float stripe_r = mod(dir + refr_r, 1.);\n float r = get_color_channel(color1.r, color2.r, stripe_r, w, 0.02 + .03 * u_refraction * bulge, bulge);\n float stripe_g = mod(dir, 1.);\n float g = get_color_channel(color1.g, color2.g, stripe_g, w, 0.01 / (1. - diagonal), bulge);\n float stripe_b = mod(dir - refr_b, 1.);\n float b = get_color_channel(color1.b, color2.b, stripe_b, w, .01, bulge);\n\n color = vec3(r, g, b);\n\n color *= opacity;\n\n fragColor = vec4(color, opacity);\n}\n";
|
|
5
|
+
//#endregion
|
|
6
|
+
export { t as liquidFragSource, e as vertexShaderSource };
|
|
7
|
+
/* 欲穷千里目,更上一层楼 */
|
|
8
|
+
/* 独立思考,明辨是非 */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { PathEl } from '../dom/index';
|
|
2
|
+
/** The 2D context surface the target drives — structural, so a real
|
|
3
|
+
* CanvasRenderingContext2D, an OffscreenCanvasRenderingContext2D or a test
|
|
4
|
+
* fake all satisfy it. Only what canvasTarget actually touches. */
|
|
5
|
+
export interface Canvas2DContext {
|
|
6
|
+
canvas: {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
};
|
|
10
|
+
lineWidth: number;
|
|
11
|
+
lineCap: string;
|
|
12
|
+
lineJoin: string;
|
|
13
|
+
strokeStyle: string | object;
|
|
14
|
+
setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
15
|
+
clearRect(x: number, y: number, w: number, h: number): void;
|
|
16
|
+
stroke(path: object): void;
|
|
17
|
+
}
|
|
18
|
+
/** Anything that can hand out a 2D context (an HTMLCanvasElement, an
|
|
19
|
+
* OffscreenCanvas, or a fake in tests). */
|
|
20
|
+
export interface CanvasSurface {
|
|
21
|
+
getContext(contextId: '2d'): Canvas2DContext | null;
|
|
22
|
+
}
|
|
23
|
+
export interface CanvasTargetOptions {
|
|
24
|
+
/** Grid the icon's coordinates live on (Lucide/Iconify default: "0 0 24 24").
|
|
25
|
+
* Used to map the geometry onto the backing store. */
|
|
26
|
+
viewBox?: string;
|
|
27
|
+
/** Stroke width in grid units (Lucide's default is 2). */
|
|
28
|
+
strokeWidth?: number;
|
|
29
|
+
/** Stroke color. Defaults to the canvas' computed CSS color when it is a
|
|
30
|
+
* styled element; otherwise the context's current `strokeStyle` stands. */
|
|
31
|
+
color?: string;
|
|
32
|
+
/** Clear the canvas before each frame. Turn off for manual compositing or
|
|
33
|
+
* trails — every frame then draws on top of the last. Default true. */
|
|
34
|
+
clear?: boolean;
|
|
35
|
+
/** Called after every drawn frame — the texture consumer's dirty signal
|
|
36
|
+
* (e.g. re-upload the canvas with `texImage2D`, or blit it into a scene). */
|
|
37
|
+
onWrite?: () => void;
|
|
38
|
+
}
|
|
39
|
+
/** Adapts a canvas (or its 2D context) into a `PathEl` whose writes stroke
|
|
40
|
+
* the morph's geometry onto the canvas, so
|
|
41
|
+
* `createMorph(canvasTarget(canvas), icon)` animates pixels instead of an
|
|
42
|
+
* inline `<svg><path>`. */
|
|
43
|
+
export declare function canvasTarget(surface: CanvasSurface | Canvas2DContext, opts?: CanvasTargetOptions): PathEl;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { PathEl } from '../dom/index';
|
|
2
|
+
/** The subset of an element's inline style the mask target writes — structural
|
|
3
|
+
* so a real HTMLElement's `.style` satisfies it (and a test fake supplies
|
|
4
|
+
* just these). */
|
|
5
|
+
export interface MaskStyle {
|
|
6
|
+
maskImage: string;
|
|
7
|
+
webkitMaskImage: string;
|
|
8
|
+
backgroundColor: string;
|
|
9
|
+
}
|
|
10
|
+
/** An element the mask target can drive (an HTMLElement, or a fake in tests). */
|
|
11
|
+
export interface MaskEl {
|
|
12
|
+
style: MaskStyle;
|
|
13
|
+
}
|
|
14
|
+
export interface MaskTargetOptions {
|
|
15
|
+
/** Stroke width of the mask geometry (Lucide's default is 2). */
|
|
16
|
+
strokeWidth?: number;
|
|
17
|
+
/** Grid the icon's coordinates live on (Lucide/Iconify default: "0 0 24 24").
|
|
18
|
+
* Used to map the geometry onto the element's box. */
|
|
19
|
+
viewBox?: string;
|
|
20
|
+
/** Set `background-color: currentColor` on first setup so the element shows
|
|
21
|
+
* through the mask in the current text color, standalone (no icon class).
|
|
22
|
+
* Turn off to keep an existing paint (e.g. a `bg-*` utility). Default true. */
|
|
23
|
+
paint?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** What `maskTarget` returns: the driver's write contract plus a `dispose`
|
|
26
|
+
* that removes the hidden mask node (call it after `morph.destroy()` when
|
|
27
|
+
* the element unmounts). */
|
|
28
|
+
export interface MaskPathEl extends PathEl {
|
|
29
|
+
dispose(): void;
|
|
30
|
+
}
|
|
31
|
+
/** Adapts an element into a `PathEl` whose writes drive a referenced SVG
|
|
32
|
+
* mask, so `createMorph(maskTarget(el), icon)` animates a mask-styled
|
|
33
|
+
* element instead of an inline `<svg><path>`.
|
|
34
|
+
*
|
|
35
|
+
* DOUBLE BUFFER, on purpose: WebKit does not reliably repaint a masked
|
|
36
|
+
* element when the CONTENT of its referenced `<mask>` mutates — a lone mask
|
|
37
|
+
* whose inner path `d` changes per frame renders frozen in Safari until the
|
|
38
|
+
* flight ends. So the target keeps TWO masks and every `d` write lands on
|
|
39
|
+
* the back buffer and re-points `mask-image` at it: the property VALUE flips
|
|
40
|
+
* (`url(#a)` ↔ `url(#b)`) each frame, which forces reference re-resolution
|
|
41
|
+
* in every engine. Chromium/Gecko pay nothing extra for it. */
|
|
42
|
+
export declare function maskTarget(el: MaskEl, opts?: MaskTargetOptions): MaskPathEl;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IconInput } from '../core/types';
|
|
2
|
+
/** SVG markup → an IconInput the pipeline can lower. Strips non-rendered
|
|
3
|
+
* containers, rejects what can't be honestly morphed (a fill-drawn icon with
|
|
4
|
+
* no stroke, a transform, an unsupported element), and re-grids onto 24 via
|
|
5
|
+
* the viewBox when one is present — so an off-grid collection lands on the
|
|
6
|
+
* shared grid automatically. Returns a `d` (when a viewBox forced a fit) or
|
|
7
|
+
* an IconNode. */
|
|
8
|
+
export declare function svgToIcon(markup: string): IconInput;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MorphPlan } from './plan';
|
|
2
|
+
/** Preallocated output buffers for a plan (zero allocation per frame). */
|
|
3
|
+
export declare function allocOutputs(plan: MorphPlan): Float64Array[];
|
|
4
|
+
export declare function interpPolar(plan: MorphPlan, t: number, out: Float64Array[]): void;
|
|
5
|
+
/** Raw coordinate lerp (same correspondence, no decomposition). */
|
|
6
|
+
export declare function interpLinear(plan: MorphPlan, t: number, out: Float64Array[]): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* 潘启宝 2026-09-03 10:06:59 星期四 山东省济南市 */
|
|
2
|
+
/* 世界因你而美丽 */
|
|
3
|
+
//#region components/common/morphicons/core/interpolate.ts
|
|
4
|
+
function e(e) {
|
|
5
|
+
return e.items.map(() => new Float64Array(2 * e.n));
|
|
6
|
+
}
|
|
7
|
+
function t(e, t, n) {
|
|
8
|
+
for (let r = 0; r < e.items.length; r++) {
|
|
9
|
+
let i = e.items[r], a = n[r], o = e.n, s = Math.exp(i.lnSigma * t), c = i.theta * t, l = Math.cos(c) * s, u = Math.sin(c) * s, d, f;
|
|
10
|
+
if (i.block) {
|
|
11
|
+
let [e, n] = i.block.off, [r, a] = i.block.drift;
|
|
12
|
+
d = i.ca[0] + r * t + (e * l - n * u - e), f = i.ca[1] + a * t + (e * u + n * l - n);
|
|
13
|
+
} else d = i.ca[0] + (i.cb[0] - i.ca[0]) * t, f = i.ca[1] + (i.cb[1] - i.ca[1]) * t;
|
|
14
|
+
for (let e = 0; e < o; e++) {
|
|
15
|
+
let n = i.aC[2 * e] + (i.bT[2 * e] - i.aC[2 * e]) * t, r = i.aC[2 * e + 1] + (i.bT[2 * e + 1] - i.aC[2 * e + 1]) * t;
|
|
16
|
+
a[2 * e] = d + n * l - r * u, a[2 * e + 1] = f + n * u + r * l;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function n(e, t, n) {
|
|
21
|
+
for (let r = 0; r < e.items.length; r++) {
|
|
22
|
+
let i = e.items[r], a = n[r], o = e.n;
|
|
23
|
+
for (let e = 0; e < o; e++) a[2 * e] = i.a[2 * e] + (i.bO[2 * e] - i.a[2 * e]) * t, a[2 * e + 1] = i.a[2 * e + 1] + (i.bO[2 * e + 1] - i.a[2 * e + 1]) * t;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { e as allocOutputs, n as interpLinear, t as interpPolar };
|
|
28
|
+
/* 欲穷千里目,更上一层楼 */
|
|
29
|
+
/* 独立思考,明辨是非 */
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CubicPath, IconInput } from './types';
|
|
2
|
+
/** Control-point offset for a quarter circle: (4/3)·tan(π/8) ≈ 0.5523. */
|
|
3
|
+
export declare const KAPPA: number;
|
|
4
|
+
/** Icon (IconNode or `d` string) → list of cubic subpaths. */
|
|
5
|
+
export declare function iconToCubics(input: IconInput): CubicPath[];
|
|
6
|
+
/** A source viewBox: `24`, `"0 0 20 20"` or `[minX, minY, w, h]`. */
|
|
7
|
+
export type ViewBox = number | string | readonly [number, number, number, number];
|
|
8
|
+
/** Re-grids an icon drawn on `viewBox` onto the shared `grid` (24 by default),
|
|
9
|
+
* centred and preserving aspect ratio — the SVG `xMidYMid meet` rule.
|
|
10
|
+
*
|
|
11
|
+
* Both endpoints of a morph must live on the same coordinate space. Lucide and
|
|
12
|
+
* Tabler already draw on 24×24; packs on 20 (Heroicons solid) or 32 (Carbon)
|
|
13
|
+
* do not, and mixing them unfitted makes Procrustes read the scale/offset gap
|
|
14
|
+
* as rotation. Apply once at module scope (not per render) and pass the
|
|
15
|
+
* resulting `d` anywhere an icon is accepted. */
|
|
16
|
+
export declare function fitIcon(input: IconInput, viewBox: ViewBox, grid?: number): string;
|