chore: refine user configuration standards

This commit is contained in:
radishzzz 2025-01-13 08:32:09 +00:00
parent 57e69c6067
commit 5d327ff4f8
7 changed files with 13000 additions and 101 deletions

View file

@ -1,5 +1,5 @@
{ {
"editor.formatOnSave": true, "editor.formatOnSave": false,
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit" "source.fixAll.eslint": "explicit"
}, },
@ -8,12 +8,8 @@
"typescript", "typescript",
"astro" "astro"
], ],
"prettier.documentSelectors": ["**/*.astro"],
"typescript.tsdk": "node_modules/typescript/lib", "typescript.tsdk": "node_modules/typescript/lib",
"files.associations": { "files.associations": {
"*.mdx": "markdown" "*.mdx": "markdown"
},
"[astro]": {
"editor.defaultFormatter": "astro-build.astro-vscode"
} }
} }

12866
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,65 +1,90 @@
import type { ThemeConfig } from '@/types' import type { ThemeConfig } from '@/types'
export const themeConfig: ThemeConfig = { export const themeConfig: ThemeConfig = {
// SITE INFORMATION ---------------------------------------------------------------------------------------- // // SITE INFORMATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
site: { site: {
// Choose One to Fill In title: 'retypeset',
title_EN: 'Retypeset', // support English, Spanish, Russian subtitle: '再现版式之美',
title_CN: '重新编排', // supports simplified, traditional Chinese, and Japanese description: '一个优美的博客主题',
// Choose One to Fill In
subtitle_EN: '', // support English, Spanish, Russian
subtitle_CN: '再现版式之美', // supports simplified, traditional Chinese, and Japanese
// Site URL
url: 'http://localhost:4321/',
// Author name
author: 'radishzz', author: 'radishzz',
// Site Favicon url: 'http://localhost:4321/',
favicon: 'https://image.radishzz.cc/image/favicon-round-48px.webp', favicon: '#',
// Site Language
language: 'zh', // zh | tw | ja | en | es | ru
}, },
// THEME SETTING ------------------------------------------------------------------------------------------- // // SITE INFORMATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
theme: {
color: 'auto', // COLOR SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
// Light Mode color: {
mode: 'light',
light: { light: {
primary: '#333', // text color primary: '#000000',
background: '#FFF', // background color backgroundStart: '#ffffff',
grid: '#F3F3F3', // grid lines color backgroundEnd: '#f5f5f5',
}, },
// Dark Mode
dark: { dark: {
primary: '#DBDBDB', // text color primary: '#000000',
background: '#121212', // background color backgroundStart: '#ffffff',
grid: '#1B1B1B', // grid lines color backgroundEnd: '#000000',
}, },
}, },
toc: { // COLOR SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
enable: true,
depth: '2', // GLOBAL SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
}, global: {
rss: { language: 'zh',
enabled: true, font: 'sans',
follow: { rss: true,
feedId: '68090849347654656', toc: true,
userId: '68014765825824768',
},
},
analytics: {
// google:
umami: 'https://analytics.example.com/script.js',
}, },
// GLOBAL SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
// COMMENT SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
comment: { comment: {
waline: { waline: {
serverURL: 'https://comment.radishzz.cc', serverURL: '#',
emoji: [ emoji: [
'//unpkg.com/@waline/emojis@1.2.0/bmoji', '#',
'//unpkg.com/@waline/emojis@1.2.0/weibo', '#',
], ],
search: false, search: true,
imageUploader: false, imageUploader: true,
}, },
}, },
// COMMENT SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
// SEO SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
seo: {
twitter: 'https://twitter.com/radishzz',
meta: {
google: '#',
bing: '#',
baidu: '#',
},
link: '#',
googleAnalyticsID: '#',
umamiAnalyticsID: '#',
follow: {
feedID: '#',
userID: '#',
},
},
// SEO SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
// FOOTER SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
footer: {
linkA: {
name: 'RSS',
url: '#',
},
linkB: {
name: 'Contact',
url: '#',
},
linkC: {
name: 'GitHub',
url: '#',
},
},
// FOOTER SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
} }
export default themeConfig export default themeConfig

View file

@ -1,16 +0,0 @@
import { defineCollection, z } from 'astro:content'
const postsCollection = defineCollection({
type: 'content',
schema: z.object({
title: z.string(),
pubDate: z.date(),
updatedDate: z.date().optional(),
tags: z.array(z.string()).optional(),
draft: z.boolean().optional().default(false),
}),
})
export const collections = {
posts: postsCollection,
}

View file

@ -1,6 +1,6 @@
--- ---
import Welcome from '../components/Welcome.astro' import Welcome from '@/components/Welcome.astro'
import Layout from '../layouts/Layout.astro' import Layout from '@/layouts/Layout.astro'
--- ---
<Layout> <Layout>

80
src/types/index.d.ts vendored
View file

@ -1,48 +1,74 @@
export interface ThemeConfig { export interface ThemeConfig {
site: { site: {
title_EN: string title: string
title_CN: string subtitle: string
subtitle_EN: string description: string
subtitle_CN: string
url: string
author: string author: string
url: string
favicon: string favicon: string
language: string
} }
theme: {
color: 'light' | 'dark' | 'auto' color: {
mode: 'light' | 'dark'
light: { light: {
primary: string primary: string
background: string backgroundStart: string
grid: string backgroundEnd: string
} }
dark: { dark: {
primary: string primary: string
background: string backgroundStart: string
grid: string backgroundEnd: string
} }
} }
toc: {
enable: boolean global: {
depth: '1' | '2' | '3' language: string
} font: string
rss?: { rss: boolean
enabled: boolean toc: boolean
follow?: {
feedId: string
userId: string
}
}
analytics?: {
google?: string
umami?: string
} }
comment?: { comment?: {
waline?: { waline?: {
serverURL: string serverURL?: string
emoji?: string[] emoji?: string[]
search?: boolean search?: boolean
imageUploader?: boolean imageUploader?: boolean
} }
} }
seo?: {
twitter?: string
meta?: {
google?: string
bing?: string
baidu?: string
}
link?: string
googleAnalyticsID?: string
umamiAnalyticsID?: string
follow?: {
feedID?: string
userID?: string
}
}
footer: {
linkA: {
name: string
url: string
}
linkB: {
name: string
url: string
}
linkC: {
name: string
url: string
}
}
} }
export default ThemeConfig

View file

@ -1,3 +1,4 @@
import type { ThemeConfig } from './src/types'
import { import {
defineConfig, defineConfig,
presetAttributify, presetAttributify,
@ -9,6 +10,11 @@ import {
import presetTheme from 'unocss-preset-theme' import presetTheme from 'unocss-preset-theme'
import { themeConfig } from './src/config' import { themeConfig } from './src/config'
const { light, dark }: {
light: ThemeConfig['color']['light']
dark: ThemeConfig['color']['dark']
} = themeConfig.color
const cssExtend = { const cssExtend = {
h1: { h1: {
'font-size': '3.6rem', 'font-size': '3.6rem',
@ -35,12 +41,8 @@ export default defineConfig({
presetUno(), presetUno(),
presetAttributify(), presetAttributify(),
presetTypography({ cssExtend }), presetTypography({ cssExtend }),
presetTheme({ presetTheme<object>({
theme: { theme: { dark },
dark: {
colors: { ...themeConfig.theme.dark },
},
},
}), }),
], ],
transformers: [ transformers: [
@ -48,7 +50,7 @@ export default defineConfig({
transformerVariantGroup(), transformerVariantGroup(),
], ],
theme: { theme: {
colors: { ...themeConfig.theme.light }, colors: light,
fontFamily: { fontFamily: {
title: ['Title-EN', 'Title-RU', 'CN', 'ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'], title: ['Title-EN', 'Title-RU', 'CN', 'ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'],
serif: ['EN', 'RU', 'CN', 'Georgia', 'ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'], serif: ['EN', 'RU', 'CN', 'Georgia', 'ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'],