Comparing version 3.0.3 to 3.0.4
@@ -5,2 +5,9 @@ # Changelog | ||
### [3.0.4](https://github.com/mirari/v-viewer/compare/v3.0.3...v3.0.4) (2021-05-30) | ||
### Bug Fixes | ||
* **api:** fix type declaration ([9987966](https://github.com/mirari/v-viewer/commit/9987966db12372186adc95a5b37643c9ce1587bb)) | ||
### [3.0.3](https://github.com/mirari/v-viewer/compare/v3.0.2...v3.0.3) (2021-05-30) | ||
@@ -7,0 +14,0 @@ |
/*! | ||
* v-viewer v3.0.3 | ||
* v-viewer v3.0.4 | ||
* https://github.com/mirari/v-viewer#readme | ||
@@ -8,4 +8,4 @@ * | ||
* | ||
* Date: 2021-05-30T17:15:40.302Z | ||
* Date: 2021-05-30T17:22:26.709Z | ||
*/ | ||
import e from"viewerjs";export{default as ViewerJs}from"viewerjs";import{h as t,render as r,watch as n,nextTick as o,defineComponent as i,ref as u,onMounted as c,onUnmounted as a,openBlock as f,createBlock as s,renderSlot as l}from"vue";var p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var v=function(e){return e};var d=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)},b=Math.max;var y=function(e,t,r){return t=b(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,i=b(n.length-t,0),u=Array(i);++o<i;)u[o]=n[t+o];o=-1;for(var c=Array(t+1);++o<t;)c[o]=n[o];return c[t]=r(u),d(e,this,c)}};var w=function(e){return function(){return e}},g="object"==typeof p&&p&&p.Object===Object&&p,h=g,j="object"==typeof self&&self&&self.Object===Object&&self,m=h||j||Function("return this")(),O=m.Symbol,_=O,$=Object.prototype,x=$.hasOwnProperty,A=$.toString,T=_?_.toStringTag:void 0;var E=function(e){var t=x.call(e,T),r=e[T];try{e[T]=void 0;var n=!0}catch(i){}var o=A.call(e);return n&&(t?e[T]=r:delete e[T]),o},I=Object.prototype.toString;var S=E,M=function(e){return I.call(e)},P=O?O.toStringTag:void 0;var V=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":P&&P in Object(e)?S(e):M(e)};var D=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},F=V,U=D;var C,W=function(e){if(!U(e))return!1;var t=F(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},N=m["__core-js_shared__"],k=(C=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||""))?"Symbol(src)_1."+C:"";var B=function(e){return!!k&&k in e},R=Function.prototype.toString;var L=W,q=B,z=D,G=function(e){if(null!=e){try{return R.call(e)}catch(t){}try{return e+""}catch(t){}}return""},H=/^\[object .+?Constructor\]$/,J=Function.prototype,K=Object.prototype,Q=J.toString,X=K.hasOwnProperty,Y=RegExp("^"+Q.call(X).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Z=function(e){return!(!z(e)||q(e))&&(L(e)?Y:H).test(G(e))},ee=function(e,t){return null==e?void 0:e[t]};var te=function(e,t){var r=ee(e,t);return Z(r)?r:void 0},re=function(){try{var e=te(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),ne=w,oe=re,ie=oe?function(e,t){return oe(e,"toString",{configurable:!0,enumerable:!1,value:ne(t),writable:!0})}:v,ue=Date.now;var ce=function(e){var t=0,r=0;return function(){var n=ue(),o=16-(n-r);if(r=n,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(ie),ae=v,fe=y,se=ce;var le=function(e,t){return se(fe(e,t,ae),e+"")};var pe=function(e,t){return e===t||e!=e&&t!=t};var ve=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},de=W,be=ve;var ye=function(e){return null!=e&&be(e.length)&&!de(e)},we=/^(?:0|[1-9]\d*)$/;var ge=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&we.test(e))&&e>-1&&e%1==0&&e<t},he=pe,je=ye,me=ge,Oe=D;var _e=function(e,t,r){if(!Oe(r))return!1;var n=typeof t;return!!("number"==n?je(r)&&me(t,r.length):"string"==n&&t in r)&&he(r[t],e)};var $e=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var xe=function(e){return null!=e&&"object"==typeof e},Ae=V,Te=xe;var Ee,Ie,Se,Me,Pe,Ve,De,Fe,Ue=function(e){return Te(e)&&"[object Arguments]"==Ae(e)},Ce=xe,We=Object.prototype,Ne=We.hasOwnProperty,ke=We.propertyIsEnumerable,Be=Ue(function(){return arguments}())?Ue:function(e){return Ce(e)&&Ne.call(e,"callee")&&!ke.call(e,"callee")},Re=Array.isArray,Le={exports:{}};Ee=Le,Se=m,Me=function(){return!1},Pe=(Ie=Le.exports)&&!Ie.nodeType&&Ie,Ve=Pe&&Ee&&!Ee.nodeType&&Ee,De=Ve&&Ve.exports===Pe?Se.Buffer:void 0,Fe=(De?De.isBuffer:void 0)||Me,Ee.exports=Fe;var qe=V,ze=ve,Ge=xe,He={};He["[object Float32Array]"]=He["[object Float64Array]"]=He["[object Int8Array]"]=He["[object Int16Array]"]=He["[object Int32Array]"]=He["[object Uint8Array]"]=He["[object Uint8ClampedArray]"]=He["[object Uint16Array]"]=He["[object Uint32Array]"]=!0,He["[object Arguments]"]=He["[object Array]"]=He["[object ArrayBuffer]"]=He["[object Boolean]"]=He["[object DataView]"]=He["[object Date]"]=He["[object Error]"]=He["[object Function]"]=He["[object Map]"]=He["[object Number]"]=He["[object Object]"]=He["[object RegExp]"]=He["[object Set]"]=He["[object String]"]=He["[object WeakMap]"]=!1;var Je=function(e){return Ge(e)&&ze(e.length)&&!!He[qe(e)]};var Ke=function(e){return function(t){return e(t)}},Qe={exports:{}};!function(e,t){var r=g,n=t&&!t.nodeType&&t,o=n&&e&&!e.nodeType&&e,i=o&&o.exports===n&&r.process,u=function(){try{var e=o&&o.require&&o.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(t){}}();e.exports=u}(Qe,Qe.exports);var Xe=Je,Ye=Ke,Ze=Qe.exports,et=Ze&&Ze.isTypedArray,tt=et?Ye(et):Xe,rt=$e,nt=Be,ot=Re,it=Le.exports,ut=ge,ct=tt,at=Object.prototype.hasOwnProperty;var ft=function(e,t){var r=ot(e),n=!r&&nt(e),o=!r&&!n&&it(e),i=!r&&!n&&!o&&ct(e),u=r||n||o||i,c=u?rt(e.length,String):[],a=c.length;for(var f in e)!t&&!at.call(e,f)||u&&("length"==f||o&&("offset"==f||"parent"==f)||i&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||ut(f,a))||c.push(f);return c},st=Object.prototype;var lt=D,pt=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||st)},vt=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t},dt=Object.prototype.hasOwnProperty;var bt=ft,yt=function(e){if(!lt(e))return vt(e);var t=pt(e),r=[];for(var n in e)("constructor"!=n||!t&&dt.call(e,n))&&r.push(n);return r},wt=ye;var gt=le,ht=pe,jt=_e,mt=function(e){return wt(e)?bt(e,!0):yt(e)},Ot=Object.prototype,_t=Ot.hasOwnProperty,$t=gt((function(e,t){e=Object(e);var r=-1,n=t.length,o=n>2?t[2]:void 0;for(o&&jt(t[0],t[1],o)&&(n=1);++r<n;)for(var i=t[r],u=mt(i),c=-1,a=u.length;++c<a;){var f=u[c],s=e[f];(void 0===s||ht(s,Ot[f])&&!_t.call(e,f))&&(e[f]=i[f])}return e}));const xt="undefined"!=typeof window&&null!==window;!function(){if(xt&&"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype)return"isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get(){return this.intersectionRatio>0}}),!0}();const At=Object.prototype.propertyIsEnumerable,Tt=Object.getOwnPropertySymbols;function Et(e){return"function"==typeof e||"[object Object]"===toString.call(e)}function It(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e}function St(e,...t){if(!Et(e))throw new TypeError("expected the first argument to be an object");if(0===t.length||"function"!=typeof Symbol||"function"!=typeof Tt)return e;for(const r of t){const t=Tt(r);for(const n of t)At.call(r,n)&&(e[n]=r[n])}return e}function Mt(e,...t){let r=0;var n;for(("object"==typeof(n=e)?null===n:"function"!=typeof n)&&(e=t[r++]),e||(e={});r<t.length;r++)if(Et(t[r])){for(const n of Object.keys(t[r]))It(n)&&(Et(e[n])&&Et(t[r][n])?Mt(e[n],t[r][n]):e[n]=t[r][n]);St(e,t[r])}return e}const Pt=({images:n=[],options:o})=>{o=Mt(o,{inline:!1});const i=document.createElement("div"),u=t("div",{style:{display:"none"},class:["__viewer-token"]},n.map((e=>t("img","string"==typeof e?{src:e}:e))));r(u,i);const c=i.firstElementChild;document.body.appendChild(c);const a=new e(c,o),f=a.destroy.bind(a);return a.destroy=function(){return f(),r(null,i),a},a.show(),c.addEventListener("hidden",(function(){this.viewer===a&&a.destroy()})),a};var Vt=m,Dt=/\s/;var Ft=function(e){for(var t=e.length;t--&&Dt.test(e.charAt(t)););return t},Ut=/^\s+/;var Ct=V,Wt=xe;var Nt=function(e){return e?e.slice(0,Ft(e)+1).replace(Ut,""):e},kt=D,Bt=function(e){return"symbol"==typeof e||Wt(e)&&"[object Symbol]"==Ct(e)},Rt=/^[-+]0x[0-9a-f]+$/i,Lt=/^0b[01]+$/i,qt=/^0o[0-7]+$/i,zt=parseInt;var Gt=D,Ht=function(){return Vt.Date.now()},Jt=function(e){if("number"==typeof e)return e;if(Bt(e))return NaN;if(kt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=kt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Nt(e);var r=Lt.test(e);return r||qt.test(e)?zt(e.slice(2),r?2:8):Rt.test(e)?NaN:+e},Kt=Math.max,Qt=Math.min;var Xt=function(e,t,r){var n,o,i,u,c,a,f=0,s=!1,l=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var r=n,i=o;return n=o=void 0,f=t,u=e.apply(i,r)}function d(e){return f=e,c=setTimeout(y,t),s?v(e):u}function b(e){var r=e-a;return void 0===a||r>=t||r<0||l&&e-f>=i}function y(){var e=Ht();if(b(e))return w(e);c=setTimeout(y,function(e){var r=t-(e-a);return l?Qt(r,i-(e-f)):r}(e))}function w(e){return c=void 0,p&&n?v(e):(n=o=void 0,u)}function g(){var e=Ht(),r=b(e);if(n=arguments,o=this,a=e,r){if(void 0===c)return d(a);if(l)return clearTimeout(c),c=setTimeout(y,t),v(a)}return void 0===c&&(c=setTimeout(y,t)),u}return t=Jt(t)||0,Gt(r)&&(s=!!r.leading,i=(l="maxWait"in r)?Kt(Jt(r.maxWait)||0,t):i,p="trailing"in r?!!r.trailing:p),g.cancel=function(){void 0!==c&&clearTimeout(c),f=0,n=a=o=c=void 0},g.flush=function(){return void 0===c?u:w(Ht())},g};const Yt=({name:t="viewer",debug:r=!1})=>{async function i(r,n,i=!1,c=!1){await o(),c&&!function(e){const t=e.innerHTML.match(/<img([\w\W]+?)[\\/]?>/g),r=t?t.join(""):void 0;return e.__viewerImageDiffCache===r?(a("Element change detected, but image(s) has not changed"),!1):(a("Image change detected"),e.__viewerImageDiffCache=r,!0)}(r)||(i||!r[`$${t}`]?(u(r),r[`$${t}`]=new e(r,n),a("Viewer created")):(r[`$${t}`].update(),a("Viewer updated")))}function u(e){e[`$${t}`]&&(e[`$${t}`].destroy(),delete e[`$${t}`],a("Viewer destroyed"))}function c(e){e.__viewerMutationObserver&&(e.__viewerMutationObserver.disconnect(),delete e.__viewerMutationObserver,a("observer destroyed"))}function a(...e){r&&console.log(...e)}return{mounted(e,t,r){a("Viewer bind");const o=Xt(i,50);o(e,t.value),function(e,t,r,o){e.__viewerUnwatch=n((()=>t.value),((r,n)=>{a("Change detected by watcher: ",t.value),o(e,r,!0,!1)}),{deep:!0}),a("Watcher created, expression: ",t.value)}(e,t,0,o),t.modifiers.static||function(e,t,r,n){c(e);const o=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;if(!o)return void a("Observer not supported");const i=new o((o=>{o.forEach((o=>{a(`Viewer mutation:${o.type}`),r(e,t,n,!0)}))}));i.observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),e.__viewerMutationObserver=i,a("Observer created")}(e,t.value,o,t.modifiers.rebuild)},unmounted(e){a("Viewer unbind"),c(e),function(e){e.__viewerUnwatch&&(e.__viewerUnwatch(),delete e.__viewerUnwatch,a("Watcher destroyed"))}(e),u(e)}}};var Zt=i({props:{images:{type:Array,default:()=>[]},rebuild:{type:Boolean,default:!1},trigger:{type:Object,default:null},options:{type:Object,default:()=>null}},emits:["inited"],setup(t,{emit:r}){let i;const f=u();function s(){i=new e(f.value,t.options),r("inited",i)}function l(){i&&i.destroy()}function p(){l(),s()}function v(){i?(i.update(),r("inited",i)):s()}function d(){t.rebuild?p():v()}const b={deep:!0};return n((()=>t.images),(()=>o((()=>d()))),b),n((()=>t.trigger),(()=>o((()=>d()))),b),n((()=>t.options),(()=>o((()=>d()))),b),c((()=>s())),a((()=>l())),{root:f,createViewer:s,rebuildViewer:p,updateViewer:v,destroyViewer:l}}});const er={ref:"root"};Zt.render=function(e,t,r,n,o,i){return f(),s("div",er,[l(e.$slots,"default",{images:e.images,options:e.options})],512)};var tr={install(t,{name:r="viewer",debug:n=!1,defaultOptions:o}={}){o&&e.setDefaults(o),t.config.globalProperties[`$${r}Api`]=Pt,t.component(r,$t(Zt,{name:r})),t.directive(r,Yt({name:r,debug:n}))},setDefaults(t){e.setDefaults(t)}};export default tr;export{Pt as api,Zt as component,Yt as directive}; |
/*! | ||
* v-viewer v3.0.3 | ||
* v-viewer v3.0.4 | ||
* https://github.com/mirari/v-viewer#readme | ||
@@ -8,4 +8,4 @@ * | ||
* | ||
* Date: 2021-05-30T17:15:40.302Z | ||
* Date: 2021-05-30T17:22:26.709Z | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("viewerjs"),require("vue")):"function"==typeof define&&define.amd?define(["exports","viewerjs","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VueViewer={},e.Viewer,e.Vue)}(this,(function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t),i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var u=function(e){return e};var c=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)},a=Math.max;var f=function(e,t,r){return t=a(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,i=a(n.length-t,0),u=Array(i);++o<i;)u[o]=n[t+o];o=-1;for(var f=Array(t+1);++o<t;)f[o]=n[o];return f[t]=r(u),c(e,this,f)}};var s=function(e){return function(){return e}},l="object"==typeof i&&i&&i.Object===Object&&i,d=l,p="object"==typeof self&&self&&self.Object===Object&&self,v=d||p||Function("return this")(),b=v.Symbol,y=b,w=Object.prototype,g=w.hasOwnProperty,h=w.toString,j=y?y.toStringTag:void 0;var m=function(e){var t=g.call(e,j),r=e[j];try{e[j]=void 0;var n=!0}catch(i){}var o=h.call(e);return n&&(t?e[j]=r:delete e[j]),o},O=Object.prototype.toString;var _=m,x=function(e){return O.call(e)},T=b?b.toStringTag:void 0;var $=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":T&&T in Object(e)?_(e):x(e)};var A=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},S=$,E=A;var I,M=function(e){if(!E(e))return!1;var t=S(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},V=v["__core-js_shared__"],P=(I=/[^.]+$/.exec(V&&V.keys&&V.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"";var k=function(e){return!!P&&P in e},D=Function.prototype.toString;var U=M,F=k,C=A,B=function(e){if(null!=e){try{return D.call(e)}catch(t){}try{return e+""}catch(t){}}return""},W=/^\[object .+?Constructor\]$/,N=Function.prototype,R=Object.prototype,q=N.toString,L=R.hasOwnProperty,z=RegExp("^"+q.call(L).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var G=function(e){return!(!C(e)||F(e))&&(U(e)?z:W).test(B(e))},H=function(e,t){return null==e?void 0:e[t]};var J=function(e,t){var r=H(e,t);return G(r)?r:void 0},K=function(){try{var e=J(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Q=s,X=K,Y=X?function(e,t){return X(e,"toString",{configurable:!0,enumerable:!1,value:Q(t),writable:!0})}:u,Z=Date.now;var ee=function(e){var t=0,r=0;return function(){var n=Z(),o=16-(n-r);if(r=n,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(Y),te=u,re=f,ne=ee;var oe=function(e,t){return ne(re(e,t,te),e+"")};var ie=function(e,t){return e===t||e!=e&&t!=t};var ue=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},ce=M,ae=ue;var fe=function(e){return null!=e&&ae(e.length)&&!ce(e)},se=/^(?:0|[1-9]\d*)$/;var le=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&se.test(e))&&e>-1&&e%1==0&&e<t},de=ie,pe=fe,ve=le,be=A;var ye=function(e,t,r){if(!be(r))return!1;var n=typeof t;return!!("number"==n?pe(r)&&ve(t,r.length):"string"==n&&t in r)&&de(r[t],e)};var we=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var ge=function(e){return null!=e&&"object"==typeof e},he=$,je=ge;var me,Oe,_e,xe,Te,$e,Ae,Se,Ee=function(e){return je(e)&&"[object Arguments]"==he(e)},Ie=ge,Me=Object.prototype,Ve=Me.hasOwnProperty,Pe=Me.propertyIsEnumerable,ke=Ee(function(){return arguments}())?Ee:function(e){return Ie(e)&&Ve.call(e,"callee")&&!Pe.call(e,"callee")},De=Array.isArray,Ue={exports:{}};me=Ue,_e=v,xe=function(){return!1},Te=(Oe=Ue.exports)&&!Oe.nodeType&&Oe,$e=Te&&me&&!me.nodeType&&me,Ae=$e&&$e.exports===Te?_e.Buffer:void 0,Se=(Ae?Ae.isBuffer:void 0)||xe,me.exports=Se;var Fe=$,Ce=ue,Be=ge,We={};We["[object Float32Array]"]=We["[object Float64Array]"]=We["[object Int8Array]"]=We["[object Int16Array]"]=We["[object Int32Array]"]=We["[object Uint8Array]"]=We["[object Uint8ClampedArray]"]=We["[object Uint16Array]"]=We["[object Uint32Array]"]=!0,We["[object Arguments]"]=We["[object Array]"]=We["[object ArrayBuffer]"]=We["[object Boolean]"]=We["[object DataView]"]=We["[object Date]"]=We["[object Error]"]=We["[object Function]"]=We["[object Map]"]=We["[object Number]"]=We["[object Object]"]=We["[object RegExp]"]=We["[object Set]"]=We["[object String]"]=We["[object WeakMap]"]=!1;var Ne=function(e){return Be(e)&&Ce(e.length)&&!!We[Fe(e)]};var Re=function(e){return function(t){return e(t)}},qe={exports:{}};!function(e,t){var r=l,n=t&&!t.nodeType&&t,o=n&&e&&!e.nodeType&&e,i=o&&o.exports===n&&r.process,u=function(){try{var e=o&&o.require&&o.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(t){}}();e.exports=u}(qe,qe.exports);var Le=Ne,ze=Re,Ge=qe.exports,He=Ge&&Ge.isTypedArray,Je=He?ze(He):Le,Ke=we,Qe=ke,Xe=De,Ye=Ue.exports,Ze=le,et=Je,tt=Object.prototype.hasOwnProperty;var rt=function(e,t){var r=Xe(e),n=!r&&Qe(e),o=!r&&!n&&Ye(e),i=!r&&!n&&!o&&et(e),u=r||n||o||i,c=u?Ke(e.length,String):[],a=c.length;for(var f in e)!t&&!tt.call(e,f)||u&&("length"==f||o&&("offset"==f||"parent"==f)||i&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||Ze(f,a))||c.push(f);return c},nt=Object.prototype;var ot=A,it=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||nt)},ut=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t},ct=Object.prototype.hasOwnProperty;var at=rt,ft=function(e){if(!ot(e))return ut(e);var t=it(e),r=[];for(var n in e)("constructor"!=n||!t&&ct.call(e,n))&&r.push(n);return r},st=fe;var lt=oe,dt=ie,pt=ye,vt=function(e){return st(e)?at(e,!0):ft(e)},bt=Object.prototype,yt=bt.hasOwnProperty,wt=lt((function(e,t){e=Object(e);var r=-1,n=t.length,o=n>2?t[2]:void 0;for(o&&pt(t[0],t[1],o)&&(n=1);++r<n;)for(var i=t[r],u=vt(i),c=-1,a=u.length;++c<a;){var f=u[c],s=e[f];(void 0===s||dt(s,bt[f])&&!yt.call(e,f))&&(e[f]=i[f])}return e}));const gt="undefined"!=typeof window&&null!==window;!function(){if(gt&&"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype)return"isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get(){return this.intersectionRatio>0}}),!0}();const ht=Object.prototype.propertyIsEnumerable,jt=Object.getOwnPropertySymbols;function mt(e){return"function"==typeof e||"[object Object]"===toString.call(e)}function Ot(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e}function _t(e,...t){if(!mt(e))throw new TypeError("expected the first argument to be an object");if(0===t.length||"function"!=typeof Symbol||"function"!=typeof jt)return e;for(const r of t){const t=jt(r);for(const n of t)ht.call(r,n)&&(e[n]=r[n])}return e}function xt(e,...t){let r=0;var n;for(("object"==typeof(n=e)?null===n:"function"!=typeof n)&&(e=t[r++]),e||(e={});r<t.length;r++)if(mt(t[r])){for(const n of Object.keys(t[r]))Ot(n)&&(mt(e[n])&&mt(t[r][n])?xt(e[n],t[r][n]):e[n]=t[r][n]);_t(e,t[r])}return e}const Tt=({images:e=[],options:t})=>{t=xt(t,{inline:!1});const n=document.createElement("div"),i=r.h("div",{style:{display:"none"},class:["__viewer-token"]},e.map((e=>r.h("img","string"==typeof e?{src:e}:e))));r.render(i,n);const u=n.firstElementChild;document.body.appendChild(u);const c=new o.default(u,t),a=c.destroy.bind(c);return c.destroy=function(){return a(),r.render(null,n),c},c.show(),u.addEventListener("hidden",(function(){this.viewer===c&&c.destroy()})),c};var $t=v,At=/\s/;var St=function(e){for(var t=e.length;t--&&At.test(e.charAt(t)););return t},Et=/^\s+/;var It=$,Mt=ge;var Vt=function(e){return e?e.slice(0,St(e)+1).replace(Et,""):e},Pt=A,kt=function(e){return"symbol"==typeof e||Mt(e)&&"[object Symbol]"==It(e)},Dt=/^[-+]0x[0-9a-f]+$/i,Ut=/^0b[01]+$/i,Ft=/^0o[0-7]+$/i,Ct=parseInt;var Bt=A,Wt=function(){return $t.Date.now()},Nt=function(e){if("number"==typeof e)return e;if(kt(e))return NaN;if(Pt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Pt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Vt(e);var r=Ut.test(e);return r||Ft.test(e)?Ct(e.slice(2),r?2:8):Dt.test(e)?NaN:+e},Rt=Math.max,qt=Math.min;var Lt=function(e,t,r){var n,o,i,u,c,a,f=0,s=!1,l=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var r=n,i=o;return n=o=void 0,f=t,u=e.apply(i,r)}function v(e){return f=e,c=setTimeout(y,t),s?p(e):u}function b(e){var r=e-a;return void 0===a||r>=t||r<0||l&&e-f>=i}function y(){var e=Wt();if(b(e))return w(e);c=setTimeout(y,function(e){var r=t-(e-a);return l?qt(r,i-(e-f)):r}(e))}function w(e){return c=void 0,d&&n?p(e):(n=o=void 0,u)}function g(){var e=Wt(),r=b(e);if(n=arguments,o=this,a=e,r){if(void 0===c)return v(a);if(l)return clearTimeout(c),c=setTimeout(y,t),p(a)}return void 0===c&&(c=setTimeout(y,t)),u}return t=Nt(t)||0,Bt(r)&&(s=!!r.leading,i=(l="maxWait"in r)?Rt(Nt(r.maxWait)||0,t):i,d="trailing"in r?!!r.trailing:d),g.cancel=function(){void 0!==c&&clearTimeout(c),f=0,n=a=o=c=void 0},g.flush=function(){return void 0===c?u:w(Wt())},g};const zt=({name:e="viewer",debug:t=!1})=>{async function n(t,n,u=!1,a=!1){await r.nextTick(),a&&!function(e){const t=e.innerHTML.match(/<img([\w\W]+?)[\\/]?>/g),r=t?t.join(""):void 0;return e.__viewerImageDiffCache===r?(c("Element change detected, but image(s) has not changed"),!1):(c("Image change detected"),e.__viewerImageDiffCache=r,!0)}(t)||(u||!t[`$${e}`]?(i(t),t[`$${e}`]=new o.default(t,n),c("Viewer created")):(t[`$${e}`].update(),c("Viewer updated")))}function i(t){t[`$${e}`]&&(t[`$${e}`].destroy(),delete t[`$${e}`],c("Viewer destroyed"))}function u(e){e.__viewerMutationObserver&&(e.__viewerMutationObserver.disconnect(),delete e.__viewerMutationObserver,c("observer destroyed"))}function c(...e){t&&console.log(...e)}return{mounted(e,t,o){c("Viewer bind");const i=Lt(n,50);i(e,t.value),function(e,t,n,o){e.__viewerUnwatch=r.watch((()=>t.value),((r,n)=>{c("Change detected by watcher: ",t.value),o(e,r,!0,!1)}),{deep:!0}),c("Watcher created, expression: ",t.value)}(e,t,0,i),t.modifiers.static||function(e,t,r,n){u(e);const o=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;if(!o)return void c("Observer not supported");const i=new o((o=>{o.forEach((o=>{c(`Viewer mutation:${o.type}`),r(e,t,n,!0)}))}));i.observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),e.__viewerMutationObserver=i,c("Observer created")}(e,t.value,i,t.modifiers.rebuild)},unmounted(e){c("Viewer unbind"),u(e),function(e){e.__viewerUnwatch&&(e.__viewerUnwatch(),delete e.__viewerUnwatch,c("Watcher destroyed"))}(e),i(e)}}};var Gt=r.defineComponent({props:{images:{type:Array,default:()=>[]},rebuild:{type:Boolean,default:!1},trigger:{type:Object,default:null},options:{type:Object,default:()=>null}},emits:["inited"],setup(e,{emit:t}){let n;const i=r.ref();function u(){n=new o.default(i.value,e.options),t("inited",n)}function c(){n&&n.destroy()}function a(){c(),u()}function f(){n?(n.update(),t("inited",n)):u()}function s(){e.rebuild?a():f()}const l={deep:!0};return r.watch((()=>e.images),(()=>r.nextTick((()=>s()))),l),r.watch((()=>e.trigger),(()=>r.nextTick((()=>s()))),l),r.watch((()=>e.options),(()=>r.nextTick((()=>s()))),l),r.onMounted((()=>u())),r.onUnmounted((()=>c())),{root:i,createViewer:u,rebuildViewer:a,updateViewer:f,destroyViewer:c}}});const Ht={ref:"root"};Gt.render=function(e,t,n,o,i,u){return r.openBlock(),r.createBlock("div",Ht,[r.renderSlot(e.$slots,"default",{images:e.images,options:e.options})],512)};var Jt={install(e,{name:t="viewer",debug:r=!1,defaultOptions:n}={}){n&&o.default.setDefaults(n),e.config.globalProperties[`$${t}Api`]=Tt,e.component(t,wt(Gt,{name:t})),e.directive(t,zt({name:t,debug:r}))},setDefaults(e){o.default.setDefaults(e)}};Object.defineProperty(e,"ViewerJs",{enumerable:!0,get:function(){return o.default}}),e.api=Tt,e.component=Gt,e.default=Jt,e.directive=zt,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"})); |
{ | ||
"name": "v-viewer", | ||
"scope": "VueViewer", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "Image viewer component for vue, supports rotation, scale, zoom and so on, based on viewer.js", | ||
@@ -6,0 +6,0 @@ "main": "./dist/index.umd.js", |
@@ -24,3 +24,3 @@ import { App } from 'vue' | ||
export type viewerApi = (options: VueViewer.ViewerApiOptions) => ViewerType | ||
export type api = (options: VueViewer.ViewerApiOptions) => ViewerType | ||
@@ -27,0 +27,0 @@ export type directive = (options?: VueViewer.InstallationOptions) => Directive |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
39032
2