Files
RustUI/.dumi/tmp-production/dumi/theme/ContextWrapper.tsx
T
2026-05-31 09:36:07 +08:00

83 lines
2.8 KiB
TypeScript

// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
import React, { useState, useEffect, useRef } from 'react';
import { useOutlet, history } from 'dumi';
import { warning } from '/Users/donghym/Desktop/day/UI/Nova/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.2.6_react@19.2.6__react@19.2.6/node_modules/rc-util';
import { SiteContext, type ISiteContext } from '/Users/donghym/Desktop/day/UI/Nova/node_modules/.pnpm/dumi@2.4.28_@babel+core@7.29.7_@swc+helpers@0.5.15_@types+node@25.9.1_@types+react@18.3_cf46fd6bbea4e97c0978eb785c920599/node_modules/dumi/dist/client/theme-api/context.js';
import { components } from '../meta/atoms';
import { locales } from '../locales/config';
import * as entryMemberExports from '/Users/donghym/Desktop/day/UI/Nova/src/index.ts';
const entryExports = {
...entryMemberExports,
};
// Static content
const pkg = {"name":"@nova/ui","description":"AI-Native component library for modern visualization","version":"0.0.1","license":"MIT","author":""};
const historyType = "browser";
const hostname = undefined;
const themeConfig = {"footer":"Copyright © 2026 | Powered by <a href=\"https://d.umijs.org\" target=\"_blank\" rel=\"noreferrer\">dumi</a>","prefersColor":{"default":"light","switch":true},"nprogress":true,"lastUpdated":true,"name":"Nova","logo":false,"nav":[{"title":"指南","link":"/guide"},{"title":"组件","link":"/components"}],"socialLinks":{"github":"https://github.com/user/novaui"}};
const _2_level_nav_available = true;
export default function DumiContextWrapper() {
const outlet = useOutlet();
const [loading, setLoading] = useState(false);
const prev = useRef(history.location.pathname);
useEffect(() => {
return history.listen((next) => {
if (next.location.pathname !== prev.current) {
prev.current = next.location.pathname;
// scroll to top when route changed
document.documentElement.scrollTo(0, 0);
}
});
}, []);
const context: ISiteContext = React.useMemo(() => {
const ctx = {
pkg,
historyType,
entryExports,
demos: null,
components,
locales,
loading,
setLoading,
hostname,
themeConfig,
_2_level_nav_available,
};
// Proxy do not warning since `Object.keys` will get nothing to loop
Object.defineProperty(ctx, 'demos', {
get: () => {
warning(false, '`demos` return empty in latest version, please use `useDemo` instead.');
return {};
},
});
return ctx;
}, [
pkg,
historyType,
entryExports,
components,
locales,
loading,
setLoading,
hostname,
themeConfig,
_2_level_nav_available,
]);
return (
<SiteContext.Provider value={context}>
{outlet}
</SiteContext.Provider>
);
}