Download lecture-05/class/assets/slidev/TimerBar-DmiBaWSb.js from DeepLearning-VT/DeepLearning_2026: direct link, hf CLI and curl.
- Browser
- Download file 2.77 kB
-
https://huggingface.co/spaces/DeepLearning-VT/DeepLearning_2026/resolve/main/lecture-05/class/assets/slidev/TimerBar-DmiBaWSb.js
- Command line
-
hf download hf://spaces/DeepLearning-VT/DeepLearning_2026/lecture-05/class/assets/slidev/TimerBar-DmiBaWSb.js
-
curl -L -o TimerBar-DmiBaWSb.js https://huggingface.co/spaces/DeepLearning-VT/DeepLearning_2026/resolve/main/lecture-05/class/assets/slidev/TimerBar-DmiBaWSb.js
2.77 kB
| import{$ as e,S as t,V as n,a as r,b as i,ct as a,g as o,ht as s,m as c,vt as l,w as u,xt as d,y as f,yt as p,z as m}from"../modules/shiki-CkJq9tSf.js";import{U as h,t as g,tt as _}from"../useNav-DYgd-Dta.js";import{F as v}from"../modules/vue-Dz2ojcKF.js";import{o as y}from"../index-B3CCQe4_.js";var b={class:`relative flex gap-px`},x=u({__name:`CurrentProgressBar`,props:{clicksContext:{},current:{}},setup(a){let s=a,u=g(),h=o(()=>s.clicksContext??u.clicksContext.value),_=o(()=>s.current??u.currentSlideNo.value),{total:v}=u;return(a,o)=>(m(),i(`div`,b,[(m(!0),i(c,null,n(l(v)-1,n=>(m(),i(`div`,{key:n,class:p([`border-x border-b border-main h-4px transition-all`,n<_.value?`bg-primary border-primary`:``]),style:d({width:`${1/(l(v)-1)*100}%`})},[t(r,{name:`fade`},{default:e(()=>[n===_.value?(m(),i(`div`,{key:0,class:`h-full bg-primary op75 transition-all`,style:d({width:`${h.value.total===0?0:h.value.current/(h.value.total+1)*100}%`})},null,4)):f(`v-if`,!0)]),_:2},1024)],6))),128))]))}});function S(){let e=o(()=>_.timer||`stopwatch`),t=o(()=>h(_.duration).seconds),n=v(100,{controls:!0}),r=s(y,`timer`),i=o(()=>r.value?.status),a=o(()=>(n.counter.value,r.value.status===`stopped`||!r.value.startedAt?0:r.value.status===`paused`?r.value.pausedAt-r.value.startedAt:Date.now()-r.value.startedAt)),c=o(()=>a.value/1e3),l=o(()=>c.value/t.value*100),u=o(()=>{if(e.value===`stopwatch`&&(r.value.status===`stopped`||!r.value.startedAt))return{h:``,m:`-`,s:`--`,ms:`-`};let n=e.value===`countdown`?t.value*1e3-a.value:a.value,i=Math.floor(n/1e3/60/60).toString();i===`0`&&(i=``);let o=Math.floor(n/1e3/60%60).toString();i&&(o=o.padStart(2,`0`));let s=Math.floor(n/1e3%60).toString().padStart(2,`0`),c=Math.floor(n%1e3/100).toString();return{h:i,m:o,s,ms:c}});function d(){n.pause(),r.value={status:`stopped`,slides:{},startedAt:0,pausedAt:0}}function f(){r.value&&(r.value?.status===`stopped`?(r.value.status=`running`,r.value.startedAt=Date.now()):r.value.status===`paused`&&(r.value.status=`running`,r.value.startedAt=Date.now()-(r.value.pausedAt-r.value.startedAt)),n.resume())}function p(){r.value.status=`paused`,r.value.pausedAt=Date.now(),n.pause()}function m(){r.value.status===`running`?p():f()}return{state:r,status:i,timer:u,reset:d,toggle:m,resume:f,pause:p,passed:c,percentage:l,duration:t,mode:e}}var C={class:`border-b mt-px border-main relative flex h-4px`},w=u({__name:`TimerBar`,setup(e){let t=a(S()),n=o(()=>t.status===`stopped`?`op50`:t.status===`paused`?`bg-blue`:t.percentage>100?`bg-red`:t.percentage>80?`bg-yellow`:`bg-green`);return(e,r)=>(m(),i(`div`,C,[t.status===`stopped`?f(`v-if`,!0):(m(),i(`div`,{key:0,class:p([`h-4px`,n.value]),style:d({width:`${t.percentage}%`})},null,6)),f(` {{ timesplits }} `)]))}});export{S as n,x as r,w as t}; |