valaxy 0.3.10 → 0.5.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/README.md +4 -0
- package/{src/client → client}/App.vue +0 -0
- package/{src/client → client}/components/AppLink.vue +0 -0
- package/{src/client → client}/components/PostCard.vue +37 -23
- package/{src/client → client}/components/PostList.vue +0 -0
- package/{src/client → client}/components/README.md +0 -0
- package/{src/client → client}/components/ValaxyBg.vue +1 -1
- package/{src/client → client}/components/ValaxyCopyright.vue +0 -0
- package/{src/client → client}/components/ValaxyFooter.vue +2 -2
- package/{src/client → client}/components/ValaxyHamburger.vue +0 -0
- package/{src/client → client}/components/ValaxyMd.vue +1 -5
- package/{src/client → client}/components/ValaxyOverlay.vue +0 -0
- package/{src/client → client}/components/ValaxyPagination.vue +0 -0
- package/{src/client → client}/components/ValaxyRightSidebar.vue +0 -0
- package/{src/client → client}/components/ValaxySidebar.vue +0 -0
- package/{src/client → client}/components/ValaxyToc.vue +0 -0
- package/{src/client → client}/composables/category.ts +0 -0
- package/{src/client → client}/composables/comments/index.ts +0 -0
- package/{src/client → client}/composables/comments/twikoo.ts +0 -0
- package/{src/client → client}/composables/comments/waline.ts +0 -0
- package/{src/client → client}/composables/common.ts +0 -0
- package/{src/client → client}/composables/dark.ts +0 -0
- package/{src/client/composables/search → client/composables/features}/index.ts +0 -0
- package/{src/client → client}/composables/helper.ts +0 -0
- package/{src/client → client}/composables/index.ts +1 -1
- package/{src/client → client}/composables/layout.ts +0 -0
- package/{src/client → client}/composables/post.ts +0 -0
- package/client/composables/search/index.ts +0 -0
- package/{src/client → client}/composables/sidebar.ts +10 -8
- package/{src/client → client}/composables/tag.ts +0 -0
- package/{src/client → client}/composables/widgets/aplayer.ts +0 -0
- package/{src/client → client}/composables/widgets/backToTop.ts +0 -0
- package/{src/client → client}/composables/widgets/codepen.ts +0 -0
- package/{src/client → client}/composables/widgets/index.ts +0 -0
- package/{src/client → client}/config.ts +2 -1
- package/{src/client → client}/index.html +0 -0
- package/{src/client → client}/index.ts +0 -0
- package/{src/client → client}/layouts/404.vue +0 -0
- package/{src/client → client}/layouts/README.md +0 -0
- package/{src/client → client}/locales/README.md +0 -0
- package/{src/client → client}/locales/en.yml +1 -0
- package/{src/client → client}/locales/zh-CN.yml +4 -3
- package/{src/client → client}/main.ts +5 -1
- package/{src/client → client}/modules/README.md +0 -0
- package/{src/client → client}/modules/nprogress.ts +0 -0
- package/{src/client → client}/modules/pinia.ts +0 -0
- package/{src/client → client}/modules/valaxy.ts +1 -1
- package/{src/client → client}/pages/README.md +0 -0
- package/{src/client → client}/pages/[...all].vue +0 -0
- package/{src/client → client}/pages/hi/[name].vue +0 -0
- package/{src/client → client}/pages/index.vue +0 -0
- package/{src/client → client}/pages/page/[page].vue +0 -0
- package/{src/client → client}/shims.d.ts +1 -0
- package/{src/client → client}/stores/app.ts +0 -0
- package/{src/client → client}/stores/user.ts +0 -0
- package/{src/client → client}/styles/common/button.scss +0 -0
- package/{src/client → client}/styles/common/code.scss +0 -0
- package/{src/client → client}/styles/common/custom-blocks.scss +0 -0
- package/{src/client → client}/styles/common/hamburger.scss +0 -0
- package/{src/client → client}/styles/common/markdown.scss +5 -1
- package/client/styles/common/scrollbar.scss +28 -0
- package/{src/client → client}/styles/common/sidebar.scss +0 -0
- package/{src/client → client}/styles/common/transition.scss +0 -0
- package/{src/client → client}/styles/css-vars.scss +0 -0
- package/{src/client → client}/styles/global/helper.scss +0 -0
- package/{src/client → client}/styles/global/i18n.scss +0 -0
- package/{src/client → client}/styles/global/index.scss +0 -0
- package/{src/client → client}/styles/global/nprogress.scss +0 -0
- package/{src/client → client}/styles/global/reset.scss +0 -0
- package/{src/client → client}/styles/index.scss +0 -0
- package/{src/client → client}/styles/mixins/config.scss +0 -0
- package/{src/client → client}/styles/mixins/index.scss +0 -0
- package/{src/client → client}/styles/mixins/size.scss +0 -0
- package/{src/client → client}/styles/mixins/variable.scss +0 -0
- package/{src/client → client}/styles/palette.scss +0 -0
- package/client/styles/third/katex.scss +3 -0
- package/{src/client → client}/styles/vars.scss +0 -0
- package/{src/client → client}/styles/widgets/banner.scss +0 -0
- package/{src/client → client}/types.ts +0 -0
- package/{src/client → client}/utils/helper.ts +0 -0
- package/{src/client → client}/utils/index.ts +0 -0
- package/{src/client → client}/utils/time.ts +0 -0
- package/dist/chunk-EAN2KU6W.mjs +1 -0
- package/dist/chunk-RSQONJW3.mjs +86 -0
- package/dist/chunk-U5OMNIOK.js +1 -0
- package/dist/chunk-XQIGHIAX.js +86 -0
- package/dist/client/index.d.ts +188 -0
- package/dist/client/index.js +1 -0
- package/dist/client/index.mjs +1 -0
- package/dist/{config-de04677b.d.ts → config-7bd43d41.d.ts} +24 -12
- package/dist/node/cli.js +10 -10
- package/dist/node/cli.mjs +10 -10
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.js +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/posts-32f55e33.d.ts +117 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.mjs +0 -0
- package/index.d.ts +3 -0
- package/{src/node → node}/build.ts +0 -0
- package/{src/node → node}/cli.ts +3 -2
- package/node/config.ts +170 -0
- package/{src/node → node}/index.ts +0 -0
- package/{src/node → node}/markdown/check.ts +0 -0
- package/{src/node → node}/markdown/highlight.ts +0 -0
- package/{src/node → node}/markdown/index.ts +0 -0
- package/{src/node → node}/markdown/markdown-it/container.ts +0 -0
- package/{src/node → node}/markdown/markdown-it/headings.ts +0 -0
- package/{src/node → node}/markdown/markdown-it/highlightLines.ts +0 -0
- package/{src/node → node}/markdown/markdown-it/katex.ts +0 -0
- package/{src/node → node}/markdown/markdown-it/parseHeader.ts +0 -0
- package/{src/node → node}/markdown/slugify.ts +0 -0
- package/{src/node → node}/options.ts +2 -2
- package/{src/node → node}/plugins/extendConfig.ts +3 -1
- package/{src/node → node}/plugins/index.ts +10 -3
- package/{src/node → node}/plugins/markdown.ts +3 -6
- package/{src/node → node}/plugins/preset.ts +0 -30
- package/{src/node → node}/plugins/unocss.ts +0 -0
- package/{src/node → node}/plugins/valaxy.ts +0 -0
- package/{src/node → node}/rss.ts +0 -0
- package/{src/node → node}/server.ts +6 -4
- package/{src/node → node}/shims.d.ts +0 -0
- package/{src/node → node}/utils/cli.ts +1 -1
- package/node/utils/index.ts +48 -0
- package/node/utils/net.ts +20 -0
- package/{src/node → node}/vite.ts +5 -1
- package/package.json +21 -16
- package/tsup.config.ts +4 -3
- package/{src/types → types}/config.ts +27 -107
- package/{src/types → types}/index.ts +0 -0
- package/{src/types → types}/posts.ts +5 -0
- package/dist/chunk-6QPICP7C.mjs +0 -1
- package/dist/chunk-PICIUZML.js +0 -83
- package/dist/chunk-S2VGPR56.mjs +0 -83
- package/dist/chunk-ZP4HS4GX.js +0 -1
- package/dist/index.d.ts +0 -407
- package/dist/index.js +0 -1
- package/dist/index.mjs +0 -1
- package/src/client/composables/features/index.ts +0 -1
- package/src/client/composables/features/katex.ts +0 -15
- package/src/client/composables/search/algolia.ts +0 -115
- package/src/client/modules/pwa.ts +0 -12
- package/src/client/styles/common/scrollbar.scss +0 -34
- package/src/index.ts +0 -2
- package/src/node/config.ts +0 -52
- package/src/node/utils/index.ts +0 -26
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { InjectionKey, ComputedRef, Ref, StyleValue } from 'vue';
|
|
3
|
+
import { V as ValaxyConfig, a as ValaxyThemeConfig } from '../config-7bd43d41.js';
|
|
4
|
+
import { ThemeConfig } from 'valaxy-theme-yun';
|
|
5
|
+
import { P as Post } from '../posts-32f55e33.js';
|
|
6
|
+
import 'type-fest';
|
|
7
|
+
import 'unocss/vite';
|
|
8
|
+
import 'vite-plugin-md';
|
|
9
|
+
import 'markdown-it';
|
|
10
|
+
import 'markdown-it-anchor';
|
|
11
|
+
import 'katex';
|
|
12
|
+
|
|
13
|
+
declare const valaxyConfigSymbol: InjectionKey<ComputedRef<ValaxyConfig<ThemeConfig>>>;
|
|
14
|
+
declare const valaxyConfigRef: vue.ShallowRef<ValaxyConfig<ValaxyThemeConfig>>;
|
|
15
|
+
declare function initConfig(): ComputedRef<ValaxyConfig<ValaxyThemeConfig>>;
|
|
16
|
+
declare function useConfig(): ComputedRef<ValaxyConfig<ThemeConfig>>;
|
|
17
|
+
/**
|
|
18
|
+
* getThemeConfig
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
declare function useThemeConfig(): ComputedRef<ThemeConfig & {
|
|
22
|
+
pkg: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
name: string;
|
|
25
|
+
version: string;
|
|
26
|
+
homepage?: string | undefined;
|
|
27
|
+
};
|
|
28
|
+
}>;
|
|
29
|
+
|
|
30
|
+
interface BaseCategory {
|
|
31
|
+
total: number;
|
|
32
|
+
}
|
|
33
|
+
interface ParentCategory extends BaseCategory {
|
|
34
|
+
children: Categories;
|
|
35
|
+
}
|
|
36
|
+
interface PostCategory extends BaseCategory {
|
|
37
|
+
posts: Post[];
|
|
38
|
+
}
|
|
39
|
+
declare type Category = ParentCategory | PostCategory;
|
|
40
|
+
declare type Categories = Map<string, Category>;
|
|
41
|
+
declare const isParentCategory: (category: any) => category is ParentCategory;
|
|
42
|
+
/**
|
|
43
|
+
* get categories from posts
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
declare function useCategory(category?: string, posts?: Post[]): ParentCategory;
|
|
47
|
+
|
|
48
|
+
declare const usePostTitle: (post: Ref<Post>) => vue.ComputedRef<any>;
|
|
49
|
+
/**
|
|
50
|
+
* get post list
|
|
51
|
+
* todo: use vue provide/inject to global
|
|
52
|
+
* @param params
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
declare function usePostList(params?: {
|
|
56
|
+
type?: string;
|
|
57
|
+
}): vue.ComputedRef<Post[]>;
|
|
58
|
+
/**
|
|
59
|
+
* get all page
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
declare function usePageList(): vue.ComputedRef<any[]>;
|
|
63
|
+
/**
|
|
64
|
+
* get prev and next post
|
|
65
|
+
* @param path
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
declare function usePrevNext(path?: string): vue.ComputedRef<Post | null>[];
|
|
69
|
+
/**
|
|
70
|
+
* get type card property
|
|
71
|
+
* todo: test reactive
|
|
72
|
+
*/
|
|
73
|
+
declare function usePostProperty(type?: string): {
|
|
74
|
+
color: string;
|
|
75
|
+
icon: string;
|
|
76
|
+
styles: {};
|
|
77
|
+
} | {
|
|
78
|
+
color: string;
|
|
79
|
+
icon: string;
|
|
80
|
+
styles: vue.ComputedRef<StyleValue>;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
declare type Tags = Map<string, {
|
|
84
|
+
count: number;
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* get utils about tags
|
|
88
|
+
*/
|
|
89
|
+
declare function useTags(options?: {
|
|
90
|
+
/**
|
|
91
|
+
* Primary Color
|
|
92
|
+
*/
|
|
93
|
+
primary: string;
|
|
94
|
+
}): {
|
|
95
|
+
tags: Tags;
|
|
96
|
+
getTagStyle: (count: number) => {
|
|
97
|
+
'--yun-tag-color': string;
|
|
98
|
+
fontSize: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* get tag map
|
|
103
|
+
* @returns
|
|
104
|
+
*/
|
|
105
|
+
declare function useTag(): Tags;
|
|
106
|
+
|
|
107
|
+
declare function useFrontmatter(): vue.ComputedRef<Post>;
|
|
108
|
+
/**
|
|
109
|
+
* get full url
|
|
110
|
+
*/
|
|
111
|
+
declare function useFullUrl(): vue.ComputedRef<string>;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* trigger show invisible element
|
|
115
|
+
* @param target
|
|
116
|
+
* @returns
|
|
117
|
+
*/
|
|
118
|
+
declare function useInvisibleElement(target: Ref<HTMLElement>): {
|
|
119
|
+
show: () => void;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
declare const isDark: vue.WritableComputedRef<boolean>;
|
|
123
|
+
declare const toggleDark: (value?: boolean | undefined) => boolean;
|
|
124
|
+
|
|
125
|
+
declare function useLayout(layout: string): vue.ComputedRef<boolean>;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* use MetingJS and Aplayer
|
|
129
|
+
* https://github.com/MoePlayer/APlayer
|
|
130
|
+
* https://github.com/metowolf/MetingJS
|
|
131
|
+
*/
|
|
132
|
+
declare function useAplayer(): void;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* You can use href="#" to back to top
|
|
136
|
+
* @description 你可以使用它来编写自己的 backToTop
|
|
137
|
+
*/
|
|
138
|
+
declare function useBackToTop(options?: {
|
|
139
|
+
/**
|
|
140
|
+
* show backToTop button, when height > offset
|
|
141
|
+
*/
|
|
142
|
+
offset: number;
|
|
143
|
+
}): {
|
|
144
|
+
percentage: vue.Ref<number>;
|
|
145
|
+
show: vue.Ref<boolean>;
|
|
146
|
+
} | {
|
|
147
|
+
percentage: vue.ComputedRef<number>;
|
|
148
|
+
show: vue.ComputedRef<boolean>;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
declare function useCodePen(): void;
|
|
152
|
+
|
|
153
|
+
declare function useActiveSidebarLinks(container: Ref<HTMLElement>, marker: Ref<HTMLElement>): void;
|
|
154
|
+
|
|
155
|
+
declare function useTwikoo(options?: {}): void;
|
|
156
|
+
|
|
157
|
+
declare function useWaline(options?: {}): any;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* 生成介于 min 与 max 之间的随机数
|
|
161
|
+
* @returns
|
|
162
|
+
*/
|
|
163
|
+
declare function random(min: number, max: number): number;
|
|
164
|
+
/**
|
|
165
|
+
* wrap node
|
|
166
|
+
* @param className
|
|
167
|
+
*/
|
|
168
|
+
declare function wrap(el: HTMLElement, className: string): void;
|
|
169
|
+
/**
|
|
170
|
+
* 包裹表格,添加 class 以控制 table 样式
|
|
171
|
+
*/
|
|
172
|
+
declare const wrapTable: (container?: HTMLElement | Document) => void;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* use dayjs format date
|
|
176
|
+
* @param date
|
|
177
|
+
* @param template
|
|
178
|
+
* @returns
|
|
179
|
+
*/
|
|
180
|
+
declare function formatDate(date: string | number | Date, template?: string): string;
|
|
181
|
+
/**
|
|
182
|
+
* sort posts by date
|
|
183
|
+
* @param posts
|
|
184
|
+
* @param desc
|
|
185
|
+
*/
|
|
186
|
+
declare function sortByDate(posts: Post[], desc?: boolean): Post[];
|
|
187
|
+
|
|
188
|
+
export { BaseCategory, Categories, Category, ParentCategory, PostCategory, Tags, formatDate, initConfig, isDark, isParentCategory, random, sortByDate, toggleDark, useActiveSidebarLinks, useAplayer, useBackToTop, useCategory, useCodePen, useConfig, useFrontmatter, useFullUrl, useInvisibleElement, useLayout, usePageList, usePostList, usePostProperty, usePostTitle, usePrevNext, useTag, useTags, useThemeConfig, useTwikoo, useWaline, valaxyConfigRef, valaxyConfigSymbol, 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 _chunkU5OMNIOKjs = require('../chunk-U5OMNIOK.js');var _config = require('@valaxyjs/config'); var _config2 = _interopRequireDefault(_config);var _vue = require('vue');function C(t){let e=JSON.parse(t);return import.meta.env.DEV?_vue.readonly.call(void 0, e):e}var U=Symbol("valaxy:config"),T= exports.valaxyConfigRef =_vue.shallowRef.call(void 0, C(_config2.default));import.meta.hot&&import.meta.hot.accept("/@valaxyjs/config",t=>{T.value=C(t.default)});function xt(){return _vue.computed.call(void 0, ()=>T.value)}function h(){let t=_vue.inject.call(void 0, U);if(!t)throw new Error("[Valaxy] config not properly injected in qpp");return t}function P(){let t=h();return _vue.computed.call(void 0, ()=>t.value.themeConfig)}var _vuerouter = require('vue-router');var _vuei18n = require('vue-i18n');function Ct(t,e){return Math.random()*(e-t)+t}function q(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var Tt=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",q(e,"table-container")})};var _dayjs = require('dayjs'); var _dayjs2 = _interopRequireDefault(_dayjs);function jt(t,e="YYYY-MM-DD"){return _dayjs2.default.call(void 0, t).format(e)}function y(t,e=!0){return t.sort((o,n)=>{let s=+new Date(o.date||""),r=+new Date(n.date||"");return e?r-s:s-r})}var Ot=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=y(o.filter(r=>r.top)).sort((r,l)=>l.top-r.top),s=y(o.filter(r=>!r.top));return n.concat(s)})}function Vt(){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 Ut(t){let e=_vuerouter.useRoute.call(void 0, ),o=_vue.computed.call(void 0, ()=>t||e.path),n=g(),s=_vue.computed.call(void 0, ()=>{let i=-1;return n.value.find((a,c)=>a.path===o.value?(i=c,!0):!1),i}),r=_vue.computed.call(void 0, ()=>s.value-1>=0?n.value[s.value-1]:null),l=_vue.computed.call(void 0, ()=>s.value+1<n.value.length?n.value[s.value+1]:null);return[r,l]}function qt(t){if(!t)return{color:"",icon:"",styles:{}};let e=P();t in e.value.types||(t="link");let o=e.value.types[t].color,n=e.value.types[t].icon,s=_vue.computed.call(void 0, ()=>({"--card-c-primary":t&&o}));return{color:o,icon:n,styles:s}}var Nt=t=>t.children;function Wt(t,e=[]){var s;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 l=r.categories.length,i=o;r.categories.forEach((a,c)=>{var m,d,f;if(c===l-1)if(i.children.has(a)){let u=i.children.get(a);u.posts&&(u.total+=1,u.posts.push(r))}else(m=i.children)==null||m.set(a,{total:1,posts:[r]});else if((d=i.children)!=null&&d.has(a)){let u=i.children.get(a);u.total+=1,i=u}else{let u={total:1,children:new Map};(f=i.children)==null||f.set(a,u),i=u}})}else{let l=r.categories;if(o.children.has(l)){let i=o.children.get(l);i.total+=1,i.posts.push(r)}else o.children.set(l,{total:1,posts:[r]})}else n.total+=1,n.posts.push(r)}),n.total===0&&((s=o.children)==null||s.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 Kt(t={primary:"#0078E7"}){let e=W(),o=new (0, _tinycolor.TinyColor)("#999999"),n=new (0, _tinycolor.TinyColor)(t.primary);return{tags:e,getTagStyle:r=>{let l=Array.from(e).map(([d,f])=>f.count),i=Math.max(...l),a=Math.min(...l),c=i-a,m=(r-a)/c;return{"--yun-tag-color":o.mix(n,m*100).toString(),fontSize:`${m*36+12}px`}}}}function W(){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(s=>{if(e.has(s)){let r=e.get(s);e.set(s,_chunkU5OMNIOKjs.b.call(void 0, _chunkU5OMNIOKjs.a.call(void 0, {},r),{count:r.count+1}))}else e.set(s,{count:1})})}}),e}var _core = require('@vueuse/core');function Zt(){let t=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>t.meta.frontmatter)}function te(){let t=h(),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 ne(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:s}])=>{e.value=s}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}var G=_core.useDark.call(void 0, ),ae= exports.toggleDark =_core.useToggle.call(void 0, G);function me(t){let e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>e.meta.layout===t)}var _head = require('@vueuse/head');function ge(){_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 xe(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 Te(){_head.useHead.call(void 0, {script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}function Ae(t,e){let o=it(n,200);function n(){let i=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),a=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(c=>i.some(m=>m.hash===c.hash));for(let c=0;c<a.length;c++){let m=a[c],d=a[c+1],[f,u]=st(c,m,d);if(f){history.replaceState(null,document.title,u||" "),r(u);return}}}let s=null;function r(i){l(s);let a=s=i==null?null:t.value.querySelector(`.va-toc a[href="${i}"]`);e.value&&(a?(a.classList.add("active"),e.value.style.opacity="1",e.value.style.top=`${a.offsetTop+2}px`):(e.value.style.opacity="0",e.value.style.top="54px"))}function l(i){i&&i.classList.remove("active")}_vue.onMounted.call(void 0, ()=>{requestAnimationFrame(n),window.addEventListener("scroll",o)}),_vue.onUnmounted.call(void 0, ()=>{window.removeEventListener("scroll",o)})}function S(t){return t.parentElement.offsetTop-50}function st(t,e,o){let n=window.scrollY;return t===0&&n===0?[!0,null]:n<S(e)?[!1,null]:!o||n<S(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function it(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}function De(t={}){let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, );function n(s={}){if(!_core.isClient)return;let r={el:".comment #tcomment",lang:o.value,path:e.path},l=Object.assign(r,s);return window.twikoo.init(l)}_core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{n(t)})}function Ie(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 s(r={}){if(!_core.isClient)return;let l={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},i=Object.assign(l,r);return window.Waline.init(i)}return _core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/@waline/client/dist/waline.js",()=>{n=s(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}exports.formatDate = jt; exports.initConfig = xt; exports.isDark = G; exports.isParentCategory = Nt; exports.random = Ct; exports.sortByDate = y; exports.toggleDark = ae; exports.useActiveSidebarLinks = Ae; exports.useAplayer = ge; exports.useBackToTop = xe; exports.useCategory = Wt; exports.useCodePen = Te; exports.useConfig = h; exports.useFrontmatter = Zt; exports.useFullUrl = te; exports.useInvisibleElement = ne; exports.useLayout = me; exports.usePageList = Vt; exports.usePostList = g; exports.usePostProperty = qt; exports.usePostTitle = Ot; exports.usePrevNext = Ut; exports.useTag = W; exports.useTags = Kt; exports.useThemeConfig = P; exports.useTwikoo = De; exports.useWaline = Ie; exports.valaxyConfigRef = T; exports.valaxyConfigSymbol = U; exports.wrap = q; exports.wrapTable = Tt;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as v,b as x}from"../chunk-EAN2KU6W.mjs";import k from"@valaxyjs/config";import{computed as w,inject as D,readonly as O,shallowRef as V}from"vue";function C(t){let e=JSON.parse(t);return import.meta.env.DEV?O(e):e}var U=Symbol("valaxy:config"),T=V(C(k));import.meta.hot&&import.meta.hot.accept("/@valaxyjs/config",t=>{T.value=C(t.default)});function xt(){return w(()=>T.value)}function h(){let t=D(U);if(!t)throw new Error("[Valaxy] config not properly injected in qpp");return t}function P(){let t=h();return w(()=>t.value.themeConfig)}import{unref as N}from"vue";import{computed as p}from"vue";import{useRoute as z,useRouter as b}from"vue-router";import{useI18n as I}from"vue-i18n";function Ct(t,e){return Math.random()*(e-t)+t}function q(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var Tt=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",q(e,"table-container")})};import B from"dayjs";function jt(t,e="YYYY-MM-DD"){return B(t).format(e)}function y(t,e=!0){return t.sort((o,n)=>{let s=+new Date(o.date||""),r=+new Date(n.date||"");return e?r-s:s-r})}var Ot=t=>{let{locale:e}=I();return p(()=>{let o=e.value==="zh-CN"?"zh":e.value;return t.value[`title_${o}`]||t.value.title})};function g(t={}){let e=b();return p(()=>{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=y(o.filter(r=>r.top)).sort((r,l)=>l.top-r.top),s=y(o.filter(r=>!r.top));return n.concat(s)})}function Vt(){let t=b();return p(()=>t.getRoutes().map(o=>Object.assign({path:o.path,excerpt:o.meta.excerpt},o.meta.frontmatter)))}function Ut(t){let e=z(),o=p(()=>t||e.path),n=g(),s=p(()=>{let i=-1;return n.value.find((a,c)=>a.path===o.value?(i=c,!0):!1),i}),r=p(()=>s.value-1>=0?n.value[s.value-1]:null),l=p(()=>s.value+1<n.value.length?n.value[s.value+1]:null);return[r,l]}function qt(t){if(!t)return{color:"",icon:"",styles:{}};let e=P();t in e.value.types||(t="link");let o=e.value.types[t].color,n=e.value.types[t].icon,s=p(()=>({"--card-c-primary":t&&o}));return{color:o,icon:n,styles:s}}var Nt=t=>t.children;function Wt(t,e=[]){var s;e.length||(e=N(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 l=r.categories.length,i=o;r.categories.forEach((a,c)=>{var m,d,f;if(c===l-1)if(i.children.has(a)){let u=i.children.get(a);u.posts&&(u.total+=1,u.posts.push(r))}else(m=i.children)==null||m.set(a,{total:1,posts:[r]});else if((d=i.children)!=null&&d.has(a)){let u=i.children.get(a);u.total+=1,i=u}else{let u={total:1,children:new Map};(f=i.children)==null||f.set(a,u),i=u}})}else{let l=r.categories;if(o.children.has(l)){let i=o.children.get(l);i.total+=1,i.posts.push(r)}else o.children.set(l,{total:1,posts:[r]})}else n.total+=1,n.posts.push(r)}),n.total===0&&((s=o.children)==null||s.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 j}from"@ctrl/tinycolor";function Kt(t={primary:"#0078E7"}){let e=W(),o=new j("#999999"),n=new j(t.primary);return{tags:e,getTagStyle:r=>{let l=Array.from(e).map(([d,f])=>f.count),i=Math.max(...l),a=Math.min(...l),c=i-a,m=(r-a)/c;return{"--yun-tag-color":o.mix(n,m*100).toString(),fontSize:`${m*36+12}px`}}}}function W(){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(s=>{if(e.has(s)){let r=e.get(s);e.set(s,x(v({},r),{count:r.count+1}))}else e.set(s,{count:1})})}}),e}import{useRoute as L}from"vue-router";import{computed as E}from"vue";import{isClient as Y}from"@vueuse/core";function Zt(){let t=L();return E(()=>t.meta.frontmatter)}function te(){let t=h(),e=L();return E(()=>((t.value.url.endsWith("/")?t.value.url.slice(0,-1):t.value.url)||Y&&window.location.origin)+e.path)}import{useElementBounding as $,useIntersectionObserver as F}from"@vueuse/core";import{ref as K}from"vue";function ne(t){let e=K(!1),{top:o}=$(t);return F(t,([{isIntersecting:s}])=>{e.value=s}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}import{useDark as _,useToggle as J}from"@vueuse/core";var G=_(),ae=J(G);import{computed as Q}from"vue";import{useRoute as X}from"vue-router";function me(t){let e=X();return Q(()=>e.meta.layout===t)}import{useScriptTag as M}from"@vueuse/core";import{useHead as Z}from"@vueuse/head";function ge(){Z({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"}]}),M("https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js",()=>{M("https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js")})}import{isClient as tt,useWindowScroll as et}from"@vueuse/core";import{computed as A,ref as R}from"vue";function xe(t={offset:100}){if(!tt)return{percentage:R(0),show:R(!1)};let{y:e}=et(),o=A(()=>e.value/(document.body.scrollHeight-window.innerHeight)),n=A(()=>e.value>t.offset);return{percentage:o,show:n}}import{useHead as ot}from"@vueuse/head";function Te(){ot({script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}import{onMounted as rt,onUnmounted as nt}from"vue";function Ae(t,e){let o=it(n,200);function n(){let i=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),a=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(c=>i.some(m=>m.hash===c.hash));for(let c=0;c<a.length;c++){let m=a[c],d=a[c+1],[f,u]=st(c,m,d);if(f){history.replaceState(null,document.title,u||" "),r(u);return}}}let s=null;function r(i){l(s);let a=s=i==null?null:t.value.querySelector(`.va-toc a[href="${i}"]`);e.value&&(a?(a.classList.add("active"),e.value.style.opacity="1",e.value.style.top=`${a.offsetTop+2}px`):(e.value.style.opacity="0",e.value.style.top="54px"))}function l(i){i&&i.classList.remove("active")}rt(()=>{requestAnimationFrame(n),window.addEventListener("scroll",o)}),nt(()=>{window.removeEventListener("scroll",o)})}function S(t){return t.parentElement.offsetTop-50}function st(t,e,o){let n=window.scrollY;return t===0&&n===0?[!0,null]:n<S(e)?[!1,null]:!o||n<S(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function it(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 at,useScriptTag as lt}from"@vueuse/core";import{useI18n as ct}from"vue-i18n";import{useRoute as ut}from"vue-router";function De(t={}){let e=ut(),{locale:o}=ct();function n(s={}){if(!at)return;let r={el:".comment #tcomment",lang:o.value,path:e.path},l=Object.assign(r,s);return window.twikoo.init(l)}lt("//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{n(t)})}import{isClient as mt,useScriptTag as pt}from"@vueuse/core";import{useHead as ft}from"@vueuse/head";import{onUnmounted as dt,watch as H}from"vue";import{useI18n as gt}from"vue-i18n";import{useRoute as ht}from"vue-router";function Ie(t={}){ft({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/@waline/client/dist/waline.css"}]});let e=ht(),{locale:o}=gt(),n;function s(r={}){if(!mt)return;let l={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},i=Object.assign(l,r);return window.Waline.init(i)}return pt("//cdn.jsdelivr.net/npm/@waline/client/dist/waline.js",()=>{n=s(t)}),H(()=>e.path,r=>{!n||n.update({path:r})}),H(o,r=>{!n||n.update({lang:r})}),dt(()=>{!n||n.destroy()}),n}export{jt as formatDate,xt as initConfig,G as isDark,Nt as isParentCategory,Ct as random,y as sortByDate,ae as toggleDark,Ae as useActiveSidebarLinks,ge as useAplayer,xe as useBackToTop,Wt as useCategory,Te as useCodePen,h as useConfig,Zt as useFrontmatter,te as useFullUrl,ne as useInvisibleElement,me as useLayout,Vt as usePageList,g as usePostList,qt as usePostProperty,Ot as usePostTitle,Ut as usePrevNext,W as useTag,Kt as useTags,P as useThemeConfig,De as useTwikoo,Ie as useWaline,T as valaxyConfigRef,U as valaxyConfigSymbol,q as wrap,Tt as wrapTable};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PartialDeep } from 'type-fest';
|
|
2
2
|
import { VitePluginConfig } from 'unocss/vite';
|
|
3
|
+
import Markdown from 'vite-plugin-md';
|
|
3
4
|
import MarkdownIt from 'markdown-it';
|
|
4
5
|
import Anchor from 'markdown-it-anchor';
|
|
5
6
|
import { KatexOptions } from 'katex';
|
|
6
|
-
import Markdown from 'vite-plugin-md';
|
|
7
7
|
|
|
8
8
|
interface MarkdownOptions extends MarkdownIt.Options {
|
|
9
9
|
config?: (md: MarkdownIt) => void;
|
|
@@ -18,7 +18,6 @@ interface MarkdownOptions extends MarkdownIt.Options {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
declare type ViteMdOptions = Parameters<typeof Markdown>[0];
|
|
21
|
-
|
|
22
21
|
declare type ValaxyThemeConfig = Record<string, any>;
|
|
23
22
|
interface SocialLink {
|
|
24
23
|
/**
|
|
@@ -33,6 +32,16 @@ interface SocialLink {
|
|
|
33
32
|
icon: string;
|
|
34
33
|
color: string;
|
|
35
34
|
}
|
|
35
|
+
interface AlgoliaSearchOptions {
|
|
36
|
+
enable: boolean;
|
|
37
|
+
appId: string;
|
|
38
|
+
apiKey: string;
|
|
39
|
+
indexName: string;
|
|
40
|
+
placeholder?: string;
|
|
41
|
+
searchParameters?: any;
|
|
42
|
+
disableUserPersonalization?: boolean;
|
|
43
|
+
initialQuery?: string;
|
|
44
|
+
}
|
|
36
45
|
interface ValaxyConfig<T = ValaxyThemeConfig> {
|
|
37
46
|
/**
|
|
38
47
|
* Default language
|
|
@@ -104,13 +113,8 @@ interface ValaxyConfig<T = ValaxyThemeConfig> {
|
|
|
104
113
|
* search
|
|
105
114
|
*/
|
|
106
115
|
search: {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
appId: string;
|
|
110
|
-
apiKey: string;
|
|
111
|
-
indexName: string;
|
|
112
|
-
chunkSize: number;
|
|
113
|
-
};
|
|
116
|
+
enable: boolean;
|
|
117
|
+
algolia: AlgoliaSearchOptions;
|
|
114
118
|
};
|
|
115
119
|
/**
|
|
116
120
|
* comment: waline/...
|
|
@@ -125,6 +129,15 @@ interface ValaxyConfig<T = ValaxyThemeConfig> {
|
|
|
125
129
|
envId: string;
|
|
126
130
|
};
|
|
127
131
|
};
|
|
132
|
+
/**
|
|
133
|
+
* Markdown Feature
|
|
134
|
+
*/
|
|
135
|
+
features: {
|
|
136
|
+
/**
|
|
137
|
+
* enable katex for global
|
|
138
|
+
*/
|
|
139
|
+
katex: boolean;
|
|
140
|
+
};
|
|
128
141
|
/**
|
|
129
142
|
* The name of theme
|
|
130
143
|
* @description 主题名称
|
|
@@ -196,7 +209,6 @@ interface ValaxyConfig<T = ValaxyThemeConfig> {
|
|
|
196
209
|
* Valaxy User Config
|
|
197
210
|
* @description Valaxy 用户配置
|
|
198
211
|
*/
|
|
199
|
-
declare type UserConfig<
|
|
200
|
-
declare const defaultValaxyConfig: ValaxyConfig;
|
|
212
|
+
declare type UserConfig<ThemeConfig = ValaxyThemeConfig> = PartialDeep<ValaxyConfig<ThemeConfig>>;
|
|
201
213
|
|
|
202
|
-
export { SocialLink as S, UserConfig as U, ValaxyConfig as V, ValaxyThemeConfig as a,
|
|
214
|
+
export { AlgoliaSearchOptions as A, SocialLink as S, UserConfig as U, ValaxyConfig as V, ValaxyThemeConfig as a, ViteMdOptions as b };
|