🌟构建了简易的blog

This commit is contained in:
Falck
2026-04-10 20:00:25 +08:00
parent 4eaf10e753
commit c38d2f66d1
238 changed files with 30052 additions and 11 deletions

View File

@@ -0,0 +1,2 @@
import{o as ht,i as bt}from"./lifecycle.MLiOCzKC.js";import{f as j,t as C,a as p,p as wt,b as gt,g as o,e as f,s as g,d as L,h as d,i as _,r as l,c as F,n as G}from"./template.CyUWgh-J.js";import{s as A}from"./render.C4NccAY7.js";import{i as x}from"./functions.LP-DBi81.js";import{e as J,i as Q}from"./each.DMYtlFB3.js";import{e as S}from"./utils.DonxBMOE.js";import{a as _t}from"./props.h8jPqBEd.js";import{I as y}from"./Icon.DAqWeDJZ.js";import{I as U}from"./zh_TW.CqrCsd4X.js";import{i as W}from"./translation.BRy61wHY.js";import{n as xt}from"./navigation-utils.Cc6bKnia.js";/* empty css */import"./config.B4FKKqOZ.js";var yt=f('<div class="text-center py-8 text-black/50 dark:text-white/50"><!> <p>暂无文章</p></div>'),It=f('<div class="post-category svelte-cz3h3s"> </div>'),kt=f('<button class="post-item svelte-cz3h3s"><div class="post-title svelte-cz3h3s"><!> </div> <!></button>'),Tt=f('<div class="post-content svelte-cz3h3s"></div>'),Et=f('<div class="text-center py-8 text-black/50 dark:text-white/50"><!> <p>当前页面没有目录</p></div>'),Ct=f('<button><span class="toc-text svelte-cz3h3s"> </span></button>'),Lt=f('<div class="toc-content svelte-cz3h3s"></div>'),At=f(`<button aria-label="Table of Contents" id="mobile-toc-switch" class="btn-plain scale-animation rounded-lg h-11 w-11 active:scale-90 lg:!hidden"><!></button> <div id="mobile-toc-panel" class="float-panel float-panel-closed mobile-toc-panel absolute md:w-[20rem] w-[calc(100vw-2rem)]
top-20 left-4 md:left-[unset] right-4 shadow-2xl rounded-2xl p-4 svelte-cz3h3s"><div class="flex items-center justify-between mb-4"><h3 class="text-lg font-bold text-[var(--primary)]"> </h3> <button aria-label="Close TOC" class="btn-plain rounded-lg h-8 w-8 active:scale-90"><!></button></div> <!></div>`,1);function Yt(X,Z){gt(Z,!1);let z=L([]),P=L([]),I=L(""),h,k=L(!1),T=!1;const K=()=>{document.getElementById("mobile-toc-panel")?.classList.toggle("float-panel-closed")},R=t=>{const e=document.getElementById("mobile-toc-panel");e&&e.classList.add("float-panel-closed")},$=()=>{const t=document.querySelectorAll("h1, h2, h3, h4, h5, h6"),e=[];t.forEach(a=>{if(a.id){const i=Number.parseInt(a.tagName.charAt(1)),v=a.textContent?.trim()||"";e.push({id:a.id,text:v,level:i})}}),g(z,e)},tt=()=>{const t=document.querySelectorAll(".card-base"),e=[];t.forEach(a=>{const i=a.querySelector('a[href*="/posts/"].transition.group'),v=a.querySelector('a[href*="/categories/"].link-lg'),n=i?.querySelector('svg[data-icon="mdi:pin"]');if(i){const s=i.getAttribute("href"),m=i.textContent?.replace(/\s+/g," ").trim()||"",r=v?.textContent?.trim()||"",c=!!n;s&&m&&e.push({title:m,url:s,category:r,pinned:c})}}),g(P,e)},et=()=>{g(k,window.location.pathname==="/"||window.location.pathname==="")},ot=t=>{const e=document.getElementById(t);if(e){R();const i=e.offsetTop-80;window.scrollTo({top:i,behavior:"smooth"})}},st=t=>{R(),xt(t)},q=()=>{const t=document.querySelectorAll("h1, h2, h3, h4, h5, h6"),e=window.scrollY,a=100;let i="";t.forEach(v=>{if(v.id){const n=v.offsetTop-a;e>=n&&(i=v.id)}}),g(I,i)},at=()=>{const t=document.querySelectorAll("h1, h2, h3, h4, h5, h6");h&&h.disconnect(),h=new IntersectionObserver(e=>{e.forEach(a=>{a.isIntersecting&&g(I,a.target.id)})},{rootMargin:"-80px 0px -80% 0px",threshold:0}),t.forEach(e=>{e.id&&h.observe(e)})},nt=()=>{if(typeof window<"u"&&(T=!!window.swup,!T)){const t=()=>{window.swup&&(T=!0,document.removeEventListener("swup:enable",t))};document.addEventListener("swup:enable",t),setTimeout(()=>{window.swup&&(T=!0,document.removeEventListener("swup:enable",t))},1e3)}},V=()=>{et(),nt(),o(k)?tt():($(),at(),q())};ht(()=>(setTimeout(V,100),window.addEventListener("scroll",q),()=>{h&&h.disconnect(),window.removeEventListener("scroll",q)})),typeof window<"u"&&(window.mobileTOCInit=V),bt();var Y=At(),E=j(Y),it=d(E);y(it,{icon:"material-symbols:format-list-bulleted",class:"text-[1.25rem]"}),l(E);var D=_(E,2),O=d(D),H=d(O),lt=d(H,!0);l(H);var B=_(H,2),rt=d(B);y(rt,{icon:"material-symbols:close",class:"text-[1rem]"}),l(B),l(O);var ct=_(O,2);{var dt=t=>{var e=F(),a=j(e);{var i=n=>{var s=yt(),m=d(s);y(m,{icon:"material-symbols:article-outline",class:"text-2xl mb-2"}),G(2),l(s),p(n,s)},v=n=>{var s=Tt();J(s,5,()=>o(P),Q,(m,r)=>{var c=kt(),b=d(c),w=d(b);{var M=u=>{y(u,{icon:"mdi:pin",class:"pinned-icon"})};x(w,u=>{o(r).pinned&&u(M)})}var mt=_(w);l(b);var pt=_(b,2);{var ft=u=>{var N=It(),ut=d(N,!0);l(N),C(()=>A(ut,o(r).category)),p(u,N)};x(pt,u=>{o(r).category&&u(ft)})}l(c),C(()=>A(mt,` ${o(r).title??""}`)),S("click",c,()=>st(o(r).url)),p(m,c)}),l(s),p(n,s)};x(a,n=>{o(P).length===0?n(i):n(v,-1)})}p(t,e)},vt=t=>{var e=F(),a=j(e);{var i=n=>{var s=Et(),m=d(s);y(m,{icon:"material-symbols:article-outline",class:"text-2xl mb-2"}),G(2),l(s),p(n,s)},v=n=>{var s=Lt();J(s,5,()=>o(z),Q,(m,r)=>{var c=Ct();let b;var w=d(c),M=d(w,!0);l(w),l(c),C(()=>{b=_t(c,1,`toc-item level-${o(r).level??""} ${o(I)===o(r).id?"active":""}`,"svelte-cz3h3s",b,{active:o(I)===o(r).id}),A(M,o(r).text)}),S("click",c,()=>ot(o(r).id)),p(m,c)}),l(s),p(n,s)};x(a,n=>{o(z).length===0?n(i):n(v,-1)})}p(t,e)};x(ct,t=>{o(k)?t(dt):t(vt,-1)})}l(D),C(t=>A(lt,t),[()=>o(k)?W(U.postList):W(U.tableOfContents)]),S("click",E,K),S("click",B,K),p(X,Y),wt()}export{Yt as default};