mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 01:17:23 +08:00
2 lines
5.4 KiB
JavaScript
2 lines
5.4 KiB
JavaScript
import{a6 as R,aI as P,aj as L,T as q,r as b,y as g,aJ as x,aK as I,aL as F,aM as S,aN as C,aO as W,x as y,aP as j,a as $}from"./index-0dd8d5e4.js";function h(t){var r;const e=F(t);return(r=e==null?void 0:e.$el)!=null?r:e}const E=x?window:void 0,H=x?window.document:void 0;function w(...t){let r,e,n,l;if(typeof t[0]=="string"||Array.isArray(t[0])?([e,n,l]=t,r=E):[r,e,n,l]=t,!r)return I;Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]);const f=[],o=()=>{f.forEach(d=>d()),f.length=0},u=(d,p,i,a)=>(d.addEventListener(p,i,a),()=>d.removeEventListener(p,i,a)),c=g(()=>[h(r),F(l)],([d,p])=>{o(),d&&f.push(...e.flatMap(i=>n.map(a=>u(d,i,a,p))))},{immediate:!0,flush:"post"}),m=()=>{c(),o()};return S(m),m}let _=!1;function T(t,r,e={}){const{window:n=E,ignore:l=[],capture:f=!0,detectIframe:o=!1}=e;if(!n)return;C&&!_&&(_=!0,Array.from(n.document.body.children).forEach(i=>i.addEventListener("click",I)));let u=!0;const c=i=>l.some(a=>{if(typeof a=="string")return Array.from(n.document.querySelectorAll(a)).some(v=>v===i.target||i.composedPath().includes(v));{const v=h(a);return v&&(i.target===v||i.composedPath().includes(v))}}),d=[w(n,"click",i=>{const a=h(t);if(!(!a||a===i.target||i.composedPath().includes(a))){if(i.detail===0&&(u=!c(i)),!u){u=!0;return}r(i)}},{passive:!0,capture:f}),w(n,"pointerdown",i=>{const a=h(t);a&&(u=!i.composedPath().includes(a)&&!c(i))},{passive:!0}),o&&w(n,"blur",i=>{var a;const v=h(t);((a=n.document.activeElement)==null?void 0:a.tagName)==="IFRAME"&&!(v!=null&&v.contains(n.document.activeElement))&&r(i)})].filter(Boolean);return()=>d.forEach(i=>i())}function B(t){return typeof t=="function"?t:typeof t=="string"?r=>r.key===t:Array.isArray(t)?r=>t.includes(r.key):()=>!0}function U(...t){let r,e,n={};t.length===3?(r=t[0],e=t[1],n=t[2]):t.length===2?typeof t[1]=="object"?(r=!0,e=t[0],n=t[1]):(r=t[0],e=t[1]):(r=!0,e=t[0]);const{target:l=E,eventName:f="keydown",passive:o=!1,dedupe:u=!1}=n,c=B(r);return w(l,f,d=>{d.repeat&&F(u)||c(d)&&e(d)},o)}function G(t,r=null){const e=R();let n=()=>{};const l=P((f,o)=>(n=o,{get(){var u,c;return f(),(c=(u=e==null?void 0:e.proxy)==null?void 0:u.$refs[t])!=null?c:r},set(){}}));return L(n),q(n),l}function D(){const t=b(!1);return R()&&$(()=>{t.value=!0}),t}function O(t){const r=D();return y(()=>(r.value,!!t()))}function K(t,r={}){const{window:e=E}=r,n=O(()=>e&&"matchMedia"in e&&typeof e.matchMedia=="function");let l;const f=b(!1),o=()=>{l&&("removeEventListener"in l?l.removeEventListener("change",u):l.removeListener(u))},u=()=>{n.value&&(o(),l=e.matchMedia(j(t).value),f.value=!!(l!=null&&l.matches),l&&("addEventListener"in l?l.addEventListener("change",u):l.addListener(u)))};return W(u),S(()=>o()),f}var M=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,V=(t,r)=>{var e={};for(var n in t)N.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(t!=null&&M)for(var n of M(t))r.indexOf(n)<0&&Q.call(t,n)&&(e[n]=t[n]);return e};function X(t,r,e={}){const n=e,{window:l=E}=n,f=V(n,["window"]);let o;const u=O(()=>l&&"ResizeObserver"in l),c=()=>{o&&(o.disconnect(),o=void 0)},m=y(()=>Array.isArray(t)?t.map(i=>h(i)):[h(t)]),d=g(m,i=>{if(c(),u.value&&l){o=new ResizeObserver(r);for(const a of i)a&&o.observe(a,f)}},{immediate:!0,flush:"post",deep:!0}),p=()=>{c(),d()};return S(p),{isSupported:u,stop:p}}const A=["fullscreenchange","webkitfullscreenchange","webkitendfullscreen","mozfullscreenchange","MSFullscreenChange"];function Y(t,r={}){const{document:e=H,autoExit:n=!1}=r,l=y(()=>{var s;return(s=h(t))!=null?s:e==null?void 0:e.querySelector("html")}),f=b(!1),o=y(()=>["requestFullscreen","webkitRequestFullscreen","webkitEnterFullscreen","webkitEnterFullScreen","webkitRequestFullScreen","mozRequestFullScreen","msRequestFullscreen"].find(s=>e&&s in e||l.value&&s in l.value)),u=y(()=>["exitFullscreen","webkitExitFullscreen","webkitExitFullScreen","webkitCancelFullScreen","mozCancelFullScreen","msExitFullscreen"].find(s=>e&&s in e||l.value&&s in l.value)),c=y(()=>["fullScreen","webkitIsFullScreen","webkitDisplayingFullscreen","mozFullScreen","msFullscreenElement"].find(s=>e&&s in e||l.value&&s in l.value)),m=["fullscreenElement","webkitFullscreenElement","mozFullScreenElement","msFullscreenElement"].find(s=>e&&s in e),d=O(()=>l.value&&e&&o.value!==void 0&&u.value!==void 0&&c.value!==void 0),p=()=>m?(e==null?void 0:e[m])===l.value:!1,i=()=>{if(c.value){if(e&&e[c.value]!=null)return e[c.value];{const s=l.value;if((s==null?void 0:s[c.value])!=null)return!!s[c.value]}}return!1};async function a(){if(d.value){if(u.value)if((e==null?void 0:e[u.value])!=null)await e[u.value]();else{const s=l.value;(s==null?void 0:s[u.value])!=null&&await s[u.value]()}f.value=!1}}async function v(){if(!d.value)return;i()&&await a();const s=l.value;o.value&&(s==null?void 0:s[o.value])!=null&&(await s[o.value](),f.value=!0)}async function z(){await(f.value?a():v())}const k=()=>{const s=i();(!s||s&&p())&&(f.value=s)};return w(e,A,k,!1),w(()=>h(l),A,k,!1),n&&S(a),{isSupported:d,isFullscreen:f,enter:v,exit:a,toggle:z}}function Z(t={}){const{window:r=E,initialWidth:e=1/0,initialHeight:n=1/0,listenOrientation:l=!0,includeScrollbar:f=!0}=t,o=b(e),u=b(n),c=()=>{r&&(f?(o.value=r.innerWidth,u.value=r.innerHeight):(o.value=r.document.documentElement.clientWidth,u.value=r.document.documentElement.clientHeight))};if(c(),L(c),w("resize",c,{passive:!0}),l){const m=K("(orientation: portrait)");g(m,()=>c())}return{width:o,height:u}}export{Y as a,X as b,T as c,Z as d,U as o,G as t,w as u};
|