@jet-w/astro-blog 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-ATRISB7B.js +206 -0
- package/dist/chunk-HVQKQN6B.js +145 -0
- package/dist/config/index.d.ts +3 -47
- package/dist/config/index.js +18 -2
- package/dist/i18n-5H4W145i.d.ts +202 -0
- package/dist/index.d.ts +186 -7
- package/dist/index.js +238 -3
- package/dist/integration.d.ts +9 -1
- package/dist/integration.js +2 -1
- package/dist/{sidebar-DNdiCKBw.d.ts → sidebar-Da-W_4Lr.d.ts} +1 -1
- package/dist/utils/sidebar.d.ts +1 -1
- package/package.json +4 -3
- package/src/components/layout/Footer.astro +36 -20
- package/src/components/layout/Header.astro +69 -15
- package/src/components/layout/Sidebar.astro +27 -15
- package/src/components/ui/LanguageSwitcher.vue +183 -0
- package/src/layouts/BaseLayout.astro +77 -52
- package/src/layouts/PageLayout.astro +22 -27
- package/src/layouts/SlidesLayout.astro +14 -2
- package/src/pages/rss.xml.ts +18 -6
- package/templates/default/astro.config.mjs +22 -2
- package/templates/default/content/posts/blog_docs/12-i18n.md +355 -0
- package/templates/default/content/posts/blog_docs/README.md +1 -0
- package/templates/default/content/posts/blog_docs_en/README.md +78 -0
- package/templates/default/content/posts/blog_docs_en/config/01-site.md +208 -0
- package/templates/default/content/posts/blog_docs_en/config/02-sidebar.md +240 -0
- package/templates/default/content/posts/blog_docs_en/config/03-i18n.md +285 -0
- package/templates/default/content/posts/blog_docs_en/config/README.md +85 -0
- package/templates/default/content/posts/blog_docs_en/get-started/01-intro.md +81 -0
- package/templates/default/content/posts/blog_docs_en/get-started/02-install.md +137 -0
- package/templates/default/content/posts/blog_docs_en/get-started/03-create-post.md +176 -0
- package/templates/default/content/posts/blog_docs_en/get-started/04-structure.md +173 -0
- package/templates/default/content/posts/blog_docs_en/get-started/05-deploy.md +197 -0
- package/templates/default/content/posts/blog_docs_en/get-started/README.md +52 -0
- package/templates/default/content/posts/blog_docs_en/guide/README.md +59 -0
- package/templates/default/content/posts/blog_docs_en/guide/features/01-mermaid.md +194 -0
- package/templates/default/content/posts/blog_docs_en/guide/features/02-latex.md +233 -0
- package/templates/default/content/posts/blog_docs_en/guide/features/03-video.md +184 -0
- package/templates/default/content/posts/blog_docs_en/guide/features/04-icons.md +227 -0
- package/templates/default/content/posts/blog_docs_en/guide/features/README.md +51 -0
- package/templates/default/content/posts/blog_docs_en/guide/markdown/02-containers.md +226 -0
- package/templates/default/content/posts/blog_docs_en/guide/markdown/03-code-blocks.md +206 -0
- package/templates/default/content/posts/blog_docs_en/guide/markdown/README.md +194 -0
- package/templates/default/package-lock.json +9667 -0
- package/templates/default/package.json +1 -1
- package/templates/default/src/config/footer.ts +14 -11
- package/templates/default/src/config/locales/en/footer.ts +17 -0
- package/templates/default/src/config/locales/en/index.ts +16 -0
- package/templates/default/src/config/locales/en/menu.ts +12 -0
- package/templates/default/src/config/locales/en/sidebar.ts +18 -0
- package/templates/default/src/config/locales/en/site.ts +7 -0
- package/templates/default/src/config/locales/index.ts +7 -0
- package/templates/default/src/config/locales/zh-CN/footer.ts +17 -0
- package/templates/default/src/config/locales/zh-CN/index.ts +16 -0
- package/templates/default/src/config/locales/zh-CN/menu.ts +12 -0
- package/templates/default/src/config/locales/zh-CN/sidebar.ts +18 -0
- package/templates/default/src/config/locales/zh-CN/site.ts +7 -0
- package/templates/default/src/config/sidebar.ts +10 -12
- package/templates/default/src/env.d.ts +7 -0
- package/dist/chunk-MQXPSOYB.js +0 -124
- /package/dist/{chunk-GYLSY3OJ.js → chunk-AZHCNNAC.js} +0 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
// src/config/i18n.ts
|
|
2
|
+
var zhCNTranslations = {
|
|
3
|
+
// Navigation
|
|
4
|
+
home: "\u9996\u9875",
|
|
5
|
+
blog: "\u535A\u5BA2",
|
|
6
|
+
about: "\u5173\u4E8E",
|
|
7
|
+
search: "\u641C\u7D22",
|
|
8
|
+
// Posts
|
|
9
|
+
posts: "\u6587\u7AE0",
|
|
10
|
+
postList: "\u6587\u7AE0\u5217\u8868",
|
|
11
|
+
noPostsFound: "\u6682\u65E0\u6587\u7AE0",
|
|
12
|
+
readMore: "\u9605\u8BFB\u66F4\u591A",
|
|
13
|
+
readingTime: "\u9605\u8BFB\u65F6\u95F4",
|
|
14
|
+
minuteRead: "\u5206\u949F",
|
|
15
|
+
// Tags & Categories
|
|
16
|
+
tags: "\u6807\u7B7E",
|
|
17
|
+
categories: "\u5206\u7C7B",
|
|
18
|
+
allTags: "\u5168\u90E8\u6807\u7B7E",
|
|
19
|
+
allCategories: "\u5168\u90E8\u5206\u7C7B",
|
|
20
|
+
taggedWith: "\u6807\u7B7E",
|
|
21
|
+
inCategory: "\u5206\u7C7B",
|
|
22
|
+
// Archives
|
|
23
|
+
archives: "\u5F52\u6863",
|
|
24
|
+
postsInArchive: "\u7BC7\u6587\u7AE0",
|
|
25
|
+
// Sidebar
|
|
26
|
+
recentPosts: "\u6700\u65B0\u6587\u7AE0",
|
|
27
|
+
popularTags: "\u70ED\u95E8\u6807\u7B7E",
|
|
28
|
+
friendLinks: "\u53CB\u60C5\u94FE\u63A5",
|
|
29
|
+
documentTree: "\u6587\u6863\u76EE\u5F55",
|
|
30
|
+
// Footer
|
|
31
|
+
quickLinks: "\u5FEB\u901F\u94FE\u63A5",
|
|
32
|
+
contact: "\u8054\u7CFB\u65B9\u5F0F",
|
|
33
|
+
// Search
|
|
34
|
+
searchPlaceholder: "\u641C\u7D22\u6587\u7AE0\u6807\u9898\u3001\u5185\u5BB9\u3001\u6807\u7B7E...",
|
|
35
|
+
searchResults: "\u641C\u7D22\u7ED3\u679C",
|
|
36
|
+
noResults: "\u6CA1\u6709\u627E\u5230\u76F8\u5173\u7ED3\u679C",
|
|
37
|
+
searching: "\u641C\u7D22\u4E2D...",
|
|
38
|
+
// Pagination
|
|
39
|
+
previousPage: "\u4E0A\u4E00\u9875",
|
|
40
|
+
nextPage: "\u4E0B\u4E00\u9875",
|
|
41
|
+
page: "\u7B2C",
|
|
42
|
+
of: "\u9875\uFF0C\u5171",
|
|
43
|
+
// Article details
|
|
44
|
+
publishedOn: "\u53D1\u5E03\u4E8E",
|
|
45
|
+
updatedOn: "\u66F4\u65B0\u4E8E",
|
|
46
|
+
author: "\u4F5C\u8005",
|
|
47
|
+
tableOfContents: "\u76EE\u5F55",
|
|
48
|
+
relatedPosts: "\u76F8\u5173\u6587\u7AE0",
|
|
49
|
+
sharePost: "\u5206\u4EAB\u6587\u7AE0",
|
|
50
|
+
previousPost: "\u4E0A\u4E00\u7BC7",
|
|
51
|
+
nextPost: "\u4E0B\u4E00\u7BC7",
|
|
52
|
+
// Misc
|
|
53
|
+
backToTop: "\u56DE\u5230\u9876\u90E8",
|
|
54
|
+
copyCode: "\u590D\u5236",
|
|
55
|
+
copied: "\u5DF2\u590D\u5236",
|
|
56
|
+
expand: "\u5C55\u5F00",
|
|
57
|
+
collapse: "\u6536\u8D77",
|
|
58
|
+
expandCode: "\u5C55\u5F00\u4EE3\u7801",
|
|
59
|
+
collapseCode: "\u6536\u8D77\u4EE3\u7801",
|
|
60
|
+
lines: "\u884C",
|
|
61
|
+
viewMode: "\u89C6\u56FE\u6A21\u5F0F",
|
|
62
|
+
cardView: "\u5361\u7247\u89C6\u56FE",
|
|
63
|
+
listView: "\u5217\u8868\u89C6\u56FE",
|
|
64
|
+
sortBy: "\u6392\u5E8F",
|
|
65
|
+
sortByDate: "\u6309\u65E5\u671F",
|
|
66
|
+
sortByTitle: "\u6309\u6807\u9898",
|
|
67
|
+
filterByTag: "\u6309\u6807\u7B7E\u7B5B\u9009",
|
|
68
|
+
filterByCategory: "\u6309\u5206\u7C7B\u7B5B\u9009",
|
|
69
|
+
clearFilter: "\u6E05\u9664\u7B5B\u9009",
|
|
70
|
+
allPosts: "\u5168\u90E8\u6587\u7AE0",
|
|
71
|
+
draft: "\u8349\u7A3F",
|
|
72
|
+
// Slides
|
|
73
|
+
slides: "\u6F14\u793A",
|
|
74
|
+
slidesList: "\u6F14\u793A\u5217\u8868",
|
|
75
|
+
// RSS
|
|
76
|
+
rssFeed: "RSS \u8BA2\u9605"
|
|
77
|
+
};
|
|
78
|
+
var enTranslations = {
|
|
79
|
+
// Navigation
|
|
80
|
+
home: "Home",
|
|
81
|
+
blog: "Blog",
|
|
82
|
+
about: "About",
|
|
83
|
+
search: "Search",
|
|
84
|
+
// Posts
|
|
85
|
+
posts: "Posts",
|
|
86
|
+
postList: "All Posts",
|
|
87
|
+
noPostsFound: "No posts found",
|
|
88
|
+
readMore: "Read more",
|
|
89
|
+
readingTime: "Reading time",
|
|
90
|
+
minuteRead: "min",
|
|
91
|
+
// Tags & Categories
|
|
92
|
+
tags: "Tags",
|
|
93
|
+
categories: "Categories",
|
|
94
|
+
allTags: "All Tags",
|
|
95
|
+
allCategories: "All Categories",
|
|
96
|
+
taggedWith: "Tagged with",
|
|
97
|
+
inCategory: "In category",
|
|
98
|
+
// Archives
|
|
99
|
+
archives: "Archives",
|
|
100
|
+
postsInArchive: "posts",
|
|
101
|
+
// Sidebar
|
|
102
|
+
recentPosts: "Recent Posts",
|
|
103
|
+
popularTags: "Popular Tags",
|
|
104
|
+
friendLinks: "Friend Links",
|
|
105
|
+
documentTree: "Document Tree",
|
|
106
|
+
// Footer
|
|
107
|
+
quickLinks: "Quick Links",
|
|
108
|
+
contact: "Contact",
|
|
109
|
+
// Search
|
|
110
|
+
searchPlaceholder: "Search posts, tags, content...",
|
|
111
|
+
searchResults: "Search Results",
|
|
112
|
+
noResults: "No results found",
|
|
113
|
+
searching: "Searching...",
|
|
114
|
+
// Pagination
|
|
115
|
+
previousPage: "Previous",
|
|
116
|
+
nextPage: "Next",
|
|
117
|
+
page: "Page",
|
|
118
|
+
of: "of",
|
|
119
|
+
// Article details
|
|
120
|
+
publishedOn: "Published on",
|
|
121
|
+
updatedOn: "Updated on",
|
|
122
|
+
author: "Author",
|
|
123
|
+
tableOfContents: "Table of Contents",
|
|
124
|
+
relatedPosts: "Related Posts",
|
|
125
|
+
sharePost: "Share",
|
|
126
|
+
previousPost: "Previous",
|
|
127
|
+
nextPost: "Next",
|
|
128
|
+
// Misc
|
|
129
|
+
backToTop: "Back to Top",
|
|
130
|
+
copyCode: "Copy",
|
|
131
|
+
copied: "Copied",
|
|
132
|
+
expand: "Expand",
|
|
133
|
+
collapse: "Collapse",
|
|
134
|
+
expandCode: "Expand code",
|
|
135
|
+
collapseCode: "Collapse code",
|
|
136
|
+
lines: "lines",
|
|
137
|
+
viewMode: "View Mode",
|
|
138
|
+
cardView: "Card View",
|
|
139
|
+
listView: "List View",
|
|
140
|
+
sortBy: "Sort by",
|
|
141
|
+
sortByDate: "Date",
|
|
142
|
+
sortByTitle: "Title",
|
|
143
|
+
filterByTag: "Filter by tag",
|
|
144
|
+
filterByCategory: "Filter by category",
|
|
145
|
+
clearFilter: "Clear filter",
|
|
146
|
+
allPosts: "All Posts",
|
|
147
|
+
draft: "Draft",
|
|
148
|
+
// Slides
|
|
149
|
+
slides: "Slides",
|
|
150
|
+
slidesList: "All Slides",
|
|
151
|
+
// RSS
|
|
152
|
+
rssFeed: "RSS Feed"
|
|
153
|
+
};
|
|
154
|
+
var builtInTranslations = {
|
|
155
|
+
"zh-CN": zhCNTranslations,
|
|
156
|
+
"zh": zhCNTranslations,
|
|
157
|
+
"en": enTranslations,
|
|
158
|
+
"en-US": enTranslations,
|
|
159
|
+
"en-GB": enTranslations
|
|
160
|
+
};
|
|
161
|
+
var defaultLocales = [
|
|
162
|
+
{
|
|
163
|
+
code: "zh-CN",
|
|
164
|
+
name: "\u4E2D\u6587",
|
|
165
|
+
htmlLang: "zh-CN",
|
|
166
|
+
dateLocale: "zh-CN",
|
|
167
|
+
direction: "ltr"
|
|
168
|
+
}
|
|
169
|
+
];
|
|
170
|
+
var defaultI18nConfig = {
|
|
171
|
+
defaultLocale: "zh-CN",
|
|
172
|
+
locales: defaultLocales,
|
|
173
|
+
localeConfigs: {},
|
|
174
|
+
routing: {
|
|
175
|
+
prefixDefaultLocale: false
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
function defineI18nConfig(config) {
|
|
179
|
+
return {
|
|
180
|
+
defaultLocale: config.defaultLocale || "zh-CN",
|
|
181
|
+
locales: config.locales || defaultLocales,
|
|
182
|
+
localeConfigs: config.localeConfigs || {},
|
|
183
|
+
routing: {
|
|
184
|
+
prefixDefaultLocale: config.routing?.prefixDefaultLocale ?? false
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function getUITranslations(locale, config) {
|
|
189
|
+
const localeConfig = config?.localeConfigs?.[locale];
|
|
190
|
+
const customTranslations = localeConfig?.ui;
|
|
191
|
+
const baseTranslations = builtInTranslations[locale] || builtInTranslations[locale.split("-")[0]] || builtInTranslations["en"];
|
|
192
|
+
if (customTranslations) {
|
|
193
|
+
return { ...baseTranslations, ...customTranslations };
|
|
194
|
+
}
|
|
195
|
+
return baseTranslations;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export {
|
|
199
|
+
zhCNTranslations,
|
|
200
|
+
enTranslations,
|
|
201
|
+
builtInTranslations,
|
|
202
|
+
defaultLocales,
|
|
203
|
+
defaultI18nConfig,
|
|
204
|
+
defineI18nConfig,
|
|
205
|
+
getUITranslations
|
|
206
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultI18nConfig
|
|
3
|
+
} from "./chunk-ATRISB7B.js";
|
|
4
|
+
|
|
5
|
+
// src/integration.ts
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
import path from "path";
|
|
8
|
+
var VIRTUAL_I18N_MODULE_ID = "virtual:astro-blog-i18n";
|
|
9
|
+
var RESOLVED_VIRTUAL_I18N_MODULE_ID = "\0" + VIRTUAL_I18N_MODULE_ID;
|
|
10
|
+
var defaultOptions = {
|
|
11
|
+
routes: {
|
|
12
|
+
posts: true,
|
|
13
|
+
tags: true,
|
|
14
|
+
categories: true,
|
|
15
|
+
archives: true,
|
|
16
|
+
slides: true,
|
|
17
|
+
search: true,
|
|
18
|
+
rss: true
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function getLocalePrefix(locale, i18nConfig) {
|
|
22
|
+
if (locale === i18nConfig.defaultLocale && !i18nConfig.routing.prefixDefaultLocale) {
|
|
23
|
+
return "";
|
|
24
|
+
}
|
|
25
|
+
return `/${locale}`;
|
|
26
|
+
}
|
|
27
|
+
function astroBlogIntegration(options = {}) {
|
|
28
|
+
const mergedOptions = {
|
|
29
|
+
...defaultOptions,
|
|
30
|
+
routes: { ...defaultOptions.routes, ...options.routes }
|
|
31
|
+
};
|
|
32
|
+
const i18nConfig = options.i18n || defaultI18nConfig;
|
|
33
|
+
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
34
|
+
const pagesDir = path.resolve(currentDir, "../src/pages");
|
|
35
|
+
const vitePluginI18nConfig = () => ({
|
|
36
|
+
name: "astro-blog-i18n-config",
|
|
37
|
+
resolveId(id) {
|
|
38
|
+
if (id === VIRTUAL_I18N_MODULE_ID) {
|
|
39
|
+
return RESOLVED_VIRTUAL_I18N_MODULE_ID;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
load(id) {
|
|
43
|
+
if (id === RESOLVED_VIRTUAL_I18N_MODULE_ID) {
|
|
44
|
+
return `export const i18nConfig = ${JSON.stringify(i18nConfig)};`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
name: "@jet-w/astro-blog",
|
|
50
|
+
hooks: {
|
|
51
|
+
"astro:config:setup": ({ injectRoute, logger, updateConfig }) => {
|
|
52
|
+
logger.info("Injecting @jet-w/astro-blog routes...");
|
|
53
|
+
updateConfig({
|
|
54
|
+
vite: {
|
|
55
|
+
plugins: [vitePluginI18nConfig()]
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const routes = mergedOptions.routes;
|
|
59
|
+
const locales = i18nConfig.locales;
|
|
60
|
+
const injectLocalizedRoute = (pattern, entrypoint) => {
|
|
61
|
+
for (const locale of locales) {
|
|
62
|
+
const prefix = getLocalePrefix(locale.code, i18nConfig);
|
|
63
|
+
const localizedPattern = prefix ? `${prefix}${pattern}` : pattern;
|
|
64
|
+
injectRoute({
|
|
65
|
+
pattern: localizedPattern,
|
|
66
|
+
entrypoint
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
if (routes.posts) {
|
|
71
|
+
injectLocalizedRoute("/posts", `${pagesDir}/posts/index.astro`);
|
|
72
|
+
injectLocalizedRoute(
|
|
73
|
+
"/posts/page/[page]",
|
|
74
|
+
`${pagesDir}/posts/page/[page].astro`
|
|
75
|
+
);
|
|
76
|
+
injectLocalizedRoute(
|
|
77
|
+
"/posts/[...slug]",
|
|
78
|
+
`${pagesDir}/posts/[...slug].astro`
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
if (routes.tags) {
|
|
82
|
+
injectLocalizedRoute("/tags", `${pagesDir}/tags/index.astro`);
|
|
83
|
+
injectLocalizedRoute("/tags/[tag]", `${pagesDir}/tags/[tag].astro`);
|
|
84
|
+
injectLocalizedRoute(
|
|
85
|
+
"/tags/[tag]/page/[page]",
|
|
86
|
+
`${pagesDir}/tags/[tag]/page/[page].astro`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
if (routes.categories) {
|
|
90
|
+
injectLocalizedRoute(
|
|
91
|
+
"/categories",
|
|
92
|
+
`${pagesDir}/categories/index.astro`
|
|
93
|
+
);
|
|
94
|
+
injectLocalizedRoute(
|
|
95
|
+
"/categories/[category]",
|
|
96
|
+
`${pagesDir}/categories/[category].astro`
|
|
97
|
+
);
|
|
98
|
+
injectLocalizedRoute(
|
|
99
|
+
"/categories/[category]/page/[page]",
|
|
100
|
+
`${pagesDir}/categories/[category]/page/[page].astro`
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
if (routes.archives) {
|
|
104
|
+
injectLocalizedRoute("/archives", `${pagesDir}/archives/index.astro`);
|
|
105
|
+
injectLocalizedRoute(
|
|
106
|
+
"/archives/[year]/[month]",
|
|
107
|
+
`${pagesDir}/archives/[year]/[month].astro`
|
|
108
|
+
);
|
|
109
|
+
injectLocalizedRoute(
|
|
110
|
+
"/archives/[year]/[month]/page/[page]",
|
|
111
|
+
`${pagesDir}/archives/[year]/[month]/page/[page].astro`
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
if (routes.slides) {
|
|
115
|
+
injectLocalizedRoute("/slides", `${pagesDir}/slides/index.astro`);
|
|
116
|
+
injectLocalizedRoute(
|
|
117
|
+
"/slides/[...slug]",
|
|
118
|
+
`${pagesDir}/slides/[...slug].astro`
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
if (routes.search) {
|
|
122
|
+
injectLocalizedRoute("/search", `${pagesDir}/search.astro`);
|
|
123
|
+
injectLocalizedRoute(
|
|
124
|
+
"/search-index.json",
|
|
125
|
+
`${pagesDir}/search-index.json.ts`
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
if (routes.rss) {
|
|
129
|
+
injectLocalizedRoute("/rss.xml", `${pagesDir}/rss.xml.ts`);
|
|
130
|
+
}
|
|
131
|
+
injectLocalizedRoute("/[...slug]", `${pagesDir}/[...slug].astro`);
|
|
132
|
+
const localeCount = locales.length;
|
|
133
|
+
logger.info(
|
|
134
|
+
`Routes injected successfully for ${localeCount} locale(s): ${locales.map((l) => l.code).join(", ")}`
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
var integration_default = astroBlogIntegration;
|
|
141
|
+
|
|
142
|
+
export {
|
|
143
|
+
astroBlogIntegration,
|
|
144
|
+
integration_default
|
|
145
|
+
};
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SiteConfig, NavigationItem } from '../types/index.js';
|
|
2
|
-
export { D as DividerConfig, M as ManualConfig, f as MixedConfig, P as PathMatchConfig, e as ScanConfig,
|
|
2
|
+
export { D as DividerConfig, M as ManualConfig, f as MixedConfig, P as PathMatchConfig, e as ScanConfig, b as SidebarConfig, a as SidebarGroup, S as SidebarItem, d as defaultSidebarConfig, c as defineSidebarConfig, s as sidebarConfig } from '../sidebar-Da-W_4Lr.js';
|
|
3
|
+
export { F as FooterConfig, m as FooterLink, I as I18nConfig, o as I18nRoutingConfig, L as Locale, n as LocaleConfig, S as SocialLink, U as UITranslations, j as builtInTranslations, c as defaultFooterConfig, g as defaultI18nConfig, d as defaultIcons, l as defaultLocales, a as defaultSocialLinks, e as defineFooterConfig, h as defineI18nConfig, b as defineSocialLinks, k as enTranslations, f as footerConfig, i as getUITranslations, s as socialLinks, z as zhCNTranslations } from '../i18n-5H4W145i.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Default site configuration
|
|
@@ -28,49 +29,4 @@ declare const menu: NavigationItem[];
|
|
|
28
29
|
declare function defineMenu(items: NavigationItem[]): NavigationItem[];
|
|
29
30
|
declare const defaultMenu: NavigationItem[];
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
* 社交链接配置
|
|
33
|
-
*/
|
|
34
|
-
interface SocialLink {
|
|
35
|
-
type: string;
|
|
36
|
-
url: string;
|
|
37
|
-
label?: string;
|
|
38
|
-
icon?: string;
|
|
39
|
-
}
|
|
40
|
-
declare const defaultIcons: Record<string, string>;
|
|
41
|
-
declare const socialLinks: SocialLink[];
|
|
42
|
-
declare const defaultSocialLinks: SocialLink[];
|
|
43
|
-
/**
|
|
44
|
-
* Define social links
|
|
45
|
-
*/
|
|
46
|
-
declare function defineSocialLinks(links: SocialLink[]): SocialLink[];
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Footer 配置
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
interface FooterLink {
|
|
53
|
-
name: string;
|
|
54
|
-
href: string;
|
|
55
|
-
}
|
|
56
|
-
interface FooterConfig {
|
|
57
|
-
quickLinksTitle: string;
|
|
58
|
-
quickLinks: FooterLink[];
|
|
59
|
-
contactTitle: string;
|
|
60
|
-
socialLinks: SocialLink[];
|
|
61
|
-
showRss: boolean;
|
|
62
|
-
rssUrl: string;
|
|
63
|
-
copyright: string;
|
|
64
|
-
poweredBy: {
|
|
65
|
-
text: string;
|
|
66
|
-
url: string;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
declare const footerConfig: FooterConfig;
|
|
70
|
-
/**
|
|
71
|
-
* Define footer configuration
|
|
72
|
-
*/
|
|
73
|
-
declare function defineFooterConfig(config: Partial<FooterConfig>): FooterConfig;
|
|
74
|
-
declare const defaultFooterConfig: FooterConfig;
|
|
75
|
-
|
|
76
|
-
export { type FooterConfig, type FooterLink, type SocialLink, defaultFooterConfig, defaultIcons, defaultMenu, defaultSEO, defaultSiteConfig, defaultSocialLinks, defineFooterConfig, defineMenu, defineSiteConfig, defineSocialLinks, footerConfig, menu, siteConfig, socialLinks };
|
|
32
|
+
export { defaultMenu, defaultSEO, defaultSiteConfig, defineMenu, defineSiteConfig, menu, siteConfig };
|
package/dist/config/index.js
CHANGED
|
@@ -16,23 +16,39 @@ import {
|
|
|
16
16
|
sidebarConfig,
|
|
17
17
|
siteConfig,
|
|
18
18
|
socialLinks
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-AZHCNNAC.js";
|
|
20
|
+
import {
|
|
21
|
+
builtInTranslations,
|
|
22
|
+
defaultI18nConfig,
|
|
23
|
+
defaultLocales,
|
|
24
|
+
defineI18nConfig,
|
|
25
|
+
enTranslations,
|
|
26
|
+
getUITranslations,
|
|
27
|
+
zhCNTranslations
|
|
28
|
+
} from "../chunk-ATRISB7B.js";
|
|
20
29
|
export {
|
|
30
|
+
builtInTranslations,
|
|
21
31
|
defaultFooterConfig,
|
|
32
|
+
defaultI18nConfig,
|
|
22
33
|
defaultIcons,
|
|
34
|
+
defaultLocales,
|
|
23
35
|
defaultMenu,
|
|
24
36
|
defaultSEO,
|
|
25
37
|
defaultSidebarConfig,
|
|
26
38
|
defaultSiteConfig,
|
|
27
39
|
defaultSocialLinks,
|
|
28
40
|
defineFooterConfig,
|
|
41
|
+
defineI18nConfig,
|
|
29
42
|
defineMenu,
|
|
30
43
|
defineSidebarConfig,
|
|
31
44
|
defineSiteConfig,
|
|
32
45
|
defineSocialLinks,
|
|
46
|
+
enTranslations,
|
|
33
47
|
footerConfig,
|
|
48
|
+
getUITranslations,
|
|
34
49
|
menu,
|
|
35
50
|
sidebarConfig,
|
|
36
51
|
siteConfig,
|
|
37
|
-
socialLinks
|
|
52
|
+
socialLinks,
|
|
53
|
+
zhCNTranslations
|
|
38
54
|
};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { SiteConfig, NavigationItem } from './types/index.js';
|
|
2
|
+
import { b as SidebarConfig } from './sidebar-Da-W_4Lr.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 社交链接配置
|
|
6
|
+
*/
|
|
7
|
+
interface SocialLink {
|
|
8
|
+
type: string;
|
|
9
|
+
url: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const defaultIcons: Record<string, string>;
|
|
14
|
+
declare const socialLinks: SocialLink[];
|
|
15
|
+
declare const defaultSocialLinks: SocialLink[];
|
|
16
|
+
/**
|
|
17
|
+
* Define social links
|
|
18
|
+
*/
|
|
19
|
+
declare function defineSocialLinks(links: SocialLink[]): SocialLink[];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Footer 配置
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
interface FooterLink {
|
|
26
|
+
name: string;
|
|
27
|
+
href: string;
|
|
28
|
+
}
|
|
29
|
+
interface FooterConfig {
|
|
30
|
+
quickLinksTitle: string;
|
|
31
|
+
quickLinks: FooterLink[];
|
|
32
|
+
contactTitle: string;
|
|
33
|
+
socialLinks: SocialLink[];
|
|
34
|
+
showRss: boolean;
|
|
35
|
+
rssUrl: string;
|
|
36
|
+
copyright: string;
|
|
37
|
+
poweredBy: {
|
|
38
|
+
text: string;
|
|
39
|
+
url: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
declare const footerConfig: FooterConfig;
|
|
43
|
+
/**
|
|
44
|
+
* Define footer configuration
|
|
45
|
+
*/
|
|
46
|
+
declare function defineFooterConfig(config: Partial<FooterConfig>): FooterConfig;
|
|
47
|
+
declare const defaultFooterConfig: FooterConfig;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* i18n Configuration Module
|
|
51
|
+
*
|
|
52
|
+
* Provides multi-language support configuration for the blog.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Locale definition
|
|
57
|
+
*/
|
|
58
|
+
interface Locale {
|
|
59
|
+
/** Language code (e.g., 'en', 'zh-CN', 'ja') */
|
|
60
|
+
code: string;
|
|
61
|
+
/** Display name (e.g., 'English', '中文') */
|
|
62
|
+
name: string;
|
|
63
|
+
/** HTML lang attribute value */
|
|
64
|
+
htmlLang: string;
|
|
65
|
+
/** Locale for Intl.DateTimeFormat */
|
|
66
|
+
dateLocale: string;
|
|
67
|
+
/** Text direction */
|
|
68
|
+
direction?: 'ltr' | 'rtl';
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* UI translation strings
|
|
72
|
+
*/
|
|
73
|
+
interface UITranslations {
|
|
74
|
+
home: string;
|
|
75
|
+
blog: string;
|
|
76
|
+
about: string;
|
|
77
|
+
search: string;
|
|
78
|
+
posts: string;
|
|
79
|
+
postList: string;
|
|
80
|
+
noPostsFound: string;
|
|
81
|
+
readMore: string;
|
|
82
|
+
readingTime: string;
|
|
83
|
+
minuteRead: string;
|
|
84
|
+
tags: string;
|
|
85
|
+
categories: string;
|
|
86
|
+
allTags: string;
|
|
87
|
+
allCategories: string;
|
|
88
|
+
taggedWith: string;
|
|
89
|
+
inCategory: string;
|
|
90
|
+
archives: string;
|
|
91
|
+
postsInArchive: string;
|
|
92
|
+
recentPosts: string;
|
|
93
|
+
popularTags: string;
|
|
94
|
+
friendLinks: string;
|
|
95
|
+
documentTree: string;
|
|
96
|
+
quickLinks: string;
|
|
97
|
+
contact: string;
|
|
98
|
+
searchPlaceholder: string;
|
|
99
|
+
searchResults: string;
|
|
100
|
+
noResults: string;
|
|
101
|
+
searching: string;
|
|
102
|
+
previousPage: string;
|
|
103
|
+
nextPage: string;
|
|
104
|
+
page: string;
|
|
105
|
+
of: string;
|
|
106
|
+
publishedOn: string;
|
|
107
|
+
updatedOn: string;
|
|
108
|
+
author: string;
|
|
109
|
+
tableOfContents: string;
|
|
110
|
+
relatedPosts: string;
|
|
111
|
+
sharePost: string;
|
|
112
|
+
previousPost: string;
|
|
113
|
+
nextPost: string;
|
|
114
|
+
backToTop: string;
|
|
115
|
+
copyCode: string;
|
|
116
|
+
copied: string;
|
|
117
|
+
expand: string;
|
|
118
|
+
collapse: string;
|
|
119
|
+
expandCode: string;
|
|
120
|
+
collapseCode: string;
|
|
121
|
+
lines: string;
|
|
122
|
+
viewMode: string;
|
|
123
|
+
cardView: string;
|
|
124
|
+
listView: string;
|
|
125
|
+
sortBy: string;
|
|
126
|
+
sortByDate: string;
|
|
127
|
+
sortByTitle: string;
|
|
128
|
+
filterByTag: string;
|
|
129
|
+
filterByCategory: string;
|
|
130
|
+
clearFilter: string;
|
|
131
|
+
allPosts: string;
|
|
132
|
+
draft: string;
|
|
133
|
+
slides: string;
|
|
134
|
+
slidesList: string;
|
|
135
|
+
rssFeed: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Locale-specific configuration
|
|
139
|
+
*/
|
|
140
|
+
interface LocaleConfig {
|
|
141
|
+
/** Site configuration overrides */
|
|
142
|
+
site?: Partial<SiteConfig>;
|
|
143
|
+
/** Navigation menu items */
|
|
144
|
+
menu?: NavigationItem[];
|
|
145
|
+
/** Footer configuration overrides */
|
|
146
|
+
footer?: Partial<FooterConfig>;
|
|
147
|
+
/** Sidebar configuration overrides */
|
|
148
|
+
sidebar?: Partial<SidebarConfig>;
|
|
149
|
+
/** UI translation overrides */
|
|
150
|
+
ui?: Partial<UITranslations>;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* i18n routing configuration
|
|
154
|
+
*/
|
|
155
|
+
interface I18nRoutingConfig {
|
|
156
|
+
/** Whether to add prefix for default locale (e.g., /zh-CN/posts vs /posts) */
|
|
157
|
+
prefixDefaultLocale: boolean;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Complete i18n configuration
|
|
161
|
+
*/
|
|
162
|
+
interface I18nConfig {
|
|
163
|
+
/** Default locale code */
|
|
164
|
+
defaultLocale: string;
|
|
165
|
+
/** Available locales */
|
|
166
|
+
locales: Locale[];
|
|
167
|
+
/** Locale-specific configurations */
|
|
168
|
+
localeConfigs: Record<string, LocaleConfig>;
|
|
169
|
+
/** Routing configuration */
|
|
170
|
+
routing: I18nRoutingConfig;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Default Chinese (Simplified) UI translations
|
|
174
|
+
*/
|
|
175
|
+
declare const zhCNTranslations: UITranslations;
|
|
176
|
+
/**
|
|
177
|
+
* Default English UI translations
|
|
178
|
+
*/
|
|
179
|
+
declare const enTranslations: UITranslations;
|
|
180
|
+
/**
|
|
181
|
+
* Built-in translations for common languages
|
|
182
|
+
*/
|
|
183
|
+
declare const builtInTranslations: Record<string, UITranslations>;
|
|
184
|
+
/**
|
|
185
|
+
* Default locales
|
|
186
|
+
*/
|
|
187
|
+
declare const defaultLocales: Locale[];
|
|
188
|
+
/**
|
|
189
|
+
* Default i18n configuration (Chinese only, backward compatible)
|
|
190
|
+
*/
|
|
191
|
+
declare const defaultI18nConfig: I18nConfig;
|
|
192
|
+
/**
|
|
193
|
+
* Helper function to define i18n configuration with type safety
|
|
194
|
+
*/
|
|
195
|
+
declare function defineI18nConfig(config: Partial<I18nConfig>): I18nConfig;
|
|
196
|
+
/**
|
|
197
|
+
* Get UI translations for a specific locale
|
|
198
|
+
* Falls back to built-in translations, then to English
|
|
199
|
+
*/
|
|
200
|
+
declare function getUITranslations(locale: string, config?: I18nConfig): UITranslations;
|
|
201
|
+
|
|
202
|
+
export { type FooterConfig as F, type I18nConfig as I, type Locale as L, type SocialLink as S, type UITranslations as U, defaultSocialLinks as a, defineSocialLinks as b, defaultFooterConfig as c, defaultIcons as d, defineFooterConfig as e, footerConfig as f, defaultI18nConfig as g, defineI18nConfig as h, getUITranslations as i, builtInTranslations as j, enTranslations as k, defaultLocales as l, type FooterLink as m, type LocaleConfig as n, type I18nRoutingConfig as o, socialLinks as s, zhCNTranslations as z };
|