mirror of
https://github.com/ZeroCatDev/Classworks.git
synced 2026-02-04 07:53:11 +00:00
2 lines
7.3 KiB
JavaScript
2 lines
7.3 KiB
JavaScript
import{g as _,b as N,c as f,i as C,n as U,d as M,p as R,m as W,h as q,aC as Y,bz as Z,be as K,bo as Q,b7 as X,az as h,aI as ee,am as te,aW as z,aJ as E,bd as ae,a3 as d,bp as le,bj as oe,bk as ne,bq as se,bI as ie,ae as I,Z as re,$ as ue,a2 as $,bc as ce,ar as ve,by as de,b3 as me,a as ge,bC as he,E as F,av as D,bG as fe}from"./index-BX1omx6G.js";const J=R({text:String,...q(),...W()},"VToolbarTitle"),j=_()({name:"VToolbarTitle",props:J(),setup(e,b){let{slots:t}=b;return N(()=>{const u=!!(t.default||t.text||e.text);return f(e.tag,{class:M(["v-toolbar-title",e.class]),style:U(e.style)},{default:()=>{var n;return[u&&C("div",{class:"v-toolbar-title__placeholder"},[t.text?t.text():e.text,(n=t.default)==null?void 0:n.call(t)])]}})}),{}}}),be=[null,"prominent","default","comfortable","compact"],G=R({absolute:Boolean,collapse:Boolean,collapsePosition:{type:String,default:"start"},color:String,density:{type:String,default:"default",validator:e=>be.includes(e)},extended:{type:Boolean,default:null},extensionHeight:{type:[Number,String],default:48},flat:Boolean,floating:Boolean,height:{type:[Number,String],default:64},image:String,title:String,...ie(),...q(),...se(),...ne(),...W({tag:"header"}),...oe()},"VToolbar"),L=_()({name:"VToolbar",props:G(),setup(e,b){var B;let{slots:t}=b;const{backgroundColorClasses:u,backgroundColorStyles:n}=Y(()=>e.color),{borderClasses:o}=Z(e),{elevationClasses:m}=le(e),{roundedClasses:s}=K(e),{themeClasses:c}=Q(e),{rtlClasses:T}=X(),H=h(e.extended===null?!!((B=t.extension)!=null&&B.call(t)):e.extended),r=d(()=>parseInt(Number(e.height)+(e.density==="prominent"?Number(e.height):0)-(e.density==="comfortable"?8:0)-(e.density==="compact"?16:0),10)),x=d(()=>H.value?parseInt(Number(e.extensionHeight)+(e.density==="prominent"?Number(e.extensionHeight):0)-(e.density==="comfortable"?4:0)-(e.density==="compact"?8:0),10):0);return ee({VBtn:{variant:"text"}}),N(()=>{var w;const p=!!(e.title||t.title),v=!!(t.image||e.image),P=(w=t.extension)==null?void 0:w.call(t);return H.value=e.extended===null?!!P:e.extended,f(e.tag,{class:M(["v-toolbar",`v-toolbar--collapse-${e.collapsePosition}`,{"v-toolbar--absolute":e.absolute,"v-toolbar--collapse":e.collapse,"v-toolbar--flat":e.flat,"v-toolbar--floating":e.floating,[`v-toolbar--density-${e.density}`]:!0},u.value,o.value,m.value,s.value,c.value,T.value,e.class]),style:U([n.value,e.style])},{default:()=>[v&&C("div",{key:"image",class:"v-toolbar__image"},[t.image?f(z,{key:"image-defaults",disabled:!e.image,defaults:{VImg:{cover:!0,src:e.image}}},t.image):f(te,{key:"image-img",cover:!0,src:e.image},null)]),f(z,{defaults:{VTabs:{height:E(r.value)}}},{default:()=>{var V,k,y;return[C("div",{class:"v-toolbar__content",style:{height:E(r.value)}},[t.prepend&&C("div",{class:"v-toolbar__prepend"},[(V=t.prepend)==null?void 0:V.call(t)]),p&&f(j,{key:"title",text:e.title},{text:t.title}),(k=t.default)==null?void 0:k.call(t),t.append&&C("div",{class:"v-toolbar__append"},[(y=t.append)==null?void 0:y.call(t)])])]}}),f(z,{defaults:{VTabs:{height:E(x.value)}}},{default:()=>[f(ae,null,{default:()=>[H.value&&C("div",{class:"v-toolbar__extension",style:{height:E(x.value)}},[P])]})]})]})}),{contentHeight:r,extensionHeight:x}}}),ye=R({scrollTarget:{type:String},scrollThreshold:{type:[String,Number],default:300}},"scroll");function Se(e){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{canScroll:t,layoutSize:u}=b;let n=0,o=0;const m=$(null),s=h(0),c=h(0),T=h(0),H=h(!1),r=h(!1),x=h(!1),B=h(!1),p=h(!0),v=d(()=>Number(e.scrollThreshold)),P=d(()=>ce((v.value-s.value)/v.value||0));function w(l){const a="window"in l?window.innerHeight:l.clientHeight,i="window"in l?document.documentElement.scrollHeight:l.scrollHeight;return{clientHeight:a,scrollHeight:i}}function V(){const l=m.value;if(!l)return;const{clientHeight:a,scrollHeight:i}=w(l),S=i-a,g=(u==null?void 0:u.value)||0,A=v.value+g;p.value=S>A}function k(){V()}function y(){const l=m.value;if(!l||t&&!t.value)return;n=s.value,s.value="window"in l?l.pageYOffset:l.scrollTop;const a=l instanceof Window?document.documentElement.scrollHeight:l.scrollHeight;o!==a&&(a>o&&V(),o=a),r.value=s.value<n,T.value=Math.abs(s.value-v.value);const{clientHeight:i,scrollHeight:S}=w(l),g=s.value+i>=S-5;!r.value&&g&&s.value>=v.value&&p.value&&(B.value=!0);const A=Math.abs(s.value-n)>100,O=s.value<=5;(r.value&&n-s.value>1&&!g||A&&s.value<v.value||O)&&(B.value=!1),x.value=g}return I(r,()=>{c.value=c.value||s.value}),I(H,()=>{c.value=0}),re(()=>{I(()=>e.scrollTarget,l=>{var i;const a=l?document.querySelector(l):window;a&&a!==m.value&&((i=m.value)==null||i.removeEventListener("scroll",y),m.value=a,m.value.addEventListener("scroll",y,{passive:!0}),Promise.resolve().then(()=>{V()}))},{immediate:!0}),window.addEventListener("resize",k,{passive:!0})}),ue(()=>{var l;(l=m.value)==null||l.removeEventListener("scroll",y),window.removeEventListener("resize",k)}),t&&I(t,y,{immediate:!0}),{scrollThreshold:v,currentScroll:s,currentThreshold:T,isScrollActive:H,scrollRatio:P,isScrollingUp:r,savedScroll:c,isAtBottom:x,reachedBottomWhileScrollingDown:B,hasEnoughScrollableSpace:p}}const Te=R({scrollBehavior:String,modelValue:{type:Boolean,default:!0},location:{type:String,default:"top",validator:e=>["top","bottom"].includes(e)},...G(),...fe(),...ye(),height:{type:[Number,String],default:64}},"VAppBar"),Be=_()({name:"VAppBar",props:Te(),emits:{"update:modelValue":e=>!0},setup(e,b){let{slots:t}=b;const u=$(),n=ve(e,"modelValue"),o=d(()=>{var i;const a=new Set(((i=e.scrollBehavior)==null?void 0:i.split(" "))??[]);return{hide:a.has("hide"),fullyHide:a.has("fully-hide"),inverted:a.has("inverted"),collapse:a.has("collapse"),elevate:a.has("elevate"),fadeImage:a.has("fade-image")}}),m=d(()=>{const a=o.value;return a.hide||a.fullyHide||a.inverted||a.collapse||a.elevate||a.fadeImage||!n.value}),s=d(()=>{var S,g;const a=((S=u.value)==null?void 0:S.contentHeight)??0,i=((g=u.value)==null?void 0:g.extensionHeight)??0;return a+i}),{currentScroll:c,scrollThreshold:T,isScrollingUp:H,scrollRatio:r,isAtBottom:x,reachedBottomWhileScrollingDown:B,hasEnoughScrollableSpace:p}=Se(e,{canScroll:m,layoutSize:s}),v=D(()=>o.value.hide||o.value.fullyHide),P=d(()=>e.collapse||o.value.collapse&&(o.value.inverted?r.value>0:r.value===0)),w=d(()=>e.flat||o.value.fullyHide&&!n.value||o.value.elevate&&(o.value.inverted?c.value>0:c.value===0)),V=d(()=>o.value.fadeImage?o.value.inverted?1-r.value:r.value:void 0),k=d(()=>{var S,g;if(o.value.hide&&o.value.inverted)return 0;const a=((S=u.value)==null?void 0:S.contentHeight)??0,i=((g=u.value)==null?void 0:g.extensionHeight)??0;return v.value?c.value<T.value||o.value.fullyHide?a+i:a:a+i});de(()=>!!e.scrollBehavior,()=>{me(()=>{if(!v.value){n.value=!0;return}if(o.value.inverted){n.value=c.value>T.value;return}if(!p.value){n.value=!0;return}if(B.value){n.value=!1;return}n.value=H.value&&!x.value||c.value<T.value})});const{ssrBootStyles:y}=ge(),{layoutItemStyles:l}=he({id:e.name,order:d(()=>parseInt(e.order,10)),position:D(()=>e.location),layoutSize:k,elementSize:h(void 0),active:n,absolute:D(()=>e.absolute)});return N(()=>{const a=L.filterProps(e);return f(L,F({ref:u,class:["v-app-bar",{"v-app-bar--bottom":e.location==="bottom"},e.class],style:[{...l.value,"--v-toolbar-image-opacity":V.value,height:void 0,...y.value},e.style]},a,{collapse:P.value,flat:w.value}),t)}),{}}}),Ve=_()({name:"VAppBarTitle",props:J(),setup(e,b){let{slots:t}=b;return N(()=>f(j,F(e,{class:"v-app-bar-title"}),t)),{}}});export{L as V,j as a,Ve as b,Be as c};
|