valaxy 0.3.9 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/bin/valaxy.js +1 -1
- package/dist/chunk-6LIOFBAA.mjs +1 -0
- package/dist/chunk-HRARZPSA.js +83 -0
- package/dist/chunk-N6HD5SHF.mjs +83 -0
- package/dist/chunk-V3BMKLEW.js +1 -0
- package/dist/{config-97204b79.d.ts → config-de04677b.d.ts} +4 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/node/cli.js +10 -10
- package/dist/node/cli.mjs +10 -10
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.mjs +1 -1
- package/package.json +27 -30
- package/src/client/App.vue +21 -1
- package/src/client/components/ValaxyBg.vue +51 -0
- package/src/client/composables/comments/twikoo.ts +0 -1
- package/src/client/composables/sidebar.ts +10 -8
- package/src/client/index.html +1 -2
- package/src/client/main.ts +5 -1
- package/src/client/modules/valaxy.ts +1 -1
- package/src/client/styles/common/markdown.scss +5 -1
- package/src/client/styles/global/index.scss +0 -25
- package/src/node/markdown/markdown-it/katex.ts +2 -2
- package/src/node/plugins/extendConfig.ts +1 -0
- package/src/node/plugins/markdown.ts +1 -1
- package/src/node/plugins/preset.ts +0 -30
- package/src/node/rss.ts +1 -1
- package/src/node/server.ts +6 -4
- package/src/types/config.ts +7 -1
- package/dist/chunk-AQBALXBF.js +0 -83
- package/dist/chunk-QIXBXHEK.js +0 -1
- package/dist/chunk-T3K5KZOK.mjs +0 -1
- package/dist/chunk-ZUG5LNG5.mjs +0 -83
- package/src/client/modules/pwa.ts +0 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { InjectionKey, ComputedRef, Ref, StyleValue } from 'vue';
|
|
3
|
-
import { V as ValaxyConfig, a as ValaxyThemeConfig } from './config-
|
|
4
|
-
export { S as SocialLink, U as UserConfig, V as ValaxyConfig, a as ValaxyThemeConfig, d as defaultValaxyConfig } from './config-
|
|
3
|
+
import { V as ValaxyConfig, a as ValaxyThemeConfig } from './config-de04677b.js';
|
|
4
|
+
export { S as SocialLink, U as UserConfig, V as ValaxyConfig, a as ValaxyThemeConfig, d as defaultValaxyConfig } from './config-de04677b.js';
|
|
5
5
|
import 'type-fest';
|
|
6
6
|
import 'unocss/vite';
|
|
7
7
|
import 'markdown-it';
|
|
@@ -146,7 +146,7 @@ interface ThemeConfig {
|
|
|
146
146
|
enable: boolean;
|
|
147
147
|
url: string;
|
|
148
148
|
dark?: string;
|
|
149
|
-
opacity
|
|
149
|
+
opacity?: number;
|
|
150
150
|
};
|
|
151
151
|
/**
|
|
152
152
|
* say something
|
|
@@ -362,6 +362,9 @@ declare function useBackToTop(options?: {
|
|
|
362
362
|
}): {
|
|
363
363
|
percentage: vue.Ref<number>;
|
|
364
364
|
show: vue.Ref<boolean>;
|
|
365
|
+
} | {
|
|
366
|
+
percentage: vue.ComputedRef<number>;
|
|
367
|
+
show: vue.ComputedRef<boolean>;
|
|
365
368
|
};
|
|
366
369
|
|
|
367
370
|
declare function useCodePen(): void;
|
package/dist/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 _chunkQIXBXHEKjs = require('./chunk-QIXBXHEK.js');_chunkQIXBXHEKjs.i.call(void 0, );_chunkQIXBXHEKjs.i.call(void 0, );_chunkQIXBXHEKjs.i.call(void 0, );var _config = require('@valaxyjs/config'); var _config2 = _interopRequireDefault(_config);var _vue = require('vue');function T(t){let e=JSON.parse(t);return import.meta.env.DEV?_vue.readonly.call(void 0, e):e}var q=Symbol("valaxy:config"),P= exports.valaxyConfigRef =_vue.shallowRef.call(void 0, T(_config2.default));import.meta.hot&&import.meta.hot.accept("/@valaxyjs/config",t=>{P.value=T(t.default)});function Tt(){return _vue.computed.call(void 0, ()=>P.value)}function y(){let t=_vue.inject.call(void 0, q);if(!t)throw new Error("[Valaxy] config not properly injected in qpp");return t}function b(){let t=y();return _vue.computed.call(void 0, ()=>t.value.themeConfig)}_chunkQIXBXHEKjs.i.call(void 0, );_chunkQIXBXHEKjs.i.call(void 0, );_chunkQIXBXHEKjs.i.call(void 0, );var _vuerouter = require('vue-router');var _vuei18n = require('vue-i18n');_chunkQIXBXHEKjs.i.call(void 0, );_chunkQIXBXHEKjs.i.call(void 0, );function bt(t,e){return Math.random()*(e-t)+t}function B(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",B(e,"table-container")})};_chunkQIXBXHEKjs.i.call(void 0, );var _dayjs = require('dayjs'); var _dayjs2 = _interopRequireDefault(_dayjs);function Mt(t,e="YYYY-MM-DD"){return _dayjs2.default.call(void 0, t).format(e)}function x(t,e=!0){return t.sort((o,s)=>{let i=+new Date(o.date||""),r=+new Date(s.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)),s=x(o.filter(r=>r.top)).sort((r,c)=>c.top-r.top),i=x(o.filter(r=>!r.top));return s.concat(i)})}function Bt(){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 zt(t){let e=_vuerouter.useRoute.call(void 0, ),o=_vue.computed.call(void 0, ()=>t||e.path),s=g(),i=_vue.computed.call(void 0, ()=>{let a=-1;return s.value.find((l,u)=>l.path===o.value?(a=u,!0):!1),a}),r=_vue.computed.call(void 0, ()=>i.value-1>=0?s.value[i.value-1]:null),c=_vue.computed.call(void 0, ()=>i.value+1<s.value.length?s.value[i.value+1]:null);return[r,c]}function It(t){if(!t)return{color:"",icon:"",styles:{}};let e=b();t in e.value.types||(t="link");let o=e.value.types[t].color,s=e.value.types[t].icon,i=_vue.computed.call(void 0, ()=>({"--card-c-primary":t&&o}));return{color:o,icon:s,styles:i}}var $t=t=>t.children;function Ft(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:[]}]])},s=o.children.get("Uncategorized");if(e.forEach(r=>{if(r.categories)if(Array.isArray(r.categories)){let c=r.categories.length,a=o;r.categories.forEach((l,u)=>{var p,h,d;if(u===c-1)if(a.children.has(l)){let m=a.children.get(l);m.posts&&(m.total+=1,m.posts.push(r))}else(p=a.children)==null||p.set(l,{total:1,posts:[r]});else if((h=a.children)!=null&&h.has(l)){let m=a.children.get(l);m.total+=1,a=m}else{let m={total:1,children:new Map};(d=a.children)==null||d.set(l,m),a=m}})}else{let c=r.categories;if(o.children.has(c)){let a=o.children.get(c);a.total+=1,a.posts.push(r)}else o.children.set(c,{total:1,posts:[r]})}else s.total+=1,s.posts.push(r)}),s.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}_chunkQIXBXHEKjs.i.call(void 0, );var _tinycolor = require('@ctrl/tinycolor');function Gt(t={primary:"#0078E7"}){let e=Y(),o=new (0, _tinycolor.TinyColor)("#999999"),s=new (0, _tinycolor.TinyColor)(t.primary);return{tags:e,getTagStyle:r=>{let c=Array.from(e).map(([h,d])=>d.count),a=Math.max(...c),l=Math.min(...c),u=a-l,p=(r-l)/u;return{"--yun-tag-color":o.mix(s,p*100).toString(),fontSize:`${p*36+12}px`}}}}function Y(){let t=g(),e=new Map;return t.value.forEach(o=>{if(o.tags){let s;typeof o.tags=="string"?s=[o.tags]:s=o.tags,s.forEach(i=>{if(e.has(i)){let r=e.get(i);e.set(i,_chunkQIXBXHEKjs.b.call(void 0, _chunkQIXBXHEKjs.a.call(void 0, {},r),{count:r.count+1}))}else e.set(i,{count:1})})}}),e}_chunkQIXBXHEKjs.i.call(void 0, );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=y(),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)}_chunkQIXBXHEKjs.i.call(void 0, );_chunkQIXBXHEKjs.i.call(void 0, );var _head = require('@vueuse/head');function ie(){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"}]})}_chunkQIXBXHEKjs.i.call(void 0, );function pe(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)}}}_chunkQIXBXHEKjs.i.call(void 0, );var X=_core.useDark.call(void 0, ),he= exports.toggleDark =_core.useToggle.call(void 0, X);_chunkQIXBXHEKjs.i.call(void 0, );function ve(t){let e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>e.meta.layout===t)}_chunkQIXBXHEKjs.i.call(void 0, );_chunkQIXBXHEKjs.i.call(void 0, );function Pe(){_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")})}_chunkQIXBXHEKjs.i.call(void 0, );function Ee(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)),s=_vue.computed.call(void 0, ()=>e.value>t.offset);return{percentage:o,show:s}}_chunkQIXBXHEKjs.i.call(void 0, );function ke(){_head.useHead.call(void 0, {script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}_chunkQIXBXHEKjs.i.call(void 0, );function Ue(t,e){let o=lt(s,200);function s(){let a=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),l=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(u=>a.some(p=>p.hash===u.hash));for(let u=0;u<l.length;u++){let p=l[u],h=l[u+1],[d,m]=at(u,p,h);if(d){history.replaceState(null,document.title,m||" "),r(m);return}}}let i=null;function r(a){c(i);let l=i=a==null?null:t.value.querySelector(`.va-toc a[href="${a}"]`);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 c(a){a&&a.classList.remove("active")}_vue.onMounted.call(void 0, ()=>{requestAnimationFrame(s),window.addEventListener("scroll",o)}),_vue.onUnmounted.call(void 0, ()=>{window.removeEventListener("scroll",o)})}function R(t){return t.parentElement.offsetTop-50}function at(t,e,o){let s=window.scrollY;return t===0&&s===0?[!0,null]:s<R(e)?[!1,null]:!o||s<R(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function lt(t,e){let o,s=!1;return()=>{o&&clearTimeout(o),s?o=setTimeout(t,e):(t(),s=!0,setTimeout(()=>{s=!1},e))}}_chunkQIXBXHEKjs.i.call(void 0, );_chunkQIXBXHEKjs.i.call(void 0, );function Ne(t={}){let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, );function s(i={}){if(!_core.isClient)return;let r={el:".comment #tcomment",lang:o.value,path:e.path},c=Object.assign(r,i);return window.twikoo.init(c)}_core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{s(t)})}_chunkQIXBXHEKjs.i.call(void 0, );function Je(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, ),s;function i(r={}){if(!_core.isClient)return;let c={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},a=Object.assign(c,r);return window.Waline.init(a)}return _core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/@waline/client/dist/waline.js",()=>{s=i(t)}),_vue.watch.call(void 0, ()=>e.path,r=>{!s||s.update({path:r})}),_vue.watch.call(void 0, o,r=>{!s||s.update({lang:r})}),_vue.onUnmounted.call(void 0, ()=>{!s||s.destroy()}),s}exports.defaultValaxyConfig = _chunkQIXBXHEKjs.j; exports.formatDate = Mt; exports.initConfig = Tt; exports.isDark = X; exports.isParentCategory = $t; exports.random = bt; exports.sortByDate = x; exports.toggleDark = he; exports.useActiveSidebarLinks = Ue; exports.useAplayer = Pe; exports.useBackToTop = Ee; exports.useCategory = Ft; exports.useCodePen = ke; exports.useConfig = y; exports.useFrontmatter = oe; exports.useFullUrl = re; exports.useInvisibleElement = pe; exports.useKatex = ie; exports.useLayout = ve; exports.usePageList = Bt; exports.usePostList = g; exports.usePostProperty = It; exports.usePostTitle = qt; exports.usePrevNext = zt; exports.useTag = Y; exports.useTags = Gt; exports.useThemeConfig = b; exports.useTwikoo = Ne; exports.useWaline = Je; exports.valaxyConfigRef = P; exports.valaxyConfigSymbol = q; exports.wrap = B; exports.wrapTable = jt;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkV3BMKLEWjs = require('./chunk-V3BMKLEW.js');var _config = require('@valaxyjs/config'); var _config2 = _interopRequireDefault(_config);var _vue = require('vue');function C(t){let e=JSON.parse(t);return import.meta.env.DEV?_vue.readonly.call(void 0, e):e}var U=Symbol("valaxy:config"),T= exports.valaxyConfigRef =_vue.shallowRef.call(void 0, C(_config2.default));import.meta.hot&&import.meta.hot.accept("/@valaxyjs/config",t=>{T.value=C(t.default)});function Ct(){return _vue.computed.call(void 0, ()=>T.value)}function g(){let t=_vue.inject.call(void 0, U);if(!t)throw new Error("[Valaxy] config not properly injected in qpp");return t}function P(){let t=g();return _vue.computed.call(void 0, ()=>t.value.themeConfig)}var _vuerouter = require('vue-router');var _vuei18n = require('vue-i18n');function Pt(t,e){return Math.random()*(e-t)+t}function q(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var bt=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",q(e,"table-container")})};var _dayjs = require('dayjs'); var _dayjs2 = _interopRequireDefault(_dayjs);function Et(t,e="YYYY-MM-DD"){return _dayjs2.default.call(void 0, t).format(e)}function y(t,e=!0){return t.sort((o,n)=>{let s=+new Date(o.date||""),r=+new Date(n.date||"");return e?r-s:s-r})}var 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 h(t={}){let e=_vuerouter.useRouter.call(void 0, );return _vue.computed.call(void 0, ()=>{let o=e.getRoutes().filter(r=>r.path.startsWith("/posts")&&r.meta.frontmatter&&r.meta.frontmatter.date).filter(r=>!r.path.endsWith(".html")).filter(r=>!t.type||r.meta.frontmatter.type===t.type).map(r=>Object.assign({path:r.path,excerpt:r.meta.excerpt},r.meta.frontmatter)),n=y(o.filter(r=>r.top)).sort((r,l)=>l.top-r.top),s=y(o.filter(r=>!r.top));return n.concat(s)})}function qt(){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=h(),s=_vue.computed.call(void 0, ()=>{let i=-1;return n.value.find((a,c)=>a.path===o.value?(i=c,!0):!1),i}),r=_vue.computed.call(void 0, ()=>s.value-1>=0?n.value[s.value-1]:null),l=_vue.computed.call(void 0, ()=>s.value+1<n.value.length?n.value[s.value+1]:null);return[r,l]}function zt(t){if(!t)return{color:"",icon:"",styles:{}};let e=P();t in e.value.types||(t="link");let o=e.value.types[t].color,n=e.value.types[t].icon,s=_vue.computed.call(void 0, ()=>({"--card-c-primary":t&&o}));return{color:o,icon:n,styles:s}}var Yt=t=>t.children;function $t(t,e=[]){var s;e.length||(e=_vue.unref.call(void 0, h()));let o={total:e.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},n=o.children.get("Uncategorized");if(e.forEach(r=>{if(r.categories)if(Array.isArray(r.categories)){let l=r.categories.length,i=o;r.categories.forEach((a,c)=>{var m,d,f;if(c===l-1)if(i.children.has(a)){let u=i.children.get(a);u.posts&&(u.total+=1,u.posts.push(r))}else(m=i.children)==null||m.set(a,{total:1,posts:[r]});else if((d=i.children)!=null&&d.has(a)){let u=i.children.get(a);u.total+=1,i=u}else{let u={total:1,children:new Map};(f=i.children)==null||f.set(a,u),i=u}})}else{let l=r.categories;if(o.children.has(l)){let i=o.children.get(l);i.total+=1,i.posts.push(r)}else o.children.set(l,{total:1,posts:[r]})}else n.total+=1,n.posts.push(r)}),n.total===0&&((s=o.children)==null||s.delete("Uncategorized")),t){let r=o.children.get(t);return r?{total:r==null?void 0:r.total,children:new Map([[t,r]])}:(console.warn(`Do not have category: ${t}`),o)}else return o}var _tinycolor = require('@ctrl/tinycolor');function Jt(t={primary:"#0078E7"}){let e=W(),o=new (0, _tinycolor.TinyColor)("#999999"),n=new (0, _tinycolor.TinyColor)(t.primary);return{tags:e,getTagStyle:r=>{let l=Array.from(e).map(([d,f])=>f.count),i=Math.max(...l),a=Math.min(...l),c=i-a,m=(r-a)/c;return{"--yun-tag-color":o.mix(n,m*100).toString(),fontSize:`${m*36+12}px`}}}}function W(){let t=h(),e=new Map;return t.value.forEach(o=>{if(o.tags){let n;typeof o.tags=="string"?n=[o.tags]:n=o.tags,n.forEach(s=>{if(e.has(s)){let r=e.get(s);e.set(s,_chunkV3BMKLEWjs.b.call(void 0, _chunkV3BMKLEWjs.a.call(void 0, {},r),{count:r.count+1}))}else e.set(s,{count:1})})}}),e}var _core = require('@vueuse/core');function ee(){let t=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>t.meta.frontmatter)}function oe(){let t=g(),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)}var _head = require('@vueuse/head');function se(){_head.useHead.call(void 0, {link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"}]})}function me(t){let e=_vue.ref.call(void 0, !1),{top:o}=_core.useElementBounding.call(void 0, t);return _core.useIntersectionObserver.call(void 0, t,([{isIntersecting:s}])=>{e.value=s}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}var Q=_core.useDark.call(void 0, ),de= exports.toggleDark =_core.useToggle.call(void 0, Q);function xe(t){let e=_vuerouter.useRoute.call(void 0, );return _vue.computed.call(void 0, ()=>e.meta.layout===t)}function Te(){_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 Le(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 Ve(t,e){let o=at(n,200);function n(){let i=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),a=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(c=>i.some(m=>m.hash===c.hash));for(let c=0;c<a.length;c++){let m=a[c],d=a[c+1],[f,u]=it(c,m,d);if(f){history.replaceState(null,document.title,u||" "),r(u);return}}}let s=null;function r(i){l(s);let a=s=i==null?null:t.value.querySelector(`.va-toc a[href="${i}"]`);e.value&&(a?(a.classList.add("active"),e.value.style.opacity="1",e.value.style.top=`${a.offsetTop+2}px`):(e.value.style.opacity="0",e.value.style.top="54px"))}function l(i){i&&i.classList.remove("active")}_vue.onMounted.call(void 0, ()=>{requestAnimationFrame(n),window.addEventListener("scroll",o)}),_vue.onUnmounted.call(void 0, ()=>{window.removeEventListener("scroll",o)})}function H(t){return t.parentElement.offsetTop-50}function it(t,e,o){let n=window.scrollY;return t===0&&n===0?[!0,null]:n<H(e)?[!1,null]:!o||n<H(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function at(t,e){let o,n=!1;return()=>{o&&clearTimeout(o),n?o=setTimeout(t,e):(t(),n=!0,setTimeout(()=>{n=!1},e))}}function Ie(t={}){let e=_vuerouter.useRoute.call(void 0, ),{locale:o}=_vuei18n.useI18n.call(void 0, );function n(s={}){if(!_core.isClient)return;let r={el:".comment #tcomment",lang:o.value,path:e.path},l=Object.assign(r,s);return window.twikoo.init(l)}_core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{n(t)})}function _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 s(r={}){if(!_core.isClient)return;let l={el:".comment #waline",lang:o.value,dark:"html.dark",emoji:["https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/qq","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo"],path:e.path},i=Object.assign(l,r);return window.Waline.init(i)}return _core.useScriptTag.call(void 0, "//cdn.jsdelivr.net/npm/@waline/client/dist/waline.js",()=>{n=s(t)}),_vue.watch.call(void 0, ()=>e.path,r=>{!n||n.update({path:r})}),_vue.watch.call(void 0, o,r=>{!n||n.update({lang:r})}),_vue.onUnmounted.call(void 0, ()=>{!n||n.destroy()}),n}exports.defaultValaxyConfig = _chunkV3BMKLEWjs.f; exports.formatDate = Et; exports.initConfig = Ct; exports.isDark = Q; exports.isParentCategory = Yt; exports.random = Pt; exports.sortByDate = y; exports.toggleDark = de; exports.useActiveSidebarLinks = Ve; exports.useAplayer = Te; exports.useBackToTop = Le; exports.useCategory = $t; exports.useCodePen = Ae; exports.useConfig = g; exports.useFrontmatter = ee; exports.useFullUrl = oe; exports.useInvisibleElement = me; exports.useKatex = se; exports.useLayout = xe; exports.usePageList = qt; exports.usePostList = h; exports.usePostProperty = zt; exports.usePostTitle = Ut; exports.usePrevNext = Bt; exports.useTag = W; exports.useTags = Jt; exports.useThemeConfig = P; exports.useTwikoo = Ie; exports.useWaline = _e; exports.valaxyConfigRef = T; exports.valaxyConfigSymbol = U; exports.wrap = q; exports.wrapTable = bt;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as x,b as v,f as xt}from"./chunk-6LIOFBAA.mjs";import S from"@valaxyjs/config";import{computed as w,inject as D,readonly as O,shallowRef as V}from"vue";function C(t){let e=JSON.parse(t);return import.meta.env.DEV?O(e):e}var U=Symbol("valaxy:config"),T=V(C(S));import.meta.hot&&import.meta.hot.accept("/@valaxyjs/config",t=>{T.value=C(t.default)});function Ct(){return w(()=>T.value)}function g(){let t=D(U);if(!t)throw new Error("[Valaxy] config not properly injected in qpp");return t}function P(){let t=g();return w(()=>t.value.themeConfig)}import{unref as N}from"vue";import{computed as p}from"vue";import{useRoute as z,useRouter as b}from"vue-router";import{useI18n as I}from"vue-i18n";function Pt(t,e){return Math.random()*(e-t)+t}function q(t,e){let o=document.createElement("div");o.className=e,t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),o.appendChild(t)}var bt=(t=document)=>{t.querySelectorAll("table").forEach(e=>{let o=document.createElement("div");o.className="table-container",q(e,"table-container")})};import B from"dayjs";function Et(t,e="YYYY-MM-DD"){return B(t).format(e)}function y(t,e=!0){return t.sort((o,n)=>{let s=+new Date(o.date||""),r=+new Date(n.date||"");return e?r-s:s-r})}var Ut=t=>{let{locale:e}=I();return p(()=>{let o=e.value==="zh-CN"?"zh":e.value;return t.value[`title_${o}`]||t.value.title})};function h(t={}){let e=b();return p(()=>{let o=e.getRoutes().filter(r=>r.path.startsWith("/posts")&&r.meta.frontmatter&&r.meta.frontmatter.date).filter(r=>!r.path.endsWith(".html")).filter(r=>!t.type||r.meta.frontmatter.type===t.type).map(r=>Object.assign({path:r.path,excerpt:r.meta.excerpt},r.meta.frontmatter)),n=y(o.filter(r=>r.top)).sort((r,l)=>l.top-r.top),s=y(o.filter(r=>!r.top));return n.concat(s)})}function qt(){let t=b();return p(()=>t.getRoutes().map(o=>Object.assign({path:o.path,excerpt:o.meta.excerpt},o.meta.frontmatter)))}function Bt(t){let e=z(),o=p(()=>t||e.path),n=h(),s=p(()=>{let i=-1;return n.value.find((a,c)=>a.path===o.value?(i=c,!0):!1),i}),r=p(()=>s.value-1>=0?n.value[s.value-1]:null),l=p(()=>s.value+1<n.value.length?n.value[s.value+1]:null);return[r,l]}function zt(t){if(!t)return{color:"",icon:"",styles:{}};let e=P();t in e.value.types||(t="link");let o=e.value.types[t].color,n=e.value.types[t].icon,s=p(()=>({"--card-c-primary":t&&o}));return{color:o,icon:n,styles:s}}var Yt=t=>t.children;function $t(t,e=[]){var s;e.length||(e=N(h()));let o={total:e.length,children:new Map([["Uncategorized",{total:0,posts:[]}]])},n=o.children.get("Uncategorized");if(e.forEach(r=>{if(r.categories)if(Array.isArray(r.categories)){let l=r.categories.length,i=o;r.categories.forEach((a,c)=>{var m,d,f;if(c===l-1)if(i.children.has(a)){let u=i.children.get(a);u.posts&&(u.total+=1,u.posts.push(r))}else(m=i.children)==null||m.set(a,{total:1,posts:[r]});else if((d=i.children)!=null&&d.has(a)){let u=i.children.get(a);u.total+=1,i=u}else{let u={total:1,children:new Map};(f=i.children)==null||f.set(a,u),i=u}})}else{let l=r.categories;if(o.children.has(l)){let i=o.children.get(l);i.total+=1,i.posts.push(r)}else o.children.set(l,{total:1,posts:[r]})}else n.total+=1,n.posts.push(r)}),n.total===0&&((s=o.children)==null||s.delete("Uncategorized")),t){let r=o.children.get(t);return r?{total:r==null?void 0:r.total,children:new Map([[t,r]])}:(console.warn(`Do not have category: ${t}`),o)}else return o}import{TinyColor as j}from"@ctrl/tinycolor";function Jt(t={primary:"#0078E7"}){let e=W(),o=new j("#999999"),n=new j(t.primary);return{tags:e,getTagStyle:r=>{let l=Array.from(e).map(([d,f])=>f.count),i=Math.max(...l),a=Math.min(...l),c=i-a,m=(r-a)/c;return{"--yun-tag-color":o.mix(n,m*100).toString(),fontSize:`${m*36+12}px`}}}}function W(){let t=h(),e=new Map;return t.value.forEach(o=>{if(o.tags){let n;typeof o.tags=="string"?n=[o.tags]:n=o.tags,n.forEach(s=>{if(e.has(s)){let r=e.get(s);e.set(s,v(x({},r),{count:r.count+1}))}else e.set(s,{count:1})})}}),e}import{useRoute as L}from"vue-router";import{computed as E}from"vue";import{isClient as Y}from"@vueuse/core";function ee(){let t=L();return E(()=>t.meta.frontmatter)}function oe(){let t=g(),e=L();return E(()=>((t.value.url.endsWith("/")?t.value.url.slice(0,-1):t.value.url)||Y&&window.location.origin)+e.path)}import{useHead as $}from"@vueuse/head";function se(){$({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"}]})}import{useElementBounding as F,useIntersectionObserver as K}from"@vueuse/core";import{ref as _}from"vue";function me(t){let e=_(!1),{top:o}=F(t);return K(t,([{isIntersecting:s}])=>{e.value=s}),{show:()=>{e.value||window.scrollTo(0,o.value)}}}import{useDark as J,useToggle as G}from"@vueuse/core";var Q=J(),de=G(Q);import{computed as X}from"vue";import{useRoute as Z}from"vue-router";function xe(t){let e=Z();return X(()=>e.meta.layout===t)}import{useScriptTag as M}from"@vueuse/core";import{useHead as tt}from"@vueuse/head";function Te(){tt({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"}]}),M("https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js",()=>{M("https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js")})}import{isClient as et,useWindowScroll as ot}from"@vueuse/core";import{computed as A,ref as k}from"vue";function Le(t={offset:100}){if(!et)return{percentage:k(0),show:k(!1)};let{y:e}=ot(),o=A(()=>e.value/(document.body.scrollHeight-window.innerHeight)),n=A(()=>e.value>t.offset);return{percentage:o,show:n}}import{useHead as rt}from"@vueuse/head";function Ae(){rt({script:[{src:"https://static.codepen.io/assets/embed/ei.js",async:!0}]})}import{onMounted as nt,onUnmounted as st}from"vue";function Ve(t,e){let o=at(n,200);function n(){let i=[].slice.call(document.querySelectorAll(".va-toc a.toc-link-item")),a=[].slice.call(document.querySelectorAll("main .header-anchor")).filter(c=>i.some(m=>m.hash===c.hash));for(let c=0;c<a.length;c++){let m=a[c],d=a[c+1],[f,u]=it(c,m,d);if(f){history.replaceState(null,document.title,u||" "),r(u);return}}}let s=null;function r(i){l(s);let a=s=i==null?null:t.value.querySelector(`.va-toc a[href="${i}"]`);e.value&&(a?(a.classList.add("active"),e.value.style.opacity="1",e.value.style.top=`${a.offsetTop+2}px`):(e.value.style.opacity="0",e.value.style.top="54px"))}function l(i){i&&i.classList.remove("active")}nt(()=>{requestAnimationFrame(n),window.addEventListener("scroll",o)}),st(()=>{window.removeEventListener("scroll",o)})}function H(t){return t.parentElement.offsetTop-50}function it(t,e,o){let n=window.scrollY;return t===0&&n===0?[!0,null]:n<H(e)?[!1,null]:!o||n<H(o)?[!0,decodeURIComponent(e.hash)]:[!1,null]}function at(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 lt,useScriptTag as ct}from"@vueuse/core";import{useI18n as ut}from"vue-i18n";import{useRoute as mt}from"vue-router";function Ie(t={}){let e=mt(),{locale:o}=ut();function n(s={}){if(!lt)return;let r={el:".comment #tcomment",lang:o.value,path:e.path},l=Object.assign(r,s);return window.twikoo.init(l)}ct("//cdn.jsdelivr.net/npm/twikoo@1.5.1/dist/twikoo.all.min.js",()=>{n(t)})}import{isClient as pt,useScriptTag as ft}from"@vueuse/core";import{useHead as dt}from"@vueuse/head";import{onUnmounted as ht,watch as R}from"vue";import{useI18n as gt}from"vue-i18n";import{useRoute as yt}from"vue-router";function _e(t={}){dt({link:[{rel:"stylesheet",href:"https://cdn.jsdelivr.net/npm/@waline/client/dist/waline.css"}]});let e=yt(),{locale:o}=gt(),n;function s(r={}){if(!pt)return;let l={el:".comment #waline",lang:o.value,dark:"html.dark",emoji:["https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/qq","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo"],path:e.path},i=Object.assign(l,r);return window.Waline.init(i)}return ft("//cdn.jsdelivr.net/npm/@waline/client/dist/waline.js",()=>{n=s(t)}),R(()=>e.path,r=>{!n||n.update({path:r})}),R(o,r=>{!n||n.update({lang:r})}),ht(()=>{!n||n.destroy()}),n}export{xt as defaultValaxyConfig,Et as formatDate,Ct as initConfig,Q as isDark,Yt as isParentCategory,Pt as random,y as sortByDate,de as toggleDark,Ve as useActiveSidebarLinks,Te as useAplayer,Le as useBackToTop,$t as useCategory,Ae as useCodePen,g as useConfig,ee as useFrontmatter,oe as useFullUrl,me as useInvisibleElement,se as useKatex,xe as useLayout,qt as usePageList,h as usePostList,zt as usePostProperty,Ut as usePostTitle,Bt as usePrevNext,W as useTag,Jt as useTags,P as useThemeConfig,Ie as useTwikoo,_e as useWaline,T as valaxyConfigRef,U as valaxyConfigSymbol,q as wrap,bt as wrapTable};
|