valaxy 1.3.4 → 1.4.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.
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import type { Post } from 'valaxy'
3
- import { onContentUpdated, runContentUpdated, sanitizeUrl, setIframeAspectRatios, useCodePen, useCollapseCode, useCopyCode, useMediumZoom, wrapTable } from 'valaxy'
3
+ import { onContentUpdated, runContentUpdated, sanitizeUrl, setIframeAspectRatios, useCollapseCode, useCopyCode, useMediumZoom, wrapTable } from 'valaxy'
4
4
  import { onMounted, onUpdated, ref } from 'vue'
5
5
  import { useI18n } from 'vue-i18n'
6
6
  import { useCodeGroups } from '../composables/codeGroups'
@@ -31,10 +31,6 @@ onUpdated(() => {
31
31
  runContentUpdated()
32
32
  })
33
33
 
34
- // widgets
35
- if (props.frontmatter.codepen)
36
- useCodePen()
37
-
38
34
  useCopyCode()
39
35
  useCodeGroups()
40
36
  useCollapseCode()
@@ -1,2 +1 @@
1
1
  export * from './backToTop'
2
- export * from './codepen'
@@ -2,7 +2,7 @@ import 'node:path';
2
2
  import 'node:process';
3
3
  import 'yargs';
4
4
  import 'yargs/helpers';
5
- export { a as createCli, t as desktopRuntimeVersion, v as execBuild, R as registerDevCommand, a3 as run, a5 as startValaxyDev } from '../../shared/valaxy.DQnMfBEN.mjs';
5
+ export { a as createCli, t as desktopRuntimeVersion, v as execBuild, R as registerDevCommand, a3 as run, a5 as startValaxyDev } from '../../shared/valaxy.i_3nqqSt.mjs';
6
6
  import 'node:os';
7
7
  import '@11ty/gray-matter';
8
8
  import 'consola';
@@ -20,12 +20,13 @@ import { Header } from '@valaxyjs/utils';
20
20
  export { CreateCliOptions, createCli, desktopRuntimeVersion, execBuild, registerDevCommand, run, startValaxyDev } from './cli/index.mjs';
21
21
  import { Awaitable } from '@antfu/utils';
22
22
  import * as defu from 'defu';
23
+ import 'valaxy/types/frontmatter';
24
+ import '../shared/valaxy.CaLqd5CH.mjs';
23
25
  import '@vueuse/integrations/useFuse';
24
26
  import 'medium-zoom';
25
27
  import 'vanilla-lazyload';
26
28
  import 'vue-router';
27
29
  import '@vueuse/core';
28
- import '@unhead/schema-org';
29
30
 
30
31
  //#region src/types.d.ts
31
32
  /**
@@ -1,4 +1,4 @@
1
- export { A as ALL_ROUTE, E as EXCERPT_SEPARATOR, G as GLOBAL_STATE, P as PATHNAME_PROTOCOL_RE, S as StateManager, V as ViteValaxyPlugins, b as build, c as clearGitTimestampCache, a as createCli, d as createContentService, e as createMemoryReleasePlugin, f as createServer, g as createValaxyNode, h as createValaxyPlugin, i as customElements, j as defaultSiteConfig, k as defaultValaxyConfig, l as defaultViteConfig, m as defineAddon, n as defineConfig, o as defineSiteConfig, p as defineTheme, q as defineValaxyAddon, r as defineValaxyConfig, s as defineValaxyTheme, t as desktopRuntimeVersion, u as encryptContent, v as execBuild, w as generateClientRedirects, x as getGitTimestamp, y as getGitTimestampCache, z as getIndexHtml, B as getServerInfoText, C as isExternal, D as isInstalledGlobally, F as isKatexEnabled, H as isKatexPluginNeeded, I as isMathJaxEnabled, J as isPath, K as loadAllContent, L as loadConfigFromFile, M as mergeValaxyConfig, N as mergeViteConfigs, O as postProcessForSSG, Q as processValaxyOptions, R as registerDevCommand, T as resolveAddonsConfig, U as resolveImportPath, W as resolveImportUrl, X as resolveOptions, Y as resolveSiteConfig, Z as resolveSiteConfigFromRoot, _ as resolveThemeConfigFromRoot, $ as resolveThemeValaxyConfig, a0 as resolveUserThemeConfig, a1 as resolveValaxyConfig, a2 as resolveValaxyConfigFromRoot, a3 as run, a4 as ssgBuild, a5 as startValaxyDev, a6 as toAtFS, a7 as transformObject, a8 as version } from '../shared/valaxy.DQnMfBEN.mjs';
1
+ export { A as ALL_ROUTE, E as EXCERPT_SEPARATOR, G as GLOBAL_STATE, P as PATHNAME_PROTOCOL_RE, S as StateManager, V as ViteValaxyPlugins, b as build, c as clearGitTimestampCache, a as createCli, d as createContentService, e as createMemoryReleasePlugin, f as createServer, g as createValaxyNode, h as createValaxyPlugin, i as customElements, j as defaultSiteConfig, k as defaultValaxyConfig, l as defaultViteConfig, m as defineAddon, n as defineConfig, o as defineSiteConfig, p as defineTheme, q as defineValaxyAddon, r as defineValaxyConfig, s as defineValaxyTheme, t as desktopRuntimeVersion, u as encryptContent, v as execBuild, w as generateClientRedirects, x as getGitTimestamp, y as getGitTimestampCache, z as getIndexHtml, B as getServerInfoText, C as isExternal, D as isInstalledGlobally, F as isKatexEnabled, H as isKatexPluginNeeded, I as isMathJaxEnabled, J as isPath, K as loadAllContent, L as loadConfigFromFile, M as mergeValaxyConfig, N as mergeViteConfigs, O as postProcessForSSG, Q as processValaxyOptions, R as registerDevCommand, T as resolveAddonsConfig, U as resolveImportPath, W as resolveImportUrl, X as resolveOptions, Y as resolveSiteConfig, Z as resolveSiteConfigFromRoot, _ as resolveThemeConfigFromRoot, $ as resolveThemeValaxyConfig, a0 as resolveUserThemeConfig, a1 as resolveValaxyConfig, a2 as resolveValaxyConfigFromRoot, a3 as run, a4 as ssgBuild, a5 as startValaxyDev, a6 as toAtFS, a7 as transformObject, a8 as version } from '../shared/valaxy.i_3nqqSt.mjs';
2
2
  import 'node:path';
3
3
  import 'consola';
4
4
  import 'fs-extra';
@@ -0,0 +1,62 @@
1
+ interface CollectionConfig {
2
+ title?: string;
3
+ key?: string;
4
+ /**
5
+ * if key is not provided, path is required
6
+ *
7
+ * if key is provided, path = `/collections/${key}`
8
+ */
9
+ path?: string;
10
+ /**
11
+ * @en
12
+ * The name of the collection.
13
+ *
14
+ * @zh
15
+ * 合集名称
16
+ */
17
+ name?: string;
18
+ cover?: string;
19
+ description?: string;
20
+ categories?: string[];
21
+ tags?: string[];
22
+ /**
23
+ * @en Whether to show collection as a single collapsed entry in homepage/archive lists.
24
+ * When true (default), a synthetic collection card is added to the post list,
25
+ * representing all articles in the collection as one entry.
26
+ * When false, no synthetic entry is added.
27
+ * @zh 是否在首页/归档列表中以单个条目展示合集。
28
+ * 为 true(默认)时,合集以一张卡片出现在文章列表中,
29
+ * 代表合集内的所有文章。
30
+ * 为 false 时,不添加合集条目。
31
+ * @default true
32
+ */
33
+ collapse?: boolean;
34
+ /**
35
+ * items
36
+ */
37
+ items?: {
38
+ title?: string;
39
+ /**
40
+ * 合集文章的唯一索引
41
+ *
42
+ * 对应路径为 `/collections/${key}/${item.key}`
43
+ */
44
+ key?: string;
45
+ /**
46
+ * @en
47
+ * Link to an existing page or external URL.
48
+ * Internal links (starting with `/`) use `<RouterLink>`.
49
+ * External links (e.g. `https://...`) open in a new tab.
50
+ * Mutually exclusive with `key` — if both are set, `link` takes precedence.
51
+ *
52
+ * @zh
53
+ * 链接到已有页面或外部 URL。
54
+ * 内部链接(以 `/` 开头)使用 `<RouterLink>`。
55
+ * 外部链接(如 `https://...`)在新标签页中打开。
56
+ * 与 `key` 互斥——若同时设置,`link` 优先。
57
+ */
58
+ link?: string;
59
+ }[];
60
+ }
61
+
62
+ export type { CollectionConfig as C };
@@ -73,7 +73,7 @@ import * as readline from 'node:readline';
73
73
  import qrcode from 'qrcode';
74
74
  import ejs from 'ejs';
75
75
 
76
- const version = "1.3.4";
76
+ const version = "1.4.0";
77
77
 
78
78
  const GLOBAL_STATE = {
79
79
  valaxyApp: void 0,
@@ -7726,14 +7726,18 @@ function createTransformMarkdown(options) {
7726
7726
  encryptedKeys.forEach((key) => {
7727
7727
  delete pageData.frontmatter[key];
7728
7728
  });
7729
- const scriptSetupStart = code.indexOf("<script setup>");
7730
- if (scriptSetupStart !== -1)
7731
- code = code.slice(0, scriptSetupStart + "<script setup>".length) + imports.join("\n") + code.slice(scriptSetupStart + 14);
7732
- else
7729
+ const scriptSetup = /^<script setup\b[^>]*>/m.exec(code);
7730
+ if (scriptSetup) {
7731
+ const scriptContentStart = scriptSetup.index + scriptSetup[0].length;
7732
+ code = `${code.slice(0, scriptContentStart)}
7733
+ ${imports.join("\n")}
7734
+ ${code.slice(scriptContentStart)}`;
7735
+ } else {
7733
7736
  code = `<script setup>
7734
7737
  ${imports.join("\n")}
7735
7738
  <\/script>
7736
7739
  ${code}`;
7740
+ }
7737
7741
  const injectA = code.indexOf("<template>") + "<template>".length;
7738
7742
  const injectB = code.lastIndexOf("</template>");
7739
7743
  let body = code.slice(injectA, injectB).trim();
@@ -8829,8 +8833,8 @@ async function ViteValaxyPlugins(valaxyApp, serverOptions = {}, viteConfig = {},
8829
8833
  // https://github.com/antfu/unplugin-vue-components
8830
8834
  Components({
8831
8835
  extensions: ["vue", "md"],
8832
- // allow auto import and register components used in markdown
8833
- include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
8836
+ // The production Vue compiler can inline a Markdown template into its TypeScript script module.
8837
+ include: [/\.(?:vue|md)(?:$|\?vue)/],
8834
8838
  /**
8835
8839
  * 默认排除 components/.exclude
8836
8840
  * `/[\\/]node_modules[\\/]/, ` 不要排除 node_modules/valaxy/client/components 下的组件
@@ -1,403 +1,11 @@
1
1
  import { Header } from '@valaxyjs/utils';
2
+ import { PostFrontMatter, PageFrontMatter, ExcerptType } from 'valaxy/types/frontmatter';
3
+ import { C as CollectionConfig } from './valaxy.CaLqd5CH.mjs';
2
4
  import { FuseOptions } from '@vueuse/integrations/useFuse';
3
5
  import { ZoomOptions } from 'medium-zoom';
4
6
  import { ILazyLoadOptions } from 'vanilla-lazyload';
5
7
  import { RouteRecordRaw } from 'vue-router';
6
8
  import { UseDarkOptions } from '@vueuse/core';
7
- import { NodeRelations, ImageObject } from '@unhead/schema-org';
8
-
9
- interface CollectionConfig {
10
- title?: string;
11
- key?: string;
12
- /**
13
- * if key is not provided, path is required
14
- *
15
- * if key is provided, path = `/collections/${key}`
16
- */
17
- path?: string;
18
- /**
19
- * @en
20
- * The name of the collection.
21
- *
22
- * @zh
23
- * 合集名称
24
- */
25
- name?: string;
26
- cover?: string;
27
- description?: string;
28
- categories?: string[];
29
- tags?: string[];
30
- /**
31
- * @en Whether to show collection as a single collapsed entry in homepage/archive lists.
32
- * When true (default), a synthetic collection card is added to the post list,
33
- * representing all articles in the collection as one entry.
34
- * When false, no synthetic entry is added.
35
- * @zh 是否在首页/归档列表中以单个条目展示合集。
36
- * 为 true(默认)时,合集以一张卡片出现在文章列表中,
37
- * 代表合集内的所有文章。
38
- * 为 false 时,不添加合集条目。
39
- * @default true
40
- */
41
- collapse?: boolean;
42
- /**
43
- * items
44
- */
45
- items?: {
46
- title?: string;
47
- /**
48
- * 合集文章的唯一索引
49
- *
50
- * 对应路径为 `/collections/${key}/${item.key}`
51
- */
52
- key?: string;
53
- /**
54
- * @en
55
- * Link to an existing page or external URL.
56
- * Internal links (starting with `/`) use `<RouterLink>`.
57
- * External links (e.g. `https://...`) open in a new tab.
58
- * Mutually exclusive with `key` — if both are set, `link` takes precedence.
59
- *
60
- * @zh
61
- * 链接到已有页面或外部 URL。
62
- * 内部链接(以 `/` 开头)使用 `<RouterLink>`。
63
- * 外部链接(如 `https://...`)在新标签页中打开。
64
- * 与 `key` 互斥——若同时设置,`link` 优先。
65
- */
66
- link?: string;
67
- }[];
68
- }
69
-
70
- interface Album {
71
- /**
72
- * @description:en-US Album Link
73
- */
74
- url: string;
75
- /**
76
- * @description:en-US Album cover
77
- * url
78
- */
79
- cover: string;
80
- /**
81
- * @description:en-US Album caption
82
- */
83
- caption: string;
84
- /**
85
- * @description:en-US Album description
86
- */
87
- desc: string;
88
- }
89
- interface Photo {
90
- src: string;
91
- caption: string;
92
- desc: string;
93
- }
94
- interface BaseFrontMatter extends Record<string, any> {
95
- /** Canonical URL or site-relative path, independent of the current route alias. */
96
- canonical?: string;
97
- /**
98
- * Title
99
- * @description 文章标题
100
- *
101
- * ```md
102
- * ---
103
- * title: Post Title
104
- * ---
105
- * ```
106
- *
107
- * i18n:
108
- *
109
- * ```md
110
- * ---
111
- * title:
112
- * en: Post Title
113
- * zh-CN: 文章标题
114
- * ---
115
- * ```
116
- */
117
- title: string | Record<string, string>;
118
- /**
119
- * @description:en-US Created Date
120
- * @description:zh-CN 文章创建日期
121
- */
122
- date: string | number | Date;
123
- /**
124
- * Updated Time
125
- */
126
- updated: string | number | Date;
127
- }
128
- interface PageFrontMatter extends BaseFrontMatter {
129
- /**
130
- * Path of post
131
- * route.path
132
- * @description 路径
133
- */
134
- path: string;
135
- /**
136
- * abbrlink
137
- *
138
- * generated by valaxy-addon-abbrlink, do not manually modify
139
- *
140
- * just compatible for [hexo-abbrlink](https://github.com/ohroy/hexo-abbrlink)
141
- */
142
- abbrlink: string;
143
- /**
144
- * i18n
145
- */
146
- lang: string;
147
- /**
148
- * @description Author
149
- * @description:zh-CN 作者
150
- */
151
- author: string;
152
- /**
153
- * Display sponsor info
154
- * @description 是否开启赞助
155
- */
156
- sponsor: boolean;
157
- /**
158
- * Copyright
159
- * @description 是否显示文章底部版权信息
160
- */
161
- copyright: boolean;
162
- /**
163
- * for seo
164
- * schema
165
- */
166
- image: NodeRelations<ImageObject | string>;
167
- /**
168
- * cover
169
- * @description 封面图片(使用组件封面时可省略)
170
- */
171
- cover?: string;
172
- /**
173
- * @description:en-US Vue component name from components/covers/, rendered by supporting themes. An image cover is optional.
174
- * @description:zh-CN components/covers/ 下的 Vue 组件名,由支持的主题渲染。图片 cover 可省略。
175
- */
176
- coverComponent?: string;
177
- /** JSON-serializable props passed to the cover component. */
178
- coverProps?: Record<string, unknown>;
179
- /**
180
- * @description:en-US Open Graph image for SEO
181
- * @description:zh-CN Open Graph 图片,用于 SEO
182
- */
183
- ogImage: string;
184
- /**
185
- * @protected
186
- * @tutorial ⚠️ DO NOT SET MANUALLY (auto-extracted from markdown content)
187
- * @description:en-US First image URL extracted from markdown content
188
- * @description:zh-CN 从 Markdown 内容中自动提取的第一张图片 URL
189
- */
190
- firstImage: string;
191
- /**
192
- * display toc
193
- * @description 是否显示目录
194
- */
195
- toc: boolean;
196
- /**
197
- * display right sidebar
198
- * @description 是否显示右侧侧边栏
199
- */
200
- aside: boolean;
201
- /**
202
- * display left sidebar
203
- * @description 是否显示左侧侧边栏
204
- */
205
- sidebar: boolean;
206
- /**
207
- * @description:en-US Custom Markdown class
208
- * @description:zh-CN 自定义 Markdown 样式
209
- * @default 'markdown-body'
210
- */
211
- markdownClass: string;
212
- /**
213
- * @description:en-US Post title class
214
- * @description:zh-CN 文章标题样式
215
- */
216
- pageTitleClass: string;
217
- /**
218
- * icon before title
219
- * @description 标题前的图标
220
- */
221
- icon: string;
222
- /**
223
- * display comment
224
- */
225
- comment: boolean;
226
- /**
227
- * post is end
228
- * @description 是否完结,将在末尾添加衬线字体 Q.E.D.
229
- */
230
- end: boolean;
231
- /**
232
- * Enable/disable KaTeX math rendering for this page.
233
- * Overrides the global `features.katex` setting.
234
- *
235
- * - When `features.katex: true` (default), set `katex: false` to disable KaTeX for this page.
236
- * - When `features.katex: false`, set `katex: true` to enable KaTeX for this page.
237
- *
238
- * @url https://katex.org/
239
- */
240
- katex: boolean;
241
- /**
242
- * use codepen
243
- * @url https://codepen.io/
244
- */
245
- codepen: boolean;
246
- /**
247
- * use medium-zoom
248
- * @url https://github.com/francoischalifour/medium-zoom
249
- */
250
- medium_zoom: boolean;
251
- /**
252
- * @description:en-US Albums
253
- * @description:zh-CN 相册
254
- */
255
- albums: Album[];
256
- /**
257
- * For layout Gallery
258
- * @description:en-US Photos
259
- */
260
- photos: Photo[];
261
- /**
262
- * for collections
263
- */
264
- collections: CollectionConfig[];
265
- /**
266
- * @description:zh-CN 是否启用加密,password 存在时默认为 true
267
- */
268
- encrypt: boolean;
269
- /**
270
- * @description:zh-CN 加密密码
271
- */
272
- password?: string;
273
- /**
274
- * @description:zh-CN 密码提示
275
- */
276
- password_hint?: string;
277
- /**
278
- * @description:zh-CN 相册密码
279
- */
280
- gallery_password?: string;
281
- /**
282
- * @en
283
- * @description encrypted content
284
- *
285
- * @description:zh-CN 加密后的内容
286
- */
287
- encryptedContent?: string;
288
- /**
289
- * @description:zh-CN 部分加密的内容
290
- */
291
- partiallyEncryptedContents?: string[];
292
- /**
293
- * @description:zh-CN 加密后的相册
294
- */
295
- encryptedPhotos?: string;
296
- /**
297
- * @description:en-US Limit the height of the code block in px
298
- * @description:zh-CN 限制代码块的高度,单位是 px
299
- */
300
- codeHeightLimit?: number;
301
- /**
302
- * @description:en-US Source path for client redirection
303
- * @description:zh-CN 客户端重定向的源路径
304
- */
305
- from?: string | string[];
306
- }
307
-
308
- type ExcerptType = 'md' | 'html' | 'text' | 'ai';
309
- interface PostFrontMatter extends PageFrontMatter {
310
- /**
311
- * @description:en-US Custom post title class in post list
312
- * @description:zh-CN 文章列表中 自定义标题样式
313
- */
314
- postTitleClass: string;
315
- /**
316
- * @description:en-US Post Card Type, can be bilibili/yuque/... (need theme support)
317
- * @description:zh-CN 卡片类型,可以是 bilibili/yuque/... (需主题支持)
318
- */
319
- type: 'bilibili' | 'yuque' | string;
320
- /**
321
- * @en override url, and jump directly
322
- * @zh 覆盖 post url,直接跳转
323
- */
324
- url: string;
325
- /**
326
- * @description:en-US custom excerpt, `excerpt_type` will be invalid
327
- * @description 手动指定摘要,此时 `excerpt_type` 将会无效
328
- */
329
- excerpt: string;
330
- /**
331
- * @description 摘要类型
332
- * @default 'html'
333
- * render type of excerpt
334
- * - md: render as raw markdown
335
- * - html: render as html
336
- * - text: render as text
337
- */
338
- excerpt_type: 'md' | 'text' | 'html' | 'ai';
339
- /**
340
- * @description:en-US Category, if it is an array, it represents multiple folders in order
341
- * @description:zh-CN 分类,若为数组,则按顺序代表多层文件夹
342
- */
343
- categories: string | string[];
344
- /**
345
- * @description:en-US Tags, can have multiple
346
- * @description:zh-CN 标签,可以有多个
347
- */
348
- tags: string[];
349
- /**
350
- * @description:en-US Whether to display the previous and next navigation
351
- * @description:zh-CN 是否显示前一篇、后一篇导航
352
- */
353
- nav: boolean;
354
- /**
355
- * @description:en-US Pin to top, the larger the number, the closer to the front
356
- * @description:zh-CN 置顶,数字越大越靠前
357
- */
358
- top: number;
359
- /**
360
- * @description:en-US Whether it is a draft, it will only be displayed during development
361
- * @description:zh-CN 是否为草稿,将仅在开发时被展示
362
- */
363
- draft: boolean;
364
- /**
365
- * hide in index
366
- * - true/`all`: hide in index & archive
367
- * - `index`: hide in index
368
- * @description 是否隐藏
369
- */
370
- hide: 'index' | boolean;
371
- /**
372
- * @en
373
- * when the post is updated more than 30 days ago, show a warning
374
- * default 30 days, you can set `time_warning` in frontmatter to change it
375
- *
376
- * @zh
377
- * 当文章更新时间超过 30 天时,显示一个警告
378
- * 默认 30 天,你可以在 frontmatter 中设置 `time_warning` (数字)来修改,单位 ms
379
- * @example 3600000
380
- */
381
- time_warning: boolean | number;
382
- /**
383
- * @protected
384
- * @see https://valaxy.site/guide/config/#%E9%98%85%E8%AF%BB%E7%BB%9F%E8%AE%A1
385
- * @tutorial ⚠️ DO NOT SET MANUALLY (generated by `site.config.ts` -> `statistics.enable: true`)
386
- * You can use `statistics.readTime.speed` to change the speed of reading time.
387
- * @description:en-US Reading time
388
- * @description:zh-CN 阅读时间
389
- */
390
- readingTime: number;
391
- /**
392
- * @protected
393
- * @see https://valaxy.site/guide/config/#%E9%98%85%E8%AF%BB%E7%BB%9F%E8%AE%A1
394
- * @tutorial ⚠️ DO NOT SET MANUALLY (generated by `site.config.ts` -> `statistics.enable: true`)
395
- * You need enable `statistics` in site config to use this feature.
396
- * @description:en-US Word count
397
- * @description:zh-CN 字数统计
398
- */
399
- wordCount: string;
400
- }
401
9
 
402
10
  type Page = Partial<PageFrontMatter>;
403
11
  type Post = Partial<PostFrontMatter> & {
@@ -1128,4 +736,4 @@ type UserSiteConfig = PartialDeep<SiteConfig>;
1128
736
  type UserValaxyConfig<ThemeConfig = DefaultTheme.Config> = PartialDeep<ValaxyConfig<ThemeConfig>>;
1129
737
 
1130
738
  export { DefaultTheme as D };
1131
- export type { Album as A, BaseFrontMatter as B, ExcerptType as E, FuseListItem as F, LlmsCollapse as L, PartialDeep as P, RuntimeConfig as R, SiteConfig as S, UserSiteConfig as U, ValaxyConfig as V, RedirectItem as a, ValaxyAddon as b, Post as c, LlmsFeatured as d, Page as e, PageFrontMatter as f, Photo as g, Pkg as h, PostFrontMatter as i, RedirectRule as j, SocialLink as k, UserValaxyConfig as l };
739
+ export type { FuseListItem as F, LlmsCollapse as L, PartialDeep as P, RuntimeConfig as R, SiteConfig as S, UserSiteConfig as U, ValaxyConfig as V, RedirectItem as a, ValaxyAddon as b, Post as c, LlmsFeatured as d, Page as e, Pkg as f, RedirectRule as g, SocialLink as h, UserValaxyConfig as i };
@@ -0,0 +1,321 @@
1
+ import { NodeRelations, ImageObject } from '@unhead/schema-org';
2
+ import { C as CollectionConfig } from '../../shared/valaxy.CaLqd5CH.mjs';
3
+
4
+ interface Album {
5
+ /**
6
+ * @description:en-US Album Link
7
+ */
8
+ url: string;
9
+ /**
10
+ * @description:en-US Album cover
11
+ * url
12
+ */
13
+ cover: string;
14
+ /**
15
+ * @description:en-US Album caption
16
+ */
17
+ caption: string;
18
+ /**
19
+ * @description:en-US Album description
20
+ */
21
+ desc: string;
22
+ }
23
+ interface Photo {
24
+ src: string;
25
+ caption: string;
26
+ desc: string;
27
+ }
28
+ interface BaseFrontMatter extends Record<string, any> {
29
+ /** Canonical URL or site-relative path, independent of the current route alias. */
30
+ canonical?: string;
31
+ /**
32
+ * Title
33
+ * @description 文章标题
34
+ *
35
+ * ```md
36
+ * ---
37
+ * title: Post Title
38
+ * ---
39
+ * ```
40
+ *
41
+ * i18n:
42
+ *
43
+ * ```md
44
+ * ---
45
+ * title:
46
+ * en: Post Title
47
+ * zh-CN: 文章标题
48
+ * ---
49
+ * ```
50
+ */
51
+ title: string | Record<string, string>;
52
+ /**
53
+ * @description:en-US Created Date
54
+ * @description:zh-CN 文章创建日期
55
+ */
56
+ date: string | number | Date;
57
+ /**
58
+ * Updated Time
59
+ */
60
+ updated: string | number | Date;
61
+ }
62
+ interface PageFrontMatter extends BaseFrontMatter {
63
+ /**
64
+ * Path of post
65
+ * route.path
66
+ * @description 路径
67
+ */
68
+ path: string;
69
+ /**
70
+ * abbrlink
71
+ *
72
+ * generated by valaxy-addon-abbrlink, do not manually modify
73
+ *
74
+ * just compatible for [hexo-abbrlink](https://github.com/ohroy/hexo-abbrlink)
75
+ */
76
+ abbrlink: string;
77
+ /**
78
+ * i18n
79
+ */
80
+ lang: string;
81
+ /**
82
+ * @description Author
83
+ * @description:zh-CN 作者
84
+ */
85
+ author: string;
86
+ /**
87
+ * Display sponsor info
88
+ * @description 是否开启赞助
89
+ */
90
+ sponsor: boolean;
91
+ /**
92
+ * Copyright
93
+ * @description 是否显示文章底部版权信息
94
+ */
95
+ copyright: boolean;
96
+ /**
97
+ * for seo
98
+ * schema
99
+ */
100
+ image: NodeRelations<ImageObject | string>;
101
+ /**
102
+ * cover
103
+ * @description 封面图片(使用组件封面时可省略)
104
+ */
105
+ cover?: string;
106
+ /**
107
+ * @description:en-US Vue component name from components/covers/, rendered by supporting themes. An image cover is optional.
108
+ * @description:zh-CN components/covers/ 下的 Vue 组件名,由支持的主题渲染。图片 cover 可省略。
109
+ */
110
+ coverComponent?: string;
111
+ /** JSON-serializable props passed to the cover component. */
112
+ coverProps?: Record<string, unknown>;
113
+ /**
114
+ * @description:en-US Open Graph image for SEO
115
+ * @description:zh-CN Open Graph 图片,用于 SEO
116
+ */
117
+ ogImage: string;
118
+ /**
119
+ * @protected
120
+ * @tutorial ⚠️ DO NOT SET MANUALLY (auto-extracted from markdown content)
121
+ * @description:en-US First image URL extracted from markdown content
122
+ * @description:zh-CN 从 Markdown 内容中自动提取的第一张图片 URL
123
+ */
124
+ firstImage: string;
125
+ /**
126
+ * display toc
127
+ * @description 是否显示目录
128
+ */
129
+ toc: boolean;
130
+ /**
131
+ * display right sidebar
132
+ * @description 是否显示右侧侧边栏
133
+ */
134
+ aside: boolean;
135
+ /**
136
+ * display left sidebar
137
+ * @description 是否显示左侧侧边栏
138
+ */
139
+ sidebar: boolean;
140
+ /**
141
+ * @description:en-US Custom Markdown class
142
+ * @description:zh-CN 自定义 Markdown 样式
143
+ * @default 'markdown-body'
144
+ */
145
+ markdownClass: string;
146
+ /**
147
+ * icon before title
148
+ * @description 标题前的图标
149
+ */
150
+ icon: string;
151
+ /**
152
+ * display comment
153
+ */
154
+ comment: boolean;
155
+ /**
156
+ * post is end
157
+ * @description 是否完结,将在末尾添加衬线字体 Q.E.D.
158
+ */
159
+ end: boolean;
160
+ /**
161
+ * Enable/disable KaTeX math rendering for this page.
162
+ * Overrides the global `features.katex` setting.
163
+ *
164
+ * - When `features.katex: true` (default), set `katex: false` to disable KaTeX for this page.
165
+ * - When `features.katex: false`, set `katex: true` to enable KaTeX for this page.
166
+ *
167
+ * @url https://katex.org/
168
+ */
169
+ katex: boolean;
170
+ /**
171
+ * use medium-zoom
172
+ * @url https://github.com/francoischalifour/medium-zoom
173
+ */
174
+ medium_zoom: boolean;
175
+ /**
176
+ * @description:en-US Albums
177
+ * @description:zh-CN 相册
178
+ */
179
+ albums: Album[];
180
+ /**
181
+ * For layout Gallery
182
+ * @description:en-US Photos
183
+ */
184
+ photos: Photo[];
185
+ /**
186
+ * for collections
187
+ */
188
+ collections: CollectionConfig[];
189
+ /**
190
+ * @description:zh-CN 是否启用加密,password 存在时默认为 true
191
+ */
192
+ encrypt: boolean;
193
+ /**
194
+ * @description:zh-CN 加密密码
195
+ */
196
+ password?: string;
197
+ /**
198
+ * @description:zh-CN 密码提示
199
+ */
200
+ password_hint?: string;
201
+ /**
202
+ * @description:zh-CN 相册密码
203
+ */
204
+ gallery_password?: string;
205
+ /**
206
+ * @en
207
+ * @description encrypted content
208
+ *
209
+ * @description:zh-CN 加密后的内容
210
+ */
211
+ encryptedContent?: string;
212
+ /**
213
+ * @description:zh-CN 部分加密的内容
214
+ */
215
+ partiallyEncryptedContents?: string[];
216
+ /**
217
+ * @description:zh-CN 加密后的相册
218
+ */
219
+ encryptedPhotos?: string;
220
+ /**
221
+ * @description:en-US Limit the height of the code block in px
222
+ * @description:zh-CN 限制代码块的高度,单位是 px
223
+ */
224
+ codeHeightLimit?: number;
225
+ /**
226
+ * @description:en-US Source path for client redirection
227
+ * @description:zh-CN 客户端重定向的源路径
228
+ */
229
+ from?: string | string[];
230
+ }
231
+
232
+ type ExcerptType = 'md' | 'html' | 'text' | 'ai';
233
+ interface PostFrontMatter extends PageFrontMatter {
234
+ /**
235
+ * @description:en-US Post Card Type, can be bilibili/yuque/... (need theme support)
236
+ * @description:zh-CN 卡片类型,可以是 bilibili/yuque/... (需主题支持)
237
+ */
238
+ type: 'bilibili' | 'yuque' | string;
239
+ /**
240
+ * @en override url, and jump directly
241
+ * @zh 覆盖 post url,直接跳转
242
+ */
243
+ url: string;
244
+ /**
245
+ * @description:en-US custom excerpt, `excerpt_type` will be invalid
246
+ * @description 手动指定摘要,此时 `excerpt_type` 将会无效
247
+ */
248
+ excerpt: string;
249
+ /**
250
+ * @description 摘要类型
251
+ * @default 'html'
252
+ * render type of excerpt
253
+ * - md: render as raw markdown
254
+ * - html: render as html
255
+ * - text: render as text
256
+ */
257
+ excerpt_type: 'md' | 'text' | 'html' | 'ai';
258
+ /**
259
+ * @description:en-US Category, if it is an array, it represents multiple folders in order
260
+ * @description:zh-CN 分类,若为数组,则按顺序代表多层文件夹
261
+ */
262
+ categories: string | string[];
263
+ /**
264
+ * @description:en-US Tags, can have multiple
265
+ * @description:zh-CN 标签,可以有多个
266
+ */
267
+ tags: string[];
268
+ /**
269
+ * @description:en-US Whether to display the previous and next navigation
270
+ * @description:zh-CN 是否显示前一篇、后一篇导航
271
+ */
272
+ nav: boolean;
273
+ /**
274
+ * @description:en-US Pin to top, the larger the number, the closer to the front
275
+ * @description:zh-CN 置顶,数字越大越靠前
276
+ */
277
+ top: number;
278
+ /**
279
+ * @description:en-US Whether it is a draft, it will only be displayed during development
280
+ * @description:zh-CN 是否为草稿,将仅在开发时被展示
281
+ */
282
+ draft: boolean;
283
+ /**
284
+ * hide in index
285
+ * - true/`all`: hide in index & archive
286
+ * - `index`: hide in index
287
+ * @description 是否隐藏
288
+ */
289
+ hide: 'index' | boolean;
290
+ /**
291
+ * @en
292
+ * when the post is updated more than 30 days ago, show a warning
293
+ * default 30 days, you can set `time_warning` in frontmatter to change it
294
+ *
295
+ * @zh
296
+ * 当文章更新时间超过 30 天时,显示一个警告
297
+ * 默认 30 天,你可以在 frontmatter 中设置 `time_warning` (数字)来修改,单位 ms
298
+ * @example 3600000
299
+ */
300
+ time_warning: boolean | number;
301
+ /**
302
+ * @protected
303
+ * @see https://valaxy.site/guide/config/#%E9%98%85%E8%AF%BB%E7%BB%9F%E8%AE%A1
304
+ * @tutorial ⚠️ DO NOT SET MANUALLY (generated by `site.config.ts` -> `statistics.enable: true`)
305
+ * You can use `statistics.readTime.speed` to change the speed of reading time.
306
+ * @description:en-US Reading time
307
+ * @description:zh-CN 阅读时间
308
+ */
309
+ readingTime: number;
310
+ /**
311
+ * @protected
312
+ * @see https://valaxy.site/guide/config/#%E9%98%85%E8%AF%BB%E7%BB%9F%E8%AE%A1
313
+ * @tutorial ⚠️ DO NOT SET MANUALLY (generated by `site.config.ts` -> `statistics.enable: true`)
314
+ * You need enable `statistics` in site config to use this feature.
315
+ * @description:en-US Word count
316
+ * @description:zh-CN 字数统计
317
+ */
318
+ wordCount: string;
319
+ }
320
+
321
+ export type { Album, BaseFrontMatter, ExcerptType, PageFrontMatter, Photo, PostFrontMatter };
@@ -0,0 +1 @@
1
+
@@ -1,12 +1,13 @@
1
- import { c as Post } from '../shared/valaxy.Jqi53gnQ.mjs';
2
- export { A as Album, B as BaseFrontMatter, D as DefaultTheme, E as ExcerptType, F as FuseListItem, L as LlmsCollapse, d as LlmsFeatured, e as Page, f as PageFrontMatter, P as PartialDeep, g as Photo, h as Pkg, i as PostFrontMatter, a as RedirectItem, j as RedirectRule, R as RuntimeConfig, S as SiteConfig, k as SocialLink, U as UserSiteConfig, l as UserValaxyConfig, b as ValaxyAddon, V as ValaxyConfig } from '../shared/valaxy.Jqi53gnQ.mjs';
1
+ import { c as Post } from '../shared/valaxy.ukLrUCoH.mjs';
2
+ export { D as DefaultTheme, F as FuseListItem, L as LlmsCollapse, d as LlmsFeatured, e as Page, P as PartialDeep, f as Pkg, a as RedirectItem, g as RedirectRule, R as RuntimeConfig, S as SiteConfig, h as SocialLink, U as UserSiteConfig, i as UserValaxyConfig, b as ValaxyAddon, V as ValaxyConfig } from '../shared/valaxy.ukLrUCoH.mjs';
3
3
  import { Header } from '@valaxyjs/utils';
4
+ export * from 'valaxy/types/frontmatter';
5
+ import '../shared/valaxy.CaLqd5CH.mjs';
4
6
  import '@vueuse/integrations/useFuse';
5
7
  import 'medium-zoom';
6
8
  import 'vanilla-lazyload';
7
9
  import 'vue-router';
8
10
  import '@vueuse/core';
9
- import '@unhead/schema-org';
10
11
 
11
12
  type CleanUrlsMode = 'disabled' | 'without-subfolders' | 'with-subfolders';
12
13
  interface PageData {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "valaxy",
3
3
  "type": "module",
4
- "version": "1.3.4",
4
+ "version": "1.4.0",
5
5
  "description": "📄 Vite & Vue powered static blog generator.",
6
6
  "author": {
7
7
  "email": "me@yunyoujun.cn",
@@ -37,6 +37,9 @@
37
37
  "types": "./dist/types/index.d.mts",
38
38
  "default": "./dist/types/index.mjs"
39
39
  },
40
+ "./types/frontmatter": {
41
+ "types": "./dist/types/frontmatter/index.d.mts"
42
+ },
40
43
  "./package.json": "./package.json",
41
44
  "./*": "./*"
42
45
  },
@@ -76,8 +79,8 @@
76
79
  "@unhead/bundler": "^3.4.1",
77
80
  "@unhead/schema-org": "^3.4.1",
78
81
  "@unhead/vue": "^3.4.1",
79
- "@valaxyjs/devtools": "1.3.4",
80
- "@valaxyjs/utils": "1.3.4",
82
+ "@valaxyjs/devtools": "1.4.0",
83
+ "@valaxyjs/utils": "1.4.0",
81
84
  "@vitejs/devtools": "0.8.0",
82
85
  "@vitejs/plugin-vue": "^6.0.9",
83
86
  "@vueuse/core": "^15.0.0",
package/types/config.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  import type { FuseOptions } from '@vueuse/integrations/useFuse'
2
2
  import type { ZoomOptions } from 'medium-zoom'
3
+ import type { ExcerptType, PostFrontMatter } from 'valaxy/types/frontmatter'
3
4
  import type { ILazyLoadOptions } from 'vanilla-lazyload'
4
5
  import type { RouteRecordRaw } from 'vue-router'
5
6
  import type { ValaxyAddon } from './addon'
6
7
  import type { DefaultTheme } from './default-theme'
7
- import type { PostFrontMatter } from './frontmatter'
8
- import type { ExcerptType } from './frontmatter/post'
9
8
  import type { FuseListItem } from './node'
10
9
 
11
10
  import './default-theme'
@@ -153,12 +153,6 @@ export interface PageFrontMatter extends BaseFrontMatter {
153
153
  */
154
154
  markdownClass: string
155
155
 
156
- /**
157
- * @description:en-US Post title class
158
- * @description:zh-CN 文章标题样式
159
- */
160
- pageTitleClass: string
161
-
162
156
  /**
163
157
  * icon before title
164
158
  * @description 标题前的图标
@@ -184,11 +178,6 @@ export interface PageFrontMatter extends BaseFrontMatter {
184
178
  * @url https://katex.org/
185
179
  */
186
180
  katex: boolean
187
- /**
188
- * use codepen
189
- * @url https://codepen.io/
190
- */
191
- codepen: boolean
192
181
  /**
193
182
  * use medium-zoom
194
183
  * @url https://github.com/francoischalifour/medium-zoom
@@ -3,12 +3,6 @@ import type { PageFrontMatter } from './page'
3
3
  export type ExcerptType = 'md' | 'html' | 'text' | 'ai'
4
4
 
5
5
  export interface PostFrontMatter extends PageFrontMatter {
6
- /**
7
- * @description:en-US Custom post title class in post list
8
- * @description:zh-CN 文章列表中 自定义标题样式
9
- */
10
- postTitleClass: string
11
-
12
6
  /**
13
7
  * @description:en-US Post Card Type, can be bilibili/yuque/... (need theme support)
14
8
  * @description:zh-CN 卡片类型,可以是 bilibili/yuque/... (需主题支持)
package/types/index.ts CHANGED
@@ -7,9 +7,9 @@ export * from './config'
7
7
  export * from './data'
8
8
  // default theme
9
9
  export * from './default-theme'
10
- export * from './frontmatter'
11
10
 
12
11
  // used in node, but without node deps
13
12
  // and need be shared with client types
14
13
  export * from './node'
15
14
  export * from './posts'
15
+ export type * from 'valaxy/types/frontmatter'
package/types/posts.ts CHANGED
@@ -1,5 +1,5 @@
1
+ import type { PageFrontMatter, PostFrontMatter } from 'valaxy/types/frontmatter'
1
2
  import type { CollectionConfig } from '../client/types'
2
- import type { PageFrontMatter, PostFrontMatter } from './frontmatter'
3
3
 
4
4
  export type Page = Partial<PageFrontMatter>
5
5
  export type Post = Partial<PostFrontMatter> & {
@@ -1,15 +0,0 @@
1
- import { useHead } from '@unhead/vue'
2
-
3
- /**
4
- * @deprecated
5
- */
6
- export function useCodePen() {
7
- useHead({
8
- script: [
9
- {
10
- src: 'https://static.codepen.io/assets/embed/ei.js',
11
- async: true,
12
- },
13
- ],
14
- })
15
- }