Main/resources/[tools]/unlimited-spectre/html/assets/QResizeObserver.2503502b.js

2 lines
1.5 KiB
JavaScript
Raw Normal View History

2025-06-07 08:51:21 +02:00
import{k as g,m as z,e as c,b as y,f,n as w,z as v,x as R,h as x,l as b}from"./app-014d9ed9.js";function O(){const i=g(!z.value);return i.value===!1&&c(()=>{i.value=!0}),i}const m=typeof ResizeObserver<"u",h=m===!0?{}:{style:"display:block;position:absolute;top:0;left:0;right:0;bottom:0;height:100%;width:100%;overflow:hidden;pointer-events:none;z-index:-1;",url:"about:blank"},L=y({name:"QResizeObserver",props:{debounce:{type:[String,Number],default:100}},emits:["resize"],setup(i,{emit:p}){let r=null,t,o={width:-1,height:-1};function s(e){e===!0||i.debounce===0||i.debounce==="0"?u():r===null&&(r=setTimeout(u,i.debounce))}function u(){if(clearTimeout(r),r=null,t){const{offsetWidth:e,offsetHeight:n}=t;(e!==o.width||n!==o.height)&&(o={width:e,height:n},p("resize",o))}}const{proxy:l}=x();if(m===!0){let e;const n=a=>{t=l.$el.parentNode,t?(e=new ResizeObserver(s),e.observe(t),u()):a!==!0&&v(()=>{n(!0)})};return c(()=>{n()}),f(()=>{clearTimeout(r),e!==void 0&&(e.disconnect!==void 0?e.disconnect():t&&e.unobserve(t))}),w}else{let a=function(){clearTimeout(r),n!==void 0&&(n.removeEventListener!==void 0&&n.removeEventListener("resize",s,b.passive),n=void 0)},d=function(){a(),t&&t.contentDocument&&(n=t.contentDocument.defaultView,n.addEventListener("resize",s,b.passive),u())};const e=O();let n;return c(()=>{v(()=>{t=l.$el,t&&d()})}),f(a),l.trigger=s,()=>{if(e.value===!0)return R("object",{style:h.style,tabindex:-1,type:"text/html",data:h.url,"aria-hidden":"true",onLoad:d})}}}});export{L as Q};