diff --git a/.dumi/theme/builtins/ComponentOverview/index.tsx b/.dumi/theme/builtins/ComponentOverview/index.tsx index 6b12828c7e..ad02ce28e5 100644 --- a/.dumi/theme/builtins/ComponentOverview/index.tsx +++ b/.dumi/theme/builtins/ComponentOverview/index.tsx @@ -243,7 +243,7 @@ const Overview: React.FC = () => { {cardContent} ) : ( - + {cardContent} ); diff --git a/.dumi/theme/builtins/DemoWrapper/index.tsx b/.dumi/theme/builtins/DemoWrapper/index.tsx index dd6f1919a1..5f408be6cc 100644 --- a/.dumi/theme/builtins/DemoWrapper/index.tsx +++ b/.dumi/theme/builtins/DemoWrapper/index.tsx @@ -1,4 +1,4 @@ -import React, { useContext } from 'react'; +import React, { Suspense, useContext } from 'react'; import { BugOutlined, CodeOutlined, ExperimentOutlined } from '@ant-design/icons'; import { ConfigProvider, Tooltip, Button } from 'antd'; import classNames from 'classnames'; @@ -113,7 +113,9 @@ const DemoWrapper: typeof DumiDemoGrid = ({ items }) => { - + + + ); diff --git a/.dumi/theme/common/Link.tsx b/.dumi/theme/common/Link.tsx index 9cfea27292..bccbbc1547 100644 --- a/.dumi/theme/common/Link.tsx +++ b/.dumi/theme/common/Link.tsx @@ -1,7 +1,6 @@ -import type { MouseEvent, MouseEventHandler } from 'react'; -import React, { forwardRef, useLayoutEffect, useTransition } from 'react'; -import { Link as DumiLink, useLocation, useNavigate } from 'dumi'; -import nprogress from 'nprogress'; +import type { MouseEventHandler } from 'react'; +import React from 'react'; +import { Link as DumiLink } from 'dumi'; export interface LinkProps { to: string | { pathname?: string; search?: string; hash?: string }; @@ -9,64 +8,9 @@ export interface LinkProps { className?: string; onClick?: MouseEventHandler; component?: React.ComponentType; + children?: React.ReactNode; } -nprogress.configure({ showSpinner: false }); - -const Link = forwardRef>((props, ref) => { - const { to, children, component, ...rest } = props; - const [isPending, startTransition] = useTransition(); - const navigate = useNavigate(); - const { pathname } = useLocation(); - - const href = React.useMemo(() => { - if (typeof to === 'object') { - return `${to.pathname || pathname}${to.search || ''}${to.hash || ''}`; - } - return to; - }, [to]); - - const handleClick = (e: MouseEvent) => { - props.onClick?.(e); - if (!href?.startsWith('http')) { - // Should support open in new tab - if (!e.metaKey && !e.ctrlKey && !e.shiftKey) { - e.preventDefault(); - startTransition(() => { - if (href) { - navigate(href); - } - }); - } - } - }; - - useLayoutEffect(() => { - if (isPending) { - nprogress.start(); - } else { - nprogress.done(); - } - }, [isPending]); - - if (component) { - return React.createElement( - component, - { - ...rest, - ref, - onClick: handleClick, - href, - }, - children, - ); - } - - return ( - - {children} - - ); -}); +const Link: React.FC = (props) => ; export default Link; diff --git a/.dumirc.ts b/.dumirc.ts index a440e99ef3..57672e5d8e 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -9,7 +9,11 @@ import { version } from './package.json'; export default defineConfig({ plugins: ['dumi-plugin-color-chunk'], + + // For + routePrefetch: {}, manifest: {}, + conventionRoutes: { // to avoid generate routes for .dumi/pages/index/components/xx exclude: [/index\/components\//], diff --git a/package.json b/package.json index 23d3f0d22a..777a90694a 100644 --- a/package.json +++ b/package.json @@ -201,7 +201,6 @@ "@types/lodash": "^4.17.12", "@types/minimist": "^1.2.5", "@types/node": "^22.7.7", - "@types/nprogress": "^0.2.3", "@types/pixelmatch": "^5.2.6", "@types/pngjs": "^6.0.5", "@types/prismjs": "^1.26.4", @@ -270,7 +269,6 @@ "mockdate": "^3.0.5", "node-fetch": "^3.3.2", "node-notifier": "^10.0.1", - "nprogress": "^0.2.0", "open": "^10.1.0", "ora": "^8.1.0", "p-all": "^5.0.0",