diff --git a/package.json b/package.json index 8cbb247..f5d17c8 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ }, "dependencies": { "alpinejs": "^3.12.2", - "pupa": "^3.1.0", - "tocbot": "^4.21.0" + "tocbot": "^4.21.2", + "pupa": "^3.1.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 91817d8..093a7ae 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ dependencies: specifier: ^3.1.0 version: 3.1.0 tocbot: - specifier: ^4.21.0 - version: 4.21.0 + specifier: ^4.21.2 + version: 4.21.2 devDependencies: '@iconify-json/bx': @@ -3774,8 +3774,8 @@ packages: is-number: 7.0.0 dev: true - /tocbot@4.21.0: - resolution: {integrity: sha512-vXk8htr8mIl3hc2s2mDkaPTBfqmqZA2o0x7eXbxUibdrpEIPdpM0L9hH/RvEvlgSM+ZTgS34sGipk5+VrLJCLA==} + /tocbot@4.21.2: + resolution: {integrity: sha512-R5Muhi/TUu4i4snWVrMgNoXyJm2f8sJfdgIkQvqb+cuIXQEIMAiWGWgCgYXHqX4+XiS/Bnm7IYZ9Zy6NVe6lhw==} dev: false /tr46@0.0.3: diff --git a/src/main.ts b/src/main.ts index aa54ac8..a427819 100644 --- a/src/main.ts +++ b/src/main.ts @@ -44,11 +44,12 @@ export function generateToc() { extraListClasses: "space-y-1 dark:border-slate-500", extraLinkClasses: "group flex items-center justify-between rounded py-1 px-1.5 transition-all hover:bg-gray-100 text-sm opacity-80 dark:hover:bg-slate-700 dark:text-slate-50", - activeLinkClass: "is-active-link", collapseDepth: 6, headingsOffset: 100, scrollSmooth: true, scrollSmoothOffset: -100, + // @ts-ignore + tocScrollOffset: 50, }); } diff --git a/src/styles/main.scss b/src/styles/main.scss index 6cbef3d..4b1288f 100644 --- a/src/styles/main.scss +++ b/src/styles/main.scss @@ -38,7 +38,7 @@ body { text-shadow: 2px 2px 10px #000; } -.is-active-li { +.is-active-link { @apply rounded bg-gray-100 dark:bg-slate-600; } diff --git a/templates/assets/dist/main.iife.js b/templates/assets/dist/main.iife.js index 695d6e3..e7d618b 100644 --- a/templates/assets/dist/main.iife.js +++ b/templates/assets/dist/main.iife.js @@ -1,5 +1,5 @@ -var main=function(I){"use strict";const vo="",yo="";var Ne=!1,Ie=!1,F=[],Me=-1;function Zr(e){en(e)}function en(e){F.includes(e)||F.push(e),tn()}function Ct(e){let t=F.indexOf(e);t!==-1&&t>Me&&F.splice(t,1)}function tn(){!Ie&&!Ne&&(Ne=!0,queueMicrotask(rn))}function rn(){Ne=!1,Ie=!0;for(let e=0;ee.effect(t,{scheduler:r=>{ke?Zr(r):r()}}),Et=e.raw}function At(e){V=e}function sn(e){let t=()=>{};return[i=>{let n=V(i);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(o=>o())}),e._x_effects.add(n),t=()=>{n!==void 0&&(e._x_effects.delete(n),X(n))},n},()=>{t()}]}var Ot=[],Tt=[],Lt=[];function an(e){Lt.push(e)}function Nt(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,Tt.push(t))}function ln(e){Ot.push(e)}function cn(e,t,r){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(r)}function It(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 $e=new MutationObserver(He),Pe=!1;function qe(){$e.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),Pe=!0}function Mt(){un(),$e.disconnect(),Pe=!1}var Z=[],je=!1;function un(){Z=Z.concat($e.takeRecords()),Z.length&&!je&&(je=!0,queueMicrotask(()=>{fn(),je=!1}))}function fn(){He(Z),Z.length=0}function C(e){if(!Pe)return e();Mt();let t=e();return qe(),t}var Re=!1,fe=[];function dn(){Re=!0}function hn(){Re=!1,He(fe),fe=[]}function He(e){if(Re){fe=fe.concat(e);return}let t=[],r=[],i=new Map,n=new Map;for(let o=0;os.nodeType===1&&t.push(s)),e[o].removedNodes.forEach(s=>s.nodeType===1&&r.push(s))),e[o].type==="attributes")){let s=e[o].target,a=e[o].attributeName,l=e[o].oldValue,c=()=>{i.has(s)||i.set(s,[]),i.get(s).push({name:a,value:s.getAttribute(a)})},u=()=>{n.has(s)||n.set(s,[]),n.get(s).push(a)};s.hasAttribute(a)&&l===null?c():s.hasAttribute(a)?(u(),c()):u()}n.forEach((o,s)=>{It(s,o)}),i.forEach((o,s)=>{Ot.forEach(a=>a(s,o))});for(let o of r)if(!t.includes(o)&&(Tt.forEach(s=>s(o)),o._x_cleanups))for(;o._x_cleanups.length;)o._x_cleanups.pop()();t.forEach(o=>{o._x_ignoreSelf=!0,o._x_ignore=!0});for(let o of t)r.includes(o)||o.isConnected&&(delete o._x_ignoreSelf,delete o._x_ignore,Lt.forEach(s=>s(o)),o._x_ignore=!0,o._x_ignoreSelf=!0);t.forEach(o=>{delete o._x_ignoreSelf,delete o._x_ignore}),t=null,r=null,i=null,n=null}function kt(e){return te(W(e))}function ee(e,t,r){return e._x_dataStack=[t,...W(r||e)],()=>{e._x_dataStack=e._x_dataStack.filter(i=>i!==t)}}function W(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?W(e.host):e.parentNode?W(e.parentNode):[]}function te(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 o=Object.getOwnPropertyDescriptor(n,i);if(o.get&&o.get._x_alreadyBound||o.set&&o.set._x_alreadyBound)return!0;if((o.get||o.set)&&o.enumerable){let s=o.get,a=o.set,l=o;s=s&&s.bind(t),a=a&&a.bind(t),s&&(s._x_alreadyBound=!0),a&&(a._x_alreadyBound=!0),Object.defineProperty(n,i,{...l,get:s,set:a})}return!0}return!1})||{})[i],set:(r,i,n)=>{let o=e.find(s=>s.hasOwnProperty(i));return o?o[i]=n:e[e.length-1][i]=n,!0}});return t}function $t(e){let t=i=>typeof i=="object"&&!Array.isArray(i)&&i!==null,r=(i,n="")=>{Object.entries(Object.getOwnPropertyDescriptors(i)).forEach(([o,{value:s,enumerable:a}])=>{if(a===!1||s===void 0)return;let l=n===""?o:`${n}.${o}`;typeof s=="object"&&s!==null&&s._x_interceptor?i[o]=s.initialize(e,l,o):t(s)&&s!==i&&!(s instanceof Element)&&r(s,l)})};return r(e)}function Pt(e,t=()=>{}){let r={initialValue:void 0,_x_interceptor:!0,initialize(i,n,o){return e(this.initialValue,()=>pn(i,n),s=>Fe(i,n,s),n,o)}};return t(r),i=>{if(typeof i=="object"&&i!==null&&i._x_interceptor){let n=r.initialize.bind(r);r.initialize=(o,s,a)=>{let l=i.initialize(o,s,a);return r.initialValue=l,n(o,s,a)}}else r.initialValue=i;return r}}function pn(e,t){return t.split(".").reduce((r,i)=>r[i],e)}function Fe(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]]={}),Fe(e[t[0]],t.slice(1),r)}}var qt={};function T(e,t){qt[e]=t}function De(e,t){return Object.entries(qt).forEach(([r,i])=>{let n=null;function o(){if(n)return n;{let[s,a]=Dt(t);return n={interceptor:Pt,...s},Nt(t,a),n}}Object.defineProperty(e,`$${r}`,{get(){return i(t,o())},enumerable:!1})}),e}function _n(e,t,r,...i){try{return r(...i)}catch(n){re(n,e,t)}}function re(e,t,r=void 0){Object.assign(e,{el:t,expression:r}),console.warn(`Alpine Expression Error: ${e.message} +var main=function(I){"use strict";const vo="",yo="";var Ne=!1,Ie=!1,F=[],Me=-1;function Zr(e){en(e)}function en(e){F.includes(e)||F.push(e),tn()}function Ct(e){let t=F.indexOf(e);t!==-1&&t>Me&&F.splice(t,1)}function tn(){!Ie&&!Ne&&(Ne=!0,queueMicrotask(rn))}function rn(){Ne=!1,Ie=!0;for(let e=0;ee.effect(t,{scheduler:r=>{ke?Zr(r):r()}}),Et=e.raw}function At(e){V=e}function sn(e){let t=()=>{};return[i=>{let n=V(i);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(o=>o())}),e._x_effects.add(n),t=()=>{n!==void 0&&(e._x_effects.delete(n),X(n))},n},()=>{t()}]}var Ot=[],Tt=[],Lt=[];function an(e){Lt.push(e)}function Nt(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,Tt.push(t))}function ln(e){Ot.push(e)}function cn(e,t,r){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(r)}function It(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 $e=new MutationObserver(He),Pe=!1;function qe(){$e.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),Pe=!0}function Mt(){un(),$e.disconnect(),Pe=!1}var Z=[],je=!1;function un(){Z=Z.concat($e.takeRecords()),Z.length&&!je&&(je=!0,queueMicrotask(()=>{fn(),je=!1}))}function fn(){He(Z),Z.length=0}function E(e){if(!Pe)return e();Mt();let t=e();return qe(),t}var Re=!1,fe=[];function dn(){Re=!0}function hn(){Re=!1,He(fe),fe=[]}function He(e){if(Re){fe=fe.concat(e);return}let t=[],r=[],i=new Map,n=new Map;for(let o=0;os.nodeType===1&&t.push(s)),e[o].removedNodes.forEach(s=>s.nodeType===1&&r.push(s))),e[o].type==="attributes")){let s=e[o].target,a=e[o].attributeName,l=e[o].oldValue,u=()=>{i.has(s)||i.set(s,[]),i.get(s).push({name:a,value:s.getAttribute(a)})},c=()=>{n.has(s)||n.set(s,[]),n.get(s).push(a)};s.hasAttribute(a)&&l===null?u():s.hasAttribute(a)?(c(),u()):c()}n.forEach((o,s)=>{It(s,o)}),i.forEach((o,s)=>{Ot.forEach(a=>a(s,o))});for(let o of r)if(!t.includes(o)&&(Tt.forEach(s=>s(o)),o._x_cleanups))for(;o._x_cleanups.length;)o._x_cleanups.pop()();t.forEach(o=>{o._x_ignoreSelf=!0,o._x_ignore=!0});for(let o of t)r.includes(o)||o.isConnected&&(delete o._x_ignoreSelf,delete o._x_ignore,Lt.forEach(s=>s(o)),o._x_ignore=!0,o._x_ignoreSelf=!0);t.forEach(o=>{delete o._x_ignoreSelf,delete o._x_ignore}),t=null,r=null,i=null,n=null}function kt(e){return te(W(e))}function ee(e,t,r){return e._x_dataStack=[t,...W(r||e)],()=>{e._x_dataStack=e._x_dataStack.filter(i=>i!==t)}}function W(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?W(e.host):e.parentNode?W(e.parentNode):[]}function te(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 o=Object.getOwnPropertyDescriptor(n,i);if(o.get&&o.get._x_alreadyBound||o.set&&o.set._x_alreadyBound)return!0;if((o.get||o.set)&&o.enumerable){let s=o.get,a=o.set,l=o;s=s&&s.bind(t),a=a&&a.bind(t),s&&(s._x_alreadyBound=!0),a&&(a._x_alreadyBound=!0),Object.defineProperty(n,i,{...l,get:s,set:a})}return!0}return!1})||{})[i],set:(r,i,n)=>{let o=e.find(s=>s.hasOwnProperty(i));return o?o[i]=n:e[e.length-1][i]=n,!0}});return t}function $t(e){let t=i=>typeof i=="object"&&!Array.isArray(i)&&i!==null,r=(i,n="")=>{Object.entries(Object.getOwnPropertyDescriptors(i)).forEach(([o,{value:s,enumerable:a}])=>{if(a===!1||s===void 0)return;let l=n===""?o:`${n}.${o}`;typeof s=="object"&&s!==null&&s._x_interceptor?i[o]=s.initialize(e,l,o):t(s)&&s!==i&&!(s instanceof Element)&&r(s,l)})};return r(e)}function Pt(e,t=()=>{}){let r={initialValue:void 0,_x_interceptor:!0,initialize(i,n,o){return e(this.initialValue,()=>pn(i,n),s=>Fe(i,n,s),n,o)}};return t(r),i=>{if(typeof i=="object"&&i!==null&&i._x_interceptor){let n=r.initialize.bind(r);r.initialize=(o,s,a)=>{let l=i.initialize(o,s,a);return r.initialValue=l,n(o,s,a)}}else r.initialValue=i;return r}}function pn(e,t){return t.split(".").reduce((r,i)=>r[i],e)}function Fe(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]]={}),Fe(e[t[0]],t.slice(1),r)}}var qt={};function T(e,t){qt[e]=t}function De(e,t){return Object.entries(qt).forEach(([r,i])=>{let n=null;function o(){if(n)return n;{let[s,a]=Dt(t);return n={interceptor:Pt,...s},Nt(t,a),n}}Object.defineProperty(e,`$${r}`,{get(){return i(t,o())},enumerable:!1})}),e}function _n(e,t,r,...i){try{return r(...i)}catch(n){re(n,e,t)}}function re(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 de=!0;function mn(e){let t=de;de=!1,e(),de=t}function J(e,t,r={}){let i;return A(e,t)(n=>i=n,r),i}function A(...e){return jt(...e)}var jt=Rt;function gn(e){jt=e}function Rt(e,t){let r={};De(r,e);let i=[r,...W(e)],n=typeof t=="function"?vn(i,t):bn(i,t,e);return _n.bind(null,e,t,n)}function vn(e,t){return(r=()=>{},{scope:i={},params:n=[]}={})=>{let o=t.apply(te([i,...e]),n);he(r,o)}}var ze={};function yn(e,t){if(ze[e])return ze[e];let r=Object.getPrototypeOf(async function(){}).constructor,i=/^[\n\s]*if.*\(.*\)/.test(e)||/^(let|const)\s/.test(e)?`(async()=>{ ${e} })()`:e,o=(()=>{try{return new r(["__self","scope"],`with (scope) { __self.result = ${i} }; __self.finished = true; return __self.result;`)}catch(s){return re(s,t,e),Promise.resolve()}})();return ze[e]=o,o}function bn(e,t,r){let i=yn(t,r);return(n=()=>{},{scope:o={},params:s=[]}={})=>{i.result=void 0,i.finished=!1;let a=te([o,...e]);if(typeof i=="function"){let l=i(i,a).catch(c=>re(c,r,t));i.finished?(he(n,i.result,a,s,r),i.result=void 0):l.then(c=>{he(n,c,a,s,r)}).catch(c=>re(c,r,t)).finally(()=>i.result=void 0)}}}function he(e,t,r,i,n){if(de&&typeof t=="function"){let o=t.apply(r,i);o instanceof Promise?o.then(s=>he(e,s,r,i)).catch(s=>re(s,n,t)):e(o)}else typeof t=="object"&&t instanceof Promise?t.then(o=>e(o)):e(t)}var Ke="x-";function Q(e=""){return Ke+e}function xn(e){Ke=e}var Be={};function S(e,t){return Be[e]=t,{before(r){if(!Be[r]){console.warn("Cannot find directive `${directive}`. `${name}` will use the default order of execution");return}const i=D.indexOf(r);D.splice(i>=0?i:D.indexOf("DEFAULT"),0,e)}}}function Ue(e,t,r){if(t=Array.from(t),e._x_virtualDirectives){let o=Object.entries(e._x_virtualDirectives).map(([a,l])=>({name:a,value:l})),s=Ht(o);o=o.map(a=>s.find(l=>l.name===a.name)?{name:`x-bind:${a.name}`,value:`"${a.value}"`}:a),t=t.concat(o)}let i={};return t.map(Bt((o,s)=>i[o]=s)).filter(Vt).map(Cn(i,r)).sort(En).map(o=>Sn(e,o))}function Ht(e){return Array.from(e).map(Bt()).filter(t=>!Vt(t))}var Ve=!1,ne=new Map,Ft=Symbol();function wn(e){Ve=!0;let t=Symbol();Ft=t,ne.set(t,[]);let r=()=>{for(;ne.get(t).length;)ne.get(t).shift()();ne.delete(t)},i=()=>{Ve=!1,r()};e(r),i()}function Dt(e){let t=[],r=a=>t.push(a),[i,n]=sn(e);return t.push(n),[{Alpine:le,effect:i,cleanup:r,evaluateLater:A.bind(A,e),evaluate:J.bind(J,e)},()=>t.forEach(a=>a())]}function Sn(e,t){let r=()=>{},i=Be[t.type]||r,[n,o]=Dt(e);cn(e,t.original,o);let s=()=>{e._x_ignore||e._x_ignoreSelf||(i.inline&&i.inline(e,t,n),i=i.bind(i,e,t,n),Ve?ne.get(Ft).push(i):i())};return s.runCleanups=o,s}var zt=(e,t)=>({name:r,value:i})=>(r.startsWith(e)&&(r=r.replace(e,t)),{name:r,value:i}),Kt=e=>e;function Bt(e=()=>{}){return({name:t,value:r})=>{let{name:i,value:n}=Ut.reduce((o,s)=>s(o),{name:t,value:r});return i!==t&&e(i,t),{name:i,value:n}}}var Ut=[];function We(e){Ut.push(e)}function Vt({name:e}){return Wt().test(e)}var Wt=()=>new RegExp(`^${Ke}([^:^.]+)\\b`);function Cn(e,t){return({name:r,value:i})=>{let n=r.match(Wt()),o=r.match(/:([a-zA-Z0-9\-:]+)/),s=r.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],a=t||e[r]||r;return{type:n?n[1]:null,value:o?o[1]:null,modifiers:s.map(l=>l.replace(".","")),expression:i,original:a}}}var Je="DEFAULT",D=["ignore","ref","data","id","bind","init","for","model","modelable","transition","show","if",Je,"teleport"];function En(e,t){let r=D.indexOf(e.type)===-1?Je:e.type,i=D.indexOf(t.type)===-1?Je:t.type;return D.indexOf(r)-D.indexOf(i)}function ie(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}function P(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(n=>P(n,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let i=e.firstElementChild;for(;i;)P(i,t),i=i.nextElementSibling}function q(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}var Jt=!1;function An(){Jt&&q("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."),Jt=!0,document.body||q("Unable to initialize. Trying to load Alpine before `` is available. Did you forget to add `defer` in Alpine's `