valaxy 0.7.4 → 0.7.7
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/client/App.vue +0 -6
- package/client/composables/index.ts +1 -0
- package/client/composables/locale.ts +24 -0
- package/client/config.ts +2 -2
- package/client/index.ts +2 -3
- package/client/main.ts +0 -3
- package/client/setup/main.ts +7 -1
- package/client/shims.d.ts +2 -2
- package/dist/{chunk-QJZSJAAI.js → chunk-BTP4CLJN.js} +218 -218
- package/dist/{chunk-OFRGQSXQ.mjs → chunk-HP2UOVSL.mjs} +219 -219
- package/dist/{index-df0324e3.d.ts → index-df14d281.d.ts} +7 -2
- package/dist/node/cli.js +7 -7
- package/dist/node/cli.mjs +3 -3
- package/dist/node/index.d.ts +12 -5
- package/dist/node/index.js +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/types/index.d.ts +1 -1
- package/index.d.ts +5 -1
- package/package.json +4 -5
- package/dist/chunk-CGQACM7C.mjs +0 -1
- package/dist/chunk-YRJYFU6Y.js +0 -1
- package/dist/client/index.d.ts +0 -183
- package/dist/client/index.js +0 -1
- package/dist/client/index.mjs +0 -1
- package/dist/index-8b96b699.d.ts +0 -14
- package/shared/index.ts +0 -21
package/dist/client/index.d.ts
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import * as vue from 'vue';
|
|
2
|
-
import { InjectionKey, ComputedRef, Ref } from 'vue';
|
|
3
|
-
import { a as ValaxyConfig, b as ValaxyThemeConfig, P as PageData, f as Post } from '../index-df0324e3.js';
|
|
4
|
-
import { ViteSSGContext } from 'vite-ssg';
|
|
5
|
-
import { Awaitable } from '@antfu/utils';
|
|
6
|
-
import { VitePluginConfig } from 'unocss/vite';
|
|
7
|
-
export { E as EXTERNAL_URL_RE, d as defineConfig, a as defineConfigWithTheme } from '../index-8b96b699.js';
|
|
8
|
-
import '@vitejs/plugin-vue';
|
|
9
|
-
import 'unplugin-vue-components/vite';
|
|
10
|
-
import 'type-fest';
|
|
11
|
-
import 'markdown-it';
|
|
12
|
-
import 'shiki';
|
|
13
|
-
import 'markdown-it-anchor';
|
|
14
|
-
import 'katex';
|
|
15
|
-
import 'type-fest/source/partial-deep';
|
|
16
|
-
|
|
17
|
-
interface ValaxyContext {
|
|
18
|
-
userRoot: string;
|
|
19
|
-
}
|
|
20
|
-
declare const valaxyConfigSymbol: InjectionKey<ComputedRef<ValaxyConfig>>;
|
|
21
|
-
declare const valaxyConfigRef: vue.ShallowRef<ValaxyConfig<ValaxyThemeConfig>>;
|
|
22
|
-
declare const valaxyContextRef: vue.ShallowRef<ValaxyContext>;
|
|
23
|
-
declare function initConfig(): ComputedRef<ValaxyConfig<ValaxyThemeConfig>>;
|
|
24
|
-
declare function initContext(): ComputedRef<ValaxyContext>;
|
|
25
|
-
declare function useConfig<ThemeConfig = any>(): ComputedRef<ValaxyConfig<ThemeConfig>>;
|
|
26
|
-
interface ValaxyData<T = any> {
|
|
27
|
-
page: Ref<PageData>;
|
|
28
|
-
theme: Ref<T>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface BaseCategory {
|
|
32
|
-
total: number;
|
|
33
|
-
}
|
|
34
|
-
interface ParentCategory extends BaseCategory {
|
|
35
|
-
children: Categories;
|
|
36
|
-
}
|
|
37
|
-
interface PostCategory extends BaseCategory {
|
|
38
|
-
posts: Post[];
|
|
39
|
-
}
|
|
40
|
-
declare type Category = ParentCategory | PostCategory;
|
|
41
|
-
declare type Categories = Map<string, Category>;
|
|
42
|
-
declare const isParentCategory: (category: any) => category is ParentCategory;
|
|
43
|
-
/**
|
|
44
|
-
* get categories from posts
|
|
45
|
-
* @returns
|
|
46
|
-
*/
|
|
47
|
-
declare function useCategory(category?: string, posts?: Post[]): ParentCategory;
|
|
48
|
-
|
|
49
|
-
declare const usePostTitle: (post: Ref<Post>) => vue.ComputedRef<any>;
|
|
50
|
-
/**
|
|
51
|
-
* get post list
|
|
52
|
-
* todo: use vue provide/inject to global
|
|
53
|
-
* @param params
|
|
54
|
-
* @returns
|
|
55
|
-
*/
|
|
56
|
-
declare function usePostList(params?: {
|
|
57
|
-
type?: string;
|
|
58
|
-
}): vue.ComputedRef<Post[]>;
|
|
59
|
-
/**
|
|
60
|
-
* get all page
|
|
61
|
-
* @returns
|
|
62
|
-
*/
|
|
63
|
-
declare function usePageList(): vue.ComputedRef<any[]>;
|
|
64
|
-
/**
|
|
65
|
-
* get prev and next post
|
|
66
|
-
* @param path
|
|
67
|
-
* @returns
|
|
68
|
-
*/
|
|
69
|
-
declare function usePrevNext(path?: string): vue.ComputedRef<Post | null>[];
|
|
70
|
-
|
|
71
|
-
declare type Tags = Map<string, {
|
|
72
|
-
count: number;
|
|
73
|
-
}>;
|
|
74
|
-
/**
|
|
75
|
-
* get utils about tags
|
|
76
|
-
*/
|
|
77
|
-
declare function useTags(options?: {
|
|
78
|
-
/**
|
|
79
|
-
* Primary Color
|
|
80
|
-
*/
|
|
81
|
-
primary: string;
|
|
82
|
-
}): {
|
|
83
|
-
tags: Tags;
|
|
84
|
-
getTagStyle: (count: number) => {
|
|
85
|
-
'--yun-tag-color': string;
|
|
86
|
-
fontSize: string;
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* get tag map
|
|
91
|
-
* @returns
|
|
92
|
-
*/
|
|
93
|
-
declare function useTag(): Tags;
|
|
94
|
-
|
|
95
|
-
declare function useFrontmatter(): vue.ComputedRef<Post>;
|
|
96
|
-
/**
|
|
97
|
-
* get full url
|
|
98
|
-
*/
|
|
99
|
-
declare function useFullUrl(): vue.ComputedRef<string>;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* trigger show invisible element
|
|
103
|
-
* @param target
|
|
104
|
-
* @returns
|
|
105
|
-
*/
|
|
106
|
-
declare function useInvisibleElement(target: Ref<HTMLElement>): {
|
|
107
|
-
show: () => void;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
declare const isDark: vue.WritableComputedRef<boolean>;
|
|
111
|
-
declare const toggleDark: (value?: boolean | undefined) => boolean;
|
|
112
|
-
|
|
113
|
-
declare function useLayout(layout: string): vue.ComputedRef<boolean>;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* use MetingJS and Aplayer
|
|
117
|
-
* https://github.com/MoePlayer/APlayer
|
|
118
|
-
* https://github.com/metowolf/MetingJS
|
|
119
|
-
*/
|
|
120
|
-
declare function useAplayer(): void;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* You can use href="#" to back to top
|
|
124
|
-
* @description 你可以使用它来编写自己的 backToTop
|
|
125
|
-
*/
|
|
126
|
-
declare function useBackToTop(options?: {
|
|
127
|
-
/**
|
|
128
|
-
* show backToTop button, when height > offset
|
|
129
|
-
*/
|
|
130
|
-
offset: number;
|
|
131
|
-
}): {
|
|
132
|
-
percentage: vue.Ref<number>;
|
|
133
|
-
show: vue.Ref<boolean>;
|
|
134
|
-
} | {
|
|
135
|
-
percentage: vue.ComputedRef<number>;
|
|
136
|
-
show: vue.ComputedRef<boolean>;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
declare function useCodePen(): void;
|
|
140
|
-
|
|
141
|
-
declare function useActiveSidebarLinks(container: Ref<HTMLElement>, marker: Ref<HTMLElement>): void;
|
|
142
|
-
|
|
143
|
-
declare function useTwikoo(options?: {}): void;
|
|
144
|
-
|
|
145
|
-
declare function useWaline(options?: {}): any;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* 生成介于 min 与 max 之间的随机数
|
|
149
|
-
* @returns
|
|
150
|
-
*/
|
|
151
|
-
declare function random(min: number, max: number): number;
|
|
152
|
-
/**
|
|
153
|
-
* wrap node
|
|
154
|
-
* @param className
|
|
155
|
-
*/
|
|
156
|
-
declare function wrap(el: HTMLElement, className: string): void;
|
|
157
|
-
/**
|
|
158
|
-
* 包裹表格,添加 class 以控制 table 样式
|
|
159
|
-
*/
|
|
160
|
-
declare const wrapTable: (container?: HTMLElement | Document) => void;
|
|
161
|
-
declare function throttleAndDebounce(fn: () => void, delay: number): () => void;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* use dayjs format date
|
|
165
|
-
* @param date
|
|
166
|
-
* @param template
|
|
167
|
-
* @returns
|
|
168
|
-
*/
|
|
169
|
-
declare function formatDate(date: string | number | Date, template?: string): string;
|
|
170
|
-
/**
|
|
171
|
-
* sort posts by date
|
|
172
|
-
* @param posts
|
|
173
|
-
* @param desc
|
|
174
|
-
*/
|
|
175
|
-
declare function sortByDate(posts: Post[], desc?: boolean): Post[];
|
|
176
|
-
|
|
177
|
-
declare type AppContext = ViteSSGContext;
|
|
178
|
-
declare type AppSetup = (ctx: AppContext) => Awaitable<void>;
|
|
179
|
-
declare type UnoSetup = () => Awaitable<Partial<VitePluginConfig> | undefined>;
|
|
180
|
-
declare function defineAppSetup(fn: AppSetup): AppSetup;
|
|
181
|
-
declare function defineUnoSetup(fn: UnoSetup): UnoSetup;
|
|
182
|
-
|
|
183
|
-
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, usePostTitle, usePrevNext, useTag, useTags, useTwikoo, useWaline, valaxyConfigRef, valaxyConfigSymbol, valaxyContextRef, wrap, wrapTable };
|
package/dist/client/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkYRJYFU6Yjs = require('../chunk-YRJYFU6Y.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 U=Symbol("valaxy:config"),C= exports.valaxyConfigRef =_vue.shallowRef.call(void 0, h(_config2.default)),w= exports.valaxyContextRef =_vue.shallowRef.call(void 0, h(_context2.default));import.meta.hot&&(import.meta.hot.accept("/@valaxyjs/config",t=>{C.value=h(t.default)}),import.meta.hot.accept("/@valaxyjs/context",t=>{w.value=h(t.default)}));function Tt(){return _vue.computed.call(void 0, ()=>C.value)}function bt(){return _vue.computed.call(void 0, ()=>w.value)}function T(){let t=_vue.inject.call(void 0, U);if(!t)throw new Error("[Valaxy] config not properly injected in app");return t}var _vuerouter = require('vue-router');var _vuei18n = require('vue-i18n');function At(t,e){return Math.random()*(e-t)+t}function O(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var jt=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",O(e,"table-container")})};function Lt(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 St(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 i=+new Date(o.date||""),r=+new Date(n.date||"");return e?r-i:i-r})}var qt=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),i=y(o.filter(r=>!r.top));return n.concat(i)})}function zt(){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 It(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((a,u)=>a.path===o.value?(s=u,!0):!1),s}),r=_vue.computed.call(void 0, ()=>i.value-1>=0?n.value[i.value-1]:null),l=_vue.computed.call(void 0, ()=>i.value+1<n.value.length?n.value[i.value+1]:null);return[r,l]}var Yt=t=>t.children;function $t(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 l=r.categories.length,s=o;r.categories.forEach((a,u)=>{var p,d,f;if(u===l-1)if(s.children.has(a)){let c=s.children.get(a);c.posts&&(c.total+=1,c.posts.push(r))}else(p=s.children)==null||p.set(a,{total:1,posts:[r]});else if((d=s.children)!=null&&d.has(a)){let c=s.children.get(a);c.total+=1,s=c}else{let c={total:1,children:new Map};(f=s.children)==null||f.set(a,c),s=c}})}else{let l=r.categories;if(o.children.has(l)){let s=o.children.get(l);s.total+=1,s.posts.push(r)}else o.children.set(l,{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 Jt(t={primary:"#0078E7"}){let e=N(),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),s=Math.max(...l),a=Math.min(...l),u=s-a,p=(r-a)/u;return{"--yun-tag-color":o.mix(n,p*100).toString(),fontSize:`${p*36+12}px`}}}}function N(){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 oe(){let t=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>t.meta.frontmatter)}function re(){let t=T(),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 ae(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 K=_core.useDark.call(void 0, ),ce= exports.toggleDark =_core.useToggle.call(void 0, K);function de(t){let e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>e.meta.layout===t)}var _head = require('@vueuse/head');function xe(){_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 Te(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 Ae(){_head.useHead.call(void 0, {script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}function De(t,e){let o=it(n,200);function n(){let s=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),a=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(u=>s.some(p=>p.hash===u.hash));for(let u=0;u<a.length;u++){let p=a[u],d=a[u+1],[f,c]=nt(u,p,d);if(f){history.replaceState(null,document.title,c||" "),r(c);return}}}let i=null;function r(s){l(i);let a=i=s==null?null:t.value.querySelector(`.va-toc a[href="${s}"]`);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(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 S(t){return t.parentElement.offsetTop-50}function nt(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 Oe(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},l=Object.assign(r,i);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 _e(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 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},s=Object.assign(l,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 so(t){return t}function ao(t){return t}exports.EXTERNAL_URL_RE = _chunkYRJYFU6Yjs.d; exports.defineAppSetup = so; exports.defineConfig = _chunkYRJYFU6Yjs.e; exports.defineConfigWithTheme = _chunkYRJYFU6Yjs.f; exports.defineUnoSetup = ao; exports.formatDate = St; exports.initConfig = Tt; exports.initContext = bt; exports.isDark = K; exports.isParentCategory = Yt; exports.random = At; exports.sortByDate = y; exports.throttleAndDebounce = Lt; exports.toggleDark = ce; exports.useActiveSidebarLinks = De; exports.useAplayer = xe; exports.useBackToTop = Te; exports.useCategory = $t; exports.useCodePen = Ae; exports.useConfig = T; exports.useFrontmatter = oe; exports.useFullUrl = re; exports.useInvisibleElement = ae; exports.useLayout = de; exports.usePageList = zt; exports.usePostList = g; exports.usePostTitle = qt; exports.usePrevNext = It; exports.useTag = N; exports.useTags = Jt; exports.useTwikoo = Oe; exports.useWaline = _e; exports.valaxyConfigRef = C; exports.valaxyConfigSymbol = U; exports.valaxyContextRef = w; exports.wrap = O; exports.wrapTable = jt;
|
package/dist/client/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as ht,e as yt,f as xt}from"../chunk-CGQACM7C.mjs";import D from"@valaxyjs/config";import H from"@valaxyjs/context";import{computed as x,inject as k,readonly as V,shallowRef as v}from"vue";function h(t){let e=JSON.parse(t);return __DEV__?V(e):e}var U=Symbol("valaxy:config"),C=v(h(D)),w=v(h(H));import.meta.hot&&(import.meta.hot.accept("/@valaxyjs/config",t=>{C.value=h(t.default)}),import.meta.hot.accept("/@valaxyjs/context",t=>{w.value=h(t.default)}));function Tt(){return x(()=>C.value)}function bt(){return x(()=>w.value)}function T(){let t=k(U);if(!t)throw new Error("[Valaxy] config not properly injected in app");return t}import{unref as I}from"vue";import{computed as m}from"vue";import{useRoute as q,useRouter as b}from"vue-router";import{useI18n as z}from"vue-i18n";function At(t,e){return Math.random()*(e-t)+t}function O(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var jt=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",O(e,"table-container")})};function Lt(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}import B from"dayjs";function St(t,e="YYYY-MM-DD"){return B(t).format(e)}function y(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 qt=t=>{let{locale:e}=z();return m(()=>{let o=e.value==="zh-CN"?"zh":e.value;return t.value[`title_${o}`]||t.value.title})};function g(t={}){let e=b();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=y(o.filter(r=>r.top)).sort((r,l)=>l.top-r.top),i=y(o.filter(r=>!r.top));return n.concat(i)})}function zt(){let t=b();return m(()=>t.getRoutes().map(o=>Object.assign({path:o.path,excerpt:o.meta.excerpt},o.meta.frontmatter)))}function It(t){let e=q(),o=m(()=>t||e.path),n=g(),i=m(()=>{let s=-1;return n.value.find((a,u)=>a.path===o.value?(s=u,!0):!1),s}),r=m(()=>i.value-1>=0?n.value[i.value-1]:null),l=m(()=>i.value+1<n.value.length?n.value[i.value+1]:null);return[r,l]}var Yt=t=>t.children;function $t(t,e=[]){var i;e.length||(e=I(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,s=o;r.categories.forEach((a,u)=>{var p,d,f;if(u===l-1)if(s.children.has(a)){let c=s.children.get(a);c.posts&&(c.total+=1,c.posts.push(r))}else(p=s.children)==null||p.set(a,{total:1,posts:[r]});else if((d=s.children)!=null&&d.has(a)){let c=s.children.get(a);c.total+=1,s=c}else{let c={total:1,children:new Map};(f=s.children)==null||f.set(a,c),s=c}})}else{let l=r.categories;if(o.children.has(l)){let s=o.children.get(l);s.total+=1,s.posts.push(r)}else o.children.set(l,{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 P}from"@ctrl/tinycolor";function Jt(t={primary:"#0078E7"}){let e=N(),o=new P("#999999"),n=new P(t.primary);return{tags:e,getTagStyle:r=>{let l=Array.from(e).map(([d,f])=>f.count),s=Math.max(...l),a=Math.min(...l),u=s-a,p=(r-a)/u;return{"--yun-tag-color":o.mix(n,p*100).toString(),fontSize:`${p*36+12}px`}}}}function N(){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 A}from"vue-router";import{computed as j}from"vue";import{isClient as W}from"@vueuse/core";function oe(){let t=A();return j(()=>t.meta.frontmatter)}function re(){let t=T(),e=A();return j(()=>((t.value.url.endsWith("/")?t.value.url.slice(0,-1):t.value.url)||W&&window.location.origin)+e.path)}import{useElementBounding as _,useIntersectionObserver as Y}from"@vueuse/core";import{ref as $}from"vue";function ae(t){let e=$(!1),{top:o}=_(t);return Y(t,([{isIntersecting:i}])=>{e.value=i}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}import{useDark as F,useToggle as G}from"@vueuse/core";var K=F(),ce=G(K);import{computed as J}from"vue";import{useRoute as Q}from"vue-router";function de(t){let e=Q();return J(()=>e.meta.layout===t)}import{useScriptTag as L}from"@vueuse/core";import{useHead as X}from"@vueuse/head";function xe(){X({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"}]}),L("https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js",()=>{L("https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js")})}import{isClient as Z,useWindowScroll as tt}from"@vueuse/core";import{computed as E,ref as M}from"vue";function Te(t={offset:100}){if(!Z)return{percentage:M(0),show:M(!1)};let{y:e}=tt(),o=E(()=>e.value/(document.body.scrollHeight-window.innerHeight)),n=E(()=>e.value>t.offset);return{percentage:o,show:n}}import{useHead as et}from"@vueuse/head";function Ae(){et({script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}import{onMounted as ot,onUnmounted as rt}from"vue";function De(t,e){let o=it(n,200);function n(){let s=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),a=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(u=>s.some(p=>p.hash===u.hash));for(let u=0;u<a.length;u++){let p=a[u],d=a[u+1],[f,c]=nt(u,p,d);if(f){history.replaceState(null,document.title,c||" "),r(c);return}}}let i=null;function r(s){l(i);let a=i=s==null?null:t.value.querySelector(`.va-toc a[href="${s}"]`);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(s){s&&s.classList.remove("active")}ot(()=>{requestAnimationFrame(n),window.addEventListener("scroll",o)}),rt(()=>{window.removeEventListener("scroll",o)})}function S(t){return t.parentElement.offsetTop-50}function nt(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 st,useScriptTag as at}from"@vueuse/core";import{useI18n as lt}from"vue-i18n";import{useRoute as ut}from"vue-router";function Oe(t={}){let e=ut(),{locale:o}=lt();function n(i={}){if(!st)return;let r={el:".comment #tcomment",lang:o.value,path:e.path},l=Object.assign(r,i);return window.twikoo.init(l)}at("//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{n(t)})}import{isClient as ct,useScriptTag as pt}from"@vueuse/core";import{useHead as mt}from"@vueuse/head";import{onUnmounted as ft,watch as R}from"vue";import{useI18n as dt}from"vue-i18n";import{useRoute as gt}from"vue-router";function _e(t={}){mt({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/@waline/client/dist/waline.css"}]});let e=gt(),{locale:o}=dt(),n;function i(r={}){if(!ct)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},s=Object.assign(l,r);return window.Waline.init(s)}return pt("//cdn.jsdelivr.net/npm/@waline/client/dist/waline.js",()=>{n=i(t)}),R(()=>e.path,r=>{!n||n.update({path:r})}),R(o,r=>{!n||n.update({lang:r})}),ft(()=>{!n||n.destroy()}),n}function so(t){return t}function ao(t){return t}export{ht as EXTERNAL_URL_RE,so as defineAppSetup,yt as defineConfig,xt as defineConfigWithTheme,ao as defineUnoSetup,St as formatDate,Tt as initConfig,bt as initContext,K as isDark,Yt as isParentCategory,At as random,y as sortByDate,Lt as throttleAndDebounce,ce as toggleDark,De as useActiveSidebarLinks,xe as useAplayer,Te as useBackToTop,$t as useCategory,Ae as useCodePen,T as useConfig,oe as useFrontmatter,re as useFullUrl,ae as useInvisibleElement,de as useLayout,zt as usePageList,g as usePostList,qt as usePostTitle,It as usePrevNext,N as useTag,Jt as useTags,Oe as useTwikoo,_e as useWaline,C as valaxyConfigRef,U as valaxyConfigSymbol,w as valaxyContextRef,O as wrap,jt as wrapTable};
|
package/dist/index-8b96b699.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as type_fest_source_partial_deep from 'type-fest/source/partial-deep';
|
|
2
|
-
import { U as UserConfig, a as ValaxyConfig } from './index-df0324e3.js';
|
|
3
|
-
|
|
4
|
-
declare const EXTERNAL_URL_RE: RegExp;
|
|
5
|
-
/**
|
|
6
|
-
* Type config helper
|
|
7
|
-
*/
|
|
8
|
-
declare function defineConfig<ThemeConfig>(config: UserConfig<ThemeConfig>): type_fest_source_partial_deep.PartialObjectDeep<ValaxyConfig<ThemeConfig>>;
|
|
9
|
-
/**
|
|
10
|
-
* Type config helper for custom theme config
|
|
11
|
-
*/
|
|
12
|
-
declare function defineConfigWithTheme<ThemeConfig>(config: UserConfig<ThemeConfig>): type_fest_source_partial_deep.PartialObjectDeep<ValaxyConfig<ThemeConfig>>;
|
|
13
|
-
|
|
14
|
-
export { EXTERNAL_URL_RE as E, defineConfigWithTheme as a, defineConfig as d };
|
package/shared/index.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { UserConfig } from '../types'
|
|
2
|
-
|
|
3
|
-
export const EXTERNAL_URL_RE = /^https?:/i
|
|
4
|
-
|
|
5
|
-
// type ThemeConfig = Record<string, any>
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Type config helper
|
|
9
|
-
*/
|
|
10
|
-
export function defineConfig<ThemeConfig>(config: UserConfig<ThemeConfig>) {
|
|
11
|
-
return config
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Type config helper for custom theme config
|
|
16
|
-
*/
|
|
17
|
-
export function defineConfigWithTheme<ThemeConfig>(
|
|
18
|
-
config: UserConfig<ThemeConfig>,
|
|
19
|
-
) {
|
|
20
|
-
return config
|
|
21
|
-
}
|