Files
deno/assets/slidev/overview-BFf1NMWS.js
T

2 lines
7.7 KiB
JavaScript

import{_ as J,a as Y}from"../modules/unplugin-icons-CKCvuFEe.js";import{d as j,ae as Z,r as H,af as ee,K as L,E as te,a7 as le,ag as ne,b as k,ah as oe,T as s,o,k as I,n as F,ai as ie,f as x,l as ae,p as q,P as se,z as K,Q as ce,L as re,g as a,F as P,aj as R,i as T,t as w,w as E,e as M}from"../modules/vue-B5Z8nqrj.js";import{u as ue,s as de,a as me,i as fe,b as B,t as ve,g as O,c as pe,C as U,p as he}from"../index-rf-F2tFP.js";import{_ as ge,C as ke}from"./NoteDisplay.vue_vue_type_style_index_0_lang-DTWbV8dj.js";import{u as be,S as _e,_ as xe,a as ye}from"./SlideWrapper-COZ1zGz_.js";import{_ as A}from"./IconButton.vue_vue_type_script_setup_true_lang-BC4Pfblr.js";import"../modules/shiki-CcvRnmUC.js";const we=["placeholder"],Ce=j({__name:"NoteEditable",props:{no:{type:Number,required:!0},class:{default:""},editing:{default:!1},style:{default:()=>({})},placeholder:{default:"No notes for this slide"},clicksContext:{type:Object},highlight:{default:!0},autoHeight:{default:!1}},emits:["update:editing","markerDblclick","markerClick"],setup(C,{emit:z}){const n=C,y=z,c=ne(n,"editing",y,{passive:!0}),{info:h,update:D}=be(Z(n,"no")),m=H("");let S;const{ignoreUpdates:b}=ee(m,f=>{if(!c.value)return;const u=n.no;clearTimeout(S),S=setTimeout(()=>{D({note:f},u)},500)});L(()=>h.value?.note,(f="")=>{c.value||(clearTimeout(S),b(()=>{m.value=f}))},{immediate:!0,flush:"sync"});const r=H(),_=H();te(()=>{c.value&&r.value?.focus()}),le(r,()=>{c.value=!1});function N(){!n.autoHeight||!r.value||!c.value||r.value.scrollHeight>r.value.clientHeight&&(r.value.style.height=`${r.value.scrollHeight}px`)}function V(f){c.value&&f.metaKey&&f.key==="s"&&(f.preventDefault(),D({note:m.value},n.no))}return L([m,c],()=>{q(()=>{N()})},{flush:"post",immediate:!0}),(f,u)=>s(c)?oe((o(),x("textarea",{key:1,ref_key:"inputEl",ref:r,"onUpdate:modelValue":u[2]||(u[2]=g=>m.value=g),class:F(["prose resize-none overflow-auto outline-none bg-transparent block border-primary border-2",n.class]),style:I([{"line-height":"1.75"},[n.style,_.value!=null?{height:`${_.value}px`}:{}]]),placeholder:C.placeholder,onKeydown:[u[3]||(u[3]=ae(g=>c.value=!1,["esc"])),V]},null,46,we)),[[ie,m.value]]):(o(),k(ge,{key:0,class:F(["border-transparent border-2",[n.class,m.value?"":"opacity-25 italic select-none"]]),style:I(n.style),note:m.value||C.placeholder,"note-html":s(h)?.noteHTML,"clicks-context":C.clicksContext,"auto-scroll":!C.autoHeight,highlight:n.highlight,onMarkerClick:u[0]||(u[0]=(g,$)=>y("markerClick",g,$)),onMarkerDblclick:u[1]||(u[1]=(g,$)=>y("markerDblclick",g,$))},null,8,["class","style","note","note-html","clicks-context","auto-scroll","highlight"]))}}),De={class:"h-screen w-screen of-hidden flex"},$e={class:"grid grid-rows-[auto_max-content] border-r border-main select-none max-h-full h-full"},Fe={class:"relative"},Se={class:"absolute left-0 top-0 bottom-0 w-200 flex flex-col flex-auto items-end group p2 gap-1 max-h-full of-x-visible of-y-auto",style:{direction:"rtl"}},Ee=["onClick"],Me={p2:"",border:"t main"},He={class:"select-none w-13 text-right my4 flex flex-col gap-1 items-end"},Ne={class:"text-3xl op20 mb2"},Te=["onDblclick"],Be={class:"py3 mt-0.5 mr--8 ml--4 op0 transition group-hover:op100"},Ae={key:0,class:"select-none absolute bottom-0 right-0 bg-main rounded-tl p2 op35 text-xs"},Ie={class:"absolute top-0 right-0 px3 py1.5 border-b border-l rounded-lb bg-main border-main select-none"},Ve={class:"text-xs op50"},W=450,Ue=j({__name:"overview",setup(C){ue({title:`Overview - ${de}`});const{openInEditor:z,slides:n}=me(),y=se(new Map),c=H([]),h=H(null),D=K(()=>n.value.map(e=>f(e.meta?.slide?.note||""))),m=K(()=>D.value.reduce((e,t)=>e+t,0)),S=K(()=>n.value.map(e=>N(e)).reduce((e,t)=>e+t,0)),b=ce(),r=new WeakMap;function _(e){return r.has(e)||r.set(e,pe(e,U)),r.get(e)}function N(e){return e.meta?.clicks||_(e)?.total}function V(e){b.value===e?b.value=void 0:b.value=e}function f(e){const t=/[\w`'\-\u0392-\u03C9\u00C0-\u00FF\u0600-\u06FF\u0400-\u04FF]+|[\u4E00-\u9FFF\u3400-\u4DBF\uF900-\uFAFF\u3040-\u309F\uAC00-\uD7AF]+/g,i=e.match(t);let v=0;if(!i)return 0;for(let l=0;l<i.length;l++)i[l].charCodeAt(0)>=19968?v+=i[l].length:v+=1;return v}function u(e){const t=e.getBoundingClientRect(),i=20;return t.top>=0-i&&t.left>=0-i&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)+i&&t.right<=(window.innerWidth||document.documentElement.clientWidth)+i}function g(){const e=[];Array.from(y.entries()).forEach(([t,i])=>{u(i)&&e.push(t)}),c.value=e}function $(e){const t=document.createElement("a");t.target="_blank",t.href=he+e.slice(1),t.click()}function Q(e){const t=y.get(e);t&&t.scrollIntoView({behavior:"smooth",block:"start"})}function X(e,t,i){const v=_(i);v.current===t?v.current=U:v.current=t,e.preventDefault()}return re(()=>{q(()=>{g()})}),(e,t)=>{const i=J,v=Y;return o(),x("div",De,[a("nav",$e,[a("div",Fe,[a("div",Se,[(o(!0),x(P,null,R(s(n),(l,p)=>(o(),x("div",{key:l.no,class:"relative",style:{direction:"ltr"}},[a("button",{class:F(["relative transition duration-300 w-8 h-8 rounded hover:bg-active hover:op100",c.value.includes(p)?"op100 text-primary bg-gray:5":"op20"]),onClick:d=>Q(p)},[a("div",null,w(p+1),1)],10,Ee),l.meta?.slide?.title?(o(),x("div",{key:0,class:F(["pointer-events-none select-none absolute left-110% top-50% translate-y--50% ws-nowrap z-label px2 slidev-glass-effect transition duration-400 op0 group-hover:op100",c.value.includes(p)?"text-primary":"text-main important-text-op-50"])},w(l.meta?.slide?.title),3)):T("v-if",!0)]))),128))])]),a("div",Me,[s(fe)?(o(),k(A,{key:1,title:s(B)?"Dark mode":"Light mode","pointer-events-none":"",op50:""},{default:E(()=>[s(B)?(o(),k(i,{key:0})):(o(),k(v,{key:1}))]),_:1},8,["title"])):(o(),k(A,{key:0,title:s(B)?"Switch to light mode theme":"Switch to dark mode theme",onClick:t[0]||(t[0]=l=>s(ve)())},{default:E(()=>[s(B)?(o(),k(i,{key:0})):(o(),k(v,{key:1}))]),_:1},8,["title"]))])]),a("main",{class:"flex-1 h-full of-auto",style:I(`grid-template-columns: repeat(auto-fit,minmax(${W}px,1fr))`),onScroll:g},[(o(!0),x(P,null,R(s(n),(l,p)=>(o(),x("div",{key:l.no,ref_for:!0,ref:d=>y.set(p,d),class:F(["relative border-t border-main of-hidden flex gap-4 min-h-50 group",p===0?"pt5":""])},[a("div",He,[a("div",Ne,w(p+1),1),M(A,{class:"mr--3 op0 group-hover:op80",title:"Play in new tab",onClick:d=>$(s(O)(l,!1))},{default:E(()=>t[2]||(t[2]=[a("div",{class:"i-carbon:presentation-file"},null,-1)])),_:2,__:[2]},1032,["onClick"]),T("v-if",!0)]),a("div",{class:"flex flex-col gap-2 my5",style:I({width:`${W}px`})},[a("div",{class:"border rounded border-main overflow-hidden bg-main select-none h-max",onDblclick:d=>$(s(O)(l,!1))},[(o(),k(ye,{key:l.no,width:W,class:"pointer-events-none important:[&_*]:select-none"},{default:E(()=>[M(_e,{"clicks-context":_(l),route:l,"render-context":"overview"},null,8,["clicks-context","route"]),M(xe,{page:l.no},null,8,["page"])]),_:2},1024))],40,Te),N(l)?(o(),k(ke,{key:0,active:b.value===l,"clicks-context":_(l),class:"w-full mt-2",onDblclick:d=>V(l),onClick:d=>b.value=l},null,8,["active","clicks-context","onDblclick","onClick"])):T("v-if",!0)],4),a("div",Be,[M(A,{title:"Edit Note",class:F(["rounded-full w-9 h-9 text-sm",h.value===l.no?"important:op0":""]),onClick:d=>h.value=l.no},{default:E(()=>t[4]||(t[4]=[a("div",{class:"i-carbon:pen"},null,-1)])),_:2,__:[4]},1032,["class","onClick"])]),M(Ce,{no:l.no,class:"max-w-250 w-250 text-lg rounded p3","auto-height":!0,highlight:b.value===l,editing:h.value===l.no,"clicks-context":_(l),onDblclick:d=>h.value!==l.no?h.value=l.no:null,"onUpdate:editing":t[1]||(t[1]=d=>h.value=null),onMarkerClick:(d,G)=>X(d,G,l)},null,8,["no","highlight","editing","clicks-context","onDblclick","onMarkerClick"]),D.value[p]>0?(o(),x("div",Ae,w(D.value[p])+" words ",1)):T("v-if",!0)],2))),128))],36),a("div",Ie,[a("div",Ve,w(s(n).length)+" slides · "+w(S.value+s(n).length-1)+" clicks · "+w(m.value)+" words ",1)])])}}});export{Ue as default};