-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
1 lines (1 loc) · 3.14 KB
/
index.js
1
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue-demi")):"function"==typeof define&&define.amd?define(["vue-demi"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VueResizeSensor=t(e.VueDemi)}(this,(function(e){"use strict";function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?t(Object(o),!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==r)return;var n,o,i=[],u=!0,a=!1;try{for(r=r.call(e);!(u=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}(e,t)||u(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||u(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var l,f,c=e.defineComponent({name:"VueResizeSensor",props:{tag:{type:String,default:"div"}},setup:function(t,n){var u=n.emit,a=n.refs,l=n.slots,f=e.ref(0),c=e.ref(0);e.watch([f,c],(function(e){var t=o(e,2),r=t[0],n=t[1];u("resize",{width:r,height:n})}));var s=e.ref(null),d=function(){var t=e.isVue2?a.el:s.value;t&&(f.value=t.offsetWidth,c.value=t.offsetHeight)};e.onActivated(d),e.onMounted(d);var y=function(e){e.target.contentWindow.addEventListener("resize",d)};return function(){var n,o=t.tag;return e.h(o,{style:{position:"relative"},ref:e.isVue2?"el":s},[e.h("iframe",r({style:{border:"none",height:"100%",opacity:0,pointerEvents:"none",position:"absolute",userSelect:"none",width:"100%"}},e.isVue2?{on:{load:y}}:{onLoad:y}))].concat(i((n=l.default)?n({width:f.value,height:c.value}):[])))}}});e.isVue2&&(null===(l=globalThis.window)||void 0===l||null===(f=l.Vue)||void 0===f||f.component(c.name,c));return c}));