maz-ui 3.6.11 → 3.7.0
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/LICENSE +21 -0
- package/components/MazAvatar.mjs +113 -55
- package/components/MazAvatar.umd.js +2 -2
- package/components/MazBackdrop.mjs +49 -23
- package/components/MazBackdrop.umd.js +2 -2
- package/components/MazBadge.mjs +17 -11
- package/components/MazBadge.umd.js +2 -2
- package/components/MazBottomSheet.mjs +160 -88
- package/components/MazBottomSheet.umd.js +2 -2
- package/components/MazBtn.mjs +54 -29
- package/components/MazBtn.umd.js +2 -2
- package/components/MazCard.mjs +322 -193
- package/components/MazCard.umd.js +2 -2
- package/components/MazCarousel.mjs +123 -77
- package/components/MazCarousel.umd.js +2 -2
- package/components/MazChart.d.ts +3 -34
- package/components/MazChart.mjs +2 -2
- package/components/MazChart.umd.js +2 -2
- package/components/MazCheckbox.mjs +25 -19
- package/components/MazCheckbox.umd.js +2 -2
- package/components/MazDialog.d.ts +27 -0
- package/components/MazDialog.mjs +178 -98
- package/components/MazDialog.umd.js +2 -2
- package/components/MazDialogPromise.d.ts +1 -1
- package/components/MazDialogPromise.mjs +204 -105
- package/components/MazDialogPromise.umd.js +2 -2
- package/components/MazDrawer.mjs +149 -80
- package/components/MazDrawer.umd.js +2 -2
- package/components/MazDropzone.d.ts +2 -2
- package/components/MazDropzone.mjs +72 -42
- package/components/MazDropzone.umd.js +2 -2
- package/components/MazGallery.mjs +158 -80
- package/components/MazGallery.umd.js +2 -2
- package/components/MazIcon.mjs +27 -15
- package/components/MazIcon.umd.js +2 -2
- package/components/MazInput.mjs +183 -140
- package/components/MazInput.umd.js +2 -2
- package/components/MazInputNumber.d.ts +1 -1
- package/components/MazInputNumber.mjs +244 -193
- package/components/MazInputNumber.umd.js +2 -2
- package/components/MazInputPrice.d.ts +1 -1
- package/components/MazInputPrice.mjs +207 -156
- package/components/MazInputPrice.umd.js +2 -2
- package/components/MazInputTags.mjs +260 -195
- package/components/MazInputTags.umd.js +2 -2
- package/components/MazLazyImg.mjs +48 -21
- package/components/MazLazyImg.umd.js +2 -2
- package/components/MazPhoneNumberInput.mjs +383 -279
- package/components/MazPhoneNumberInput.umd.js +2 -2
- package/components/MazPicker.d.ts +2 -2
- package/components/MazPicker.mjs +755 -486
- package/components/MazPicker.umd.js +2 -2
- package/components/MazRadioButtons.mjs +52 -36
- package/components/MazRadioButtons.umd.js +2 -2
- package/components/MazSelect.mjs +324 -254
- package/components/MazSelect.umd.js +2 -2
- package/components/MazSlider.d.ts +1 -1
- package/components/MazSlider.mjs +97 -45
- package/components/MazSlider.umd.js +2 -2
- package/components/MazSpinner.mjs +8 -2
- package/components/MazSpinner.umd.js +2 -2
- package/components/MazStepper.mjs +144 -84
- package/components/MazStepper.umd.js +2 -2
- package/components/MazSwitch.mjs +34 -22
- package/components/MazSwitch.umd.js +2 -2
- package/components/MazTabsBar.mjs +111 -57
- package/components/MazTabsBar.umd.js +2 -2
- package/components/MazTabsContent.mjs +14 -8
- package/components/MazTabsContent.umd.js +2 -2
- package/components/MazTabsContentItem.mjs +17 -9
- package/components/MazTabsContentItem.umd.js +2 -2
- package/components/MazTextarea.mjs +52 -40
- package/components/MazTextarea.umd.js +2 -2
- package/components/MazTransitionExpand.mjs +2 -1
- package/components/MazTransitionExpand.umd.js +2 -2
- package/components/assets/no-photography-584c6185.mjs +4 -0
- package/components/index.mjs +1 -1
- package/css/main.css +1 -1
- package/modules/assets/no-photography-584c6185.mjs +4 -0
- package/modules/maz-ui.mjs +81 -40
- package/modules/maz-ui.umd.js +2 -2
- package/package.json +37 -48
- package/components/index.umd.js +0 -35
- package/components/no_photo-410a8f01.mjs +0 -4
- package/modules/no_photo-410a8f01.mjs +0 -4
package/modules/maz-ui.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp=Object.defineProperty,__defNormalProp=(e,t,i)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,__publicField=(e,t,i)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,i),i);!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["maz-ui"]={},e.Vue)}(this,(function(e,t){"use strict";function i(e,i){const s=t.inject(e,i);if(!s)throw new TypeError(`[maz-ui](injectStrict) Could not resolve ${e}`);return s}function s(e,{props:i,children:s,element:o,app:n}={}){let r=o;const a=t.createVNode(e,i,s);n&&n._context&&(a.appContext=n._context),r?t.render(a,r):"undefined"!=typeof document&&t.render(a,r=document.createElement("div"));return{vNode:a,destroy:()=>{r&&t.render(null,r)},el:r}}function o(){return"undefined"!=typeof document}class n{constructor(e,t){__publicField(this,"defaultOptions",{element:void 0,timeout:3e5,once:!1,immediate:!0,ssr:!1}),__publicField(this,"options"),__publicField(this,"timeoutHandler"),__publicField(this,"isIdle",!1),__publicField(this,"isDestroy",!1),__publicField(this,"startTime",0),__publicField(this,"remainingTime",0),__publicField(this,"lastClientX",-1),__publicField(this,"lastClientY",-1),__publicField(this,"eventNames",["DOMMouseScroll","mousedown","mousemove","mousewheel","MSPointerDown","MSPointerMove","keydown","touchmove","touchstart","wheel","click"]),__publicField(this,"handleEvent",(e=>{try{if(this.remainingTime>0)return;if("mousemove"===e.type){const{clientX:t,clientY:i}=e;if(void 0===t&&void 0===i||t===this.lastClientX&&i===this.lastClientY)return;this.lastClientX=t,this.lastClientY=i}this.resetTimeout(),this.callback({isIdle:this.isIdle,eventType:e.type})}catch(t){throw new Error(`[IdleTimeout](handleEvent) ${t}`)}})),this.callback=e,this.options={...this.defaultOptions,...t},!this.options.ssr&&o()?this.start():this.options.ssr||o()||console.warn('[IdleTimeout](constructor) executed on server side - set immediate option to "false"')}get element(){return this.options.element??document.body}start(){if(o()){for(const e of this.eventNames)this.element.addEventListener(e,this.handleEvent);this.resetTimeout(),this.options.immediate&&this.callback({isIdle:!1})}else console.warn("[IdleTimeout](start) you should run this method on client side")}pause(){const e=this.startTime+this.options.timeout-Date.now();e<=0||(this.remainingTime=e,this.timeoutHandler&&(clearTimeout(this.timeoutHandler),this.timeoutHandler=void 0))}resume(){this.remainingTime<=0||(this.resetTimeout(),this.callback({isIdle:this.isIdle}),this.remainingTime=0)}reset(){this.isDestroy=!1,this.isIdle=!1,this.remainingTime=0,this.resetTimeout(),this.callback({isIdle:this.isIdle})}destroy(){if(o()){this.isDestroy=!0;for(const e of this.eventNames)this.element.removeEventListener(e,this.handleEvent);this.timeoutHandler&&clearTimeout(this.timeoutHandler)}else console.warn("[IdleTimeout](destroy) you should run this method on client side")}resetTimeout(){this.isIdle=!1,this.timeoutHandler&&(clearTimeout(this.timeoutHandler),this.timeoutHandler=void 0),this.timeoutHandler=setTimeout(this.handleTimeout.bind(this),this.remainingTime||this.options.timeout),this.startTime=Date.now()}handleTimeout(){this.isIdle=!0,this.callback({isIdle:this.isIdle}),this.options.once&&this.destroy()}get destroyed(){return this.isDestroy}get timeout(){return this.options.timeout}set timeout(e){this.options.timeout=e}get idle(){return this.isIdle}set idle(e){e?this.handleTimeout():this.reset(),this.callback({isIdle:this.isIdle})}}class r{constructor(e,t){__publicField(this,"eventHandlerFunction"),__publicField(this,"event","visibilitychange"),__publicField(this,"timeoutHandler"),__publicField(this,"options"),__publicField(this,"defaultOptions",{timeout:5e3,once:!1,immediate:!0,ssr:!1}),__publicField(this,"isVisible",!1),this.callback=e,this.options={...this.defaultOptions,...t},this.eventHandlerFunction=this.eventHandler.bind(this),!this.options.ssr&&o()?this.start():this.options.ssr||o()||console.warn('[UserVisibility](constructor) executed on server side - set "ssr" option to "false"')}start(){o()?(this.options.immediate&&this.emitCallback(),this.addEventListener()):console.warn("[UserVisibility](start) you should run this method on client side")}emitCallback(){this.isVisible="visible"===document.visibilityState,this.callback({isVisible:this.isVisible}),this.options.once&&this.destroy()}eventHandler(){"visible"!==document.visibilityState||this.isVisible?"hidden"===document.visibilityState&&this.initTimeout():(this.clearTimeout(),this.emitCallback())}clearTimeout(){this.timeoutHandler&&(clearTimeout(this.timeoutHandler),this.timeoutHandler=void 0)}initTimeout(){this.clearTimeout(),this.timeoutHandler=setTimeout(this.emitCallback.bind(this),this.options.timeout)}addEventListener(){document.addEventListener(this.event,this.eventHandlerFunction)}removeEventListener(){document.removeEventListener(this.event,this.eventHandlerFunction)}destroy(){this.removeEventListener(),this.timeoutHandler&&clearTimeout(this.timeoutHandler)}}const a="__vue_click_away__",l=()=>null===document.ontouchstart?"touchstart":"click",d=async(e,i)=>{c(e);const s=i.instance,o=i.value,n="function"==typeof o;if(!n)throw new Error("[maz-ui](vClickOutside) the callback should be a function");await t.nextTick(),e[a]=t=>{if((!e||!e.contains(t.target))&&o&&n)return o.call(s,t)};const r=l();document.addEventListener(r,e[a],!1)},c=e=>{const t=l();document.removeEventListener(t,e[a],!1),delete e[a]},u={mounted:d,updated:(e,t)=>{t.value!==t.oldValue&&d(e,t)},unmounted:c},m={install:e=>{e.directive("click-outside",u)}},h=(e,t,i,s)=>{e.stopPropagation();const{handler:o,exclude:n}=i.value;let r=!1;if(n&&n.length>0)for(const a of n)if(!r){r=s.context.$refs[a].contains(e.target)}t.contains(e.target)||r||s.context[o]()},p=()=>null===document.ontouchstart?"touchstart":"click",g={mounted:(e,t,i)=>{const s=p();document.addEventListener(s,(s=>h(s,e,t,i)))},unmounted:(e,t,i)=>{const s=p();document.removeEventListener(s,(s=>h(s,e,t,i)))}},v={install:e=>{e.directive("closable",g)}},b={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>'};class y{constructor(e){if(__publicField(this,"options"),__publicField(this,"loader"),__publicField(this,"wrapper"),__publicField(this,"img"),__publicField(this,"keydownHandler"),__publicField(this,"onImgLoadedCallback"),__publicField(this,"buttonsAdded"),__publicField(this,"defaultOptions",{scale:!0,blur:!0,disabled:!1}),__publicField(this,"mouseEnterListener"),__publicField(this,"mouseLeaveListener"),__publicField(this,"renderPreviewListener"),!e.value)throw new Error('[MazUI](zoom-img) Image path must be defined. Ex: `v-zoom-img="<PATH_TO_IMAGE>"`');if("object"==typeof e.value&&!e.value.src)throw new Error("[maz-ui](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)}buildOptions(e){return{...this.defaultOptions,..."object"==typeof e.value?e.value:{src:e.value}}}get allInstances(){return[...document.querySelectorAll(".maz-zoom-img-instance")]}create(e){this.options.disabled||(e.style.cursor="pointer",setTimeout((()=>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",this.mouseEnterListener=()=>this.mouseEnter(e),this.mouseLeaveListener=()=>this.mouseLeave(e),this.renderPreviewListener=()=>this.renderPreview(e,this.options),e.addEventListener("mouseenter",this.mouseEnterListener),e.addEventListener("mouseleave",this.mouseLeaveListener),e.addEventListener("click",this.renderPreviewListener))}update(e){this.options=this.buildOptions(e)}remove(e){this.imgEventHandler(!1),e.removeEventListener("mouseenter",this.mouseEnterListener),e.removeEventListener("mouseleave",this.mouseLeaveListener),e.removeEventListener("click",this.renderPreviewListener),e.classList.remove("maz-zoom-img-instance"),e.removeAttribute("data-src"),e.removeAttribute("data-alt"),e.style.cursor=""}renderPreview(e,t){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: 1rem;\n z-index: 1050;\n background-color: hsla(238, 15%, 40%, 0.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: hsla(238, 15%, 40%, 0.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: hsla(0, 0%, 7%, 0.5);\n box-shadow: 0 0 0.5rem 0 hsla(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: hsl(0, 0%, 0%);\n}");const i=document.createElement("div");i.classList.add("maz-zoom-img"),i.setAttribute("id","MazImgPreviewFullsize"),i.addEventListener("click",(e=>{i.isEqualNode(e.target)&&this.closePreview()})),"object"==typeof t&&(this.img.setAttribute("src",t.src),t.alt&&this.img.setAttribute("alt",t.alt),this.img.id="MazImgElement"),this.wrapper.append(this.img),i.append(this.wrapper),document.body.append(i),this.keyboardEventHandler(!0),setTimeout((()=>{i&&i.classList.add("maz-animate")}),100)}onImgLoaded(){this.wrapper.style.width=`${this.img.width}px`,this.wrapper.style.minWidth="200px",this.loader.hidden=!0;const e=this.getButton(),t=[],i=this.allInstances.length>1;if(!this.buttonsAdded){if(this.buttonsAdded=!0,i){const e=this.getButton("previous"),i=this.getButton("next");t.push(e,i)}this.wrapper.append(e),i&&(this.wrapper.prepend(t[0]),this.wrapper.append(t[1]))}}getLoader(){const e=document.createElement("div");return e.classList.add("maz-zoom-img__loader"),e.innerHTML=b.spinner,e}mouseLeave(e){this.options.scale&&(e.style.transform=""),this.options.blur&&(e.style.filter=""),e.style.zIndex=""}mouseEnter(e){e.style.zIndex="1",this.options.scale&&(e.style.transform="scale(1.1)"),this.options.blur&&(e.style.filter="blur(2px)")}keydownLister(e){e.preventDefault(),"Escape"!==e.key&&" "!==e.key||this.closePreview(),"ArrowLeft"!==e.key&&"ArrowRight"!==e.key||this.nextPreviousImage("ArrowRight"===e.key)}getButton(e="close"){const t=document.createElement("button");return t.innerHTML=b[e],t.addEventListener("click",(()=>{"close"===e?this.closePreview():this.allInstances&&this.nextPreviousImage("next"===e)})),t.classList.add("maz-zoom-btn"),t.classList.add(`maz-zoom-btn--${e}`),t}closePreview(){const e=document.querySelector("#MazImgPreviewFullsize"),t=document.querySelector("#MazPreviewStyle"),i=document.querySelector(".maz-zoom-img-instance.maz-is-open");i&&i.classList.remove("maz-is-open"),e&&e.classList.remove("maz-animate"),this.keyboardEventHandler(!1),setTimeout((()=>{e&&e.remove(),t&&t.remove()}),300)}getNewInstanceIndex(e){return e<0?this.allInstances.length-1:e>=this.allInstances.length?0:e}nextPreviousImage(e){const t=e,i=document.querySelector(".maz-zoom-img-instance.maz-is-open");if(i){const e=this.allInstances.indexOf(i),s=t?e+1:e-1,o=this.allInstances[this.getNewInstanceIndex(s)];o&&this.useNextInstance(i,o)}}useNextInstance(e,t){e.classList.remove("maz-is-open"),t.classList.add("maz-is-open");const i=t.getAttribute("data-src"),s=t.getAttribute("data-alt");this.wrapper.style.width="",this.loader.hidden=!1,i&&this.img.setAttribute("src",i),s&&this.img.setAttribute("alt",s)}addStyle(e){const t=document.createElement("style");t.id="MazPreviewStyle",t.textContent=e,document.head.append(t)}keyboardEventHandler(e){if(e)return document.addEventListener("keydown",this.keydownHandler);document.removeEventListener("keydown",this.keydownHandler)}imgEventHandler(e){if(e)return this.img.addEventListener("load",this.onImgLoadedCallback);this.img.removeEventListener("load",this.onImgLoadedCallback)}}let w;const f={created(e,t){w=new y(t),w.create(e)},updated(e,t){w.update(t)},unmounted(e){w.remove(e)}},z={install(e){e.directive("zoom-img",f)}},L={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}};class I{constructor(e={}){__publicField(this,"observers",[]),__publicField(this,"defaultOptions",L),__publicField(this,"options"),__publicField(this,"onImgLoadedCallback"),__publicField(this,"onImgErrorCallback"),__publicField(this,"hasImgLoaded",!1),this.options=this.buildOptions(e),this.onImgLoadedCallback=this.imageIsLoaded.bind(this),this.onImgErrorCallback=this.imageHasError.bind(this)}async loadErrorPhoto(){const{default:e}=await Promise.resolve().then((()=>de));return e}buildOptions(e){return{...this.defaultOptions,...e,observerOptions:{...this.defaultOptions.observerOptions,...e.observerOptions}}}removeClass(e,t){e.classList.remove(t)}addClass(e,t){e.classList.add(t)}removeAllStateClasses(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)}setBaseClass(e){this.addClass(e,this.options.baseClass)}imageIsLoading(e){var t,i;this.addClass(e,this.options.loadingClass),null==(i=(t=this.options).onLoading)||i.call(t,e)}imageHasNoPhoto(e){this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.noPhotoClass),this.setDefaultPhoto(e)}imageIsLoaded(e){var t,i;this.hasImgLoaded=!0,this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.loadedClass),null==(i=(t=this.options).onLoaded)||i.call(t,e)}imageHasError(e,t){var i,s;console.warn("[maz-ui][MazLazyImg] Error while loading image",t),this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.errorClass),null==(s=(i=this.options).onError)||s.call(i,e),this.setDefaultPhoto(e)}getImageUrl(e,t){const i=this.getImgElement(e).getAttribute("data-src");if(i)return i;const s="object"==typeof t.value?t.value.src:t.value;return s||console.warn("[maz-ui][MazLazyImg] src url is not defined"),s}async setPictureSourceUrls(e){const t=e.querySelectorAll("source");if(t.length>0)for await(const i of t){const e=i.getAttribute("data-srcset");e?i.srcset=e:console.warn('[maz-ui][MazLazyImg] the "[data-srcset]" attribute is not provided on "<source />"')}else console.warn('[maz-ui][MazLazyImg] No "<source />" elements provided into the "<picture />" element'),this.imageHasError(e)}hasBgImgMode(e){return"bg-image"===e.arg}isPictureElement(e){return e instanceof HTMLPictureElement}getImgElement(e){return this.isPictureElement(e)?e.querySelector("img"):e}async setDefaultPhoto(e){if(this.options.noUseErrorPhoto)return;const t=this.options.errorPhoto??await this.loadErrorPhoto(),i=e.querySelectorAll("source");if(i.length>0)for await(const s of i)s.srcset=t;else this.setImgSrc(e,t)}addEventListenerToImg(e){const t=this.getImgElement(e);t.addEventListener("load",(()=>this.onImgLoadedCallback(e)),{once:!0}),t.addEventListener("error",(t=>this.onImgErrorCallback(e,t)),{once:!0})}async loadImage(e,t){if(this.imageIsLoading(e),this.isPictureElement(e))this.addEventListenerToImg(e),await this.setPictureSourceUrls(e);else{const i=this.getImageUrl(e,t);if(!i)return this.imageHasError(e);this.hasBgImgMode(t)?(e.style.backgroundImage=`url('${i}')`,this.imageIsLoaded(e)):(this.addEventListenerToImg(e),this.setImgSrc(e,i))}}setImgSrc(e,t){this.getImgElement(e).src=t}handleIntersectionObserver(e,t,i,s){var o,n;this.observers.push(s);for(const r of i)if(r.isIntersecting){if(null==(n=(o=this.options).onIntersecting)||n.call(o,r.target),this.options.observerOnce&&s.unobserve(e),this.options.loadOnce&&this.hasImgLoaded)return;this.loadImage(e,t)}}createObserver(e,t){const i=this.options.observerOptions;new IntersectionObserver(((i,s)=>{this.handleIntersectionObserver(e,t,i,s)}),i).observe(e)}async imageHandler(e,t,i){if("update"===i)for await(const s of this.observers)s.unobserve(e);window.IntersectionObserver?this.createObserver(e,t):this.loadImage(e,t)}async bindUpdateHandler(e,t,i){if(this.options.noPhoto)return this.imageHasNoPhoto(e);await this.imageHandler(e,t,i)}async add(e,t){if(this.hasBgImgMode(t)&&this.isPictureElement(e))throw new Error('[MazLazyImg] You can\'t use the "bg-image" mode with "<picture />" element');setTimeout((()=>this.setBaseClass(e)),0),e.getAttribute("src")||this.setImgSrc(e,"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"),await this.bindUpdateHandler(e,t,"bind")}async update(e,t){t.value!==t.oldValue&&(this.hasImgLoaded=!1,this.removeAllStateClasses(e),await this.bindUpdateHandler(e,t,"update"))}remove(e,t){this.hasImgLoaded=!1,this.hasBgImgMode(t)&&(e.style.backgroundImage=""),this.removeAllStateClasses(e);for(const i of this.observers)i.unobserve(e);this.observers=[]}}let T;const M={created(e,t){const i="object"==typeof t.value?t.value:{};T=new I(i),T.add(e,t)},updated(e,t){T.update(e,t)},unmounted(e,t){T.remove(e,t)}},_={install(e,t={}){const i={...L,...t,observerOptions:{...L.observerOptions,...t.observerOptions}},s=new I(i);e.directive("lazy-img",{created:s.add.bind(s),updated:s.update.bind(s),unmounted:s.remove.bind(s)})}},E=[{name:"click-outside",directive:u},{name:"closable",directive:g},{name:"zoom-img",directive:f},{name:"lazy-img",directive:M}],C={install(e){for(const{name:t,directive:i}of E)e.directive(t,i)}},k=e=>e?(e=e.toString()).charAt(0).toUpperCase()+e.slice(1):"",A={style:"currency",minimumFractionDigits:2,round:!1},x=(e,t,i)=>{const s={...A,...i};((e,t,i)=>{if(void 0===e)throw new TypeError("[maz-ui](FilterCurrency) The `number` attribute is required.");if(void 0===t)throw new TypeError("[maz-ui](FilterCurrency) The `locale` attribute is required.");if("string"!=typeof t)throw new TypeError("[maz-ui](FilterCurrency) The `locale` attribute must be a string.");if(void 0===i.currency)throw new TypeError("[maz-ui](FilterCurrency) The `options.currency` attribute is required.")})(e,t,s);try{return((e,t,i)=>{let s=Number(e);return i.round&&(s=Math.floor(s),i.minimumFractionDigits=0),new Intl.NumberFormat(t,i).format(s)})(e,t,s)}catch(o){throw new Error(`[maz-ui](FilterCurrency) ${o}`)}},S={month:"short",day:"numeric",year:"numeric"},D=(e,t,i)=>{if(void 0===t)throw new TypeError("[maz-ui](FilterDate) The `locale` attribute is required.");if("string"!=typeof t)throw new TypeError("[maz-ui](FilterDate) The `locale` attribute must be a string.");const s=i??S;try{const i=e instanceof Date?e:new Date(e);return new Intl.DateTimeFormat(t,s).format(i)}catch(o){throw new Error(`[maz-ui](FilterDate) ${o}`)}},N={minimumFractionDigits:2},H=(e,t,i)=>{const s={...N,...i};if(void 0===e)throw new TypeError("[maz-ui](FilterNumber) The `number` attribute is required.");if(void 0===t)throw new TypeError("[maz-ui](FilterNumber) The `locale` attribute is required.");if("string"!=typeof t)throw new TypeError("[maz-ui](FilterNumber) The `locale` attribute must be a string.");try{return new Intl.NumberFormat(t,s).format(Number(e))}catch(o){throw new Error(`[maz-ui](FilterNumber) ${o}`)}},j={capitalize:k,currency:x,date:D,number:H},O={install(e){e.provide("filters",j)}};class F{constructor(e,t){__publicField(this,"callback"),__publicField(this,"delay"),__publicField(this,"timer"),__publicField(this,"startedAt"),this.startedAt=Date.now(),this.callback=e,this.delay=t,this.start()}pause(){this.stop(),this.delay-=Date.now()-this.startedAt}resume(){this.startedAt=Date.now(),this.start()}start(){this.timer=setTimeout(this.callback,this.delay)}stop(){clearTimeout(this.timer)}}const P=["innerHTML"],V=t.defineComponent({__name:"MazIcon",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:e=>e}},emits:["loaded","unloaded","error"],setup(e,{emit:s}){const o=e,n={},r=t.ref(),a=t.ref(),l=t.computed((()=>o.path??(()=>{try{return i("mazIconPath")}catch{return}})())),d=t.computed((()=>o.src?o.src:l.value?`${l.value}/${o.name}.svg`:`/${o.name}.svg`));t.onMounted((()=>{o.name||o.src||console.error('[maz-ui](MazIcon) you should provide "name" or "src" as prop')}));const c=e=>{const t={},i=e.attributes;if(!i)return t;for(let s=i.length-1;s>=0;s--)t[i[s].name]=i[s].value;return t},u=e=>{let t=e.cloneNode(!0);return t=o.transformSource(e),o.title&&((e,t)=>{const i=e.querySelectorAll("title");if(i.length>0)i[0].textContent=t;else{const i=document.createElementNS("http://www.w3.org/2000/svg","title");i.textContent=t,e.append(i)}})(t,o.title),e.innerHTML},m=e=>new Promise(((t,i)=>{const s=new XMLHttpRequest;s.open("GET",e,!0),s.addEventListener("load",(()=>{if(s.status>=200&&s.status<400)try{const e=new DOMParser;let n=e.parseFromString(s.responseText,"text/xml").querySelectorAll("svg")[0];n?(n=o.transformSource(n),t(n)):i(new Error('Loaded file is not valid SVG"'))}catch(e){i(e)}else i(new Error("Error loading SVG"))})),s.addEventListener("error",(()=>i())),s.send()}));return t.watchEffect((()=>(async e=>{n[e]||(n[e]=m(e));try{r.value=await n[e],await t.nextTick(),s("loaded",a.value)}catch(i){r.value&&(r.value=void 0,s("unloaded")),delete n[e],s("error",i)}})(d.value))),(i,s)=>{return r.value?(t.openBlock(),t.createElementBlock("svg",t.mergeProps({key:0,ref_key:"svgElem",ref:a,width:"1em",height:"1em"},{...c(r.value),...(o=i.$attrs,Object.keys(o).reduce(((e,t)=>(!1!==o[t]&&null!==o[t]&&void 0!==o[t]&&(e[t]=o[t]),e)),{}))},{style:`font-size: ${e.size}`,innerHTML:u(r.value)}),null,16,P)):t.createCommentVNode("",!0);var o}}}),B={class:"m-toast__message-wrapper"},q={class:"m-toast__message"},Z={key:0,class:"--close"},$=((e,t)=>{const i=e.__vccOpts||e;for(const[s,o]of t)i[s]=o;return i})(t.defineComponent({__name:"MazToast",props:{position:{type:String,default:"bottom-right"},maxToasts:{type:[Number,Boolean],default:!1},timeout:{type:Number,default:1e4},queue:{type:Boolean,default:!1},noPauseOnHover:{type:Boolean,default:!1},type:{type:String,default:"info",validator:e=>["info","success","warning","danger"].includes(e)},message:{type:String,required:!0},persistent:{type:Boolean,default:!1}},emits:["close","click"],setup(e,{emit:i}){const s=e,o=t.ref(),n=t.computed((()=>s.position.includes("top")?"top":"bottom")),r=t.computed((()=>s.position.includes("left")?"left":s.position.includes("right")?"right":"center")),a=t.computed((()=>"center"!==r.value?"right"===r.value?"m-slide-right":"m-slide-left":"top"===n.value?"m-slide-top":"m-slide-bottom")),l=t.ref(!1),d=t.ref(),c=t.ref(),u=`m-toast-container --${n.value} --${r.value}`,m=`.${u.replaceAll(" ",".")}`,h=()=>{if((()=>{const e=document.querySelector(m);return!(!s.queue&&!1===s.maxToasts)&&(!1!==s.maxToasts&&e?s.maxToasts<=e.childElementCount:e&&e.childElementCount>0)})())return void(c.value=setTimeout(h,250));const e=document.querySelector(m);o.value&&e&&e.prepend(o.value),l.value=!0,d.value=s.timeout?new F(g,s.timeout):void 0};const p=e=>{d.value&&!s.noPauseOnHover&&(e?d.value.pause():d.value.resume())},g=()=>{d.value&&d.value.stop(),c.value&&clearTimeout(c.value),l.value=!1,setTimeout((()=>{var e;i("close"),null==(e=o.value)||e.remove();const t=document.querySelector(m);t&&!(null==t?void 0:t.hasChildNodes())&&t.remove()}),300)};return t.onMounted((()=>{(()=>{const e=document.querySelector(m);if(!e&&!e){const e=document.body,t=document.createElement("div");t.className=u,e.append(t)}})(),h()})),(d,c)=>(t.openBlock(),t.createBlock(t.Transition,{name:t.unref(a)},{default:t.withCtx((()=>[t.withDirectives(t.createElementVNode("div",{ref_key:"Toaster",ref:o,class:t.normalizeClass(["m-toast",[`--${e.type}`,`--${t.unref(n)}`,`--${t.unref(r)}`]]),role:"alert",onMouseover:c[0]||(c[0]=e=>p(!0)),onMouseleave:c[1]||(c[1]=e=>p(!1)),onClick:c[2]||(c[2]=e=>(i("click",e),void(s.persistent||g())))},[t.createElementVNode("div",B,[t.createElementVNode("p",q,t.toDisplayString(e.message),1)]),e.persistent?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",Z,[t.createVNode(V,{src:t.unref("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIGFyaWEtaGlkZGVuPSJ0cnVlIj4KICA8cGF0aCBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMiIgZD0iTTYgMThMMTggNk02IDZsMTIgMTIiLz4KPC9zdmc+Cg=="),class:"--icon"},null,8,["src"])]))],34),[[t.vShow,l.value]])])),_:1},8,["name"]))}}),[["__scopeId","data-v-f511285d"]]);class G{constructor(e,t){this.app=e,this.globalOptions=t}show(e,t){const i={...{message:e,...t},...this.globalOptions,...t};s($,{props:i,app:this.app})}getLocalOptions(e,t){return{type:e,...t}}success(e,t){return this.show(e,this.getLocalOptions("success",t))}error(e,t){return this.show(e,this.getLocalOptions("danger",t))}info(e,t){return this.show(e,this.getLocalOptions("info",t))}warning(e,t){return this.show(e,this.getLocalOptions("warning",t))}}const U={position:"bottom-right",timeout:1e4,persistent:!0};e.toastInstance=void 0;const Y={install(t,i){e.toastInstance=new G(t,{...U,...i}),t.provide("toast",e.toastInstance)}};class W{constructor(){__publicField(this,"_loaders",t.ref([]))}get loaders(){return t.computed((()=>this._loaders.value))}stop(e=""){var t;this._loaders.value=(t=this._loaders.value,(e="")=>t.filter((t=>t!==e)))(e)}start(e=""){var t;return this._loaders.value=(t=this._loaders.value,(e="")=>(e=>e.filter(((e,t,i)=>t===i.indexOf(e))))([...t,e]))(e),()=>this.stop(e)}get anyLoading(){return t.computed((()=>this._loaders.value.length>0))}isLoading(e=""){return t.computed((()=>{return(t=this._loaders.value,(e="")=>"function"==typeof e?t.findIndex(((...t)=>e(...t)))>-1:t.includes(e))(e);var t})).value}}const Q=new W,K={install:e=>{e.provide("wait",Q)}},J=100,R={root:void 0,rootMargin:"0px",threshold:.2},X={once:!0,duration:300};class ee{constructor(e){__publicField(this,"options"),this.options={delay:(null==e?void 0:e.delay)??J,observer:{...R,...null==e?void 0:e.observer},animation:{...X,...null==e?void 0:e.animation}}}runAnimations(){if(o())return this.handleObserver();console.warn("[MazAos](runAnimations) should be executed on client side")}async handleObserver(){var e;await(e=this.options.delay,new Promise((t=>setTimeout(t,e))));const t=new IntersectionObserver(this.handleIntersect.bind(this),{...this.options.observer});for(const i of document.querySelectorAll("[data-maz-aos]")){const e=i.getAttribute("data-maz-aos-anchor");if(e){const i=document.querySelector(e);i?(i.setAttribute("data-maz-aos-children","true"),t.observe(i)):console.warn(`[maz-ui](aos) no element found with selector "${e}"`)}else t.observe(i)}}handleIntersect(e,t){for(const i of e){const e="true"===i.target.getAttribute("data-maz-aos-children"),s=i.target.getAttribute("data-maz-aos")?[i.target]:[];if(e){const e=[...document.querySelectorAll("[data-maz-aos-anchor]")].map((e=>e.getAttribute("data-maz-aos-anchor")===`#${i.target.id}`?e:void 0));for(const t of e)t&&s.push(t)}for(const o of s){const e=o.getAttribute("data-maz-aos-once"),s="string"==typeof e?"true"===e:this.options.animation.once;if(i.intersectionRatio>this.options.observer.threshold){o.getAttribute("data-maz-aos-duration")||(o.style.transitionDuration=`${this.options.animation.duration}ms`,setTimeout((()=>{o.style.transitionDuration="0"}),1e3)),o.classList.add("maz-aos-animate"),s&&t.unobserve(o)}else o.classList.remove("maz-aos-animate")}}}}e.aosInstance=void 0;const te={install:(t,i)=>{e.aosInstance=new ee(i),t.provide("aos",e.aosInstance),o()&&((null==i?void 0:i.router)?i.router.afterEach((async()=>{e.aosInstance.runAnimations()})):e.aosInstance.runAnimations())}},ie={darkClass:"dark",storageThemeKey:"theme",storageThemeValueDark:"dark",storageThemeValueLight:"light"},se=t.ref(),oe=({darkClass:e,storageThemeKey:t,storageThemeValueDark:i,setLocalStorageValue:s=!0})=>{document.documentElement.classList.add(e),se.value=i,s&&(localStorage[t]=i)},ne=({darkClass:e,storageThemeKey:t,storageThemeValueLight:i,setLocalStorageValue:s=!0})=>{document.documentElement.classList.remove(e),se.value=i,s&&(localStorage[t]=i)},re=({shouldSetDarkMode:e,...t})=>e?oe(t):ne(t),ae=t.ref(),le=t.ref(),de=Object.freeze(Object.defineProperty({__proto__:null,default:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDI0IDI0IiBoZWlnaHQ9IjQ4cHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjQ4cHgiIGZpbGw9IiNjZGNkY2QiPgogIDxnPgogICAgPHJlY3QgZmlsbD0ibm9uZSIgaGVpZ2h0PSIyNCIgd2lkdGg9IjI0Ii8+CiAgICA8Zz4KICAgICAgPHBhdGggZD0iTTguOSw2LjA3TDcuNDgsNC42Nkw5LDNoNmwxLjgzLDJIMjBjMS4xLDAsMiwwLjksMiwydjEyYzAsMC4wNS0wLjAxLDAuMS0wLjAyLDAuMTZMMjAsMTcuMTdWN2gtNC4wNWwtMS44My0ySDkuODggTDguOSw2LjA3eiBNMjAuNDksMjMuMzFMMTguMTcsMjFINGMtMS4xLDAtMi0wLjktMi0yVjdjMC0wLjU5LDAuMjctMS4xMiwwLjY4LTEuNDlsLTItMkwyLjEsMi4xbDE5LjgsMTkuOEwyMC40OSwyMy4zMXogTTkuMTksMTIuMDJDOS4wOCwxMi4zMyw5LDEyLjY1LDksMTNjMCwxLjY2LDEuMzQsMywzLDNjMC4zNSwwLDAuNjctMC4wOCwwLjk4LTAuMTlMOS4xOSwxMi4wMnogTTE2LjE3LDE5bC0xLjY4LTEuNjggQzEzLjc2LDE3Ljc1LDEyLjkxLDE4LDEyLDE4Yy0yLjc2LDAtNS0yLjI0LTUtNWMwLTAuOTEsMC4yNS0xLjc2LDAuNjgtMi40OUw0LjE3LDdINHYxMkgxNi4xN3ogTTE0LjgxLDExLjk4bDIuMDcsMi4wNyBDMTYuOTYsMTMuNzEsMTcsMTMuMzYsMTcsMTNjMC0yLjc2LTIuMjQtNS01LTVjLTAuMzYsMC0wLjcxLDAuMDQtMS4wNiwwLjEybDIuMDcsMi4wN0MxMy44NSwxMC40OSwxNC41MSwxMS4xNSwxNC44MSwxMS45OHoiLz4KICAgIDwvZz4KICA8L2c+Cjwvc3ZnPg=="},Symbol.toStringTag,{value:"Module"}));e.AosHandler=ee,e.IdleTimeout=n,e.ToasterHandler=G,e.UserVisibility=r,e.WaitHandler=W,e.capitalize=k,e.currency=x,e.date=D,e.debounce=function(e,t=0,i=!1){let s,o;const n=function(){s&&(clearTimeout(s),o=void 0,s=void 0)},r=function(...r){if(!t)return e.apply(this,r);const a=this,l=i&&!s;return n(),o=function(){e.apply(a,r)},s=setTimeout((function(){if(s=void 0,!l){const e=o;if(o=void 0,void 0!==e)return e()}}),t),l?o():void 0};return r.cancel=n,r.flush=function(){const e=o;n(),e&&e()},r},e.injectStrict=i,e.installAos=te,e.installDirectives=C,e.installFilters=O,e.installToaster=Y,e.installWait=K,e.isClient=o,e.mount=s,e.number=H,e.sleep=e=>new Promise((t=>{setTimeout(t,e)})),e.theme=se,e.truthyFilter=function(e){return!!e},e.useAos=()=>({aos:i("aos")}),e.useIdleTimeout=({callback:e,options:t})=>{const i=new n(e,t);ae.value=i;return{idle:ae}},e.useInstanceUniqId=({componentName:e,instance:i,providedId:s})=>({instanceId:t.computed((()=>s??`${e}-${null==i?void 0:i.uid}`))}),e.useThemeHandler=(e=ie)=>{const i={...ie,...e};return{autoSetTheme:()=>(e=>{localStorage[e.storageThemeKey]===e.storageThemeValueDark||!(e.storageThemeKey in localStorage)&&window.matchMedia("(prefers-color-scheme: dark)").matches?oe({...e,setLocalStorageValue:!1}):ne({...e,setLocalStorageValue:!1})})(i),toggleTheme:()=>(e=>localStorage[e.storageThemeKey]===e.storageThemeValueDark?ne(e):oe(e))(i),setDarkTheme:()=>re({...i,shouldSetDarkMode:!0}),setLightTheme:()=>re({...i,shouldSetDarkMode:!1}),hasDarkTheme:t.computed((()=>se.value===i.storageThemeValueDark)),hasLightTheme:t.computed((()=>se.value===i.storageThemeValueLight)),theme:se}},e.useToast=()=>({toast:i("toast")}),e.useUserVisibility=({callback:e,options:t})=>{const i=new r(e,t);le.value=i;return{visibility:le}},e.useWait=()=>({wait:i("wait")}),e.vClickOutside=u,e.vClickOutsideInstall=m,e.vClosable=g,e.vClosableInstall=v,e.vLazyImg=M,e.vLazyImgInstall=_,e.vZoomImg=f,e.vZoomImgInstall=z,e.waitInstance=Q,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode(".m-toast-container{-webkit-box-sizing:border-box;box-sizing:border-box;position:fixed;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.m-toast-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.m-toast-container{padding:1rem;z-index:1051}.m-toast-container.--top{top:0px;display:-webkit-box;display:-ms-flexbox;display:flex}.m-toast-container.--center{width:100%}@media (min-width: 768px){.m-toast-container.--center{position:fixed;left:50%;width:auto;-webkit-transform:translate(-50%,0);transform:translate(-50%)}}.m-toast-container.--bottom{bottom:0px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse}.m-toast-container.--bottom>:not([hidden])~:not([hidden]){margin-bottom:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-top:calc(.5rem * var(--tw-space-y-reverse))}.m-toast-container.--right{right:0px;width:100%}@media (min-width: 768px){.m-toast-container.--right{width:auto}}.m-toast-container.--left{left:0px;width:100%}@media (min-width: 768px){.m-toast-container.--left{width:auto}}.m-toast[data-v-f511285d],.m-toast *[data-v-f511285d]{-webkit-box-sizing:border-box;box-sizing:border-box}.m-toast[data-v-f511285d]{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;cursor:pointer;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-ms-flex-item-align:center;align-self:center;border-radius:var(--maz-border-radius);padding-left:.5rem;padding-right:.5rem;color:var(--maz-color-white);-webkit-transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,-webkit-box-shadow,-webkit-transform,-webkit-filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,-webkit-box-shadow,-webkit-transform,-webkit-filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-box-shadow,-webkit-transform,-webkit-filter,-webkit-backdrop-filter;-webkit-transition-duration:.3s;transition-duration:.3s;-webkit-transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:cubic-bezier(.4,0,.2,1)}@media (min-width: 768px){.m-toast.--left[data-v-f511285d],.m-toast.--right[data-v-f511285d]{width:20rem}.m-toast.--center[data-v-f511285d]{width:20rem;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}}.m-toast__message-wrapper[data-v-f511285d]{-webkit-box-flex:1;-ms-flex:1 1 0%;flex:1 1 0%;padding-top:.75rem;padding-bottom:.75rem}.m-toast__message[data-v-f511285d]{margin:0;font-weight:500}.m-toast .--close[data-v-f511285d]{margin-left:.25rem;display:-webkit-box;display:-ms-flexbox;display:flex;height:1.75rem;width:1.75rem;border-radius:var(--maz-border-radius);background-color:transparent;padding:0;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.m-toast .--close[data-v-f511285d]:hover{background-color:#11182733}.m-toast .--close .--icon[data-v-f511285d]{height:1.25rem;width:1.25rem;cursor:pointer}.m-toast.--info[data-v-f511285d]{background-color:var(--maz-color-info);color:var(--maz-color-info-contrast)}.m-toast.--info[data-v-f511285d]:hover{background-color:var(--maz-color-info-600)}.m-toast.--info .--close[data-v-f511285d]{color:var(--maz-color-info-contrast)}.m-toast.--success[data-v-f511285d]{background-color:var(--maz-color-success);color:var(--maz-color-success-contrast)}.m-toast.--success[data-v-f511285d]:hover{background-color:var(--maz-color-success-600)}.m-toast.--success .--close[data-v-f511285d]{color:var(--maz-color-success-contrast)}.m-toast.--warning[data-v-f511285d]{background-color:var(--maz-color-warning);color:var(--maz-color-warning-contrast)}.m-toast.--warning[data-v-f511285d]:hover{background-color:var(--maz-color-warning-600)}.m-toast.--warning .--close[data-v-f511285d]{color:var(--maz-color-warning-contrast)}.m-toast.--danger[data-v-f511285d]{background-color:var(--maz-color-danger);color:var(--maz-color-danger-contrast)}.m-toast.--danger[data-v-f511285d]:hover{background-color:var(--maz-color-danger-600)}.m-toast.--danger .--close[data-v-f511285d]{color:var(--maz-color-danger-contrast)}.m-slide-top-enter-active[data-v-f511285d],.m-slide-top-leave-active[data-v-f511285d]{opacity:1;-webkit-transition:all .3s;transition:all .3s;-webkit-transform:translateY(0);transform:translateY(0)}.m-slide-top-enter-from[data-v-f511285d],.m-slide-top-leave-to[data-v-f511285d]{opacity:0;-webkit-transform:translateY(-100%);transform:translateY(-100%)}.m-slide-bottom-enter-active[data-v-f511285d],.m-slide-bottom-leave-active[data-v-f511285d]{opacity:1;-webkit-transition:all .3s;transition:all .3s;-webkit-transform:translateY(0);transform:translateY(0)}.m-slide-bottom-enter-from[data-v-f511285d],.m-slide-bottom-leave-to[data-v-f511285d]{opacity:0;-webkit-transform:translateY(100%);transform:translateY(100%)}.m-slide-right-enter-active[data-v-f511285d],.m-slide-right-leave-active[data-v-f511285d]{opacity:1;-webkit-transition:all .3s;transition:all .3s;-webkit-transform:translateX(0);transform:translate(0)}.m-slide-right-enter-from[data-v-f511285d],.m-slide-right-leave-to[data-v-f511285d]{opacity:0;-webkit-transform:translateX(100%);transform:translate(100%)}.m-slide-left-enter-active[data-v-f511285d],.m-slide-left-leave-active[data-v-f511285d]{opacity:1;-webkit-transition:all .3s;transition:all .3s;-webkit-transform:translateX(0);transform:translate(0)}.m-slide-left-enter-from[data-v-f511285d],.m-slide-left-leave-to[data-v-f511285d]{opacity:0;-webkit-transform:translateX(-100%);transform:translate(-100%)}")),document.head.appendChild(t)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}}();
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["maz-ui"]={},e.Vue)}(this,(function(e,t){"use strict";var s=Object.defineProperty,i=(e,t,i)=>(((e,t,i)=>{t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i})(e,"symbol"!=typeof t?t+"":t,i),i);function o(e,s){const i=t.inject(e,s);if(!i)throw new TypeError(`[maz-ui](injectStrict) Could not resolve ${e}`);return i}function n(e,{props:s,children:i,element:o,app:n}={}){let a=o;const r=t.createVNode(e,s,i);n&&n._context&&(r.appContext=n._context),a?t.render(r,a):"undefined"!=typeof document&&t.render(r,a=document.createElement("div"));return{vNode:r,destroy:()=>{a&&t.render(null,a)},el:a}}function a(){return"undefined"!=typeof document}class r{constructor(e,t){i(this,"defaultOptions",{element:void 0,timeout:3e5,once:!1,immediate:!0,ssr:!1}),i(this,"options"),i(this,"timeoutHandler"),i(this,"isIdle",!1),i(this,"isDestroy",!1),i(this,"startTime",0),i(this,"remainingTime",0),i(this,"lastClientX",-1),i(this,"lastClientY",-1),i(this,"eventNames",["DOMMouseScroll","mousedown","mousemove","mousewheel","MSPointerDown","MSPointerMove","keydown","touchmove","touchstart","wheel","click"]),i(this,"handleEvent",(e=>{try{if(this.remainingTime>0)return;if("mousemove"===e.type){const{clientX:t,clientY:s}=e;if(void 0===t&&void 0===s||t===this.lastClientX&&s===this.lastClientY)return;this.lastClientX=t,this.lastClientY=s}this.resetTimeout(),this.callback({isIdle:this.isIdle,eventType:e.type})}catch(t){throw new Error(`[IdleTimeout](handleEvent) ${t}`)}})),this.callback=e,this.options={...this.defaultOptions,...t},!this.options.ssr&&a()?this.start():this.options.ssr||a()||console.warn('[IdleTimeout](constructor) executed on server side - set immediate option to "false"')}get element(){return this.options.element??document.body}start(){if(a()){for(const e of this.eventNames)this.element.addEventListener(e,this.handleEvent);this.resetTimeout(),this.options.immediate&&this.callback({isIdle:!1})}else console.warn("[IdleTimeout](start) you should run this method on client side")}pause(){const e=this.startTime+this.options.timeout-Date.now();e<=0||(this.remainingTime=e,this.timeoutHandler&&(clearTimeout(this.timeoutHandler),this.timeoutHandler=void 0))}resume(){this.remainingTime<=0||(this.resetTimeout(),this.callback({isIdle:this.isIdle}),this.remainingTime=0)}reset(){this.isDestroy=!1,this.isIdle=!1,this.remainingTime=0,this.resetTimeout(),this.callback({isIdle:this.isIdle})}destroy(){if(a()){this.isDestroy=!0;for(const e of this.eventNames)this.element.removeEventListener(e,this.handleEvent);this.timeoutHandler&&clearTimeout(this.timeoutHandler)}else console.warn("[IdleTimeout](destroy) you should run this method on client side")}resetTimeout(){this.isIdle=!1,this.timeoutHandler&&(clearTimeout(this.timeoutHandler),this.timeoutHandler=void 0),this.timeoutHandler=setTimeout(this.handleTimeout.bind(this),this.remainingTime||this.options.timeout),this.startTime=Date.now()}handleTimeout(){this.isIdle=!0,this.callback({isIdle:this.isIdle}),this.options.once&&this.destroy()}get destroyed(){return this.isDestroy}get timeout(){return this.options.timeout}set timeout(e){this.options.timeout=e}get idle(){return this.isIdle}set idle(e){e?this.handleTimeout():this.reset(),this.callback({isIdle:this.isIdle})}}class l{constructor(e,t){i(this,"eventHandlerFunction"),i(this,"event","visibilitychange"),i(this,"timeoutHandler"),i(this,"options"),i(this,"defaultOptions",{timeout:5e3,once:!1,immediate:!0,ssr:!1}),i(this,"isVisible",!1),this.callback=e,this.options={...this.defaultOptions,...t},this.eventHandlerFunction=this.eventHandler.bind(this),!this.options.ssr&&a()?this.start():this.options.ssr||a()||console.warn('[UserVisibility](constructor) executed on server side - set "ssr" option to "false"')}start(){a()?(this.options.immediate&&this.emitCallback(),this.addEventListener()):console.warn("[UserVisibility](start) you should run this method on client side")}emitCallback(){this.isVisible="visible"===document.visibilityState,this.callback({isVisible:this.isVisible}),this.options.once&&this.destroy()}eventHandler(){"visible"!==document.visibilityState||this.isVisible?"hidden"===document.visibilityState&&this.initTimeout():(this.clearTimeout(),this.emitCallback())}clearTimeout(){this.timeoutHandler&&(clearTimeout(this.timeoutHandler),this.timeoutHandler=void 0)}initTimeout(){this.clearTimeout(),this.timeoutHandler=setTimeout(this.emitCallback.bind(this),this.options.timeout)}addEventListener(){document.addEventListener(this.event,this.eventHandlerFunction)}removeEventListener(){document.removeEventListener(this.event,this.eventHandlerFunction)}destroy(){this.removeEventListener(),this.timeoutHandler&&clearTimeout(this.timeoutHandler)}}const d="__vue_click_away__",m=()=>null===document.ontouchstart?"touchstart":"click",c=async(e,s)=>{u(e);const i=s.instance,o=s.value,n="function"==typeof o;if(!n)throw new Error("[maz-ui](vClickOutside) the callback should be a function");await t.nextTick(),e[d]=t=>{if((!e||!e.contains(t.target))&&o&&n)return o.call(i,t)};const a=m();document.addEventListener(a,e[d],!1)},u=e=>{const t=m();document.removeEventListener(t,e[d],!1),delete e[d]},h={mounted:c,updated:(e,t)=>{t.value!==t.oldValue&&c(e,t)},unmounted:u},g={install:e=>{e.directive("click-outside",h)}},p=(e,t,s,i)=>{e.stopPropagation();const{handler:o,exclude:n}=s.value;let a=!1;if(n&&n.length>0)for(const r of n)if(!a){a=i.context.$refs[r].contains(e.target)}t.contains(e.target)||a||i.context[o]()},v=()=>null===document.ontouchstart?"touchstart":"click",b={mounted:(e,t,s)=>{const i=v();document.addEventListener(i,(i=>p(i,e,t,s)))},unmounted:(e,t,s)=>{const i=v();document.removeEventListener(i,(i=>p(i,e,t,s)))}},y={install:e=>{e.directive("closable",b)}},w={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>'};class f{constructor(e){if(i(this,"options"),i(this,"loader"),i(this,"wrapper"),i(this,"img"),i(this,"keydownHandler"),i(this,"onImgLoadedCallback"),i(this,"buttonsAdded"),i(this,"defaultOptions",{scale:!0,blur:!0,disabled:!1}),i(this,"mouseEnterListener"),i(this,"mouseLeaveListener"),i(this,"renderPreviewListener"),!e.value)throw new Error('[MazUI](zoom-img) Image path must be defined. Ex: `v-zoom-img="<PATH_TO_IMAGE>"`');if("object"==typeof e.value&&!e.value.src)throw new Error("[maz-ui](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)}buildOptions(e){return{...this.defaultOptions,..."object"==typeof e.value?e.value:{src:e.value}}}get allInstances(){return[...document.querySelectorAll(".maz-zoom-img-instance")]}create(e){this.options.disabled||(e.style.cursor="pointer",setTimeout((()=>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",this.mouseEnterListener=()=>this.mouseEnter(e),this.mouseLeaveListener=()=>this.mouseLeave(e),this.renderPreviewListener=()=>this.renderPreview(e,this.options),e.addEventListener("mouseenter",this.mouseEnterListener),e.addEventListener("mouseleave",this.mouseLeaveListener),e.addEventListener("click",this.renderPreviewListener))}update(e){this.options=this.buildOptions(e)}remove(e){this.imgEventHandler(!1),e.removeEventListener("mouseenter",this.mouseEnterListener),e.removeEventListener("mouseleave",this.mouseLeaveListener),e.removeEventListener("click",this.renderPreviewListener),e.classList.remove("maz-zoom-img-instance"),e.removeAttribute("data-src"),e.removeAttribute("data-alt"),e.style.cursor=""}renderPreview(e,t){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: 1rem;\n z-index: 1050;\n background-color: hsla(238, 15%, 40%, 0.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: hsla(238, 15%, 40%, 0.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: hsla(0, 0%, 7%, 0.5);\n box-shadow: 0 0 0.5rem 0 hsla(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: hsl(0, 0%, 0%);\n}");const s=document.createElement("div");s.classList.add("maz-zoom-img"),s.setAttribute("id","MazImgPreviewFullsize"),s.addEventListener("click",(e=>{s.isEqualNode(e.target)&&this.closePreview()})),"object"==typeof t&&(this.img.setAttribute("src",t.src),t.alt&&this.img.setAttribute("alt",t.alt),this.img.id="MazImgElement"),this.wrapper.append(this.img),s.append(this.wrapper),document.body.append(s),this.keyboardEventHandler(!0),setTimeout((()=>{s&&s.classList.add("maz-animate")}),100)}onImgLoaded(){this.wrapper.style.width=`${this.img.width}px`,this.wrapper.style.minWidth="200px",this.loader.hidden=!0;const e=this.getButton(),t=[],s=this.allInstances.length>1;if(!this.buttonsAdded){if(this.buttonsAdded=!0,s){const e=this.getButton("previous"),s=this.getButton("next");t.push(e,s)}this.wrapper.append(e),s&&(this.wrapper.prepend(t[0]),this.wrapper.append(t[1]))}}getLoader(){const e=document.createElement("div");return e.classList.add("maz-zoom-img__loader"),e.innerHTML=w.spinner,e}mouseLeave(e){this.options.scale&&(e.style.transform=""),this.options.blur&&(e.style.filter=""),e.style.zIndex=""}mouseEnter(e){e.style.zIndex="1",this.options.scale&&(e.style.transform="scale(1.1)"),this.options.blur&&(e.style.filter="blur(2px)")}keydownLister(e){e.preventDefault(),"Escape"!==e.key&&" "!==e.key||this.closePreview(),"ArrowLeft"!==e.key&&"ArrowRight"!==e.key||this.nextPreviousImage("ArrowRight"===e.key)}getButton(e="close"){const t=document.createElement("button");return t.innerHTML=w[e],t.addEventListener("click",(()=>{"close"===e?this.closePreview():this.allInstances&&this.nextPreviousImage("next"===e)})),t.classList.add("maz-zoom-btn"),t.classList.add(`maz-zoom-btn--${e}`),t}closePreview(){const e=document.querySelector("#MazImgPreviewFullsize"),t=document.querySelector("#MazPreviewStyle"),s=document.querySelector(".maz-zoom-img-instance.maz-is-open");s&&s.classList.remove("maz-is-open"),e&&e.classList.remove("maz-animate"),this.keyboardEventHandler(!1),setTimeout((()=>{e&&e.remove(),t&&t.remove()}),300)}getNewInstanceIndex(e){return e<0?this.allInstances.length-1:e>=this.allInstances.length?0:e}nextPreviousImage(e){const t=e,s=document.querySelector(".maz-zoom-img-instance.maz-is-open");if(s){const e=this.allInstances.indexOf(s),i=t?e+1:e-1,o=this.allInstances[this.getNewInstanceIndex(i)];o&&this.useNextInstance(s,o)}}useNextInstance(e,t){e.classList.remove("maz-is-open"),t.classList.add("maz-is-open");const s=t.getAttribute("data-src"),i=t.getAttribute("data-alt");this.wrapper.style.width="",this.loader.hidden=!1,s&&this.img.setAttribute("src",s),i&&this.img.setAttribute("alt",i)}addStyle(e){const t=document.createElement("style");t.id="MazPreviewStyle",t.textContent=e,document.head.append(t)}keyboardEventHandler(e){if(e)return document.addEventListener("keydown",this.keydownHandler);document.removeEventListener("keydown",this.keydownHandler)}imgEventHandler(e){if(e)return this.img.addEventListener("load",this.onImgLoadedCallback);this.img.removeEventListener("load",this.onImgLoadedCallback)}}let z;const L={created(e,t){z=new f(t),z.create(e)},updated(e,t){z.update(t)},unmounted(e){z.remove(e)}},I={install(e){e.directive("zoom-img",L)}},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}};class M{constructor(e={}){i(this,"observers",[]),i(this,"defaultOptions",T),i(this,"options"),i(this,"onImgLoadedCallback"),i(this,"onImgErrorCallback"),i(this,"hasImgLoaded",!1),this.options=this.buildOptions(e),this.onImgLoadedCallback=this.imageIsLoaded.bind(this),this.onImgErrorCallback=this.imageHasError.bind(this)}async loadErrorPhoto(){const{default:e}=await Promise.resolve().then((()=>ce));return e}buildOptions(e){return{...this.defaultOptions,...e,observerOptions:{...this.defaultOptions.observerOptions,...e.observerOptions}}}removeClass(e,t){e.classList.remove(t)}addClass(e,t){e.classList.add(t)}removeAllStateClasses(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)}setBaseClass(e){this.addClass(e,this.options.baseClass)}imageIsLoading(e){var t,s;this.addClass(e,this.options.loadingClass),null==(s=(t=this.options).onLoading)||s.call(t,e)}imageHasNoPhoto(e){this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.noPhotoClass),this.setDefaultPhoto(e)}imageIsLoaded(e){var t,s;this.hasImgLoaded=!0,this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.loadedClass),null==(s=(t=this.options).onLoaded)||s.call(t,e)}imageHasError(e,t){var s,i;console.warn("[maz-ui][MazLazyImg] Error while loading image",t),this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.errorClass),null==(i=(s=this.options).onError)||i.call(s,e),this.setDefaultPhoto(e)}getImageUrl(e,t){const s=this.getImgElement(e).getAttribute("data-src");if(s)return s;const i="object"==typeof t.value?t.value.src:t.value;return i||console.warn("[maz-ui][MazLazyImg] src url is not defined"),i}async setPictureSourceUrls(e){const t=e.querySelectorAll("source");if(t.length>0)for await(const s of t){const e=s.getAttribute("data-srcset");e?s.srcset=e:console.warn('[maz-ui][MazLazyImg] the "[data-srcset]" attribute is not provided on "<source />"')}else console.warn('[maz-ui][MazLazyImg] No "<source />" elements provided into the "<picture />" element'),this.imageHasError(e)}hasBgImgMode(e){return"bg-image"===e.arg}isPictureElement(e){return e instanceof HTMLPictureElement}getImgElement(e){return this.isPictureElement(e)?e.querySelector("img"):e}async setDefaultPhoto(e){if(this.options.noUseErrorPhoto)return;const t=this.options.errorPhoto??await this.loadErrorPhoto(),s=e.querySelectorAll("source");if(s.length>0)for await(const i of s)i.srcset=t;else this.setImgSrc(e,t)}addEventListenerToImg(e){const t=this.getImgElement(e);t.addEventListener("load",(()=>this.onImgLoadedCallback(e)),{once:!0}),t.addEventListener("error",(t=>this.onImgErrorCallback(e,t)),{once:!0})}async loadImage(e,t){if(this.imageIsLoading(e),this.isPictureElement(e))this.addEventListenerToImg(e),await this.setPictureSourceUrls(e);else{const s=this.getImageUrl(e,t);if(!s)return this.imageHasError(e);this.hasBgImgMode(t)?(e.style.backgroundImage=`url('${s}')`,this.imageIsLoaded(e)):(this.addEventListenerToImg(e),this.setImgSrc(e,s))}}setImgSrc(e,t){this.getImgElement(e).src=t}handleIntersectionObserver(e,t,s,i){var o,n;this.observers.push(i);for(const a of s)if(a.isIntersecting){if(null==(n=(o=this.options).onIntersecting)||n.call(o,a.target),this.options.observerOnce&&i.unobserve(e),this.options.loadOnce&&this.hasImgLoaded)return;this.loadImage(e,t)}}createObserver(e,t){const s=this.options.observerOptions;new IntersectionObserver(((s,i)=>{this.handleIntersectionObserver(e,t,s,i)}),s).observe(e)}async imageHandler(e,t,s){if("update"===s)for await(const i of this.observers)i.unobserve(e);window.IntersectionObserver?this.createObserver(e,t):this.loadImage(e,t)}async bindUpdateHandler(e,t,s){if(this.options.noPhoto)return this.imageHasNoPhoto(e);await this.imageHandler(e,t,s)}async add(e,t){if(this.hasBgImgMode(t)&&this.isPictureElement(e))throw new Error('[MazLazyImg] You can\'t use the "bg-image" mode with "<picture />" element');setTimeout((()=>this.setBaseClass(e)),0),e.getAttribute("src")||this.setImgSrc(e,"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"),await this.bindUpdateHandler(e,t,"bind")}async update(e,t){t.value!==t.oldValue&&(this.hasImgLoaded=!1,this.removeAllStateClasses(e),await this.bindUpdateHandler(e,t,"update"))}remove(e,t){this.hasImgLoaded=!1,this.hasBgImgMode(t)&&(e.style.backgroundImage=""),this.removeAllStateClasses(e);for(const s of this.observers)s.unobserve(e);this.observers=[]}}let E;const C={created(e,t){const s="object"==typeof t.value?t.value:{};E=new M(s),E.add(e,t)},updated(e,t){E.update(e,t)},unmounted(e,t){E.remove(e,t)}},A={install(e,t={}){const s={...T,...t,observerOptions:{...T.observerOptions,...t.observerOptions}},i=new M(s);e.directive("lazy-img",{created:i.add.bind(i),updated:i.update.bind(i),unmounted:i.remove.bind(i)})}},k=[{name:"click-outside",directive:h},{name:"closable",directive:b},{name:"zoom-img",directive:L},{name:"lazy-img",directive:C}],x={install(e){for(const{name:t,directive:s}of k)e.directive(t,s)}},S=e=>e?(e=e.toString()).charAt(0).toUpperCase()+e.slice(1):"",D={style:"currency",minimumFractionDigits:2,round:!1},N=(e,t,s)=>{const i={...D,...s};((e,t,s)=>{if(void 0===e)throw new TypeError("[maz-ui](FilterCurrency) The `number` attribute is required.");if(void 0===t)throw new TypeError("[maz-ui](FilterCurrency) The `locale` attribute is required.");if("string"!=typeof t)throw new TypeError("[maz-ui](FilterCurrency) The `locale` attribute must be a string.");if(void 0===s.currency)throw new TypeError("[maz-ui](FilterCurrency) The `options.currency` attribute is required.")})(e,t,i);try{return((e,t,s)=>{let i=Number(e);return s.round&&(i=Math.floor(i),s.minimumFractionDigits=0),new Intl.NumberFormat(t,s).format(i)})(e,t,i)}catch(o){throw new Error(`[maz-ui](FilterCurrency) ${o}`)}},H={month:"short",day:"numeric",year:"numeric"},O=(e,t,s)=>{if(void 0===t)throw new TypeError("[maz-ui](FilterDate) The `locale` attribute is required.");if("string"!=typeof t)throw new TypeError("[maz-ui](FilterDate) The `locale` attribute must be a string.");const i=s??H;try{const s=e instanceof Date?e:new Date(e);return new Intl.DateTimeFormat(t,i).format(s)}catch(o){throw new Error(`[maz-ui](FilterDate) ${o}`)}},j={minimumFractionDigits:2},P=(e,t,s)=>{const i={...j,...s};if(void 0===e)throw new TypeError("[maz-ui](FilterNumber) The `number` attribute is required.");if(void 0===t)throw new TypeError("[maz-ui](FilterNumber) The `locale` attribute is required.");if("string"!=typeof t)throw new TypeError("[maz-ui](FilterNumber) The `locale` attribute must be a string.");try{return new Intl.NumberFormat(t,i).format(Number(e))}catch(o){throw new Error(`[maz-ui](FilterNumber) ${o}`)}},_={capitalize:S,currency:N,date:O,number:P},V={install(e){e.provide("filters",_)}};class B{constructor(e,t){i(this,"callback"),i(this,"delay"),i(this,"timer"),i(this,"startedAt"),this.startedAt=Date.now(),this.callback=e,this.delay=t,this.start()}pause(){this.stop(),this.delay-=Date.now()-this.startedAt}resume(){this.startedAt=Date.now(),this.start()}start(){this.timer=setTimeout(this.callback,this.delay)}stop(){clearTimeout(this.timer)}}const F=["innerHTML"],q=t.defineComponent({__name:"MazIcon",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:e=>e}},emits:["loaded","unloaded","error"],setup(e,{emit:s}){const i=e,n={},a=t.ref(),r=t.ref(),l=t.computed((()=>i.path??(()=>{try{return o("mazIconPath")}catch{return}})())),d=t.computed((()=>i.src?i.src:l.value?`${l.value}/${i.name}.svg`:`/${i.name}.svg`));t.onMounted((()=>{i.name||i.src||console.error('[maz-ui](MazIcon) you should provide "name" or "src" as prop')}));const m=e=>{const t={},s=e.attributes;if(!s)return t;for(let i=s.length-1;i>=0;i--)t[s[i].name]=s[i].value;return t},c=e=>{let t=e.cloneNode(!0);return t=i.transformSource(e),i.title&&((e,t)=>{const s=e.querySelectorAll("title");if(s.length>0)s[0].textContent=t;else{const s=document.createElementNS("http://www.w3.org/2000/svg","title");s.textContent=t,e.append(s)}})(t,i.title),e.innerHTML},u=e=>new Promise(((t,s)=>{const o=new XMLHttpRequest;o.open("GET",e,!0),o.addEventListener("load",(()=>{if(o.status>=200&&o.status<400)try{const e=new DOMParser;let n=e.parseFromString(o.responseText,"text/xml").querySelectorAll("svg")[0];n?(n=i.transformSource(n),t(n)):s(new Error('Loaded file is not valid SVG"'))}catch(e){s(e)}else s(new Error("Error loading SVG"))})),o.addEventListener("error",(()=>s())),o.send()}));return t.watchEffect((()=>(async e=>{n[e]||(n[e]=u(e));try{a.value=await n[e],await t.nextTick(),s("loaded",r.value)}catch(i){a.value&&(a.value=void 0,s("unloaded")),delete n[e],s("error",i)}})(d.value))),(s,i)=>{return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createCommentVNode(" eslint-disable vue/no-v-html "),t.createCommentVNode(" eslint-disable vue/html-self-closing "),a.value?(t.openBlock(),t.createElementBlock("svg",t.mergeProps({key:0,ref_key:"svgElem",ref:r,width:"1em",height:"1em"},{...m(a.value),...(o=s.$attrs,Object.keys(o).reduce(((e,t)=>(!1!==o[t]&&null!==o[t]&&void 0!==o[t]&&(e[t]=o[t]),e)),{}))},{style:`font-size: ${e.size}`,innerHTML:c(a.value)}),null,16,F)):t.createCommentVNode("v-if",!0),t.createCommentVNode(" eslint-enable vue/no-v-html "),t.createCommentVNode(" eslint-enable vue/html-self-closing ")],2112);var o}}}),Z={class:"m-toast__message-wrapper"},$={class:"m-toast__message"},U={key:0,class:"--close"},G=((e,t)=>{const s=e.__vccOpts||e;for(const[i,o]of t)s[i]=o;return s})(t.defineComponent({__name:"MazToast",props:{position:{type:String,default:"bottom-right"},maxToasts:{type:[Number,Boolean],default:!1},timeout:{type:Number,default:1e4},queue:{type:Boolean,default:!1},noPauseOnHover:{type:Boolean,default:!1},type:{type:String,default:"info",validator:e=>["info","success","warning","danger"].includes(e)},message:{type:String,required:!0},persistent:{type:Boolean,default:!1}},emits:["close","click"],setup(e,{emit:s}){const i=e,o=t.ref(),n=t.computed((()=>i.position.includes("top")?"top":"bottom")),a=t.computed((()=>i.position.includes("left")?"left":i.position.includes("right")?"right":"center")),r=t.computed((()=>"center"!==a.value?"right"===a.value?"m-slide-right":"m-slide-left":"top"===n.value?"m-slide-top":"m-slide-bottom")),l=t.ref(!1),d=t.ref(),m=t.ref(),c=`m-toast-container --${n.value} --${a.value}`,u=`.${c.replaceAll(" ",".")}`,h=()=>{if((()=>{const e=document.querySelector(u);return!(!i.queue&&!1===i.maxToasts)&&(!1!==i.maxToasts&&e?i.maxToasts<=e.childElementCount:e&&e.childElementCount>0)})())return void(m.value=setTimeout(h,250));const e=document.querySelector(u);o.value&&e&&e.prepend(o.value),l.value=!0,d.value=i.timeout?new B(p,i.timeout):void 0};const g=e=>{d.value&&!i.noPauseOnHover&&(e?d.value.pause():d.value.resume())},p=()=>{d.value&&d.value.stop(),m.value&&clearTimeout(m.value),l.value=!1,setTimeout((()=>{var e;s("close"),null==(e=o.value)||e.remove();const t=document.querySelector(u);t&&!(null==t?void 0:t.hasChildNodes())&&t.remove()}),300)};return t.onMounted((()=>{(()=>{const e=document.querySelector(u);if(!e&&!e){const e=document.body,t=document.createElement("div");t.className=c,e.append(t)}})(),h()})),(d,m)=>(t.openBlock(),t.createBlock(t.Transition,{name:t.unref(r),persisted:""},{default:t.withCtx((()=>[t.withDirectives(t.createElementVNode("div",{ref_key:"Toaster",ref:o,class:t.normalizeClass(["m-toast",[`--${e.type}`,`--${t.unref(n)}`,`--${t.unref(a)}`]]),role:"alert",onMouseover:m[0]||(m[0]=e=>g(!0)),onMouseleave:m[1]||(m[1]=e=>g(!1)),onClick:m[2]||(m[2]=e=>(s("click",e),void(i.persistent||p())))},[t.createElementVNode("div",Z,[t.createElementVNode("p",$,t.toDisplayString(e.message),1)]),e.persistent?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock("button",U,[t.createVNode(q,{src:t.unref("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIGFyaWEtaGlkZGVuPSJ0cnVlIj4KICA8cGF0aCBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMiIgZD0iTTYgMThMMTggNk02IDZsMTIgMTIiLz4KPC9zdmc+Cg=="),class:"--icon"},null,8,["src"])]))],34),[[t.vShow,l.value]])])),_:1},8,["name"]))}}),[["__scopeId","data-v-f511285d"]]);class Y{constructor(e,t){this.app=e,this.globalOptions=t}show(e,t){const s={...{message:e,...t},...this.globalOptions,...t};n(G,{props:s,app:this.app})}getLocalOptions(e,t){return{type:e,...t}}success(e,t){return this.show(e,this.getLocalOptions("success",t))}error(e,t){return this.show(e,this.getLocalOptions("danger",t))}info(e,t){return this.show(e,this.getLocalOptions("info",t))}warning(e,t){return this.show(e,this.getLocalOptions("warning",t))}}const W={position:"bottom-right",timeout:1e4,persistent:!0};e.toastInstance=void 0;const R={install(t,s){e.toastInstance=new Y(t,{...W,...s}),t.provide("toast",e.toastInstance)}};class K{constructor(){i(this,"_loaders",t.ref([]))}get loaders(){return t.computed((()=>this._loaders.value))}stop(e=""){var t;this._loaders.value=(t=this._loaders.value,(e="")=>t.filter((t=>t!==e)))(e)}start(e=""){var t;return this._loaders.value=(t=this._loaders.value,(e="")=>(e=>e.filter(((e,t,s)=>t===s.indexOf(e))))([...t,e]))(e),()=>this.stop(e)}get anyLoading(){return t.computed((()=>this._loaders.value.length>0))}isLoading(e=""){return t.computed((()=>{return(t=this._loaders.value,(e="")=>"function"==typeof e?t.findIndex(((...t)=>e(...t)))>-1:t.includes(e))(e);var t})).value}}const Q=new K,J={install:e=>{e.provide("wait",Q)}},X=100,ee={root:void 0,rootMargin:"0px",threshold:.2},te={once:!0,duration:300};class se{constructor(e){i(this,"options"),this.options={delay:(null==e?void 0:e.delay)??X,observer:{...ee,...null==e?void 0:e.observer},animation:{...te,...null==e?void 0:e.animation}}}runAnimations(){if(a())return this.handleObserver();console.warn("[MazAos](runAnimations) should be executed on client side")}async handleObserver(){var e;await(e=this.options.delay,new Promise((t=>setTimeout(t,e))));const t=new IntersectionObserver(this.handleIntersect.bind(this),{...this.options.observer});for(const s of document.querySelectorAll("[data-maz-aos]")){const e=s.getAttribute("data-maz-aos-anchor");if(e){const s=document.querySelector(e);s?(s.setAttribute("data-maz-aos-children","true"),t.observe(s)):console.warn(`[maz-ui](aos) no element found with selector "${e}"`)}else t.observe(s)}}handleIntersect(e,t){for(const s of e){const e="true"===s.target.getAttribute("data-maz-aos-children"),i=s.target.getAttribute("data-maz-aos")?[s.target]:[];if(e){const e=[...document.querySelectorAll("[data-maz-aos-anchor]")].map((e=>e.getAttribute("data-maz-aos-anchor")===`#${s.target.id}`?e:void 0));for(const t of e)t&&i.push(t)}for(const o of i){const e=o.getAttribute("data-maz-aos-once"),i="string"==typeof e?"true"===e:this.options.animation.once;if(s.intersectionRatio>this.options.observer.threshold){o.getAttribute("data-maz-aos-duration")||(o.style.transitionDuration=`${this.options.animation.duration}ms`,setTimeout((()=>{o.style.transitionDuration="0"}),1e3)),o.classList.add("maz-aos-animate"),i&&t.unobserve(o)}else o.classList.remove("maz-aos-animate")}}}}e.aosInstance=void 0;const ie={install:(t,s)=>{e.aosInstance=new se(s),t.provide("aos",e.aosInstance),a()&&((null==s?void 0:s.router)?s.router.afterEach((async()=>{e.aosInstance.runAnimations()})):e.aosInstance.runAnimations())}},oe={darkClass:"dark",storageThemeKey:"theme",storageThemeValueDark:"dark",storageThemeValueLight:"light"},ne=t.ref(),ae=({darkClass:e,storageThemeKey:t,storageThemeValueDark:s,setLocalStorageValue:i=!0})=>{document.documentElement.classList.add(e),ne.value=s,i&&(localStorage[t]=s)},re=({darkClass:e,storageThemeKey:t,storageThemeValueLight:s,setLocalStorageValue:i=!0})=>{document.documentElement.classList.remove(e),ne.value=s,i&&(localStorage[t]=s)},le=({shouldSetDarkMode:e,...t})=>e?ae(t):re(t),de=t.ref(),me=t.ref(),ce=Object.freeze(Object.defineProperty({__proto__:null,default:"data:image/svg+xml;base64,PHN2ZwogIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICB2aWV3Qm94PSIwIDAgMjQgMjQiCiAgc3Ryb2tlPSJub25lIgogIGZpbGw9ImN1cnJlbnRDb2xvciIKICBhcmlhLWhpZGRlbj0idHJ1ZSIKPgogIDxnPgogICAgPHJlY3QgZmlsbD0ibm9uZSIgaGVpZ2h0PSIyNCIgd2lkdGg9IjI0IiAvPgogICAgPGc+CiAgICAgIDxwYXRoCiAgICAgICAgZD0iTTguOSw2LjA3TDcuNDgsNC42Nkw5LDNoNmwxLjgzLDJIMjBjMS4xLDAsMiwwLjksMiwydjEyYzAsMC4wNS0wLjAxLDAuMS0wLjAyLDAuMTZMMjAsMTcuMTdWN2gtNC4wNWwtMS44My0ySDkuODggTDguOSw2LjA3eiBNMjAuNDksMjMuMzFMMTguMTcsMjFINGMtMS4xLDAtMi0wLjktMi0yVjdjMC0wLjU5LDAuMjctMS4xMiwwLjY4LTEuNDlsLTItMkwyLjEsMi4xbDE5LjgsMTkuOEwyMC40OSwyMy4zMXogTTkuMTksMTIuMDJDOS4wOCwxMi4zMyw5LDEyLjY1LDksMTNjMCwxLjY2LDEuMzQsMywzLDNjMC4zNSwwLDAuNjctMC4wOCwwLjk4LTAuMTlMOS4xOSwxMi4wMnogTTE2LjE3LDE5bC0xLjY4LTEuNjggQzEzLjc2LDE3Ljc1LDEyLjkxLDE4LDEyLDE4Yy0yLjc2LDAtNS0yLjI0LTUtNWMwLTAuOTEsMC4yNS0xLjc2LDAuNjgtMi40OUw0LjE3LDdINHYxMkgxNi4xN3ogTTE0LjgxLDExLjk4bDIuMDcsMi4wNyBDMTYuOTYsMTMuNzEsMTcsMTMuMzYsMTcsMTNjMC0yLjc2LTIuMjQtNS01LTVjLTAuMzYsMC0wLjcxLDAuMDQtMS4wNiwwLjEybDIuMDcsMi4wN0MxMy44NSwxMC40OSwxNC41MSwxMS4xNSwxNC44MSwxMS45OHoiCiAgICAgIC8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"},Symbol.toStringTag,{value:"Module"}));e.AosHandler=se,e.IdleTimeout=r,e.ToasterHandler=Y,e.UserVisibility=l,e.WaitHandler=K,e.capitalize=S,e.currency=N,e.date=O,e.debounce=function(e,t=0,s=!1){let i,o;const n=function(){i&&(clearTimeout(i),o=void 0,i=void 0)},a=function(...a){if(!t)return e.apply(this,a);const r=this,l=s&&!i;return n(),o=function(){e.apply(r,a)},i=setTimeout((function(){if(i=void 0,!l){const e=o;if(o=void 0,void 0!==e)return e()}}),t),l?o():void 0};return a.cancel=n,a.flush=function(){const e=o;n(),e&&e()},a},e.injectStrict=o,e.installAos=ie,e.installDirectives=x,e.installFilters=V,e.installToaster=R,e.installWait=J,e.isClient=a,e.mount=n,e.number=P,e.sleep=e=>new Promise((t=>{setTimeout(t,e)})),e.theme=ne,e.truthyFilter=function(e){return!!e},e.useAos=()=>({aos:o("aos")}),e.useIdleTimeout=({callback:e,options:t})=>{const s=new r(e,t);de.value=s;return{idle:de}},e.useInstanceUniqId=({componentName:e,instance:s,providedId:i})=>({instanceId:t.computed((()=>i??`${e}-${null==s?void 0:s.uid}`))}),e.useThemeHandler=(e=oe)=>{const s={...oe,...e};return{autoSetTheme:()=>(e=>{localStorage[e.storageThemeKey]===e.storageThemeValueDark||!(e.storageThemeKey in localStorage)&&window.matchMedia("(prefers-color-scheme: dark)").matches?ae({...e,setLocalStorageValue:!1}):re({...e,setLocalStorageValue:!1})})(s),toggleTheme:()=>(e=>localStorage[e.storageThemeKey]===e.storageThemeValueDark?re(e):ae(e))(s),setDarkTheme:()=>le({...s,shouldSetDarkMode:!0}),setLightTheme:()=>le({...s,shouldSetDarkMode:!1}),hasDarkTheme:t.computed((()=>ne.value===s.storageThemeValueDark)),hasLightTheme:t.computed((()=>ne.value===s.storageThemeValueLight)),theme:ne}},e.useToast=()=>({toast:o("toast")}),e.useUserVisibility=({callback:e,options:t})=>{const s=new l(e,t);me.value=s;return{visibility:me}},e.useWait=()=>({wait:o("wait")}),e.vClickOutside=h,e.vClickOutsideInstall=g,e.vClosable=b,e.vClosableInstall=y,e.vLazyImg=C,e.vLazyImgInstall=A,e.vZoomImg=L,e.vZoomImgInstall=I,e.waitInstance=Q,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maz-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "A standalone components library for Vue.Js 3 & Nuxt.Js 3",
|
|
5
5
|
"author": "Louis Mazel <me@loicmazuel.com>",
|
|
6
6
|
"main": "modules/maz-ui.umd.js",
|
|
@@ -15,40 +15,10 @@
|
|
|
15
15
|
"tailwindcss/utils",
|
|
16
16
|
"tailwindcss/variables"
|
|
17
17
|
],
|
|
18
|
-
"scripts": {
|
|
19
|
-
"lint": "npm run lint:js && npm run lint:style",
|
|
20
|
-
"lint:nofix": "cross-env NODE_ENV=production eslint --ext .ts,.js,.vue .",
|
|
21
|
-
"lint:js": "cross-env NODE_ENV=production eslint --fix --ext .ts,.js,.vue .",
|
|
22
|
-
"format": "prettier . --write",
|
|
23
|
-
"lint:style": "stylelint --custom-syntax postcss-html --fix \"./**/*.{vue,css,scss,postcss,pcss}\"",
|
|
24
|
-
"clean": "rimraf dist types",
|
|
25
|
-
"emit-types": "vue-tsc --declaration --emitDeclarationOnly",
|
|
26
|
-
"build": "npm run clean && mkdir -p dist && npm run build:js && npm run build:css && cp package.json dist/package.json && npm run copy:tailwind",
|
|
27
|
-
"build:watch": "onchange --await-write-finish 2000 'package/**/*' -e 'package/components/index.ts' --exclude-path .gitignore -- npm run build:modules",
|
|
28
|
-
"build:lib": "ts-node build/vite.config.ts",
|
|
29
|
-
"build:js": "npm run build:gen-components-entry && npm run build:lib && npm run emit-types && npm run build:file-types && npm run build:copy-comp-types && npm run build:components-entry",
|
|
30
|
-
"build:css": "npm run build:tailwind && npm run build:scss",
|
|
31
|
-
"build:scss": "ts-node build/compile-scss.ts",
|
|
32
|
-
"build:tailwind": "tailwindcss -i package/tailwindcss/css/tailwind.css -o dist/css/main.css --config tailwind.config.js --postcss --minify",
|
|
33
|
-
"copy:tailwind": "cp -R package/tailwindcss dist/tailwindcss",
|
|
34
|
-
"build:modules": "npm run build:lib -- --package modules",
|
|
35
|
-
"build:component": "npm run build:lib -- --component",
|
|
36
|
-
"build:components": "npm run build:lib -- --package components",
|
|
37
|
-
"build:file-types": "rollup --config build/rollup.types.config.ts --configPlugin @rollup/plugin-typescript",
|
|
38
|
-
"build:copy-comp-types": "ts-node build/copy-components-types.ts",
|
|
39
|
-
"build:components-entry": "ts-node build/build-components-entry.ts",
|
|
40
|
-
"build:gen-components-entry": "ts-node build/generate-components-entry.ts",
|
|
41
|
-
"test:unit": "vitest",
|
|
42
|
-
"test:unit:watch": "vitest watch",
|
|
43
|
-
"test:unit:coverage": "vitest run --coverage",
|
|
44
|
-
"test:unit:coverage:watch": "vitest watch --coverage",
|
|
45
|
-
"test:unit:coverage:master": "vitest run --coverage --changed master",
|
|
46
|
-
"pre-commit": "lint-staged"
|
|
47
|
-
},
|
|
48
18
|
"lint-staged": {
|
|
49
19
|
"*": "prettier -w -u",
|
|
50
20
|
"*.{js,ts,vue}": "cross-env NODE_ENV=production eslint --fix",
|
|
51
|
-
"*.{vue,css,scss,postcss,pcss}": "stylelint --
|
|
21
|
+
"*.{vue,css,scss,postcss,pcss}": "stylelint --fix"
|
|
52
22
|
},
|
|
53
23
|
"peerDependencies": {
|
|
54
24
|
"chart.js": "^3.0.0",
|
|
@@ -76,17 +46,18 @@
|
|
|
76
46
|
}
|
|
77
47
|
},
|
|
78
48
|
"devDependencies": {
|
|
49
|
+
"@babel/core": "^7.21.0",
|
|
79
50
|
"@babel/preset-env": "^7.20.2",
|
|
80
51
|
"@babel/preset-typescript": "^7.18.6",
|
|
81
52
|
"@rollup/plugin-typescript": "^11.0.0",
|
|
82
53
|
"@types/dropzone": "^5.7.4",
|
|
83
54
|
"@types/google.maps": "^3.51.0",
|
|
84
|
-
"@types/node": "^18.
|
|
55
|
+
"@types/node": "^18.14.6",
|
|
85
56
|
"@types/rollup-plugin-peer-deps-external": "^2.2.1",
|
|
86
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
87
|
-
"@typescript-eslint/parser": "^5.
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^5.49.0",
|
|
58
|
+
"@typescript-eslint/parser": "^5.49.0",
|
|
88
59
|
"@vitejs/plugin-vue": "^4.0.0",
|
|
89
|
-
"@vitest/coverage-c8": "^0.
|
|
60
|
+
"@vitest/coverage-c8": "^0.29.2",
|
|
90
61
|
"@vue/compiler-sfc": "^3.2.39",
|
|
91
62
|
"@vue/eslint-config-prettier": "^7.0.0",
|
|
92
63
|
"@vue/eslint-config-typescript": "^11.0.1",
|
|
@@ -99,16 +70,17 @@
|
|
|
99
70
|
"cross-env": "^7.0.3",
|
|
100
71
|
"dayjs": "^1.11.7",
|
|
101
72
|
"dropzone": "^6.0.0-beta.2",
|
|
102
|
-
"eslint": "^8.
|
|
73
|
+
"eslint": "^8.32.0",
|
|
103
74
|
"eslint-plugin-prettier": "^4.2.1",
|
|
104
75
|
"eslint-plugin-sonarjs": "^0.18.0",
|
|
105
|
-
"eslint-plugin-unicorn": "^
|
|
76
|
+
"eslint-plugin-unicorn": "^46.0.0",
|
|
106
77
|
"eslint-plugin-vue": "^9.9.0",
|
|
107
78
|
"fs": "0.0.2",
|
|
108
|
-
"jsdom": "^21.
|
|
79
|
+
"jsdom": "^21.1.0",
|
|
109
80
|
"json-templater": "^1.2.0",
|
|
110
81
|
"libphonenumber-js": "^1.10.18",
|
|
111
|
-
"lint-staged": "^13.1.
|
|
82
|
+
"lint-staged": "^13.1.2",
|
|
83
|
+
"minimist": "^1.2.8",
|
|
112
84
|
"onchange": "^7.1.0",
|
|
113
85
|
"path": "^0.12.7",
|
|
114
86
|
"postcss": "^8.4.21",
|
|
@@ -117,11 +89,11 @@
|
|
|
117
89
|
"postcss-nested": "^6.0.0",
|
|
118
90
|
"postcss-simple-vars": "^7.0.1",
|
|
119
91
|
"postcss-url": "^10.1.3",
|
|
120
|
-
"prettier": "^2.8.
|
|
121
|
-
"prettier-plugin-tailwindcss": "^0.2.
|
|
92
|
+
"prettier": "^2.8.3",
|
|
93
|
+
"prettier-plugin-tailwindcss": "^0.2.2",
|
|
122
94
|
"replace-in-file": "^6.3.5",
|
|
123
|
-
"rimraf": "^4.
|
|
124
|
-
"rollup": "^3.
|
|
95
|
+
"rimraf": "^4.1.2",
|
|
96
|
+
"rollup": "^3.11.0",
|
|
125
97
|
"rollup-plugin-dts": "^5.1.1",
|
|
126
98
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
127
99
|
"sass": "^1.57.1",
|
|
@@ -138,8 +110,10 @@
|
|
|
138
110
|
"ts-node": "^10.9.1",
|
|
139
111
|
"typescript": "^4.9.4",
|
|
140
112
|
"vite": "^4.0.4",
|
|
141
|
-
"vite-plugin-css-injected-by-js": "^
|
|
142
|
-
"
|
|
113
|
+
"vite-plugin-css-injected-by-js": "^3.0.1",
|
|
114
|
+
"vite-plugin-static-copy": "^0.13.1",
|
|
115
|
+
"vite-svg-loader": "^4.0.0",
|
|
116
|
+
"vitest": "^0.29.2",
|
|
143
117
|
"vitest-canvas-mock": "^0.2.2",
|
|
144
118
|
"vue": "^3.2.45",
|
|
145
119
|
"vue-loader": "^17.0.1",
|
|
@@ -157,6 +131,7 @@
|
|
|
157
131
|
"homepage": "https://louismazel.github.io/maz-ui-3/",
|
|
158
132
|
"keywords": [
|
|
159
133
|
"vue",
|
|
134
|
+
"nuxt",
|
|
160
135
|
"components",
|
|
161
136
|
"vue-component",
|
|
162
137
|
"framework",
|
|
@@ -167,5 +142,19 @@
|
|
|
167
142
|
"type": "git",
|
|
168
143
|
"url": "git+https://github.com/LouisMazel/maz-ui.git"
|
|
169
144
|
},
|
|
170
|
-
"license": "MIT"
|
|
171
|
-
|
|
145
|
+
"license": "MIT",
|
|
146
|
+
"scripts": {
|
|
147
|
+
"lint": "npm run lint:js && npm run lint:style",
|
|
148
|
+
"lint:nofix": "cross-env NODE_ENV=production eslint --ext .ts,.js,.vue .",
|
|
149
|
+
"lint:js": "cross-env NODE_ENV=production eslint --fix --ext .ts,.js,.vue .",
|
|
150
|
+
"lint:style": "stylelint --fix \"./**/*.{vue,css,scss,postcss,pcss}\"",
|
|
151
|
+
"format": "prettier . --write",
|
|
152
|
+
"build": "ts-node build/vite.config.ts",
|
|
153
|
+
"test:unit": "vitest",
|
|
154
|
+
"test:unit:watch": "vitest watch",
|
|
155
|
+
"test:unit:coverage": "vitest run --coverage",
|
|
156
|
+
"test:unit:coverage:watch": "vitest watch --coverage",
|
|
157
|
+
"test:unit:coverage:master": "vitest run --coverage --changed master",
|
|
158
|
+
"pre-commit": "lint-staged"
|
|
159
|
+
}
|
|
160
|
+
}
|
package/components/index.umd.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/* Automatically generated by './build/build-components-entry.js' */
|
|
2
|
-
|
|
3
|
-
export { default as MazAvatar } from './MazAvatar.umd.js'
|
|
4
|
-
export { default as MazBackdrop } from './MazBackdrop.umd.js'
|
|
5
|
-
export { default as MazBadge } from './MazBadge.umd.js'
|
|
6
|
-
export { default as MazBottomSheet } from './MazBottomSheet.umd.js'
|
|
7
|
-
export { default as MazBtn } from './MazBtn.umd.js'
|
|
8
|
-
export { default as MazCard } from './MazCard.umd.js'
|
|
9
|
-
export { default as MazCarousel } from './MazCarousel.umd.js'
|
|
10
|
-
export { default as MazChart } from './MazChart.umd.js'
|
|
11
|
-
export { default as MazCheckbox } from './MazCheckbox.umd.js'
|
|
12
|
-
export { default as MazDialog } from './MazDialog.umd.js'
|
|
13
|
-
export { default as MazDialogPromise } from './MazDialogPromise.umd.js'
|
|
14
|
-
export { default as MazDrawer } from './MazDrawer.umd.js'
|
|
15
|
-
export { default as MazDropzone } from './MazDropzone.umd.js'
|
|
16
|
-
export { default as MazGallery } from './MazGallery.umd.js'
|
|
17
|
-
export { default as MazIcon } from './MazIcon.umd.js'
|
|
18
|
-
export { default as MazInput } from './MazInput.umd.js'
|
|
19
|
-
export { default as MazInputNumber } from './MazInputNumber.umd.js'
|
|
20
|
-
export { default as MazInputPrice } from './MazInputPrice.umd.js'
|
|
21
|
-
export { default as MazInputTags } from './MazInputTags.umd.js'
|
|
22
|
-
export { default as MazLazyImg } from './MazLazyImg.umd.js'
|
|
23
|
-
export { default as MazPhoneNumberInput } from './MazPhoneNumberInput.umd.js'
|
|
24
|
-
export { default as MazPicker } from './MazPicker.umd.js'
|
|
25
|
-
export { default as MazRadioButtons } from './MazRadioButtons.umd.js'
|
|
26
|
-
export { default as MazSelect } from './MazSelect.umd.js'
|
|
27
|
-
export { default as MazSlider } from './MazSlider.umd.js'
|
|
28
|
-
export { default as MazSpinner } from './MazSpinner.umd.js'
|
|
29
|
-
export { default as MazStepper } from './MazStepper.umd.js'
|
|
30
|
-
export { default as MazSwitch } from './MazSwitch.umd.js'
|
|
31
|
-
export { default as MazTabsBar } from './MazTabsBar.umd.js'
|
|
32
|
-
export { default as MazTabsContent } from './MazTabsContent.umd.js'
|
|
33
|
-
export { default as MazTabsContentItem } from './MazTabsContentItem.umd.js'
|
|
34
|
-
export { default as MazTextarea } from './MazTextarea.umd.js'
|
|
35
|
-
export { default as MazTransitionExpand } from './MazTransitionExpand.umd.js'
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const no_photo = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDI0IDI0IiBoZWlnaHQ9IjQ4cHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjQ4cHgiIGZpbGw9IiNjZGNkY2QiPgogIDxnPgogICAgPHJlY3QgZmlsbD0ibm9uZSIgaGVpZ2h0PSIyNCIgd2lkdGg9IjI0Ii8+CiAgICA8Zz4KICAgICAgPHBhdGggZD0iTTguOSw2LjA3TDcuNDgsNC42Nkw5LDNoNmwxLjgzLDJIMjBjMS4xLDAsMiwwLjksMiwydjEyYzAsMC4wNS0wLjAxLDAuMS0wLjAyLDAuMTZMMjAsMTcuMTdWN2gtNC4wNWwtMS44My0ySDkuODggTDguOSw2LjA3eiBNMjAuNDksMjMuMzFMMTguMTcsMjFINGMtMS4xLDAtMi0wLjktMi0yVjdjMC0wLjU5LDAuMjctMS4xMiwwLjY4LTEuNDlsLTItMkwyLjEsMi4xbDE5LjgsMTkuOEwyMC40OSwyMy4zMXogTTkuMTksMTIuMDJDOS4wOCwxMi4zMyw5LDEyLjY1LDksMTNjMCwxLjY2LDEuMzQsMywzLDNjMC4zNSwwLDAuNjctMC4wOCwwLjk4LTAuMTlMOS4xOSwxMi4wMnogTTE2LjE3LDE5bC0xLjY4LTEuNjggQzEzLjc2LDE3Ljc1LDEyLjkxLDE4LDEyLDE4Yy0yLjc2LDAtNS0yLjI0LTUtNWMwLTAuOTEsMC4yNS0xLjc2LDAuNjgtMi40OUw0LjE3LDdINHYxMkgxNi4xN3ogTTE0LjgxLDExLjk4bDIuMDcsMi4wNyBDMTYuOTYsMTMuNzEsMTcsMTMuMzYsMTcsMTNjMC0yLjc2LTIuMjQtNS01LTVjLTAuMzYsMC0wLjcxLDAuMDQtMS4wNiwwLjEybDIuMDcsMi4wN0MxMy44NSwxMC40OSwxNC41MSwxMS4xNSwxNC44MSwxMS45OHoiLz4KICAgIDwvZz4KICA8L2c+Cjwvc3ZnPg==";
|
|
2
|
-
export {
|
|
3
|
-
no_photo as default
|
|
4
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const no_photo = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDI0IDI0IiBoZWlnaHQ9IjQ4cHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjQ4cHgiIGZpbGw9IiNjZGNkY2QiPgogIDxnPgogICAgPHJlY3QgZmlsbD0ibm9uZSIgaGVpZ2h0PSIyNCIgd2lkdGg9IjI0Ii8+CiAgICA8Zz4KICAgICAgPHBhdGggZD0iTTguOSw2LjA3TDcuNDgsNC42Nkw5LDNoNmwxLjgzLDJIMjBjMS4xLDAsMiwwLjksMiwydjEyYzAsMC4wNS0wLjAxLDAuMS0wLjAyLDAuMTZMMjAsMTcuMTdWN2gtNC4wNWwtMS44My0ySDkuODggTDguOSw2LjA3eiBNMjAuNDksMjMuMzFMMTguMTcsMjFINGMtMS4xLDAtMi0wLjktMi0yVjdjMC0wLjU5LDAuMjctMS4xMiwwLjY4LTEuNDlsLTItMkwyLjEsMi4xbDE5LjgsMTkuOEwyMC40OSwyMy4zMXogTTkuMTksMTIuMDJDOS4wOCwxMi4zMyw5LDEyLjY1LDksMTNjMCwxLjY2LDEuMzQsMywzLDNjMC4zNSwwLDAuNjctMC4wOCwwLjk4LTAuMTlMOS4xOSwxMi4wMnogTTE2LjE3LDE5bC0xLjY4LTEuNjggQzEzLjc2LDE3Ljc1LDEyLjkxLDE4LDEyLDE4Yy0yLjc2LDAtNS0yLjI0LTUtNWMwLTAuOTEsMC4yNS0xLjc2LDAuNjgtMi40OUw0LjE3LDdINHYxMkgxNi4xN3ogTTE0LjgxLDExLjk4bDIuMDcsMi4wNyBDMTYuOTYsMTMuNzEsMTcsMTMuMzYsMTcsMTNjMC0yLjc2LTIuMjQtNS01LTVjLTAuMzYsMC0wLjcxLDAuMDQtMS4wNiwwLjEybDIuMDcsMi4wN0MxMy44NSwxMC40OSwxNC41MSwxMS4xNSwxNC44MSwxMS45OHoiLz4KICAgIDwvZz4KICA8L2c+Cjwvc3ZnPg==";
|
|
2
|
-
export {
|
|
3
|
-
no_photo as default
|
|
4
|
-
};
|