valaxy 0.7.3 → 0.7.6
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/composables/post.ts +1 -36
- package/client/composables/sidebar.ts +1 -48
- package/client/config.ts +7 -16
- 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/client.d.ts +2 -0
- package/dist/chunk-BTP4CLJN.js +2312 -0
- package/dist/chunk-HP2UOVSL.mjs +2312 -0
- package/dist/{index-afca77df.d.ts → index-df14d281.d.ts} +23 -3
- package/dist/node/cli.js +9 -42
- package/dist/node/cli.mjs +9 -42
- 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 +1 -1
- package/package.json +12 -10
- package/client/components/PostCard.vue +0 -81
- package/client/components/PostList.vue +0 -50
- package/client/components/ValaxyBg.vue +0 -51
- package/client/components/ValaxyFooter.vue +0 -52
- package/client/pages/hi/[name].vue +0 -52
- package/client/pages/index.vue +0 -8
- package/client/pages/page/[page].vue +0 -12
- package/client/stores/user.ts +0 -35
- package/client/utils/sidebar.ts +0 -26
- package/dist/chunk-4VSND5ZW.mjs +0 -1
- package/dist/chunk-6MWMH5HB.mjs +0 -2270
- package/dist/chunk-CDIW2WTI.js +0 -1
- package/dist/chunk-EFF4TH4Z.js +0 -2270
- package/dist/client/index.d.ts +0 -217
- package/dist/client/index.js +0 -1
- package/dist/client/index.mjs +0 -1
- package/dist/index-a6b0a69b.d.ts +0 -16
- package/shared/index.ts +0 -20
package/dist/client/index.d.ts
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import * as vue from 'vue';
|
|
2
|
-
import { InjectionKey, ComputedRef, Ref, StyleValue } from 'vue';
|
|
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';
|
|
11
|
-
import 'type-fest';
|
|
12
|
-
import 'markdown-it';
|
|
13
|
-
import 'shiki';
|
|
14
|
-
import 'markdown-it-anchor';
|
|
15
|
-
import 'katex';
|
|
16
|
-
import 'type-fest/source/partial-deep';
|
|
17
|
-
|
|
18
|
-
interface ValaxyContext {
|
|
19
|
-
userRoot: string;
|
|
20
|
-
}
|
|
21
|
-
declare const valaxyConfigSymbol: InjectionKey<ComputedRef<ValaxyConfig<ThemeConfig>>>;
|
|
22
|
-
declare const valaxyConfigRef: vue.ShallowRef<ValaxyConfig<ValaxyThemeConfig>>;
|
|
23
|
-
declare const valaxyContextRef: vue.ShallowRef<ValaxyContext>;
|
|
24
|
-
declare function initConfig(): ComputedRef<ValaxyConfig<ValaxyThemeConfig>>;
|
|
25
|
-
declare function initContext(): ComputedRef<ValaxyContext>;
|
|
26
|
-
declare function useConfig(): ComputedRef<ValaxyConfig<ThemeConfig>>;
|
|
27
|
-
/**
|
|
28
|
-
* getThemeConfig
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
31
|
-
declare function useThemeConfig(): ComputedRef<ThemeConfig & {
|
|
32
|
-
pkg: {
|
|
33
|
-
[key: string]: any;
|
|
34
|
-
name: string;
|
|
35
|
-
version: string;
|
|
36
|
-
homepage?: string | undefined;
|
|
37
|
-
};
|
|
38
|
-
}>;
|
|
39
|
-
interface ValaxyData<T = any> {
|
|
40
|
-
page: Ref<PageData>;
|
|
41
|
-
theme: Ref<T>;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
interface BaseCategory {
|
|
45
|
-
total: number;
|
|
46
|
-
}
|
|
47
|
-
interface ParentCategory extends BaseCategory {
|
|
48
|
-
children: Categories;
|
|
49
|
-
}
|
|
50
|
-
interface PostCategory extends BaseCategory {
|
|
51
|
-
posts: Post[];
|
|
52
|
-
}
|
|
53
|
-
declare type Category = ParentCategory | PostCategory;
|
|
54
|
-
declare type Categories = Map<string, Category>;
|
|
55
|
-
declare const isParentCategory: (category: any) => category is ParentCategory;
|
|
56
|
-
/**
|
|
57
|
-
* get categories from posts
|
|
58
|
-
* @returns
|
|
59
|
-
*/
|
|
60
|
-
declare function useCategory(category?: string, posts?: Post[]): ParentCategory;
|
|
61
|
-
|
|
62
|
-
declare const usePostTitle: (post: Ref<Post>) => vue.ComputedRef<any>;
|
|
63
|
-
/**
|
|
64
|
-
* get post list
|
|
65
|
-
* todo: use vue provide/inject to global
|
|
66
|
-
* @param params
|
|
67
|
-
* @returns
|
|
68
|
-
*/
|
|
69
|
-
declare function usePostList(params?: {
|
|
70
|
-
type?: string;
|
|
71
|
-
}): vue.ComputedRef<Post[]>;
|
|
72
|
-
/**
|
|
73
|
-
* get all page
|
|
74
|
-
* @returns
|
|
75
|
-
*/
|
|
76
|
-
declare function usePageList(): vue.ComputedRef<any[]>;
|
|
77
|
-
/**
|
|
78
|
-
* get prev and next post
|
|
79
|
-
* @param path
|
|
80
|
-
* @returns
|
|
81
|
-
*/
|
|
82
|
-
declare function usePrevNext(path?: string): vue.ComputedRef<Post | null>[];
|
|
83
|
-
/**
|
|
84
|
-
* get type card property
|
|
85
|
-
* todo: test reactive
|
|
86
|
-
*/
|
|
87
|
-
declare function usePostProperty(type?: string): {
|
|
88
|
-
color: string;
|
|
89
|
-
icon: string;
|
|
90
|
-
styles: {};
|
|
91
|
-
} | {
|
|
92
|
-
color: string;
|
|
93
|
-
icon: string;
|
|
94
|
-
styles: vue.ComputedRef<StyleValue>;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
declare type Tags = Map<string, {
|
|
98
|
-
count: number;
|
|
99
|
-
}>;
|
|
100
|
-
/**
|
|
101
|
-
* get utils about tags
|
|
102
|
-
*/
|
|
103
|
-
declare function useTags(options?: {
|
|
104
|
-
/**
|
|
105
|
-
* Primary Color
|
|
106
|
-
*/
|
|
107
|
-
primary: string;
|
|
108
|
-
}): {
|
|
109
|
-
tags: Tags;
|
|
110
|
-
getTagStyle: (count: number) => {
|
|
111
|
-
'--yun-tag-color': string;
|
|
112
|
-
fontSize: string;
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* get tag map
|
|
117
|
-
* @returns
|
|
118
|
-
*/
|
|
119
|
-
declare function useTag(): Tags;
|
|
120
|
-
|
|
121
|
-
declare function useFrontmatter(): vue.ComputedRef<Post>;
|
|
122
|
-
/**
|
|
123
|
-
* get full url
|
|
124
|
-
*/
|
|
125
|
-
declare function useFullUrl(): vue.ComputedRef<string>;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* trigger show invisible element
|
|
129
|
-
* @param target
|
|
130
|
-
* @returns
|
|
131
|
-
*/
|
|
132
|
-
declare function useInvisibleElement(target: Ref<HTMLElement>): {
|
|
133
|
-
show: () => void;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
declare const isDark: vue.WritableComputedRef<boolean>;
|
|
137
|
-
declare const toggleDark: (value?: boolean | undefined) => boolean;
|
|
138
|
-
|
|
139
|
-
declare function useLayout(layout: string): vue.ComputedRef<boolean>;
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* use MetingJS and Aplayer
|
|
143
|
-
* https://github.com/MoePlayer/APlayer
|
|
144
|
-
* https://github.com/metowolf/MetingJS
|
|
145
|
-
*/
|
|
146
|
-
declare function useAplayer(): void;
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* You can use href="#" to back to top
|
|
150
|
-
* @description 你可以使用它来编写自己的 backToTop
|
|
151
|
-
*/
|
|
152
|
-
declare function useBackToTop(options?: {
|
|
153
|
-
/**
|
|
154
|
-
* show backToTop button, when height > offset
|
|
155
|
-
*/
|
|
156
|
-
offset: number;
|
|
157
|
-
}): {
|
|
158
|
-
percentage: vue.Ref<number>;
|
|
159
|
-
show: vue.Ref<boolean>;
|
|
160
|
-
} | {
|
|
161
|
-
percentage: vue.ComputedRef<number>;
|
|
162
|
-
show: vue.ComputedRef<boolean>;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
declare function useCodePen(): void;
|
|
166
|
-
|
|
167
|
-
declare function useSidebar(): {
|
|
168
|
-
isOpen: Ref<boolean>;
|
|
169
|
-
sidebar: vue.ComputedRef<any>;
|
|
170
|
-
hasSidebar: vue.ComputedRef<boolean>;
|
|
171
|
-
open: () => void;
|
|
172
|
-
close: () => void;
|
|
173
|
-
toggle: () => void;
|
|
174
|
-
};
|
|
175
|
-
declare function useActiveSidebarLinks(container: Ref<HTMLElement>, marker: Ref<HTMLElement>): void;
|
|
176
|
-
|
|
177
|
-
declare function useTwikoo(options?: {}): void;
|
|
178
|
-
|
|
179
|
-
declare function useWaline(options?: {}): any;
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* 生成介于 min 与 max 之间的随机数
|
|
183
|
-
* @returns
|
|
184
|
-
*/
|
|
185
|
-
declare function random(min: number, max: number): number;
|
|
186
|
-
/**
|
|
187
|
-
* wrap node
|
|
188
|
-
* @param className
|
|
189
|
-
*/
|
|
190
|
-
declare function wrap(el: HTMLElement, className: string): void;
|
|
191
|
-
/**
|
|
192
|
-
* 包裹表格,添加 class 以控制 table 样式
|
|
193
|
-
*/
|
|
194
|
-
declare const wrapTable: (container?: HTMLElement | Document) => void;
|
|
195
|
-
declare function throttleAndDebounce(fn: () => void, delay: number): () => void;
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* use dayjs format date
|
|
199
|
-
* @param date
|
|
200
|
-
* @param template
|
|
201
|
-
* @returns
|
|
202
|
-
*/
|
|
203
|
-
declare function formatDate(date: string | number | Date, template?: string): string;
|
|
204
|
-
/**
|
|
205
|
-
* sort posts by date
|
|
206
|
-
* @param posts
|
|
207
|
-
* @param desc
|
|
208
|
-
*/
|
|
209
|
-
declare function sortByDate(posts: Post[], desc?: boolean): Post[];
|
|
210
|
-
|
|
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;
|
|
216
|
-
|
|
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 };
|
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 _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;
|
package/dist/client/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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};
|
package/dist/index-a6b0a69b.d.ts
DELETED
|
@@ -1,16 +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-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 };
|
package/shared/index.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { YunTheme } from 'valaxy-theme-yun'
|
|
2
|
-
import type { UserConfig } from '../types'
|
|
3
|
-
|
|
4
|
-
export const EXTERNAL_URL_RE = /^https?:/i
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Type config helper
|
|
8
|
-
*/
|
|
9
|
-
export function defineConfig(config: UserConfig<YunTheme.Config>) {
|
|
10
|
-
return config
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Type config helper for custom theme config
|
|
15
|
-
*/
|
|
16
|
-
export function defineConfigWithTheme<ThemeConfig>(
|
|
17
|
-
config: UserConfig<ThemeConfig>,
|
|
18
|
-
) {
|
|
19
|
-
return config
|
|
20
|
-
}
|