Feature/docs improvement (#254)

* refactor: 编辑器/运行时架构拆分与构建系统升级

* feat(core): 层级系统重构与UI变换矩阵修复

* refactor: 移除 ecs-components 聚合包并修复跨包组件查找问题

* fix(physics): 修复跨包组件类引用问题

* feat: 统一运行时架构与浏览器运行支持

* feat(asset): 实现浏览器运行时资产加载系统

* fix: 修复文档、CodeQL安全问题和CI类型检查错误

* fix: 修复文档、CodeQL安全问题和CI类型检查错误

* fix: 修复文档、CodeQL安全问题、CI类型检查和测试错误

* test: 补齐核心模块测试用例,修复CI构建配置

* fix: 修复测试用例中的类型错误和断言问题

* fix: 修复 turbo build:npm 任务的依赖顺序问题

* fix: 修复 CI 构建错误并优化构建性能

* feat(docs): 重构文档站主题样式

* chore(ci): 升级所有 workflow 的 pnpm 版本从 v8 到 v10
This commit is contained in:
YHH
2025-12-01 23:33:04 +08:00
committed by GitHub
parent 290bd9858e
commit 460cdb5af4
16 changed files with 11255 additions and 8094 deletions

View File

@@ -33,7 +33,7 @@ jobs:
- name: Install pnpm - name: Install pnpm
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v2
with: with:
version: 8 version: 10
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
@@ -67,7 +67,7 @@ jobs:
fi fi
- name: Install dependencies - name: Install dependencies
run: pnpm install run: pnpm install --no-frozen-lockfile
# 缓存 Turbo # 缓存 Turbo
- name: Cache Turbo - name: Cache Turbo

View File

@@ -17,7 +17,7 @@ jobs:
- name: Install pnpm - name: Install pnpm
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v2
with: with:
version: 8 version: 10
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4

View File

@@ -20,7 +20,7 @@ jobs:
- name: Install pnpm - name: Install pnpm
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v2
with: with:
version: 8 version: 10
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4

View File

@@ -32,7 +32,7 @@ jobs:
- name: Install pnpm - name: Install pnpm
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v2
with: with:
version: 8 version: 10
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4

View File

@@ -36,7 +36,7 @@ jobs:
- name: Install pnpm - name: Install pnpm
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v2
with: with:
version: 8 version: 10
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4

View File

@@ -48,7 +48,7 @@ jobs:
- name: Install pnpm - name: Install pnpm
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v2
with: with:
version: 8 version: 10
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4

View File

@@ -25,7 +25,7 @@ jobs:
- name: Install pnpm - name: Install pnpm
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v2
with: with:
version: 8 version: 10
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4

View File

@@ -28,11 +28,15 @@ export default defineConfig({
} }
} }
}, },
title: 'ECS Framework', title: 'ESEngine',
description: '高性能TypeScript ECS框架 - 为游戏开发而生', description: '高性能 TypeScript ECS 框架 - 为游戏开发而生',
lang: 'zh-CN', lang: 'zh-CN',
appearance: 'force-dark',
themeConfig: { themeConfig: {
siteTitle: 'ESEngine',
nav: [ nav: [
{ text: '首页', link: '/' }, { text: '首页', link: '/' },
{ text: '快速开始', link: '/guide/getting-started' }, { text: '快速开始', link: '/guide/getting-started' },
@@ -219,7 +223,7 @@ export default defineConfig({
outline: { outline: {
level: [2, 3], level: [2, 3],
label: '目录' label: '在这个页面上'
} }
}, },
@@ -228,7 +232,9 @@ export default defineConfig({
['link', { rel: 'icon', href: '/favicon.ico' }] ['link', { rel: 'icon', href: '/favicon.ico' }]
], ],
base: '/ecs-framework/', // 使用自定义域名 esengine.cn 时base 设置为 '/'
// 如果部署到 GitHub Pages 子路径,改为 '/ecs-framework/'
base: '/',
cleanUrls: true, cleanUrls: true,
markdown: { markdown: {

View File

@@ -0,0 +1,93 @@
<script setup>
defineProps({
title: String,
description: String,
icon: String,
link: String,
image: String
})
</script>
<template>
<a :href="link" class="feature-card">
<div class="card-image" v-if="image">
<img :src="image" :alt="title" />
</div>
<div class="card-body">
<div class="card-icon" v-if="icon && !image">{{ icon }}</div>
<h3 class="card-title">{{ title }}</h3>
<p class="card-description">{{ description }}</p>
</div>
</a>
</template>
<style scoped>
.feature-card {
display: flex;
flex-direction: column;
background: var(--es-bg-elevated, #252526);
border: 1px solid var(--es-border-default, #3e3e42);
border-radius: 4px;
overflow: hidden;
text-decoration: none;
transition: all 0.15s ease;
}
.feature-card:hover {
border-color: var(--es-primary, #007acc);
background: var(--es-bg-overlay, #2d2d2d);
}
.card-image {
width: 100%;
height: 160px;
overflow: hidden;
background: linear-gradient(135deg, #1e3a5f 0%, #1e1e1e 100%);
}
.card-image img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s ease;
}
.feature-card:hover .card-image img {
transform: scale(1.05);
}
.card-body {
padding: 16px;
flex: 1;
display: flex;
flex-direction: column;
}
.card-icon {
font-size: 1.5rem;
margin-bottom: 12px;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
background: var(--es-bg-input, #3c3c3c);
border-radius: 4px;
}
.card-title {
font-size: 14px;
font-weight: 600;
color: var(--es-text-inverse, #ffffff);
margin: 0 0 8px 0;
line-height: 1.3;
}
.card-description {
font-size: 12px;
color: var(--es-text-secondary, #9d9d9d);
margin: 0;
line-height: 1.6;
flex: 1;
}
</style>

View File

@@ -0,0 +1,422 @@
<script setup>
import { onMounted, onUnmounted, ref } from 'vue'
const canvasRef = ref(null)
let animationId = null
let particles = []
let animationStartTime = null
let glowStartTime = null
// ESEngine 粒子颜色 - VS Code 风格配色(与编辑器统一)
const colors = ['#569CD6', '#4EC9B0', '#9CDCFE', '#C586C0', '#DCDCAA']
class Particle {
constructor(x, y, targetX, targetY) {
this.x = x
this.y = y
this.targetX = targetX
this.targetY = targetY
this.size = Math.random() * 2 + 1.5
this.alpha = Math.random() * 0.5 + 0.5
this.color = colors[Math.floor(Math.random() * colors.length)]
}
}
function createParticles(canvas, text, fontSize) {
const tempCanvas = document.createElement('canvas')
const tempCtx = tempCanvas.getContext('2d')
if (!tempCtx) return []
tempCtx.font = `bold ${fontSize}px "Segoe UI", Arial, sans-serif`
const textMetrics = tempCtx.measureText(text)
const textWidth = textMetrics.width
const textHeight = fontSize
tempCanvas.width = textWidth + 40
tempCanvas.height = textHeight + 40
tempCtx.font = `bold ${fontSize}px "Segoe UI", Arial, sans-serif`
tempCtx.textAlign = 'center'
tempCtx.textBaseline = 'middle'
tempCtx.fillStyle = '#ffffff'
tempCtx.fillText(text, tempCanvas.width / 2, tempCanvas.height / 2)
const imageData = tempCtx.getImageData(0, 0, tempCanvas.width, tempCanvas.height)
const pixels = imageData.data
const newParticles = []
const gap = 3
const width = canvas.width / (window.devicePixelRatio || 1)
const height = canvas.height / (window.devicePixelRatio || 1)
const offsetX = (width - tempCanvas.width) / 2
const offsetY = (height - tempCanvas.height) / 2
for (let y = 0; y < tempCanvas.height; y += gap) {
for (let x = 0; x < tempCanvas.width; x += gap) {
const index = (y * tempCanvas.width + x) * 4
const alpha = pixels[index + 3] || 0
if (alpha > 128) {
const angle = Math.random() * Math.PI * 2
const distance = Math.random() * Math.max(width, height)
newParticles.push(new Particle(
width / 2 + Math.cos(angle) * distance,
height / 2 + Math.sin(angle) * distance,
offsetX + x,
offsetY + y
))
}
}
}
return newParticles
}
function easeOutQuart(t) {
return 1 - Math.pow(1 - t, 4)
}
function easeOutCubic(t) {
return 1 - Math.pow(1 - t, 3)
}
function animate(canvas, ctx) {
const dpr = window.devicePixelRatio || 1
const width = canvas.width / dpr
const height = canvas.height / dpr
const currentTime = performance.now()
const duration = 2500
const glowDuration = 600
const elapsed = currentTime - animationStartTime
const progress = Math.min(elapsed / duration, 1)
const easedProgress = easeOutQuart(progress)
// 透明背景
ctx.clearRect(0, 0, width, height)
// 计算发光进度
let glowProgress = 0
if (progress >= 1) {
if (glowStartTime === null) {
glowStartTime = currentTime
}
glowProgress = Math.min((currentTime - glowStartTime) / glowDuration, 1)
glowProgress = easeOutCubic(glowProgress)
}
const text = 'ESEngine'
const fontSize = Math.min(width / 4, height / 3, 80)
const textY = height / 2
for (const particle of particles) {
const moveProgress = Math.min(easedProgress * 1.2, 1)
const currentX = particle.x + (particle.targetX - particle.x) * moveProgress
const currentY = particle.y + (particle.targetY - particle.y) * moveProgress
ctx.beginPath()
ctx.arc(currentX, currentY, particle.size, 0, Math.PI * 2)
ctx.fillStyle = particle.color
ctx.globalAlpha = particle.alpha * (1 - glowProgress * 0.3)
ctx.fill()
}
ctx.globalAlpha = 1
if (glowProgress > 0) {
ctx.save()
ctx.shadowColor = '#3b9eff'
ctx.shadowBlur = 30 * glowProgress
ctx.fillStyle = `rgba(255, 255, 255, ${glowProgress})`
ctx.font = `bold ${fontSize}px "Segoe UI", Arial, sans-serif`
ctx.textAlign = 'center'
ctx.textBaseline = 'middle'
ctx.fillText(text, width / 2, textY)
ctx.restore()
}
if (glowProgress >= 1) {
const breathe = 0.8 + Math.sin(currentTime / 1000) * 0.2
ctx.save()
ctx.shadowColor = '#3b9eff'
ctx.shadowBlur = 20 * breathe
ctx.fillStyle = '#ffffff'
ctx.font = `bold ${fontSize}px "Segoe UI", Arial, sans-serif`
ctx.textAlign = 'center'
ctx.textBaseline = 'middle'
ctx.fillText(text, width / 2, textY)
ctx.restore()
}
animationId = requestAnimationFrame(() => animate(canvas, ctx))
}
function initCanvas() {
const canvas = canvasRef.value
if (!canvas) return
const ctx = canvas.getContext('2d')
if (!ctx) return
const dpr = window.devicePixelRatio || 1
const container = canvas.parentElement
const width = container.offsetWidth
const height = container.offsetHeight
canvas.width = width * dpr
canvas.height = height * dpr
canvas.style.width = `${width}px`
canvas.style.height = `${height}px`
ctx.scale(dpr, dpr)
const text = 'ESEngine'
const fontSize = Math.min(width / 4, height / 3, 80)
particles = createParticles(canvas, text, fontSize)
animationStartTime = performance.now()
glowStartTime = null
if (animationId) {
cancelAnimationFrame(animationId)
}
animate(canvas, ctx)
}
onMounted(() => {
initCanvas()
window.addEventListener('resize', initCanvas)
})
onUnmounted(() => {
if (animationId) {
cancelAnimationFrame(animationId)
}
window.removeEventListener('resize', initCanvas)
})
</script>
<template>
<section class="hero-section">
<div class="hero-container">
<!-- 左侧文字区域 -->
<div class="hero-text">
<div class="hero-logo">
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="16" cy="16" r="14" stroke="#9147ff" stroke-width="2"/>
<path d="M10 10h8v2h-6v3h5v2h-5v3h6v2h-8v-12z" fill="#9147ff"/>
</svg>
<span>ESENGINE</span>
</div>
<h1 class="hero-title">
我们构建框架<br/>
而你将创造游戏
</h1>
<p class="hero-description">
ESEngine 是一个高性能的 TypeScript ECS 框架为游戏开发者提供现代化的实体组件系统
无论是 2D 还是 3D 游戏都能帮助你快速构建可扩展的游戏架构
</p>
<div class="hero-actions">
<a href="/guide/getting-started" class="btn-primary">开始使用</a>
<a href="https://github.com/esengine/ecs-framework" class="btn-secondary" target="_blank">了解更多</a>
</div>
</div>
<!-- 右侧粒子动画区域 -->
<div class="hero-visual">
<div class="visual-container">
<canvas ref="canvasRef" class="particle-canvas"></canvas>
<div class="visual-label">
<span class="label-title">Entity Component System</span>
<span class="label-subtitle">High Performance Framework</span>
</div>
</div>
</div>
</div>
</section>
</template>
<style scoped>
.hero-section {
background: #0d0d0d;
padding: 80px 0;
min-height: calc(100vh - 64px);
display: flex;
align-items: center;
}
.hero-container {
max-width: 1400px;
margin: 0 auto;
padding: 0 48px;
display: grid;
grid-template-columns: 1fr 1.2fr;
gap: 64px;
align-items: center;
}
/* 左侧文字 */
.hero-text {
display: flex;
flex-direction: column;
gap: 24px;
}
.hero-logo {
display: flex;
align-items: center;
gap: 12px;
color: #ffffff;
font-size: 1rem;
font-weight: 700;
letter-spacing: 0.1em;
}
.hero-title {
font-size: 3rem;
font-weight: 700;
color: #ffffff;
line-height: 1.2;
margin: 0;
}
.hero-description {
font-size: 1.125rem;
color: #707070;
line-height: 1.7;
margin: 0;
max-width: 480px;
}
.hero-actions {
display: flex;
gap: 16px;
margin-top: 8px;
}
.btn-primary,
.btn-secondary {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 14px 28px;
border-radius: 4px;
font-weight: 600;
font-size: 0.9375rem;
text-decoration: none;
transition: all 0.2s ease;
}
.btn-primary {
background: #3b9eff;
color: #ffffff;
border: 1px solid #3b9eff;
border-radius: 6px;
}
.btn-primary:hover {
background: #5aadff;
border-color: #5aadff;
}
.btn-secondary {
background: #1a1a1a;
color: #a0a0a0;
border: 1px solid #2a2a2a;
border-radius: 6px;
}
.btn-secondary:hover {
background: #252525;
color: #ffffff;
}
.hero-visual {
display: flex;
justify-content: center;
}
.visual-container {
position: relative;
width: 100%;
max-width: 600px;
aspect-ratio: 4 / 3;
background: linear-gradient(135deg, #1a2a3a 0%, #1a1a1a 50%, #0d0d0d 100%);
border-radius: 12px;
border: 1px solid #2a2a2a;
overflow: hidden;
box-shadow: 0 20px 60px rgba(59, 158, 255, 0.1);
}
.particle-canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.visual-label {
position: absolute;
bottom: 24px;
left: 24px;
display: flex;
flex-direction: column;
gap: 4px;
}
.label-title {
font-size: 1.125rem;
font-weight: 600;
color: #ffffff;
}
.label-subtitle {
font-size: 0.875rem;
color: #737373;
}
/* 响应式 */
@media (max-width: 1024px) {
.hero-container {
grid-template-columns: 1fr;
gap: 48px;
padding: 0 24px;
}
.hero-section {
padding: 48px 0;
min-height: auto;
}
.hero-title {
font-size: 2.25rem;
}
.hero-description {
font-size: 1rem;
}
.visual-container {
max-width: 100%;
aspect-ratio: 16 / 9;
}
}
@media (max-width: 640px) {
.hero-title {
font-size: 1.75rem;
}
.hero-actions {
flex-direction: column;
}
.btn-primary,
.btn-secondary {
width: 100%;
justify-content: center;
}
}
</style>

View File

@@ -0,0 +1,631 @@
/* ============================================
ESEngine 文档站主题样式
============================================ */
:root {
color-scheme: dark;
--vp-nav-height: 64px;
}
body {
background: #0d0d0d !important;
}
.VPContent.has-sidebar {
background: linear-gradient(180deg, #1e3a5f 0%, #152540 30vh, #0d1a2a 50vh, #0d0d0d 70vh) !important;
background-repeat: no-repeat !important;
}
html,
html.dark {
--vp-c-bg: #0d0d0d;
--vp-c-bg-soft: #1a1a1a;
--vp-c-bg-mute: #1f1f1f;
--vp-c-bg-alt: #1a1a1a;
--vp-c-text-1: #e0e0e0;
--vp-c-text-2: #a0a0a0;
--vp-c-text-3: #707070;
--vp-c-divider: #2a2a2a;
--vp-c-divider-light: #222222;
}
html:not(.dark) {
--vp-c-bg: #0d0d0d !important;
--vp-c-bg-soft: #1a1a1a !important;
--vp-c-bg-mute: #1f1f1f !important;
--vp-c-bg-alt: #1a1a1a !important;
--vp-c-text-1: #e0e0e0 !important;
--vp-c-text-2: #a0a0a0 !important;
--vp-c-text-3: #707070 !important;
}
:root {
--es-bg-base: #0d0d0d;
--es-bg-sidebar: #1a1a1a;
--es-bg-card: #1f1f1f;
--es-bg-hover: #252525;
--es-bg-selected: #0e4a7c;
--es-text-primary: #e0e0e0;
--es-text-secondary: #a0a0a0;
--es-text-tertiary: #707070;
--es-text-inverse: #ffffff;
--es-border-default: #2a2a2a;
--es-border-subtle: #222222;
--es-primary: #3b9eff;
--es-warning: #c9a227;
--es-info: #3b9eff;
}
/* ============================================
导航栏
============================================ */
.VPNav {
background: #0d0d0d !important;
border-bottom: 1px solid #2a2a2a !important;
}
.VPNav .VPNavBar {
background: #0d0d0d !important;
}
.VPNav .VPNavBar .wrapper {
background: #0d0d0d !important;
}
.VPNav .VPNavBar::before,
.VPNav .VPNavBar::after {
display: none !important;
}
.VPNavBar {
background: #0d0d0d !important;
}
.VPNavBar::before {
display: none !important;
}
.VPNavBarTitle .title {
color: #ffffff;
font-weight: 600;
font-size: 15px;
}
.VPNavBarMenuLink {
color: #a0a0a0 !important;
font-size: 14px !important;
font-weight: 400 !important;
}
.VPNavBarMenuLink:hover {
color: #ffffff !important;
}
.VPNavBarMenuLink.active {
color: #ffffff !important;
}
.VPNavBarSearch .DocSearch-Button {
background: #1a1a1a !important;
border: 1px solid #2a2a2a !important;
border-radius: 6px;
}
/* ============================================
侧边栏
============================================ */
.VPSidebar {
background: transparent !important;
border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
padding: 16px 0 !important;
width: 280px !important;
}
.VPSidebar .nav {
padding: 0 16px;
}
.VPSidebarItem.level-0 > .item {
padding: 12px 0 6px 0;
}
.VPSidebarItem.level-0 > .item > .text {
font-weight: 400;
font-size: 13px;
color: #808080;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.VPSidebarItem .link {
padding: 6px 12px;
margin: 1px 0;
border-radius: 4px;
color: #9d9d9d;
font-size: 14px;
transition: all 0.15s;
position: relative;
border-left: 2px solid transparent;
}
.VPSidebarItem .link:hover {
background: rgba(255, 255, 255, 0.05);
color: #ffffff;
}
.VPSidebarItem.is-active > .item > .link {
background: transparent;
color: #ffffff;
border-left: 2px solid #3b9eff;
}
.VPSidebarItem.level-1 .link {
padding-left: 24px;
font-size: 13px;
}
.VPSidebarItem.level-2 .link {
padding-left: 36px;
font-size: 13px;
}
.VPSidebarItem .caret {
color: #606060;
}
.VPSidebarItem .caret:hover {
color: #9d9d9d;
}
/* ============================================
内容区域
============================================ */
.VPContent {
background: transparent !important;
}
.VPDoc {
background: transparent !important;
}
.VPDoc .container {
max-width: 100% !important;
}
.VPDoc .content {
max-width: 860px !important;
padding: 80px 60px 48px !important;
}
.VPNavBar {
background: #0d0d0d !important;
}
.VPNavBar .content {
background: #0d0d0d !important;
}
.VPNavBar .content-body {
background: #0d0d0d !important;
}
.VPNavBar .divider {
display: none;
}
.VPLocalNav {
background: #0d0d0d !important;
border-bottom: 1px solid #2a2a2a !important;
}
.VPNavScreenMenu {
background: #0d0d0d !important;
}
.VPNavScreen {
background: #0d0d0d !important;
}
.curtain {
display: none !important;
}
.VPNav .curtain,
.VPNavBar .curtain {
display: none !important;
}
[class*="curtain"] {
display: none !important;
}
.VPNav > div::before,
.VPNav > div::after {
display: none !important;
}
.vp-doc {
color: #e0e0e0;
}
.vp-doc h1 {
font-size: 32px;
font-weight: 700;
color: #ffffff;
border-bottom: none;
padding-bottom: 0;
margin-bottom: 32px;
line-height: 1.2;
}
.vp-doc h2 {
font-size: 24px;
font-weight: 600;
color: #ffffff;
border-bottom: none;
padding-bottom: 0;
margin-top: 48px;
margin-bottom: 20px;
}
.vp-doc h3 {
font-size: 18px;
font-weight: 600;
color: #ffffff;
margin-top: 32px;
margin-bottom: 16px;
}
.vp-doc p {
color: #a0a0a0;
line-height: 1.8;
font-size: 15px;
margin: 20px 0;
}
.vp-doc ul,
.vp-doc ol {
padding-left: 24px;
margin: 20px 0;
}
.vp-doc li {
line-height: 1.8;
margin: 8px 0;
color: #a0a0a0;
font-size: 15px;
}
.vp-doc li::marker {
color: #707070;
}
.vp-doc strong {
color: #ffffff;
font-weight: 600;
}
.vp-doc a {
color: #3b9eff;
text-decoration: none;
}
.vp-doc a:hover {
text-decoration: underline;
}
/* ============================================
右侧大纲
============================================ */
.VPDocAside {
padding-left: 32px;
border-left: 1px solid #2a2a2a;
}
.VPDocAsideOutline {
padding: 0;
border: none !important;
}
.VPDocAsideOutline .content {
border: none !important;
padding-left: 0 !important;
}
.VPDocAsideOutline .outline-title {
font-size: 14px;
font-weight: 600;
text-transform: none;
letter-spacing: 0;
color: #ffffff;
padding-bottom: 16px;
}
.VPDocAsideOutline .outline-link {
color: #707070;
font-size: 13px;
padding: 6px 0;
line-height: 1.5;
display: block;
}
.VPDocAsideOutline .outline-link:hover {
color: #a0a0a0;
}
.VPDocAsideOutline .outline-link.active {
color: #3b9eff;
}
.VPDocAsideOutline .outline-marker {
display: none;
}
/* ============================================
代码块
============================================ */
div[class*='language-'] {
background: #1a1a1a !important;
border: 1px solid #2a2a2a;
border-radius: 8px;
margin: 20px 0;
}
.vp-code-group .tabs {
background: #1f1f1f;
border-bottom: 1px solid #2a2a2a;
}
.vp-doc :not(pre) > code {
background: #1f1f1f;
color: #3b9eff;
padding: 3px 8px;
border-radius: 4px;
font-size: 0.9em;
}
/* ============================================
表格
============================================ */
.vp-doc table {
display: table;
width: 100%;
background: transparent;
border: none;
border-collapse: collapse;
margin: 24px 0;
}
.vp-doc tr {
border-bottom: 1px solid #2a2a2a;
background: transparent;
}
.vp-doc tr:last-child {
border-bottom: none;
}
.vp-doc th {
background: #1f1f1f;
font-weight: 600;
font-size: 14px;
color: #a0a0a0;
text-align: left;
padding: 14px 20px;
border-bottom: 1px solid #2a2a2a;
}
.vp-doc td {
font-size: 15px;
color: #e0e0e0;
padding: 14px 20px;
vertical-align: top;
line-height: 1.6;
}
.vp-doc td:first-child {
font-weight: 500;
color: #a0a0a0;
min-width: 120px;
}
/* ============================================
提示框
============================================ */
.vp-doc .warning,
.vp-doc .custom-block.warning {
background: rgba(201, 162, 39, 0.08);
border: none;
border-left: 4px solid #c9a227;
border-radius: 0 8px 8px 0;
padding: 16px 24px;
margin: 24px 0;
}
.vp-doc .warning .custom-block-title,
.vp-doc .custom-block.warning .custom-block-title {
color: #c9a227;
font-weight: 600;
font-size: 15px;
margin-bottom: 8px;
}
.vp-doc .warning p {
color: #a0a0a0;
margin: 0;
}
.vp-doc .tip,
.vp-doc .custom-block.tip {
background: rgba(59, 158, 255, 0.08);
border: none;
border-left: 4px solid #3b9eff;
border-radius: 0 8px 8px 0;
padding: 16px 24px;
margin: 24px 0;
}
.vp-doc .tip .custom-block-title,
.vp-doc .custom-block.tip .custom-block-title {
color: #3b9eff;
font-weight: 600;
font-size: 15px;
margin-bottom: 8px;
}
.vp-doc .tip p {
color: #a0a0a0;
margin: 0;
}
.vp-doc .info,
.vp-doc .custom-block.info {
background: rgba(78, 201, 176, 0.08);
border: none;
border-left: 4px solid #4ec9b0;
border-radius: 0 8px 8px 0;
padding: 16px 24px;
margin: 24px 0;
}
.vp-doc .info .custom-block-title,
.vp-doc .custom-block.info .custom-block-title {
color: #4ec9b0;
font-weight: 600;
font-size: 15px;
margin-bottom: 8px;
}
.vp-doc .danger,
.vp-doc .custom-block.danger {
background: rgba(244, 135, 113, 0.08);
border: none;
border-left: 4px solid #f48771;
border-radius: 0 8px 8px 0;
padding: 16px 24px;
margin: 24px 0;
}
.vp-doc .danger .custom-block-title,
.vp-doc .custom-block.danger .custom-block-title {
color: #f48771;
font-weight: 600;
font-size: 15px;
margin-bottom: 8px;
}
/* ============================================
卡片样式
============================================ */
.vp-doc .card {
background: #1f1f1f;
border-radius: 12px;
padding: 24px;
margin: 24px 0;
}
.vp-doc .card-title {
font-size: 18px;
font-weight: 600;
color: #ffffff;
margin-bottom: 8px;
}
.vp-doc .card-description {
font-size: 14px;
color: #707070;
line-height: 1.6;
}
/* ============================================
标签样式
============================================ */
.vp-doc .tag {
display: inline-block;
padding: 4px 12px;
background: transparent;
border: 1px solid #3a3a3a;
border-radius: 16px;
color: #a0a0a0;
font-size: 13px;
margin-right: 8px;
margin-bottom: 8px;
}
/* ============================================
链接行样式
============================================ */
.vp-doc .link-row {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 0;
color: #a0a0a0;
font-size: 15px;
}
.vp-doc .link-row a {
color: #3b9eff;
}
/* ============================================
页脚
============================================ */
.VPFooter {
background: #1a1a1a !important;
border-top: 1px solid #2a2a2a !important;
}
/* ============================================
滚动条
============================================ */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: #3a3a3a;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #4a4a4a;
}
::-webkit-scrollbar-corner {
background: transparent;
}
/* ============================================
首页专用样式
============================================ */
.home-container {
max-width: 1200px;
margin: 0 auto;
padding: 0 24px;
}
.home-section {
padding: 48px 0;
}
/* ============================================
响应式
============================================ */
@media (max-width: 960px) {
.VPDoc .content {
padding: 24px !important;
}
.VPSidebar {
width: 100% !important;
}
}

View File

@@ -0,0 +1,12 @@
import DefaultTheme from 'vitepress/theme'
import ParticleHero from './components/ParticleHero.vue'
import FeatureCard from './components/FeatureCard.vue'
import './custom.css'
export default {
extends: DefaultTheme,
enhanceApp({ app }) {
app.component('ParticleHero', ParticleHero)
app.component('FeatureCard', FeatureCard)
}
}

View File

@@ -23,7 +23,6 @@ import { Core } from '@esengine/ecs-framework'
// 方式1使用配置对象推荐 // 方式1使用配置对象推荐
const core = Core.create({ const core = Core.create({
debug: true, // 启用调试模式,提供详细的日志和性能监控 debug: true, // 启用调试模式,提供详细的日志和性能监控
enableEntitySystems: true, // 启用实体系统这是ECS的核心功能
debugConfig: { // 可选:高级调试配置 debugConfig: { // 可选:高级调试配置
enabled: false, // 是否启用WebSocket调试服务器 enabled: false, // 是否启用WebSocket调试服务器
websocketUrl: 'ws://localhost:8080', websocketUrl: 'ws://localhost:8080',
@@ -39,12 +38,11 @@ const core = Core.create({
}); });
// 方式2简化创建向后兼容 // 方式2简化创建向后兼容
const core = Core.create(true); // 等同于 { debug: true, enableEntitySystems: true } const core = Core.create(true); // 等同于 { debug: true }
// 方式3生产环境配置 // 方式3生产环境配置
const core = Core.create({ const core = Core.create({
debug: false, // 生产环境关闭调试 debug: false // 生产环境关闭调试
enableEntitySystems: true
}); });
``` ```
@@ -55,9 +53,6 @@ interface ICoreConfig {
/** 是否启用调试模式 - 影响日志级别和性能监控 */ /** 是否启用调试模式 - 影响日志级别和性能监控 */
debug?: boolean; debug?: boolean;
/** 是否启用实体系统 - 核心ECS功能开关 */
enableEntitySystems?: boolean;
/** 高级调试配置 - 用于开发工具集成 */ /** 高级调试配置 - 用于开发工具集成 */
debugConfig?: { debugConfig?: {
enabled: boolean; // 是否启用调试服务器 enabled: boolean; // 是否启用调试服务器

View File

@@ -1,23 +1,329 @@
--- ---
layout: home layout: page
title: ESEngine - 高性能 TypeScript ECS 框架
hero:
name: "ECS Framework"
text: "高性能ECS框架"
tagline: "为Javascript游戏开发而设计"
actions:
- theme: brand
text: 快速开始
link: /guide/getting-started
- theme: alt
text: 查看示例
link: https://github.com/esengine/lawn-mower-demo
features:
- title: 高性能
details: 支持大规模实体处理
- title: 类型安全
details: 完整的TypeScript支持编译时类型检查
- title: 模块化设计
details: 核心功能独立打包,支持多平台
--- ---
<ParticleHero />
<section class="news-section">
<div class="news-container">
<div class="news-header">
<h2 class="news-title">快速入口</h2>
<a href="/guide/" class="news-more">查看文档</a>
</div>
<div class="news-grid">
<a href="/guide/getting-started" class="news-card">
<div class="news-card-image" style="background: linear-gradient(135deg, #1e3a5f 0%, #1e1e1e 100%);">
<div class="news-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path fill="#4fc1ff" d="M12 3L1 9l4 2.18v6L12 21l7-3.82v-6l2-1.09V17h2V9zm6.82 6L12 12.72L5.18 9L12 5.28zM17 16l-5 2.72L7 16v-3.73L12 15l5-2.73z"/></svg>
</div>
<span class="news-badge">快速开始</span>
</div>
<div class="news-card-content">
<h3>5 分钟上手 ESEngine</h3>
<p>从安装到创建第一个 ECS 应用,快速了解核心概念。</p>
</div>
</a>
<a href="/guide/behavior-tree/" class="news-card">
<div class="news-card-image" style="background: linear-gradient(135deg, #1e3a5f 0%, #1e1e1e 100%);">
<div class="news-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path fill="#4ec9b0" d="M12 2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2m3 20h-1v-7l-2-2l-2 2v7H9v-7.5l-2 2V22H6v-6l3-3l1-3.5c-.3.4-.6.7-1 1L6 9v1H4V8l5-3c.5-.3 1.1-.5 1.7-.5H11c.6 0 1.2.2 1.7.5l5 3v2h-2V9l-3 1.5c-.4-.3-.7-.6-1-1l1 3.5l3 3v6Z"/></svg>
</div>
<span class="news-badge">AI 系统</span>
</div>
<div class="news-card-content">
<h3>行为树可视化编辑器</h3>
<p>内置 AI 行为树系统,支持可视化编辑和实时调试。</p>
</div>
</a>
</div>
</div>
</section>
<section class="features-section">
<div class="features-container">
<h2 class="features-title">核心特性</h2>
<div class="features-grid">
<div class="feature-card">
<div class="feature-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="#4fc1ff" d="M13 2.05v2.02c3.95.49 7 3.85 7 7.93c0 1.45-.39 2.79-1.06 3.95l1.59 1.09A9.94 9.94 0 0 0 22 12c0-5.18-3.95-9.45-9-9.95M12 19c-3.87 0-7-3.13-7-7c0-3.53 2.61-6.43 6-6.92V2.05c-5.06.5-9 4.76-9 9.95c0 5.52 4.47 10 9.99 10c3.31 0 6.24-1.61 8.06-4.09l-1.6-1.1A7.93 7.93 0 0 1 12 19"/><path fill="#4fc1ff" d="M12 6a6 6 0 0 0-6 6c0 3.31 2.69 6 6 6a6 6 0 0 0 0-12m0 10c-2.21 0-4-1.79-4-4s1.79-4 4-4s4 1.79 4 4s-1.79 4-4 4"/></svg>
</div>
<h3 class="feature-title">高性能 ECS 架构</h3>
<p class="feature-desc">基于数据驱动的实体组件系统,支持大规模实体处理,缓存友好的内存布局。</p>
<a href="/guide/entity" class="feature-link">了解更多 →</a>
</div>
<div class="feature-card">
<div class="feature-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="#569cd6" d="M3 3h18v18H3zm16.525 13.707c0-.795-.272-1.425-.816-1.89c-.544-.465-1.404-.804-2.58-1.016l-1.704-.296c-.616-.104-1.052-.26-1.308-.468c-.256-.21-.384-.468-.384-.776c0-.392.168-.7.504-.924c.336-.224.8-.336 1.392-.336c.56 0 1.008.124 1.344.372c.336.248.536.584.6 1.008h2.016c-.08-.96-.464-1.716-1.152-2.268c-.688-.552-1.6-.828-2.736-.828c-1.2 0-2.148.3-2.844.9c-.696.6-1.044 1.38-1.044 2.34c0 .76.252 1.368.756 1.824c.504.456 1.308.792 2.412.996l1.704.312c.624.12 1.068.28 1.332.48c.264.2.396.46.396.78c0 .424-.192.756-.576.996c-.384.24-.9.36-1.548.36c-.672 0-1.2-.14-1.584-.42c-.384-.28-.608-.668-.672-1.164H8.868c.048 1.016.46 1.808 1.236 2.376c.776.568 1.796.852 3.06.852c1.24 0 2.22-.292 2.94-.876c.72-.584 1.08-1.364 1.08-2.34z"/></svg>
</div>
<h3 class="feature-title">完整类型支持</h3>
<p class="feature-desc">100% TypeScript 编写,完整的类型定义和编译时检查,提供最佳的开发体验。</p>
<a href="/guide/component" class="feature-link">了解更多 →</a>
</div>
<div class="feature-card">
<div class="feature-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="#4ec9b0" d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10s10-4.5 10-10S17.5 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8s8 3.59 8 8s-3.59 8-8 8m-5-8l4-4v3h4v2h-4v3z"/></svg>
</div>
<h3 class="feature-title">可视化行为树</h3>
<p class="feature-desc">内置 AI 行为树系统,提供可视化编辑器,支持自定义节点和实时调试。</p>
<a href="/guide/behavior-tree/" class="feature-link">了解更多 →</a>
</div>
<div class="feature-card">
<div class="feature-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="#c586c0" d="M4 6h18V4H4c-1.1 0-2 .9-2 2v11H0v3h14v-3H4zm19 2h-6c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1m-1 9h-4v-7h4z"/></svg>
</div>
<h3 class="feature-title">多平台支持</h3>
<p class="feature-desc">支持浏览器、Node.js、微信小游戏等多平台可与主流游戏引擎无缝集成。</p>
<a href="/guide/platform-adapter" class="feature-link">了解更多 →</a>
</div>
<div class="feature-card">
<div class="feature-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="#dcdcaa" d="M4 3h6v2H4v14h6v2H4c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2m9 0h6c1.1 0 2 .9 2 2v14c0 1.1-.9 2-2 2h-6v-2h6V5h-6zm-1 7h4v2h-4z"/></svg>
</div>
<h3 class="feature-title">模块化设计</h3>
<p class="feature-desc">核心功能独立打包,按需引入。支持自定义插件扩展,灵活适配不同项目。</p>
<a href="/guide/plugin-system" class="feature-link">了解更多 →</a>
</div>
<div class="feature-card">
<div class="feature-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="#9cdcfe" d="M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9c-2-2-5-2.4-7.4-1.3L9 6L6 9L1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4"/></svg>
</div>
<h3 class="feature-title">开发者工具</h3>
<p class="feature-desc">内置性能监控、调试工具、序列化系统等,提供完整的开发工具链。</p>
<a href="/guide/logging" class="feature-link">了解更多 →</a>
</div>
</div>
</div>
</section>
<style>
/* 隐藏 VitePress 默认样式 */
.VPDoc {
padding: 0 !important;
}
.vp-doc {
padding: 0 !important;
}
.VPContent {
padding: 0 !important;
}
.news-section {
background: #0d0d0d;
padding: 64px 0;
border-top: 1px solid #2a2a2a;
}
.news-container {
max-width: 1400px;
margin: 0 auto;
padding: 0 48px;
}
.news-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 32px;
}
.news-title {
font-size: 1.5rem;
font-weight: 700;
color: #ffffff;
margin: 0;
}
.news-more {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 20px;
background: #1a1a1a;
border: 1px solid #2a2a2a;
border-radius: 6px;
color: #a0a0a0;
font-size: 0.875rem;
font-weight: 500;
text-decoration: none;
transition: all 0.2s;
}
.news-more:hover {
background: #252525;
color: #ffffff;
}
.news-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 24px;
}
.news-card {
display: flex;
background: #1f1f1f;
border: 1px solid #2a2a2a;
border-radius: 12px;
overflow: hidden;
text-decoration: none;
transition: all 0.2s;
}
.news-card:hover {
border-color: #3b9eff;
}
.news-card-image {
width: 200px;
min-height: 140px;
flex-shrink: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 16px;
gap: 12px;
}
.news-icon {
opacity: 0.9;
}
.news-badge {
display: inline-block;
padding: 4px 12px;
background: transparent;
border: 1px solid #3a3a3a;
border-radius: 16px;
color: #a0a0a0;
font-size: 0.75rem;
font-weight: 500;
}
.news-card-content {
padding: 20px;
display: flex;
flex-direction: column;
justify-content: center;
}
.news-card-content h3 {
font-size: 1.125rem;
font-weight: 600;
color: #ffffff;
margin: 0 0 8px 0;
}
.news-card-content p {
font-size: 0.875rem;
color: #707070;
margin: 0;
line-height: 1.6;
}
.features-section {
background: #0d0d0d;
padding: 64px 0;
}
.features-container {
max-width: 1400px;
margin: 0 auto;
padding: 0 48px;
}
.features-title {
font-size: 1.5rem;
font-weight: 700;
color: #ffffff;
margin: 0 0 32px 0;
}
.features-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20px;
}
.feature-card {
background: #1f1f1f;
border: 1px solid #2a2a2a;
border-radius: 12px;
padding: 24px;
transition: all 0.15s ease;
}
.feature-card:hover {
border-color: #3b9eff;
background: #252525;
}
.feature-icon {
width: 48px;
height: 48px;
background: #0d0d0d;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 16px;
}
.feature-title {
font-size: 16px;
font-weight: 600;
color: #ffffff;
margin: 0 0 8px 0;
}
.feature-desc {
font-size: 14px;
color: #707070;
line-height: 1.7;
margin: 0 0 16px 0;
}
.feature-link {
font-size: 14px;
color: #3b9eff;
text-decoration: none;
font-weight: 500;
}
.feature-link:hover {
text-decoration: underline;
}
@media (max-width: 1024px) {
.news-container,
.features-container {
padding: 0 24px;
}
.news-grid {
grid-template-columns: 1fr;
}
.features-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 768px) {
.news-card {
flex-direction: column;
}
.news-card-image {
width: 100%;
min-height: 120px;
}
.features-grid {
grid-template-columns: 1fr;
}
}
</style>

1
docs/public/CNAME Normal file
View File

@@ -0,0 +1 @@
esengine.cn

17805
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff