vistaview 0.7.1 â 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -14
- package/dist/lib/vista-view.d.ts +2 -0
- package/dist/lib/vista-view.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/styles/dark-rounded.css +1 -1
- package/dist/vistaview.d.ts +4 -0
- package/dist/vistaview.d.ts.map +1 -1
- package/dist/vistaview.js +163 -133
- package/dist/vistaview.umd.js +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A lightweight, modern image lightbox library for the web. Zero dependencies, fra
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- ðŠķ **Lightweight** â ~
|
|
9
|
+
- ðŠķ **Lightweight** â ~43KB ESM (~10KB gzip), minimal footprint, zero dependencies
|
|
10
10
|
- ðą **Touch-first** â Swipe gestures for navigation and closing, pinch-to-zoom support
|
|
11
11
|
- ðĻ **Customizable** â Configurable controls, animations, and styling via CSS variables
|
|
12
12
|
- âŋ **Accessible** â Keyboard navigation, ARIA labels, reduced motion support
|
|
@@ -189,6 +189,10 @@ import {
|
|
|
189
189
|
vistaView,
|
|
190
190
|
vistaViewDownload, // Helper function for download control
|
|
191
191
|
DefaultOptions, // Default configuration options
|
|
192
|
+
setup, // Default setup function
|
|
193
|
+
init, // Default init function
|
|
194
|
+
close, // Default close function
|
|
195
|
+
transition, // Default transition function
|
|
192
196
|
} from 'vistaview';
|
|
193
197
|
|
|
194
198
|
import type {
|
|
@@ -326,24 +330,24 @@ vite v6.4.1 building for production...
|
|
|
326
330
|
â 19 modules transformed.
|
|
327
331
|
|
|
328
332
|
[vite:dts] Start generate declaration files...
|
|
329
|
-
dist/styles/dark-rounded.css
|
|
330
|
-
dist/style.css
|
|
331
|
-
dist/svelte.js 0.62 kB â gzip:
|
|
332
|
-
dist/solid.js 1.19 kB â gzip:
|
|
333
|
-
dist/vue.js 1.36 kB â gzip:
|
|
334
|
-
dist/react.js 1.67 kB â gzip:
|
|
335
|
-
dist/vistaview.js
|
|
336
|
-
[vite:dts] Declaration files built in
|
|
337
|
-
|
|
338
|
-
â built in
|
|
333
|
+
dist/styles/dark-rounded.css 1.55 kB â gzip: 0.41 kB
|
|
334
|
+
dist/style.css 6.88 kB â gzip: 1.65 kB
|
|
335
|
+
dist/svelte.js 0.62 kB â gzip: 0.29 kB
|
|
336
|
+
dist/solid.js 1.19 kB â gzip: 0.54 kB
|
|
337
|
+
dist/vue.js 1.36 kB â gzip: 0.59 kB
|
|
338
|
+
dist/react.js 1.67 kB â gzip: 0.59 kB
|
|
339
|
+
dist/vistaview.js 43.30 kB â gzip: 10.43 kB
|
|
340
|
+
[vite:dts] Declaration files built in 664ms.
|
|
341
|
+
|
|
342
|
+
â built in 772ms
|
|
339
343
|
vite v6.4.1 building for production...
|
|
340
344
|
â 13 modules transformed.
|
|
341
345
|
|
|
342
346
|
[vite:dts] Start generate declaration files...
|
|
343
|
-
dist/vistaview.umd.js
|
|
344
|
-
[vite:dts] Declaration files built in
|
|
347
|
+
dist/vistaview.umd.js 33.94 kB â gzip: 9.29 kB
|
|
348
|
+
[vite:dts] Declaration files built in 657ms.
|
|
345
349
|
|
|
346
|
-
â built in
|
|
350
|
+
â built in 751ms
|
|
347
351
|
```
|
|
348
352
|
|
|
349
353
|
## License
|
package/dist/lib/vista-view.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export declare class VistaView {
|
|
|
24
24
|
private throttle;
|
|
25
25
|
constructor(elements: NodeListOf<HTMLElement> | VistaImg[], options?: VistaOpt);
|
|
26
26
|
private lastSwapTime;
|
|
27
|
+
private isRapidSwap;
|
|
28
|
+
private isRapidSwapRelease;
|
|
27
29
|
private transitionCleanup;
|
|
28
30
|
private swap;
|
|
29
31
|
private getChildElements;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vista-view.d.ts","sourceRoot":"","sources":["../../src/lib/vista-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,QAAQ,EAGR,QAAQ,EAIR,gCAAgC,EACjC,MAAM,SAAS,CAAC;AAajB,eAAO,MAAM,gBAAgB,EAAE;IAAE,eAAe,EAAE,SAAS,GAAG,IAAI,CAAA;CAEjE,CAAC;AAEF,qBAAa,SAAS;IACpB,OAAO,EAAE,QAAQ,CAAC;IAClB,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,QAAQ,EAAE,CAAC;IAC/C,eAAe,EAAE,OAAO,CAAC;IAEzB,OAAO,CAAC,YAAY,CAAc;IAClC,OAAO,CAAC,eAAe,CAAmE;IAE1F,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,kBAAkB,CAAiC;IAC3D,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,gBAAgB,CAMV;IAEd,IAAI,EAAE,WAAW,GAAG,IAAI,CAAQ;IAChC,cAAc,EAAE,WAAW,GAAG,IAAI,CAAQ;IAC1C,EAAE,CAAC,CAAC,SAAS,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAIrD,OAAO,CAAC,eAAe,CAIrB;IAEF,OAAO,CAAC,qBAAqB,CAAwD;IAErF,OAAO,CAAC,eAAe,CAAgC;IAEvD,OAAO,CAAC,QAAQ,CAAkB;gBAEtB,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,QAAQ,EAAE,EAAE,OAAO,GAAE,QAAa;IAsElF,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,iBAAiB,CAA6B;YACxC,IAAI;
|
|
1
|
+
{"version":3,"file":"vista-view.d.ts","sourceRoot":"","sources":["../../src/lib/vista-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,QAAQ,EAGR,QAAQ,EAIR,gCAAgC,EACjC,MAAM,SAAS,CAAC;AAajB,eAAO,MAAM,gBAAgB,EAAE;IAAE,eAAe,EAAE,SAAS,GAAG,IAAI,CAAA;CAEjE,CAAC;AAEF,qBAAa,SAAS;IACpB,OAAO,EAAE,QAAQ,CAAC;IAClB,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,QAAQ,EAAE,CAAC;IAC/C,eAAe,EAAE,OAAO,CAAC;IAEzB,OAAO,CAAC,YAAY,CAAc;IAClC,OAAO,CAAC,eAAe,CAAmE;IAE1F,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,kBAAkB,CAAiC;IAC3D,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,gBAAgB,CAMV;IAEd,IAAI,EAAE,WAAW,GAAG,IAAI,CAAQ;IAChC,cAAc,EAAE,WAAW,GAAG,IAAI,CAAQ;IAC1C,EAAE,CAAC,CAAC,SAAS,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAIrD,OAAO,CAAC,eAAe,CAIrB;IAEF,OAAO,CAAC,qBAAqB,CAAwD;IAErF,OAAO,CAAC,eAAe,CAAgC;IAEvD,OAAO,CAAC,QAAQ,CAAkB;gBAEtB,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,QAAQ,EAAE,EAAE,OAAO,GAAE,QAAa;IAsElF,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,kBAAkB,CAAK;IAC/B,OAAO,CAAC,iBAAiB,CAA6B;YACxC,IAAI;IAyIlB,OAAO,CAAC,gBAAgB;IAkDxB,UAAU,EAAE,OAAO,CAAS;IAC5B,OAAO,CAAC,MAAM;IASd,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,kBAAkB;IAmC1B,OAAO,CAAC,eAAe;IA4CvB,OAAO,CAAC,mBAAmB;IAiE3B,OAAO,CAAC,SAAS,CAuBf;IAEF,OAAO,CAAC,QAAQ,CAYd;IAEF,OAAO,CAAC,eAAe,CAkBrB;IAGF,OAAO,CAAC,gBAAgB,CAAyD;IACjF,uBAAuB,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,gCAAgC,KAAK,IAAI,GAAG,IAAI;IAGtF,OAAO,CAAC,0BAA0B;IAIlC,OAAO,CAAC,0BAA0B,CAwDhC;IAGF,IAAI,CAAC,UAAU,GAAE,MAAU,GAAG,IAAI;IA4I5B,KAAK,CAAC,OAAO,GAAE,OAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA0DnD,IAAI,IAAI,IAAI;IASZ,IAAI,IAAI,IAAI;IASZ,OAAO,IAAI,IAAI;IAcf,eAAe,IAAI,MAAM;IAOzB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;CAoBlE"}
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--vvw-bg-color: #000000;--vvw-text-color: #ffffff;--vvw-bg-blur: 10px;--vvw-bg-opacity: .8;--vvw-init-z: 1;--vvw-dest-z: 2147483647;--vvw-anim-dur: 333;--vvw-init-w: 0;--vvw-init-h: 0;--vvw-init-t: 0;--vvw-init-l: 0;--vvw-idx: 0;--vvw-radius: 0px}@keyframes vvw-pulse{0%{opacity:1;border-radius:var(--vvw-init-radius);scale:1}50%{opacity:.7;border-radius:var(--vvw-pulse-radius);scale:.99}to{opacity:1;border-radius:var(--vvw-init-radius);scale:1}}@keyframes vvw-simple-pulse{0%{opacity:1}50%{opacity:.5}to{opacity:1}}@keyframes vvw-gradient{0%{background-position:0% 50%}50%{background-position:100% 50%}to{background-position:0% 50%}}.vvw-root{position:fixed;top:0;left:0;width:100vw;width:100dvw;height:100vh;height:100dvh;overflow:hidden;z-index:var(--vvw-init-z);opacity:0;isolation:isolate;transform:none;touch-action:none}.vvw-container{position:relative;width:100%;height:100%;overflow:hidden}.vvw-bg{position:absolute;top:0;left:0;width:100%;height:100%;z-index:0;background-color:rgb(from var(--vvw-bg-color) r g b / var(--vvw-bg-opacity));-webkit-backdrop-filter:blur(var(--vvw-bg-blur));backdrop-filter:blur(var(--vvw-bg-blur));opacity:0;transition:opacity calc(var(--vvw-anim-dur) * 1ms) calc(var(--vvw-anim-dur) * 1ms) ease}.vvw-image-container{position:relative;height:100%;overflow:hidden;isolation:isolate}.vvw-item{position:relative;width:100%;height:100%;overflow:hidden}.vvw-item img{position:absolute;display:block;top:50%;left:50%;translate:-50% -50%}.vvw-item .vvw-img-err{position:absolute;top:50%;left:50%;translate:-50% -50%;color:#fff;background-color:red;font-size:14px;text-align:center;padding:8px 12px;margin:0;display:none;z-index:2}.vvw-item .vvw-img-lo{--vvw-init-radius: 0px;--vvw-pulse-radius: 0px;--vvw-init-x: 0px;--vvw-init-y: 0px;--vvw-current-x: 0px;--vvw-current-y: 0px;outline:1px solid rgba(255,255,255,.2);z-index:0;opacity:1;border-radius:var(--vvw-init-radius);overflow:hidden;transition:transform calc(var(--vvw-anim-dur) * 1ms) ease;transform:translate3d(var(--vvw-current-x),var(--vvw-current-y),0);background:linear-gradient(45deg,#1a1a1a,#333,#1a1a1a,#555);background-size:400% 400%;animation:vvw-gradient 3s ease-in-out infinite}.vvw-item .vvw-img-hi{
|
|
1
|
+
:root{--vvw-bg-color: #000000;--vvw-text-color: #ffffff;--vvw-bg-blur: 10px;--vvw-bg-opacity: .8;--vvw-init-z: 1;--vvw-dest-z: 2147483647;--vvw-anim-dur: 333;--vvw-init-w: 0;--vvw-init-h: 0;--vvw-init-t: 0;--vvw-init-l: 0;--vvw-idx: 0;--vvw-radius: 0px}@keyframes vvw-pulse{0%{opacity:1;border-radius:var(--vvw-init-radius);scale:1}50%{opacity:.7;border-radius:var(--vvw-pulse-radius);scale:.99}to{opacity:1;border-radius:var(--vvw-init-radius);scale:1}}@keyframes vvw-simple-pulse{0%{opacity:1}50%{opacity:.5}to{opacity:1}}@keyframes vvw-gradient{0%{background-position:0% 50%}50%{background-position:100% 50%}to{background-position:0% 50%}}.vvw-root{position:fixed;top:0;left:0;width:100vw;width:100dvw;height:100vh;height:100dvh;overflow:hidden;z-index:var(--vvw-init-z);opacity:0;isolation:isolate;transform:none;touch-action:none}.vvw-container{position:relative;width:100%;height:100%;overflow:hidden}.vvw-bg{position:absolute;top:0;left:0;width:100%;height:100%;z-index:0;background-color:rgb(from var(--vvw-bg-color) r g b / var(--vvw-bg-opacity));-webkit-backdrop-filter:blur(var(--vvw-bg-blur));backdrop-filter:blur(var(--vvw-bg-blur));opacity:0;transition:opacity calc(var(--vvw-anim-dur) * 1ms) calc(var(--vvw-anim-dur) * 1ms) ease}.vvw-image-container{position:relative;height:100%;overflow:hidden;isolation:isolate}.vvw-item{position:relative;width:100%;height:100%;overflow:hidden;cursor:grab}.vvw-item:active{cursor:grabbing}.vvw-item img{position:absolute;display:block;top:50%;left:50%;translate:-50% -50%}.vvw-item .vvw-img-err{position:absolute;top:50%;left:50%;translate:-50% -50%;color:#fff;background-color:red;font-size:14px;text-align:center;padding:8px 12px;margin:0;display:none;z-index:2}.vvw-item .vvw-img-lo{--vvw-init-radius: 0px;--vvw-pulse-radius: 0px;--vvw-init-x: 0px;--vvw-init-y: 0px;--vvw-current-x: 0px;--vvw-current-y: 0px;outline:1px solid rgba(255,255,255,.2);z-index:0;opacity:1;border-radius:var(--vvw-init-radius);overflow:hidden;transition:transform calc(var(--vvw-anim-dur) * 1ms) ease;transform:translate3d(var(--vvw-current-x),var(--vvw-current-y),0);background:linear-gradient(45deg,#1a1a1a,#333,#1a1a1a,#555);background-size:400% 400%;animation:vvw-gradient 3s ease-in-out infinite}.vvw-item .vvw-img-hi{--vvw-init-radius: 0px;--vvw-init-w: 0px;--vvw-init-h: 0px;--vvw-current-w: 0px;--vvw-current-h: 0px;--vvw-current-radius: 0px;width:var(--vvw-init-w);height:var(--vvw-init-h);border-radius:var(--vvw-init-radius);z-index:1;overflow:hidden;object-fit:cover;opacity:0}.vvw-top-bar,.vvw-bottom-bar{position:absolute;top:0;left:0;width:100%;z-index:6;display:flex;align-items:stretch;justify-content:space-between;pointer-events:none}.vvw-top-bar>div,.vvw-bottom-bar>div{display:flex;align-items:stretch}.vvw-bottom-bar{top:unset;bottom:0}.vvw-ui{opacity:0;transition:opacity calc(var(--vvw-anim-dur) * 1ms) ease calc(var(--vvw-anim-dur) * 2ms) ease;outline:1px solid hsl(from var(--vvw-bg-color) h s calc(l + 30));pointer-events:auto}.vvw-ui.vvw-index{font-size:16px;padding:8px 13px;background-color:var(--vvw-bg-color);color:var(--vvw-text-color)}.vvw-ui.vvw-desc{font-size:14px;padding:8px 15px;background-color:var(--vvw-bg-color);color:var(--vvw-text-color);max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vvw-ui:is(button),.vvw-ui>button{background:none;color:inherit;border:0px;font:inherit;cursor:pointer;outline:inherit;box-sizing:border-box;margin:0;padding:8px 12px;align-self:stretch;border-radius:0;display:flex;align-items:center;justify-content:center;background-color:var(--vvw-bg-color);color:var(--vvw-text-color)}.vvw-ui:is(button):disabled,.vvw-ui>button:disabled{color:rgb(from var(--vvw-text-color) r g b / .5);cursor:not-allowed}.vvw-ui:is(button):hover,.vvw-ui>button:hover{background-color:hsl(from var(--vvw-bg-color) h s calc(l + 20))}.vvw-ui:is(button):active,.vvw-ui>button:active{background-color:hsl(from var(--vvw-bg-color) h s calc(l + 40))}.vvw-ui:is(button).vvw-button--loading,.vvw-ui>button.vvw-button--loading{animation:vvw-simple-pulse .5s ease-in-out infinite}.vvw-ui:is(button) svg,.vvw-ui>button svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.vvw-ui:is(button){outline:1px solid hsl(from var(--vvw-bg-color) h s calc(l + 30))}.vvw-ui.vvw-prev{position:absolute;top:50%;left:0;translate:0 -50%;align-items:center;justify-content:center;z-index:2;display:none}.vvw-ui.vvw-next{position:absolute;top:50%;right:0;translate:0 -50%;align-items:center;justify-content:center;z-index:2;display:none}@media(min-width:768px){.vvw-ui.vvw-prev,.vvw-ui.vvw-next{display:flex}}.vvw-arrow-sm .vvw-ui.vvw-prev,.vvw-arrow-sm .vvw-ui.vvw-next{display:flex}.vvw-root.vvw--active{opacity:1;transition:z-index 0ms calc(var(--vvw-anim-dur) * 1ms) ease;z-index:var(--vvw-dest-z)}.vvw-root.vvw--active .vvw-bg{opacity:1}.vvw-root.vvw--active .vvw-img-lo{--vvw-current-x: 0px !important;--vvw-current-y: 0px !important}.vvw-root.vvw--active .vvw-ui{opacity:1}.vvw-root.vvw--settled .vvw-img-lo{animation:vvw-pulse 1s infinite,vvw-gradient 3s ease-in-out infinite;animation-delay:calc(var(--vvw-anim-dur) * 2ms)}.vvw-root.vvw--settled .vvw-img-lo:has(+img.vvw--loaded){animation:none;opacity:0}.vvw-root.vvw--settled .vvw-img-err:has(~img.vvw--loaderror){display:block}.vvw-root.vvw--settled .vvw-img-hi.vvw--loaded{opacity:1;width:var(--vvw-current-w);height:var(--vvw-current-h);border-radius:var(--vvw-current-radius)}.vvw-root.vvw--closing{transition:opacity calc(var(--vvw-anim-dur) * 1ms) calc(var(--vvw-anim-dur) * 2ms) ease,transform 0s calc(var(--vvw-anim-dur) * 2ms) ease,z-index 0s calc(var(--vvw-anim-dur) * 1ms) ease;transform:scale(1);z-index:var(--vvw-init-z);opacity:0!important}.vvw-root.vvw--closing .vvw-img-err:has(~img.vvw--loaderror){display:none}.vvw-root.vvw--closing .vvw-img-hi.vvw--loaded,.vvw-root.vvw--closing .vvw-img-hi.vvw--ready{transition:width calc(var(--vvw-anim-dur) * 1ms) ease,height calc(var(--vvw-anim-dur) * 1ms) ease,border-radius calc(var(--vvw-anim-dur) * 1ms) ease,top calc(var(--vvw-anim-dur) * 1ms) ease,left calc(var(--vvw-anim-dur) * 1ms) ease,opacity 0ms calc(var(--vvw-anim-dur) * 1ms) ease;opacity:0;top:50%!important;left:50%!important;width:var(--vvw-init-w)!important;height:var(--vvw-init-h)!important;border-radius:var(--vvw-init-radius)!important}.vvw-root.vvw--closing .vvw-img-lo{transition:opacity 0ms calc(var(--vvw-anim-dur) * 1ms) ease,transform calc(var(--vvw-anim-dur) * 1ms) calc(var(--vvw-anim-dur) * 1ms) ease;opacity:1!important;--vvw-current-x: var(--vvw-init-x) !important;--vvw-current-y: var(--vvw-init-y) !important}.vvw-root.vvw--closing .vvw-ui{transition:opacity calc(var(--vvw-anim-dur) * 1ms) ease;opacity:0}.vvw-root.vvw--closing .vvw-bg{transition:opacity calc(var(--vvw-anim-dur) * 1ms) calc(var(--vvw-anim-dur) * 1ms) ease;opacity:0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.vvw-ui:is(button),.vvw-ui>button
|
|
1
|
+
.vvw-ui{outline:2px solid #333}.vvw-ui:is(button),.vvw-ui>button,.vvw-ui.vvw-index,.vvw-ui.vvw-desc{background-color:#222;color:#eee}.vvw-ui:is(button){outline:2px solid #333}.vvw-ui:is(button) svg{width:21px;height:21px}.vvw-ui.vvw-prev,.vvw-ui.vvw-next{overflow:hidden}.vvw-ui.vvw-prev button,.vvw-ui.vvw-next button{padding:18px 3px;transition:padding-left 333ms ease,padding-right 333ms ease}.vvw-ui.vvw-prev button svg,.vvw-ui.vvw-next button svg{transition:transform 333ms 111ms ease}.vvw-ui.vvw-prev:hover button svg,.vvw-ui.vvw-next:hover button svg{transform:translate(-3px)}.vvw-ui.vvw-prev{border-top-right-radius:5px;border-bottom-right-radius:5px}.vvw-ui.vvw-prev:hover button{padding-left:8px}.vvw-ui.vvw-next{border-top-left-radius:5px;border-bottom-left-radius:5px}.vvw-ui.vvw-next:hover button{padding-right:8px}.vvw-ui.vvw-next:hover button svg{transform:translate(3px)}.vvw-bottom-bar>div:nth-child(2),.vvw-top-bar>div:nth-child(2){padding:0 1rem}.vvw-bottom-bar>div:first-child :is(button,div):last-child,.vvw-bottom-bar>div:nth-child(2) :is(button,div):last-child{border-top-right-radius:5px}.vvw-bottom-bar>div:nth-child(2) :is(button,div):first-child,.vvw-bottom-bar>div:last-child :is(button,div):first-child{border-top-left-radius:5px}.vvw-top-bar>div:first-child :is(button,div):last-child,.vvw-top-bar>div:nth-child(2) :is(button,div):last-child{border-bottom-right-radius:5px}.vvw-top-bar>div:nth-child(2) :is(button,div):first-child,.vvw-top-bar>div:last-child :is(button,div):first-child{border-bottom-left-radius:5px}
|
package/dist/vistaview.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export type * from './lib/types';
|
|
2
2
|
export { vistaView } from './lib/main';
|
|
3
3
|
export { DefaultOptions } from './lib/defaults/options';
|
|
4
|
+
export { setup } from './lib/defaults/setup';
|
|
5
|
+
export { init } from './lib/defaults/init';
|
|
6
|
+
export { close } from './lib/defaults/close';
|
|
7
|
+
export { transition } from './lib/defaults/transition';
|
|
4
8
|
export { vistaViewDownload } from './lib/components';
|
|
5
9
|
//# sourceMappingURL=vistaview.d.ts.map
|
package/dist/vistaview.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vistaview.d.ts","sourceRoot":"","sources":["../src/vistaview.ts"],"names":[],"mappings":"AAAA,mBAAmB,aAAa,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"vistaview.d.ts","sourceRoot":"","sources":["../src/vistaview.ts"],"names":[],"mappings":"AAAA,mBAAmB,aAAa,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/vistaview.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
var F = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
function
|
|
2
|
+
var R = (s, t, e) => t in s ? F(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var l = (s, t, e) => R(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
function T(s) {
|
|
5
5
|
return s && !/^0(px|%|r?em|vw|vh|vmin|vmax|cm|mm|in|pt|pc|ex|ch)?$/i.test(s.trim()) && s;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function A(s) {
|
|
8
8
|
const e = window.getComputedStyle(s).objectFit || "", { width: i, height: n } = s.getBoundingClientRect(), o = s.naturalWidth, r = s.naturalHeight;
|
|
9
9
|
if (!e)
|
|
10
10
|
return { width: i, height: n };
|
|
11
11
|
if (!o || !r)
|
|
12
12
|
return { width: i, height: n };
|
|
13
|
-
const a = o / r,
|
|
13
|
+
const a = o / r, h = i / n;
|
|
14
14
|
switch (e) {
|
|
15
15
|
case "fill":
|
|
16
16
|
return { width: i, height: n };
|
|
17
17
|
case "none":
|
|
18
18
|
return { width: o, height: r };
|
|
19
19
|
case "contain":
|
|
20
|
-
return a >
|
|
20
|
+
return a > h ? { width: i, height: i / a } : { width: n * a, height: n };
|
|
21
21
|
case "cover":
|
|
22
|
-
return a <
|
|
22
|
+
return a < h ? { width: i, height: i / a } : { width: n * a, height: n };
|
|
23
23
|
case "scale-down": {
|
|
24
|
-
const c = { width: o, height: r }, m = a >
|
|
24
|
+
const c = { width: o, height: r }, m = a > h ? { width: i, height: i / a } : { width: n * a, height: n };
|
|
25
25
|
return m.width <= c.width && m.height <= c.height ? m : c;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -42,8 +42,8 @@ function D(s) {
|
|
|
42
42
|
naturalHeight: s.naturalHeight
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
const t = s.imageElm ? D(s.imageElm) : null, e = s.anchorElm ? D(s.anchorElm) : null, i =
|
|
45
|
+
function z(s) {
|
|
46
|
+
const t = s.imageElm ? D(s.imageElm) : null, e = s.anchorElm ? D(s.anchorElm) : null, i = T(t == null ? void 0 : t.borderRadius), n = e && T(e == null ? void 0 : e.borderRadius), o = (n ? e == null ? void 0 : e.borderRadius : i ? t == null ? void 0 : t.borderRadius : "") || "";
|
|
47
47
|
return {
|
|
48
48
|
fit: (t == null ? void 0 : t.objectFit) || (e == null ? void 0 : e.objectFit) || "",
|
|
49
49
|
pos: (t == null ? void 0 : t.objectPosition) || "",
|
|
@@ -66,14 +66,14 @@ function W(s, t, e, i = !1) {
|
|
|
66
66
|
// pos,
|
|
67
67
|
// overflow,
|
|
68
68
|
nw: a,
|
|
69
|
-
nh:
|
|
69
|
+
nh: h,
|
|
70
70
|
br: c,
|
|
71
71
|
top: m,
|
|
72
72
|
left: p
|
|
73
|
-
} =
|
|
74
|
-
d.width = `${o}px`, d.height = `${r}px`, d.objectFit = n, e.width = a, e.height =
|
|
75
|
-
const u =
|
|
76
|
-
v.setProperty("--vvw-init-radius", `${c}`), v.setProperty("--vvw-init-w", `${
|
|
73
|
+
} = z(s), x = Math.min(Math.max(p, -o), window.innerWidth + o) - window.innerWidth / 2 + o / 2, g = Math.min(Math.max(m, -r), window.innerHeight + r) - window.innerHeight / 2 + r / 2, d = e.style;
|
|
74
|
+
d.width = `${o}px`, d.height = `${r}px`, d.objectFit = n, e.width = a, e.height = h, d.setProperty("--vvw-init-radius", `${c}`), d.setProperty("--vvw-pulse-radius", `calc(1.3 * ${c})`), d.setProperty("--vvw-init-x", `${x}px`), d.setProperty("--vvw-init-y", `${g}px`), i && (d.setProperty("--vvw-current-x", `${x}px`), d.setProperty("--vvw-current-y", `${g}px`));
|
|
75
|
+
const u = A(s.imageElm), b = Math.min(o, u.width), f = Math.min(r, u.height), v = t.style;
|
|
76
|
+
v.setProperty("--vvw-init-radius", `${c}`), v.setProperty("--vvw-init-w", `${b}px`), v.setProperty("--vvw-init-h", `${f}px`), i && (v.setProperty("--vvw-current-radius", `${c}`), v.setProperty("--vvw-current-w", `${b}px`), v.setProperty("--vvw-current-h", `${f}px`), t.dataset.vvwWidth = b.toString(), t.dataset.vvwHeight = f.toString());
|
|
77
77
|
}
|
|
78
78
|
function M(s) {
|
|
79
79
|
const t = window.innerWidth, e = window.innerHeight, i = s.naturalWidth, n = s.naturalHeight;
|
|
@@ -85,20 +85,20 @@ function M(s) {
|
|
|
85
85
|
height: n
|
|
86
86
|
};
|
|
87
87
|
const o = i / n, r = t / e;
|
|
88
|
-
let a,
|
|
89
|
-
return o > r ? (a = t,
|
|
88
|
+
let a, h;
|
|
89
|
+
return o > r ? (a = t, h = t / o) : (h = e, a = e * o), {
|
|
90
90
|
width: a,
|
|
91
|
-
height:
|
|
91
|
+
height: h
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
function q(s, t, e) {
|
|
95
95
|
return Math.min(Math.max(s, t), e);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function L(s, t = 2) {
|
|
98
98
|
const e = Math.pow(10, t);
|
|
99
99
|
return Math.round(s * e) / e;
|
|
100
100
|
}
|
|
101
|
-
const
|
|
101
|
+
const k = '<svg viewBox="0 0 24 24"><path d="m15 18-6-6 6-6"/></svg>', O = '<svg viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></svg>', Z = '<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/></svg>', X = '<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>', N = '<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>', Y = '<svg viewBox="0 0 24 24"><path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/></svg>';
|
|
102
102
|
let $ = null;
|
|
103
103
|
function B() {
|
|
104
104
|
return $ || (window.trustedTypes || (window.trustedTypes = {
|
|
@@ -171,7 +171,7 @@ function K({
|
|
|
171
171
|
<div class="vvw-image-container"></div>
|
|
172
172
|
<div class="vvw-top-bar"><div>${t(s == null ? void 0 : s.topLeft)}</div><div>${t(s == null ? void 0 : s.topCenter)}</div><div>${t(s == null ? void 0 : s.topRight)}</div></div>
|
|
173
173
|
<div class="vvw-bottom-bar"><div>${t(s == null ? void 0 : s.bottomLeft)}</div><div>${t(s == null ? void 0 : s.bottomCenter)}</div><div>${t(s == null ? void 0 : s.bottomRight)}</div></div>
|
|
174
|
-
<div class="vvw-prev vvw-ui"><button aria-label="Previous">${
|
|
174
|
+
<div class="vvw-prev vvw-ui"><button aria-label="Previous">${k}</button></div>
|
|
175
175
|
<div class="vvw-next vvw-ui"><button aria-label="Next">${O}</button></div>
|
|
176
176
|
</div>
|
|
177
177
|
</div>`
|
|
@@ -207,17 +207,17 @@ function J(s) {
|
|
|
207
207
|
e = { x: n.pointer.x, y: n.pointer.y };
|
|
208
208
|
const r = e.x - t.x, a = e.y - t.y;
|
|
209
209
|
if (!i && Math.abs(a) > Math.abs(r) || i === "y") {
|
|
210
|
-
const
|
|
211
|
-
s.imageContainer.style.transition = "none", s.imageContainer.style.transform = `translateY(${
|
|
210
|
+
const h = a / window.innerHeight * 100;
|
|
211
|
+
s.imageContainer.style.transition = "none", s.imageContainer.style.transform = `translateY(${h}vh)`, i = "y";
|
|
212
212
|
} else if (!i && Math.abs(r) > Math.abs(a) || i === "x") {
|
|
213
|
-
const
|
|
214
|
-
s.imageContainer.style.transition = "none", s.imageContainer.style.transform = `translateX(${
|
|
213
|
+
const h = r / window.innerWidth * 100;
|
|
214
|
+
s.imageContainer.style.transition = "none", s.imageContainer.style.transform = `translateX(${h}vw)`, i = "x";
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
if (n.event === "up" || n.event === "cancel") {
|
|
218
218
|
let r = function(a) {
|
|
219
|
-
var
|
|
220
|
-
(
|
|
219
|
+
var h;
|
|
220
|
+
(h = s.imageContainer) == null || h.addEventListener("transitionend", function c() {
|
|
221
221
|
var m;
|
|
222
222
|
(m = s.imageContainer) == null || m.removeEventListener("transitionend", c), s.imageContainer.style.transition = "", s.imageContainer.style.transform = "";
|
|
223
223
|
}), s.imageContainer.style.transition = "transform 222ms ease", s.imageContainer.style.transform = a;
|
|
@@ -227,8 +227,8 @@ function J(s) {
|
|
|
227
227
|
Math.abs(a) > 144 ? (s.imageContainer.style.transition = "transform 222ms ease", s.imageContainer.style.transform = "translateY(0vh)", s.close()) : r("translateY(0vh)");
|
|
228
228
|
}
|
|
229
229
|
if (i === "x") {
|
|
230
|
-
const a = e.x - t.x,
|
|
231
|
-
s.imageContainer.style.transition = "", a > 0 && Math.abs(
|
|
230
|
+
const a = e.x - t.x, h = n.pointer.movementX, c = 1;
|
|
231
|
+
s.imageContainer.style.transition = "", a > 0 && Math.abs(h) > c ? s.prev() : a < 0 && Math.abs(h) > c ? s.next() : r("translateX(0vw)");
|
|
232
232
|
}
|
|
233
233
|
i = null, t = { x: 0, y: 0 }, e = { x: 0, y: 0 };
|
|
234
234
|
}
|
|
@@ -269,17 +269,17 @@ function tt({
|
|
|
269
269
|
}
|
|
270
270
|
class et {
|
|
271
271
|
constructor({ elm: t, listeners: e }) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
272
|
+
l(this, "pointers", []);
|
|
273
|
+
l(this, "elm");
|
|
274
|
+
l(this, "listeners", []);
|
|
275
|
+
l(this, "lastPointerDownId", null);
|
|
276
|
+
l(this, "removeLastPointer", () => {
|
|
277
277
|
if (this.pointers.length && this.lastPointerDownId !== null) {
|
|
278
278
|
const t = this.pointers.findIndex((e) => e.id === this.lastPointerDownId);
|
|
279
279
|
t !== -1 && this.pointers.splice(t, 1);
|
|
280
280
|
}
|
|
281
281
|
});
|
|
282
|
-
|
|
282
|
+
l(this, "onPointerDown", (t) => {
|
|
283
283
|
if (!this.listeners.length || t.button !== 0) return;
|
|
284
284
|
t.preventDefault(), this.lastPointerDownId = t.pointerId, window.addEventListener("contextmenu", this.removeLastPointer, { once: !0 }), window.addEventListener("auxclick", this.removeLastPointer, { once: !0 });
|
|
285
285
|
let e = {
|
|
@@ -298,7 +298,7 @@ class et {
|
|
|
298
298
|
})
|
|
299
299
|
);
|
|
300
300
|
});
|
|
301
|
-
|
|
301
|
+
l(this, "onPointerMove", (t) => {
|
|
302
302
|
if (!this.listeners.length) return;
|
|
303
303
|
t.preventDefault();
|
|
304
304
|
const e = this.pointers.find((i) => i.id === t.pointerId);
|
|
@@ -311,7 +311,7 @@ class et {
|
|
|
311
311
|
})
|
|
312
312
|
));
|
|
313
313
|
});
|
|
314
|
-
|
|
314
|
+
l(this, "onPointerUp", (t) => {
|
|
315
315
|
if (!this.listeners.length || t.button !== 0 || (window.removeEventListener("contextmenu", this.removeLastPointer), window.removeEventListener("auxclick", this.removeLastPointer), t.target instanceof Node && !this.elm.contains(t.target) && t.target !== document.querySelector("html") && t.target !== document))
|
|
316
316
|
return;
|
|
317
317
|
t.preventDefault();
|
|
@@ -329,7 +329,7 @@ class et {
|
|
|
329
329
|
})
|
|
330
330
|
);
|
|
331
331
|
});
|
|
332
|
-
|
|
332
|
+
l(this, "onPointerCancel", (t) => {
|
|
333
333
|
if (!this.listeners.length || t.target instanceof Node && !this.elm.contains(t.target) && t.target !== document.querySelector("html") && t.target !== document)
|
|
334
334
|
return;
|
|
335
335
|
t.preventDefault();
|
|
@@ -379,18 +379,18 @@ class et {
|
|
|
379
379
|
}
|
|
380
380
|
class it {
|
|
381
381
|
constructor(t, e) {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
382
|
+
l(this, "maxZoomLevel");
|
|
383
|
+
l(this, "image", null);
|
|
384
|
+
l(this, "rect", null);
|
|
385
|
+
l(this, "initialCenter", { x: 0, y: 0 });
|
|
386
|
+
l(this, "maxDimension", { width: 0 });
|
|
387
|
+
l(this, "minDimension", { initialWidth: 0, initialHeight: 0, minWidth: 0, closingWidth: 0 });
|
|
388
|
+
l(this, "accumulatedTranslate", { x: 0, y: 0 });
|
|
389
389
|
// state
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
390
|
+
l(this, "scale", 1);
|
|
391
|
+
l(this, "translate", { x: 0, y: 0 });
|
|
392
|
+
l(this, "onScale", null);
|
|
393
|
+
l(this, "animationTimestamp", 0);
|
|
394
394
|
this.maxZoomLevel = t, this.onScale = e;
|
|
395
395
|
}
|
|
396
396
|
clean() {
|
|
@@ -416,7 +416,7 @@ class it {
|
|
|
416
416
|
this.initialCenter = t || { x: window.innerWidth / 2, y: window.innerHeight / 2 };
|
|
417
417
|
}
|
|
418
418
|
move(t) {
|
|
419
|
-
this.image && (this.rect || (this.rect = this.image.getBoundingClientRect()), this.translate.x =
|
|
419
|
+
this.image && (this.rect || (this.rect = this.image.getBoundingClientRect()), this.translate.x = L(t.x - this.initialCenter.x), this.translate.y = L(t.y - this.initialCenter.y), this.image.style.transform = `translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`);
|
|
420
420
|
}
|
|
421
421
|
snapToTargetIfClose(t, e, i = 1) {
|
|
422
422
|
return Math.abs(t - e) <= i && (t = e), t;
|
|
@@ -432,9 +432,9 @@ class it {
|
|
|
432
432
|
scale: i / (this.maxDimension.width / this.maxZoomLevel),
|
|
433
433
|
isMax: i >= this.maxDimension.width,
|
|
434
434
|
isMin: i <= this.minDimension.initialWidth
|
|
435
|
-
}), this.scale =
|
|
436
|
-
const n = this.rect.left + this.rect.width / 2, o = this.rect.top + this.rect.height / 2, r = this.initialCenter.x - n, a = this.initialCenter.y - o,
|
|
437
|
-
this.translate.x =
|
|
435
|
+
}), this.scale = L(i / this.rect.width);
|
|
436
|
+
const n = this.rect.left + this.rect.width / 2, o = this.rect.top + this.rect.height / 2, r = this.initialCenter.x - n, a = this.initialCenter.y - o, h = r * (1 - this.scale), c = a * (1 - this.scale), m = e.x - this.initialCenter.x, p = e.y - this.initialCenter.y;
|
|
437
|
+
this.translate.x = L(h + m), this.translate.y = L(c + p), this.image.style.transform = `translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`, i <= this.minDimension.closingWidth ? this.image.style.opacity = "0.5" : this.image.style.opacity = "";
|
|
438
438
|
}
|
|
439
439
|
moveAndNormalize(t) {
|
|
440
440
|
let e = 0, i = !1;
|
|
@@ -445,7 +445,7 @@ class it {
|
|
|
445
445
|
return this.normalize();
|
|
446
446
|
o *= 0.9, r *= 0.9;
|
|
447
447
|
const a = this.image.getBoundingClientRect();
|
|
448
|
-
this.translate.x =
|
|
448
|
+
this.translate.x = L(this.translate.x + o), this.translate.y = L(this.translate.y + r), a.right < window.innerWidth / 2 && (this.translate.x += (window.innerWidth / 2 - a.right) * 0.1, o *= 0.7), a.left > window.innerWidth / 2 && (this.translate.x -= (a.left - window.innerWidth / 2) * 0.1, o *= 0.7), a.bottom < window.innerHeight / 2 && (this.translate.y += (window.innerHeight / 2 - a.bottom) * 0.1, r *= 0.7), a.top > window.innerHeight / 2 && (this.translate.y -= (a.top - window.innerHeight / 2) * 0.1, r *= 0.7), this.image.style.transform = `translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`, e = requestAnimationFrame(() => n({ x: o, y: r }));
|
|
449
449
|
};
|
|
450
450
|
return n({
|
|
451
451
|
x: t.movementX,
|
|
@@ -500,7 +500,7 @@ class it {
|
|
|
500
500
|
}
|
|
501
501
|
class nt {
|
|
502
502
|
constructor() {
|
|
503
|
-
|
|
503
|
+
l(this, "fiolast", {});
|
|
504
504
|
}
|
|
505
505
|
// first in out
|
|
506
506
|
fio(t, e, i = 50) {
|
|
@@ -514,37 +514,39 @@ class nt {
|
|
|
514
514
|
o >= i && r();
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
|
-
const
|
|
517
|
+
const C = {
|
|
518
518
|
somethingOpened: null
|
|
519
519
|
};
|
|
520
520
|
class st {
|
|
521
521
|
constructor(t, e = {}) {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
522
|
+
l(this, "options");
|
|
523
|
+
l(this, "elements");
|
|
524
|
+
l(this, "isReducedMotion");
|
|
525
|
+
l(this, "currentIndex", -1);
|
|
526
|
+
l(this, "currentChildren", null);
|
|
527
|
+
l(this, "setupFunction", _);
|
|
528
|
+
l(this, "initFunction", G);
|
|
529
|
+
l(this, "closeFunction", Q);
|
|
530
|
+
l(this, "transitionFunction", tt);
|
|
531
|
+
l(this, "pointers", null);
|
|
532
|
+
l(this, "imageState");
|
|
533
|
+
l(this, "imageTransitions", /* @__PURE__ */ new Map());
|
|
534
|
+
l(this, "root", null);
|
|
535
|
+
l(this, "imageContainer", null);
|
|
536
|
+
l(this, "onClickElements", (t) => {
|
|
537
537
|
t.preventDefault();
|
|
538
538
|
const e = t.currentTarget;
|
|
539
539
|
e.dataset.vistaIdx && this.open(parseInt(e.dataset.vistaIdx));
|
|
540
540
|
});
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
541
|
+
l(this, "defaultOnClickHandler", (t) => t.preventDefault());
|
|
542
|
+
l(this, "abortController", null);
|
|
543
|
+
l(this, "throttle", new nt());
|
|
544
|
+
l(this, "lastSwapTime", 0);
|
|
545
|
+
l(this, "isRapidSwap", !1);
|
|
546
|
+
l(this, "isRapidSwapRelease", 0);
|
|
547
|
+
l(this, "transitionCleanup", null);
|
|
548
|
+
l(this, "isZoomedIn", !1);
|
|
549
|
+
l(this, "onKeyDown", (t) => {
|
|
548
550
|
switch (t.key) {
|
|
549
551
|
case "ArrowLeft":
|
|
550
552
|
t.preventDefault(), this.prev();
|
|
@@ -563,7 +565,7 @@ class st {
|
|
|
563
565
|
break;
|
|
564
566
|
}
|
|
565
567
|
});
|
|
566
|
-
|
|
568
|
+
l(this, "onScroll", (t) => {
|
|
567
569
|
t.preventDefault();
|
|
568
570
|
const e = t.deltaY;
|
|
569
571
|
this.imageState.setInitialCenter({
|
|
@@ -571,7 +573,7 @@ class st {
|
|
|
571
573
|
y: t.clientY
|
|
572
574
|
}), e < 0 ? this.zoomIn() : e > 0 && this.zoomOut();
|
|
573
575
|
});
|
|
574
|
-
|
|
576
|
+
l(this, "onResizeHandler", () => {
|
|
575
577
|
this.currentChildren.htmls.forEach((t, e) => {
|
|
576
578
|
const i = this.currentChildren.images[e], n = t.querySelector("img.vvw-img-hi"), o = t.querySelector("img.vvw-img-lo");
|
|
577
579
|
if (W(i, n, o, !1), n.classList.contains("vvw--loaded")) {
|
|
@@ -581,8 +583,8 @@ class st {
|
|
|
581
583
|
});
|
|
582
584
|
});
|
|
583
585
|
/// POINTERS
|
|
584
|
-
|
|
585
|
-
|
|
586
|
+
l(this, "pointerListeners", []);
|
|
587
|
+
l(this, "getInternalPointerListener", () => {
|
|
586
588
|
const t = this.imageState;
|
|
587
589
|
let e = 0, i = !1, n = () => {
|
|
588
590
|
};
|
|
@@ -628,14 +630,14 @@ class st {
|
|
|
628
630
|
}, this.imageState = new it(
|
|
629
631
|
this.options.maxZoomLevel,
|
|
630
632
|
(i) => {
|
|
631
|
-
var n, o, r, a,
|
|
633
|
+
var n, o, r, a, h, c;
|
|
632
634
|
i.isMin ? (this.isZoomedIn = !1, (n = this.qs(".vvw-zoom-out")) == null || n.setAttribute("disabled", "true"), (o = this.qs('.vvw-item[data-vvw-idx="' + this.currentIndex + '"]')) == null || o.style.setProperty(
|
|
633
635
|
"pointer-events",
|
|
634
636
|
"none"
|
|
635
637
|
)) : (this.isZoomedIn = !0, (r = this.qs(".vvw-zoom-out")) == null || r.removeAttribute("disabled"), (a = this.qs('.vvw-item[data-vvw-idx="' + this.currentIndex + '"]')) == null || a.style.setProperty(
|
|
636
638
|
"pointer-events",
|
|
637
639
|
"auto"
|
|
638
|
-
)), i.isMax ? (
|
|
640
|
+
)), i.isMax ? (h = this.qs(".vvw-zoom-in")) == null || h.setAttribute("disabled", "true") : (c = this.qs(".vvw-zoom-in")) == null || c.removeAttribute("disabled");
|
|
639
641
|
}
|
|
640
642
|
), this.options.setupFunction && (this.setupFunction = this.options.setupFunction), this.options.closeFunction && (this.closeFunction = this.options.closeFunction), this.options.initFunction && (this.initFunction = this.options.initFunction), this.options.transitionFunction && (this.transitionFunction = this.options.transitionFunction), this.isReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.elements instanceof NodeList && this.elements.forEach((i, n) => {
|
|
641
643
|
i.dataset.vistaIdx = n.toString(), i.addEventListener("click", this.defaultOnClickHandler), i.addEventListener("pointerup", this.onClickElements);
|
|
@@ -645,45 +647,51 @@ class st {
|
|
|
645
647
|
return this.root ? this.root.querySelector(t) : null;
|
|
646
648
|
}
|
|
647
649
|
async swap(t, e) {
|
|
648
|
-
const i = this.options.preloads || 0, n = this.currentIndex, { htmls: o, images: r } = this.getChildElements(i, n), a = this.imageContainer,
|
|
649
|
-
htmlElements: { from:
|
|
650
|
-
images: { from:
|
|
650
|
+
const i = this.options.preloads || 0, n = this.currentIndex, { htmls: o, images: r } = this.getChildElements(i, n), a = this.imageContainer, h = this.currentChildren, c = {
|
|
651
|
+
htmlElements: { from: h.htmls, to: o },
|
|
652
|
+
images: { from: h.images, to: r },
|
|
651
653
|
index: { from: t, to: this.currentIndex },
|
|
652
654
|
via: e || { next: !1, prev: !1 },
|
|
653
655
|
vistaView: this
|
|
654
656
|
};
|
|
655
657
|
this.setupFunction(c), this.currentChildren = { htmls: o, images: r }, this.displayActiveIndex();
|
|
656
|
-
const m = this.abortController.signal;
|
|
657
|
-
if (
|
|
658
|
-
a.innerHTML = "", this.transitionCleanup && this.transitionCleanup(), o.forEach((
|
|
659
|
-
a.appendChild(
|
|
660
|
-
}), this.lastSwapTime = performance.now(), this.waitForImagesToLoad(), this.options.onImageView && this.options.onImageView(c)
|
|
658
|
+
const m = this.abortController.signal, x = performance.now() - this.lastSwapTime < this.options.rapidLimit;
|
|
659
|
+
if (this.isRapidSwap = x, a.querySelectorAll(".vvw-item img.vvw-img-hi").forEach((y) => y.classList.add("vvw--load-cancelled")), x) {
|
|
660
|
+
this.imageState.reset(), a.innerHTML = "", this.transitionCleanup && this.transitionCleanup(), o.forEach((y) => {
|
|
661
|
+
a.appendChild(y);
|
|
662
|
+
}), this.lastSwapTime = performance.now(), this.waitForImagesToLoad(), this.options.onImageView && this.options.onImageView(c), this.isRapidSwapRelease && clearTimeout(this.isRapidSwapRelease), this.isRapidSwapRelease = setTimeout(() => {
|
|
663
|
+
this.isRapidSwap = !1;
|
|
664
|
+
}, 333);
|
|
661
665
|
return;
|
|
662
666
|
}
|
|
663
667
|
const g = this.transitionFunction(c, m);
|
|
664
668
|
g && (this.transitionCleanup = g.cleanup, await g.transitionEnded), this.lastSwapTime = performance.now();
|
|
665
669
|
const d = o[Math.floor(o.length / 2)].dataset.vvwIdx, u = a.querySelector(
|
|
666
670
|
`.vvw-item[data-vvw-idx="${d}"] img.vvw-img-hi`
|
|
667
|
-
),
|
|
671
|
+
), b = this.imageTransitions.get(u);
|
|
668
672
|
this.imageTransitions.delete(u);
|
|
669
|
-
const f = u.getAttribute("style") || "", v = u.classList.contains("vvw--loaded"), E = u.classList.contains("vvw--ready"), I = u.width,
|
|
670
|
-
this.imageState.reset(), a.innerHTML = "", this.transitionCleanup && this.transitionCleanup(), o.forEach((
|
|
671
|
-
const w =
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
673
|
+
const f = u.getAttribute("style") || "", v = u.classList.contains("vvw--loaded"), E = u.classList.contains("vvw--ready"), I = u.width, S = u.height;
|
|
674
|
+
this.imageState.reset(), a.innerHTML = "", this.transitionCleanup && this.transitionCleanup(), o.forEach((y) => {
|
|
675
|
+
const w = y.querySelector("img.vvw-img-hi");
|
|
676
|
+
y.dataset.vvwPos === "0" && !m.aborted && f && I && S && (v && (w.classList.add("vvw--loaded"), w.dataset.vvwWidth = u.dataset.vvwWidth || "", w.dataset.vvwHeight = u.dataset.vvwHeight || ""), E && (w.classList.add("vvw--ready"), w.width = I, w.height = S), w.setAttribute("style", f)), a.appendChild(y), y.dataset.vvwPos === "0" && !m.aborted && E ? (this.imageState.setCurrentImage(w), this.imageState.setInitialCenter()) : y.dataset.vvwPos === "0" && !m.aborted && f && I && S && v && b && (this.imageTransitions.set(w, b), this.transitionImage(
|
|
677
|
+
w,
|
|
678
|
+
() => {
|
|
679
|
+
this.imageState.setCurrentImage(w), this.imageState.setInitialCenter(), w.classList.add("vvw--ready");
|
|
680
|
+
}
|
|
681
|
+
// false
|
|
682
|
+
));
|
|
683
|
+
}), this.isRapidSwap = !1, this.waitForImagesToLoad(), this.options.onImageView && this.options.onImageView(c);
|
|
676
684
|
}
|
|
677
685
|
getChildElements(t, e) {
|
|
678
686
|
const i = [], n = [];
|
|
679
687
|
for (let o = -t; o <= t; o++) {
|
|
680
|
-
const r = (e + o + this.elements.length) % this.elements.length, a = this.elements[r],
|
|
688
|
+
const r = (e + o + this.elements.length) % this.elements.length, a = this.elements[r], h = a instanceof HTMLImageElement ? a : a instanceof HTMLAnchorElement && a.querySelector("img") || void 0, c = a instanceof HTMLElement ? {
|
|
681
689
|
index: r,
|
|
682
|
-
imageElm:
|
|
690
|
+
imageElm: h instanceof HTMLImageElement ? h : void 0,
|
|
683
691
|
anchorElm: a instanceof HTMLAnchorElement ? a : void 0,
|
|
684
692
|
src: a.dataset.vistaviewSrc || a.getAttribute("href") || a.getAttribute("src") || "",
|
|
685
|
-
thumb: a.dataset.vistaviewThumb || (
|
|
686
|
-
alt:
|
|
693
|
+
thumb: a.dataset.vistaviewThumb || (h instanceof HTMLImageElement ? h.getAttribute("src") : void 0) || a.getAttribute("href") || void 0,
|
|
694
|
+
alt: h instanceof HTMLImageElement && h.getAttribute("alt") || void 0
|
|
687
695
|
} : {
|
|
688
696
|
index: r,
|
|
689
697
|
...a
|
|
@@ -716,43 +724,61 @@ class st {
|
|
|
716
724
|
displayActiveIndex() {
|
|
717
725
|
var r;
|
|
718
726
|
const t = this.currentIndex;
|
|
719
|
-
this.elements instanceof NodeList && this.elements.forEach((a,
|
|
720
|
-
a.style.opacity = "",
|
|
727
|
+
this.elements instanceof NodeList && this.elements.forEach((a, h) => {
|
|
728
|
+
a.style.opacity = "", h === t && (a.style.opacity = "0");
|
|
721
729
|
});
|
|
722
730
|
const e = this.qs(".vvw-index"), i = `${t + 1}`, n = `${this.elements.length}`;
|
|
723
731
|
e && (e.textContent = `${i} / ${n}`);
|
|
724
732
|
const o = this.qs(".vvw-desc");
|
|
725
733
|
if (o) {
|
|
726
|
-
const a = (r = this.currentChildren) == null ? void 0 : r.images.find((c) => c.index === t),
|
|
727
|
-
|
|
734
|
+
const a = (r = this.currentChildren) == null ? void 0 : r.images.find((c) => c.index === t), h = (a == null ? void 0 : a.alt) || "";
|
|
735
|
+
h ? (o.textContent = h, o.setAttribute("aria-label", `Image ${i} of ${n}: ${h}`)) : (o.textContent = "", o.setAttribute("aria-label", `Image ${i} of ${n}`));
|
|
728
736
|
}
|
|
729
737
|
}
|
|
730
738
|
transitionImage(t, e) {
|
|
739
|
+
if (t.classList.contains("vvw--load-cancelled")) return;
|
|
740
|
+
if (this.isRapidSwap) {
|
|
741
|
+
requestAnimationFrame(() => {
|
|
742
|
+
this.transitionImage(t, e);
|
|
743
|
+
});
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
731
746
|
const i = this.imageTransitions.get(t);
|
|
732
747
|
i && requestAnimationFrame(() => {
|
|
748
|
+
if (t.classList.contains("vvw--load-cancelled")) return;
|
|
733
749
|
const { current: n, target: o } = i, r = {
|
|
734
|
-
width: n.width + (o.width - n.width) * 0.
|
|
735
|
-
height: n.height + (o.height - n.height) * 0.
|
|
736
|
-
radius: n.radius + (o.radius - n.radius) * 0.
|
|
750
|
+
width: n.width + (o.width - n.width) * 0.2,
|
|
751
|
+
height: n.height + (o.height - n.height) * 0.2,
|
|
752
|
+
radius: n.radius + (o.radius - n.radius) * 0.2
|
|
737
753
|
};
|
|
738
|
-
Math.abs(r.width - o.width) <
|
|
754
|
+
Math.abs(r.width - o.width) < 1 && Math.abs(r.height - o.height) < 1 && Math.abs(r.radius - o.radius) < 1 ? (t.style.setProperty("--vvw-current-w", `${o.width}px`), t.style.setProperty("--vvw-current-h", `${o.height}px`), t.style.setProperty("--vvw-current-radius", `${o.radius}px`), this.imageTransitions.delete(t), e()) : (t.style.setProperty("--vvw-current-w", `${r.width}px`), t.style.setProperty("--vvw-current-h", `${r.height}px`), t.style.setProperty("--vvw-current-radius", `${r.radius}px`), this.imageTransitions.set(t, { current: r, target: o }), this.transitionImage(
|
|
755
|
+
t,
|
|
756
|
+
e
|
|
757
|
+
/* false */
|
|
758
|
+
));
|
|
739
759
|
});
|
|
740
760
|
}
|
|
741
761
|
waitForImagesToLoad() {
|
|
742
762
|
this.imageContainer.querySelectorAll("img.vvw-img-hi:not(.vvw--loaded)").forEach((i) => {
|
|
743
|
-
const n = i
|
|
744
|
-
|
|
763
|
+
const n = i;
|
|
764
|
+
if (n.classList.contains("vvw--load-cancelled")) return;
|
|
765
|
+
const o = () => {
|
|
766
|
+
if (n.classList.contains("vvw--load-cancelled")) return;
|
|
745
767
|
n.width = n.naturalWidth, n.height = n.naturalHeight;
|
|
746
|
-
const
|
|
747
|
-
n.dataset.vvwWidth =
|
|
768
|
+
const { width: r, height: a } = M(n);
|
|
769
|
+
n.dataset.vvwWidth = r.toString(), n.dataset.vvwHeight = a.toString(), n.classList.add("vvw--loaded"), this.imageTransitions.set(n, {
|
|
748
770
|
current: {
|
|
749
771
|
width: n.style.getPropertyValue("--vvw-current-w") ? parseFloat(n.style.getPropertyValue("--vvw-current-w")) : 0,
|
|
750
772
|
height: n.style.getPropertyValue("--vvw-current-h") ? parseFloat(n.style.getPropertyValue("--vvw-current-h")) : 0,
|
|
751
773
|
radius: n.style.getPropertyValue("--vvw-current-radius") ? parseFloat(n.style.getPropertyValue("--vvw-current-radius")) : 0
|
|
752
774
|
},
|
|
753
|
-
target: { width:
|
|
775
|
+
target: { width: r, height: a, radius: 0 }
|
|
754
776
|
}), this.transitionImage(n, () => {
|
|
755
|
-
|
|
777
|
+
var c;
|
|
778
|
+
if (n.classList.contains("vvw--load-cancelled")) return;
|
|
779
|
+
((c = n.parentElement) == null ? void 0 : c.matches(
|
|
780
|
+
`[data-vvw-idx="${this.currentIndex}"][data-vvw-pos="0"]`
|
|
781
|
+
)) && (this.imageState.setCurrentImage(n), this.imageState.setInitialCenter()), n.classList.add("vvw--ready");
|
|
756
782
|
});
|
|
757
783
|
};
|
|
758
784
|
if (n.complete && n.naturalWidth !== 0) {
|
|
@@ -777,10 +803,10 @@ class st {
|
|
|
777
803
|
}
|
|
778
804
|
/// OPEN
|
|
779
805
|
open(t = 0) {
|
|
780
|
-
var c, m, p,
|
|
781
|
-
if (
|
|
806
|
+
var c, m, p, x, g;
|
|
807
|
+
if (C.somethingOpened)
|
|
782
808
|
return;
|
|
783
|
-
|
|
809
|
+
C.somethingOpened = this, this.currentIndex = t, document.body.style.overflow = "hidden";
|
|
784
810
|
const e = K({
|
|
785
811
|
controls: this.options.controls
|
|
786
812
|
});
|
|
@@ -796,11 +822,11 @@ class st {
|
|
|
796
822
|
};
|
|
797
823
|
this.setupFunction(a), this.currentChildren = { htmls: r, images: o }, r.forEach((d) => {
|
|
798
824
|
this.imageContainer.appendChild(d);
|
|
799
|
-
}), (c = this.qs(".vvw-close")) == null || c.addEventListener("click", () => this.close()), (m = this.qs(".vvw-zoom-in")) == null || m.addEventListener("click", () => this.zoomIn()), (p = this.qs(".vvw-zoom-out")) == null || p.addEventListener("click", () => this.zoomOut()), (
|
|
825
|
+
}), (c = this.qs(".vvw-close")) == null || c.addEventListener("click", () => this.close()), (m = this.qs(".vvw-zoom-in")) == null || m.addEventListener("click", () => this.zoomIn()), (p = this.qs(".vvw-zoom-out")) == null || p.addEventListener("click", () => this.zoomOut()), (x = this.qs(".vvw-prev>button")) == null || x.addEventListener("click", () => this.prev()), (g = this.qs(".vvw-next>button")) == null || g.addEventListener("click", () => this.next()), this.options.keyboardListeners && window.addEventListener("keydown", this.onKeyDown), window.addEventListener("wheel", this.onScroll, { passive: !1 }), window.addEventListener("resize", this.onResizeHandler), this.pointers = new et({
|
|
800
826
|
elm: this.imageContainer,
|
|
801
827
|
listeners: [this.getInternalPointerListener()]
|
|
802
828
|
});
|
|
803
|
-
const
|
|
829
|
+
const h = {};
|
|
804
830
|
[
|
|
805
831
|
...this.options.controls.topLeft || [],
|
|
806
832
|
...this.options.controls.topRight || [],
|
|
@@ -809,11 +835,11 @@ class st {
|
|
|
809
835
|
...this.options.controls.bottomLeft || [],
|
|
810
836
|
...this.options.controls.bottomRight || []
|
|
811
837
|
].forEach((d) => {
|
|
812
|
-
typeof d != "string" && (
|
|
838
|
+
typeof d != "string" && (h[d.name] = d);
|
|
813
839
|
}), this.root.querySelectorAll("button[data-vvw-control]").forEach((d) => {
|
|
814
840
|
const u = d;
|
|
815
|
-
u.addEventListener("click", (
|
|
816
|
-
const f =
|
|
841
|
+
u.addEventListener("click", (b) => {
|
|
842
|
+
const f = b.currentTarget.dataset.vvwControl, v = h[f], E = this.currentChildren.images.find(
|
|
817
843
|
(I) => I.index === this.currentIndex
|
|
818
844
|
);
|
|
819
845
|
v && E && (v.onClick.constructor.name === "AsyncFunction" ? (u.classList.add("vvw--loading"), v.onClick(E, this).finally(() => {
|
|
@@ -826,7 +852,7 @@ class st {
|
|
|
826
852
|
"transitionend",
|
|
827
853
|
() => {
|
|
828
854
|
var u;
|
|
829
|
-
(u = this.root) == null || u.classList.add("vvw--settled"), this.
|
|
855
|
+
(u = this.root) == null || u.classList.add("vvw--settled"), this.imageState.reset(), this.waitForImagesToLoad();
|
|
830
856
|
},
|
|
831
857
|
{ once: !0 }
|
|
832
858
|
), this.root.classList.add("vvw--active"), this.displayActiveIndex(), this.options.onOpen && this.options.onOpen(this), this.options.onImageView && this.options.onImageView(a);
|
|
@@ -834,7 +860,7 @@ class st {
|
|
|
834
860
|
}
|
|
835
861
|
/// CLOSE
|
|
836
862
|
async close(t = !0) {
|
|
837
|
-
|
|
863
|
+
C.somethingOpened === this && this.root && (t ? await new Promise((e) => {
|
|
838
864
|
let n = 0;
|
|
839
865
|
this.root.addEventListener("transitionend", (o) => {
|
|
840
866
|
o.target === this.root && (n++, n === 2 && this.elements instanceof NodeList && this.elements.forEach((r) => {
|
|
@@ -843,16 +869,16 @@ class st {
|
|
|
843
869
|
}), this.root.classList.add("vvw--closing");
|
|
844
870
|
}) : this.elements instanceof NodeList && this.elements.forEach((e) => {
|
|
845
871
|
e.style.opacity = "";
|
|
846
|
-
}), this.options.keyboardListeners && window.removeEventListener("keydown", this.onKeyDown), window.removeEventListener("resize", this.onResizeHandler), window.removeEventListener("wheel", this.onScroll), this.unregisterPointerListeners(), this.pointers.removeListeners(), this.root.remove(), this.root = null, this.imageContainer = null, this.currentChildren = null, this.currentIndex = -1, document.body.style.overflow = "",
|
|
872
|
+
}), this.options.keyboardListeners && window.removeEventListener("keydown", this.onKeyDown), window.removeEventListener("resize", this.onResizeHandler), window.removeEventListener("wheel", this.onScroll), this.unregisterPointerListeners(), this.pointers.removeListeners(), this.root.remove(), this.root = null, this.imageContainer = null, this.currentChildren = null, this.currentIndex = -1, document.body.style.overflow = "", C.somethingOpened = null, this.closeFunction(this), this.options.onClose && this.options.onClose(this));
|
|
847
873
|
}
|
|
848
874
|
next() {
|
|
849
|
-
if (
|
|
875
|
+
if (C.somethingOpened !== this)
|
|
850
876
|
return;
|
|
851
877
|
const t = (this.currentIndex + 1) % this.elements.length;
|
|
852
878
|
this.view(t, { next: !0, prev: !1 });
|
|
853
879
|
}
|
|
854
880
|
prev() {
|
|
855
|
-
if (
|
|
881
|
+
if (C.somethingOpened !== this)
|
|
856
882
|
return;
|
|
857
883
|
const t = (this.currentIndex - 1 + this.elements.length) % this.elements.length;
|
|
858
884
|
this.view(t, { next: !1, prev: !0 });
|
|
@@ -863,10 +889,10 @@ class st {
|
|
|
863
889
|
});
|
|
864
890
|
}
|
|
865
891
|
getCurrentIndex() {
|
|
866
|
-
return
|
|
892
|
+
return C.somethingOpened !== this ? -1 : this.currentIndex;
|
|
867
893
|
}
|
|
868
894
|
view(t, e) {
|
|
869
|
-
if (
|
|
895
|
+
if (C.somethingOpened !== this || t < 0 || t >= this.elements.length)
|
|
870
896
|
return;
|
|
871
897
|
const i = this.currentIndex;
|
|
872
898
|
this.currentIndex = t;
|
|
@@ -910,6 +936,10 @@ function at({ elements: s, ...t }) {
|
|
|
910
936
|
}
|
|
911
937
|
export {
|
|
912
938
|
H as DefaultOptions,
|
|
939
|
+
Q as close,
|
|
940
|
+
G as init,
|
|
941
|
+
_ as setup,
|
|
942
|
+
tt as transition,
|
|
913
943
|
at as vistaView,
|
|
914
944
|
j as vistaViewDownload
|
|
915
945
|
};
|
package/dist/vistaview.umd.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
(function(v,w){typeof exports=="object"&&typeof module<"u"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(v=typeof globalThis<"u"?globalThis:v||self,w(v.VistaView={}))})(this,(function(v){"use strict";var rt=Object.defineProperty;var at=(v,w
|
|
2
|
-
<img class="vvw-img-hi" src="${s.src}" alt="${s.alt||""}" />`));const i=e.querySelector("img.vvw-img-lo"),n=e.querySelector("img.vvw-img-hi");return P(s,n,i,t===0),e}function
|
|
1
|
+
(function(v,w){typeof exports=="object"&&typeof module<"u"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(v=typeof globalThis<"u"?globalThis:v||self,w(v.VistaView={}))})(this,(function(v){"use strict";var rt=Object.defineProperty;var at=(v,w,$)=>w in v?rt(v,w,{enumerable:!0,configurable:!0,writable:!0,value:$}):v[w]=$;var l=(v,w,$)=>at(v,typeof w!="symbol"?w+"":w,$);function w(s){return s&&!/^0(px|%|r?em|vw|vh|vmin|vmax|cm|mm|in|pt|pc|ex|ch)?$/i.test(s.trim())&&s}function $(s){const e=window.getComputedStyle(s).objectFit||"",{width:i,height:n}=s.getBoundingClientRect(),o=s.naturalWidth,r=s.naturalHeight;if(!e)return{width:i,height:n};if(!o||!r)return{width:i,height:n};const a=o/r,h=i/n;switch(e){case"fill":return{width:i,height:n};case"none":return{width:o,height:r};case"contain":return a>h?{width:i,height:i/a}:{width:n*a,height:n};case"cover":return a<h?{width:i,height:i/a}:{width:n*a,height:n};case"scale-down":{const c={width:o,height:r},m=a>h?{width:i,height:i/a}:{width:n*a,height:n};return m.width<=c.width&&m.height<=c.height?m:c}}return{width:i,height:n}}function W(s){const t=getComputedStyle(s),e=s.getBoundingClientRect();return{objectFit:t.objectFit,borderRadius:t.borderRadius,objectPosition:t.objectPosition,overflow:t.overflow,top:e.top,left:e.left,width:e.width,height:e.height,naturalWidth:s.naturalWidth,naturalHeight:s.naturalHeight}}function Z(s){const t=s.imageElm?W(s.imageElm):null,e=s.anchorElm?W(s.anchorElm):null,i=w(t==null?void 0:t.borderRadius),n=e&&w(e==null?void 0:e.borderRadius),o=(n?e==null?void 0:e.borderRadius:i?t==null?void 0:t.borderRadius:"")||"";return{fit:(t==null?void 0:t.objectFit)||(e==null?void 0:e.objectFit)||"",pos:(t==null?void 0:t.objectPosition)||"",br:o,overflow:n?e.overflow:i?t.overflow:"",nw:(t==null?void 0:t.naturalWidth)||0,nh:(t==null?void 0:t.naturalHeight)||0,w:(e==null?void 0:e.width)||(t==null?void 0:t.width)||0,h:(e==null?void 0:e.height)||(t==null?void 0:t.height)||0,top:(e==null?void 0:e.top)||(t==null?void 0:t.top)||0,left:(e==null?void 0:e.left)||(t==null?void 0:t.left)||0}}function P(s,t,e,i=!1){const{fit:n,w:o,h:r,nw:a,nh:h,br:c,top:m,left:f}=Z(s),L=Math.min(Math.max(f,-o),window.innerWidth+o)-window.innerWidth/2+o/2,y=Math.min(Math.max(m,-r),window.innerHeight+r)-window.innerHeight/2+r/2,d=e.style;d.width=`${o}px`,d.height=`${r}px`,d.objectFit=n,e.width=a,e.height=h,d.setProperty("--vvw-init-radius",`${c}`),d.setProperty("--vvw-pulse-radius",`calc(1.3 * ${c})`),d.setProperty("--vvw-init-x",`${L}px`),d.setProperty("--vvw-init-y",`${y}px`),i&&(d.setProperty("--vvw-current-x",`${L}px`),d.setProperty("--vvw-current-y",`${y}px`));const u=$(s.imageElm),E=Math.min(o,u.width),x=Math.min(r,u.height),p=t.style;p.setProperty("--vvw-init-radius",`${c}`),p.setProperty("--vvw-init-w",`${E}px`),p.setProperty("--vvw-init-h",`${x}px`),i&&(p.setProperty("--vvw-current-radius",`${c}`),p.setProperty("--vvw-current-w",`${E}px`),p.setProperty("--vvw-current-h",`${x}px`),t.dataset.vvwWidth=E.toString(),t.dataset.vvwHeight=x.toString())}function F(s){const t=window.innerWidth,e=window.innerHeight,i=s.naturalWidth,n=s.naturalHeight;if(!i||!n)throw new Error("Image natural dimensions are zero");if(i<t&&n<e)return{width:i,height:n};const o=i/n,r=t/e;let a,h;return o>r?(a=t,h=t/o):(h=e,a=e*o),{width:a,height:h}}function X(s,t,e){return Math.min(Math.max(s,t),e)}function I(s,t=2){const e=Math.pow(10,t);return Math.round(s*e)/e}const N='<svg viewBox="0 0 24 24"><path d="m15 18-6-6 6-6"/></svg>',Y='<svg viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></svg>',B='<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/></svg>',j='<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>',V='<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',U='<svg viewBox="0 0 24 24"><path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/></svg>';let D=null;function K(){return D||(window.trustedTypes||(window.trustedTypes={createPolicy:(s,t)=>t}),D=window.trustedTypes.createPolicy("vistaView-policy",{createHTML:s=>s,createScript:()=>{throw new Error("Not implemented")},createScriptURL:()=>{throw new Error("Not implemented")}}),D)}function R(s){const e=K().createHTML(s),i=document.createElement("template");i.innerHTML=e;const n=i.content;return i.remove(),n}function A(){return{name:"download",icon:U,onClick:async s=>{var o;const t=await fetch(s.src),e=await t.blob(),i=t.url,n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=((o=i.split("/").pop())==null?void 0:o.split("?")[0].split("#")[0])||"download",document.body.appendChild(n),n.click(),document.body.removeChild(n)}}}function _(s){if(typeof s=="string")switch(s){case"zoomIn":return`<button aria-label="Zoom In" class="vvw-zoom-in vvw-ui">${B}</button>`;case"zoomOut":return`<button aria-label="Zoom Out" disabled class="vvw-zoom-out vvw-ui">${j}</button>`;case"close":return`<button aria-label="Close" class="vvw-close vvw-ui">${V}</button>`;case"indexDisplay":return'<div class="vvw-index vvw-ui" aria-hidden="true"></div>';case"description":return'<div class="vvw-desc vvw-ui" role="status" aria-live="polite" aria-atomic="true"></div>';default:return""}return`<button class="vvw-ui" aria-label="${s.description||s.name}" data-vvw-control="${s.name}">${s.icon}</button>`}function G(s,t){const e=document.createElement("div");e.className="vvw-item",e.dataset.vvwPos=`${t!==void 0?t:""}`,e.dataset.vvwIdx=s.index.toString(),e.appendChild(R(`<img class="vvw-img-lo" src="${s.thumb||s.src}" alt="${s.alt||""}" />
|
|
2
|
+
<img class="vvw-img-hi" src="${s.src}" alt="${s.alt||""}" />`));const i=e.querySelector("img.vvw-img-lo"),n=e.querySelector("img.vvw-img-hi");return P(s,n,i,t===0),e}function J({controls:s}){const t=i=>i?i.map(_).join(""):"";return R(`<div class="vvw-root" id="vvw-root">
|
|
3
3
|
<div class="vvw-container">
|
|
4
4
|
<div class="vvw-bg"></div>
|
|
5
5
|
<div class="vvw-image-container"></div>
|
|
6
6
|
<div class="vvw-top-bar"><div>${t(s==null?void 0:s.topLeft)}</div><div>${t(s==null?void 0:s.topCenter)}</div><div>${t(s==null?void 0:s.topRight)}</div></div>
|
|
7
7
|
<div class="vvw-bottom-bar"><div>${t(s==null?void 0:s.bottomLeft)}</div><div>${t(s==null?void 0:s.bottomCenter)}</div><div>${t(s==null?void 0:s.bottomRight)}</div></div>
|
|
8
|
-
<div class="vvw-prev vvw-ui"><button aria-label="Previous">${
|
|
9
|
-
<div class="vvw-next vvw-ui"><button aria-label="Next">${
|
|
8
|
+
<div class="vvw-prev vvw-ui"><button aria-label="Previous">${N}</button></div>
|
|
9
|
+
<div class="vvw-next vvw-ui"><button aria-label="Next">${Y}</button></div>
|
|
10
10
|
</div>
|
|
11
|
-
</div>`)}const M={animationDurationBase:333,maxZoomLevel:2,preloads:1,keyboardListeners:!0,arrowOnSmallScreens:!1,rapidLimit:222,controls:{topLeft:["indexDisplay"],topRight:["zoomIn","zoomOut",z(),"close"],bottomLeft:["description"]}};function K(s){}function _(s){const t=s.options.preloads;s.imageContainer.style.width=`${(t*2+1)*100}vw`,s.imageContainer.style.left=`-${t*100}vw`,s.imageContainer.style.display="flex",G(s)}function G(s){let t={x:0,y:0},e={x:0,y:0},i=null;s.registerPointerListener(n=>{var o;if(!n.hasInternalExecution&&!(n.pointers.length>1)){if(n.event==="down"&&(t={x:n.pointer.x,y:n.pointer.y},e={x:n.pointer.x,y:n.pointer.y},(o=n.abortController)==null||o.abort()),n.event==="move"){e={x:n.pointer.x,y:n.pointer.y};const r=e.x-t.x,a=e.y-t.y;if(!i&&Math.abs(a)>Math.abs(r)||i==="y"){const l=a/window.innerHeight*100;s.imageContainer.style.transition="none",s.imageContainer.style.transform=`translateY(${l}vh)`,i="y"}else if(!i&&Math.abs(r)>Math.abs(a)||i==="x"){const l=r/window.innerWidth*100;s.imageContainer.style.transition="none",s.imageContainer.style.transform=`translateX(${l}vw)`,i="x"}}if(n.event==="up"||n.event==="cancel"){let r=function(a){var l;(l=s.imageContainer)==null||l.addEventListener("transitionend",function c(){var m;(m=s.imageContainer)==null||m.removeEventListener("transitionend",c),s.imageContainer.style.transition="",s.imageContainer.style.transform=""}),s.imageContainer.style.transition="transform 222ms ease",s.imageContainer.style.transform=a};if(i==="y"){const a=e.y-t.y;Math.abs(a)>144?(s.imageContainer.style.transition="transform 222ms ease",s.imageContainer.style.transform="translateY(0vh)",s.close()):r("translateY(0vh)")}if(i==="x"){const a=e.x-t.x,l=n.pointer.movementX,c=1;s.imageContainer.style.transition="",a>0&&Math.abs(l)>c?s.prev():a<0&&Math.abs(l)>c?s.next():r("translateX(0vw)")}i=null,t={x:0,y:0},e={x:0,y:0}}}})}function J(s){}function Q({vistaView:{isReducedMotion:s},htmlElements:{to:t},index:{from:e,to:i},vistaView:{elements:n,imageContainer:o,options:r}},a){if(!(!t||a.aborted||s||!(Math.abs(i-e)===1||e===0&&i===n.length-1||e===n.length-1&&i===0)))return{cleanup:()=>{o.style.transition="",o.style.transform=""},transitionEnded:new Promise(c=>{o.addEventListener("transitionend",()=>{c()},{once:!0}),o.addEventListener("transitioncancel",()=>{a.aborted&&c()},{once:!0});const m=Math.round(r.animationDurationBase*100)/100,f=i===e+1||e===n.length-1&&i===0?"translateX(-100vw)":"translateX(100vw)";o.style.transition=`transform ${m}ms ease`,o.style.transform=f})}}class tt{constructor({elm:t,listeners:e}){h(this,"pointers",[]);h(this,"elm");h(this,"listeners",[]);h(this,"lastPointerDownId",null);h(this,"removeLastPointer",()=>{if(this.pointers.length&&this.lastPointerDownId!==null){const t=this.pointers.findIndex(e=>e.id===this.lastPointerDownId);t!==-1&&this.pointers.splice(t,1)}});h(this,"onPointerDown",t=>{if(!this.listeners.length||t.button!==0)return;t.preventDefault(),this.lastPointerDownId=t.pointerId,window.addEventListener("contextmenu",this.removeLastPointer,{once:!0}),window.addEventListener("auxclick",this.removeLastPointer,{once:!0});let e={x:t.clientX,y:t.clientY,movementX:0,movementY:0,id:t.pointerId};this.pointers.push(e),this.listeners.forEach(i=>i({event:"down",pointer:e,pointers:this.pointers,lastPointerLen:this.pointers.length-1}))});h(this,"onPointerMove",t=>{if(!this.listeners.length)return;t.preventDefault();const e=this.pointers.find(i=>i.id===t.pointerId);e&&(e.movementX=t.movementX,e.movementY=t.movementY,e.x=t.clientX,e.y=t.clientY,this.listeners.forEach(i=>i({event:"move",pointer:e,pointers:this.pointers,lastPointerLen:this.pointers.length-1})))});h(this,"onPointerUp",t=>{if(!this.listeners.length||t.button!==0||(window.removeEventListener("contextmenu",this.removeLastPointer),window.removeEventListener("auxclick",this.removeLastPointer),t.target instanceof Node&&!this.elm.contains(t.target)&&t.target!==document.querySelector("html")&&t.target!==document))return;t.preventDefault();const e=this.pointers.findIndex(o=>o.id===t.pointerId);if(e===-1)return;const i=this.pointers[e];i.x=t.clientX,i.y=t.clientY;const n=this.pointers.length;this.pointers.splice(e,1),this.listeners.forEach(o=>o({event:"up",pointer:i,pointers:this.pointers,lastPointerLen:n}))});h(this,"onPointerCancel",t=>{if(!this.listeners.length||t.target instanceof Node&&!this.elm.contains(t.target)&&t.target!==document.querySelector("html")&&t.target!==document)return;t.preventDefault();const e=this.pointers.findIndex(o=>o.id===t.pointerId);if(e===-1)return;const i=this.pointers[e];i.x=t.clientX,i.y=t.clientY;const n=this.pointers.length;this.pointers.splice(e,1),this.listeners.forEach(o=>o({event:"cancel",pointer:i,pointers:this.pointers,lastPointerLen:n}))});this.elm=t??document,e&&(this.listeners=e),this.startListeners()}startListeners(){this.elm.addEventListener("pointerdown",this.onPointerDown),this.elm.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp),document.addEventListener("pointercancel",this.onPointerCancel)}removeListeners(){this.elm.removeEventListener("pointerdown",this.onPointerDown),this.elm.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerCancel),this.pointers=[]}addEventListener(t){this.listeners.push(t)}removeEventListener(t){this.listeners=this.listeners.filter(e=>e!==t)}getPointerDistance(t,e){const i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)}getCentroid(){if(this.pointers.length===0)return null;const t=this.pointers.reduce((e,i)=>(e.x+=i.x,e.y+=i.y,e),{x:0,y:0});return{x:t.x/this.pointers.length,y:t.y/this.pointers.length}}}class et{constructor(t,e){h(this,"maxZoomLevel");h(this,"image",null);h(this,"rect",null);h(this,"initialCenter",{x:0,y:0});h(this,"maxDimension",{width:0});h(this,"minDimension",{initialWidth:0,initialHeight:0,minWidth:0,closingWidth:0});h(this,"accumulatedTranslate",{x:0,y:0});h(this,"scale",1);h(this,"translate",{x:0,y:0});h(this,"onScale",null);h(this,"animationTimestamp",0);this.maxZoomLevel=t,this.onScale=e}clean(){this.image&&(this.image.style.transform="",this.image.style.width="",this.image.style.height="",this.image.style.top="",this.image.style.left="",this.image.style.opacity="")}reset(){this.clean(),this.image=null,this.rect=null,this.initialCenter={x:window.innerWidth/2,y:window.innerHeight/2},this.maxDimension={width:0},this.minDimension={initialWidth:0,initialHeight:0,minWidth:0,closingWidth:0},this.accumulatedTranslate={x:0,y:0},this.scale=1,this.translate={x:0,y:0}}setCurrentImage(t){if(this.rect=null,this.image=t,this.maxDimension={width:t.naturalWidth*this.maxZoomLevel},!t.dataset.vvwWidth||!t.dataset.vvwHeight)throw new Error("VistaImageState: Image dataset vvwWidth or vvwHeight not set.");const e=parseFloat(t.dataset.vvwWidth),i=parseFloat(t.dataset.vvwHeight);this.minDimension={initialWidth:e,initialHeight:i,minWidth:e*.1,closingWidth:e*.5},this.accumulatedTranslate={x:0,y:0}}setInitialCenter(t){this.initialCenter=t||{x:window.innerWidth/2,y:window.innerHeight/2}}move(t){this.image&&(this.rect||(this.rect=this.image.getBoundingClientRect()),this.translate.x=L(t.x-this.initialCenter.x),this.translate.y=L(t.y-this.initialCenter.y),this.image.style.transform=`translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`)}snapToTargetIfClose(t,e,i=1){return Math.abs(t-e)<=i&&(t=e),t}scaleMove(t,e){if(!this.image)return;this.rect||(this.rect=this.image.getBoundingClientRect()),e||(e=this.initialCenter);const i=this.snapToTargetIfClose(q(this.rect.width*t,this.minDimension.minWidth,this.maxDimension.width),this.minDimension.initialWidth);this.onScale&&this.onScale({scale:i/(this.maxDimension.width/this.maxZoomLevel),isMax:i>=this.maxDimension.width,isMin:i<=this.minDimension.initialWidth}),this.scale=L(i/this.rect.width);const n=this.rect.left+this.rect.width/2,o=this.rect.top+this.rect.height/2,r=this.initialCenter.x-n,a=this.initialCenter.y-o,l=r*(1-this.scale),c=a*(1-this.scale),m=e.x-this.initialCenter.x,f=e.y-this.initialCenter.y;this.translate.x=L(l+m),this.translate.y=L(c+f),this.image.style.transform=`translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`,i<=this.minDimension.closingWidth?this.image.style.opacity="0.5":this.image.style.opacity=""}moveAndNormalize(t){let e=0,i=!1;const n=({x:o,y:r})=>{if(i)return;if(Math.abs(o)<.001&&Math.abs(r)<.001)return this.normalize();o*=.9,r*=.9;const a=this.image.getBoundingClientRect();this.translate.x=L(this.translate.x+o),this.translate.y=L(this.translate.y+r),a.right<window.innerWidth/2&&(this.translate.x+=(window.innerWidth/2-a.right)*.1,o*=.7),a.left>window.innerWidth/2&&(this.translate.x-=(a.left-window.innerWidth/2)*.1,o*=.7),a.bottom<window.innerHeight/2&&(this.translate.y+=(window.innerHeight/2-a.bottom)*.1,r*=.7),a.top>window.innerHeight/2&&(this.translate.y-=(a.top-window.innerHeight/2)*.1,r*=.7),this.image.style.transform=`translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`,e=requestAnimationFrame(()=>n({x:o,y:r}))};return n({x:t.movementX,y:t.movementY}),()=>{i=!0,cancelAnimationFrame(e),this.normalize(!1)}}animateZoom(t){if(!this.image)return;this.rect||(this.rect=this.image.getBoundingClientRect());const e=Date.now(),i=this.image;this.rect.width*t<this.minDimension.closingWidth||i.width<Math.floor(this.minDimension.initialWidth)||(i.addEventListener("transitionend",()=>{this.animationTimestamp===e&&i&&(i.style.transition="",this.normalize())},{once:!0}),i.style.transition||(i.style.transition="all 222ms ease"),this.animationTimestamp=e,this.scaleMove(t))}normalize(t=!0){if(!this.image||!this.rect)return;const e=this.rect.width*this.scale,i=e<=this.minDimension.closingWidth,n=i?e:this.snapToTargetIfClose(this.rect.width*this.scale,this.minDimension.initialWidth),o=i?this.rect.height*this.scale:this.snapToTargetIfClose(this.rect.height*this.scale,this.minDimension.initialHeight);if(this.image.style.width=`${n}px`,this.image.style.height=`${o}px`,this.scale=1,this.image.style.opacity="",this.accumulatedTranslate.x+=this.translate.x,this.accumulatedTranslate.y+=this.translate.y,this.image.style.left=`calc(50% + ${this.accumulatedTranslate.x}px)`,this.image.style.top=`calc(50% + ${this.accumulatedTranslate.y}px)`,this.translate={x:0,y:0},this.image.style.transform="",this.rect=this.image.getBoundingClientRect(),i)return!0;if(n<this.minDimension.initialWidth)this.accumulatedTranslate.x=0,this.accumulatedTranslate.y=0,requestAnimationFrame(()=>{const r=this.image;r&&(r.addEventListener("transitionend",()=>{r&&(this.clean(),this.rect=null)},{once:!0}),r.style.transition="all 222ms ease",r.style.width=`${this.minDimension.initialWidth}px`,r.style.height=`${this.minDimension.initialHeight}px`,r.style.left="50%",r.style.top="50%")});else if(t){let r=!1;if(this.rect.right<window.innerWidth/2&&(r=!0,this.accumulatedTranslate.x+=window.innerWidth/2-this.rect.right),this.rect.left>window.innerWidth/2&&(r=!0,this.accumulatedTranslate.x-=this.rect.left-window.innerWidth/2),this.rect.bottom<window.innerHeight/2&&(r=!0,this.accumulatedTranslate.y+=window.innerHeight/2-this.rect.bottom),this.rect.top>window.innerHeight/2&&(r=!0,this.accumulatedTranslate.y-=this.rect.top-window.innerHeight/2),r){const a=this.image;a.addEventListener("transitionend",()=>{a&&(a.style.transition="",this.rect=null)},{once:!0}),a.style.transition="all 222ms ease",a.style.left=`calc(50% + ${this.accumulatedTranslate.x}px)`,a.style.top=`calc(50% + ${this.accumulatedTranslate.y}px)`}else this.rect=null}}}class it{constructor(){h(this,"fiolast",{})}fio(t,e,i=50){const o=Date.now()-(this.fiolast[e]??0),r=()=>{this.fiolast[e]=Date.now(),t()};if(!this.fiolast[e]){r();return}o>=i&&r()}}const b={somethingOpened:null};class nt{constructor(t,e={}){h(this,"options");h(this,"elements");h(this,"isReducedMotion");h(this,"currentIndex",-1);h(this,"currentChildren",null);h(this,"setupFunction",K);h(this,"initFunction",_);h(this,"closeFunction",J);h(this,"transitionFunction",Q);h(this,"pointers",null);h(this,"imageState");h(this,"imageTransitions",new Map);h(this,"root",null);h(this,"imageContainer",null);h(this,"onClickElements",t=>{t.preventDefault();const e=t.currentTarget;e.dataset.vistaIdx&&this.open(parseInt(e.dataset.vistaIdx))});h(this,"defaultOnClickHandler",t=>t.preventDefault());h(this,"abortController",null);h(this,"throttle",new it);h(this,"lastSwapTime",0);h(this,"transitionCleanup",null);h(this,"isZoomedIn",!1);h(this,"onKeyDown",t=>{switch(t.key){case"ArrowLeft":t.preventDefault(),this.prev();break;case"ArrowRight":t.preventDefault(),this.next();break;case"ArrowUp":t.preventDefault(),this.zoomIn();break;case"ArrowDown":t.preventDefault(),this.zoomOut();break;case"Escape":t.preventDefault(),this.close();break}});h(this,"onScroll",t=>{t.preventDefault();const e=t.deltaY;this.imageState.setInitialCenter({x:t.clientX,y:t.clientY}),e<0?this.zoomIn():e>0&&this.zoomOut()});h(this,"onResizeHandler",()=>{this.currentChildren.htmls.forEach((t,e)=>{const i=this.currentChildren.images[e],n=t.querySelector("img.vvw-img-hi"),o=t.querySelector("img.vvw-img-lo");if(P(i,n,o,!1),n.classList.contains("vvw--loaded")){const{width:r,height:a}=F(n);n.style.setProperty("--vvw-current-w",`${r}px`),n.style.setProperty("--vvw-current-h",`${a}px`),n.dataset.vvwWidth=r.toString(),n.dataset.vvwHeight=a.toString()}})});h(this,"pointerListeners",[]);h(this,"getInternalPointerListener",()=>{const t=this.imageState;let e=0,i=!1,n=()=>{};return o=>{if(o.event==="down"){if(n(),this.isZoomedIn&&o.pointers.length===1){const r=this.pointers.getCentroid();t.setInitialCenter(r)}if(o.pointers.length>=2){i=!0;const r=this.pointers.getCentroid();e=this.pointers.getPointerDistance(o.pointers[0],o.pointers[1]),t.setInitialCenter(r)}}else if(o.event==="move"){if(this.isZoomedIn&&o.pointers.length===1&&o.lastPointerLen===0){const r=this.pointers.getCentroid();t.move(r)}if(o.pointers.length>=2&&i){const r=this.pointers.getCentroid(),a=this.pointers.getPointerDistance(o.pointers[0],o.pointers[1]);t.scaleMove(a/e,r)}}else(o.event==="up"||o.event==="cancel")&&(i||this.isZoomedIn)&&(i?(i=!1,t.normalize()&&requestAnimationFrame(()=>{this.close()})):this.isZoomedIn&&o.pointers.length===0&&(n=t.moveAndNormalize(o.pointer)));this.pointerListeners.forEach(r=>r({...o,hasInternalExecution:this.isZoomedIn||i,abortController:this.abortController}))}});this.elements=t,this.options={...M,...e,controls:{...M.controls,...e.controls}},this.imageState=new et(this.options.maxZoomLevel,i=>{var n,o,r,a,l,c;i.isMin?(this.isZoomedIn=!1,(n=this.qs(".vvw-zoom-out"))==null||n.setAttribute("disabled","true"),(o=this.qs('.vvw-item[data-vvw-idx="'+this.currentIndex+'"]'))==null||o.style.setProperty("pointer-events","none")):(this.isZoomedIn=!0,(r=this.qs(".vvw-zoom-out"))==null||r.removeAttribute("disabled"),(a=this.qs('.vvw-item[data-vvw-idx="'+this.currentIndex+'"]'))==null||a.style.setProperty("pointer-events","auto")),i.isMax?(l=this.qs(".vvw-zoom-in"))==null||l.setAttribute("disabled","true"):(c=this.qs(".vvw-zoom-in"))==null||c.removeAttribute("disabled")}),this.options.setupFunction&&(this.setupFunction=this.options.setupFunction),this.options.closeFunction&&(this.closeFunction=this.options.closeFunction),this.options.initFunction&&(this.initFunction=this.options.initFunction),this.options.transitionFunction&&(this.transitionFunction=this.options.transitionFunction),this.isReducedMotion=window.matchMedia("(prefers-reduced-motion: reduce)").matches,this.elements instanceof NodeList&&this.elements.forEach((i,n)=>{i.dataset.vistaIdx=n.toString(),i.addEventListener("click",this.defaultOnClickHandler),i.addEventListener("pointerup",this.onClickElements)})}qs(t){return this.root?this.root.querySelector(t):null}async swap(t,e){const i=this.options.preloads||0,n=this.currentIndex,{htmls:o,images:r}=this.getChildElements(i,n),a=this.imageContainer,l=this.currentChildren,c={htmlElements:{from:l.htmls,to:o},images:{from:l.images,to:r},index:{from:t,to:this.currentIndex},via:e||{next:!1,prev:!1},vistaView:this};this.setupFunction(c),this.currentChildren={htmls:o,images:r},this.displayActiveIndex();const m=this.abortController.signal;if(performance.now()-this.lastSwapTime<this.options.rapidLimit){a.innerHTML="",this.transitionCleanup&&this.transitionCleanup(),o.forEach(E=>{a.appendChild(E)}),this.lastSwapTime=performance.now(),this.waitForImagesToLoad(),this.options.onImageView&&this.options.onImageView(c);return}const y=this.transitionFunction(c,m);y&&(this.transitionCleanup=y.cleanup,await y.transitionEnded),this.lastSwapTime=performance.now();const d=o[Math.floor(o.length/2)].dataset.vvwIdx,u=a.querySelector(`.vvw-item[data-vvw-idx="${d}"] img.vvw-img-hi`),C=this.imageTransitions.get(u);this.imageTransitions.delete(u);const x=u.getAttribute("style")||"",p=u.classList.contains("vvw--loaded"),T=u.classList.contains("vvw--ready"),S=u.width,H=u.height;this.imageState.reset(),a.innerHTML="",this.transitionCleanup&&this.transitionCleanup(),o.forEach(E=>{const g=E.querySelector("img.vvw-img-hi");E.dataset.vvwPos==="0"&&!m.aborted&&x&&S&&H&&(p&&(g.classList.add("vvw--loaded"),g.dataset.vvwWidth=u.dataset.vvwWidth||"",g.dataset.vvwHeight=u.dataset.vvwHeight||""),T&&(g.classList.add("vvw--ready"),g.width=S,g.height=H),g.setAttribute("style",x)),a.appendChild(E),E.dataset.vvwPos==="0"&&!m.aborted&&T?(this.imageState.setCurrentImage(g),this.imageState.setInitialCenter()):E.dataset.vvwPos==="0"&&!m.aborted&&x&&S&&H&&p&&C&&(this.imageTransitions.set(g,C),this.transitionImage(g,()=>{this.imageState.setCurrentImage(g),this.imageState.setInitialCenter(),g.classList.add("vvw--ready")}))}),this.waitForImagesToLoad(),this.options.onImageView&&this.options.onImageView(c)}getChildElements(t,e){const i=[],n=[];for(let o=-t;o<=t;o++){const r=(e+o+this.elements.length)%this.elements.length,a=this.elements[r],l=a instanceof HTMLImageElement?a:a instanceof HTMLAnchorElement&&a.querySelector("img")||void 0,c=a instanceof HTMLElement?{index:r,imageElm:l instanceof HTMLImageElement?l:void 0,anchorElm:a instanceof HTMLAnchorElement?a:void 0,src:a.dataset.vistaviewSrc||a.getAttribute("href")||a.getAttribute("src")||"",thumb:a.dataset.vistaviewThumb||(l instanceof HTMLImageElement?l.getAttribute("src"):void 0)||a.getAttribute("href")||void 0,alt:l instanceof HTMLImageElement&&l.getAttribute("alt")||void 0}:{index:r,...a};n.push(c),i.push(V(c,o))}return{htmls:i,images:n}}zoomIn(){this.throttle.fio(()=>{this.imageState.animateZoom(1.68)},"zoom",222)}zoomOut(){this.throttle.fio(()=>{this.imageState.animateZoom(.68)},"zoom",222)}displayActiveIndex(){var r;const t=this.currentIndex;this.elements instanceof NodeList&&this.elements.forEach((a,l)=>{a.style.opacity="",l===t&&(a.style.opacity="0")});const e=this.qs(".vvw-index"),i=`${t+1}`,n=`${this.elements.length}`;e&&(e.textContent=`${i} / ${n}`);const o=this.qs(".vvw-desc");if(o){const a=(r=this.currentChildren)==null?void 0:r.images.find(c=>c.index===t),l=(a==null?void 0:a.alt)||"";l?(o.textContent=l,o.setAttribute("aria-label",`Image ${i} of ${n}: ${l}`)):(o.textContent="",o.setAttribute("aria-label",`Image ${i} of ${n}`))}}transitionImage(t,e){const i=this.imageTransitions.get(t);i&&requestAnimationFrame(()=>{const{current:n,target:o}=i,r={width:n.width+(o.width-n.width)*.1,height:n.height+(o.height-n.height)*.1,radius:n.radius+(o.radius-n.radius)*.1};Math.abs(r.width-o.width)<.5&&Math.abs(r.height-o.height)<.5&&Math.abs(r.radius-o.radius)<.5?(t.style.setProperty("--vvw-current-w",`${o.width}px`),t.style.setProperty("--vvw-current-h",`${o.height}px`),t.style.setProperty("--vvw-current-radius",`${o.radius}px`),this.imageTransitions.delete(t),e()):(t.style.setProperty("--vvw-current-w",`${r.width}px`),t.style.setProperty("--vvw-current-h",`${r.height}px`),t.style.setProperty("--vvw-current-radius",`${r.radius}px`),this.imageTransitions.set(t,{current:r,target:o}),this.transitionImage(t,e))})}waitForImagesToLoad(){this.imageContainer.querySelectorAll("img.vvw-img-hi:not(.vvw--loaded)").forEach(i=>{const n=i,o=()=>{var c;n.width=n.naturalWidth,n.height=n.naturalHeight;const r=(c=n.parentElement)==null?void 0:c.matches(`[data-vvw-idx="${this.currentIndex}"]`),{width:a,height:l}=F(n);n.dataset.vvwWidth=a.toString(),n.dataset.vvwHeight=l.toString(),n.classList.add("vvw--loaded"),this.imageTransitions.set(n,{current:{width:n.style.getPropertyValue("--vvw-current-w")?parseFloat(n.style.getPropertyValue("--vvw-current-w")):0,height:n.style.getPropertyValue("--vvw-current-h")?parseFloat(n.style.getPropertyValue("--vvw-current-h")):0,radius:n.style.getPropertyValue("--vvw-current-radius")?parseFloat(n.style.getPropertyValue("--vvw-current-radius")):0},target:{width:a,height:l,radius:0}}),this.transitionImage(n,()=>{r&&(this.imageState.setCurrentImage(n),this.imageState.setInitialCenter()),n.classList.add("vvw--ready")})};if(n.complete&&n.naturalWidth!==0){o();return}n.addEventListener("load",()=>{o()}),n.addEventListener("error",()=>{var a;n.classList.add("vvw--loaderror");const r=document.createElement("p");r.className="vvw-img-err",r.setAttribute("role","alert"),r.textContent="Error loading image",(a=n.parentNode)==null||a.appendChild(r)})})}registerPointerListener(t){this.pointerListeners.push(t)}unregisterPointerListeners(){this.pointerListeners=[]}open(t=0){var c,m,f,$,y;if(b.somethingOpened)return;b.somethingOpened=this,this.currentIndex=t,document.body.style.overflow="hidden";const e=U({controls:this.options.controls});if(document.body.prepend(e),this.root=document.body.querySelector("#vvw-root"),!this.root)throw new Error("Failed to setup VistaView root element.");this.imageContainer=this.qs(".vvw-image-container"),this.options.animationDurationBase&&this.root.style.setProperty("--vvw-anim-dur",`${this.options.animationDurationBase}`),this.options.initialZIndex!==void 0&&this.root.style.setProperty("--vvw-init-z",`${this.options.initialZIndex??0}`),this.options.arrowOnSmallScreens&&this.root.classList.add("vvw-arrow-sm");const i=this.options.preloads||0,n=t,{images:o,htmls:r}=this.getChildElements(i,n),a={htmlElements:{from:null,to:r},images:{from:null,to:o},index:{from:null,to:this.currentIndex},via:{next:!1,prev:!1},vistaView:this};this.setupFunction(a),this.currentChildren={htmls:r,images:o},r.forEach(d=>{this.imageContainer.appendChild(d)}),(c=this.qs(".vvw-close"))==null||c.addEventListener("click",()=>this.close()),(m=this.qs(".vvw-zoom-in"))==null||m.addEventListener("click",()=>this.zoomIn()),(f=this.qs(".vvw-zoom-out"))==null||f.addEventListener("click",()=>this.zoomOut()),($=this.qs(".vvw-prev>button"))==null||$.addEventListener("click",()=>this.prev()),(y=this.qs(".vvw-next>button"))==null||y.addEventListener("click",()=>this.next()),this.options.keyboardListeners&&window.addEventListener("keydown",this.onKeyDown),window.addEventListener("wheel",this.onScroll,{passive:!1}),window.addEventListener("resize",this.onResizeHandler),this.pointers=new tt({elm:this.imageContainer,listeners:[this.getInternalPointerListener()]});const l={};[...this.options.controls.topLeft||[],...this.options.controls.topRight||[],...this.options.controls.topCenter||[],...this.options.controls.bottomCenter||[],...this.options.controls.bottomLeft||[],...this.options.controls.bottomRight||[]].forEach(d=>{typeof d!="string"&&(l[d.name]=d)}),this.root.querySelectorAll("button[data-vvw-control]").forEach(d=>{const u=d;u.addEventListener("click",C=>{const x=C.currentTarget.dataset.vvwControl,p=l[x],T=this.currentChildren.images.find(S=>S.index===this.currentIndex);p&&T&&(p.onClick.constructor.name==="AsyncFunction"?(u.classList.add("vvw--loading"),p.onClick(T,this).finally(()=>{u.classList.remove("vvw--loading")})):p.onClick(T,this))})}),this.initFunction(this),requestAnimationFrame(()=>{var d;(d=this.root)==null||d.addEventListener("transitionend",()=>{var u;(u=this.root)==null||u.classList.add("vvw--settled"),this.waitForImagesToLoad(),this.imageState.reset()},{once:!0}),this.root.classList.add("vvw--active"),this.displayActiveIndex(),this.options.onOpen&&this.options.onOpen(this),this.options.onImageView&&this.options.onImageView(a)})}async close(t=!0){b.somethingOpened===this&&this.root&&(t?await new Promise(e=>{let n=0;this.root.addEventListener("transitionend",o=>{o.target===this.root&&(n++,n===2&&this.elements instanceof NodeList&&this.elements.forEach(r=>{r.style.opacity=""}),n===3&&e(null))}),this.root.classList.add("vvw--closing")}):this.elements instanceof NodeList&&this.elements.forEach(e=>{e.style.opacity=""}),this.options.keyboardListeners&&window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("resize",this.onResizeHandler),window.removeEventListener("wheel",this.onScroll),this.unregisterPointerListeners(),this.pointers.removeListeners(),this.root.remove(),this.root=null,this.imageContainer=null,this.currentChildren=null,this.currentIndex=-1,document.body.style.overflow="",b.somethingOpened=null,this.closeFunction(this),this.options.onClose&&this.options.onClose(this))}next(){if(b.somethingOpened!==this)return;const t=(this.currentIndex+1)%this.elements.length;this.view(t,{next:!0,prev:!1})}prev(){if(b.somethingOpened!==this)return;const t=(this.currentIndex-1+this.elements.length)%this.elements.length;this.view(t,{next:!1,prev:!0})}destroy(){this.close(!1),this.elements instanceof NodeList&&this.elements.forEach(t=>{t.removeAttribute("data-vista-idx"),t.removeEventListener("click",this.defaultOnClickHandler),t.removeEventListener("pointerup",this.onClickElements)})}getCurrentIndex(){return b.somethingOpened!==this?-1:this.currentIndex}view(t,e){if(b.somethingOpened!==this||t<0||t>=this.elements.length)return;const i=this.currentIndex;this.currentIndex=t;const n=this.abortController;n==null||n.abort(),this.abortController=new AbortController,this.swap(i,e)}}function st(s){let t=null;if(typeof s=="string"?t=document.querySelectorAll(s):s instanceof NodeList&&(t=s),t)for(let e=0;e<t.length;e++){const i=t[e];if(!(i.dataset.vistaviewSrc||i.getAttribute("href")||i.getAttribute("src")||""))return`Element at index ${e} is missing 'src' / 'data-vistaview-src' / 'href' attribute.`}else{const e=s;for(let i=0;i<e.length;i++)if(!e[i].src)return`Element at index ${i} is missing 'src' attribute.`}return t||s}function ot({elements:s,...t}){if(!s)throw new Error("No elements");let e=st(s);if(typeof e=="string")return null;const i=new nt(e,t);return{open:(n=0)=>i.open(n),close:()=>i.close(),next:()=>i.next(),prev:()=>i.prev(),destroy:()=>i.destroy(),getCurrentIndex:()=>i.getCurrentIndex(),view:n=>{i.view(n)}}}v.DefaultOptions=M,v.vistaView=ot,v.vistaViewDownload=z,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})}));
|
|
11
|
+
</div>`)}const M={animationDurationBase:333,maxZoomLevel:2,preloads:1,keyboardListeners:!0,arrowOnSmallScreens:!1,rapidLimit:222,controls:{topLeft:["indexDisplay"],topRight:["zoomIn","zoomOut",A(),"close"],bottomLeft:["description"]}};function z(s){}function q(s){const t=s.options.preloads;s.imageContainer.style.width=`${(t*2+1)*100}vw`,s.imageContainer.style.left=`-${t*100}vw`,s.imageContainer.style.display="flex",Q(s)}function Q(s){let t={x:0,y:0},e={x:0,y:0},i=null;s.registerPointerListener(n=>{var o;if(!n.hasInternalExecution&&!(n.pointers.length>1)){if(n.event==="down"&&(t={x:n.pointer.x,y:n.pointer.y},e={x:n.pointer.x,y:n.pointer.y},(o=n.abortController)==null||o.abort()),n.event==="move"){e={x:n.pointer.x,y:n.pointer.y};const r=e.x-t.x,a=e.y-t.y;if(!i&&Math.abs(a)>Math.abs(r)||i==="y"){const h=a/window.innerHeight*100;s.imageContainer.style.transition="none",s.imageContainer.style.transform=`translateY(${h}vh)`,i="y"}else if(!i&&Math.abs(r)>Math.abs(a)||i==="x"){const h=r/window.innerWidth*100;s.imageContainer.style.transition="none",s.imageContainer.style.transform=`translateX(${h}vw)`,i="x"}}if(n.event==="up"||n.event==="cancel"){let r=function(a){var h;(h=s.imageContainer)==null||h.addEventListener("transitionend",function c(){var m;(m=s.imageContainer)==null||m.removeEventListener("transitionend",c),s.imageContainer.style.transition="",s.imageContainer.style.transform=""}),s.imageContainer.style.transition="transform 222ms ease",s.imageContainer.style.transform=a};if(i==="y"){const a=e.y-t.y;Math.abs(a)>144?(s.imageContainer.style.transition="transform 222ms ease",s.imageContainer.style.transform="translateY(0vh)",s.close()):r("translateY(0vh)")}if(i==="x"){const a=e.x-t.x,h=n.pointer.movementX,c=1;s.imageContainer.style.transition="",a>0&&Math.abs(h)>c?s.prev():a<0&&Math.abs(h)>c?s.next():r("translateX(0vw)")}i=null,t={x:0,y:0},e={x:0,y:0}}}})}function k(s){}function O({vistaView:{isReducedMotion:s},htmlElements:{to:t},index:{from:e,to:i},vistaView:{elements:n,imageContainer:o,options:r}},a){if(!(!t||a.aborted||s||!(Math.abs(i-e)===1||e===0&&i===n.length-1||e===n.length-1&&i===0)))return{cleanup:()=>{o.style.transition="",o.style.transform=""},transitionEnded:new Promise(c=>{o.addEventListener("transitionend",()=>{c()},{once:!0}),o.addEventListener("transitioncancel",()=>{a.aborted&&c()},{once:!0});const m=Math.round(r.animationDurationBase*100)/100,f=i===e+1||e===n.length-1&&i===0?"translateX(-100vw)":"translateX(100vw)";o.style.transition=`transform ${m}ms ease`,o.style.transform=f})}}class tt{constructor({elm:t,listeners:e}){l(this,"pointers",[]);l(this,"elm");l(this,"listeners",[]);l(this,"lastPointerDownId",null);l(this,"removeLastPointer",()=>{if(this.pointers.length&&this.lastPointerDownId!==null){const t=this.pointers.findIndex(e=>e.id===this.lastPointerDownId);t!==-1&&this.pointers.splice(t,1)}});l(this,"onPointerDown",t=>{if(!this.listeners.length||t.button!==0)return;t.preventDefault(),this.lastPointerDownId=t.pointerId,window.addEventListener("contextmenu",this.removeLastPointer,{once:!0}),window.addEventListener("auxclick",this.removeLastPointer,{once:!0});let e={x:t.clientX,y:t.clientY,movementX:0,movementY:0,id:t.pointerId};this.pointers.push(e),this.listeners.forEach(i=>i({event:"down",pointer:e,pointers:this.pointers,lastPointerLen:this.pointers.length-1}))});l(this,"onPointerMove",t=>{if(!this.listeners.length)return;t.preventDefault();const e=this.pointers.find(i=>i.id===t.pointerId);e&&(e.movementX=t.movementX,e.movementY=t.movementY,e.x=t.clientX,e.y=t.clientY,this.listeners.forEach(i=>i({event:"move",pointer:e,pointers:this.pointers,lastPointerLen:this.pointers.length-1})))});l(this,"onPointerUp",t=>{if(!this.listeners.length||t.button!==0||(window.removeEventListener("contextmenu",this.removeLastPointer),window.removeEventListener("auxclick",this.removeLastPointer),t.target instanceof Node&&!this.elm.contains(t.target)&&t.target!==document.querySelector("html")&&t.target!==document))return;t.preventDefault();const e=this.pointers.findIndex(o=>o.id===t.pointerId);if(e===-1)return;const i=this.pointers[e];i.x=t.clientX,i.y=t.clientY;const n=this.pointers.length;this.pointers.splice(e,1),this.listeners.forEach(o=>o({event:"up",pointer:i,pointers:this.pointers,lastPointerLen:n}))});l(this,"onPointerCancel",t=>{if(!this.listeners.length||t.target instanceof Node&&!this.elm.contains(t.target)&&t.target!==document.querySelector("html")&&t.target!==document)return;t.preventDefault();const e=this.pointers.findIndex(o=>o.id===t.pointerId);if(e===-1)return;const i=this.pointers[e];i.x=t.clientX,i.y=t.clientY;const n=this.pointers.length;this.pointers.splice(e,1),this.listeners.forEach(o=>o({event:"cancel",pointer:i,pointers:this.pointers,lastPointerLen:n}))});this.elm=t??document,e&&(this.listeners=e),this.startListeners()}startListeners(){this.elm.addEventListener("pointerdown",this.onPointerDown),this.elm.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp),document.addEventListener("pointercancel",this.onPointerCancel)}removeListeners(){this.elm.removeEventListener("pointerdown",this.onPointerDown),this.elm.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerCancel),this.pointers=[]}addEventListener(t){this.listeners.push(t)}removeEventListener(t){this.listeners=this.listeners.filter(e=>e!==t)}getPointerDistance(t,e){const i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)}getCentroid(){if(this.pointers.length===0)return null;const t=this.pointers.reduce((e,i)=>(e.x+=i.x,e.y+=i.y,e),{x:0,y:0});return{x:t.x/this.pointers.length,y:t.y/this.pointers.length}}}class et{constructor(t,e){l(this,"maxZoomLevel");l(this,"image",null);l(this,"rect",null);l(this,"initialCenter",{x:0,y:0});l(this,"maxDimension",{width:0});l(this,"minDimension",{initialWidth:0,initialHeight:0,minWidth:0,closingWidth:0});l(this,"accumulatedTranslate",{x:0,y:0});l(this,"scale",1);l(this,"translate",{x:0,y:0});l(this,"onScale",null);l(this,"animationTimestamp",0);this.maxZoomLevel=t,this.onScale=e}clean(){this.image&&(this.image.style.transform="",this.image.style.width="",this.image.style.height="",this.image.style.top="",this.image.style.left="",this.image.style.opacity="")}reset(){this.clean(),this.image=null,this.rect=null,this.initialCenter={x:window.innerWidth/2,y:window.innerHeight/2},this.maxDimension={width:0},this.minDimension={initialWidth:0,initialHeight:0,minWidth:0,closingWidth:0},this.accumulatedTranslate={x:0,y:0},this.scale=1,this.translate={x:0,y:0}}setCurrentImage(t){if(this.rect=null,this.image=t,this.maxDimension={width:t.naturalWidth*this.maxZoomLevel},!t.dataset.vvwWidth||!t.dataset.vvwHeight)throw new Error("VistaImageState: Image dataset vvwWidth or vvwHeight not set.");const e=parseFloat(t.dataset.vvwWidth),i=parseFloat(t.dataset.vvwHeight);this.minDimension={initialWidth:e,initialHeight:i,minWidth:e*.1,closingWidth:e*.5},this.accumulatedTranslate={x:0,y:0}}setInitialCenter(t){this.initialCenter=t||{x:window.innerWidth/2,y:window.innerHeight/2}}move(t){this.image&&(this.rect||(this.rect=this.image.getBoundingClientRect()),this.translate.x=I(t.x-this.initialCenter.x),this.translate.y=I(t.y-this.initialCenter.y),this.image.style.transform=`translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`)}snapToTargetIfClose(t,e,i=1){return Math.abs(t-e)<=i&&(t=e),t}scaleMove(t,e){if(!this.image)return;this.rect||(this.rect=this.image.getBoundingClientRect()),e||(e=this.initialCenter);const i=this.snapToTargetIfClose(X(this.rect.width*t,this.minDimension.minWidth,this.maxDimension.width),this.minDimension.initialWidth);this.onScale&&this.onScale({scale:i/(this.maxDimension.width/this.maxZoomLevel),isMax:i>=this.maxDimension.width,isMin:i<=this.minDimension.initialWidth}),this.scale=I(i/this.rect.width);const n=this.rect.left+this.rect.width/2,o=this.rect.top+this.rect.height/2,r=this.initialCenter.x-n,a=this.initialCenter.y-o,h=r*(1-this.scale),c=a*(1-this.scale),m=e.x-this.initialCenter.x,f=e.y-this.initialCenter.y;this.translate.x=I(h+m),this.translate.y=I(c+f),this.image.style.transform=`translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`,i<=this.minDimension.closingWidth?this.image.style.opacity="0.5":this.image.style.opacity=""}moveAndNormalize(t){let e=0,i=!1;const n=({x:o,y:r})=>{if(i)return;if(Math.abs(o)<.001&&Math.abs(r)<.001)return this.normalize();o*=.9,r*=.9;const a=this.image.getBoundingClientRect();this.translate.x=I(this.translate.x+o),this.translate.y=I(this.translate.y+r),a.right<window.innerWidth/2&&(this.translate.x+=(window.innerWidth/2-a.right)*.1,o*=.7),a.left>window.innerWidth/2&&(this.translate.x-=(a.left-window.innerWidth/2)*.1,o*=.7),a.bottom<window.innerHeight/2&&(this.translate.y+=(window.innerHeight/2-a.bottom)*.1,r*=.7),a.top>window.innerHeight/2&&(this.translate.y-=(a.top-window.innerHeight/2)*.1,r*=.7),this.image.style.transform=`translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`,e=requestAnimationFrame(()=>n({x:o,y:r}))};return n({x:t.movementX,y:t.movementY}),()=>{i=!0,cancelAnimationFrame(e),this.normalize(!1)}}animateZoom(t){if(!this.image)return;this.rect||(this.rect=this.image.getBoundingClientRect());const e=Date.now(),i=this.image;this.rect.width*t<this.minDimension.closingWidth||i.width<Math.floor(this.minDimension.initialWidth)||(i.addEventListener("transitionend",()=>{this.animationTimestamp===e&&i&&(i.style.transition="",this.normalize())},{once:!0}),i.style.transition||(i.style.transition="all 222ms ease"),this.animationTimestamp=e,this.scaleMove(t))}normalize(t=!0){if(!this.image||!this.rect)return;const e=this.rect.width*this.scale,i=e<=this.minDimension.closingWidth,n=i?e:this.snapToTargetIfClose(this.rect.width*this.scale,this.minDimension.initialWidth),o=i?this.rect.height*this.scale:this.snapToTargetIfClose(this.rect.height*this.scale,this.minDimension.initialHeight);if(this.image.style.width=`${n}px`,this.image.style.height=`${o}px`,this.scale=1,this.image.style.opacity="",this.accumulatedTranslate.x+=this.translate.x,this.accumulatedTranslate.y+=this.translate.y,this.image.style.left=`calc(50% + ${this.accumulatedTranslate.x}px)`,this.image.style.top=`calc(50% + ${this.accumulatedTranslate.y}px)`,this.translate={x:0,y:0},this.image.style.transform="",this.rect=this.image.getBoundingClientRect(),i)return!0;if(n<this.minDimension.initialWidth)this.accumulatedTranslate.x=0,this.accumulatedTranslate.y=0,requestAnimationFrame(()=>{const r=this.image;r&&(r.addEventListener("transitionend",()=>{r&&(this.clean(),this.rect=null)},{once:!0}),r.style.transition="all 222ms ease",r.style.width=`${this.minDimension.initialWidth}px`,r.style.height=`${this.minDimension.initialHeight}px`,r.style.left="50%",r.style.top="50%")});else if(t){let r=!1;if(this.rect.right<window.innerWidth/2&&(r=!0,this.accumulatedTranslate.x+=window.innerWidth/2-this.rect.right),this.rect.left>window.innerWidth/2&&(r=!0,this.accumulatedTranslate.x-=this.rect.left-window.innerWidth/2),this.rect.bottom<window.innerHeight/2&&(r=!0,this.accumulatedTranslate.y+=window.innerHeight/2-this.rect.bottom),this.rect.top>window.innerHeight/2&&(r=!0,this.accumulatedTranslate.y-=this.rect.top-window.innerHeight/2),r){const a=this.image;a.addEventListener("transitionend",()=>{a&&(a.style.transition="",this.rect=null)},{once:!0}),a.style.transition="all 222ms ease",a.style.left=`calc(50% + ${this.accumulatedTranslate.x}px)`,a.style.top=`calc(50% + ${this.accumulatedTranslate.y}px)`}else this.rect=null}}}class it{constructor(){l(this,"fiolast",{})}fio(t,e,i=50){const o=Date.now()-(this.fiolast[e]??0),r=()=>{this.fiolast[e]=Date.now(),t()};if(!this.fiolast[e]){r();return}o>=i&&r()}}const C={somethingOpened:null};class nt{constructor(t,e={}){l(this,"options");l(this,"elements");l(this,"isReducedMotion");l(this,"currentIndex",-1);l(this,"currentChildren",null);l(this,"setupFunction",z);l(this,"initFunction",q);l(this,"closeFunction",k);l(this,"transitionFunction",O);l(this,"pointers",null);l(this,"imageState");l(this,"imageTransitions",new Map);l(this,"root",null);l(this,"imageContainer",null);l(this,"onClickElements",t=>{t.preventDefault();const e=t.currentTarget;e.dataset.vistaIdx&&this.open(parseInt(e.dataset.vistaIdx))});l(this,"defaultOnClickHandler",t=>t.preventDefault());l(this,"abortController",null);l(this,"throttle",new it);l(this,"lastSwapTime",0);l(this,"isRapidSwap",!1);l(this,"isRapidSwapRelease",0);l(this,"transitionCleanup",null);l(this,"isZoomedIn",!1);l(this,"onKeyDown",t=>{switch(t.key){case"ArrowLeft":t.preventDefault(),this.prev();break;case"ArrowRight":t.preventDefault(),this.next();break;case"ArrowUp":t.preventDefault(),this.zoomIn();break;case"ArrowDown":t.preventDefault(),this.zoomOut();break;case"Escape":t.preventDefault(),this.close();break}});l(this,"onScroll",t=>{t.preventDefault();const e=t.deltaY;this.imageState.setInitialCenter({x:t.clientX,y:t.clientY}),e<0?this.zoomIn():e>0&&this.zoomOut()});l(this,"onResizeHandler",()=>{this.currentChildren.htmls.forEach((t,e)=>{const i=this.currentChildren.images[e],n=t.querySelector("img.vvw-img-hi"),o=t.querySelector("img.vvw-img-lo");if(P(i,n,o,!1),n.classList.contains("vvw--loaded")){const{width:r,height:a}=F(n);n.style.setProperty("--vvw-current-w",`${r}px`),n.style.setProperty("--vvw-current-h",`${a}px`),n.dataset.vvwWidth=r.toString(),n.dataset.vvwHeight=a.toString()}})});l(this,"pointerListeners",[]);l(this,"getInternalPointerListener",()=>{const t=this.imageState;let e=0,i=!1,n=()=>{};return o=>{if(o.event==="down"){if(n(),this.isZoomedIn&&o.pointers.length===1){const r=this.pointers.getCentroid();t.setInitialCenter(r)}if(o.pointers.length>=2){i=!0;const r=this.pointers.getCentroid();e=this.pointers.getPointerDistance(o.pointers[0],o.pointers[1]),t.setInitialCenter(r)}}else if(o.event==="move"){if(this.isZoomedIn&&o.pointers.length===1&&o.lastPointerLen===0){const r=this.pointers.getCentroid();t.move(r)}if(o.pointers.length>=2&&i){const r=this.pointers.getCentroid(),a=this.pointers.getPointerDistance(o.pointers[0],o.pointers[1]);t.scaleMove(a/e,r)}}else(o.event==="up"||o.event==="cancel")&&(i||this.isZoomedIn)&&(i?(i=!1,t.normalize()&&requestAnimationFrame(()=>{this.close()})):this.isZoomedIn&&o.pointers.length===0&&(n=t.moveAndNormalize(o.pointer)));this.pointerListeners.forEach(r=>r({...o,hasInternalExecution:this.isZoomedIn||i,abortController:this.abortController}))}});this.elements=t,this.options={...M,...e,controls:{...M.controls,...e.controls}},this.imageState=new et(this.options.maxZoomLevel,i=>{var n,o,r,a,h,c;i.isMin?(this.isZoomedIn=!1,(n=this.qs(".vvw-zoom-out"))==null||n.setAttribute("disabled","true"),(o=this.qs('.vvw-item[data-vvw-idx="'+this.currentIndex+'"]'))==null||o.style.setProperty("pointer-events","none")):(this.isZoomedIn=!0,(r=this.qs(".vvw-zoom-out"))==null||r.removeAttribute("disabled"),(a=this.qs('.vvw-item[data-vvw-idx="'+this.currentIndex+'"]'))==null||a.style.setProperty("pointer-events","auto")),i.isMax?(h=this.qs(".vvw-zoom-in"))==null||h.setAttribute("disabled","true"):(c=this.qs(".vvw-zoom-in"))==null||c.removeAttribute("disabled")}),this.options.setupFunction&&(this.setupFunction=this.options.setupFunction),this.options.closeFunction&&(this.closeFunction=this.options.closeFunction),this.options.initFunction&&(this.initFunction=this.options.initFunction),this.options.transitionFunction&&(this.transitionFunction=this.options.transitionFunction),this.isReducedMotion=window.matchMedia("(prefers-reduced-motion: reduce)").matches,this.elements instanceof NodeList&&this.elements.forEach((i,n)=>{i.dataset.vistaIdx=n.toString(),i.addEventListener("click",this.defaultOnClickHandler),i.addEventListener("pointerup",this.onClickElements)})}qs(t){return this.root?this.root.querySelector(t):null}async swap(t,e){const i=this.options.preloads||0,n=this.currentIndex,{htmls:o,images:r}=this.getChildElements(i,n),a=this.imageContainer,h=this.currentChildren,c={htmlElements:{from:h.htmls,to:o},images:{from:h.images,to:r},index:{from:t,to:this.currentIndex},via:e||{next:!1,prev:!1},vistaView:this};this.setupFunction(c),this.currentChildren={htmls:o,images:r},this.displayActiveIndex();const m=this.abortController.signal,L=performance.now()-this.lastSwapTime<this.options.rapidLimit;if(this.isRapidSwap=L,a.querySelectorAll(".vvw-item img.vvw-img-hi").forEach(b=>b.classList.add("vvw--load-cancelled")),L){this.imageState.reset(),a.innerHTML="",this.transitionCleanup&&this.transitionCleanup(),o.forEach(b=>{a.appendChild(b)}),this.lastSwapTime=performance.now(),this.waitForImagesToLoad(),this.options.onImageView&&this.options.onImageView(c),this.isRapidSwapRelease&&clearTimeout(this.isRapidSwapRelease),this.isRapidSwapRelease=setTimeout(()=>{this.isRapidSwap=!1},333);return}const y=this.transitionFunction(c,m);y&&(this.transitionCleanup=y.cleanup,await y.transitionEnded),this.lastSwapTime=performance.now();const d=o[Math.floor(o.length/2)].dataset.vvwIdx,u=a.querySelector(`.vvw-item[data-vvw-idx="${d}"] img.vvw-img-hi`),E=this.imageTransitions.get(u);this.imageTransitions.delete(u);const x=u.getAttribute("style")||"",p=u.classList.contains("vvw--loaded"),S=u.classList.contains("vvw--ready"),T=u.width,H=u.height;this.imageState.reset(),a.innerHTML="",this.transitionCleanup&&this.transitionCleanup(),o.forEach(b=>{const g=b.querySelector("img.vvw-img-hi");b.dataset.vvwPos==="0"&&!m.aborted&&x&&T&&H&&(p&&(g.classList.add("vvw--loaded"),g.dataset.vvwWidth=u.dataset.vvwWidth||"",g.dataset.vvwHeight=u.dataset.vvwHeight||""),S&&(g.classList.add("vvw--ready"),g.width=T,g.height=H),g.setAttribute("style",x)),a.appendChild(b),b.dataset.vvwPos==="0"&&!m.aborted&&S?(this.imageState.setCurrentImage(g),this.imageState.setInitialCenter()):b.dataset.vvwPos==="0"&&!m.aborted&&x&&T&&H&&p&&E&&(this.imageTransitions.set(g,E),this.transitionImage(g,()=>{this.imageState.setCurrentImage(g),this.imageState.setInitialCenter(),g.classList.add("vvw--ready")}))}),this.isRapidSwap=!1,this.waitForImagesToLoad(),this.options.onImageView&&this.options.onImageView(c)}getChildElements(t,e){const i=[],n=[];for(let o=-t;o<=t;o++){const r=(e+o+this.elements.length)%this.elements.length,a=this.elements[r],h=a instanceof HTMLImageElement?a:a instanceof HTMLAnchorElement&&a.querySelector("img")||void 0,c=a instanceof HTMLElement?{index:r,imageElm:h instanceof HTMLImageElement?h:void 0,anchorElm:a instanceof HTMLAnchorElement?a:void 0,src:a.dataset.vistaviewSrc||a.getAttribute("href")||a.getAttribute("src")||"",thumb:a.dataset.vistaviewThumb||(h instanceof HTMLImageElement?h.getAttribute("src"):void 0)||a.getAttribute("href")||void 0,alt:h instanceof HTMLImageElement&&h.getAttribute("alt")||void 0}:{index:r,...a};n.push(c),i.push(G(c,o))}return{htmls:i,images:n}}zoomIn(){this.throttle.fio(()=>{this.imageState.animateZoom(1.68)},"zoom",222)}zoomOut(){this.throttle.fio(()=>{this.imageState.animateZoom(.68)},"zoom",222)}displayActiveIndex(){var r;const t=this.currentIndex;this.elements instanceof NodeList&&this.elements.forEach((a,h)=>{a.style.opacity="",h===t&&(a.style.opacity="0")});const e=this.qs(".vvw-index"),i=`${t+1}`,n=`${this.elements.length}`;e&&(e.textContent=`${i} / ${n}`);const o=this.qs(".vvw-desc");if(o){const a=(r=this.currentChildren)==null?void 0:r.images.find(c=>c.index===t),h=(a==null?void 0:a.alt)||"";h?(o.textContent=h,o.setAttribute("aria-label",`Image ${i} of ${n}: ${h}`)):(o.textContent="",o.setAttribute("aria-label",`Image ${i} of ${n}`))}}transitionImage(t,e){if(t.classList.contains("vvw--load-cancelled"))return;if(this.isRapidSwap){requestAnimationFrame(()=>{this.transitionImage(t,e)});return}const i=this.imageTransitions.get(t);i&&requestAnimationFrame(()=>{if(t.classList.contains("vvw--load-cancelled"))return;const{current:n,target:o}=i,r={width:n.width+(o.width-n.width)*.2,height:n.height+(o.height-n.height)*.2,radius:n.radius+(o.radius-n.radius)*.2};Math.abs(r.width-o.width)<1&&Math.abs(r.height-o.height)<1&&Math.abs(r.radius-o.radius)<1?(t.style.setProperty("--vvw-current-w",`${o.width}px`),t.style.setProperty("--vvw-current-h",`${o.height}px`),t.style.setProperty("--vvw-current-radius",`${o.radius}px`),this.imageTransitions.delete(t),e()):(t.style.setProperty("--vvw-current-w",`${r.width}px`),t.style.setProperty("--vvw-current-h",`${r.height}px`),t.style.setProperty("--vvw-current-radius",`${r.radius}px`),this.imageTransitions.set(t,{current:r,target:o}),this.transitionImage(t,e))})}waitForImagesToLoad(){this.imageContainer.querySelectorAll("img.vvw-img-hi:not(.vvw--loaded)").forEach(i=>{const n=i;if(n.classList.contains("vvw--load-cancelled"))return;const o=()=>{if(n.classList.contains("vvw--load-cancelled"))return;n.width=n.naturalWidth,n.height=n.naturalHeight;const{width:r,height:a}=F(n);n.dataset.vvwWidth=r.toString(),n.dataset.vvwHeight=a.toString(),n.classList.add("vvw--loaded"),this.imageTransitions.set(n,{current:{width:n.style.getPropertyValue("--vvw-current-w")?parseFloat(n.style.getPropertyValue("--vvw-current-w")):0,height:n.style.getPropertyValue("--vvw-current-h")?parseFloat(n.style.getPropertyValue("--vvw-current-h")):0,radius:n.style.getPropertyValue("--vvw-current-radius")?parseFloat(n.style.getPropertyValue("--vvw-current-radius")):0},target:{width:r,height:a,radius:0}}),this.transitionImage(n,()=>{var c;if(n.classList.contains("vvw--load-cancelled"))return;((c=n.parentElement)==null?void 0:c.matches(`[data-vvw-idx="${this.currentIndex}"][data-vvw-pos="0"]`))&&(this.imageState.setCurrentImage(n),this.imageState.setInitialCenter()),n.classList.add("vvw--ready")})};if(n.complete&&n.naturalWidth!==0){o();return}n.addEventListener("load",()=>{o()}),n.addEventListener("error",()=>{var a;n.classList.add("vvw--loaderror");const r=document.createElement("p");r.className="vvw-img-err",r.setAttribute("role","alert"),r.textContent="Error loading image",(a=n.parentNode)==null||a.appendChild(r)})})}registerPointerListener(t){this.pointerListeners.push(t)}unregisterPointerListeners(){this.pointerListeners=[]}open(t=0){var c,m,f,L,y;if(C.somethingOpened)return;C.somethingOpened=this,this.currentIndex=t,document.body.style.overflow="hidden";const e=J({controls:this.options.controls});if(document.body.prepend(e),this.root=document.body.querySelector("#vvw-root"),!this.root)throw new Error("Failed to setup VistaView root element.");this.imageContainer=this.qs(".vvw-image-container"),this.options.animationDurationBase&&this.root.style.setProperty("--vvw-anim-dur",`${this.options.animationDurationBase}`),this.options.initialZIndex!==void 0&&this.root.style.setProperty("--vvw-init-z",`${this.options.initialZIndex??0}`),this.options.arrowOnSmallScreens&&this.root.classList.add("vvw-arrow-sm");const i=this.options.preloads||0,n=t,{images:o,htmls:r}=this.getChildElements(i,n),a={htmlElements:{from:null,to:r},images:{from:null,to:o},index:{from:null,to:this.currentIndex},via:{next:!1,prev:!1},vistaView:this};this.setupFunction(a),this.currentChildren={htmls:r,images:o},r.forEach(d=>{this.imageContainer.appendChild(d)}),(c=this.qs(".vvw-close"))==null||c.addEventListener("click",()=>this.close()),(m=this.qs(".vvw-zoom-in"))==null||m.addEventListener("click",()=>this.zoomIn()),(f=this.qs(".vvw-zoom-out"))==null||f.addEventListener("click",()=>this.zoomOut()),(L=this.qs(".vvw-prev>button"))==null||L.addEventListener("click",()=>this.prev()),(y=this.qs(".vvw-next>button"))==null||y.addEventListener("click",()=>this.next()),this.options.keyboardListeners&&window.addEventListener("keydown",this.onKeyDown),window.addEventListener("wheel",this.onScroll,{passive:!1}),window.addEventListener("resize",this.onResizeHandler),this.pointers=new tt({elm:this.imageContainer,listeners:[this.getInternalPointerListener()]});const h={};[...this.options.controls.topLeft||[],...this.options.controls.topRight||[],...this.options.controls.topCenter||[],...this.options.controls.bottomCenter||[],...this.options.controls.bottomLeft||[],...this.options.controls.bottomRight||[]].forEach(d=>{typeof d!="string"&&(h[d.name]=d)}),this.root.querySelectorAll("button[data-vvw-control]").forEach(d=>{const u=d;u.addEventListener("click",E=>{const x=E.currentTarget.dataset.vvwControl,p=h[x],S=this.currentChildren.images.find(T=>T.index===this.currentIndex);p&&S&&(p.onClick.constructor.name==="AsyncFunction"?(u.classList.add("vvw--loading"),p.onClick(S,this).finally(()=>{u.classList.remove("vvw--loading")})):p.onClick(S,this))})}),this.initFunction(this),requestAnimationFrame(()=>{var d;(d=this.root)==null||d.addEventListener("transitionend",()=>{var u;(u=this.root)==null||u.classList.add("vvw--settled"),this.imageState.reset(),this.waitForImagesToLoad()},{once:!0}),this.root.classList.add("vvw--active"),this.displayActiveIndex(),this.options.onOpen&&this.options.onOpen(this),this.options.onImageView&&this.options.onImageView(a)})}async close(t=!0){C.somethingOpened===this&&this.root&&(t?await new Promise(e=>{let n=0;this.root.addEventListener("transitionend",o=>{o.target===this.root&&(n++,n===2&&this.elements instanceof NodeList&&this.elements.forEach(r=>{r.style.opacity=""}),n===3&&e(null))}),this.root.classList.add("vvw--closing")}):this.elements instanceof NodeList&&this.elements.forEach(e=>{e.style.opacity=""}),this.options.keyboardListeners&&window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("resize",this.onResizeHandler),window.removeEventListener("wheel",this.onScroll),this.unregisterPointerListeners(),this.pointers.removeListeners(),this.root.remove(),this.root=null,this.imageContainer=null,this.currentChildren=null,this.currentIndex=-1,document.body.style.overflow="",C.somethingOpened=null,this.closeFunction(this),this.options.onClose&&this.options.onClose(this))}next(){if(C.somethingOpened!==this)return;const t=(this.currentIndex+1)%this.elements.length;this.view(t,{next:!0,prev:!1})}prev(){if(C.somethingOpened!==this)return;const t=(this.currentIndex-1+this.elements.length)%this.elements.length;this.view(t,{next:!1,prev:!0})}destroy(){this.close(!1),this.elements instanceof NodeList&&this.elements.forEach(t=>{t.removeAttribute("data-vista-idx"),t.removeEventListener("click",this.defaultOnClickHandler),t.removeEventListener("pointerup",this.onClickElements)})}getCurrentIndex(){return C.somethingOpened!==this?-1:this.currentIndex}view(t,e){if(C.somethingOpened!==this||t<0||t>=this.elements.length)return;const i=this.currentIndex;this.currentIndex=t;const n=this.abortController;n==null||n.abort(),this.abortController=new AbortController,this.swap(i,e)}}function st(s){let t=null;if(typeof s=="string"?t=document.querySelectorAll(s):s instanceof NodeList&&(t=s),t)for(let e=0;e<t.length;e++){const i=t[e];if(!(i.dataset.vistaviewSrc||i.getAttribute("href")||i.getAttribute("src")||""))return`Element at index ${e} is missing 'src' / 'data-vistaview-src' / 'href' attribute.`}else{const e=s;for(let i=0;i<e.length;i++)if(!e[i].src)return`Element at index ${i} is missing 'src' attribute.`}return t||s}function ot({elements:s,...t}){if(!s)throw new Error("No elements");let e=st(s);if(typeof e=="string")return null;const i=new nt(e,t);return{open:(n=0)=>i.open(n),close:()=>i.close(),next:()=>i.next(),prev:()=>i.prev(),destroy:()=>i.destroy(),getCurrentIndex:()=>i.getCurrentIndex(),view:n=>{i.view(n)}}}v.DefaultOptions=M,v.close=k,v.init=q,v.setup=z,v.transition=O,v.vistaView=ot,v.vistaViewDownload=A,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})}));
|