/* eslint-disable eslint-comments/no-unlimited-disable */ /* eslint-disable */ // TODO: enable eslint import React from 'react'; import clsx from 'clsx'; import Layout from '@theme/Layout'; import Link from '@docusaurus/Link'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import { Swiper, SwiperSlide } from 'swiper/react'; import BrowserOnly from '@docusaurus/BrowserOnly'; import JavascriptSVG from '@site/static/img/features/javascript.svg'; import BrowserSVG from '@site/static/img/features/browser.svg'; import cl from 'classnames'; import UnitySVG from '@site/static/img/features/unity.svg'; import ServerLessSVG from '@site/static/img/features/serverless.svg'; import FrameWorkSVG from '@site/static/img/features/framework.svg'; import DeveloperSVG from '@site/static/img/features/developer.svg'; import AISVG from '@site/static/img/features/ai.svg'; import CloudSVG from '@site/static/img/features/cloud.svg'; import BlocksSVG from '@site/static/img/features/blocks.svg'; import UrltSVG from '@site/static/img/features/url.svg'; import DynamicSVG from '@site/static/img/features/dynamic.svg'; import APISVG from '@site/static/img/features/api.svg'; import AppSVG from '@site/static/img/features/app.svg'; import WebServerSVG from '@site/static/img/features/web-server.svg'; import HTMLSVG from '@site/static/img/features/html.svg'; import CodingBackEndSVG from '@site/static/img/features/coding-backend.svg'; import ServerNetworkSVG from '@site/static/img/features/server-network.svg'; import FrameworksSVG from '@site/static/img/features/frameworks.svg'; import CustomizeSVG from '@site/static/img/features/customize.svg'; import TrinitySVG from '@site/static/img/features/trinity.svg'; import CompilerSVG from '@site/static/img/features/compiler.svg'; import CssFileSVG from '@site/static/img/features/css-file.svg'; import FrameWorkConfigSVG from '@site/static/img/features/framework-config.svg'; import TestSVG from '@site/static/img/features/test.svg'; import EditorSVG from '@site/static/img/features/editor.svg'; import ProductSVG from '@site/static/img/features/product.svg'; import VisualSVG from '@site/static/img/features/visual.svg'; import MonorepoSVG from '@site/static/img/features/monorepo.svg'; import VideoCard from '../components/VideoCard'; import NavTabs from '../components/NavTabs'; import QuickStartCard from '../components/QuickStartCard'; import FlowCard from '../components/FlowCard'; import ContentCard, { ContentCardProps } from '../components/ContentCard'; import SecondaryTitle from '../components/SecondaryTitle'; import { Featurelayout } from '../components/FeatureLayout'; import Features from '../components/HomePageFeatures'; import styles from './index.module.css'; import 'swiper/css'; const headerTabs = [ { tabName: '移动页面', href: '/docs/start/mobile', }, { tabName: '响应式网站', href: '/docs/start/website', }, { tabName: '中后台', href: '/docs/start/admin', }, { tabName: '微前端', href: '/docs/start/micro-frontend', }, { tabName: '桌面应用', href: '/docs/start/electron', }, { tabName: 'API服务', href: '/docs/start/api-service', }, { tabName: '工具库', href: '/docs/start/library', }, { tabName: 'UI组件', href: '/docs/start/component', }, ]; const features = [ { icon: BrowserSVG, desc: '客户端为中心的 Web 框架', href: '/docs/guides/tutorials/c01-getting-started/1.2-minimal-mwa', }, { icon: JavascriptSVG, desc: 'JS 为中心、FP 优先的 GUI 软件研发技术栈', href: '/docs/guides/tutorials/c07-app-entry/7.1-intro', }, { icon: UnitySVG, desc: '从「前后端分离」到「前后端一体化」', href: '/docs/guides/features/server-side/web/routes', }, { icon: ServerLessSVG, desc: 'Serverless 优先', href: '/docs/guides/tutorials/c09-bff/9.1-serverless', }, { icon: FrameWorkSVG, desc: '对 Web 应用开发的充分抽象', href: '/docs/guides/tutorials/c01-getting-started/1.2-minimal-mwa', }, { icon: DeveloperSVG, desc: 'DX 和 UX 同时最大化', href: '/docs/guides/usages/basic-configuration/compatibility', }, { icon: AISVG, desc: '智能化', href: '/docs/guides/tutorials/c03-ide/3.2-hints-in-ide', }, { icon: CloudSVG, desc: '平台化', href: '/coming-soon', }, { icon: BlocksSVG, desc: '低码化', href: '/coming-soon', }, ]; const univeralGroups: ContentCardProps[] = [ { title: '同时支持「服务器端路由」和「客户端路由」', img: UrltSVG, href: '/docs/guides/tutorials/c07-app-entry/7.1-intro', }, { title: 'Serverless 范式的「动静一体 Web」', img: DynamicSVG, href: '/docs/guides/features/server-side/web/ssg', }, { title: '低门槛、全功能、一体化的「BFF」开发', img: APISVG, href: '/docs/guides/tutorials/c09-bff/9.2-enable-bff', }, { title: '不同类型的应用', img: AppSVG, href: '/docs/guides/features/electron/basic', }, ]; const feBe: ContentCardProps[] = [ { title: '自带 Web Server', img: WebServerSVG, href: '/docs/guides/tutorials/c01-getting-started/1.4-enable-ssr', }, { title: '一体化 SSR/SPR/SSG', img: HTMLSVG, href: '/docs/guides/features/server-side/web/ssr-and-spr', }, { title: '一体化 BFF', img: CodingBackEndSVG, href: '/docs/guides/features/server-side/bff/function', }, { title: '为 Serverless 优化', img: ServerNetworkSVG, href: '/coming-soon', }, { title: '多框架', img: FrameworksSVG, href: '/docs/guides/features/server-side/bff/frameworks', }, { title: '定制 Web Server', img: CustomizeSVG, href: '/docs/guides/features/server-side/web/web-server', }, { title: '三位一体', img: TrinitySVG, href: '/docs/start/api-service', }, ]; const flowCards = [ { title: '搭建', img: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js/modern-js-landing-pics.003.jpeg', href: '/docs/guides/tutorials/c02-generator-and-studio/2.1-generator', top: 53, }, { title: '编码', img: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js/modern-js-landing-pics.004.jpeg', href: '/docs/guides/tutorials/c03-ide/3.1-setting-up', top: 120, }, { title: '测试', href: '/docs/guides/tutorials/c06-css-and-component/6.6-testing', top: 423, }, { title: '调试', href: '/docs/guides/usages/debug/proxy-and-mock', top: 490, }, { title: '构建', img: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js/modern-js-landing-pics.005.jpeg', href: '/docs/apis/commands/module/build', top: 545, }, { title: '运行', img: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js/modern-js-landing-pics.007.jpeg', href: '/docs/guides/usages/basic-configuration/compatibility', top: 610, }, { title: '部署', img: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js//modern-js-landing-pics.008.jpeg', href: '/coming-soon', top: 915, }, ]; const bestPratice = [ { title: 'Post-Webpack Era', img: CompilerSVG, href: '/docs/guides/usages/debug/unbundled', }, { title: 'CSS 解决方案', img: CssFileSVG, href: '/docs/guides/tutorials/c06-css-and-component/6.1-css-in-js', }, { title: '默认零配置、样板文件最小化', img: FrameWorkConfigSVG, href: '/docs/guides/tutorials/c01-getting-started/1.2-minimal-mwa', }, { title: '单元测试、集成测试', img: TestSVG, href: '/docs/guides/tutorials/c11-container/11.4-testing', }, { title: 'ESLint 全量规则集、IDE 支持', img: EditorSVG, href: '/docs/guides/tutorials/c03-ide/3.1-setting-up', }, { title: '模块构建产物规范', img: ProductSVG, href: '/docs/guides/features/modules/build', }, { title: 'Visual Testing', img: VisualSVG, href: '/docs/guides/features/modules/storybook', }, { title: 'Monorepo', img: MonorepoSVG, href: '/docs/guides/features/monorepo/intro', }, ]; const HomepageHeader = () => (

现代 Web 工程体系

介绍{' '} 快速开始{' '} 文档
); const renderFlowCards = cards => { const isWeb = window.innerWidth > 1100; const flowLineImg = isWeb ? 'https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js/flow-line-line.png' : 'https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js/flow-line-mobile.png'; let top1 = 53; let top2 = 120; const distance = 530; const renderedWebCards = cards.map((card, cardIndex) => { if (cardIndex % 2 !== 0) { const top = top2; top2 += distance; return ( ); } else { const top = top1; top1 += distance; return ( ); } }); const renderedMobileCards = cards.map((card, cardIndex) => { const left = 53; const top = 10; // const distance = cardIndex * 60; const distance = cardIndex * 65; return ( ); }); return (
{isWeb && ( flow line )} {isWeb ? renderedWebCards : renderedMobileCards}
); }; const renderCards = cards => { const isWeb = window.innerWidth > 966; if (isWeb) { return (
{renderContentCards(cards)}
); } else { return ( {renderSwiperContentCards(cards)} ); } }; const renderSwiperContentCards = cards => cards.map(({ title, desc, img, href }, index) => ( )); const renderContentCards = cards => cards.map((card, cardIndex) => ( )); export default function Home() { const { siteConfig } = useDocusaurusContext(); const renderedUniVerals = renderSwiperContentCards(univeralGroups); const bestPraticeCards = renderContentCards(bestPratice); let count = 1; return (
现代 Web 应用(MWA)

从 Universal JS 到 Universal App

{renderedUniVerals}

前后端一体化

{() => renderCards(feBe)}

应用架构

framework

Runtime API 标准库

framework
内置工程最佳实践
{bestPraticeCards}
包含 Web 开发全流程 {() => renderFlowCards(flowCards)} 提供工程标准体系 提供工程标准体系
); } /* eslint-enable */