1
0
mirror of https://github.com/ZeroCatDev/Classworks.git synced 2025-12-07 21:13:11 +00:00
Classworks/assets/VMenu-ClQzjH_h.js

2 lines
2.9 KiB
JavaScript

import{g as x,p as R,a3 as p,aG as I,b7 as M,ba as T,ay as S,$ as L,bI as K,cg as w,a0 as O,aQ as U,ch as F,a6 as N,a5 as j,E as b,c as B,au as k,d as A,ac as H,ad as $,ae as z,bb as G,cc as Q,ci as m,cj as q,ck as J,bN as W,cl as X}from"./index-GyS8nTIx.js";const Y=R({id:String,submenu:Boolean,...z(G({captureFocus:!0,closeDelay:250,closeOnContentClick:!0,locationStrategy:"connected",location:void 0,openDelay:300,scrim:!1,scrollStrategy:"reposition",transition:{component:Q}}),["absolute"])},"VMenu"),ee=x()({name:"VMenu",props:Y(),emits:{"update:modelValue":t=>!0},setup(t,E){let{slots:i}=E;const o=p(t,"modelValue"),{scopeId:V}=I(),{isRtl:c}=M(),v=T(),f=S(()=>t.id||`v-menu-${v}`),s=L(),a=K(w,null),d=O(new Set);W(w,{register(){d.value.add(v)},unregister(){d.value.delete(v)},closeParents(e){setTimeout(()=>{var n;!d.value.size&&!t.persistent&&(e==null||(n=s.value)!=null&&n.contentEl&&!X(e,s.value.contentEl))&&(o.value=!1,a==null||a.closeParents())},40)}}),U(()=>a==null?void 0:a.unregister()),F(()=>o.value=!1),N(o,e=>{e?a==null||a.register():a==null||a.unregister()},{immediate:!0});function P(e){a==null||a.closeParents(e)}function h(e){var n,l,r,u,g;if(!t.disabled)if(e.key==="Tab"||e.key==="Enter"&&!t.closeOnContentClick){if(e.key==="Enter"&&(e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLInputElement&&e.target.closest("form")))return;e.key==="Enter"&&e.preventDefault(),!q(J((n=s.value)==null?void 0:n.contentEl,!1),e.shiftKey?"prev":"next",D=>D.tabIndex>=0)&&!t.retainFocus&&(o.value=!1,(r=(l=s.value)==null?void 0:l.activatorEl)==null||r.focus())}else t.submenu&&e.key===(c.value?"ArrowRight":"ArrowLeft")&&(o.value=!1,(g=(u=s.value)==null?void 0:u.activatorEl)==null||g.focus())}function y(e){var l;if(t.disabled)return;const n=(l=s.value)==null?void 0:l.contentEl;n&&o.value?e.key==="ArrowDown"?(e.preventDefault(),e.stopImmediatePropagation(),m(n,"next")):e.key==="ArrowUp"?(e.preventDefault(),e.stopImmediatePropagation(),m(n,"prev")):t.submenu&&(e.key===(c.value?"ArrowRight":"ArrowLeft")?o.value=!1:e.key===(c.value?"ArrowLeft":"ArrowRight")&&(e.preventDefault(),m(n,"first"))):(t.submenu?e.key===(c.value?"ArrowLeft":"ArrowRight"):["ArrowDown","ArrowUp"].includes(e.key))&&(o.value=!0,e.preventDefault(),setTimeout(()=>setTimeout(()=>y(e))))}const C=j(()=>b({"aria-haspopup":"menu","aria-expanded":String(o.value),"aria-controls":f.value,"aria-owns":f.value,onKeydown:y},t.activatorProps));return B(()=>{const e=k.filterProps(t);return A(k,b({ref:s,id:f.value,class:["v-menu",t.class],style:t.style},e,{modelValue:o.value,"onUpdate:modelValue":n=>o.value=n,absolute:!0,activatorProps:C.value,location:t.location??(t.submenu?"end":"bottom"),"onClick:outside":P,onKeydown:h},V),{activator:i.activator,default:function(){for(var n=arguments.length,l=new Array(n),r=0;r<n;r++)l[r]=arguments[r];return A(H,{root:"VMenu"},{default:()=>{var u;return[(u=i.default)==null?void 0:u.call(i,...l)]}})}})}),$({id:f,ΨopenChildren:d},s)}});export{ee as V};