From dc8245b9a9f83546ea3ba00ae995d84ccfb84e28 Mon Sep 17 00:00:00 2001 From: lan-yonghui Date: Thu, 14 Sep 2023 18:10:52 +0800 Subject: [PATCH] refactor: Optimize article pages --- templates/assets/dist/main.iife.js | 6 +++--- templates/assets/dist/style.css | 2 +- templates/post.html | 30 +++++++++++++++++------------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/templates/assets/dist/main.iife.js b/templates/assets/dist/main.iife.js index 08aed38..f40dcc9 100644 --- a/templates/assets/dist/main.iife.js +++ b/templates/assets/dist/main.iife.js @@ -1,8 +1,8 @@ -var main=function(M){"use strict";const el="",tl="";var Qe=!1,Ze=!1,V=[];function Ni(e){Pi(e)}function Pi(e){V.includes(e)||V.push(e),Ii()}function gr(e){let t=V.indexOf(e);t!==-1&&V.splice(t,1)}function Ii(){!Ze&&!Qe&&(Qe=!0,queueMicrotask(ki))}function ki(){Qe=!1,Ze=!0;for(let e=0;ee.effect(t,{scheduler:r=>{et?Ni(r):r()}}),_r=e.raw}function yr(e){re=e}function qi(e){let t=()=>{};return[i=>{let n=re(i);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(s=>s())}),e._x_effects.add(n),t=()=>{n!==void 0&&(e._x_effects.delete(n),pe(n))},n},()=>{t()}]}var br=[],xr=[],Er=[];function $i(e){Er.push(e)}function wr(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,xr.push(t))}function Di(e){br.push(e)}function Fi(e,t,r){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(r)}function Sr(e,t){!e._x_attributeCleanups||Object.entries(e._x_attributeCleanups).forEach(([r,i])=>{(t===void 0||t.includes(r))&&(i.forEach(n=>n()),delete e._x_attributeCleanups[r])})}var tt=new MutationObserver(at),rt=!1;function nt(){tt.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),rt=!0}function Cr(){Bi(),tt.disconnect(),rt=!1}var me=[],it=!1;function Bi(){me=me.concat(tt.takeRecords()),me.length&&!it&&(it=!0,queueMicrotask(()=>{Hi(),it=!1}))}function Hi(){at(me),me.length=0}function A(e){if(!rt)return e();Cr();let t=e();return nt(),t}var st=!1,Ae=[];function Ui(){st=!0}function zi(){st=!1,at(Ae),Ae=[]}function at(e){if(st){Ae=Ae.concat(e);return}let t=[],r=[],i=new Map,n=new Map;for(let s=0;sa.nodeType===1&&t.push(a)),e[s].removedNodes.forEach(a=>a.nodeType===1&&r.push(a))),e[s].type==="attributes")){let a=e[s].target,o=e[s].attributeName,l=e[s].oldValue,u=()=>{i.has(a)||i.set(a,[]),i.get(a).push({name:o,value:a.getAttribute(o)})},c=()=>{n.has(a)||n.set(a,[]),n.get(a).push(o)};a.hasAttribute(o)&&l===null?u():a.hasAttribute(o)?(c(),u()):c()}n.forEach((s,a)=>{Sr(a,s)}),i.forEach((s,a)=>{br.forEach(o=>o(a,s))});for(let s of r)if(!t.includes(s)&&(xr.forEach(a=>a(s)),s._x_cleanups))for(;s._x_cleanups.length;)s._x_cleanups.pop()();t.forEach(s=>{s._x_ignoreSelf=!0,s._x_ignore=!0});for(let s of t)r.includes(s)||!s.isConnected||(delete s._x_ignoreSelf,delete s._x_ignore,Er.forEach(a=>a(s)),s._x_ignore=!0,s._x_ignoreSelf=!0);t.forEach(s=>{delete s._x_ignoreSelf,delete s._x_ignore}),t=null,r=null,i=null,n=null}function Ar(e){return ge(ne(e))}function ve(e,t,r){return e._x_dataStack=[t,...ne(r||e)],()=>{e._x_dataStack=e._x_dataStack.filter(i=>i!==t)}}function Or(e,t){let r=e._x_dataStack[0];Object.entries(t).forEach(([i,n])=>{r[i]=n})}function ne(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?ne(e.host):e.parentNode?ne(e.parentNode):[]}function ge(e){let t=new Proxy({},{ownKeys:()=>Array.from(new Set(e.flatMap(r=>Object.keys(r)))),has:(r,i)=>e.some(n=>n.hasOwnProperty(i)),get:(r,i)=>(e.find(n=>{if(n.hasOwnProperty(i)){let s=Object.getOwnPropertyDescriptor(n,i);if(s.get&&s.get._x_alreadyBound||s.set&&s.set._x_alreadyBound)return!0;if((s.get||s.set)&&s.enumerable){let a=s.get,o=s.set,l=s;a=a&&a.bind(t),o=o&&o.bind(t),a&&(a._x_alreadyBound=!0),o&&(o._x_alreadyBound=!0),Object.defineProperty(n,i,{...l,get:a,set:o})}return!0}return!1})||{})[i],set:(r,i,n)=>{let s=e.find(a=>a.hasOwnProperty(i));return s?s[i]=n:e[e.length-1][i]=n,!0}});return t}function Rr(e){let t=i=>typeof i=="object"&&!Array.isArray(i)&&i!==null,r=(i,n="")=>{Object.entries(Object.getOwnPropertyDescriptors(i)).forEach(([s,{value:a,enumerable:o}])=>{if(o===!1||a===void 0)return;let l=n===""?s:`${n}.${s}`;typeof a=="object"&&a!==null&&a._x_interceptor?i[s]=a.initialize(e,l,s):t(a)&&a!==i&&!(a instanceof Element)&&r(a,l)})};return r(e)}function Tr(e,t=()=>{}){let r={initialValue:void 0,_x_interceptor:!0,initialize(i,n,s){return e(this.initialValue,()=>Ki(i,n),a=>ot(i,n,a),n,s)}};return t(r),i=>{if(typeof i=="object"&&i!==null&&i._x_interceptor){let n=r.initialize.bind(r);r.initialize=(s,a,o)=>{let l=i.initialize(s,a,o);return r.initialValue=l,n(s,a,o)}}else r.initialValue=i;return r}}function Ki(e,t){return t.split(".").reduce((r,i)=>r[i],e)}function ot(e,t,r){if(typeof t=="string"&&(t=t.split(".")),t.length===1)e[t[0]]=r;else{if(t.length===0)throw error;return e[t[0]]||(e[t[0]]={}),ot(e[t[0]],t.slice(1),r)}}var Lr={};function j(e,t){Lr[e]=t}function lt(e,t){return Object.entries(Lr).forEach(([r,i])=>{Object.defineProperty(e,`$${r}`,{get(){let[n,s]=Mr(t);return n={interceptor:Tr,...n},wr(t,s),i(t,n)},enumerable:!1})}),e}function Wi(e,t,r,...i){try{return r(...i)}catch(n){_e(n,e,t)}}function _e(e,t,r=void 0){Object.assign(e,{el:t,expression:r}),console.warn(`Alpine Expression Error: ${e.message} +var main=function(M){"use strict";const el="",tl="";var Qe=!1,Ze=!1,V=[];function Li(e){Pi(e)}function Pi(e){V.includes(e)||V.push(e),Ii()}function gr(e){let t=V.indexOf(e);t!==-1&&V.splice(t,1)}function Ii(){!Ze&&!Qe&&(Qe=!0,queueMicrotask(ki))}function ki(){Qe=!1,Ze=!0;for(let e=0;ee.effect(t,{scheduler:r=>{et?Li(r):r()}}),_r=e.raw}function yr(e){re=e}function qi(e){let t=()=>{};return[i=>{let n=re(i);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(s=>s())}),e._x_effects.add(n),t=()=>{n!==void 0&&(e._x_effects.delete(n),pe(n))},n},()=>{t()}]}var br=[],xr=[],Er=[];function $i(e){Er.push(e)}function wr(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,xr.push(t))}function Di(e){br.push(e)}function Fi(e,t,r){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(r)}function Sr(e,t){!e._x_attributeCleanups||Object.entries(e._x_attributeCleanups).forEach(([r,i])=>{(t===void 0||t.includes(r))&&(i.forEach(n=>n()),delete e._x_attributeCleanups[r])})}var tt=new MutationObserver(at),rt=!1;function nt(){tt.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),rt=!0}function Cr(){Bi(),tt.disconnect(),rt=!1}var me=[],it=!1;function Bi(){me=me.concat(tt.takeRecords()),me.length&&!it&&(it=!0,queueMicrotask(()=>{Hi(),it=!1}))}function Hi(){at(me),me.length=0}function A(e){if(!rt)return e();Cr();let t=e();return nt(),t}var st=!1,Ae=[];function Ui(){st=!0}function zi(){st=!1,at(Ae),Ae=[]}function at(e){if(st){Ae=Ae.concat(e);return}let t=[],r=[],i=new Map,n=new Map;for(let s=0;sa.nodeType===1&&t.push(a)),e[s].removedNodes.forEach(a=>a.nodeType===1&&r.push(a))),e[s].type==="attributes")){let a=e[s].target,o=e[s].attributeName,l=e[s].oldValue,u=()=>{i.has(a)||i.set(a,[]),i.get(a).push({name:o,value:a.getAttribute(o)})},c=()=>{n.has(a)||n.set(a,[]),n.get(a).push(o)};a.hasAttribute(o)&&l===null?u():a.hasAttribute(o)?(c(),u()):c()}n.forEach((s,a)=>{Sr(a,s)}),i.forEach((s,a)=>{br.forEach(o=>o(a,s))});for(let s of r)if(!t.includes(s)&&(xr.forEach(a=>a(s)),s._x_cleanups))for(;s._x_cleanups.length;)s._x_cleanups.pop()();t.forEach(s=>{s._x_ignoreSelf=!0,s._x_ignore=!0});for(let s of t)r.includes(s)||!s.isConnected||(delete s._x_ignoreSelf,delete s._x_ignore,Er.forEach(a=>a(s)),s._x_ignore=!0,s._x_ignoreSelf=!0);t.forEach(s=>{delete s._x_ignoreSelf,delete s._x_ignore}),t=null,r=null,i=null,n=null}function Ar(e){return ge(ne(e))}function ve(e,t,r){return e._x_dataStack=[t,...ne(r||e)],()=>{e._x_dataStack=e._x_dataStack.filter(i=>i!==t)}}function Or(e,t){let r=e._x_dataStack[0];Object.entries(t).forEach(([i,n])=>{r[i]=n})}function ne(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?ne(e.host):e.parentNode?ne(e.parentNode):[]}function ge(e){let t=new Proxy({},{ownKeys:()=>Array.from(new Set(e.flatMap(r=>Object.keys(r)))),has:(r,i)=>e.some(n=>n.hasOwnProperty(i)),get:(r,i)=>(e.find(n=>{if(n.hasOwnProperty(i)){let s=Object.getOwnPropertyDescriptor(n,i);if(s.get&&s.get._x_alreadyBound||s.set&&s.set._x_alreadyBound)return!0;if((s.get||s.set)&&s.enumerable){let a=s.get,o=s.set,l=s;a=a&&a.bind(t),o=o&&o.bind(t),a&&(a._x_alreadyBound=!0),o&&(o._x_alreadyBound=!0),Object.defineProperty(n,i,{...l,get:a,set:o})}return!0}return!1})||{})[i],set:(r,i,n)=>{let s=e.find(a=>a.hasOwnProperty(i));return s?s[i]=n:e[e.length-1][i]=n,!0}});return t}function Rr(e){let t=i=>typeof i=="object"&&!Array.isArray(i)&&i!==null,r=(i,n="")=>{Object.entries(Object.getOwnPropertyDescriptors(i)).forEach(([s,{value:a,enumerable:o}])=>{if(o===!1||a===void 0)return;let l=n===""?s:`${n}.${s}`;typeof a=="object"&&a!==null&&a._x_interceptor?i[s]=a.initialize(e,l,s):t(a)&&a!==i&&!(a instanceof Element)&&r(a,l)})};return r(e)}function Tr(e,t=()=>{}){let r={initialValue:void 0,_x_interceptor:!0,initialize(i,n,s){return e(this.initialValue,()=>Ki(i,n),a=>ot(i,n,a),n,s)}};return t(r),i=>{if(typeof i=="object"&&i!==null&&i._x_interceptor){let n=r.initialize.bind(r);r.initialize=(s,a,o)=>{let l=i.initialize(s,a,o);return r.initialValue=l,n(s,a,o)}}else r.initialValue=i;return r}}function Ki(e,t){return t.split(".").reduce((r,i)=>r[i],e)}function ot(e,t,r){if(typeof t=="string"&&(t=t.split(".")),t.length===1)e[t[0]]=r;else{if(t.length===0)throw error;return e[t[0]]||(e[t[0]]={}),ot(e[t[0]],t.slice(1),r)}}var Nr={};function j(e,t){Nr[e]=t}function lt(e,t){return Object.entries(Nr).forEach(([r,i])=>{Object.defineProperty(e,`$${r}`,{get(){let[n,s]=Mr(t);return n={interceptor:Tr,...n},wr(t,s),i(t,n)},enumerable:!1})}),e}function Wi(e,t,r,...i){try{return r(...i)}catch(n){_e(n,e,t)}}function _e(e,t,r=void 0){Object.assign(e,{el:t,expression:r}),console.warn(`Alpine Expression Error: ${e.message} ${r?'Expression: "'+r+`" -`:""}`,t),setTimeout(()=>{throw e},0)}var Oe=!0;function Vi(e){let t=Oe;Oe=!1,e(),Oe=t}function ie(e,t,r={}){let i;return T(e,t)(n=>i=n,r),i}function T(...e){return Nr(...e)}var Nr=Pr;function Ji(e){Nr=e}function Pr(e,t){let r={};lt(r,e);let i=[r,...ne(e)];if(typeof t=="function")return Yi(i,t);let n=Gi(i,t,e);return Wi.bind(null,e,t,n)}function Yi(e,t){return(r=()=>{},{scope:i={},params:n=[]}={})=>{let s=t.apply(ge([i,...e]),n);Re(r,s)}}var ut={};function Xi(e,t){if(ut[e])return ut[e];let r=Object.getPrototypeOf(async function(){}).constructor,i=/^[\n\s]*if.*\(.*\)/.test(e)||/^(let|const)\s/.test(e)?`(async()=>{ ${e} })()`:e,s=(()=>{try{return new r(["__self","scope"],`with (scope) { __self.result = ${i} }; __self.finished = true; return __self.result;`)}catch(a){return _e(a,t,e),Promise.resolve()}})();return ut[e]=s,s}function Gi(e,t,r){let i=Xi(t,r);return(n=()=>{},{scope:s={},params:a=[]}={})=>{i.result=void 0,i.finished=!1;let o=ge([s,...e]);if(typeof i=="function"){let l=i(i,o).catch(u=>_e(u,r,t));i.finished?(Re(n,i.result,o,a,r),i.result=void 0):l.then(u=>{Re(n,u,o,a,r)}).catch(u=>_e(u,r,t)).finally(()=>i.result=void 0)}}}function Re(e,t,r,i,n){if(Oe&&typeof t=="function"){let s=t.apply(r,i);s instanceof Promise?s.then(a=>Re(e,a,r,i)).catch(a=>_e(a,n,t)):e(s)}else typeof t=="object"&&t instanceof Promise?t.then(s=>e(s)):e(t)}var ct="x-";function se(e=""){return ct+e}function Qi(e){ct=e}var ft={};function C(e,t){return ft[e]=t,{before(r){var n;if(!ft[r]){console.warn("Cannot find directive `${directive}`. `${name}` will use the default order of execution");return}const i=(n=J.indexOf(r))!=null?n:J.indexOf("DEFAULT");i>=0&&J.splice(i,0,e)}}}function dt(e,t,r){if(t=Array.from(t),e._x_virtualDirectives){let s=Object.entries(e._x_virtualDirectives).map(([o,l])=>({name:o,value:l})),a=Ir(s);s=s.map(o=>a.find(l=>l.name===o.name)?{name:`x-bind:${o.name}`,value:`"${o.value}"`}:o),t=t.concat(s)}let i={};return t.map($r((s,a)=>i[s]=a)).filter(Fr).map(ts(i,r)).sort(rs).map(s=>es(e,s))}function Ir(e){return Array.from(e).map($r()).filter(t=>!Fr(t))}var ht=!1,ye=new Map,kr=Symbol();function Zi(e){ht=!0;let t=Symbol();kr=t,ye.set(t,[]);let r=()=>{for(;ye.get(t).length;)ye.get(t).shift()();ye.delete(t)},i=()=>{ht=!1,r()};e(r),i()}function Mr(e){let t=[],r=o=>t.push(o),[i,n]=qi(e);return t.push(n),[{Alpine:we,effect:i,cleanup:r,evaluateLater:T.bind(T,e),evaluate:ie.bind(ie,e)},()=>t.forEach(o=>o())]}function es(e,t){let r=()=>{},i=ft[t.type]||r,[n,s]=Mr(e);Fi(e,t.original,s);let a=()=>{e._x_ignore||e._x_ignoreSelf||(i.inline&&i.inline(e,t,n),i=i.bind(i,e,t,n),ht?ye.get(kr).push(i):i())};return a.runCleanups=s,a}var jr=(e,t)=>({name:r,value:i})=>(r.startsWith(e)&&(r=r.replace(e,t)),{name:r,value:i}),qr=e=>e;function $r(e=()=>{}){return({name:t,value:r})=>{let{name:i,value:n}=Dr.reduce((s,a)=>a(s),{name:t,value:r});return i!==t&&e(i,t),{name:i,value:n}}}var Dr=[];function pt(e){Dr.push(e)}function Fr({name:e}){return Br().test(e)}var Br=()=>new RegExp(`^${ct}([^:^.]+)\\b`);function ts(e,t){return({name:r,value:i})=>{let n=r.match(Br()),s=r.match(/:([a-zA-Z0-9\-:]+)/),a=r.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],o=t||e[r]||r;return{type:n?n[1]:null,value:s?s[1]:null,modifiers:a.map(l=>l.replace(".","")),expression:i,original:o}}}var mt="DEFAULT",J=["ignore","ref","data","id","radio","tabs","switch","disclosure","menu","listbox","combobox","bind","init","for","mask","model","modelable","transition","show","if",mt,"teleport"];function rs(e,t){let r=J.indexOf(e.type)===-1?mt:e.type,i=J.indexOf(t.type)===-1?mt:t.type;return J.indexOf(r)-J.indexOf(i)}function be(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}function B(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(n=>B(n,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let i=e.firstElementChild;for(;i;)B(i,t),i=i.nextElementSibling}function ae(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}function ns(){document.body||ae("Unable to initialize. Trying to load Alpine before `` is available. Did you forget to add `defer` in Alpine's `