commit b00b4a69a7c6329838aed388d564ffce254b9abe Author: xiongxiao Date: Sat Mar 21 20:32:27 2026 +0800 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..66f45fd --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +# build output +dist +# generated types +.astro + +# dependencies +node_modules + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/README.md b/README.md new file mode 100644 index 0000000..449d9a9 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Astro Note diff --git a/astro.config.mjs b/astro.config.mjs new file mode 100644 index 0000000..c935b45 --- /dev/null +++ b/astro.config.mjs @@ -0,0 +1,63 @@ +// @ts-check +import { defineConfig } from 'astro/config'; +import starlight from '@astrojs/starlight'; +import path from 'path'; +import react from '@astrojs/react'; +import tailwindcss from '@tailwindcss/vite'; +import pkgs from './package.json'; +import dotenv from 'dotenv'; + +const env = dotenv.config().parsed || {}; +const isDev = env.NODE_ENV === 'development' || process.env.NODE_ENV === 'development'; +const basename = isDev ? '/' : pkgs?.basename || '/'; + +let target = env.VITE_API_URL || process.env.API_URL || 'http://localhost:51515'; +const apiProxy = { target: target, changeOrigin: true, ws: true, rewriteWsOrigin: true, secure: false, cookieDomainRewrite: 'localhost' }; +let proxy = { + '/root/': apiProxy, + '/api': apiProxy, + '/client': apiProxy, +}; + +// https://astro.build/config +export default defineConfig({ + base: basename, + integrations: [ + starlight({ + title: 'Note', + social: [], + sidebar: [ + { + label: 'Guides', + items: [ + // Each item here is one entry in the navigation menu. + { label: 'Example Guide', slug: 'guides/example' }, + ], + }, + { + label: 'Reference', + autogenerate: { directory: 'reference' }, + }, + ], + customCss: [ + './src/styles/global.css', + ], + }), + react(), // + ], + server: { + port: 7008, + host: '0.0.0.0', + allowedHosts: true, + }, + vite: { + // @ts-ignore + plugins: [tailwindcss()], + define: { + BASE_NAME: JSON.stringify(basename || ''), + }, + server: { + proxy, + }, + }, +}); diff --git a/components.json b/components.json new file mode 100644 index 0000000..c3cc1db --- /dev/null +++ b/components.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "base-nova", + "rsc": false, + "tsx": true, + "tailwind": { + "config": "tailwind.config.ts", + "css": "src/index.css", + "baseColor": "neutral", + "cssVariables": true + }, + "iconLibrary": "lucide", + "aliases": { + "components": "@/components", + "utils": "@/lib/utils", + "ui": "@/components/ui", + "lib": "@/lib", + "hooks": "@/hooks" + } +} \ No newline at end of file diff --git a/kevisual.json b/kevisual.json new file mode 100644 index 0000000..6808a3a --- /dev/null +++ b/kevisual.json @@ -0,0 +1,21 @@ +{ + "metadata": { + "name": "kevisual", + "share": "public" + }, + "registry": "https://kevisual.cn/root/resources/ai/1.0.0/kevisual/frontend/astro-note-template", + "clone": { + ".": { + "enabled": true + } + }, + "syncd": [ + { + "files": [ + "**/*" + ], + "registry": "" + } + ], + "sync": {} +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..c402851 --- /dev/null +++ b/package.json @@ -0,0 +1,37 @@ +{ + "name": "astro-note-template", + "type": "module", + "version": "0.0.1", + "basename": "/root/astro-note-template", + "scripts": { + "dev": "astro dev", + "start": "astro dev", + "build": "astro build", + "preview": "astro preview", + "astro": "astro", + "ui": "bunx shadcn@latest add ", + "pub": "ev deploy ./dist -k astro-note-template -v 0.0.1 -y y -u" + }, + "dependencies": { + "@astrojs/starlight": "^0.38.2", + "@base-ui/react": "^1.3.0", + "@kevisual/query": "^0.0.55", + "@kevisual/router": "^0.1.6", + "astro": "^6.0.1", + "class-variance-authority": "^0.7.1", + "react": "^19.2.4", + "react-dom": "^19.2.4", + "sharp": "^0.34.2", + "tw-animate-css": "^1.4.0" + }, + "devDependencies": { + "@astrojs/react": "^5.0.1", + "@astrojs/starlight-tailwind": "^5.0.0", + "@kevisual/types": "^0.0.12", + "@tailwindcss/vite": "^4.2.2", + "clsx": "^2.1.1", + "dotenv": "^17.3.1", + "tailwind-merge": "^3.5.0", + "tailwindcss": "^4.2.2" + } +} \ No newline at end of file diff --git a/public/favicon.svg b/public/favicon.svg new file mode 100644 index 0000000..cba5ac1 --- /dev/null +++ b/public/favicon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/houston.webp b/src/assets/houston.webp new file mode 100644 index 0000000..930c164 Binary files /dev/null and b/src/assets/houston.webp differ diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx new file mode 100644 index 0000000..226defb --- /dev/null +++ b/src/components/ui/button.tsx @@ -0,0 +1,58 @@ +import { Button as ButtonPrimitive } from "@base-ui/react/button" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" + +const buttonVariants = cva( + "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + { + variants: { + variant: { + default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80", + outline: + "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50", + secondary: + "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground", + ghost: + "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50", + destructive: + "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40", + link: "text-primary underline-offset-4 hover:underline", + }, + size: { + default: + "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2", + xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3", + sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5", + lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3", + icon: "size-8", + "icon-xs": + "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3", + "icon-sm": + "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg", + "icon-lg": "size-9", + }, + }, + defaultVariants: { + variant: "default", + size: "default", + }, + } +) + +function Button({ + className, + variant = "default", + size = "default", + ...props +}: ButtonPrimitive.Props & VariantProps) { + return ( + + ) +} + +export { Button, buttonVariants } diff --git a/src/content.config.ts b/src/content.config.ts new file mode 100644 index 0000000..d9ee8c9 --- /dev/null +++ b/src/content.config.ts @@ -0,0 +1,7 @@ +import { defineCollection } from 'astro:content'; +import { docsLoader } from '@astrojs/starlight/loaders'; +import { docsSchema } from '@astrojs/starlight/schema'; + +export const collections = { + docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }), +}; diff --git a/src/content/docs/guides/example.md b/src/content/docs/guides/example.md new file mode 100644 index 0000000..ebd0f3b --- /dev/null +++ b/src/content/docs/guides/example.md @@ -0,0 +1,11 @@ +--- +title: Example Guide +description: A guide in my new Starlight docs site. +--- + +Guides lead a user through a specific task they want to accomplish, often with a sequence of steps. +Writing a good guide requires thinking about what your users are trying to do. + +## Further reading + +- Read [about how-to guides](https://diataxis.fr/how-to-guides/) in the Diátaxis framework diff --git a/src/content/docs/index.mdx b/src/content/docs/index.mdx new file mode 100644 index 0000000..e6ed51f --- /dev/null +++ b/src/content/docs/index.mdx @@ -0,0 +1,40 @@ +--- +title: Welcome to Starlight +description: Get started building your docs site with Starlight. +template: splash # Remove or comment out this line to display the site sidebar on this page. +hero: + tagline: Congrats on setting up a new Starlight project! + image: + file: ../../assets/houston.webp + actions: + - text: Example Guide + link: /guides/example/ + icon: right-arrow + - text: Read the Starlight docs + link: https://starlight.astro.build + icon: external + variant: minimal +--- + +import { Card, CardGrid } from '@astrojs/starlight/components'; + +## Next steps + + + + Edit `src/content/docs/index.mdx` to see this page change. + + + Delete `template: splash` in `src/content/docs/index.mdx` to display a + sidebar on this page. + + + Add Markdown or MDX files to `src/content/docs` to create new pages. + + + Edit your `sidebar` and other config in `astro.config.mjs`. + + + Learn more in [the Starlight Docs](https://starlight.astro.build/). + + diff --git a/src/content/docs/reference/example.md b/src/content/docs/reference/example.md new file mode 100644 index 0000000..0224f09 --- /dev/null +++ b/src/content/docs/reference/example.md @@ -0,0 +1,11 @@ +--- +title: Example Reference +description: A reference page in my new Starlight docs site. +--- + +Reference pages are ideal for outlining how things work in terse and clear terms. +Less concerned with telling a story or addressing a specific use case, they should give a comprehensive outline of what you're documenting. + +## Further reading + +- Read [about reference](https://diataxis.fr/reference/) in the Diátaxis framework diff --git a/src/lib/utils.ts b/src/lib/utils.ts new file mode 100644 index 0000000..bd0c391 --- /dev/null +++ b/src/lib/utils.ts @@ -0,0 +1,6 @@ +import { clsx, type ClassValue } from "clsx" +import { twMerge } from "tailwind-merge" + +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)) +} diff --git a/src/modules/basename.ts b/src/modules/basename.ts new file mode 100644 index 0000000..788806a --- /dev/null +++ b/src/modules/basename.ts @@ -0,0 +1,13 @@ +// @ts-ignore +export const basename = BASE_NAME; + +console.log(basename); + +export const wrapBasename = (path: string) => { + const hasEnd = path.endsWith('/') + if (basename) { + return `${basename}${path}` + (hasEnd ? '' : '/'); + } else { + return path; + } +} \ No newline at end of file diff --git a/src/modules/query.ts b/src/modules/query.ts new file mode 100644 index 0000000..caf1d03 --- /dev/null +++ b/src/modules/query.ts @@ -0,0 +1,3 @@ +import { Query } from '@kevisual/query' + +export const query = new Query({}); \ No newline at end of file diff --git a/src/styles/global.css b/src/styles/global.css new file mode 100644 index 0000000..68c1aae --- /dev/null +++ b/src/styles/global.css @@ -0,0 +1,126 @@ +@layer base, starlight, theme, components, utilities; + +@import '@astrojs/starlight-tailwind'; +@import 'tailwindcss/theme.css' layer(theme); +@import 'tailwindcss/utilities.css' layer(utilities); + +@import 'tailwindcss'; +@import "tw-animate-css"; + +@custom-variant dark (&:is(.dark *)); + +@theme inline { + --radius-sm: calc(var(--radius) - 4px); + --radius-md: calc(var(--radius) - 2px); + --radius-lg: var(--radius); + --radius-xl: calc(var(--radius) + 4px); + --color-background: var(--background); + --color-foreground: var(--foreground); + --color-card: var(--card); + --color-card-foreground: var(--card-foreground); + --color-popover: var(--popover); + --color-popover-foreground: var(--popover-foreground); + --color-primary: var(--primary); + --color-primary-foreground: var(--primary-foreground); + --color-secondary: var(--secondary); + --color-secondary-foreground: var(--secondary-foreground); + --color-muted: var(--muted); + --color-muted-foreground: var(--muted-foreground); + --color-accent: var(--accent); + --color-accent-foreground: var(--accent-foreground); + --color-destructive: var(--destructive); + --color-border: var(--border); + --color-input: var(--input); + --color-ring: var(--ring); + --color-chart-1: var(--chart-1); + --color-chart-2: var(--chart-2); + --color-chart-3: var(--chart-3); + --color-chart-4: var(--chart-4); + --color-chart-5: var(--chart-5); + --color-sidebar: var(--sidebar); + --color-sidebar-foreground: var(--sidebar-foreground); + --color-sidebar-primary: var(--sidebar-primary); + --color-sidebar-primary-foreground: var(--sidebar-primary-foreground); + --color-sidebar-accent: var(--sidebar-accent); + --color-sidebar-accent-foreground: var(--sidebar-accent-foreground); + --color-sidebar-border: var(--sidebar-border); + --color-sidebar-ring: var(--sidebar-ring); +} + +:root { + --radius: 0.625rem; + --background: oklch(1 0 0); + --foreground: oklch(0.145 0 0); + --card: oklch(1 0 0); + --card-foreground: oklch(0.145 0 0); + --popover: oklch(1 0 0); + --popover-foreground: oklch(0.145 0 0); + --primary: oklch(0.205 0 0); + --primary-foreground: oklch(0.985 0 0); + --secondary: oklch(0.97 0 0); + --secondary-foreground: oklch(0.205 0 0); + --muted: oklch(0.97 0 0); + --muted-foreground: oklch(0.556 0 0); + --accent: oklch(0.97 0 0); + --accent-foreground: oklch(0.205 0 0); + --destructive: oklch(0.577 0.245 27.325); + --border: oklch(0.922 0 0); + --input: oklch(0.922 0 0); + --ring: oklch(0.708 0 0); + --chart-1: oklch(0.646 0.222 41.116); + --chart-2: oklch(0.6 0.118 184.704); + --chart-3: oklch(0.398 0.07 227.392); + --chart-4: oklch(0.828 0.189 84.429); + --chart-5: oklch(0.769 0.188 70.08); + --sidebar: oklch(0.985 0 0); + --sidebar-foreground: oklch(0.145 0 0); + --sidebar-primary: oklch(0.205 0 0); + --sidebar-primary-foreground: oklch(0.985 0 0); + --sidebar-accent: oklch(0.97 0 0); + --sidebar-accent-foreground: oklch(0.205 0 0); + --sidebar-border: oklch(0.922 0 0); + --sidebar-ring: oklch(0.708 0 0); +} + +.dark { + --background: oklch(0.145 0 0); + --foreground: oklch(0.985 0 0); + --card: oklch(0.205 0 0); + --card-foreground: oklch(0.985 0 0); + --popover: oklch(0.205 0 0); + --popover-foreground: oklch(0.985 0 0); + --primary: oklch(0.922 0 0); + --primary-foreground: oklch(0.205 0 0); + --secondary: oklch(0.269 0 0); + --secondary-foreground: oklch(0.985 0 0); + --muted: oklch(0.269 0 0); + --muted-foreground: oklch(0.708 0 0); + --accent: oklch(0.269 0 0); + --accent-foreground: oklch(0.985 0 0); + --destructive: oklch(0.704 0.191 22.216); + --border: oklch(1 0 0 / 10%); + --input: oklch(1 0 0 / 15%); + --ring: oklch(0.556 0 0); + --chart-1: oklch(0.488 0.243 264.376); + --chart-2: oklch(0.696 0.17 162.48); + --chart-3: oklch(0.769 0.188 70.08); + --chart-4: oklch(0.627 0.265 303.9); + --chart-5: oklch(0.645 0.246 16.439); + --sidebar: oklch(0.205 0 0); + --sidebar-foreground: oklch(0.985 0 0); + --sidebar-primary: oklch(0.488 0.243 264.376); + --sidebar-primary-foreground: oklch(0.985 0 0); + --sidebar-accent: oklch(0.269 0 0); + --sidebar-accent-foreground: oklch(0.985 0 0); + --sidebar-border: oklch(1 0 0 / 10%); + --sidebar-ring: oklch(0.556 0 0); +} + +@layer base { + * { + @apply border-border outline-ring/50; + } + body { + @apply bg-background text-foreground; + } +} \ No newline at end of file diff --git a/src/styles/theme.css b/src/styles/theme.css new file mode 100644 index 0000000..47b517d --- /dev/null +++ b/src/styles/theme.css @@ -0,0 +1,98 @@ +@import 'tailwindcss'; + +@theme { + /* --color-primary: #ffc107; + --color-secondary: #ffa000; + --color-text-primary: #000000; + --color-text-secondary: #000000; + --color-success: #28a745; */ + + --color-scrollbar-thumb: #999999; + --color-scrollbar-track: rgba(0, 0, 0, 0.1); + --color-scrollbar-thumb-hover: #666666; + --scrollbar-color: #ffc107; +} + +html, +body { + width: 100%; + height: 100%; + font-size: 16px; + font-family: 'Montserrat', sans-serif; +} + +/* font-family */ +@utility font-family-mon { + font-family: 'Montserrat', sans-serif; +} + +@utility font-family-rob { + font-family: 'Roboto', sans-serif; +} + +@utility font-family-int { + font-family: 'Inter', sans-serif; +} + +@utility font-family-orb { + font-family: 'Orbitron', sans-serif; +} + +@utility font-family-din { + font-family: 'DIN', sans-serif; +} + +@utility flex-row-center { + @apply flex flex-row items-center justify-center; +} + +@utility flex-col-center { + @apply flex flex-col items-center justify-center; +} + +@utility scrollbar { + overflow: auto; + + /* 整个滚动条 */ + &::-webkit-scrollbar { + width: 3px; + height: 3px; + } + + &::-webkit-scrollbar-track { + background-color: var(--color-scrollbar-track); + } + + /* 滚动条有滑块的轨道部分 */ + &::-webkit-scrollbar-track-piece { + background-color: transparent; + border-radius: 1px; + } + + /* 滚动条滑块(竖向:vertical 横向:horizontal) */ + &::-webkit-scrollbar-thumb { + cursor: pointer; + background-color: var(--color-scrollbar-thumb); + border-radius: 5px; + } + + /* 滚动条滑块hover */ + &::-webkit-scrollbar-thumb:hover { + background-color: var(--color-scrollbar-thumb-hover); + } + + /* 同时有垂直和水平滚动条时交汇的部分 */ + &::-webkit-scrollbar-corner { + display: block; + /* 修复交汇时出现的白块 */ + } +} + +ul, +menu { + list-style: disc; +} + +ol { + list-style: decimal; +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..bd01390 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "@kevisual/types/json/frontend.json", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@/*": [ + "./src/*" + ], + "@/agent": [ + "./src/agent" + ] + }, + }, + "include": [ + "src/**/*", + "agent/**/*", + ".astro/types.d.ts", + "**/*" + ], + "exclude": [ + "dist" + ] +} \ No newline at end of file