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": {
"source.fixAll.eslint": "explicit"
},
@ -8,12 +8,8 @@
"typescript",
"astro"
],
"prettier.documentSelectors": ["**/*.astro"],
"typescript.tsdk": "node_modules/typescript/lib",
"files.associations": {
"*.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'
export const themeConfig: ThemeConfig = {
// SITE INFORMATION ---------------------------------------------------------------------------------------- //
// SITE INFORMATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
site: {
// Choose One to Fill In
title_EN: 'Retypeset', // support English, Spanish, Russian
title_CN: '重新编排', // supports simplified, traditional Chinese, and Japanese
// 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
title: 'retypeset',
subtitle: '再现版式之美',
description: '一个优美的博客主题',
author: 'radishzz',
// Site Favicon
favicon: 'https://image.radishzz.cc/image/favicon-round-48px.webp',
// Site Language
language: 'zh', // zh | tw | ja | en | es | ru
url: 'http://localhost:4321/',
favicon: '#',
},
// THEME SETTING ------------------------------------------------------------------------------------------- //
theme: {
color: 'auto',
// Light Mode
// SITE INFORMATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
// COLOR SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
color: {
mode: 'light',
light: {
primary: '#333', // text color
background: '#FFF', // background color
grid: '#F3F3F3', // grid lines color
primary: '#000000',
backgroundStart: '#ffffff',
backgroundEnd: '#f5f5f5',
},
// Dark Mode
dark: {
primary: '#DBDBDB', // text color
background: '#121212', // background color
grid: '#1B1B1B', // grid lines color
primary: '#000000',
backgroundStart: '#ffffff',
backgroundEnd: '#000000',
},
},
toc: {
enable: true,
depth: '2',
},
rss: {
enabled: true,
follow: {
feedId: '68090849347654656',
userId: '68014765825824768',
},
},
analytics: {
// google:
umami: 'https://analytics.example.com/script.js',
// COLOR SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
// GLOBAL SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
global: {
language: 'zh',
font: 'sans',
rss: true,
toc: true,
},
// GLOBAL SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
// COMMENT SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
comment: {
waline: {
serverURL: 'https://comment.radishzz.cc',
serverURL: '#',
emoji: [
'//unpkg.com/@waline/emojis@1.2.0/bmoji',
'//unpkg.com/@waline/emojis@1.2.0/weibo',
'#',
'#',
],
search: false,
imageUploader: false,
search: true,
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

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 Layout from '../layouts/Layout.astro'
import Welcome from '@/components/Welcome.astro'
import Layout from '@/layouts/Layout.astro'
---
<Layout>

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

@ -1,48 +1,74 @@
export interface ThemeConfig {
site: {
title_EN: string
title_CN: string
subtitle_EN: string
subtitle_CN: string
url: string
title: string
subtitle: string
description: string
author: string
url: string
favicon: string
language: string
}
theme: {
color: 'light' | 'dark' | 'auto'
color: {
mode: 'light' | 'dark'
light: {
primary: string
background: string
grid: string
backgroundStart: string
backgroundEnd: string
}
dark: {
primary: string
background: string
grid: string
backgroundStart: string
backgroundEnd: string
}
}
toc: {
enable: boolean
depth: '1' | '2' | '3'
}
rss?: {
enabled: boolean
follow?: {
feedId: string
userId: string
}
}
analytics?: {
google?: string
umami?: string
global: {
language: string
font: string
rss: boolean
toc: boolean
}
comment?: {
waline?: {
serverURL: string
serverURL?: string
emoji?: string[]
search?: 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 {
defineConfig,
presetAttributify,
@ -9,6 +10,11 @@ import {
import presetTheme from 'unocss-preset-theme'
import { themeConfig } from './src/config'
const { light, dark }: {
light: ThemeConfig['color']['light']
dark: ThemeConfig['color']['dark']
} = themeConfig.color
const cssExtend = {
h1: {
'font-size': '3.6rem',
@ -35,12 +41,8 @@ export default defineConfig({
presetUno(),
presetAttributify(),
presetTypography({ cssExtend }),
presetTheme({
theme: {
dark: {
colors: { ...themeConfig.theme.dark },
},
},
presetTheme<object>({
theme: { dark },
}),
],
transformers: [
@ -48,7 +50,7 @@ export default defineConfig({
transformerVariantGroup(),
],
theme: {
colors: { ...themeConfig.theme.light },
colors: light,
fontFamily: {
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'],