maz-ui 3.0.0-beta.21 → 3.0.0-beta.22
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/components/MazCard.js +2 -2
- package/components/MazCard.js.map +1 -1
- package/components/MazGallery.d.ts +4 -3
- package/components/MazGallery.js +2 -2
- package/components/MazGallery.js.map +1 -1
- package/components/MazTransitionExpand.js +1 -1
- package/components/MazTransitionExpand.js.map +1 -1
- package/components/types.d.ts +1 -1
- package/css/main.css +82 -1
- package/maz-ui.d.ts +29 -6
- package/modules/index.js +2 -2
- package/modules/index.js.map +1 -1
- package/package.json +1 -1
package/css/main.css
CHANGED
|
@@ -9,6 +9,8 @@ html {
|
|
|
9
9
|
border-width: 0;
|
|
10
10
|
border-style: solid;
|
|
11
11
|
border-color: #e5e7eb;
|
|
12
|
+
-webkit-box-sizing: border-box;
|
|
13
|
+
box-sizing: border-box;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
button {
|
|
@@ -121,7 +123,7 @@ textarea {
|
|
|
121
123
|
/* USAGE */
|
|
122
124
|
--maz-color-normal-text: #2c3e50;
|
|
123
125
|
--maz-color-bg: white;
|
|
124
|
-
--maz-color-bg-light: #
|
|
126
|
+
--maz-color-bg-light: #efefef;
|
|
125
127
|
--maz-color-bg-lighter: #f2f2f2;
|
|
126
128
|
--maz-color-muted: rgb(0 0 0 / 54%);
|
|
127
129
|
}
|
|
@@ -453,6 +455,10 @@ html.dark {
|
|
|
453
455
|
top: -50%;
|
|
454
456
|
}
|
|
455
457
|
|
|
458
|
+
.maz-right-0 {
|
|
459
|
+
right: 0px;
|
|
460
|
+
}
|
|
461
|
+
|
|
456
462
|
.maz-bottom-0 {
|
|
457
463
|
bottom: 0px;
|
|
458
464
|
}
|
|
@@ -477,6 +483,10 @@ html.dark {
|
|
|
477
483
|
z-index: 20;
|
|
478
484
|
}
|
|
479
485
|
|
|
486
|
+
.maz-z-50 {
|
|
487
|
+
z-index: 50;
|
|
488
|
+
}
|
|
489
|
+
|
|
480
490
|
.maz-z-100 {
|
|
481
491
|
z-index: 100;
|
|
482
492
|
}
|
|
@@ -538,6 +548,10 @@ html.dark {
|
|
|
538
548
|
margin-bottom: 0.75rem;
|
|
539
549
|
}
|
|
540
550
|
|
|
551
|
+
.maz-ml-1 {
|
|
552
|
+
margin-left: 0.25rem;
|
|
553
|
+
}
|
|
554
|
+
|
|
541
555
|
.maz-ml-2 {
|
|
542
556
|
margin-left: 0.5rem;
|
|
543
557
|
}
|
|
@@ -566,6 +580,10 @@ html.dark {
|
|
|
566
580
|
display: none;
|
|
567
581
|
}
|
|
568
582
|
|
|
583
|
+
.maz-h-3 {
|
|
584
|
+
height: 0.75rem;
|
|
585
|
+
}
|
|
586
|
+
|
|
569
587
|
.maz-h-5 {
|
|
570
588
|
height: 1.25rem;
|
|
571
589
|
}
|
|
@@ -574,6 +592,10 @@ html.dark {
|
|
|
574
592
|
height: 1.5rem;
|
|
575
593
|
}
|
|
576
594
|
|
|
595
|
+
.maz-h-7 {
|
|
596
|
+
height: 1.75rem;
|
|
597
|
+
}
|
|
598
|
+
|
|
577
599
|
.maz-h-9 {
|
|
578
600
|
height: 2.25rem;
|
|
579
601
|
}
|
|
@@ -606,10 +628,18 @@ html.dark {
|
|
|
606
628
|
width: 0px;
|
|
607
629
|
}
|
|
608
630
|
|
|
631
|
+
.maz-w-3 {
|
|
632
|
+
width: 0.75rem;
|
|
633
|
+
}
|
|
634
|
+
|
|
609
635
|
.maz-w-5 {
|
|
610
636
|
width: 1.25rem;
|
|
611
637
|
}
|
|
612
638
|
|
|
639
|
+
.maz-w-7 {
|
|
640
|
+
width: 1.75rem;
|
|
641
|
+
}
|
|
642
|
+
|
|
613
643
|
.maz-w-9 {
|
|
614
644
|
width: 2.25rem;
|
|
615
645
|
}
|
|
@@ -825,6 +855,17 @@ html.dark {
|
|
|
825
855
|
margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
|
|
826
856
|
}
|
|
827
857
|
|
|
858
|
+
.maz-space-y-2 > :not([hidden]) ~ :not([hidden]) {
|
|
859
|
+
--tw-space-y-reverse: 0;
|
|
860
|
+
margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));
|
|
861
|
+
margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
.maz-self-center {
|
|
865
|
+
-ms-flex-item-align: center;
|
|
866
|
+
align-self: center;
|
|
867
|
+
}
|
|
868
|
+
|
|
828
869
|
.maz-overflow-auto {
|
|
829
870
|
overflow: auto;
|
|
830
871
|
}
|
|
@@ -1100,6 +1141,11 @@ html.dark {
|
|
|
1100
1141
|
background-color: var(--maz-color-danger);
|
|
1101
1142
|
}
|
|
1102
1143
|
|
|
1144
|
+
.hover\:maz-bg-gray-900:hover {
|
|
1145
|
+
--tw-bg-opacity: 1;
|
|
1146
|
+
background-color: rgba(17, 24, 39, var(--tw-bg-opacity));
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1103
1149
|
.maz-bg-clip-padding {
|
|
1104
1150
|
background-clip: padding-box;
|
|
1105
1151
|
}
|
|
@@ -1198,6 +1244,14 @@ html.dark {
|
|
|
1198
1244
|
padding-top: 0.5rem;
|
|
1199
1245
|
}
|
|
1200
1246
|
|
|
1247
|
+
.maz-pr-2 {
|
|
1248
|
+
padding-right: 0.5rem;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
.maz-pl-2 {
|
|
1252
|
+
padding-left: 0.5rem;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1201
1255
|
.maz-pl-3 {
|
|
1202
1256
|
padding-left: 0.75rem;
|
|
1203
1257
|
}
|
|
@@ -1288,18 +1342,34 @@ html.dark {
|
|
|
1288
1342
|
color: var(--maz-color-primary);
|
|
1289
1343
|
}
|
|
1290
1344
|
|
|
1345
|
+
.maz-text-info-contrast {
|
|
1346
|
+
color: var(--maz-color-info-contrast);
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1291
1349
|
.maz-text-success-600 {
|
|
1292
1350
|
color: var(--maz-color-success-600);
|
|
1293
1351
|
}
|
|
1294
1352
|
|
|
1353
|
+
.maz-text-success-contrast {
|
|
1354
|
+
color: var(--maz-color-success-contrast);
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1295
1357
|
.maz-text-warning-600 {
|
|
1296
1358
|
color: var(--maz-color-warning-600);
|
|
1297
1359
|
}
|
|
1298
1360
|
|
|
1361
|
+
.maz-text-warning-contrast {
|
|
1362
|
+
color: var(--maz-color-warning-contrast);
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1299
1365
|
.maz-text-danger-600 {
|
|
1300
1366
|
color: var(--maz-color-danger-600);
|
|
1301
1367
|
}
|
|
1302
1368
|
|
|
1369
|
+
.maz-text-danger-contrast {
|
|
1370
|
+
color: var(--maz-color-danger-contrast);
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1303
1373
|
.maz-no-underline {
|
|
1304
1374
|
text-decoration: none;
|
|
1305
1375
|
}
|
|
@@ -1456,6 +1526,17 @@ html.dark {
|
|
|
1456
1526
|
}
|
|
1457
1527
|
|
|
1458
1528
|
@media (min-width: 768px) {
|
|
1529
|
+
.tab-m\:maz-absolute {
|
|
1530
|
+
position: absolute;
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
.tab-m\:maz-left-2\/4 {
|
|
1534
|
+
left: 50%;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
.tab-m\:maz-w-80 {
|
|
1538
|
+
width: 20rem;
|
|
1539
|
+
}
|
|
1459
1540
|
}
|
|
1460
1541
|
|
|
1461
1542
|
@media (min-width: 992px) {
|
package/maz-ui.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Directive, Plugin } from 'vue';
|
|
1
|
+
import { Directive, Plugin, App } from 'vue';
|
|
2
2
|
|
|
3
3
|
declare type ArgumentTypes<F extends (...args: any[]) => void> = F extends (...args: infer A) => any ? A : never;
|
|
4
4
|
declare type MethodTypes = {
|
|
@@ -8,10 +8,10 @@ declare type MethodTypes = {
|
|
|
8
8
|
declare function debounce<T extends (...args: any[]) => void>(fn: T, wait?: number, callFirst?: boolean): ((...args: ArgumentTypes<T>) => void) & MethodTypes;
|
|
9
9
|
|
|
10
10
|
declare const directive$2: Directive;
|
|
11
|
-
declare const plugin$
|
|
11
|
+
declare const plugin$4: Plugin;
|
|
12
12
|
|
|
13
13
|
declare const directive$1: Directive;
|
|
14
|
-
declare const plugin$
|
|
14
|
+
declare const plugin$3: Plugin;
|
|
15
15
|
|
|
16
16
|
interface vZoomImgOptions {
|
|
17
17
|
disabled?: boolean;
|
|
@@ -24,7 +24,7 @@ interface vZoomImgBindingOptions extends vZoomImgOptions {
|
|
|
24
24
|
}
|
|
25
25
|
declare type vZoomImgBinding = string | vZoomImgBindingOptions;
|
|
26
26
|
declare const directive: Directive;
|
|
27
|
-
declare const plugin$
|
|
27
|
+
declare const plugin$2: {
|
|
28
28
|
install(app: any): void;
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -56,7 +56,7 @@ interface vLazyImgBindingOptions extends vLazyImgOptions {
|
|
|
56
56
|
}
|
|
57
57
|
declare type vLazyImgBinding = string | vLazyImgBindingOptions;
|
|
58
58
|
|
|
59
|
-
declare const plugin: {
|
|
59
|
+
declare const plugin$1: {
|
|
60
60
|
install(app: any, opts?: vLazyImgOptions): void;
|
|
61
61
|
};
|
|
62
62
|
|
|
@@ -86,4 +86,27 @@ declare const installFilters: {
|
|
|
86
86
|
install(app: any): void;
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
declare type ToasterPositions = 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left';
|
|
90
|
+
interface ToasterOptions {
|
|
91
|
+
position?: ToasterPositions;
|
|
92
|
+
timeout?: number;
|
|
93
|
+
persistent?: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
declare class ToasterHandler {
|
|
97
|
+
private readonly app;
|
|
98
|
+
private readonly globalOptions;
|
|
99
|
+
constructor(app: App, globalOptions: ToasterOptions);
|
|
100
|
+
private show;
|
|
101
|
+
private getLocalOptions;
|
|
102
|
+
success(message: string, options?: ToasterOptions): void;
|
|
103
|
+
error(message: string, options?: ToasterOptions): void;
|
|
104
|
+
info(message: string, options?: ToasterOptions): void;
|
|
105
|
+
warning(message: string, options?: ToasterOptions): void;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declare const plugin: {
|
|
109
|
+
install(app: any, options?: ToasterOptions | undefined): void;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export { Filters, ToasterHandler, ToasterOptions, ToasterPositions, capitalize, currency, date, debounce, installDirectives, installFilters, plugin as installToaster, number, directive$2 as vClickOutside, plugin$4 as vClickOutsideInstall, directive$1 as vClosable, plugin$3 as vClosableInstall, vLazyImg, vLazyImgBinding, plugin$1 as vLazyImgInstall, vLazyImgOptions, directive as vZoomImg, vZoomImgBinding, plugin$2 as vZoomImgInstall, vZoomImgOptions };
|
package/modules/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function e(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=void 0,o=void 0,i=function(){r&&(clearTimeout(r),o=void 0,r=void 0)},a=function(){var e=o;i(),e&&e()},s=function(){for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];if(!t)return e.apply(this,[s]);var c=this,l=n&&!r;return i(),o=function(){e.apply(c,[s])},r=setTimeout((function(){if(r=void 0,!l){var e=o;if(o=void 0,void 0!==e)return e()}}),t),l?o():void 0};return s.cancel=i,s.flush=a,s}var t="__vue_click_away__",n=function(){return null!==document.ontouchstart?"click":"touchstart"},r=function(e,r){o(e);var i=r.instance,a=r.value,s=!1;setTimeout((function(){s=!0}),0),e[t]=function(t){if((!e||!e.contains(t.target))&&a&&s&&"function"==typeof a)return a.call(i,t)};var u=n();document.addEventListener(u,e[t],!1)},o=function(e){var r=n();document.removeEventListener(r,e[t],!1),delete e[t]},i={mounted:r,updated:function(e,t){t.value!==t.oldValue&&r(e,t)},unmounted:o},a={install:function(e){e.directive("click-outside",i)}};function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var c=function(e,t,n,r){e.stopPropagation();var o=n.value,i=o.handler,a=o.exclude,u=!1;if(a&&a.length>0){var c,l=s(a);try{for(l.s();!(c=l.n()).done;){var d=c.value;if(!u)u=r.context.$refs[d].contains(e.target)}}catch(e){l.e(e)}finally{l.f()}}t.contains(e.target)||u||r.context[i]()},l=function(){return null!==document.ontouchstart?"click":"touchstart"},d={mounted:function(e,t,n){var r=l();document.addEventListener(r,(function(r){return c(r,e,t,n)}))},unmounted:function(e,t,n){var r=l();document.removeEventListener(r,(function(r){return c(r,e,t,n)}))}},h={install:function(e){e.directive("closable",d)}};function m(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var f={exports:{}};!function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(f);var v,p=m(f.exports),g={exports:{}};(v=g).exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},v.exports.__esModule=!0,v.exports.default=v.exports;var y=m(g.exports),b={exports:{}};!function(e){function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports}(b);var w,x=m(b.exports),z={close:'<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>',next:'<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>',previous:'<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>',spinner:'<svg width="40px" height="40px" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor" x="0px" y="0px" viewBox="0 0 50 50" xml:space="preserve" class="maz-zoom-img__loader__svg" data-v-6d1cb50c=""><path d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"></path></svg>'},k=function(){function e(t){if(y(this,e),this.defaultOptions={scale:!0,blur:!0,disabled:!1},!t.value)throw new Error('[MazUI](img-preview) Image path must be defined. Ex: `v-zoom-img="<PATH_TO_IMAGE>"`');if("object"===p(t.value)&&!t.value.src)throw new Error("[MazUI](img-preview) src of image must be provided");this.buttonsAdded=!1,this.options=this.buildOptions(t),this.keydownHandler=this.keydownLister.bind(this),this.loader=this.getLoader(),this.wrapper=document.createElement("div"),this.wrapper.classList.add("maz-zoom-img__wrapper"),this.wrapper.prepend(this.loader),this.img=document.createElement("img"),this.onImgLoadedCallback=this.onImgLoaded.bind(this),this.imgEventHandler(!0)}return x(e,[{key:"buildOptions",value:function(e){return Object.assign(Object.assign({},this.defaultOptions),"object"===p(e.value)?e.value:{src:e.value})}},{key:"allInstances",get:function(){return Array.from(document.querySelectorAll(".maz-zoom-img-instance"))}},{key:"create",value:function(e){var t=this;this.options.disabled||(e.style.cursor="pointer",setTimeout((function(){return e.classList.add("maz-zoom-img-instance")})),e.setAttribute("data-src",this.options.src),this.options.alt&&e.setAttribute("data-alt",this.options.alt),e.style.transition="all 300ms ease-in-out",e.addEventListener("mouseenter",(function(){return t.mouseEnter(e)})),e.addEventListener("mouseleave",(function(){return t.mouseLeave(e)})),e.addEventListener("click",(function(){return t.renderPreview(e,t.options)})))}},{key:"update",value:function(e){this.options=this.buildOptions(e)}},{key:"remove",value:function(e){var t=this;this.imgEventHandler(!1),e.removeEventListener("click",(function(){return t.renderPreview(e)})),e.removeEventListener("mouseenter",(function(){return t.mouseEnter(e)})),e.removeEventListener("mouseleave",(function(){return t.mouseLeave(e)})),e.classList.remove("maz-zoom-img-instance"),e.removeAttribute("data-src"),e.removeAttribute("data-alt"),e.style.cursor=""}},{key:"renderPreview",value:function(e,t){var n=this;e.classList.add("maz-is-open"),this.addStyle("\n.maz-zoom-img {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 2.5rem;\n z-index: 1050;\n background-color: rgba(86, 87, 117, .7);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n}\n\n.maz-zoom-img,\n.maz-zoom-img * {\n box-sizing: border-box;\n}\n\n.maz-zoom-img .maz-zoom-img__wrapper {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n min-width: 0;\n min-height: 0;\n max-width: 100%;\n max-height: 100%;\n transition: all 300ms ease-in-out;\n opacity: 0;\n transform: scale(0.5);\n}\n\n.maz-zoom-img.maz-animate .maz-zoom-img__wrapper {\n opacity: 1;\n transform: scale(1);\n}\n\n.maz-zoom-img.maz-animate .maz-zoom-img__loader {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgba(86, 87, 117, .7);\n border-radius: 1rem;\n z-index: 2;\n min-width: 60px;\n min-height: 60px;\n}\n.maz-zoom-img.maz-animate .maz-zoom-img__loader[hidden] {\n display: none;\n}\n\n@-webkit-keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n}\n\n@keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n}\n\n.maz-zoom-img.maz-animate .maz-zoom-img__loader__svg {\n animation: spin .6s linear infinite;\n}\n\n.maz-zoom-img img {\n max-width: 100%;\n max-height: 100%;\n min-width: 0;\n border-radius: 1rem;\n}\n\n.maz-zoom-img .maz-zoom-btn {\n margin: 0 auto;\n border: none;\n background-color: rgba(17, 17, 17, 0.5);\n box-shadow: 0 0 0.5rem 0 rgba(0, 0, 0, 0.2);\n height: 2.2rem;\n min-height: 2.2rem;\n width: 2.2rem;\n min-width: 2.2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 2.2rem;\n cursor: pointer;\n flex: 0 0 auto;\n outline: none;\n}\n\n.maz-zoom-img .maz-zoom-btn svg {\n fill: white;\n}\n\n.maz-zoom-img .maz-zoom-btn.maz-zoom-btn--close {\n position: absolute;\n top: 0.5rem;\n right: 0.5rem;\n z-index: 1;\n}\n\n.maz-zoom-img .maz-zoom-btn.maz-zoom-btn--previous {\n position: absolute;\n left: 0.5rem;\n z-index: 1;\n}\n\n.maz-zoom-img .maz-zoom-btn.maz-zoom-btn--next {\n position: absolute;\n right: 0.5rem;\n z-index: 1;\n}\n\n.maz-zoom-img .maz-zoom-btn:hover {\n background-color: black;\n}");var r=document.createElement("div");r.classList.add("maz-zoom-img"),r.setAttribute("id","MazImgPreviewFullsize"),r.addEventListener("click",(function(e){r.isEqualNode(e.target)&&n.closePreview()})),"object"===p(t)&&(this.img.setAttribute("src",t.src),t.alt&&this.img.setAttribute("alt",t.alt),this.img.id="MazImgElement"),this.wrapper.append(this.img),r.append(this.wrapper),document.body.appendChild(r),this.keyboardEventHandler(!0),setTimeout((function(){r&&r.classList.add("maz-animate")}),100)}},{key:"onImgLoaded",value:function(){this.wrapper.style.width="".concat(this.img.width,"px"),this.wrapper.style.minWidth="200px",this.loader.hidden=!0;var e=this.getButton(),t=[],n=this.allInstances.length>1;if(!this.buttonsAdded){if(this.buttonsAdded=!0,n){var r=this.getButton("previous"),o=this.getButton("next");t.push(r,o)}this.wrapper.append(e),n&&(this.wrapper.prepend(t[0]),this.wrapper.append(t[1]))}}},{key:"getLoader",value:function(){var e=document.createElement("div");return e.classList.add("maz-zoom-img__loader"),e.innerHTML=z.spinner,e}},{key:"mouseLeave",value:function(e){this.options.scale&&(e.style.transform=""),this.options.blur&&(e.style.filter=""),e.style.zIndex=""}},{key:"mouseEnter",value:function(e){e.style.zIndex="1",this.options.scale&&(e.style.transform="scale(1.1)"),this.options.blur&&(e.style.filter="blur(2px)")}},{key:"keydownLister",value:function(e){e.preventDefault(),"Escape"!==e.key&&" "!==e.key||this.closePreview(),"ArrowLeft"!==e.key&&"ArrowRight"!==e.key||this.nextPreviousImage("ArrowRight"===e.key)}},{key:"getButton",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"close",n=document.createElement("button");return n.innerHTML=z[t],n.onclick=function(){"close"===t?e.closePreview():e.allInstances&&e.nextPreviousImage("next"===t)},n.classList.add("maz-zoom-btn"),n.classList.add("maz-zoom-btn--".concat(t)),n}},{key:"closePreview",value:function(){var e=document.querySelector("#MazImgPreviewFullsize"),t=document.querySelector("#MazPreviewStyle"),n=document.querySelector(".maz-zoom-img-instance.maz-is-open");n&&n.classList.remove("maz-is-open"),e&&e.classList.remove("maz-animate"),this.keyboardEventHandler(!1),setTimeout((function(){e&&e.remove(),t&&t.remove()}),300)}},{key:"nextPreviousImage",value:function(e){var t=this,n=e,r=document.querySelector(".maz-zoom-img-instance.maz-is-open"),o=this.allInstances.findIndex((function(e){return e===r})),i=n?o+1:o-1,a=this.allInstances[i<0?t.allInstances.length-1:i>=t.allInstances.length?0:i];if(a&&r){r.classList.remove("maz-is-open"),a.classList.add("maz-is-open");var s=a.getAttribute("data-src"),u=a.getAttribute("data-alt");this.wrapper.style.width="",this.loader.hidden=!1,s&&this.img.setAttribute("src",s),u&&this.img.setAttribute("alt",u)}}},{key:"addStyle",value:function(e){var t=document.createElement("style");t.id="MazPreviewStyle",t.textContent=e,document.head.append(t)}},{key:"keyboardEventHandler",value:function(e){if(e)return document.addEventListener("keydown",this.keydownHandler);document.removeEventListener("keydown",this.keydownHandler)}},{key:"imgEventHandler",value:function(e){if(e)return this.img.addEventListener("load",this.onImgLoadedCallback);this.img.removeEventListener("load",this.onImgLoadedCallback)}}]),e}(),E={created:function(e,t){(w=new k(t)).create(e)},updated:function(e,t){w.update(t)},unmounted:function(e){w.remove(e)}},L={install:function(e){e.directive("zoom-img",E)}},I={exports:{}};!function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o=t&&t.prototype instanceof p?t:p,i=Object.create(o.prototype),a=new O(r||[]);return i._invoke=function(e,t,n){var r=d;return function(o,i){if(r===m)throw new Error("Generator is already running");if(r===f){if("throw"===o)throw i;return _()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=L(a,n);if(s){if(s===v)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=m;var u=l(e,t,n);if("normal"===u.type){if(r=n.done?f:h,u.arg===v)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=f,n.method="throw",n.arg=u.arg)}}}(e,n,a),i}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d="suspendedStart",h="suspendedYield",m="executing",f="completed",v={};function p(){}function g(){}function y(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,x=w&&w(w(C([])));x&&x!==n&&r.call(x,i)&&(b=x);var z=y.prototype=p.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(o,i,a,s){var u=l(e[o],e,i);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(d).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var o;this._invoke=function(e,r){function i(){return new t((function(t,o){n(e,r,t,o)}))}return o=o?o.then(i,i):i()}}function L(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,L(e,n),"throw"===n.method))return v;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=l(r,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var i=o.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function C(e){if(e){var n=e[i];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}return{next:_}}function _(){return{value:t,done:!0}}return g.prototype=y,u(z,"constructor",y),u(y,"constructor",g),g.displayName=u(y,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,u(e,s,"GeneratorFunction")),e.prototype=Object.create(z),e},e.awrap=function(e){return{__await:e}},k(E.prototype),u(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new E(c(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(z),u(z,s,"Generator"),u(z,i,(function(){return this})),u(z,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=C,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;A(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(I);var A=I.exports;
|
|
1
|
+
import{createVNode as t,render as e,inject as n,defineComponent as r,ref as o,computed as a,onMounted as i,watch as s,openBlock as c,createElementBlock as l,mergeProps as u,createCommentVNode as d,nextTick as m,createBlock as f,Transition as v,unref as h,withCtx as p,withDirectives as g,createElementVNode as b,normalizeClass as y,toDisplayString as w,vShow as x}from"vue";function k(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=void 0,o=void 0,a=function(){r&&(clearTimeout(r),o=void 0,r=void 0)},i=function(){var t=o;a(),t&&t()},s=function(){for(var i=arguments.length,s=new Array(i),c=0;c<i;c++)s[c]=arguments[c];if(!e)return t.apply(this,[s]);var l=this,u=n&&!r;return a(),o=function(){t.apply(l,[s])},r=setTimeout((function(){if(r=void 0,!u){var t=o;if(o=void 0,void 0!==t)return t()}}),e),u?o():void 0};return s.cancel=a,s.flush=i,s}var z="__vue_click_away__",E=function(){return null!==document.ontouchstart?"click":"touchstart"},L=function(t,e){I(t);var n=e.instance,r=e.value,o=!1;setTimeout((function(){o=!0}),0),t[z]=function(e){if((!t||!t.contains(e.target))&&r&&o&&"function"==typeof r)return r.call(n,e)};var a=E();document.addEventListener(a,t[z],!1)},I=function(t){var e=E();document.removeEventListener(e,t[z],!1),delete t[z]},O={mounted:L,updated:function(t,e){e.value!==e.oldValue&&L(t,e)},unmounted:I},A={install:function(t){t.directive("click-outside",O)}};function C(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return S(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){s=!0,a=t},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw a}}}}function S(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var _=function(t,e,n,r){t.stopPropagation();var o=n.value,a=o.handler,i=o.exclude,s=!1;if(i&&i.length>0){var c,l=C(i);try{for(l.s();!(c=l.n()).done;){var u=c.value;if(!s)s=r.context.$refs[u].contains(t.target)}}catch(t){l.e(t)}finally{l.f()}}e.contains(t.target)||s||r.context[a]()},T=function(){return null!==document.ontouchstart?"click":"touchstart"},j={mounted:function(t,e,n){var r=T();document.addEventListener(r,(function(r){return _(r,t,e,n)}))},unmounted:function(t,e,n){var r=T();document.removeEventListener(r,(function(r){return _(r,t,e,n)}))}},P={install:function(t){t.directive("closable",j)}};function M(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var H={exports:{}};!function(t){function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports}(H);var F,N=M(H.exports),B={exports:{}};(F=B).exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},F.exports.__esModule=!0,F.exports.default=F.exports;var D=M(B.exports),q={exports:{}};!function(t){function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports}(q);var U,G=M(q.exports),Y={close:'<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>',next:'<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>',previous:'<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>',spinner:'<svg width="40px" height="40px" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor" x="0px" y="0px" viewBox="0 0 50 50" xml:space="preserve" class="maz-zoom-img__loader__svg" data-v-6d1cb50c=""><path d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"></path></svg>'},X=function(){function t(e){if(D(this,t),this.defaultOptions={scale:!0,blur:!0,disabled:!1},!e.value)throw new Error('[MazUI](zoom-img) Image path must be defined. Ex: `v-zoom-img="<PATH_TO_IMAGE>"`');if("object"===N(e.value)&&!e.value.src)throw new Error("[MazUI](zoom-img) src of image must be provided");this.buttonsAdded=!1,this.options=this.buildOptions(e),this.keydownHandler=this.keydownLister.bind(this),this.loader=this.getLoader(),this.wrapper=document.createElement("div"),this.wrapper.classList.add("maz-zoom-img__wrapper"),this.wrapper.prepend(this.loader),this.img=document.createElement("img"),this.onImgLoadedCallback=this.onImgLoaded.bind(this),this.imgEventHandler(!0)}return G(t,[{key:"buildOptions",value:function(t){return Object.assign(Object.assign({},this.defaultOptions),"object"===N(t.value)?t.value:{src:t.value})}},{key:"allInstances",get:function(){return Array.from(document.querySelectorAll(".maz-zoom-img-instance"))}},{key:"create",value:function(t){var e=this;this.options.disabled||(t.style.cursor="pointer",setTimeout((function(){return t.classList.add("maz-zoom-img-instance")})),t.setAttribute("data-src",this.options.src),this.options.alt&&t.setAttribute("data-alt",this.options.alt),t.style.transition="all 300ms ease-in-out",t.addEventListener("mouseenter",(function(){return e.mouseEnter(t)})),t.addEventListener("mouseleave",(function(){return e.mouseLeave(t)})),t.addEventListener("click",(function(){return e.renderPreview(t,e.options)})))}},{key:"update",value:function(t){this.options=this.buildOptions(t)}},{key:"remove",value:function(t){var e=this;this.imgEventHandler(!1),t.removeEventListener("click",(function(){return e.renderPreview(t)})),t.removeEventListener("mouseenter",(function(){return e.mouseEnter(t)})),t.removeEventListener("mouseleave",(function(){return e.mouseLeave(t)})),t.classList.remove("maz-zoom-img-instance"),t.removeAttribute("data-src"),t.removeAttribute("data-alt"),t.style.cursor=""}},{key:"renderPreview",value:function(t,e){var n=this;t.classList.add("maz-is-open"),this.addStyle("\n.maz-zoom-img {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 2.5rem;\n z-index: 1050;\n background-color: rgba(86, 87, 117, .7);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n}\n\n.maz-zoom-img,\n.maz-zoom-img * {\n box-sizing: border-box;\n}\n\n.maz-zoom-img .maz-zoom-img__wrapper {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n min-width: 0;\n min-height: 0;\n max-width: 100%;\n max-height: 100%;\n transition: all 300ms ease-in-out;\n opacity: 0;\n transform: scale(0.5);\n}\n\n.maz-zoom-img.maz-animate .maz-zoom-img__wrapper {\n opacity: 1;\n transform: scale(1);\n}\n\n.maz-zoom-img.maz-animate .maz-zoom-img__loader {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgba(86, 87, 117, .7);\n border-radius: 1rem;\n z-index: 2;\n min-width: 60px;\n min-height: 60px;\n}\n.maz-zoom-img.maz-animate .maz-zoom-img__loader[hidden] {\n display: none;\n}\n\n@-webkit-keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n}\n\n@keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n}\n\n.maz-zoom-img.maz-animate .maz-zoom-img__loader__svg {\n animation: spin .6s linear infinite;\n}\n\n.maz-zoom-img img {\n max-width: 100%;\n max-height: 100%;\n min-width: 0;\n border-radius: 1rem;\n}\n\n.maz-zoom-img .maz-zoom-btn {\n margin: 0 auto;\n border: none;\n background-color: rgba(17, 17, 17, 0.5);\n box-shadow: 0 0 0.5rem 0 rgba(0, 0, 0, 0.2);\n height: 2.2rem;\n min-height: 2.2rem;\n width: 2.2rem;\n min-width: 2.2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 2.2rem;\n cursor: pointer;\n flex: 0 0 auto;\n outline: none;\n}\n\n.maz-zoom-img .maz-zoom-btn svg {\n fill: white;\n}\n\n.maz-zoom-img .maz-zoom-btn.maz-zoom-btn--close {\n position: absolute;\n top: 0.5rem;\n right: 0.5rem;\n z-index: 1;\n}\n\n.maz-zoom-img .maz-zoom-btn.maz-zoom-btn--previous {\n position: absolute;\n left: 0.5rem;\n z-index: 1;\n}\n\n.maz-zoom-img .maz-zoom-btn.maz-zoom-btn--next {\n position: absolute;\n right: 0.5rem;\n z-index: 1;\n}\n\n.maz-zoom-img .maz-zoom-btn:hover {\n background-color: black;\n}");var r=document.createElement("div");r.classList.add("maz-zoom-img"),r.setAttribute("id","MazImgPreviewFullsize"),r.addEventListener("click",(function(t){r.isEqualNode(t.target)&&n.closePreview()})),"object"===N(e)&&(this.img.setAttribute("src",e.src),e.alt&&this.img.setAttribute("alt",e.alt),this.img.id="MazImgElement"),this.wrapper.append(this.img),r.append(this.wrapper),document.body.appendChild(r),this.keyboardEventHandler(!0),setTimeout((function(){r&&r.classList.add("maz-animate")}),100)}},{key:"onImgLoaded",value:function(){this.wrapper.style.width="".concat(this.img.width,"px"),this.wrapper.style.minWidth="200px",this.loader.hidden=!0;var t=this.getButton(),e=[],n=this.allInstances.length>1;if(!this.buttonsAdded){if(this.buttonsAdded=!0,n){var r=this.getButton("previous"),o=this.getButton("next");e.push(r,o)}this.wrapper.append(t),n&&(this.wrapper.prepend(e[0]),this.wrapper.append(e[1]))}}},{key:"getLoader",value:function(){var t=document.createElement("div");return t.classList.add("maz-zoom-img__loader"),t.innerHTML=Y.spinner,t}},{key:"mouseLeave",value:function(t){this.options.scale&&(t.style.transform=""),this.options.blur&&(t.style.filter=""),t.style.zIndex=""}},{key:"mouseEnter",value:function(t){t.style.zIndex="1",this.options.scale&&(t.style.transform="scale(1.1)"),this.options.blur&&(t.style.filter="blur(2px)")}},{key:"keydownLister",value:function(t){t.preventDefault(),"Escape"!==t.key&&" "!==t.key||this.closePreview(),"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||this.nextPreviousImage("ArrowRight"===t.key)}},{key:"getButton",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"close",n=document.createElement("button");return n.innerHTML=Y[e],n.onclick=function(){"close"===e?t.closePreview():t.allInstances&&t.nextPreviousImage("next"===e)},n.classList.add("maz-zoom-btn"),n.classList.add("maz-zoom-btn--".concat(e)),n}},{key:"closePreview",value:function(){var t=document.querySelector("#MazImgPreviewFullsize"),e=document.querySelector("#MazPreviewStyle"),n=document.querySelector(".maz-zoom-img-instance.maz-is-open");n&&n.classList.remove("maz-is-open"),t&&t.classList.remove("maz-animate"),this.keyboardEventHandler(!1),setTimeout((function(){t&&t.remove(),e&&e.remove()}),300)}},{key:"nextPreviousImage",value:function(t){var e=this,n=t,r=document.querySelector(".maz-zoom-img-instance.maz-is-open"),o=this.allInstances.findIndex((function(t){return t===r})),a=n?o+1:o-1,i=this.allInstances[a<0?e.allInstances.length-1:a>=e.allInstances.length?0:a];if(i&&r){r.classList.remove("maz-is-open"),i.classList.add("maz-is-open");var s=i.getAttribute("data-src"),c=i.getAttribute("data-alt");this.wrapper.style.width="",this.loader.hidden=!1,s&&this.img.setAttribute("src",s),c&&this.img.setAttribute("alt",c)}}},{key:"addStyle",value:function(t){var e=document.createElement("style");e.id="MazPreviewStyle",e.textContent=t,document.head.append(e)}},{key:"keyboardEventHandler",value:function(t){if(t)return document.addEventListener("keydown",this.keydownHandler);document.removeEventListener("keydown",this.keydownHandler)}},{key:"imgEventHandler",value:function(t){if(t)return this.img.addEventListener("load",this.onImgLoadedCallback);this.img.removeEventListener("load",this.onImgLoadedCallback)}}]),t}(),R={created:function(t,e){(U=new X(e)).create(t)},updated:function(t,e){U.update(e)},unmounted:function(t){U.remove(t)}},$={install:function(t){t.directive("zoom-img",R)}},V={exports:{}};!function(t){var e=function(t){var e,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof p?e:p,a=Object.create(o.prototype),i=new A(r||[]);return a._invoke=function(t,e,n){var r=d;return function(o,a){if(r===f)throw new Error("Generator is already running");if(r===v){if("throw"===o)throw a;return S()}for(n.method=o,n.arg=a;;){var i=n.delegate;if(i){var s=L(i,n);if(s){if(s===h)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=f;var c=u(t,e,n);if("normal"===c.type){if(r=n.done?v:m,c.arg===h)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=v,n.method="throw",n.arg=c.arg)}}}(t,n,i),a}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var d="suspendedStart",m="suspendedYield",f="executing",v="completed",h={};function p(){}function g(){}function b(){}var y={};c(y,a,(function(){return this}));var w=Object.getPrototypeOf,x=w&&w(w(C([])));x&&x!==n&&r.call(x,a)&&(y=x);var k=b.prototype=p.prototype=Object.create(y);function z(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(o,a,i,s){var c=u(t[o],t,a);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==typeof d&&r.call(d,"__await")?e.resolve(d.__await).then((function(t){n("next",t,i,s)}),(function(t){n("throw",t,i,s)})):e.resolve(d).then((function(t){l.value=t,i(l)}),(function(t){return n("throw",t,i,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function a(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(a,a):a()}}function L(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,L(t,n),"throw"===n.method))return h;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var o=u(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,h;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,h):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function C(t){if(t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}return{next:S}}function S(){return{value:e,done:!0}}return g.prototype=b,c(k,"constructor",b),c(b,"constructor",g),g.displayName=c(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,s,"GeneratorFunction")),t.prototype=Object.create(k),t},t.awrap=function(t){return{__await:t}},z(E.prototype),c(E.prototype,i,(function(){return this})),t.AsyncIterator=E,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new E(l(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},z(k),c(k,s,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=C,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return s.type="throw",s.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(c&&l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:C(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),h}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(V);var Z=V.exports;
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -12,5 +12,5 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */function O(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function C(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=C(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}function P(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return j(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return j(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var S,T={baseClass:"m-lazy-img",loadedClass:"m-lazy-loaded",loadingClass:"m-lazy-loading",errorClass:"m-lazy-error",noPhotoClass:"m-lazy-no-photo",noPhoto:!1,observerOnce:!0,loadOnce:!1,noUseErrorPhoto:!1,observerOptions:{threshold:.1}},M=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};y(this,e),this.observers=[],this.defaultOptions=T,this.hasImgLoaded=!1,this.options=this.buildOptions(t),this.onImgLoadedCallback=this.imageIsLoaded.bind(this),this.onImgErrorCallback=this.imageHasError.bind(this)}return x(e,[{key:"loadErrorPhoto",value:function(){return O(this,void 0,void 0,A.mark((function e(){return A.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,import("./no_photo-a72545e4.js");case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})))}},{key:"buildOptions",value:function(e){return Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{observerOptions:Object.assign(Object.assign({},this.defaultOptions.observerOptions),e.observerOptions)})}},{key:"removeClass",value:function(e,t){e.classList.remove(t)}},{key:"addClass",value:function(e,t){e.classList.add(t)}},{key:"removeAllStateClasses",value:function(e){this.removeClass(e,this.options.loadedClass),this.removeClass(e,this.options.loadingClass),this.removeClass(e,this.options.errorClass),this.removeClass(e,this.options.noPhotoClass)}},{key:"setBaseClass",value:function(e){this.addClass(e,this.options.baseClass)}},{key:"imageIsLoading",value:function(e){var t,n;this.addClass(e,this.options.loadingClass),null===(n=(t=this.options).onLoading)||void 0===n||n.call(t,e)}},{key:"imageHasNoPhoto",value:function(e){this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.noPhotoClass),this.setDefaultPhoto(e)}},{key:"imageIsLoaded",value:function(e){var t,n;this.hasImgLoaded=!0,this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.loadedClass),null===(n=(t=this.options).onLoaded)||void 0===n||n.call(t,e)}},{key:"imageHasError",value:function(e,t){var n,r;console.warn("[MazLazyImg] Error while loading image",t),this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.errorClass),null===(r=(n=this.options).onError)||void 0===r||r.call(n,e),this.setDefaultPhoto(e)}},{key:"getImageUrl",value:function(e,t){var n=this.getImgElement(e).getAttribute("data-src");if(n)return n;var r="object"===p(t.value)?t.value.src:t.value;return r||console.warn("[MazLazyImg] src url is not defined"),r}},{key:"setPictureSourceUrls",value:function(e){var t,n;return O(this,void 0,void 0,A.mark((function r(){var o,i,a,s,u;return A.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!((o=e.querySelectorAll("source")).length>0)){r.next=30;break}r.prev=2,i=_(o);case 4:return r.next=6,i.next();case 6:if((a=r.sent).done){r.next=13;break}s=a.value,(u=s.getAttribute("data-srcset"))?s.srcset=u:console.warn('[MazLazyImg] the "[data-srcset]" attribute is not provided on "<source />"');case 11:r.next=4;break;case 13:r.next=18;break;case 15:r.prev=15,r.t0=r.catch(2),t={error:r.t0};case 18:if(r.prev=18,r.prev=19,!a||a.done||!(n=i.return)){r.next=23;break}return r.next=23,n.call(i);case 23:if(r.prev=23,!t){r.next=26;break}throw t.error;case 26:return r.finish(23);case 27:return r.finish(18);case 28:r.next=32;break;case 30:console.warn('[MazLazyImg] No "<source />" elements provided into the "<picture />" element'),this.imageHasError(e);case 32:case"end":return r.stop()}}),r,this,[[2,15,18,28],[19,,23,27]])})))}},{key:"hasBgImgMode",value:function(e){return"bg-image"===e.arg}},{key:"isPictureElement",value:function(e){return e instanceof HTMLPictureElement}},{key:"getImgElement",value:function(e){return this.isPictureElement(e)?e.querySelector("img"):e}},{key:"setDefaultPhoto",value:function(e){var t,n;return O(this,void 0,void 0,A.mark((function r(){var o,i,a,s;return A.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this.options.noUseErrorPhoto){r.next=2;break}return r.abrupt("return");case 2:if(!this.options.errorPhoto){r.next=6;break}r.t0=this.options.errorPhoto,r.next=9;break;case 6:return r.next=8,this.loadErrorPhoto();case 8:r.t0=r.sent;case 9:if(o=r.t0,!((i=e.querySelectorAll("source")).length>0)){r.next=39;break}r.prev=12,a=_(i);case 14:return r.next=16,a.next();case 16:if((s=r.sent).done){r.next=22;break}s.value.srcset=o;case 20:r.next=14;break;case 22:r.next=27;break;case 24:r.prev=24,r.t1=r.catch(12),t={error:r.t1};case 27:if(r.prev=27,r.prev=28,!s||s.done||!(n=a.return)){r.next=32;break}return r.next=32,n.call(a);case 32:if(r.prev=32,!t){r.next=35;break}throw t.error;case 35:return r.finish(32);case 36:return r.finish(27);case 37:r.next=40;break;case 39:this.setImgSrc(e,o);case 40:case"end":return r.stop()}}),r,this,[[12,24,27,37],[28,,32,36]])})))}},{key:"addEventListenerToImg",value:function(e){var t=this,n=this.getImgElement(e);n.addEventListener("load",(function(){return t.onImgLoadedCallback(e)}),{once:!0}),n.addEventListener("error",(function(n){return t.onImgErrorCallback(e,n)}),{once:!0})}},{key:"loadImage",value:function(e,t){return O(this,void 0,void 0,A.mark((function n(){var r;return A.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.imageIsLoading(e),!this.isPictureElement(e)){n.next=7;break}return this.addEventListenerToImg(e),n.next=5,this.setPictureSourceUrls(e);case 5:n.next=11;break;case 7:if(r=this.getImageUrl(e,t)){n.next=10;break}return n.abrupt("return",this.imageHasError(e));case 10:this.hasBgImgMode(t)?(e.style.backgroundImage="url('".concat(r,"')"),this.imageIsLoaded(e)):(this.addEventListenerToImg(e),this.setImgSrc(e,r));case 11:case"end":return n.stop()}}),n,this)})))}},{key:"setImgSrc",value:function(e,t){this.getImgElement(e).src=t}},{key:"handleIntersectionObserver",value:function(e,t,n,r){var o,i;this.observers.push(r);var a,s=P(n);try{for(s.s();!(a=s.n()).done;){var u=a.value;if(u.isIntersecting){if(null===(i=(o=this.options).onIntersecting)||void 0===i||i.call(o,u.target),this.options.observerOnce&&r.unobserve(e),this.options.loadOnce&&this.hasImgLoaded)return;this.loadImage(e,t)}}}catch(e){s.e(e)}finally{s.f()}}},{key:"createObserver",value:function(e,t){var n=this,r=this.options.observerOptions;new IntersectionObserver((function(r,o){n.handleIntersectionObserver(e,t,r,o)}),r).observe(e)}},{key:"imageHandler",value:function(e,t,n){var r,o;return O(this,void 0,void 0,A.mark((function i(){var a,s;return A.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if("update"!==n){i.next=26;break}i.prev=1,a=_(this.observers);case 3:return i.next=5,a.next();case 5:if((s=i.sent).done){i.next=11;break}s.value.unobserve(e);case 9:i.next=3;break;case 11:i.next=16;break;case 13:i.prev=13,i.t0=i.catch(1),r={error:i.t0};case 16:if(i.prev=16,i.prev=17,!s||s.done||!(o=a.return)){i.next=21;break}return i.next=21,o.call(a);case 21:if(i.prev=21,!r){i.next=24;break}throw r.error;case 24:return i.finish(21);case 25:return i.finish(16);case 26:window.IntersectionObserver?this.createObserver(e,t):this.loadImage(e,t);case 27:case"end":return i.stop()}}),i,this,[[1,13,16,26],[17,,21,25]])})))}},{key:"bindUpdateHandler",value:function(e,t,n){return O(this,void 0,void 0,A.mark((function r(){return A.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this.options.noPhoto){r.next=2;break}return r.abrupt("return",this.imageHasNoPhoto(e));case 2:return r.next=4,this.imageHandler(e,t,n);case 4:case"end":return r.stop()}}),r,this)})))}},{key:"add",value:function(e,t){return O(this,void 0,void 0,A.mark((function n(){var r=this;return A.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!this.hasBgImgMode(t)||!this.isPictureElement(e)){n.next=2;break}throw new Error('[MazLazyImg] You can\'t use the "bg-image" mode with "<picture />" element');case 2:return setTimeout((function(){return r.setBaseClass(e)}),0),e.getAttribute("src")||this.setImgSrc(e,"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"),n.next=6,this.bindUpdateHandler(e,t,"bind");case 6:case"end":return n.stop()}}),n,this)})))}},{key:"update",value:function(e,t){return O(this,void 0,void 0,A.mark((function n(){return A.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t.value===t.oldValue){n.next=5;break}return this.hasImgLoaded=!1,this.removeAllStateClasses(e),n.next=5,this.bindUpdateHandler(e,t,"update");case 5:case"end":return n.stop()}}),n,this)})))}},{key:"remove",value:function(e,t){this.hasImgLoaded=!1,this.hasBgImgMode(t)&&(e.style.backgroundImage=""),this.removeAllStateClasses(e);var n,r=P(this.observers);try{for(r.s();!(n=r.n()).done;){n.value.unobserve(e)}}catch(e){r.e(e)}finally{r.f()}this.observers=[]}}]),e}(),H={created:function(e,t){var n="object"===p(t.value)?t.value:{};(S=new M(n)).add(e,t)},updated:function(e,t){S.update(e,t)},unmounted:function(e,t){S.remove(e,t)}},F={install:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object.assign(Object.assign(Object.assign({},T),t),{observerOptions:Object.assign(Object.assign({},T.observerOptions),t.observerOptions)}),r=new M(n);e.directive("lazy-img",{created:r.add.bind(r),updated:r.update.bind(r),unmounted:r.remove.bind(r)})}},N=[{name:"click-outside",directive:i},{name:"closable",directive:d},{name:"zoom-img",directive:E},{name:"lazy-img",directive:H}],B={install:function(e){N.forEach((function(t){var n=t.name,r=t.directive;e.directive(n,r)}))}},q=function(e){return e?(e=e.toString()).charAt(0).toUpperCase()+e.slice(1):""},U={style:"currency",minimumFractionDigits:2,round:!1},D=function(e,t,n){var r=Object.assign(Object.assign({},U),n);!function(e,t,n){if(void 0===e)throw new TypeError("[FilterCurrency] The `number` attribute is required.");if(void 0===t)throw new TypeError("[FilterCurrency] The `locale` attribute is required.");if("string"!=typeof t)throw new TypeError("[FilterCurrency] The `locale` attribute must be a string.");if(void 0===n.currency)throw new TypeError("[FilterCurrency] The `options.currency` attribute is required.")}(e,t,r);try{return function(e,t,n){var r=Number(e);return n.round&&(r=Math.floor(r),n.minimumFractionDigits=0),new Intl.NumberFormat(t,n).format(r)}(e,t,r)}catch(e){throw new Error("[FilterCurrency] ".concat(e))}},G={month:"short",day:"numeric",year:"numeric"},R=function(e,t,n){if(void 0===t)throw new TypeError("[FilterDate] The `locale` attribute is required.");if("string"!=typeof t)throw new TypeError("[FilterDate] The `locale` attribute must be a string.");var r=Object.assign(Object.assign({},G),n);try{return new Intl.DateTimeFormat(t,r).format(new Date(e))}catch(e){throw new Error("[FilterDate] ".concat(e))}},Y={minimumFractionDigits:2},$=function(e,t,n){if(n=Object.assign(Object.assign({},Y),n),void 0===e)throw new TypeError("[FilterNumber] The `number` attribute is required.");if(void 0===t)throw new TypeError("[FilterNumber] The `locale` attribute is required.");if("string"!=typeof t)throw new TypeError("[FilterNumber] The `locale` attribute must be a string.");try{return new Intl.NumberFormat(t,n).format(Number(e))}catch(e){throw new Error("[FilterNumber] ".concat(e))}},V={capitalize:q,currency:D,date:R,number:$},Z={install:function(e){e.provide("filters",V)}};export{q as capitalize,D as currency,R as date,e as debounce,B as installDirectives,Z as installFilters,$ as number,i as vClickOutside,a as vClickOutsideInstall,d as vClosable,h as vClosableInstall,H as vLazyImg,F as vLazyImgInstall,E as vZoomImg,L as vZoomImgInstall};
|
|
15
|
+
***************************************************************************** */function Q(t,e,n,r){return new(n||(n=Promise))((function(o,a){function i(t){try{c(r.next(t))}catch(t){a(t)}}function s(t){try{c(r.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}c((r=r.apply(t,e||[])).next())}))}function W(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function J(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=W(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,o){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,o,(e=t[n](e)).done,e.value)}))}}}function K(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return tt(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tt(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){s=!0,a=t},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw a}}}}function tt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var et,nt={baseClass:"m-lazy-img",loadedClass:"m-lazy-loaded",loadingClass:"m-lazy-loading",errorClass:"m-lazy-error",noPhotoClass:"m-lazy-no-photo",noPhoto:!1,observerOnce:!0,loadOnce:!1,noUseErrorPhoto:!1,observerOptions:{threshold:.1}},rt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};D(this,t),this.observers=[],this.defaultOptions=nt,this.hasImgLoaded=!1,this.options=this.buildOptions(e),this.onImgLoadedCallback=this.imageIsLoaded.bind(this),this.onImgErrorCallback=this.imageHasError.bind(this)}return G(t,[{key:"loadErrorPhoto",value:function(){return Q(this,void 0,void 0,Z.mark((function t(){return Z.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,import("./no_photo-a72545e4.js");case 2:return t.abrupt("return",t.sent.default);case 3:case"end":return t.stop()}}),t)})))}},{key:"buildOptions",value:function(t){return Object.assign(Object.assign(Object.assign({},this.defaultOptions),t),{observerOptions:Object.assign(Object.assign({},this.defaultOptions.observerOptions),t.observerOptions)})}},{key:"removeClass",value:function(t,e){t.classList.remove(e)}},{key:"addClass",value:function(t,e){t.classList.add(e)}},{key:"removeAllStateClasses",value:function(t){this.removeClass(t,this.options.loadedClass),this.removeClass(t,this.options.loadingClass),this.removeClass(t,this.options.errorClass),this.removeClass(t,this.options.noPhotoClass)}},{key:"setBaseClass",value:function(t){this.addClass(t,this.options.baseClass)}},{key:"imageIsLoading",value:function(t){var e,n;this.addClass(t,this.options.loadingClass),null===(n=(e=this.options).onLoading)||void 0===n||n.call(e,t)}},{key:"imageHasNoPhoto",value:function(t){this.removeClass(t,this.options.loadingClass),this.addClass(t,this.options.noPhotoClass),this.setDefaultPhoto(t)}},{key:"imageIsLoaded",value:function(t){var e,n;this.hasImgLoaded=!0,this.removeClass(t,this.options.loadingClass),this.addClass(t,this.options.loadedClass),null===(n=(e=this.options).onLoaded)||void 0===n||n.call(e,t)}},{key:"imageHasError",value:function(t,e){var n,r;console.warn("[MazLazyImg] Error while loading image",e),this.removeClass(t,this.options.loadingClass),this.addClass(t,this.options.errorClass),null===(r=(n=this.options).onError)||void 0===r||r.call(n,t),this.setDefaultPhoto(t)}},{key:"getImageUrl",value:function(t,e){var n=this.getImgElement(t).getAttribute("data-src");if(n)return n;var r="object"===N(e.value)?e.value.src:e.value;return r||console.warn("[MazLazyImg] src url is not defined"),r}},{key:"setPictureSourceUrls",value:function(t){var e,n;return Q(this,void 0,void 0,Z.mark((function r(){var o,a,i,s,c;return Z.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!((o=t.querySelectorAll("source")).length>0)){r.next=30;break}r.prev=2,a=J(o);case 4:return r.next=6,a.next();case 6:if((i=r.sent).done){r.next=13;break}s=i.value,(c=s.getAttribute("data-srcset"))?s.srcset=c:console.warn('[MazLazyImg] the "[data-srcset]" attribute is not provided on "<source />"');case 11:r.next=4;break;case 13:r.next=18;break;case 15:r.prev=15,r.t0=r.catch(2),e={error:r.t0};case 18:if(r.prev=18,r.prev=19,!i||i.done||!(n=a.return)){r.next=23;break}return r.next=23,n.call(a);case 23:if(r.prev=23,!e){r.next=26;break}throw e.error;case 26:return r.finish(23);case 27:return r.finish(18);case 28:r.next=32;break;case 30:console.warn('[MazLazyImg] No "<source />" elements provided into the "<picture />" element'),this.imageHasError(t);case 32:case"end":return r.stop()}}),r,this,[[2,15,18,28],[19,,23,27]])})))}},{key:"hasBgImgMode",value:function(t){return"bg-image"===t.arg}},{key:"isPictureElement",value:function(t){return t instanceof HTMLPictureElement}},{key:"getImgElement",value:function(t){return this.isPictureElement(t)?t.querySelector("img"):t}},{key:"setDefaultPhoto",value:function(t){var e,n;return Q(this,void 0,void 0,Z.mark((function r(){var o,a,i,s;return Z.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this.options.noUseErrorPhoto){r.next=2;break}return r.abrupt("return");case 2:if(!this.options.errorPhoto){r.next=6;break}r.t0=this.options.errorPhoto,r.next=9;break;case 6:return r.next=8,this.loadErrorPhoto();case 8:r.t0=r.sent;case 9:if(o=r.t0,!((a=t.querySelectorAll("source")).length>0)){r.next=39;break}r.prev=12,i=J(a);case 14:return r.next=16,i.next();case 16:if((s=r.sent).done){r.next=22;break}s.value.srcset=o;case 20:r.next=14;break;case 22:r.next=27;break;case 24:r.prev=24,r.t1=r.catch(12),e={error:r.t1};case 27:if(r.prev=27,r.prev=28,!s||s.done||!(n=i.return)){r.next=32;break}return r.next=32,n.call(i);case 32:if(r.prev=32,!e){r.next=35;break}throw e.error;case 35:return r.finish(32);case 36:return r.finish(27);case 37:r.next=40;break;case 39:this.setImgSrc(t,o);case 40:case"end":return r.stop()}}),r,this,[[12,24,27,37],[28,,32,36]])})))}},{key:"addEventListenerToImg",value:function(t){var e=this,n=this.getImgElement(t);n.addEventListener("load",(function(){return e.onImgLoadedCallback(t)}),{once:!0}),n.addEventListener("error",(function(n){return e.onImgErrorCallback(t,n)}),{once:!0})}},{key:"loadImage",value:function(t,e){return Q(this,void 0,void 0,Z.mark((function n(){var r;return Z.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.imageIsLoading(t),!this.isPictureElement(t)){n.next=7;break}return this.addEventListenerToImg(t),n.next=5,this.setPictureSourceUrls(t);case 5:n.next=11;break;case 7:if(r=this.getImageUrl(t,e)){n.next=10;break}return n.abrupt("return",this.imageHasError(t));case 10:this.hasBgImgMode(e)?(t.style.backgroundImage="url('".concat(r,"')"),this.imageIsLoaded(t)):(this.addEventListenerToImg(t),this.setImgSrc(t,r));case 11:case"end":return n.stop()}}),n,this)})))}},{key:"setImgSrc",value:function(t,e){this.getImgElement(t).src=e}},{key:"handleIntersectionObserver",value:function(t,e,n,r){var o,a;this.observers.push(r);var i,s=K(n);try{for(s.s();!(i=s.n()).done;){var c=i.value;if(c.isIntersecting){if(null===(a=(o=this.options).onIntersecting)||void 0===a||a.call(o,c.target),this.options.observerOnce&&r.unobserve(t),this.options.loadOnce&&this.hasImgLoaded)return;this.loadImage(t,e)}}}catch(t){s.e(t)}finally{s.f()}}},{key:"createObserver",value:function(t,e){var n=this,r=this.options.observerOptions;new IntersectionObserver((function(r,o){n.handleIntersectionObserver(t,e,r,o)}),r).observe(t)}},{key:"imageHandler",value:function(t,e,n){var r,o;return Q(this,void 0,void 0,Z.mark((function a(){var i,s;return Z.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if("update"!==n){a.next=26;break}a.prev=1,i=J(this.observers);case 3:return a.next=5,i.next();case 5:if((s=a.sent).done){a.next=11;break}s.value.unobserve(t);case 9:a.next=3;break;case 11:a.next=16;break;case 13:a.prev=13,a.t0=a.catch(1),r={error:a.t0};case 16:if(a.prev=16,a.prev=17,!s||s.done||!(o=i.return)){a.next=21;break}return a.next=21,o.call(i);case 21:if(a.prev=21,!r){a.next=24;break}throw r.error;case 24:return a.finish(21);case 25:return a.finish(16);case 26:window.IntersectionObserver?this.createObserver(t,e):this.loadImage(t,e);case 27:case"end":return a.stop()}}),a,this,[[1,13,16,26],[17,,21,25]])})))}},{key:"bindUpdateHandler",value:function(t,e,n){return Q(this,void 0,void 0,Z.mark((function r(){return Z.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this.options.noPhoto){r.next=2;break}return r.abrupt("return",this.imageHasNoPhoto(t));case 2:return r.next=4,this.imageHandler(t,e,n);case 4:case"end":return r.stop()}}),r,this)})))}},{key:"add",value:function(t,e){return Q(this,void 0,void 0,Z.mark((function n(){var r=this;return Z.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!this.hasBgImgMode(e)||!this.isPictureElement(t)){n.next=2;break}throw new Error('[MazLazyImg] You can\'t use the "bg-image" mode with "<picture />" element');case 2:return setTimeout((function(){return r.setBaseClass(t)}),0),t.getAttribute("src")||this.setImgSrc(t,"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"),n.next=6,this.bindUpdateHandler(t,e,"bind");case 6:case"end":return n.stop()}}),n,this)})))}},{key:"update",value:function(t,e){return Q(this,void 0,void 0,Z.mark((function n(){return Z.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e.value===e.oldValue){n.next=5;break}return this.hasImgLoaded=!1,this.removeAllStateClasses(t),n.next=5,this.bindUpdateHandler(t,e,"update");case 5:case"end":return n.stop()}}),n,this)})))}},{key:"remove",value:function(t,e){this.hasImgLoaded=!1,this.hasBgImgMode(e)&&(t.style.backgroundImage=""),this.removeAllStateClasses(t);var n,r=K(this.observers);try{for(r.s();!(n=r.n()).done;){n.value.unobserve(t)}}catch(t){r.e(t)}finally{r.f()}this.observers=[]}}]),t}(),ot={created:function(t,e){var n="object"===N(e.value)?e.value:{};(et=new rt(n)).add(t,e)},updated:function(t,e){et.update(t,e)},unmounted:function(t,e){et.remove(t,e)}},at={install:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object.assign(Object.assign(Object.assign({},nt),e),{observerOptions:Object.assign(Object.assign({},nt.observerOptions),e.observerOptions)}),r=new rt(n);t.directive("lazy-img",{created:r.add.bind(r),updated:r.update.bind(r),unmounted:r.remove.bind(r)})}},it=[{name:"click-outside",directive:O},{name:"closable",directive:j},{name:"zoom-img",directive:R},{name:"lazy-img",directive:ot}],st={install:function(t){it.forEach((function(e){var n=e.name,r=e.directive;t.directive(n,r)}))}},ct=function(t){return t?(t=t.toString()).charAt(0).toUpperCase()+t.slice(1):""},lt={style:"currency",minimumFractionDigits:2,round:!1},ut=function(t,e,n){var r=Object.assign(Object.assign({},lt),n);!function(t,e,n){if(void 0===t)throw new TypeError("[FilterCurrency] The `number` attribute is required.");if(void 0===e)throw new TypeError("[FilterCurrency] The `locale` attribute is required.");if("string"!=typeof e)throw new TypeError("[FilterCurrency] The `locale` attribute must be a string.");if(void 0===n.currency)throw new TypeError("[FilterCurrency] The `options.currency` attribute is required.")}(t,e,r);try{return function(t,e,n){var r=Number(t);return n.round&&(r=Math.floor(r),n.minimumFractionDigits=0),new Intl.NumberFormat(e,n).format(r)}(t,e,r)}catch(t){throw new Error("[FilterCurrency] ".concat(t))}},dt={month:"short",day:"numeric",year:"numeric"},mt=function(t,e,n){if(void 0===e)throw new TypeError("[FilterDate] The `locale` attribute is required.");if("string"!=typeof e)throw new TypeError("[FilterDate] The `locale` attribute must be a string.");var r=Object.assign(Object.assign({},dt),n);try{return new Intl.DateTimeFormat(e,r).format(new Date(t))}catch(t){throw new Error("[FilterDate] ".concat(t))}},ft={minimumFractionDigits:2},vt=function(t,e,n){if(n=Object.assign(Object.assign({},ft),n),void 0===t)throw new TypeError("[FilterNumber] The `number` attribute is required.");if(void 0===e)throw new TypeError("[FilterNumber] The `locale` attribute is required.");if("string"!=typeof e)throw new TypeError("[FilterNumber] The `locale` attribute must be a string.");try{return new Intl.NumberFormat(e,n).format(Number(t))}catch(t){throw new Error("[FilterNumber] ".concat(t))}},ht={capitalize:ct,currency:ut,date:mt,number:vt},pt={install:function(t){t.provide("filters",ht)}};var gt=function(){function t(e,n){D(this,t),this.startedAt=Date.now(),this.callback=e,this.delay=n,this.start()}return G(t,[{key:"pause",value:function(){this.stop(),this.delay-=Date.now()-this.startedAt}},{key:"resume",value:function(){this.startedAt=Date.now(),this.start()}},{key:"start",value:function(){this.timer=setTimeout(this.callback,this.delay)}},{key:"stop",value:function(){clearTimeout(this.timer)}}]),t}();var bt=["innerHTML"],yt=r({props:{src:{type:String,default:void 0},path:{type:String,default:void 0},name:{type:String,default:void 0},size:{type:String,default:"1.5rem"},title:{type:String,default:void 0},transformSource:{type:Function,default:function(t){return t}},keepDuringLoading:{type:Boolean,default:!0}},emits:["loaded","unloaded","error"],setup:function(t,e){var r=this,f=e.emit,v=t,h={},p=o(),g=o(),b=function(t,e){var r=n(t,e);if(r)return r}("mazIconPath"),y=a((function(){var t;return null!==(t=v.path)&&void 0!==t?t:b})),w=a((function(){return v.src?v.src:y.value?"".concat(y.value,"/").concat(v.name,".svg"):"/".concat(v.name,".svg")}));i((function(){if(!v.name&&!v.src)throw new Error('[MazIcon] you should provide "name" or "src" as prop');k(w.value)}));var x=function(t){var e=t.cloneNode(!0);return e=v.transformSource(t),v.title&&function(t,e){var n=t.getElementsByTagName("title");if(n.length)n[0].textContent=e;else{var r=document.createElementNS("http://www.w3.org/2000/svg","title");r.textContent=e,t.appendChild(r)}}(e,v.title),t.innerHTML},k=function(t){return Q(r,void 0,void 0,Z.mark((function e(){var n;return Z.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h[t]||(h[t]=z(t)),e.prev=1,e.next=4,h[t];case 4:return n=e.sent,p.value=n,e.next=8,m();case 8:f("loaded",g.value),e.next=16;break;case 11:e.prev=11,e.t0=e.catch(1),p.value&&(p.value=void 0,f("unloaded")),delete h[t],f("error",e.t0);case 16:case"end":return e.stop()}}),e,null,[[1,11]])})))},z=function(t){return new Promise((function(e,n){var r=new XMLHttpRequest;r.open("GET",t,!0),r.onload=function(){if(r.status>=200&&r.status<400)try{var t=(new DOMParser).parseFromString(r.responseText,"text/xml").getElementsByTagName("svg")[0];t?e(t):n(new Error('Loaded file is not valid SVG"'))}catch(t){n(t)}else n(new Error("Error loading SVG"))},r.onerror=n,r.send()}))};return s((function(){return v.src}),(function(){return k(w.value)})),function(e,n){return p.value?(c(),l("svg",u({key:0,ref_key:"svgElem",ref:g,width:"1em",height:"1em"},Object.assign(Object.assign({},function(t){var e={},n=t.attributes;if(!n)return e;for(var r=n.length-1;r>=0;r--)e[n[r].name]=n[r].value;return e}(p.value)),(r=e.$attrs,Object.keys(r).reduce((function(t,e){return!1!==r[e]&&null!==r[e]&&void 0!==r[e]&&(t[e]=r[e]),t}),{}))),{style:"font-size: ".concat(t.size),innerHTML:x(p.value)}),null,16,bt)):d("",!0);var r}}}),wt={class:"m-toast__message-wrapper"},xt={class:"m-toast__message"},kt={key:0,class:"--close"},zt=r({props:{position:{type:String,default:"bottom-right",required:!0},maxToasts:{type:[Number,Boolean],default:!1},timeout:{type:Number,required:!0},queue:{type:Boolean,default:!1},noPauseOnHover:{type:Boolean,default:!1},type:{type:String,default:"info",validator:function(t){return["info","success","warning","danger"].includes(t)}},message:{type:String,required:!0},persistent:{type:Boolean,default:!1}},emits:["close","click"],setup:function(e,n){var r=n.emit,s=e,u=o(),m=a((function(){return s.position.includes("top")?"top":"bottom"})),k=a((function(){return s.position.includes("left")?"left":s.position.includes("right")?"right":"center"})),z=a((function(){return"center"!==k.value?"right"===k.value?"m-slide-right":"m-slide-left":"top"===m.value?"m-slide-top":"m-slide-bottom"})),E=o(!1),L=o(),I=o(),O="m-toast-container --".concat(m.value," --").concat(k.value),A=".".concat(O.replaceAll(" ",".")),C=function t(){if(function(){var t=document.querySelector(A);return!(!s.queue&&!1===s.maxToasts)&&(!1!==s.maxToasts&&t?s.maxToasts<=t.childElementCount:t&&t.childElementCount>0)}())I.value=setTimeout(t,250);else{var e=document.querySelector(A);u.value&&e&&e.prepend(u.value),E.value=!0,L.value=s.timeout?new gt(_,s.timeout):void 0}};var S=function(t){L.value&&!s.noPauseOnHover&&(t?L.value.pause():L.value.resume())},_=function(){L.value&&L.value.stop(),I.value&&clearTimeout(I.value),E.value=!1,setTimeout((function(){var t;r("close"),null===(t=u.value)||void 0===t||t.remove();var e=document.querySelector(A);e&&!(null==e?void 0:e.hasChildNodes())&&e.remove()}),300)};return i((function(){!function(){var t=document.querySelector(A);if(!t&&!t){var e=document.body,n=document.createElement("div");n.className=O,e.append(n)}}(),C()})),function(n,o){return c(),f(v,{name:h(z)},{default:p((function(){return[g(b("div",{ref_key:"Toaster",ref:u,class:y(["m-toast",["--".concat(e.type),"--".concat(h(m)),"--".concat(h(k))]]),role:"alert",onMouseover:o[0]||(o[0]=function(t){return S(!0)}),onMouseleave:o[1]||(o[1]=function(t){return S(!1)}),onClick:o[2]||(o[2]=function(t){return r("click",t),void(s.persistent||_())})},[b("div",wt,[b("p",xt,w(e.message),1)]),e.persistent?d("",!0):(c(),l("button",kt,[t(yt,{src:h("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill%3D%22none%22%20viewBox%3D%220%200%2024%2024%22%20stroke%3D%22currentColor%22%20aria-hidden%3D%22true%22%3E%20%20%3Cpath%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%222%22%20d%3D%22M6%2018L18%206M6%206l12%2012%22%2F%3E%3C%2Fsvg%3E"),class:"maz-h-3 maz-w-3 maz-cursor-pointer"},null,8,["src"])]))],34),[[x,E.value]])]})),_:1},8,["name"])}}});function Et(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}}Et("/* purgecss start ignore */\n\n.m-toast-container {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n position: fixed;\n z-index: 50;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n\n.m-toast-container > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n\n.m-toast-container {\n padding: 1rem;\n}\n\n.m-toast-container.--top {\n top: 0px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n\n.m-toast-container.--center {\n width: 100%\n}\n\n@media (min-width: 768px) {\n .m-toast-container.--center {\n position: absolute;\n left: 50%;\n width: auto;\n }\n}\n\n@media (min-width: 768px) {\n\n.m-toast-container.--center {\n -webkit-transform: translate(-50%, 0);\n\n transform: translate(-50%, 0);\n}\n }\n\n.m-toast-container.--bottom {\n bottom: 0px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: reverse;\n -ms-flex-direction: column-reverse;\n flex-direction: column-reverse;\n}\n\n.m-toast-container.--bottom > :not([hidden]) ~ :not([hidden]) {\n margin-bottom: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-top: calc(0.5rem * var(--tw-space-y-reverse));\n}\n\n.m-toast-container.--right {\n right: 0px;\n width: 100%;\n}\n\n@media (min-width: 768px) {\n .m-toast-container.--right {\n width: auto;\n }\n}\n\n.m-toast-container.--left {\n left: 0px;\n width: 100%;\n}\n\n@media (min-width: 768px) {\n .m-toast-container.--left {\n width: auto;\n }\n}\n\n/* purgecss end ignore */\n");Et("/* purgecss start ignore */\n\n.m-toast[data-v-77935c60] {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n\n.m-toast *[data-v-77935c60] {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n\n.m-toast[data-v-77935c60] {\n position: relative;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n width: 100%;\n cursor: pointer;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-item-align: center;\n align-self: center;\n border-radius: 0.25rem;\n padding-right: 0.5rem;\n padding-left: 0.5rem;\n color: var(--maz-color-white);\n -webkit-transition-property: background-color, border-color, color, fill, stroke, opacity, -webkit-box-shadow, -webkit-transform, -webkit-filter, -webkit-backdrop-filter;\n transition-property: background-color, border-color, color, fill, stroke, opacity, -webkit-box-shadow, -webkit-transform, -webkit-filter, -webkit-backdrop-filter;\n transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-box-shadow, -webkit-transform, -webkit-filter, -webkit-backdrop-filter;\n -webkit-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n -webkit-transition-duration: 150ms;\n transition-duration: 150ms;\n -webkit-transition-duration: 300ms;\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n@media (min-width: 768px) {\n .m-toast.--left[data-v-77935c60], .m-toast.--right[data-v-77935c60] {\n width: 20rem;\n }\n}\n\n@media (min-width: 768px) {\n .m-toast.--center[data-v-77935c60] {\n width: 20rem;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n }\n}\n\n.m-toast__message-wrapper[data-v-77935c60] {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 0%;\n flex: 1 1 0%;\n padding-top: 0.75rem;\n padding-bottom: 0.75rem;\n}\n\n.m-toast__message[data-v-77935c60] {\n margin: 0px;\n font-weight: 500;\n}\n\n.m-toast .--close[data-v-77935c60] {\n margin-left: 0.25rem;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n height: 1.75rem;\n width: 1.75rem;\n border-radius: 9999px;\n background-color: transparent;\n}\n\n.m-toast .--close[data-v-77935c60]:hover {\n --tw-bg-opacity: 1;\n background-color: rgba(17, 24, 39, var(--tw-bg-opacity));\n --tw-bg-opacity: 0.1;\n}\n\n.m-toast .--close[data-v-77935c60] {\n padding: 0px;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n.m-toast.--info[data-v-77935c60] {\n background-color: var(--maz-color-info);\n}\n\n.m-toast.--info[data-v-77935c60]:hover {\n background-color: var(--maz-color-info-600);\n}\n\n.m-toast.--info[data-v-77935c60] {\n color: var(--maz-color-info-contrast);\n}\n\n.m-toast.--info .--close[data-v-77935c60] {\n color: var(--maz-color-info-contrast);\n}\n\n.m-toast.--success[data-v-77935c60] {\n background-color: var(--maz-color-success);\n}\n\n.m-toast.--success[data-v-77935c60]:hover {\n background-color: var(--maz-color-success-600);\n}\n\n.m-toast.--success[data-v-77935c60] {\n color: var(--maz-color-success-contrast);\n}\n\n.m-toast.--success .--close[data-v-77935c60] {\n color: var(--maz-color-success-contrast);\n}\n\n.m-toast.--warning[data-v-77935c60] {\n background-color: var(--maz-color-warning);\n}\n\n.m-toast.--warning[data-v-77935c60]:hover {\n background-color: var(--maz-color-warning-600);\n}\n\n.m-toast.--warning[data-v-77935c60] {\n color: var(--maz-color-warning-contrast);\n}\n\n.m-toast.--warning .--close[data-v-77935c60] {\n color: var(--maz-color-warning-contrast);\n}\n\n.m-toast.--danger[data-v-77935c60] {\n background-color: var(--maz-color-danger);\n}\n\n.m-toast.--danger[data-v-77935c60]:hover {\n background-color: var(--maz-color-danger-600);\n}\n\n.m-toast.--danger[data-v-77935c60] {\n color: var(--maz-color-danger-contrast);\n}\n\n.m-toast.--danger .--close[data-v-77935c60] {\n color: var(--maz-color-danger-contrast);\n}\n\n.m-slide-top-enter-from[data-v-77935c60],\n .m-slide-top-leave-to[data-v-77935c60] {\n opacity: 0;\n -webkit-transform: translateY(-100%);\n transform: translateY(-100%);\n}\n\n.m-slide-top-enter-active[data-v-77935c60],\n .m-slide-top-leave-active[data-v-77935c60] {\n opacity: 1;\n -webkit-transition: all 300ms;\n transition: all 300ms;\n -webkit-transform: translateY(0);\n transform: translateY(0);\n}\n\n.m-slide-bottom-enter-active[data-v-77935c60],\n .m-slide-bottom-leave-active[data-v-77935c60] {\n opacity: 1;\n -webkit-transition: all 300ms;\n transition: all 300ms;\n -webkit-transform: translateY(0);\n transform: translateY(0);\n}\n\n.m-slide-bottom-enter-from[data-v-77935c60],\n .m-slide-bottom-leave-to[data-v-77935c60] {\n opacity: 0;\n -webkit-transform: translateY(100%);\n transform: translateY(100%);\n}\n\n.m-slide-right-enter-active[data-v-77935c60],\n .m-slide-right-leave-active[data-v-77935c60] {\n opacity: 1;\n -webkit-transition: all 300ms;\n transition: all 300ms;\n -webkit-transform: translateX(0);\n transform: translateX(0);\n}\n\n.m-slide-right-enter-from[data-v-77935c60],\n .m-slide-right-leave-to[data-v-77935c60] {\n opacity: 0;\n -webkit-transform: translateX(100%);\n transform: translateX(100%);\n}\n\n.m-slide-left-enter-active[data-v-77935c60],\n .m-slide-left-leave-active[data-v-77935c60] {\n opacity: 1;\n -webkit-transition: all 300ms;\n transition: all 300ms;\n -webkit-transform: translateX(0);\n transform: translateX(0);\n}\n\n.m-slide-left-enter-from[data-v-77935c60],\n .m-slide-left-leave-to[data-v-77935c60] {\n opacity: 0;\n -webkit-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n\n/* purgecss end ignore */\n"),zt.__scopeId="data-v-77935c60";var Lt=function(){function n(t,e){D(this,n),this.app=t,this.globalOptions=e}return G(n,[{key:"show",value:function(n,r){var o=Object.assign({message:n},r),a=Object.assign(Object.assign(Object.assign({},o),this.globalOptions),r);!function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{props:void 0},o=r.props,a=r.children,i=r.element,s=r.app,c=i,l=t(n,o,a);s&&s._context&&(l.appContext=s._context),c?e(l,c):"undefined"!=typeof document&&e(l,c=document.createElement("div"))}(zt,{props:a,app:this.app})}},{key:"getLocalOptions",value:function(t,e){return Object.assign({type:t},e)}},{key:"success",value:function(t,e){return this.show(t,this.getLocalOptions("success",e))}},{key:"error",value:function(t,e){return this.show(t,this.getLocalOptions("danger",e))}},{key:"info",value:function(t,e){return this.show(t,this.getLocalOptions("info",e))}},{key:"warning",value:function(t,e){return this.show(t,this.getLocalOptions("warning",e))}}]),n}(),It={position:"bottom-right",timeout:1e4,persistent:!0},Ot={install:function(t,e){var n=new Lt(t,Object.assign(Object.assign({},It),e));t.provide("toast",n),t.config.globalProperties.$toaster=n}};export{Lt as ToasterHandler,ct as capitalize,ut as currency,mt as date,k as debounce,st as installDirectives,pt as installFilters,Ot as installToaster,vt as number,O as vClickOutside,A as vClickOutsideInstall,j as vClosable,P as vClosableInstall,ot as vLazyImg,at as vLazyImgInstall,R as vZoomImg,$ as vZoomImgInstall};
|
|
16
16
|
//# sourceMappingURL=index.js.map
|