Compare commits

...

10 Commits

Author SHA1 Message Date
bf5f57bc60 update 2026-01-03 20:19:35 +08:00
7996896530 update 2025-12-26 18:58:50 +08:00
f7ea3a5d6d update 2025-12-26 18:57:14 +08:00
5999e49967 update 2025-12-17 23:23:53 +08:00
bbd1232243 update 2025-12-11 13:34:59 +08:00
4ddf3fbe0a temp 2025-12-05 22:36:37 +08:00
0df73b268a update 2025-12-05 22:35:54 +08:00
ffdf0502e2 添加 src/layouts/MDXPost.astro 2025-12-01 18:27:40 +08:00
1f5a0795d3 更新 astro.config.mjs 2025-11-26 04:27:27 +08:00
f0b859311f 1 2025-11-26 04:22:35 +08:00
12 changed files with 826 additions and 801 deletions

View File

@@ -5,17 +5,15 @@ import sitemap from '@astrojs/sitemap';
import pkgs from './package.json'; import pkgs from './package.json';
import tailwindcss from '@tailwindcss/vite'; import tailwindcss from '@tailwindcss/vite';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
import vue from '@astrojs/vue'; // import vue from '@astrojs/vue';
dotenv.config(); dotenv.config();
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
let target = process.env.VITE_API_URL || 'http://localhost:51015'; let target = process.env.VITE_API_URL || 'http://localhost:51515';
const apiProxy = { target: target, changeOrigin: true, ws: true, rewriteWsOrigin: true, secure: false, cookieDomainRewrite: 'localhost' }; const apiProxy = { target: target, changeOrigin: true, ws: true, rewriteWsOrigin: true, secure: false, cookieDomainRewrite: 'localhost' };
let proxy = { let proxy = {
'/root/': { '/root/': apiProxy,
target: `${target}/root/`,
},
'/api': apiProxy, '/api': apiProxy,
'/client': apiProxy, '/client': apiProxy,
}; };
@@ -26,19 +24,20 @@ export default defineConfig({
integrations: [ integrations: [
mdx(), mdx(),
react(), // react(), //
vue(), // vue(),
// sitemap(), // sitemap must be site has a domain // sitemap(), // sitemap must be site has a domain
], ],
server: {
port: 7008,
host: '0.0.0.0',
allowedHosts: true,
},
vite: { vite: {
plugins: [tailwindcss()], plugins: [tailwindcss()],
define: { define: {
BASE_NAME: JSON.stringify(basename || ''), BASE_NAME: JSON.stringify(basename || ''),
}, },
server: { server: {
port: 7008,
host: '0.0.0.0',
allowedHosts: true,
proxy, proxy,
}, },
}, },

21
kevisual.json Normal file
View File

@@ -0,0 +1,21 @@
{
"metadata": {
"name": "kevisual",
"share": "public"
},
"registry": "https://kevisual.cn/root/ai/kevisual/frontend/simple-astro-template",
"clone": {
".": {
"enabled": true
}
},
"syncd": [
{
"files": [
"**/*"
],
"registry": ""
}
],
"sync": {}
}

View File

@@ -19,34 +19,35 @@
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@astrojs/mdx": "^4.3.12", "@astrojs/mdx": "^4.3.13",
"@astrojs/react": "^4.4.2", "@astrojs/react": "^4.4.2",
"@astrojs/sitemap": "^3.6.0", "@astrojs/sitemap": "^3.6.0",
"@astrojs/vue": "^5.1.3", "@astrojs/vue": "^5.1.3",
"@kevisual/query": "^0.0.29", "@kevisual/context": "^0.0.4",
"@kevisual/query": "^0.0.35",
"@kevisual/query-login": "^0.0.7", "@kevisual/query-login": "^0.0.7",
"@kevisual/registry": "^0.0.1", "@kevisual/registry": "^0.0.1",
"@radix-ui/react-slot": "^1.2.4", "@radix-ui/react-slot": "^1.2.4",
"@tailwindcss/vite": "^4.1.17", "@tailwindcss/vite": "^4.1.18",
"@uiw/react-md-editor": "^4.0.8", "@uiw/react-md-editor": "^4.0.11",
"antd": "^6.0.0", "antd": "^6.1.3",
"astro": "^5.16.0", "astro": "^5.16.6",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"dayjs": "^1.11.19", "dayjs": "^1.11.19",
"es-toolkit": "^1.42.0", "es-toolkit": "^1.43.0",
"github-markdown-css": "^5.8.1", "github-markdown-css": "^5.8.1",
"highlight.js": "^11.11.1", "highlight.js": "^11.11.1",
"lucide-react": "^0.554.0", "lucide-react": "^0.562.0",
"marked": "^17.0.1", "marked": "^17.0.1",
"marked-highlight": "^2.2.3", "marked-highlight": "^2.2.3",
"nanoid": "^5.1.6", "nanoid": "^5.1.6",
"react": "^19.2.0", "react": "^19.2.3",
"react-dom": "^19.2.0", "react-dom": "^19.2.3",
"react-toastify": "^11.0.5", "react-toastify": "^11.0.5",
"tailwind-merge": "^3.4.0", "tailwind-merge": "^3.4.0",
"vue": "^3.5.25", "vue": "^3.5.26",
"zustand": "^5.0.8" "zustand": "^5.0.9"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
@@ -56,10 +57,10 @@
"@types/react": "^19.2.7", "@types/react": "^19.2.7",
"@types/react-dom": "^19.2.3", "@types/react-dom": "^19.2.3",
"dotenv": "^17.2.3", "dotenv": "^17.2.3",
"tailwindcss": "^4.1.17", "tailwindcss": "^4.1.18",
"tw-animate-css": "^1.4.0" "tw-animate-css": "^1.4.0"
}, },
"packageManager": "pnpm@10.23.0", "packageManager": "pnpm@10.27.0",
"onlyBuiltDependencies": [ "onlyBuiltDependencies": [
"@tailwindcss/oxide", "@tailwindcss/oxide",
"esbuild", "esbuild",

1486
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

17
readme.md Normal file
View File

@@ -0,0 +1,17 @@
# template
在开发多项目的时候实时创建的新的模块界面git 已经满足不了正常开发需求,文件随时更新。以最新为标准,进行同步和开发。
## 使用方法
### simple-lit-vite
```sh
ev sync clone -i https://kevisual.cn/root/ai/kevisual/frontend/simple-astro-template/kevisual.json
```
### simple-slide
```sh
ev sync clone -i https://kevisual.cn/root/ai/kevisual/frontend/simple-astro-template/kevisual.json
```

View File

@@ -1,10 +1,10 @@
--- ---
title: 'astro 例子' title: '想要模板做什么'
tags: ['astro', 'simple', 'template'] tags: ['astro', 'simple', 'template']
createdAt: '2025-11-25 20:00:00' createdAt: '2025-11-25 20:00:00'
hideInMenu: true hideInMenu: true
--- ---
## astro-simplate-template ## 模板介绍
astro 是一个非常好的 合并文档内容和开发项目的模块

24
src/layouts/MDXPost.astro Normal file
View File

@@ -0,0 +1,24 @@
---
import '../styles/global.css';
export interface Props {
title?: string;
description?: string;
}
import 'github-markdown-css/github-markdown-light.css';
import 'highlight.js/styles/github-dark.css';
const { title, description } = Astro.props;
---
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>{title || '文档'}</title>
</head>
<body class="bg-gray-50 min-h-screen">
<div class="container mx-auto px-4 py-8 max-w-4xl">
<article class="markdown-body bg-white rounded-lg shadow-lg p-8">
<slot />
</article>
</div>
</body>
</html>

View File

@@ -0,0 +1,4 @@
---
---
分页组件

View File

@@ -4,8 +4,9 @@ export const basename = BASE_NAME;
console.log(basename); console.log(basename);
export const wrapBasename = (path: string) => { export const wrapBasename = (path: string) => {
const hasEnd = path.endsWith('/')
if (basename) { if (basename) {
return `${basename}${path}/`; return `${basename}${path}` + (hasEnd ? '' : '/');
} else { } else {
return path; return path;
} }

View File

@@ -1,10 +1,10 @@
--- ---
import Html from '@/components/html.astro'; import Html from '@/components/html.astro';
import Counter from '@/components/vue/Counter.vue'; // import Counter from '@/components/vue/Counter.vue';
--- ---
<Html> <Html>
<main> <main>
<Counter count={10} client:only/> <!-- <Counter count={10} client:only/> -->
</main> </main>
</Html> </Html>

View File

@@ -22,6 +22,6 @@ const staticPaths = await getStaticPaths();
const menu = staticPaths.map((item) => item.data); const menu = staticPaths.map((item) => item.data);
--- ---
<Main showMenu={showMenu} menu={menu} basename={basename}> <Main showMenu={showMenu} menu={menu} basename={basename} title={post.data.title}>
<Content /> <Content />
</Main> </Main>

View File

@@ -1,7 +1,7 @@
--- ---
import { getCollection } from 'astro:content'; import { getCollection } from 'astro:content';
const posts = await getCollection('docs'); const posts = await getCollection('docs');
import { basename } from '@/modules/basename'; import { basename, wrapBasename } from '@/modules/basename';
import Blank from '@/layouts/blank.astro'; import Blank from '@/layouts/blank.astro';
--- ---
@@ -10,10 +10,7 @@ import Blank from '@/layouts/blank.astro';
<div class='max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12'> <div class='max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12'>
{/* 页面标题区域 */} {/* 页面标题区域 */}
<div class='mb-12'> <div class='mb-12'>
<h1 <h1 class='text-4xl sm:text-5xl font-bold text-slate-900 dark:text-white mb-4 bg-clip-text bg-linear-to-r from-blue-600 to-purple-600'>📚 文档列表</h1>
class='text-4xl sm:text-5xl font-bold text-slate-900 dark:text-white mb-4 bg-clip-text bg-linear-to-r from-blue-600 to-purple-600'>
📚 文档列表
</h1>
<p class='text-slate-600 dark:text-slate-400 text-lg'>浏览所有可用的文档资源</p> <p class='text-slate-600 dark:text-slate-400 text-lg'>浏览所有可用的文档资源</p>
<div class='mt-4 h-1 w-20 bg-linear-to-r from-blue-600 to-purple-600 rounded-full'></div> <div class='mt-4 h-1 w-20 bg-linear-to-r from-blue-600 to-purple-600 rounded-full'></div>
</div> </div>
@@ -23,11 +20,12 @@ import Blank from '@/layouts/blank.astro';
{ {
posts.map((post) => { posts.map((post) => {
const tags = post.data.tags || []; const tags = post.data.tags || [];
const postUrl = wrapBasename(`/docs/${post.id}`);
return ( return (
<article class='group bg-white dark:bg-slate-800 rounded-xl shadow-sm hover:shadow-xl transition-all duration-300 overflow-hidden border border-slate-200 dark:border-slate-700 hover:border-blue-500 dark:hover:border-blue-400'> <article class='group bg-white dark:bg-slate-800 rounded-xl shadow-sm hover:shadow-xl transition-all duration-300 overflow-hidden border border-slate-200 dark:border-slate-700 hover:border-blue-500 dark:hover:border-blue-400'>
<div class='p-6'> <div class='p-6'>
{/* 文档标题 */} {/* 文档标题 */}
<a href={`${basename}/docs/${post.id}/`} class='block'> <a href={postUrl} class='block'>
<h2 class='text-xl sm:text-2xl font-semibold text-slate-900 dark:text-white group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors duration-200 mb-3'> <h2 class='text-xl sm:text-2xl font-semibold text-slate-900 dark:text-white group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors duration-200 mb-3'>
{post.data.title} {post.data.title}
</h2> </h2>
@@ -50,7 +48,7 @@ import Blank from '@/layouts/blank.astro';
{/* 阅读更多指示器 */} {/* 阅读更多指示器 */}
<a <a
href={`${basename}/docs/${post.id}/`} href={postUrl}
class='mt-4 flex items-center text-blue-600 dark:text-blue-400 text-sm font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-200'> class='mt-4 flex items-center text-blue-600 dark:text-blue-400 text-sm font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-200'>
<span>阅读更多</span> <span>阅读更多</span>
<svg <svg