valaxy 0.6.3 → 0.7.2

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.
Files changed (68) hide show
  1. package/client/components/PostCard.vue +26 -29
  2. package/client/config.ts +1 -1
  3. package/client/index.ts +5 -0
  4. package/client/main.ts +3 -0
  5. package/client/setup/main.ts +11 -0
  6. package/client/setups.ts +16 -0
  7. package/client/styles/common/custom-blocks.scss +7 -0
  8. package/client/styles/common/markdown.scss +0 -4
  9. package/dist/chunk-35O5DRGK.mjs +2270 -0
  10. package/dist/chunk-4VSND5ZW.mjs +1 -0
  11. package/dist/chunk-CDIW2WTI.js +1 -0
  12. package/dist/chunk-RGBLPQZ2.js +2270 -0
  13. package/dist/{index.d.ts → client/index.d.ts} +16 -160
  14. package/dist/client/index.js +1 -0
  15. package/dist/client/index.mjs +1 -0
  16. package/dist/index-a6b0a69b.d.ts +16 -0
  17. package/dist/{config-112ac884.d.ts → index-afca77df.d.ts} +223 -6
  18. package/dist/node/cli.js +13 -8
  19. package/dist/node/cli.mjs +13 -8
  20. package/dist/node/index.d.ts +13 -35
  21. package/dist/node/index.js +1 -1
  22. package/dist/node/index.mjs +1 -1
  23. package/dist/types/index.d.ts +10 -0
  24. package/dist/types/index.js +1 -0
  25. package/dist/types/index.mjs +0 -0
  26. package/package.json +27 -22
  27. package/shared/index.ts +19 -0
  28. package/config/index.ts +0 -18
  29. package/dist/chunk-4TQV23CA.mjs +0 -40
  30. package/dist/chunk-C4MEVIMD.js +0 -40
  31. package/dist/chunk-EAN2KU6W.mjs +0 -1
  32. package/dist/chunk-U5OMNIOK.js +0 -1
  33. package/dist/index.js +0 -1
  34. package/dist/index.mjs +0 -1
  35. package/index.ts +0 -3
  36. package/node/build.ts +0 -31
  37. package/node/cli.ts +0 -192
  38. package/node/config.ts +0 -156
  39. package/node/index.ts +0 -1
  40. package/node/markdown/check.ts +0 -14
  41. package/node/markdown/highlight.ts +0 -38
  42. package/node/markdown/index.ts +0 -109
  43. package/node/markdown/markdown-it/container.ts +0 -61
  44. package/node/markdown/markdown-it/headings.ts +0 -32
  45. package/node/markdown/markdown-it/highlightLines.ts +0 -96
  46. package/node/markdown/markdown-it/katex.ts +0 -210
  47. package/node/markdown/markdown-it/parseHeader.ts +0 -72
  48. package/node/markdown/markdownToVue.ts +0 -277
  49. package/node/markdown/slugify.ts +0 -24
  50. package/node/options.ts +0 -108
  51. package/node/plugins/extendConfig.ts +0 -46
  52. package/node/plugins/index.ts +0 -224
  53. package/node/plugins/preset.ts +0 -186
  54. package/node/plugins/unocss.ts +0 -110
  55. package/node/plugins/valaxy.ts +0 -1
  56. package/node/rss.ts +0 -127
  57. package/node/server.ts +0 -23
  58. package/node/shims.d.ts +0 -33
  59. package/node/utils/cli.ts +0 -103
  60. package/node/utils/getGitTimestamp.ts +0 -13
  61. package/node/utils/index.ts +0 -59
  62. package/node/utils/net.ts +0 -20
  63. package/node/vite.ts +0 -52
  64. package/tsup.config.ts +0 -25
  65. package/types/config.ts +0 -217
  66. package/types/data.ts +0 -31
  67. package/types/index.ts +0 -3
  68. package/types/posts.ts +0 -122
@@ -1,157 +1,19 @@
1
1
  import * as vue from 'vue';
2
2
  import { InjectionKey, ComputedRef, Ref, StyleValue } from 'vue';
3
- import { V as ValaxyConfig, a as ValaxyThemeConfig, U as UserConfig } from './config-112ac884.js';
4
- export { A as AlgoliaSearchOptions, S as SocialLink, U as UserConfig, V as ValaxyConfig, a as ValaxyThemeConfig } from './config-112ac884.js';
5
- import * as valaxy_theme_yun from 'valaxy-theme-yun';
6
- import { ThemeConfig, YunTheme } from 'valaxy-theme-yun';
7
- import * as type_fest_source_partial_deep from 'type-fest/source/partial-deep';
3
+ import { a as ValaxyConfig, b as ValaxyThemeConfig, P as PageData, d as Post } from '../index-afca77df.js';
4
+ import { ThemeConfig } from 'valaxy-theme-yun';
5
+ import { ViteSSGContext } from 'vite-ssg';
6
+ import { Awaitable } from '@antfu/utils';
7
+ import { VitePluginConfig } from 'unocss/vite';
8
+ export { E as EXTERNAL_URL_RE, d as defineConfig, a as defineConfigWithTheme } from '../index-a6b0a69b.js';
9
+ import '@vitejs/plugin-vue';
10
+ import 'unplugin-vue-components/vite';
8
11
  import 'type-fest';
9
- import 'unocss/vite';
10
12
  import 'markdown-it';
11
13
  import 'shiki';
12
14
  import 'markdown-it-anchor';
13
15
  import 'katex';
14
-
15
- interface Post extends Record<string, any> {
16
- /**
17
- * Path of post
18
- * route.path
19
- * @description 路径
20
- */
21
- path?: string;
22
- /**
23
- * Title
24
- * @description 文章标题
25
- */
26
- title?: string;
27
- date?: string | number | Date;
28
- /**
29
- * Updated Time
30
- */
31
- updated?: string | number | Date;
32
- lang?: string;
33
- /**
34
- * TODO
35
- * Read Time
36
- * @description 阅读时长
37
- */
38
- duration?: string;
39
- /**
40
- * post card type, can be bilibili/yuque/...
41
- */
42
- type?: string;
43
- /**
44
- * override url, and jump directly
45
- */
46
- url?: string;
47
- /**
48
- * @description 摘要
49
- */
50
- excerpt?: string;
51
- /**
52
- * Display sponsor info
53
- * @description 是否开启赞助
54
- */
55
- sponsor?: boolean;
56
- /**
57
- * Copyright
58
- * @description 是否显示文章底部版权信息
59
- */
60
- copyright?: boolean;
61
- /**
62
- * Category
63
- * @description 分类,若为数组,则按顺序代表多层文件夹
64
- */
65
- categories?: string | string[];
66
- /**
67
- * Tags
68
- * @description 标签,可以有多个
69
- */
70
- tags?: string[];
71
- /**
72
- * display prev next
73
- * @description 是否显示前一篇、后一篇导航
74
- */
75
- nav?: boolean;
76
- /**
77
- * icon before title
78
- */
79
- icon?: string;
80
- /**
81
- * title color
82
- */
83
- color?: string;
84
- /**
85
- * display comment
86
- */
87
- comment?: boolean;
88
- /**
89
- * post is end
90
- * @description 是否完结,将在末尾添加衬线字体 Q.E.D.
91
- */
92
- end?: boolean;
93
- /**
94
- * use aplayer
95
- */
96
- aplayer?: boolean;
97
- /**
98
- * use katex
99
- */
100
- katex?: boolean;
101
- /**
102
- * use codepen
103
- */
104
- codepen?: boolean;
105
- /**
106
- * 置顶
107
- */
108
- top?: number;
109
- /**
110
- * display toc
111
- * @description 是否显示目录
112
- */
113
- toc?: boolean;
114
- /**
115
- * is draft
116
- * @description 是否为草稿
117
- */
118
- draft?: boolean;
119
- /**
120
- * cover
121
- * @description 封面图片
122
- */
123
- cover?: string;
124
- /**
125
- * enable markdown-body class
126
- * @description 是否启用默认的 markdown 样式
127
- */
128
- markdown?: boolean;
129
- }
130
-
131
- interface Header {
132
- level: number;
133
- title: string;
134
- slug: string;
135
- /**
136
- * i18n
137
- */
138
- lang?: string;
139
- }
140
- interface PageData {
141
- path: string;
142
- relativePath: string;
143
- title: string;
144
- titleTemplate?: string;
145
- description: string;
146
- headers: Header[];
147
- frontmatter: Post;
148
- lastUpdated?: number;
149
- }
150
- interface PageDataPayload {
151
- path: string;
152
- pageData: PageData;
153
- }
154
- declare type HeadConfig = [string, Record<string, string>] | [string, Record<string, string>, string];
16
+ import 'type-fest/source/partial-deep';
155
17
 
156
18
  interface ValaxyContext {
157
19
  userRoot: string;
@@ -211,10 +73,7 @@ declare function usePostList(params?: {
211
73
  * get all page
212
74
  * @returns
213
75
  */
214
- declare function usePageList(): vue.ComputedRef<({
215
- path: string;
216
- excerpt: unknown;
217
- } & Post)[]>;
76
+ declare function usePageList(): vue.ComputedRef<any[]>;
218
77
  /**
219
78
  * get prev and next post
220
79
  * @param path
@@ -349,13 +208,10 @@ declare function formatDate(date: string | number | Date, template?: string): st
349
208
  */
350
209
  declare function sortByDate(posts: Post[], desc?: boolean): Post[];
351
210
 
352
- /**
353
- * Type config helper
354
- */
355
- declare function defineConfig(config: UserConfig<YunTheme.Config>): type_fest_source_partial_deep.PartialObjectDeep<ValaxyConfig<valaxy_theme_yun.ThemeConfig>>;
356
- /**
357
- * Type config helper for custom theme config
358
- */
359
- declare function defineConfigWithTheme<ThemeConfig>(config: UserConfig<ThemeConfig>): type_fest_source_partial_deep.PartialObjectDeep<ValaxyConfig<ThemeConfig>>;
211
+ declare type AppContext = ViteSSGContext;
212
+ declare type AppSetup = (ctx: AppContext) => Awaitable<void>;
213
+ declare type UnoSetup = () => Awaitable<Partial<VitePluginConfig> | undefined>;
214
+ declare function defineAppSetup(fn: AppSetup): AppSetup;
215
+ declare function defineUnoSetup(fn: UnoSetup): UnoSetup;
360
216
 
361
- export { BaseCategory, Categories, Category, HeadConfig, Header, PageData, PageDataPayload, ParentCategory, Post, PostCategory, Tags, ValaxyData, defineConfig, defineConfigWithTheme, formatDate, initConfig, initContext, isDark, isParentCategory, random, sortByDate, throttleAndDebounce, toggleDark, useActiveSidebarLinks, useAplayer, useBackToTop, useCategory, useCodePen, useConfig, useFrontmatter, useFullUrl, useInvisibleElement, useLayout, usePageList, usePostList, usePostProperty, usePostTitle, usePrevNext, useSidebar, useTag, useTags, useThemeConfig, useTwikoo, useWaline, valaxyConfigRef, valaxyConfigSymbol, valaxyContextRef, wrap, wrapTable };
217
+ export { AppSetup, BaseCategory, Categories, Category, ParentCategory, PostCategory, Tags, UnoSetup, ValaxyData, defineAppSetup, defineUnoSetup, formatDate, initConfig, initContext, isDark, isParentCategory, random, sortByDate, throttleAndDebounce, toggleDark, useActiveSidebarLinks, useAplayer, useBackToTop, useCategory, useCodePen, useConfig, useFrontmatter, useFullUrl, useInvisibleElement, useLayout, usePageList, usePostList, usePostProperty, usePostTitle, usePrevNext, useSidebar, useTag, useTags, useThemeConfig, useTwikoo, useWaline, valaxyConfigRef, valaxyConfigSymbol, valaxyContextRef, wrap, wrapTable };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkCDIW2WTIjs = require('../chunk-CDIW2WTI.js');var _config = require('@valaxyjs/config'); var _config2 = _interopRequireDefault(_config);var _context = require('@valaxyjs/context'); var _context2 = _interopRequireDefault(_context);var _vue = require('vue');function h(t){let e=JSON.parse(t);return __DEV__?_vue.readonly.call(void 0, e):e}var z=Symbol("valaxy:config"),T= exports.valaxyConfigRef =_vue.shallowRef.call(void 0, h(_config2.default)),b= exports.valaxyContextRef =_vue.shallowRef.call(void 0, h(_context2.default));import.meta.hot&&(import.meta.hot.accept("/@valaxyjs/config",t=>{T.value=h(t.default)}),import.meta.hot.accept("/@valaxyjs/context",t=>{b.value=h(t.default)}));function Et(){return _vue.computed.call(void 0, ()=>T.value)}function Mt(){return _vue.computed.call(void 0, ()=>b.value)}function v(){let t=_vue.inject.call(void 0, z);if(!t)throw new Error("[Valaxy] config not properly injected in app");return t}function y(){let t=v();return _vue.computed.call(void 0, ()=>t.value.themeConfig)}var _vuerouter = require('vue-router');var _vuei18n = require('vue-i18n');function Dt(t,e){return Math.random()*(e-t)+t}function I(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var Ht=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",I(e,"table-container")})};function kt(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}var _dayjs = require('dayjs'); var _dayjs2 = _interopRequireDefault(_dayjs);function Ot(t,e="YYYY-MM-DD"){return _dayjs2.default.call(void 0, t).format(e)}function C(t,e=!0){return t.sort((o,n)=>{let i=+new Date(o.date||""),r=+new Date(n.date||"");return e?r-i:i-r})}var Ft=t=>{let{locale:e}=_vuei18n.useI18n.call(void 0, );return _vue.computed.call(void 0, ()=>{let o=e.value==="zh-CN"?"zh":e.value;return t.value[`title_${o}`]||t.value.title})};function g(t={}){let e=_vuerouter.useRouter.call(void 0, );return _vue.computed.call(void 0, ()=>{let o=e.getRoutes().filter(r=>r.path.startsWith("/posts")&&r.meta.frontmatter&&r.meta.frontmatter.date).filter(r=>!r.path.endsWith(".html")).filter(r=>!t.type||r.meta.frontmatter.type===t.type).map(r=>Object.assign({path:r.path,excerpt:r.meta.excerpt},r.meta.frontmatter)),n=C(o.filter(r=>r.top)).sort((r,a)=>a.top-r.top),i=C(o.filter(r=>!r.top));return n.concat(i)})}function Gt(){let t=_vuerouter.useRouter.call(void 0, );return _vue.computed.call(void 0, ()=>t.getRoutes().map(o=>Object.assign({path:o.path,excerpt:o.meta.excerpt},o.meta.frontmatter)))}function Kt(t){let e=_vuerouter.useRoute.call(void 0, ),o=_vue.computed.call(void 0, ()=>t||e.path),n=g(),i=_vue.computed.call(void 0, ()=>{let s=-1;return n.value.find((l,u)=>l.path===o.value?(s=u,!0):!1),s}),r=_vue.computed.call(void 0, ()=>i.value-1>=0?n.value[i.value-1]:null),a=_vue.computed.call(void 0, ()=>i.value+1<n.value.length?n.value[i.value+1]:null);return[r,a]}function Jt(t){if(!t)return{color:"",icon:"",styles:{}};let e=y();t in e.value.types||(t="link");let o=e.value.types[t].color,n=e.value.types[t].icon,i=_vue.computed.call(void 0, ()=>({"--card-c-primary":t&&o}));return{color:o,icon:n,styles:i}}var te=t=>t.children;function ee(t,e=[]){var i;e.length||(e=_vue.unref.call(void 0, g()));let o={total:e.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},n=o.children.get("Uncategorized");if(e.forEach(r=>{if(r.categories)if(Array.isArray(r.categories)){let a=r.categories.length,s=o;r.categories.forEach((l,u)=>{var p,d,f;if(u===a-1)if(s.children.has(l)){let c=s.children.get(l);c.posts&&(c.total+=1,c.posts.push(r))}else(p=s.children)==null||p.set(l,{total:1,posts:[r]});else if((d=s.children)!=null&&d.has(l)){let c=s.children.get(l);c.total+=1,s=c}else{let c={total:1,children:new Map};(f=s.children)==null||f.set(l,c),s=c}})}else{let a=r.categories;if(o.children.has(a)){let s=o.children.get(a);s.total+=1,s.posts.push(r)}else o.children.set(a,{total:1,posts:[r]})}else n.total+=1,n.posts.push(r)}),n.total===0&&((i=o.children)==null||i.delete("Uncategorized")),t){let r=o.children.get(t);return r?{total:r==null?void 0:r.total,children:new Map([[t,r]])}:(console.warn(`Do not have category: ${t}`),o)}else return o}var _tinycolor = require('@ctrl/tinycolor');function ie(t={primary:"#0078E7"}){let e=F(),o=new (0, _tinycolor.TinyColor)("#999999"),n=new (0, _tinycolor.TinyColor)(t.primary);return{tags:e,getTagStyle:r=>{let a=Array.from(e).map(([d,f])=>f.count),s=Math.max(...a),l=Math.min(...a),u=s-l,p=(r-l)/u;return{"--yun-tag-color":o.mix(n,p*100).toString(),fontSize:`${p*36+12}px`}}}}function F(){let t=g(),e=new Map;return t.value.forEach(o=>{if(o.tags){let n;typeof o.tags=="string"?n=[o.tags]:n=o.tags,n.forEach(i=>{if(e.has(i)){let r=e.get(i);e.set(i,{...r,count:r.count+1})}else e.set(i,{count:1})})}}),e}var _core = require('@vueuse/core');function L(){let t=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>t.meta.frontmatter)}function pe(){let t=v(),e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>((t.value.url.endsWith("/")?t.value.url.slice(0,-1):t.value.url)||_core.isClient&&window.location.origin)+e.path)}function ge(t){let e=_vue.ref.call(void 0, !1),{top:o}=_core.useElementBounding.call(void 0, t);return _core.useIntersectionObserver.call(void 0, t,([{isIntersecting:i}])=>{e.value=i}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}var tt=_core.useDark.call(void 0, ),xe= exports.toggleDark =_core.useToggle.call(void 0, tt);function Te(t){let e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>e.meta.layout===t)}var _head = require('@vueuse/head');function Se(){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"}]}),_core.useScriptTag.call(void 0, "https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js",()=>{_core.useScriptTag.call(void 0, "https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js")})}function Me(t={offset:100}){if(!_core.isClient)return{percentage:_vue.ref.call(void 0, 0),show:_vue.ref.call(void 0, !1)};let{y:e}=_core.useWindowScroll.call(void 0, ),o=_vue.computed.call(void 0, ()=>e.value/(document.body.scrollHeight-window.innerHeight)),n=_vue.computed.call(void 0, ()=>e.value>t.offset);return{percentage:o,show:n}}function He(){_head.useHead.call(void 0, {script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}var _utils = require('@antfu/utils');function H(t,e){if(Array.isArray(t))return t;e=_utils.ensurePrefix.call(void 0, "/",e);for(let o in t)if(e.startsWith(_utils.ensurePrefix.call(void 0, "/",o)))return t[o];return[]}function $e(){let t=_vuerouter.useRoute.call(void 0, ),e=L(),o=y(),n=_vue.ref.call(void 0, !1),i=_vue.computed.call(void 0, ()=>{let u=o.value.sidebar,p=t.path;return u?H(u,p):[]}),r=_vue.computed.call(void 0, ()=>e.value.sidebar!==!1);function a(){n.value=!0}function s(){n.value=!1}function l(){n.value?s():a()}return{isOpen:n,sidebar:i,hasSidebar:r,open:a,close:s,toggle:l}}function Fe(t,e){let o=mt(n,200);function n(){let s=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),l=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(u=>s.some(p=>p.hash===u.hash));for(let u=0;u<l.length;u++){let p=l[u],d=l[u+1],[f,c]=pt(u,p,d);if(f){history.replaceState(null,document.title,c||" "),r(c);return}}}let i=null;function r(s){a(i);let l=i=s==null?null:t.value.querySelector(`.va-toc a[href="${s}"]`);e.value&&(l?(l.classList.add("active"),e.value.style.opacity="1",e.value.style.top=`${l.offsetTop+2}px`):(e.value.style.opacity="0",e.value.style.top="54px"))}function a(s){s&&s.classList.remove("active")}_vue.onMounted.call(void 0, ()=>{requestAnimationFrame(n),window.addEventListener("scroll",o)}),_vue.onUnmounted.call(void 0, ()=>{window.removeEventListener("scroll",o)})}function V(t){return t.parentElement.offsetTop-50}function pt(t,e,o){let n=window.scrollY;return t===0&&n===0?[!0,null]:n<V(e)?[!1,null]:!o||n<V(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function mt(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}function Xe(t={}){let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, );function n(i={}){if(!_core.isClient)return;let r={el:".comment #tcomment",lang:o.value,path:e.path},a=Object.assign(r,i);return window.twikoo.init(a)}_core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{n(t)})}function io(t={}){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/@waline/client/dist/waline.css"}]});let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, ),n;function i(r={}){if(!_core.isClient)return;let a={el:".comment #waline",lang:o.value,dark:"html.dark",emoji:["https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/qq","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo"],path:e.path},s=Object.assign(a,r);return window.Waline.init(s)}return _core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/@waline/client/dist/waline.js",()=>{n=i(t)}),_vue.watch.call(void 0, ()=>e.path,r=>{!n||n.update({path:r})}),_vue.watch.call(void 0, o,r=>{!n||n.update({lang:r})}),_vue.onUnmounted.call(void 0, ()=>{!n||n.destroy()}),n}function To(t){return t}function bo(t){return t}exports.EXTERNAL_URL_RE = _chunkCDIW2WTIjs.d; exports.defineAppSetup = To; exports.defineConfig = _chunkCDIW2WTIjs.e; exports.defineConfigWithTheme = _chunkCDIW2WTIjs.f; exports.defineUnoSetup = bo; exports.formatDate = Ot; exports.initConfig = Et; exports.initContext = Mt; exports.isDark = tt; exports.isParentCategory = te; exports.random = Dt; exports.sortByDate = C; exports.throttleAndDebounce = kt; exports.toggleDark = xe; exports.useActiveSidebarLinks = Fe; exports.useAplayer = Se; exports.useBackToTop = Me; exports.useCategory = ee; exports.useCodePen = He; exports.useConfig = v; exports.useFrontmatter = L; exports.useFullUrl = pe; exports.useInvisibleElement = ge; exports.useLayout = Te; exports.usePageList = Gt; exports.usePostList = g; exports.usePostProperty = Jt; exports.usePostTitle = Ft; exports.usePrevNext = Kt; exports.useSidebar = $e; exports.useTag = F; exports.useTags = ie; exports.useThemeConfig = y; exports.useTwikoo = Xe; exports.useWaline = io; exports.valaxyConfigRef = T; exports.valaxyConfigSymbol = z; exports.valaxyContextRef = b; exports.wrap = I; exports.wrapTable = Ht;
@@ -0,0 +1 @@
1
+ import{d as bt,e as Pt,f as At}from"../chunk-4VSND5ZW.mjs";import O from"@valaxyjs/config";import B from"@valaxyjs/context";import{computed as x,inject as W,readonly as q,shallowRef as w}from"vue";function h(t){let e=JSON.parse(t);return __DEV__?q(e):e}var z=Symbol("valaxy:config"),T=w(h(O)),b=w(h(B));import.meta.hot&&(import.meta.hot.accept("/@valaxyjs/config",t=>{T.value=h(t.default)}),import.meta.hot.accept("/@valaxyjs/context",t=>{b.value=h(t.default)}));function Et(){return x(()=>T.value)}function Mt(){return x(()=>b.value)}function v(){let t=W(z);if(!t)throw new Error("[Valaxy] config not properly injected in app");return t}function y(){let t=v();return x(()=>t.value.themeConfig)}import{unref as $}from"vue";import{computed as m}from"vue";import{useRoute as Y,useRouter as P}from"vue-router";import{useI18n as _}from"vue-i18n";function Dt(t,e){return Math.random()*(e-t)+t}function I(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var Ht=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",I(e,"table-container")})};function kt(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}import N from"dayjs";function Ot(t,e="YYYY-MM-DD"){return N(t).format(e)}function C(t,e=!0){return t.sort((o,n)=>{let i=+new Date(o.date||""),r=+new Date(n.date||"");return e?r-i:i-r})}var Ft=t=>{let{locale:e}=_();return m(()=>{let o=e.value==="zh-CN"?"zh":e.value;return t.value[`title_${o}`]||t.value.title})};function g(t={}){let e=P();return m(()=>{let o=e.getRoutes().filter(r=>r.path.startsWith("/posts")&&r.meta.frontmatter&&r.meta.frontmatter.date).filter(r=>!r.path.endsWith(".html")).filter(r=>!t.type||r.meta.frontmatter.type===t.type).map(r=>Object.assign({path:r.path,excerpt:r.meta.excerpt},r.meta.frontmatter)),n=C(o.filter(r=>r.top)).sort((r,a)=>a.top-r.top),i=C(o.filter(r=>!r.top));return n.concat(i)})}function Gt(){let t=P();return m(()=>t.getRoutes().map(o=>Object.assign({path:o.path,excerpt:o.meta.excerpt},o.meta.frontmatter)))}function Kt(t){let e=Y(),o=m(()=>t||e.path),n=g(),i=m(()=>{let s=-1;return n.value.find((l,u)=>l.path===o.value?(s=u,!0):!1),s}),r=m(()=>i.value-1>=0?n.value[i.value-1]:null),a=m(()=>i.value+1<n.value.length?n.value[i.value+1]:null);return[r,a]}function Jt(t){if(!t)return{color:"",icon:"",styles:{}};let e=y();t in e.value.types||(t="link");let o=e.value.types[t].color,n=e.value.types[t].icon,i=m(()=>({"--card-c-primary":t&&o}));return{color:o,icon:n,styles:i}}var te=t=>t.children;function ee(t,e=[]){var i;e.length||(e=$(g()));let o={total:e.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},n=o.children.get("Uncategorized");if(e.forEach(r=>{if(r.categories)if(Array.isArray(r.categories)){let a=r.categories.length,s=o;r.categories.forEach((l,u)=>{var p,d,f;if(u===a-1)if(s.children.has(l)){let c=s.children.get(l);c.posts&&(c.total+=1,c.posts.push(r))}else(p=s.children)==null||p.set(l,{total:1,posts:[r]});else if((d=s.children)!=null&&d.has(l)){let c=s.children.get(l);c.total+=1,s=c}else{let c={total:1,children:new Map};(f=s.children)==null||f.set(l,c),s=c}})}else{let a=r.categories;if(o.children.has(a)){let s=o.children.get(a);s.total+=1,s.posts.push(r)}else o.children.set(a,{total:1,posts:[r]})}else n.total+=1,n.posts.push(r)}),n.total===0&&((i=o.children)==null||i.delete("Uncategorized")),t){let r=o.children.get(t);return r?{total:r==null?void 0:r.total,children:new Map([[t,r]])}:(console.warn(`Do not have category: ${t}`),o)}else return o}import{TinyColor as A}from"@ctrl/tinycolor";function ie(t={primary:"#0078E7"}){let e=F(),o=new A("#999999"),n=new A(t.primary);return{tags:e,getTagStyle:r=>{let a=Array.from(e).map(([d,f])=>f.count),s=Math.max(...a),l=Math.min(...a),u=s-l,p=(r-l)/u;return{"--yun-tag-color":o.mix(n,p*100).toString(),fontSize:`${p*36+12}px`}}}}function F(){let t=g(),e=new Map;return t.value.forEach(o=>{if(o.tags){let n;typeof o.tags=="string"?n=[o.tags]:n=o.tags,n.forEach(i=>{if(e.has(i)){let r=e.get(i);e.set(i,{...r,count:r.count+1})}else e.set(i,{count:1})})}}),e}import{useRoute as S}from"vue-router";import{computed as j}from"vue";import{isClient as G}from"@vueuse/core";function L(){let t=S();return j(()=>t.meta.frontmatter)}function pe(){let t=v(),e=S();return j(()=>((t.value.url.endsWith("/")?t.value.url.slice(0,-1):t.value.url)||G&&window.location.origin)+e.path)}import{useElementBounding as K,useIntersectionObserver as J}from"@vueuse/core";import{ref as Q}from"vue";function ge(t){let e=Q(!1),{top:o}=K(t);return J(t,([{isIntersecting:i}])=>{e.value=i}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}import{useDark as X,useToggle as Z}from"@vueuse/core";var tt=X(),xe=Z(tt);import{computed as et}from"vue";import{useRoute as ot}from"vue-router";function Te(t){let e=ot();return et(()=>e.meta.layout===t)}import{useScriptTag as E}from"@vueuse/core";import{useHead as rt}from"@vueuse/head";function Se(){rt({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"}]}),E("https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js",()=>{E("https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js")})}import{isClient as nt,useWindowScroll as it}from"@vueuse/core";import{computed as M,ref as R}from"vue";function Me(t={offset:100}){if(!nt)return{percentage:R(0),show:R(!1)};let{y:e}=it(),o=M(()=>e.value/(document.body.scrollHeight-window.innerHeight)),n=M(()=>e.value>t.offset);return{percentage:o,show:n}}import{useHead as st}from"@vueuse/head";function He(){st({script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}import{computed as k,onMounted as at,onUnmounted as lt,ref as ut}from"vue";import{useRoute as ct}from"vue-router";import{ensurePrefix as D}from"@antfu/utils";function H(t,e){if(Array.isArray(t))return t;e=D("/",e);for(let o in t)if(e.startsWith(D("/",o)))return t[o];return[]}function $e(){let t=ct(),e=L(),o=y(),n=ut(!1),i=k(()=>{let u=o.value.sidebar,p=t.path;return u?H(u,p):[]}),r=k(()=>e.value.sidebar!==!1);function a(){n.value=!0}function s(){n.value=!1}function l(){n.value?s():a()}return{isOpen:n,sidebar:i,hasSidebar:r,open:a,close:s,toggle:l}}function Fe(t,e){let o=mt(n,200);function n(){let s=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),l=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(u=>s.some(p=>p.hash===u.hash));for(let u=0;u<l.length;u++){let p=l[u],d=l[u+1],[f,c]=pt(u,p,d);if(f){history.replaceState(null,document.title,c||" "),r(c);return}}}let i=null;function r(s){a(i);let l=i=s==null?null:t.value.querySelector(`.va-toc a[href="${s}"]`);e.value&&(l?(l.classList.add("active"),e.value.style.opacity="1",e.value.style.top=`${l.offsetTop+2}px`):(e.value.style.opacity="0",e.value.style.top="54px"))}function a(s){s&&s.classList.remove("active")}at(()=>{requestAnimationFrame(n),window.addEventListener("scroll",o)}),lt(()=>{window.removeEventListener("scroll",o)})}function V(t){return t.parentElement.offsetTop-50}function pt(t,e,o){let n=window.scrollY;return t===0&&n===0?[!0,null]:n<V(e)?[!1,null]:!o||n<V(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function mt(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}import{isClient as ft,useScriptTag as dt}from"@vueuse/core";import{useI18n as gt}from"vue-i18n";import{useRoute as ht}from"vue-router";function Xe(t={}){let e=ht(),{locale:o}=gt();function n(i={}){if(!ft)return;let r={el:".comment #tcomment",lang:o.value,path:e.path},a=Object.assign(r,i);return window.twikoo.init(a)}dt("//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{n(t)})}import{isClient as yt,useScriptTag as xt}from"@vueuse/core";import{useHead as vt}from"@vueuse/head";import{onUnmounted as Ct,watch as U}from"vue";import{useI18n as wt}from"vue-i18n";import{useRoute as Tt}from"vue-router";function io(t={}){vt({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/@waline/client/dist/waline.css"}]});let e=Tt(),{locale:o}=wt(),n;function i(r={}){if(!yt)return;let a={el:".comment #waline",lang:o.value,dark:"html.dark",emoji:["https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/qq","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo"],path:e.path},s=Object.assign(a,r);return window.Waline.init(s)}return xt("//cdn.jsdelivr.net/npm/@waline/client/dist/waline.js",()=>{n=i(t)}),U(()=>e.path,r=>{!n||n.update({path:r})}),U(o,r=>{!n||n.update({lang:r})}),Ct(()=>{!n||n.destroy()}),n}function To(t){return t}function bo(t){return t}export{bt as EXTERNAL_URL_RE,To as defineAppSetup,Pt as defineConfig,At as defineConfigWithTheme,bo as defineUnoSetup,Ot as formatDate,Et as initConfig,Mt as initContext,tt as isDark,te as isParentCategory,Dt as random,C as sortByDate,kt as throttleAndDebounce,xe as toggleDark,Fe as useActiveSidebarLinks,Se as useAplayer,Me as useBackToTop,ee as useCategory,He as useCodePen,v as useConfig,L as useFrontmatter,pe as useFullUrl,ge as useInvisibleElement,Te as useLayout,Gt as usePageList,g as usePostList,Jt as usePostProperty,Ft as usePostTitle,Kt as usePrevNext,$e as useSidebar,F as useTag,ie as useTags,y as useThemeConfig,Xe as useTwikoo,io as useWaline,T as valaxyConfigRef,z as valaxyConfigSymbol,b as valaxyContextRef,I as wrap,Ht as wrapTable};
@@ -0,0 +1,16 @@
1
+ import * as type_fest_source_partial_deep from 'type-fest/source/partial-deep';
2
+ import { U as UserConfig, a as ValaxyConfig } from './index-afca77df.js';
3
+ import * as valaxy_theme_yun from 'valaxy-theme-yun';
4
+ import { YunTheme } from 'valaxy-theme-yun';
5
+
6
+ declare const EXTERNAL_URL_RE: RegExp;
7
+ /**
8
+ * Type config helper
9
+ */
10
+ declare function defineConfig(config: UserConfig<YunTheme.Config>): type_fest_source_partial_deep.PartialObjectDeep<ValaxyConfig<valaxy_theme_yun.ThemeConfig>>;
11
+ /**
12
+ * Type config helper for custom theme config
13
+ */
14
+ declare function defineConfigWithTheme<ThemeConfig>(config: UserConfig<ThemeConfig>): type_fest_source_partial_deep.PartialObjectDeep<ValaxyConfig<ThemeConfig>>;
15
+
16
+ export { EXTERNAL_URL_RE as E, defineConfigWithTheme as a, defineConfig as d };
@@ -1,10 +1,73 @@
1
- import { PartialDeep } from 'type-fest';
1
+ import { ViteSSGOptions } from 'vite-ssg';
2
+ import Vue from '@vitejs/plugin-vue';
3
+ import Components from 'unplugin-vue-components/vite';
2
4
  import { VitePluginConfig } from 'unocss/vite';
5
+ import { PartialDeep } from 'type-fest';
3
6
  import MarkdownIt from 'markdown-it';
4
7
  import { Theme } from 'shiki';
5
8
  import Anchor from 'markdown-it-anchor';
6
9
  import { KatexOptions } from 'katex';
7
10
 
11
+ interface ValaxyEntryOptions {
12
+ /**
13
+ * theme name
14
+ */
15
+ theme?: string;
16
+ userRoot?: string;
17
+ }
18
+ interface ValaxyPluginOptions {
19
+ vue?: Parameters<typeof Vue>[0];
20
+ components?: Parameters<typeof Components>[0];
21
+ unocss?: VitePluginConfig;
22
+ }
23
+ interface ResolvedValaxyOptions {
24
+ mode: 'dev' | 'build';
25
+ /**
26
+ * Client root path
27
+ * @default 'valaxy/src/client'
28
+ */
29
+ clientRoot: string;
30
+ /**
31
+ * User root path
32
+ * @default process.cwd()
33
+ */
34
+ userRoot: string;
35
+ /**
36
+ * Theme root path
37
+ */
38
+ themeRoot: string;
39
+ /**
40
+ * Theme name
41
+ */
42
+ roots: string[];
43
+ theme: string;
44
+ /**
45
+ * Valaxy Config
46
+ */
47
+ config: ValaxyConfig;
48
+ /**
49
+ * config file path
50
+ */
51
+ configFile: string;
52
+ pages: string[];
53
+ }
54
+ interface ValaxyServerOptions {
55
+ onConfigReload?: (newConfig: ValaxyConfig, config: ValaxyConfig) => void;
56
+ }
57
+
58
+ interface BlockItem {
59
+ text?: string;
60
+ icon?: string;
61
+ color?: string;
62
+ }
63
+ interface Blocks {
64
+ tip?: BlockItem;
65
+ warning?: BlockItem;
66
+ danger?: BlockItem;
67
+ info?: BlockItem;
68
+ details?: BlockItem;
69
+ }
70
+
8
71
  declare type ThemeOptions = Theme | {
9
72
  light: Theme;
10
73
  dark: Theme;
@@ -23,6 +86,10 @@ interface MarkdownOptions extends MarkdownIt.Options {
23
86
  * shiki
24
87
  */
25
88
  theme?: ThemeOptions;
89
+ /**
90
+ * Custom block configurations
91
+ */
92
+ blocks?: Blocks;
26
93
  }
27
94
 
28
95
  declare type ValaxyThemeConfig = Record<string, any>;
@@ -132,6 +199,7 @@ interface ValaxyConfig<T = ValaxyThemeConfig> {
132
199
  * comment: waline/...
133
200
  */
134
201
  comment: {
202
+ enable: boolean;
135
203
  waline: {
136
204
  enable: boolean;
137
205
  serverURL: string;
@@ -167,10 +235,6 @@ interface ValaxyConfig<T = ValaxyThemeConfig> {
167
235
  [key: string]: any;
168
236
  };
169
237
  };
170
- /**
171
- * Unocss Config
172
- */
173
- unocss: VitePluginConfig;
174
238
  /**
175
239
  * The license of your posts
176
240
  * @description 文章所使用的协议,默认使用 Creative Commons
@@ -222,4 +286,157 @@ interface ValaxyConfig<T = ValaxyThemeConfig> {
222
286
  */
223
287
  declare type UserConfig<ThemeConfig = ValaxyThemeConfig> = PartialDeep<ValaxyConfig<ThemeConfig>>;
224
288
 
225
- export { AlgoliaSearchOptions as A, SocialLink as S, UserConfig as U, ValaxyConfig as V, ValaxyThemeConfig as a };
289
+ interface Post extends Record<string, any> {
290
+ /**
291
+ * Path of post
292
+ * route.path
293
+ * @description 路径
294
+ */
295
+ path?: string;
296
+ /**
297
+ * Title
298
+ * @description 文章标题
299
+ */
300
+ title?: string;
301
+ date?: string | number | Date;
302
+ /**
303
+ * Updated Time
304
+ */
305
+ updated?: string | number | Date;
306
+ lang?: string;
307
+ /**
308
+ * TODO
309
+ * Read Time
310
+ * @description 阅读时长
311
+ */
312
+ duration?: string;
313
+ /**
314
+ * post card type, can be bilibili/yuque/...
315
+ */
316
+ type?: string;
317
+ /**
318
+ * override url, and jump directly
319
+ */
320
+ url?: string;
321
+ /**
322
+ * @description 摘要
323
+ */
324
+ excerpt?: string;
325
+ /**
326
+ * Display sponsor info
327
+ * @description 是否开启赞助
328
+ */
329
+ sponsor?: boolean;
330
+ /**
331
+ * Copyright
332
+ * @description 是否显示文章底部版权信息
333
+ */
334
+ copyright?: boolean;
335
+ /**
336
+ * Category
337
+ * @description 分类,若为数组,则按顺序代表多层文件夹
338
+ */
339
+ categories?: string | string[];
340
+ /**
341
+ * Tags
342
+ * @description 标签,可以有多个
343
+ */
344
+ tags?: string[];
345
+ /**
346
+ * display prev next
347
+ * @description 是否显示前一篇、后一篇导航
348
+ */
349
+ nav?: boolean;
350
+ /**
351
+ * icon before title
352
+ */
353
+ icon?: string;
354
+ /**
355
+ * title color
356
+ */
357
+ color?: string;
358
+ /**
359
+ * display comment
360
+ */
361
+ comment?: boolean;
362
+ /**
363
+ * post is end
364
+ * @description 是否完结,将在末尾添加衬线字体 Q.E.D.
365
+ */
366
+ end?: boolean;
367
+ /**
368
+ * use aplayer
369
+ */
370
+ aplayer?: boolean;
371
+ /**
372
+ * use katex
373
+ */
374
+ katex?: boolean;
375
+ /**
376
+ * use codepen
377
+ */
378
+ codepen?: boolean;
379
+ /**
380
+ * 置顶
381
+ */
382
+ top?: number;
383
+ /**
384
+ * display toc
385
+ * @description 是否显示目录
386
+ */
387
+ toc?: boolean;
388
+ /**
389
+ * is draft
390
+ * @description 是否为草稿
391
+ */
392
+ draft?: boolean;
393
+ /**
394
+ * cover
395
+ * @description 封面图片
396
+ */
397
+ cover?: string;
398
+ /**
399
+ * enable markdown-body class
400
+ * @description 是否启用默认的 markdown 样式
401
+ */
402
+ markdown?: boolean;
403
+ }
404
+
405
+ interface Header {
406
+ level: number;
407
+ title: string;
408
+ slug: string;
409
+ /**
410
+ * i18n
411
+ */
412
+ lang?: string;
413
+ }
414
+ interface PageData {
415
+ path: string;
416
+ relativePath: string;
417
+ title: string;
418
+ titleTemplate?: string;
419
+ description: string;
420
+ headers: Header[];
421
+ frontmatter: Post;
422
+ lastUpdated?: number;
423
+ }
424
+ interface PageDataPayload {
425
+ path: string;
426
+ pageData: PageData;
427
+ }
428
+ declare type HeadConfig = [string, Record<string, string>] | [string, Record<string, string>, string];
429
+
430
+ declare module 'vite' {
431
+ interface UserConfig {
432
+ /**
433
+ * Custom internal plugin options for Valaxy (advanced)
434
+ *
435
+ * @see './options.ts'
436
+ */
437
+ valaxy?: ValaxyPluginOptions;
438
+ ssgOptions?: ViteSSGOptions;
439
+ }
440
+ }
441
+
442
+ export { AlgoliaSearchOptions as A, Header as H, PageData as P, ResolvedValaxyOptions as R, SocialLink as S, UserConfig as U, ValaxyEntryOptions as V, ValaxyConfig as a, ValaxyThemeConfig as b, ValaxyServerOptions as c, Post as d, PageDataPayload as e, HeadConfig as f };