1
0
web/static/slide/assets/slidev/overview-C8DpBgre.js

2 lines
7.7 KiB
JavaScript
Raw Permalink Normal View History

2024-10-14 14:14:52 +00:00
import{d as te,e as ne,_ as oe,f as le}from"../modules/unplugin-icons-C_8y6Xs3.js";import{d as J,ab as ae,ac as ie,q as T,ad as se,E as U,D as ce,a4 as re,n as Q,B as c,o as a,c as g,i as S,h as z,ae as ue,af as de,b,j as me,K as pe,z as L,R as ve,O as fe,e as s,F as j,ag as q,k as N,x as y,g as V,l as w}from"../modules/vue-CSR4ejk2.js";import{u as he,a as ge,s as ke,c as _e,C as X,i as be,b as K,t as xe,g as G,p as ye}from"../index-DYPPoQLU.js";import{u as we,S as Ce,_ as $e,a as De}from"./DrawingPreview.vue_vue_type_script_setup_true_lang-BxrzxYkd.js";import{_ as W}from"./IconButton.vue_vue_type_script_setup_true_lang-7nPPoqsL.js";import{_ as Se,C as Ee}from"./ClicksSlider-CIb42Z5s.js";import"../modules/shiki-tduQW0Ms.js";const Me=["placeholder"],He=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:A}){const o=C,x=A,r=ae(o,"editing",x,{passive:!0}),{info:f,update:$}=we(ie(o,"no")),p=T("");let E;const{ignoreUpdates:k}=se(p,i=>{if(!r.value)return;const m=o.no;clearTimeout(E),E=setTimeout(()=>{$({note:i},m)},500)});U(()=>{var i;return(i=f.value)==null?void 0:i.note},(i="")=>{r.value||(clearTimeout(E),k(()=>{p.value=i}))},{immediate:!0,flush:"sync"});const d=T(),_=T();ce(()=>{var i;r.value&&((i=d.value)==null||i.focus())}),re(d,()=>{r.value=!1});function B(){!o.autoHeight||!d.value||!r.value||d.value.scrollHeight>d.value.clientHeight&&(d.value.style.height=`${d.value.scrollHeight}px`)}function R(i){r.value&&i.metaKey&&i.key==="s"&&(i.preventDefault(),$({note:p.value},o.no))}return U([p,r],()=>{Q(()=>{B()})},{flush:"post",immediate:!0}),(i,m)=>{var M;return c(r)?ue((a(),b("textarea",{key:1,ref_key:"inputEl",ref:d,"onUpdate:modelValue":m[2]||(m[2]=h=>p.value=h),class:S(["prose resize-none overflow-auto outline-none bg-transparent block border-primary border-2",o.class]),style:z([{"line-height":"1.75"},[o.style,_.value!=null?{height:`${_.value}px`}:{}]]),placeholder:C.placeholder,onKeydown:[m[3]||(m[3]=me(h=>r.value=!1,["esc"])),R]},null,46,Me)),[[de,p.value]]):(a(),g(Se,{key:0,class:S(["border-transparent border-2",[o.class,p.value?"":"opacity-25 italic select-none"]]),style:z(o.style),note:p.value||C.placeholder,"note-html":(M=c(f))==null?void 0:M.noteHTML,"clicks-context":C.clicksContext,"auto-scroll":!C.autoHeight,highlight:o.highlight,onMarkerClick:m[0]||(m[0]=(h,H)=>x("markerClick",h,H)),onMarkerDblclick:m[1]||(m[1]=(h,H)=>x("markerDblclick",h,H))},null,8,["class","style","note","note-html","clicks-context","auto-scroll","highlight"]))}}}),Ne={class:"h-screen w-screen of-hidden flex"},Te={class:"grid grid-rows-[auto_max-content] border-r border-main select-none max-h-full h-full"},Be={class:"relative"},Ie={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"}},Ve=["onClick"],Ke={p2:"",border:"t main"},We={class:"select-none w-13 text-right my4 flex flex-col gap-1 items-end"},ze={class:"text-3xl op20 mb2"},Re=["onDblclick"],Le={class:"py3 mt-0.5 mr--8 ml--4 op0 transition group-hover:op100"},Oe={key:0,class:"select-none absolute bottom-0 right-0 bg-main rounded-tl p2 op35 text-xs"},Ae={class:"absolute top-0 right-0 px3 py1.5 border-b border-l rounded-lb bg-main border-main select-none"},Fe={class:"text-xs op50"},O=450,Ye=J({__name:"overview",setup(C){he({title:`Overview - ${ke}`});const{openInEditor:A,slides:o}=ge(),x=pe(new Map),r=T([]),f=T(null),$=L(()=>o.value.map(t=>{var e,l;return i(((l=(e=t.meta)==null?void 0:e.slide)==null?void 0:l.note)||"")})),p=L(()=>$.value.reduce((t,e)=>t+e,0)),E=L(()=>o.value.map(t=>B(t)).reduce((t,e)=>t+e,0)),k=ve(),d=new WeakMap;function _(t){return d.has(t)||d.set(t,_e(t,X)),d.get(t)}function B(t){var e,l;return((e=t.meta)==null?void 0:e.clicks)||((l=_(t))==null?void 0:l.total)}function R(t){k.value===t?k.value=void 0:k.value=