-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
807 changed files
with
88,156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// @ts-nocheck | ||
// This file is generated by Umi automatically | ||
// DO NOT CHANGE IT MANUALLY! | ||
import React from 'react'; | ||
import { Outlet, useOutletContext } from 'umi'; | ||
export default function EmptyRoute() { | ||
const context = useOutletContext(); | ||
return <Outlet context={context} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// @ts-nocheck | ||
// This file is generated by Umi automatically | ||
// DO NOT CHANGE IT MANUALLY! | ||
interface IDefaultRuntimeConfig { | ||
onRouteChange?: (props: { routes: any, clientRoutes: any, location: any, action: any, isFirst: boolean }) => void; | ||
patchRoutes?: (props: { routes: any }) => void; | ||
patchClientRoutes?: (props: { routes: any }) => void; | ||
render?: (oldRender: () => void) => void; | ||
rootContainer?: (lastRootContainer: JSX.Element, args?: any) => void; | ||
[key: string]: any; | ||
} | ||
export type RuntimeConfig = IDefaultRuntimeConfig | ||
|
||
export function defineApp(config: RuntimeConfig): RuntimeConfig { | ||
return config; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// @ts-nocheck | ||
// This file is generated by Umi automatically | ||
// DO NOT CHANGE IT MANUALLY! | ||
export function modifyClientRenderOpts(memo: any) { | ||
const { history, hydrate } = memo; | ||
|
||
return { | ||
...memo, | ||
hydrate: hydrate && ![].includes(history.location.pathname), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// @ts-nocheck | ||
// This file is generated by Umi automatically | ||
// DO NOT CHANGE IT MANUALLY! | ||
import React from 'react'; | ||
import { HelmetProvider } from 'D:/MyWeb/KaiYuan/lighting-design-v2/node_modules/@umijs/renderer-react'; | ||
import { context } from './helmetContext'; | ||
|
||
export const innerProvider = (container) => { | ||
return React.createElement(HelmetProvider, { context }, container); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// @ts-nocheck | ||
// This file is generated by Umi automatically | ||
// DO NOT CHANGE IT MANUALLY! | ||
export const context = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// @ts-nocheck | ||
// This file is generated by Umi automatically | ||
// DO NOT CHANGE IT MANUALLY! | ||
import { createHashHistory, createMemoryHistory, createBrowserHistory } from 'D:/MyWeb/KaiYuan/lighting-design-v2/node_modules/@umijs/renderer-react'; | ||
import type { UmiHistory } from './historyIntelli'; | ||
|
||
let history: UmiHistory; | ||
let basename: string = '/'; | ||
export function createHistory(opts: any) { | ||
let h; | ||
if (opts.type === 'hash') { | ||
h = createHashHistory(); | ||
} else if (opts.type === 'memory') { | ||
h = createMemoryHistory(opts); | ||
} else { | ||
h = createBrowserHistory(); | ||
} | ||
if (opts.basename) { | ||
basename = opts.basename; | ||
} | ||
|
||
|
||
history = { | ||
...h, | ||
push(to, state) { | ||
h.push(patchTo(to, h), state); | ||
}, | ||
replace(to, state) { | ||
h.replace(patchTo(to, h), state); | ||
}, | ||
get location() { | ||
return h.location; | ||
}, | ||
get action() { | ||
return h.action; | ||
} | ||
} | ||
|
||
return h; | ||
} | ||
|
||
// Patch `to` to support basename | ||
// Refs: | ||
// https://github.com/remix-run/history/blob/3e9dab4/packages/history/index.ts#L484 | ||
// https://github.com/remix-run/history/blob/dev/docs/api-reference.md#to | ||
function patchTo(to: any, h: History) { | ||
if (typeof to === 'string') { | ||
return `${stripLastSlash(basename)}${to}`; | ||
} else if (typeof to === 'object') { | ||
|
||
const currentPathname = h.location.pathname; | ||
|
||
return { | ||
...to, | ||
pathname: to.pathname? `${stripLastSlash(basename)}${to.pathname}` : currentPathname, | ||
}; | ||
} else { | ||
throw new Error(`Unexpected to: ${to}`); | ||
} | ||
} | ||
|
||
function stripLastSlash(path) { | ||
return path.slice(-1) === '/' ? path.slice(0, -1) : path; | ||
} | ||
|
||
export { history }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
// @ts-nocheck | ||
// This file is generated by Umi automatically | ||
// DO NOT CHANGE IT MANUALLY! | ||
import { getRoutes } from './route' | ||
import type { History } from 'D:/MyWeb/KaiYuan/lighting-design-v2/node_modules/@umijs/renderer-react' | ||
|
||
type Routes = Awaited<ReturnType<typeof getRoutes>>['routes'] | ||
type AllRoute = Routes[keyof Routes] | ||
type IsRoot<T extends any> = 'parentId' extends keyof T ? false : true | ||
|
||
// show `/` in not `layout / wrapper` only | ||
type GetAllRouteWithoutLayout<Item extends AllRoute> = Item extends any | ||
? 'isWrapper' extends keyof Item | ||
? never | ||
: 'isLayout' extends keyof Item | ||
? never | ||
: Item | ||
: never | ||
type AllRouteWithoutLayout = GetAllRouteWithoutLayout<AllRoute> | ||
type IndexRoutePathname = '/' extends AllRouteWithoutLayout['path'] | ||
? '/' | ||
: never | ||
|
||
type GetChildrens<T extends any> = T extends any | ||
? IsRoot<T> extends true | ||
? never | ||
: T | ||
: never | ||
type Childrens = GetChildrens<AllRoute> | ||
type Root = Exclude<AllRoute, Childrens> | ||
type AllIds = AllRoute['id'] | ||
|
||
type GetChildrensByParentId< | ||
Id extends AllIds, | ||
Item = AllRoute | ||
> = Item extends any | ||
? 'parentId' extends keyof Item | ||
? Item['parentId'] extends Id | ||
? Item | ||
: never | ||
: never | ||
: never | ||
|
||
type RouteObject< | ||
Id extends AllIds, | ||
Item = GetChildrensByParentId<Id> | ||
> = IsNever<Item> extends true | ||
? '' | ||
: Item extends AllRoute | ||
? { | ||
[Key in Item['path'] as TrimSlash<Key>]: UnionMerge< | ||
RouteObject<Item['id']> | ||
> | ||
} | ||
: never | ||
|
||
type GetRootRouteObject<Item extends Root> = Item extends Root | ||
? { | ||
[K in Item['path'] as TrimSlash<K>]: UnionMerge<RouteObject<Item['id']>> | ||
} | ||
: never | ||
type MergedResult = UnionMerge<GetRootRouteObject<Root>> | ||
|
||
// --- patch history types --- | ||
|
||
type HistoryTo = Parameters<History['push']>['0'] | ||
type HistoryPath = Exclude<HistoryTo, string> | ||
|
||
type UmiPathname = Path<MergedResult> | (string & {}) | ||
interface UmiPath extends HistoryPath { | ||
pathname: UmiPathname | ||
} | ||
type UmiTo = UmiPathname | UmiPath | ||
|
||
type UmiPush = (to: UmiTo, state?: any) => void | ||
type UmiReplace = (to: UmiTo, state?: any) => void | ||
|
||
|
||
export interface UmiHistory extends History { | ||
push: UmiPush | ||
replace: UmiReplace | ||
} | ||
|
||
// --- type utils --- | ||
type TrimLeftSlash<T extends string> = T extends `/${infer R}` | ||
? TrimLeftSlash<R> | ||
: T | ||
type TrimRightSlash<T extends string> = T extends `${infer R}/` | ||
? TrimRightSlash<R> | ||
: T | ||
type TrimSlash<T extends string> = TrimLeftSlash<TrimRightSlash<T>> | ||
|
||
type IsNever<T> = [T] extends [never] ? true : false | ||
type IsEqual<A, B> = (<G>() => G extends A ? 1 : 2) extends <G>() => G extends B | ||
? 1 | ||
: 2 | ||
? true | ||
: false | ||
|
||
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ( | ||
k: infer I | ||
) => void | ||
? I | ||
: never | ||
type UnionMerge<U> = UnionToIntersection<U> extends infer O | ||
? { [K in keyof O]: O[K] } | ||
: never | ||
|
||
type ExcludeEmptyKey<T> = IsEqual<T, ''> extends true ? never : T | ||
|
||
type PathConcat< | ||
TKey extends string, | ||
TValue, | ||
N = TrimSlash<TKey> | ||
> = TValue extends string | ||
? ExcludeEmptyKey<N> | ||
: | ||
| ExcludeEmptyKey<N> | ||
| `${N & string}${IsNever<ExcludeEmptyKey<N>> extends true | ||
? '' | ||
: '/'}${UnionPath<TValue>}` | ||
|
||
type UnionPath<T> = { | ||
[K in keyof T]-?: PathConcat<K & string, T[K]> | ||
}[keyof T] | ||
|
||
type MakeSureLeftSlash<T> = T extends any | ||
? `/${TrimRightSlash<T & string>}` | ||
: never | ||
|
||
// exclude `/*`, because it always at the top of the IDE tip list | ||
type Path<T, K = UnionPath<T>> = Exclude<MakeSureLeftSlash<K>, '/*'> | IndexRoutePathname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// @ts-nocheck | ||
// This file is generated by Umi automatically | ||
// DO NOT CHANGE IT MANUALLY! | ||
import * as Plugin_0 from '@@/core/exportStaticRuntimePlugin.ts'; | ||
import * as Plugin_1 from '@@/core/helmet.ts'; | ||
import * as Plugin_2 from '@@/dumi/meta/runtime.ts'; | ||
import * as Plugin_3 from '@@/dumi/locales/runtime.tsx'; | ||
import * as Plugin_4 from '@@/dumi/exportStaticRuntimePlugin.ts'; | ||
import { PluginManager } from 'umi'; | ||
|
||
function __defaultExport (obj) { | ||
if (obj.default) { | ||
return typeof obj.default === 'function' ? obj.default() : obj.default | ||
} | ||
return obj; | ||
} | ||
export function getPlugins() { | ||
return [ | ||
{ | ||
apply: Plugin_0, | ||
path: process.env.NODE_ENV === 'production' ? void 0 : '@@/core/exportStaticRuntimePlugin.ts', | ||
}, | ||
{ | ||
apply: Plugin_1, | ||
path: process.env.NODE_ENV === 'production' ? void 0 : '@@/core/helmet.ts', | ||
}, | ||
{ | ||
apply: Plugin_2, | ||
path: process.env.NODE_ENV === 'production' ? void 0 : '@@/dumi/meta/runtime.ts', | ||
}, | ||
{ | ||
apply: Plugin_3, | ||
path: process.env.NODE_ENV === 'production' ? void 0 : '@@/dumi/locales/runtime.tsx', | ||
}, | ||
{ | ||
apply: Plugin_4, | ||
path: process.env.NODE_ENV === 'production' ? void 0 : '@@/dumi/exportStaticRuntimePlugin.ts', | ||
}, | ||
]; | ||
} | ||
|
||
export function getValidKeys() { | ||
return ['patchRoutes','patchClientRoutes','modifyContextOpts','modifyClientRenderOpts','rootContainer','innerProvider','i18nProvider','accessProvider','dataflowProvider','outerProvider','render','onRouteChange','modifyCodeSandboxData','modifyStackBlitzData',]; | ||
} | ||
|
||
let pluginManager = null; | ||
|
||
export function createPluginManager() { | ||
pluginManager = PluginManager.create({ | ||
plugins: getPlugins(), | ||
validKeys: getValidKeys(), | ||
}); | ||
|
||
|
||
return pluginManager; | ||
} | ||
|
||
export function getPluginManager() { | ||
return pluginManager; | ||
} |
Oops, something went wrong.