valaxy 0.7.2 → 0.7.5
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/composables/post.ts +1 -36
- package/client/composables/sidebar.ts +1 -48
- package/client/config.ts +7 -16
- package/client/index.ts +0 -3
- package/client/main.ts +0 -3
- package/client/setup/main.ts +7 -1
- package/client/shims.d.ts +2 -2
- package/dist/chunk-B2L4QLCB.mjs +1 -0
- package/dist/chunk-KRHFRLOW.js +1 -0
- package/dist/chunk-XWW4YHHO.mjs +2312 -0
- package/dist/chunk-YE3TWJS7.js +2312 -0
- package/dist/client/index.d.ts +5 -41
- package/dist/client/index.js +1 -1
- package/dist/client/index.mjs +1 -1
- package/dist/{index-afca77df.d.ts → index-cfcea95c.d.ts} +17 -2
- 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 +3 -0
- package/package.json +10 -7
- 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-35O5DRGK.mjs +0 -2270
- package/dist/chunk-4VSND5ZW.mjs +0 -1
- package/dist/chunk-CDIW2WTI.js +0 -1
- package/dist/chunk-RGBLPQZ2.js +0 -2270
- package/dist/index-a6b0a69b.d.ts +0 -16
- package/shared/index.ts +0 -20
package/dist/client/index.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { InjectionKey, ComputedRef, Ref
|
|
3
|
-
import {
|
|
4
|
-
import { ThemeConfig } from 'valaxy-theme-yun';
|
|
2
|
+
import { InjectionKey, ComputedRef, Ref } from 'vue';
|
|
3
|
+
import { V as ValaxyConfig, b as ValaxyThemeConfig, P as PageData, f as Post } from '../index-cfcea95c.js';
|
|
5
4
|
import { ViteSSGContext } from 'vite-ssg';
|
|
6
5
|
import { Awaitable } from '@antfu/utils';
|
|
7
6
|
import { VitePluginConfig } from 'unocss/vite';
|
|
8
|
-
export { E as EXTERNAL_URL_RE, d as defineConfig, a as defineConfigWithTheme } from '../index-a6b0a69b.js';
|
|
9
7
|
import '@vitejs/plugin-vue';
|
|
10
8
|
import 'unplugin-vue-components/vite';
|
|
11
9
|
import 'type-fest';
|
|
@@ -13,29 +11,16 @@ import 'markdown-it';
|
|
|
13
11
|
import 'shiki';
|
|
14
12
|
import 'markdown-it-anchor';
|
|
15
13
|
import 'katex';
|
|
16
|
-
import 'type-fest/source/partial-deep';
|
|
17
14
|
|
|
18
15
|
interface ValaxyContext {
|
|
19
16
|
userRoot: string;
|
|
20
17
|
}
|
|
21
|
-
declare const valaxyConfigSymbol: InjectionKey<ComputedRef<ValaxyConfig
|
|
18
|
+
declare const valaxyConfigSymbol: InjectionKey<ComputedRef<ValaxyConfig>>;
|
|
22
19
|
declare const valaxyConfigRef: vue.ShallowRef<ValaxyConfig<ValaxyThemeConfig>>;
|
|
23
20
|
declare const valaxyContextRef: vue.ShallowRef<ValaxyContext>;
|
|
24
21
|
declare function initConfig(): ComputedRef<ValaxyConfig<ValaxyThemeConfig>>;
|
|
25
22
|
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
|
-
}>;
|
|
23
|
+
declare function useConfig<ThemeConfig = any>(): ComputedRef<ValaxyConfig<ThemeConfig>>;
|
|
39
24
|
interface ValaxyData<T = any> {
|
|
40
25
|
page: Ref<PageData>;
|
|
41
26
|
theme: Ref<T>;
|
|
@@ -80,19 +65,6 @@ declare function usePageList(): vue.ComputedRef<any[]>;
|
|
|
80
65
|
* @returns
|
|
81
66
|
*/
|
|
82
67
|
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
68
|
|
|
97
69
|
declare type Tags = Map<string, {
|
|
98
70
|
count: number;
|
|
@@ -164,14 +136,6 @@ declare function useBackToTop(options?: {
|
|
|
164
136
|
|
|
165
137
|
declare function useCodePen(): void;
|
|
166
138
|
|
|
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
139
|
declare function useActiveSidebarLinks(container: Ref<HTMLElement>, marker: Ref<HTMLElement>): void;
|
|
176
140
|
|
|
177
141
|
declare function useTwikoo(options?: {}): void;
|
|
@@ -214,4 +178,4 @@ declare type UnoSetup = () => Awaitable<Partial<VitePluginConfig> | undefined>;
|
|
|
214
178
|
declare function defineAppSetup(fn: AppSetup): AppSetup;
|
|
215
179
|
declare function defineUnoSetup(fn: UnoSetup): UnoSetup;
|
|
216
180
|
|
|
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,
|
|
181
|
+
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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkCDIW2WTIjs = require('../chunk-CDIW2WTI.js');var _config = require('@valaxyjs/config'); var _config2 = _interopRequireDefault(_config);var _context = require('@valaxyjs/context'); var _context2 = _interopRequireDefault(_context);var _vue = require('vue');function h(t){let e=JSON.parse(t);return __DEV__?_vue.readonly.call(void 0, e):e}var z=Symbol("valaxy:config"),T= exports.valaxyConfigRef =_vue.shallowRef.call(void 0, h(_config2.default)),b= exports.valaxyContextRef =_vue.shallowRef.call(void 0, h(_context2.default));import.meta.hot&&(import.meta.hot.accept("/@valaxyjs/config",t=>{T.value=h(t.default)}),import.meta.hot.accept("/@valaxyjs/context",t=>{b.value=h(t.default)}));function Et(){return _vue.computed.call(void 0, ()=>T.value)}function Mt(){return _vue.computed.call(void 0, ()=>b.value)}function v(){let t=_vue.inject.call(void 0, z);if(!t)throw new Error("[Valaxy] config not properly injected in app");return t}function y(){let t=v();return _vue.computed.call(void 0, ()=>t.value.themeConfig)}var _vuerouter = require('vue-router');var _vuei18n = require('vue-i18n');function Dt(t,e){return Math.random()*(e-t)+t}function I(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var Ht=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",I(e,"table-container")})};function kt(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}var _dayjs = require('dayjs'); var _dayjs2 = _interopRequireDefault(_dayjs);function Ot(t,e="YYYY-MM-DD"){return _dayjs2.default.call(void 0, t).format(e)}function C(t,e=!0){return t.sort((o,n)=>{let i=+new Date(o.date||""),r=+new Date(n.date||"");return e?r-i:i-r})}var Ft=t=>{let{locale:e}=_vuei18n.useI18n.call(void 0, );return _vue.computed.call(void 0, ()=>{let o=e.value==="zh-CN"?"zh":e.value;return t.value[`title_${o}`]||t.value.title})};function g(t={}){let e=_vuerouter.useRouter.call(void 0, );return _vue.computed.call(void 0, ()=>{let o=e.getRoutes().filter(r=>r.path.startsWith("/posts")&&r.meta.frontmatter&&r.meta.frontmatter.date).filter(r=>!r.path.endsWith(".html")).filter(r=>!t.type||r.meta.frontmatter.type===t.type).map(r=>Object.assign({path:r.path,excerpt:r.meta.excerpt},r.meta.frontmatter)),n=C(o.filter(r=>r.top)).sort((r,a)=>a.top-r.top),i=C(o.filter(r=>!r.top));return n.concat(i)})}function Gt(){let t=_vuerouter.useRouter.call(void 0, );return _vue.computed.call(void 0, ()=>t.getRoutes().map(o=>Object.assign({path:o.path,excerpt:o.meta.excerpt},o.meta.frontmatter)))}function Kt(t){let e=_vuerouter.useRoute.call(void 0, ),o=_vue.computed.call(void 0, ()=>t||e.path),n=g(),i=_vue.computed.call(void 0, ()=>{let s=-1;return n.value.find((l,u)=>l.path===o.value?(s=u,!0):!1),s}),r=_vue.computed.call(void 0, ()=>i.value-1>=0?n.value[i.value-1]:null),a=_vue.computed.call(void 0, ()=>i.value+1<n.value.length?n.value[i.value+1]:null);return[r,a]}function Jt(t){if(!t)return{color:"",icon:"",styles:{}};let e=y();t in e.value.types||(t="link");let o=e.value.types[t].color,n=e.value.types[t].icon,i=_vue.computed.call(void 0, ()=>({"--card-c-primary":t&&o}));return{color:o,icon:n,styles:i}}var te=t=>t.children;function ee(t,e=[]){var i;e.length||(e=_vue.unref.call(void 0, g()));let o={total:e.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},n=o.children.get("Uncategorized");if(e.forEach(r=>{if(r.categories)if(Array.isArray(r.categories)){let a=r.categories.length,s=o;r.categories.forEach((l,u)=>{var p,d,f;if(u===a-1)if(s.children.has(l)){let c=s.children.get(l);c.posts&&(c.total+=1,c.posts.push(r))}else(p=s.children)==null||p.set(l,{total:1,posts:[r]});else if((d=s.children)!=null&&d.has(l)){let c=s.children.get(l);c.total+=1,s=c}else{let c={total:1,children:new Map};(f=s.children)==null||f.set(l,c),s=c}})}else{let a=r.categories;if(o.children.has(a)){let s=o.children.get(a);s.total+=1,s.posts.push(r)}else o.children.set(a,{total:1,posts:[r]})}else n.total+=1,n.posts.push(r)}),n.total===0&&((i=o.children)==null||i.delete("Uncategorized")),t){let r=o.children.get(t);return r?{total:r==null?void 0:r.total,children:new Map([[t,r]])}:(console.warn(`Do not have category: ${t}`),o)}else return o}var _tinycolor = require('@ctrl/tinycolor');function ie(t={primary:"#0078E7"}){let e=F(),o=new (0, _tinycolor.TinyColor)("#999999"),n=new (0, _tinycolor.TinyColor)(t.primary);return{tags:e,getTagStyle:r=>{let a=Array.from(e).map(([d,f])=>f.count),s=Math.max(...a),l=Math.min(...a),u=s-l,p=(r-l)/u;return{"--yun-tag-color":o.mix(n,p*100).toString(),fontSize:`${p*36+12}px`}}}}function F(){let t=g(),e=new Map;return t.value.forEach(o=>{if(o.tags){let n;typeof o.tags=="string"?n=[o.tags]:n=o.tags,n.forEach(i=>{if(e.has(i)){let r=e.get(i);e.set(i,{...r,count:r.count+1})}else e.set(i,{count:1})})}}),e}var _core = require('@vueuse/core');function L(){let t=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>t.meta.frontmatter)}function pe(){let t=v(),e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>((t.value.url.endsWith("/")?t.value.url.slice(0,-1):t.value.url)||_core.isClient&&window.location.origin)+e.path)}function ge(t){let e=_vue.ref.call(void 0, !1),{top:o}=_core.useElementBounding.call(void 0, t);return _core.useIntersectionObserver.call(void 0, t,([{isIntersecting:i}])=>{e.value=i}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}var tt=_core.useDark.call(void 0, ),xe= exports.toggleDark =_core.useToggle.call(void 0, tt);function Te(t){let e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>e.meta.layout===t)}var _head = require('@vueuse/head');function Se(){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"}]}),_core.useScriptTag.call(void 0, "https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js",()=>{_core.useScriptTag.call(void 0, "https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js")})}function Me(t={offset:100}){if(!_core.isClient)return{percentage:_vue.ref.call(void 0, 0),show:_vue.ref.call(void 0, !1)};let{y:e}=_core.useWindowScroll.call(void 0, ),o=_vue.computed.call(void 0, ()=>e.value/(document.body.scrollHeight-window.innerHeight)),n=_vue.computed.call(void 0, ()=>e.value>t.offset);return{percentage:o,show:n}}function He(){_head.useHead.call(void 0, {script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}var _utils = require('@antfu/utils');function H(t,e){if(Array.isArray(t))return t;e=_utils.ensurePrefix.call(void 0, "/",e);for(let o in t)if(e.startsWith(_utils.ensurePrefix.call(void 0, "/",o)))return t[o];return[]}function $e(){let t=_vuerouter.useRoute.call(void 0, ),e=L(),o=y(),n=_vue.ref.call(void 0, !1),i=_vue.computed.call(void 0, ()=>{let u=o.value.sidebar,p=t.path;return u?H(u,p):[]}),r=_vue.computed.call(void 0, ()=>e.value.sidebar!==!1);function a(){n.value=!0}function s(){n.value=!1}function l(){n.value?s():a()}return{isOpen:n,sidebar:i,hasSidebar:r,open:a,close:s,toggle:l}}function Fe(t,e){let o=mt(n,200);function n(){let s=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),l=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(u=>s.some(p=>p.hash===u.hash));for(let u=0;u<l.length;u++){let p=l[u],d=l[u+1],[f,c]=pt(u,p,d);if(f){history.replaceState(null,document.title,c||" "),r(c);return}}}let i=null;function r(s){a(i);let l=i=s==null?null:t.value.querySelector(`.va-toc a[href="${s}"]`);e.value&&(l?(l.classList.add("active"),e.value.style.opacity="1",e.value.style.top=`${l.offsetTop+2}px`):(e.value.style.opacity="0",e.value.style.top="54px"))}function a(s){s&&s.classList.remove("active")}_vue.onMounted.call(void 0, ()=>{requestAnimationFrame(n),window.addEventListener("scroll",o)}),_vue.onUnmounted.call(void 0, ()=>{window.removeEventListener("scroll",o)})}function V(t){return t.parentElement.offsetTop-50}function pt(t,e,o){let n=window.scrollY;return t===0&&n===0?[!0,null]:n<V(e)?[!1,null]:!o||n<V(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function mt(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}function Xe(t={}){let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, );function n(i={}){if(!_core.isClient)return;let r={el:".comment #tcomment",lang:o.value,path:e.path},a=Object.assign(r,i);return window.twikoo.init(a)}_core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{n(t)})}function io(t={}){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/@waline/client/dist/waline.css"}]});let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, ),n;function i(r={}){if(!_core.isClient)return;let a={el:".comment #waline",lang:o.value,dark:"html.dark",emoji:["https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/qq","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo"],path:e.path},s=Object.assign(a,r);return window.Waline.init(s)}return _core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/@waline/client/dist/waline.js",()=>{n=i(t)}),_vue.watch.call(void 0, ()=>e.path,r=>{!n||n.update({path:r})}),_vue.watch.call(void 0, o,r=>{!n||n.update({lang:r})}),_vue.onUnmounted.call(void 0, ()=>{!n||n.destroy()}),n}function To(t){return t}function bo(t){return t}exports.EXTERNAL_URL_RE = _chunkCDIW2WTIjs.d; exports.defineAppSetup = To; exports.defineConfig = _chunkCDIW2WTIjs.e; exports.defineConfigWithTheme = _chunkCDIW2WTIjs.f; exports.defineUnoSetup = bo; exports.formatDate = Ot; exports.initConfig = Et; exports.initContext = Mt; exports.isDark = tt; exports.isParentCategory = te; exports.random = Dt; exports.sortByDate = C; exports.throttleAndDebounce = kt; exports.toggleDark = xe; exports.useActiveSidebarLinks = Fe; exports.useAplayer = Se; exports.useBackToTop = Me; exports.useCategory = ee; exports.useCodePen = He; exports.useConfig = v; exports.useFrontmatter = L; exports.useFullUrl = pe; exports.useInvisibleElement = ge; exports.useLayout = Te; exports.usePageList = Gt; exports.usePostList = g; exports.usePostProperty = Jt; exports.usePostTitle = Ft; exports.usePrevNext = Kt; exports.useSidebar = $e; exports.useTag = F; exports.useTags = ie; exports.useThemeConfig = y; exports.useTwikoo = Xe; exports.useWaline = io; exports.valaxyConfigRef = T; exports.valaxyConfigSymbol = z; exports.valaxyContextRef = b; exports.wrap = I; exports.wrapTable = Ht;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('../chunk-KRHFRLOW.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 vt(){return _vue.computed.call(void 0, ()=>C.value)}function Ct(){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 Tt(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 bt=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",O(e,"table-container")})};function Pt(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 Lt(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 Ut=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 Ot(){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 Bt(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 Nt=t=>t.children;function Wt(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 Ft(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 Zt(){let t=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>t.meta.frontmatter)}function te(){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 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:i}])=>{e.value=i}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}var K=_core.useDark.call(void 0, ),ae= exports.toggleDark =_core.useToggle.call(void 0, K);function pe(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 ve(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 Me(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 ke(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 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 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 ro(t){return t}function no(t){return t}exports.defineAppSetup = ro; exports.defineUnoSetup = no; exports.formatDate = Lt; exports.initConfig = vt; exports.initContext = Ct; exports.isDark = K; exports.isParentCategory = Nt; exports.random = Tt; exports.sortByDate = y; exports.throttleAndDebounce = Pt; exports.toggleDark = ae; exports.useActiveSidebarLinks = Me; exports.useAplayer = ge; exports.useBackToTop = ve; exports.useCategory = Wt; exports.useCodePen = Te; exports.useConfig = T; exports.useFrontmatter = Zt; exports.useFullUrl = te; exports.useInvisibleElement = ne; exports.useLayout = pe; exports.usePageList = Ot; exports.usePostList = g; exports.usePostTitle = Ut; exports.usePrevNext = Bt; exports.useTag = N; exports.useTags = Ft; exports.useTwikoo = ke; exports.useWaline = Ie; exports.valaxyConfigRef = C; exports.valaxyConfigSymbol = U; exports.valaxyContextRef = w; exports.wrap = O; exports.wrapTable = bt;
|
package/dist/client/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"../chunk-B2L4QLCB.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 vt(){return x(()=>C.value)}function Ct(){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 Tt(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 bt=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",O(e,"table-container")})};function Pt(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 Lt(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 Ut=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 Ot(){let t=b();return m(()=>t.getRoutes().map(o=>Object.assign({path:o.path,excerpt:o.meta.excerpt},o.meta.frontmatter)))}function Bt(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 Nt=t=>t.children;function Wt(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 Ft(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 Zt(){let t=A();return j(()=>t.meta.frontmatter)}function te(){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 ne(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(),ae=G(K);import{computed as J}from"vue";import{useRoute as Q}from"vue-router";function pe(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 ge(){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 ve(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 Te(){et({script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}import{onMounted as ot,onUnmounted as rt}from"vue";function Me(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 ke(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 Ie(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 ro(t){return t}function no(t){return t}export{ro as defineAppSetup,no as defineUnoSetup,Lt as formatDate,vt as initConfig,Ct as initContext,K as isDark,Nt as isParentCategory,Tt as random,y as sortByDate,Pt as throttleAndDebounce,ae as toggleDark,Me as useActiveSidebarLinks,ge as useAplayer,ve as useBackToTop,Wt as useCategory,Te as useCodePen,T as useConfig,Zt as useFrontmatter,te as useFullUrl,ne as useInvisibleElement,pe as useLayout,Ot as usePageList,g as usePostList,Ut as usePostTitle,Bt as usePrevNext,N as useTag,Ft as useTags,ke as useTwikoo,Ie as useWaline,C as valaxyConfigRef,U as valaxyConfigSymbol,w as valaxyContextRef,O as wrap,bt as wrapTable};
|
|
@@ -54,6 +54,21 @@ interface ResolvedValaxyOptions {
|
|
|
54
54
|
interface ValaxyServerOptions {
|
|
55
55
|
onConfigReload?: (newConfig: ValaxyConfig, config: ValaxyConfig) => void;
|
|
56
56
|
}
|
|
57
|
+
declare function isPath(name: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* get theme roots
|
|
60
|
+
* @param name
|
|
61
|
+
* @param entry
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
declare function getThemeRoot(name: string, entry: string): string;
|
|
65
|
+
declare function resolveOptions(options: ValaxyEntryOptions, mode?: ResolvedValaxyOptions['mode']): Promise<ResolvedValaxyOptions>;
|
|
66
|
+
/**
|
|
67
|
+
* resolve plugin options
|
|
68
|
+
* @param command
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
declare function resolvePluginOptions(command?: 'build' | 'serve'): Promise<ValaxyPluginOptions>;
|
|
57
72
|
|
|
58
73
|
interface BlockItem {
|
|
59
74
|
text?: string;
|
|
@@ -432,11 +447,11 @@ declare module 'vite' {
|
|
|
432
447
|
/**
|
|
433
448
|
* Custom internal plugin options for Valaxy (advanced)
|
|
434
449
|
*
|
|
435
|
-
* @see
|
|
450
|
+
* @see ./options.ts'
|
|
436
451
|
*/
|
|
437
452
|
valaxy?: ValaxyPluginOptions;
|
|
438
453
|
ssgOptions?: ViteSSGOptions;
|
|
439
454
|
}
|
|
440
455
|
}
|
|
441
456
|
|
|
442
|
-
export { AlgoliaSearchOptions as A, Header as H, PageData as P, ResolvedValaxyOptions as R, SocialLink as S, UserConfig as U,
|
|
457
|
+
export { AlgoliaSearchOptions as A, Header as H, PageData as P, ResolvedValaxyOptions as R, SocialLink as S, UserConfig as U, ValaxyConfig as V, ValaxyEntryOptions as a, ValaxyThemeConfig as b, ValaxyServerOptions as c, ValaxyPluginOptions as d, resolvePluginOptions as e, Post as f, getThemeRoot as g, PageDataPayload as h, isPath as i, HeadConfig as j, resolveOptions as r };
|