-
Notifications
You must be signed in to change notification settings - Fork 0
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
109 changed files
with
4,445 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,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
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,43 @@ | ||
# site | ||
|
||
## 0.0.1 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies | ||
- @casts/portal@0.1.0 | ||
- @casts/checkbox@0.1.0 | ||
- @casts/theme@0.1.0 | ||
- @casts/message@0.1.0 | ||
- @casts/affix@0.1.0 | ||
- @casts/toast@0.1.0 | ||
- @casts/dialog@0.1.0 | ||
- @casts/table@0.1.0 | ||
- @casts/input@0.1.0 | ||
- @casts/badge@0.1.0 | ||
- @casts/layout@0.1.0 | ||
- @casts/config-provider@0.1.0 | ||
- @casts/space@0.1.0 | ||
- @casts/form@0.1.0 | ||
- @casts/notification@0.1.0 | ||
- @casts/typography@0.1.0 | ||
- @casts/grid@0.1.0 | ||
- @casts/menu@0.1.0 | ||
- @casts/progress@0.1.0 | ||
- @casts/divider@0.1.0 | ||
- @casts/standard@0.1.0 | ||
- @casts/icons@0.1.0 | ||
- @casts/avatar@0.1.0 | ||
- @casts/button@0.1.0 | ||
- @casts/code@0.1.0 | ||
- @casts/alert@0.1.0 | ||
- @casts/tooltip@0.1.0 | ||
- @casts/anchor@0.1.0 | ||
- @casts/popup@0.1.0 | ||
- @casts/radio@0.1.0 | ||
- @casts/locale@0.1.0 | ||
- @casts/link@0.1.0 | ||
- @casts/tabs@0.1.0 | ||
- @casts/theme-generator@0.1.0 | ||
- @casts/switch@0.1.0 | ||
- @casts/common@0.1.0 |
Empty file.
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,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title><!--app-name --<</title> | ||
</head> | ||
<body> | ||
<div id="root"><!--app-html--></div> | ||
<script type="module" src="/src/entry-client.tsx"></script> | ||
</body> | ||
</html> |
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,139 @@ | ||
{ | ||
"name": "site", | ||
"private": true, | ||
"version": "0.0.1", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"build:client": "vite build --manifest --ssrManifest", | ||
"build:server": "vite build --outDir dist/server --ssr src/entry-server.tsx", | ||
"build:ssg": "tsc && vite build && vite build --outDir dist/server --ssr src/entry-server.tsx && node ./prerender.js && rm -rf dist/server", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"@casts/affix": "workspace:^0.0.1", | ||
"@casts/alert": "workspace:^0.0.1", | ||
"@casts/anchor": "workspace:^0.0.1", | ||
"@casts/avatar": "workspace:^0.0.1", | ||
"@casts/badge": "workspace:^0.0.1", | ||
"@casts/breadcrumbs": "workspace:^0.0.1", | ||
"@casts/button": "workspace:^0.0.1", | ||
"@casts/checkbox": "workspace:^0.0.1", | ||
"@casts/code": "workspace:^0.0.1", | ||
"@casts/common": "workspace:^0.0.1", | ||
"@casts/config-provider": "workspace:^0.0.1", | ||
"@casts/dialog": "workspace:^0.0.1", | ||
"@casts/divider": "workspace:^0.0.1", | ||
"@casts/empty": "workspace:^0.0.1", | ||
"@casts/form": "workspace:^0.0.1", | ||
"@casts/grid": "workspace:^0.0.1", | ||
"@casts/icons": "workspace:^0.0.1", | ||
"@casts/input": "workspace:^0.0.1", | ||
"@casts/layout": "workspace:^0.0.1", | ||
"@casts/link": "workspace:^0.0.1", | ||
"@casts/locale": "workspace:^0.0.1", | ||
"@casts/menu": "workspace:^0.0.1", | ||
"@casts/message": "workspace:^0.0.1", | ||
"@casts/notification": "workspace:^0.0.1", | ||
"@casts/popup": "workspace:^0.0.1", | ||
"@casts/portal": "workspace:^0.0.1", | ||
"@casts/progress": "workspace:^0.0.1", | ||
"@casts/radio": "workspace:^0.0.1", | ||
"@casts/space": "workspace:^0.0.1", | ||
"@casts/standard": "workspace:^0.0.1", | ||
"@casts/switch": "workspace:^0.0.1", | ||
"@casts/table": "workspace:^0.0.1", | ||
"@casts/tabs": "workspace:^0.0.1", | ||
"@casts/theme": "workspace:^0.0.1", | ||
"@casts/theme-generator": "workspace:^0.0.1", | ||
"@casts/toast": "workspace:^0.0.1", | ||
"@casts/tooltip": "workspace:^0.0.1", | ||
"@casts/typography": "workspace:^0.0.1", | ||
"@floating-ui/react": "^0.26.4", | ||
"@jsdevtools/rehype-toc": "^3.0.2", | ||
"@juggle/resize-observer": "^3.4.0", | ||
"@mdx-js/mdx": "^2.3.0", | ||
"@mdx-js/react": "^2.3.0", | ||
"@mdx-js/rollup": "^2.3.0", | ||
"@tanstack/react-table": "^8.9.3", | ||
"@theme-toggles/react": "^4.1.0", | ||
"@vitejs/plugin-react": "^4.0.4", | ||
"add": "^2.0.6", | ||
"ahooks": "^3.7.8", | ||
"clsx": "^2.0.0", | ||
"copy-to-clipboard": "^3.3.3", | ||
"estree-jsx": "^0.0.1", | ||
"father": "4.3.2", | ||
"lodash-es": "^4.17.21", | ||
"mdast-util-from-markdown": "^2.0.0", | ||
"mdast-util-gfm-table": "^2.0.0", | ||
"mdast-util-mdx-jsx": "^3.0.0", | ||
"mdast-util-toc": "^7.0.0", | ||
"micromark-extension-gfm-table": "^2.0.0", | ||
"micromark-extension-mdx-jsx": "^2.0.0", | ||
"prism-react-renderer": "^2.0.6", | ||
"prismjs": "^1.29.0", | ||
"react": "^18.2.0", | ||
"react-docgen-typescript": "^2.2.2", | ||
"react-dom": "^18.2.0", | ||
"react-helmet": "^6.1.0", | ||
"react-helmet-async": "^2.0.5", | ||
"react-hook-form": "^7.45.4", | ||
"react-hot-toast": "^2.4.1", | ||
"react-is": "^18.2.0", | ||
"react-router-dom": "^6.15.0", | ||
"react-transition-group": "^4.4.5", | ||
"rehype-autolink-headings": "^6.1.1", | ||
"rehype-raw": "^7.0.0", | ||
"rehype-slug": "^6.0.0", | ||
"remark-comment": "^1.0.0", | ||
"remark-frontmatter": "^4.0.1", | ||
"remark-gfm": "^3.0.1", | ||
"remark-mdx-frontmatter": "^3.0.0", | ||
"remark-mdx-images": "^2.0.0", | ||
"remove": "^0.1.5", | ||
"resize-observer-polyfill": "^1.5.1", | ||
"ripplet.js": "^1.1.0", | ||
"to-vfile": "^7.2.4", | ||
"validator": "^13.11.0", | ||
"vfile-matter": "^4.0.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.22.11", | ||
"@babel/parser": "^7.22.14", | ||
"@babel/traverse": "^7.22.11", | ||
"@babel/types": "^7.22.11", | ||
"@swc/core": "^1.3.82", | ||
"@types/babel__core": "^7.20.1", | ||
"@types/dom-view-transitions": "^1.0.4", | ||
"@types/estree": "^1.0.1", | ||
"@types/hast": "^3.0.0", | ||
"@types/lodash-es": "^4.17.9", | ||
"@types/mdast": "^4.0.0", | ||
"@types/react": "^18.2.21", | ||
"@types/react-dom": "^18.2.7", | ||
"@types/react-helmet": "^6.1.11", | ||
"@types/react-transition-group": "^4.4.6", | ||
"@types/unist": "^3.0.0", | ||
"@vitejs/plugin-react-swc": "^3.3.2", | ||
"@vitest/coverage-v8": "^1.3.1", | ||
"acorn": "^8.10.0", | ||
"autoprefixer": "^10.4.19", | ||
"esbuild": "^0.19.2", | ||
"import-meta-resolve": "^3.0.0", | ||
"jsdom": "^22.1.0", | ||
"mdast": "^3.0.0", | ||
"postcss": "^8.4.38", | ||
"postcss-discard-duplicates": "^6.0.3", | ||
"rollup": "^3.28.1", | ||
"sass": "^1.66.1", | ||
"source-map": "^0.6.1", | ||
"typescript": "5.5.1-rc", | ||
"unified": "^10.1.2", | ||
"unist-util-visit": "^5.0.0", | ||
"vite": "^4.4.9", | ||
"vite-plugin-dynamic-import": "^1.5.0", | ||
"vite-plugin-svgr": "^3.2.0" | ||
} | ||
} |
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 @@ | ||
# @casts/rd-theme |
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,12 @@ | ||
{ | ||
"name": "@casts/rd-theme", | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "moecasts", | ||
"license": "ISC" | ||
} |
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 @@ | ||
export const prefixCls = 'rd'; |
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,12 @@ | ||
import { prefixCls } from './constants'; | ||
|
||
export const getCompletePrefixCls = ({ | ||
prefixCls, | ||
suffixCls, | ||
}: { | ||
prefixCls?: string; | ||
suffixCls?: string; | ||
}) => [prefixCls, suffixCls].filter((text) => !!text).join('-'); | ||
|
||
export const getPrefixCls = (suffixCls?: string) => | ||
getCompletePrefixCls({ prefixCls, suffixCls }); |
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,2 @@ | ||
export * from './constants'; | ||
export * from './get-prefix-cls'; |
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,120 @@ | ||
import { FC, useEffect } from 'react'; | ||
import { useRef } from 'react'; | ||
import { isEmpty, scrollTo } from '@casts/common'; | ||
import { | ||
ConfigProvider, | ||
type ConfigProviderProps, | ||
} from '@casts/config-provider'; | ||
import { Layout } from '@casts/layout'; | ||
import { useRd } from '@casts/rd-vite/client/hooks/use-rd'; | ||
import { CdsMotionDurationRapid } from '@casts/theme'; | ||
import clsx from 'clsx'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import { CSSTransition } from 'react-transition-group'; | ||
|
||
import { getPrefixCls } from '../common'; | ||
import { FloatButton } from './doc-features/float-button'; | ||
import { useAppLocale } from './hooks'; | ||
import { SiteFooter } from './layout/footer'; | ||
import { Header } from './layout/header'; | ||
import { Router } from './layout/router'; | ||
import { Sidebar } from './layout/sidebar'; | ||
import { useAppContext } from './store/context'; | ||
import { AppProvider } from './store/provider'; | ||
|
||
import '@casts/theme/styles/scss/core.scss'; | ||
import './styles/app.scss'; | ||
|
||
const { Content, Footer, Aside } = Layout; | ||
|
||
export const App: FC<Partial<ConfigProviderProps>> = (props) => { | ||
return ( | ||
<AppProvider> | ||
<_App {...props} /> | ||
</AppProvider> | ||
); | ||
}; | ||
|
||
const _App: FC<Partial<ConfigProviderProps>> = () => { | ||
const { menu, matches, name } = useRd(); | ||
|
||
const asideContentRef = useRef<HTMLDivElement>(null); | ||
const asideOverlayRef = useRef<HTMLDivElement>(null); | ||
|
||
const { themeMode, asideVisible, toggleAsideVisible } = useAppContext(); | ||
|
||
const navigate = useNavigate(); | ||
|
||
/** | ||
* scroll to top when route change | ||
*/ | ||
const currentRoute = matches?.[matches.length - 1].route; | ||
useEffect(() => { | ||
scrollTo(0); | ||
}, [currentRoute]); | ||
|
||
useEffect(() => { | ||
const title = [currentRoute?.meta?.title, name].filter(Boolean).join(' - '); | ||
document.title = title; | ||
}, [name, currentRoute?.meta?.title]); | ||
|
||
const { locale } = useAppLocale(); | ||
|
||
return ( | ||
<ConfigProvider locale={locale} themeMode={themeMode} navigate={navigate}> | ||
<Layout className={`${getPrefixCls('root-layout')}`}> | ||
<Header /> | ||
<Layout className={`${getPrefixCls('sub-layout')}`}> | ||
{!isEmpty(menu) && ( | ||
<Aside | ||
className={clsx(getPrefixCls('aside'), { | ||
'is-hide': !asideVisible, | ||
})} | ||
> | ||
<CSSTransition | ||
in={asideVisible} | ||
mountOnEnter | ||
nodeRef={asideContentRef} | ||
timeout={parseInt(CdsMotionDurationRapid)} | ||
classNames={getPrefixCls('aside-animate')} | ||
appear | ||
> | ||
<div | ||
className={`${getPrefixCls('aside-content')}`} | ||
ref={asideContentRef} | ||
> | ||
<CSSTransition | ||
in={asideVisible} | ||
nodeRef={asideOverlayRef} | ||
timeout={200} | ||
appear | ||
unmountOnExit | ||
classNames={'cds-fade'} | ||
> | ||
<div | ||
role="presentation" | ||
className={`${getPrefixCls('aside-overlay')}`} | ||
tabIndex={-1} | ||
onClick={toggleAsideVisible} | ||
ref={asideOverlayRef} | ||
></div> | ||
</CSSTransition> | ||
<Sidebar /> | ||
</div> | ||
</CSSTransition> | ||
</Aside> | ||
)} | ||
<Layout className={`${getPrefixCls('content-layout')}`}> | ||
<Content className={`${getPrefixCls('content')}`}> | ||
<Router /> | ||
</Content> | ||
<Footer className={`${getPrefixCls('footer')}`}> | ||
<SiteFooter /> | ||
</Footer> | ||
</Layout> | ||
</Layout> | ||
<FloatButton /> | ||
</Layout> | ||
</ConfigProvider> | ||
); | ||
}; |
Oops, something went wrong.