maz-ui 4.7.5 → 4.7.6
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/dist/chunks/MazAccordion.CKnz73h4.js +1 -0
- package/dist/chunks/MazAlert.B8hE7wet.js +1 -0
- package/dist/chunks/MazAnimatedCounter.GLLYbZAz.js +1 -0
- package/dist/chunks/MazAnimatedElement._8NY8WgC.js +1 -0
- package/dist/chunks/MazAnimatedText.BSZ8FNf-.js +1 -0
- package/dist/chunks/MazAvatar.vO5VNPi8.js +1 -0
- package/dist/chunks/MazBackdrop.Cjbwi8-V.js +1 -0
- package/dist/chunks/MazBadge.BBZJgHXm.js +1 -0
- package/dist/chunks/MazBottomSheet.WgZ6qobx.js +1 -0
- package/dist/chunks/MazBtn.Cc9C1v2l.js +1 -0
- package/dist/chunks/MazBtnGroup.3B1XcqWM.js +1 -0
- package/dist/chunks/MazCard.YYC0LaHY.js +1 -0
- package/dist/chunks/MazCardSpotlight.SpZF61hl.js +1 -0
- package/dist/chunks/MazCarousel.1NT4jcvR.js +1 -0
- package/dist/chunks/MazChart.CDZ2PBTC.js +1 -0
- package/dist/chunks/MazCheckbox.DurIbKdf.js +1 -0
- package/dist/chunks/MazChecklist.D9ezwGpQ.js +1 -0
- package/dist/chunks/MazCircularProgressBar.rATx_hD9.js +1 -0
- package/dist/chunks/MazContainer.zXcfMOs-.js +1 -0
- package/dist/chunks/MazDatePicker.KUP34cbV.js +1 -0
- package/dist/chunks/MazDialog.CtKF3Xzo.js +1 -0
- package/dist/chunks/MazDialogConfirm.CAAHeBPE.js +1 -0
- package/dist/chunks/MazDrawer.Dc_RGG8a.js +1 -0
- package/dist/chunks/MazDropdown.2DUcivzO.js +1 -0
- package/dist/chunks/MazDropzone.CiWiPcFM.js +1 -0
- package/dist/chunks/MazExpandAnimation.CMMwtuQA.js +1 -0
- package/dist/chunks/MazFullscreenLoader.BIVRcZJ8.js +1 -0
- package/dist/chunks/MazGallery.CEmGy0K9.js +1 -0
- package/dist/chunks/MazIcon.ZWAk25ZX.js +1 -0
- package/dist/chunks/MazInput.DJjWLaKg.js +1 -0
- package/dist/chunks/MazInputCode.DKnl3i-X.js +1 -0
- package/dist/chunks/MazInputNumber.B42Mn-9h.js +1 -0
- package/dist/chunks/MazInputPhoneNumber.CLivThtK.js +1 -0
- package/dist/chunks/MazInputPrice.BeL-M944.js +1 -0
- package/dist/chunks/MazInputTags.CIVT9F6Q.js +1 -0
- package/dist/chunks/MazLazyImg.-EMwandx.js +1 -0
- package/dist/chunks/MazLink.BOpxMATj.js +1 -0
- package/dist/chunks/MazLoadingBar.C86AX2Tk.js +1 -0
- package/dist/chunks/MazPagination.CNNKXBsg.js +1 -0
- package/dist/chunks/MazPickerCalendarDays.CSZZbk5Z.js +1 -0
- package/dist/chunks/MazPickerCalendarGrid.DrUHBH6-.js +1 -0
- package/dist/chunks/MazPickerContainer.BZ74M74V.js +1 -0
- package/dist/chunks/MazPopover.Co8BEopX.js +1 -0
- package/dist/chunks/MazPullToRefresh.DMtb6Oa3.js +1 -0
- package/dist/chunks/MazRadio.75ipjTw2.js +1 -0
- package/dist/chunks/MazRadioButtons.DenHCgB3.js +1 -0
- package/dist/chunks/MazReadMore.CDXacQIw.js +1 -0
- package/dist/chunks/MazReadingProgressBar.828Y0mxA.js +1 -0
- package/dist/chunks/MazSelect.yYFAbBb5.js +1 -0
- package/dist/chunks/MazSelectCountry.DvVgk2es.js +1 -0
- package/dist/chunks/MazSkeleton.BewTYJC2.js +1 -0
- package/dist/chunks/MazSlider.BS5QHWK6.js +1 -0
- package/dist/chunks/MazSpinner.D3NN2pow.js +1 -0
- package/dist/chunks/MazStepper.DTu8HG9T.js +1 -0
- package/dist/chunks/MazSwitch.Dvmj-rTW.js +1 -0
- package/dist/chunks/MazTable.DnOehvN6.js +1 -0
- package/dist/chunks/MazTableCell.xbm2NGWL.js +1 -0
- package/dist/chunks/MazTableRow.B5dJiXk1.js +1 -0
- package/dist/chunks/MazTableTitle.DNA_1mCy.js +1 -0
- package/dist/chunks/MazTabs.-0-YP3QQ.js +1 -0
- package/dist/chunks/MazTabsBar.D2JVKMS7.js +1 -0
- package/dist/chunks/MazTabsContent.C9omK25X.js +1 -0
- package/dist/chunks/MazTabsContentItem.mJEAS5R8.js +1 -0
- package/dist/chunks/MazTextarea.BliEP5G5.js +1 -0
- package/dist/chunks/MazUiProvider.BgN8V0lD.js +1 -0
- package/dist/chunks/_plugin-vue_export-helper.ChmETRGw.js +1 -0
- package/dist/chunks/dialog.DexeIC3K.js +1 -0
- package/dist/chunks/dom-events.BPrKJiCz.js +1 -0
- package/dist/chunks/resolveLinkComponent.DAc3sqGH.js +1 -0
- package/dist/chunks/toast.UQ8RRuT9.js +1 -0
- package/dist/chunks/types.DDbvTVqf.js +1 -0
- package/dist/chunks/useMazInputPhoneNumber.B_qQ0ldP.js +1 -0
- package/dist/chunks/utils.B8bfGQxN.js +1 -0
- package/dist/chunks/vFullscreenImg.CZeRh3mw.js +1 -0
- package/dist/chunks/vLazyImg.CXmd3Lp0.js +1 -0
- package/dist/chunks/vZoomImg.CaAHb98S.js +124 -0
- package/dist/components/MazAccordion.js +1 -86
- package/dist/components/MazAlert.js +1 -85
- package/dist/components/MazAnimatedCounter.js +1 -73
- package/dist/components/MazAnimatedElement.js +1 -44
- package/dist/components/MazAnimatedText.js +1 -103
- package/dist/components/MazAvatar.js +1 -125
- package/dist/components/MazBackdrop.js +1 -163
- package/dist/components/MazBadge.js +1 -29
- package/dist/components/MazBottomSheet.js +1 -55
- package/dist/components/MazBtn.js +1 -109
- package/dist/components/MazBtnGroup.js +1 -44
- package/dist/components/MazCard.js +1 -184
- package/dist/components/MazCardSpotlight.js +1 -81
- package/dist/components/MazCarousel.js +1 -104
- package/dist/components/MazChart.js +1 -4
- package/dist/components/MazCheckbox.js +1 -128
- package/dist/components/MazChecklist.js +1 -133
- package/dist/components/MazCircularProgressBar.js +1 -131
- package/dist/components/MazContainer.js +1 -71
- package/dist/components/MazDatePicker/MazPickerCalendar.js +1 -113
- package/dist/components/MazDatePicker/MazPickerCalendarMonth/MazPickerCalendarDays.js +1 -19
- package/dist/components/MazDatePicker/MazPickerCalendarMonth/MazPickerCalendarGrid.js +1 -181
- package/dist/components/MazDatePicker/MazPickerCalendarMonth/MazPickerCalendarMonth.js +1 -75
- package/dist/components/MazDatePicker/MazPickerCalendarSwitcher.js +1 -90
- package/dist/components/MazDatePicker/MazPickerContainer.js +1 -116
- package/dist/components/MazDatePicker/MazPickerHeader.js +1 -126
- package/dist/components/MazDatePicker/MazPickerMonthSwitcher.js +1 -82
- package/dist/components/MazDatePicker/MazPickerShortcuts.js +1 -55
- package/dist/components/MazDatePicker/MazPickerTime.js +1 -178
- package/dist/components/MazDatePicker/MazPickerYearSwitcher.js +1 -95
- package/dist/components/MazDatePicker.js +1 -466
- package/dist/components/MazDatePicker.vue.d.ts +2 -6
- package/dist/components/MazDialog.js +1 -115
- package/dist/components/MazDialog.vue.d.ts +2 -6
- package/dist/components/MazDialogConfirm.js +1 -6
- package/dist/components/MazDialogConfirm.vue.d.ts +2 -6
- package/dist/components/MazDrawer.js +1 -70
- package/dist/components/MazDropdown.js +1 -277
- package/dist/components/MazDropdown.vue.d.ts +2 -6
- package/dist/components/MazDropzone.js +1 -533
- package/dist/components/MazExpandAnimation.js +1 -46
- package/dist/components/MazFullscreenLoader.js +1 -38
- package/dist/components/MazGallery.js +1 -105
- package/dist/components/MazIcon.js +1 -114
- package/dist/components/MazInput.js +1 -256
- package/dist/components/MazInputCode.js +1 -152
- package/dist/components/MazInputNumber.js +1 -152
- package/dist/components/MazInputPhoneNumber/PhoneInput.js +1 -114
- package/dist/components/MazInputPhoneNumber.js +1 -253
- package/dist/components/MazInputPrice.js +1 -4
- package/dist/components/MazInputTags.js +1 -145
- package/dist/components/MazLazyImg.js +1 -62
- package/dist/components/MazLink.js +1 -80
- package/dist/components/MazLoadingBar.js +1 -24
- package/dist/components/MazPagination.js +1 -184
- package/dist/components/MazPopover.js +1 -326
- package/dist/components/MazPullToRefresh.js +1 -145
- package/dist/components/MazRadio.js +1 -103
- package/dist/components/MazRadioButtons.js +1 -135
- package/dist/components/MazReadMore.js +1 -110
- package/dist/components/MazReadingProgressBar.js +1 -68
- package/dist/components/MazSelect.js +1 -413
- package/dist/components/MazSelectCountry.js +1 -192
- package/dist/components/MazSkeleton.js +1 -50
- package/dist/components/MazSlider.js +1 -205
- package/dist/components/MazSpinner.js +1 -27
- package/dist/components/MazStepper.js +1 -170
- package/dist/components/MazSwitch.js +1 -4
- package/dist/components/MazTable.js +1 -8
- package/dist/components/MazTableCell.js +1 -18
- package/dist/components/MazTableRow.js +1 -26
- package/dist/components/MazTableTitle.js +1 -18
- package/dist/components/MazTabs.js +1 -4
- package/dist/components/MazTabsBar.js +1 -138
- package/dist/components/MazTabsContent.js +1 -4
- package/dist/components/MazTabsContentItem.js +1 -37
- package/dist/components/MazTextarea.js +1 -147
- package/dist/components/MazUiProvider.js +1 -4
- package/dist/components/index.js +1 -127
- package/dist/composables/index.js +1 -44
- package/dist/composables/useAos.js +1 -7
- package/dist/composables/useBreakpoints.js +1 -34
- package/dist/composables/useDialog.js +1 -7
- package/dist/composables/useDisplayNames.js +1 -111
- package/dist/composables/useDropzone.js +1 -66
- package/dist/composables/useFormField.js +1 -101
- package/dist/composables/useFormValidator.js +1 -163
- package/dist/composables/useFreezeValue.js +1 -8
- package/dist/composables/useIdleTimeout.js +1 -10
- package/dist/composables/useInjectStrict.js +1 -10
- package/dist/composables/useInstanceUniqId.js +1 -12
- package/dist/composables/useMountComponent.js +1 -16
- package/dist/composables/useMutationObserver.js +1 -37
- package/dist/composables/useReadingTime.js +1 -33
- package/dist/composables/useStringMatching.js +1 -42
- package/dist/composables/useSwipe.js +1 -26
- package/dist/composables/useTimer.js +1 -36
- package/dist/composables/useToast.js +1 -14
- package/dist/composables/useUserVisibility.js +1 -10
- package/dist/composables/useWait.js +1 -7
- package/dist/composables/useWindowSize.js +1 -21
- package/dist/directives/index.js +1 -19
- package/dist/directives/vClickOutside.js +1 -104
- package/dist/directives/vFullscreenImg.js +1 -10
- package/dist/directives/vLazyImg.js +1 -23
- package/dist/directives/vTooltip.js +1 -161
- package/dist/directives/vZoomImg.js +1 -286
- package/dist/index.js +1 -1
- package/dist/plugins/aos.js +1 -89
- package/dist/plugins/dialog.js +1 -61
- package/dist/plugins/index.js +1 -17
- package/dist/plugins/maz-ui.js +1 -11
- package/dist/plugins/toast.js +1 -261
- package/dist/plugins/wait.js +1 -43
- package/dist/resolvers/MazComponentsResolver.js +1 -18
- package/dist/resolvers/MazDirectivesResolver.js +1 -14
- package/dist/resolvers/MazModulesResolver.js +1 -76
- package/dist/resolvers/index.js +1 -8
- package/dist/tailwindcss/index.js +1 -20
- package/dist/tailwindcss/tailwind.config.js +1 -35
- package/dist/tailwindcss/utils/colors.js +1 -25
- package/dist/tailwindcss/variables/breakpoints.js +1 -29
- package/dist/tailwindcss/variables/colors.js +1 -33
- package/dist/tailwindcss/variables/design-tokens.js +1 -42
- package/dist/tailwindcss/variables/utilities.js +1 -20
- package/dist/tailwindcss/variables/z-indexes.js +1 -17
- package/package.json +12 -13
- package/dist/chunks/MazChart.vue_vue_type_script_setup_true_lang.DpG9UYdm.js +0 -50
- package/dist/chunks/MazDialogConfirm.vue_vue_type_script_setup_true_lang.BB2rYkwY.js +0 -215
- package/dist/chunks/MazInputPrice.vue_vue_type_script_setup_true_lang.DcNkyw1C.js +0 -77
- package/dist/chunks/MazSwitch.vue_vue_type_style_index_0_lang.lYfYsI0R.js +0 -84
- package/dist/chunks/MazTable.vue_vue_type_script_setup_true_lang.ycpSYFvJ.js +0 -517
- package/dist/chunks/MazTabs.vue_vue_type_script_setup_true_lang.CiIFxs7J.js +0 -28
- package/dist/chunks/MazTabsContent.vue_vue_type_script_setup_true_lang.MO7zA8LZ.js +0 -26
- package/dist/chunks/MazUiProvider.vue_vue_type_script_setup_true_lang.DtnM1DOn.js +0 -34
- package/dist/chunks/_plugin-vue_export-helper.B--vMWp3.js +0 -9
- package/dist/chunks/dom-events.DTx6Kblx.js +0 -368
- package/dist/chunks/fullscreen-img.directive.BJieSSIt.js +0 -321
- package/dist/chunks/lazy-img.directive.GRfYbidn.js +0 -174
- package/dist/chunks/resolveLinkComponent.CKR2McYy.js +0 -8
- package/dist/chunks/types.D0Bp_UhS.js +0 -6
- package/dist/chunks/useMazInputPhoneNumber.Os-2y9bz.js +0 -157
- package/dist/chunks/utils.D89Q5cCP.js +0 -207
- /package/dist/assets/{fullscreen-img.DFp1SMPU.css → vFullscreenImg.DFp1SMPU.css} +0 -0
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
function useWait() {
|
|
3
|
-
return useInjectStrict("mazWait", void 0, "[maz-ui](useWait) WaitPlugin is not installed");
|
|
4
|
-
}
|
|
5
|
-
export {
|
|
6
|
-
useWait
|
|
7
|
-
};
|
|
1
|
+
import{useInjectStrict}from"./useInjectStrict.js";function useWait(){return useInjectStrict(`mazWait`,void 0,`[maz-ui](useWait) WaitPlugin is not installed`)}export{useWait};
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ref, onMounted, onUnmounted } from "vue";
|
|
3
|
-
function useWindowSize(options = {}) {
|
|
4
|
-
const {
|
|
5
|
-
internalWindow = isClient() ? globalThis : void 0,
|
|
6
|
-
initialWidth = Number.POSITIVE_INFINITY,
|
|
7
|
-
initialHeight = Number.POSITIVE_INFINITY,
|
|
8
|
-
includeScrollbar = !0
|
|
9
|
-
} = options, width = ref(initialWidth), height = ref(initialHeight);
|
|
10
|
-
function update() {
|
|
11
|
-
internalWindow && (includeScrollbar ? (width.value = internalWindow.innerWidth, height.value = internalWindow.innerHeight) : (width.value = internalWindow.document.documentElement.clientWidth, height.value = internalWindow.document.documentElement.clientHeight));
|
|
12
|
-
}
|
|
13
|
-
return update(), onMounted(() => {
|
|
14
|
-
internalWindow && internalWindow.addEventListener("resize", update, { passive: !0 });
|
|
15
|
-
}), onUnmounted(() => {
|
|
16
|
-
internalWindow && internalWindow.removeEventListener("resize", update);
|
|
17
|
-
}), { width, height };
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
useWindowSize
|
|
21
|
-
};
|
|
1
|
+
import{onMounted,onUnmounted,ref}from"vue";import{isClient}from"@maz-ui/utils/helpers/isClient";function useWindowSize(options={}){let{internalWindow=isClient()?globalThis:void 0,initialWidth=1/0,initialHeight=1/0,includeScrollbar=!0}=options;let width=ref(initialWidth);let height=ref(initialHeight);function update(){internalWindow&&(includeScrollbar?(width.value=internalWindow.innerWidth,height.value=internalWindow.innerHeight):(width.value=internalWindow.document.documentElement.clientWidth,height.value=internalWindow.document.documentElement.clientHeight))}return update(),onMounted(()=>{internalWindow&&internalWindow.addEventListener(`resize`,update,{passive:!0})}),onUnmounted(()=>{internalWindow&&internalWindow.removeEventListener(`resize`,update)}),{width,height}}export{useWindowSize};
|
package/dist/directives/index.js
CHANGED
|
@@ -1,19 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { vFullscreenImgInstall } from "./vFullscreenImg.js";
|
|
3
|
-
import { vLazyImgInstall } from "./vLazyImg.js";
|
|
4
|
-
import { vTooltip, vTooltipInstall } from "./vTooltip.js";
|
|
5
|
-
import { vZoomImg, vZoomImgInstall } from "./vZoomImg.js";
|
|
6
|
-
import { d } from "../chunks/fullscreen-img.directive.BJieSSIt.js";
|
|
7
|
-
import { d as d2 } from "../chunks/lazy-img.directive.GRfYbidn.js";
|
|
8
|
-
export {
|
|
9
|
-
vClickOutside,
|
|
10
|
-
vClickOutsideInstall,
|
|
11
|
-
d as vFullscreenImg,
|
|
12
|
-
vFullscreenImgInstall,
|
|
13
|
-
d2 as vLazyImg,
|
|
14
|
-
vLazyImgInstall,
|
|
15
|
-
vTooltip,
|
|
16
|
-
vTooltipInstall,
|
|
17
|
-
vZoomImg,
|
|
18
|
-
vZoomImgInstall
|
|
19
|
-
};
|
|
1
|
+
import"../chunks/MazSpinner.D3NN2pow.js";import{vClickOutside as directive,vClickOutsideInstall as plugin}from"./vClickOutside.js";import"../chunks/MazPopover.Co8BEopX.js";import{n as directive$2,t as plugin$2}from"../chunks/vLazyImg.CXmd3Lp0.js";import{n as directive$1,t as plugin$1}from"../chunks/vFullscreenImg.CZeRh3mw.js";import{n as vZoomImg,t as plugin$4}from"../chunks/vZoomImg.CaAHb98S.js";import{vTooltip as directive$3,vTooltipInstall as plugin$3}from"./vTooltip.js";export{directive as vClickOutside,plugin as vClickOutsideInstall,directive$1 as vFullscreenImg,plugin$1 as vFullscreenImgInstall,directive$2 as vLazyImg,plugin$2 as vLazyImgInstall,directive$3 as vTooltip,plugin$3 as vTooltipInstall,vZoomImg,plugin$4 as vZoomImgInstall};
|
|
@@ -1,104 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { nextTick } from "vue";
|
|
3
|
-
const eventHandlers = /* @__PURE__ */ new WeakMap();
|
|
4
|
-
function getEventType() {
|
|
5
|
-
return isServer() ? "click" : document.ontouchstart === null ? "touchstart" : "click";
|
|
6
|
-
}
|
|
7
|
-
function isOptionsObject(value) {
|
|
8
|
-
return typeof value == "object" && value !== null && "callback" in value;
|
|
9
|
-
}
|
|
10
|
-
function getOptionsFromBinding(binding) {
|
|
11
|
-
const value = binding.value;
|
|
12
|
-
return isOptionsObject(value) ? {
|
|
13
|
-
ignore: [],
|
|
14
|
-
capture: !1,
|
|
15
|
-
once: !1,
|
|
16
|
-
stopPropagation: !1,
|
|
17
|
-
...value
|
|
18
|
-
} : {
|
|
19
|
-
callback: value,
|
|
20
|
-
ignore: [],
|
|
21
|
-
capture: !1,
|
|
22
|
-
once: !1,
|
|
23
|
-
stopPropagation: !1
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function shouldIgnoreElement(target, ignoreSelectors) {
|
|
27
|
-
return isServer() ? !1 : ignoreSelectors.some((selector) => {
|
|
28
|
-
try {
|
|
29
|
-
if (target.matches && target.matches(selector) || target.closest && target.closest(selector) !== null)
|
|
30
|
-
return !0;
|
|
31
|
-
const excludedElement = document.querySelector(selector);
|
|
32
|
-
if (excludedElement) {
|
|
33
|
-
const elementId = excludedElement.getAttribute("id");
|
|
34
|
-
if (elementId && target instanceof HTMLElement && target.getAttribute("id") === elementId || excludedElement.contains(target))
|
|
35
|
-
return !0;
|
|
36
|
-
}
|
|
37
|
-
return !1;
|
|
38
|
-
} catch {
|
|
39
|
-
return !1;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
async function onMounted(el, binding) {
|
|
44
|
-
if (!isServer())
|
|
45
|
-
try {
|
|
46
|
-
onUnmounted(el);
|
|
47
|
-
const vm = binding.instance, options = getOptionsFromBinding(binding), { callback, ignore = [], capture = !1, once = !1, stopPropagation = !1 } = options, isCallbackFunction = typeof callback == "function";
|
|
48
|
-
if (!isCallbackFunction)
|
|
49
|
-
throw new Error("[maz-ui](vClickOutside) the callback should be a function");
|
|
50
|
-
await nextTick();
|
|
51
|
-
const eventHandler = (event) => {
|
|
52
|
-
stopPropagation && event.stopPropagation();
|
|
53
|
-
const target = event.target;
|
|
54
|
-
if (!target || !el)
|
|
55
|
-
return;
|
|
56
|
-
const isOutside = !el.contains(target), shouldIgnore = ignore.length > 0 && shouldIgnoreElement(target, ignore);
|
|
57
|
-
if (isOutside && !shouldIgnore && callback && isCallbackFunction)
|
|
58
|
-
return callback.call(vm, event);
|
|
59
|
-
};
|
|
60
|
-
eventHandlers.set(el, eventHandler);
|
|
61
|
-
const eventType = getEventType(), eventOptions = {
|
|
62
|
-
passive: !0,
|
|
63
|
-
capture,
|
|
64
|
-
once
|
|
65
|
-
};
|
|
66
|
-
document.addEventListener(eventType, eventHandler, eventOptions);
|
|
67
|
-
} catch (error) {
|
|
68
|
-
console.error("[maz-ui](vClickOutside)", error);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function onUnmounted(el) {
|
|
72
|
-
if (!isServer())
|
|
73
|
-
try {
|
|
74
|
-
const eventHandler = eventHandlers.get(el);
|
|
75
|
-
if (eventHandler) {
|
|
76
|
-
const eventType = getEventType();
|
|
77
|
-
document.removeEventListener(eventType, eventHandler, !1), eventHandlers.delete(el);
|
|
78
|
-
}
|
|
79
|
-
} catch (error) {
|
|
80
|
-
console.error("[maz-ui](vClickOutside)", error);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function onUpdated(el, binding) {
|
|
84
|
-
try {
|
|
85
|
-
if (binding.value === binding.oldValue)
|
|
86
|
-
return;
|
|
87
|
-
onMounted(el, binding);
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.error("[maz-ui](vClickOutside)", error);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
const directive = {
|
|
93
|
-
mounted: onMounted,
|
|
94
|
-
updated: onUpdated,
|
|
95
|
-
unmounted: onUnmounted
|
|
96
|
-
}, plugin = {
|
|
97
|
-
install: (app) => {
|
|
98
|
-
app.directive("click-outside", directive);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
export {
|
|
102
|
-
directive as vClickOutside,
|
|
103
|
-
plugin as vClickOutsideInstall
|
|
104
|
-
};
|
|
1
|
+
import{nextTick}from"vue";import{isServer}from"@maz-ui/utils/helpers/isServer";var eventHandlers=new WeakMap;function getEventType(){return isServer()?`click`:document.ontouchstart===null?`touchstart`:`click`}function isOptionsObject(value){return typeof value==`object`&&!!value&&`callback`in value}function getOptionsFromBinding(binding){let value=binding.value;return isOptionsObject(value)?{ignore:[],capture:!1,once:!1,stopPropagation:!1,...value}:{callback:value,ignore:[],capture:!1,once:!1,stopPropagation:!1}}function shouldIgnoreElement(target,ignoreSelectors){return isServer()?!1:ignoreSelectors.some(selector=>{try{if(target.matches&&target.matches(selector)||target.closest&&target.closest(selector)!==null)return!0;let excludedElement=document.querySelector(selector);if(excludedElement){let elementId=excludedElement.getAttribute(`id`);if(elementId&&target instanceof HTMLElement&&target.getAttribute(`id`)===elementId||excludedElement.contains(target))return!0}return!1}catch{return!1}})}async function onMounted$1(el,binding){if(!isServer())try{onUnmounted$1(el);let vm=binding.instance;let{callback,ignore=[],capture=!1,once=!1,stopPropagation=!1}=getOptionsFromBinding(binding);let isCallbackFunction=typeof callback==`function`;if(!isCallbackFunction)throw Error(`[maz-ui](vClickOutside) the callback should be a function`);await nextTick();let eventHandler=event=>{stopPropagation&&event.stopPropagation();let target=event.target;if(!target||!el)return;let isOutside=!el.contains(target);let shouldIgnore=ignore.length>0&&shouldIgnoreElement(target,ignore);if(isOutside&&!shouldIgnore&&callback&&isCallbackFunction)return callback.call(vm,event)};eventHandlers.set(el,eventHandler);let eventType=getEventType();document.addEventListener(eventType,eventHandler,{passive:!0,capture,once})}catch(error){console.error(`[maz-ui](vClickOutside)`,error)}}function onUnmounted$1(el){if(!isServer())try{let eventHandler=eventHandlers.get(el);if(eventHandler){let eventType=getEventType();document.removeEventListener(eventType,eventHandler,!1),eventHandlers.delete(el)}}catch(error){console.error(`[maz-ui](vClickOutside)`,error)}}function onUpdated(el,binding){try{if(binding.value===binding.oldValue)return;onMounted$1(el,binding)}catch(error){console.error(`[maz-ui](vClickOutside)`,error)}}var directive={mounted:onMounted$1,updated:onUpdated,unmounted:onUnmounted$1};var plugin={install:app=>{app.directive(`click-outside`,directive)}};export{directive as vClickOutside,plugin as vClickOutsideInstall};
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
const plugin = {
|
|
3
|
-
install(app) {
|
|
4
|
-
app.directive("fullscreen-img", directive);
|
|
5
|
-
}
|
|
6
|
-
};
|
|
7
|
-
export {
|
|
8
|
-
directive as vFullscreenImg,
|
|
9
|
-
plugin as vFullscreenImgInstall
|
|
10
|
-
};
|
|
1
|
+
import"../chunks/MazSpinner.D3NN2pow.js";import{n as directive,t as plugin}from"../chunks/vFullscreenImg.CZeRh3mw.js";export{directive as vFullscreenImg,plugin as vFullscreenImgInstall};
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { d } from "../chunks/lazy-img.directive.GRfYbidn.js";
|
|
3
|
-
const plugin = {
|
|
4
|
-
install(app, opts = {}) {
|
|
5
|
-
const options = {
|
|
6
|
-
...DEFAULT_OPTIONS,
|
|
7
|
-
...opts,
|
|
8
|
-
observerOptions: {
|
|
9
|
-
...DEFAULT_OPTIONS.observerOptions,
|
|
10
|
-
...opts.observerOptions
|
|
11
|
-
}
|
|
12
|
-
}, instance = new LazyImg(options);
|
|
13
|
-
app.directive("lazy-img", {
|
|
14
|
-
created: instance.add.bind(instance),
|
|
15
|
-
updated: instance.update.bind(instance),
|
|
16
|
-
unmounted: instance.remove.bind(instance)
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
d as vLazyImg,
|
|
22
|
-
plugin as vLazyImgInstall
|
|
23
|
-
};
|
|
1
|
+
import{n as directive,t as plugin}from"../chunks/vLazyImg.CXmd3Lp0.js";export{directive as vLazyImg,plugin as vLazyImgInstall};
|
|
@@ -1,161 +1 @@
|
|
|
1
|
-
import { ref, nextTick,
|
|
2
|
-
import MazPopover from "../components/MazPopover.js";
|
|
3
|
-
import { useMountComponent } from "../composables/useMountComponent.js";
|
|
4
|
-
const tooltipInstances = /* @__PURE__ */ new WeakMap();
|
|
5
|
-
class TooltipHandler {
|
|
6
|
-
defaultProps;
|
|
7
|
-
constructor(options = {}) {
|
|
8
|
-
this.defaultProps = {
|
|
9
|
-
open: !1,
|
|
10
|
-
position: "top",
|
|
11
|
-
trigger: "hover",
|
|
12
|
-
role: "tooltip",
|
|
13
|
-
closeOnClickOutside: !1,
|
|
14
|
-
closeOnEscape: !1,
|
|
15
|
-
color: "contrast",
|
|
16
|
-
...options
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
getTooltipProps(binding) {
|
|
20
|
-
const baseOptions = { ...this.defaultProps };
|
|
21
|
-
return typeof binding.value == "string" ? {
|
|
22
|
-
...baseOptions,
|
|
23
|
-
text: binding.value,
|
|
24
|
-
position: this.getPositionFromModifiers(binding) || baseOptions.position || "top"
|
|
25
|
-
} : {
|
|
26
|
-
...baseOptions,
|
|
27
|
-
...binding.value,
|
|
28
|
-
position: this.getPositionFromModifiers(binding) || binding.value.position || baseOptions.position || "top"
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
getPositionFromModifiers(binding) {
|
|
32
|
-
const modifiers = Object.keys(binding.modifiers), validPositions = [
|
|
33
|
-
"top",
|
|
34
|
-
"bottom",
|
|
35
|
-
"left",
|
|
36
|
-
"right",
|
|
37
|
-
"top-start",
|
|
38
|
-
"top-end",
|
|
39
|
-
"bottom-start",
|
|
40
|
-
"bottom-end",
|
|
41
|
-
"left-start",
|
|
42
|
-
"left-end",
|
|
43
|
-
"right-start",
|
|
44
|
-
"right-end",
|
|
45
|
-
"auto"
|
|
46
|
-
];
|
|
47
|
-
for (const modifier of modifiers)
|
|
48
|
-
if (validPositions.includes(modifier))
|
|
49
|
-
return modifier;
|
|
50
|
-
}
|
|
51
|
-
mount(el, binding) {
|
|
52
|
-
const tooltipProps = this.getTooltipProps(binding);
|
|
53
|
-
if (!tooltipProps.text && !tooltipProps.html) {
|
|
54
|
-
console.warn("[maz-ui](vTooltip) No text or html content provided");
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const isOpen = ref(!!tooltipProps.open);
|
|
58
|
-
let vNodeInstance = null;
|
|
59
|
-
const createTooltip = () => {
|
|
60
|
-
const popoverProps = {
|
|
61
|
-
...tooltipProps,
|
|
62
|
-
panelClass: [
|
|
63
|
-
"m-tooltip-panel",
|
|
64
|
-
"maz-text-sm",
|
|
65
|
-
"maz-whitespace-pre-wrap",
|
|
66
|
-
"maz-break-words",
|
|
67
|
-
"maz-p-2",
|
|
68
|
-
"maz-max-w-xs",
|
|
69
|
-
tooltipProps.panelClass
|
|
70
|
-
].filter(Boolean).join(" "),
|
|
71
|
-
modelValue: isOpen.value,
|
|
72
|
-
positionReference: el,
|
|
73
|
-
onAfterCloseAnimation: () => {
|
|
74
|
-
vNodeInstance?.destroy(), vNodeInstance = null;
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
vNodeInstance = useMountComponent(MazPopover, {
|
|
78
|
-
props: popoverProps,
|
|
79
|
-
children: {
|
|
80
|
-
default: () => tooltipProps.html ? h("div", { innerHTML: tooltipProps.html }) : tooltipProps.text || ""
|
|
81
|
-
},
|
|
82
|
-
element: el
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
function isTouchDevice() {
|
|
86
|
-
return "ontouchstart" in globalThis || navigator.maxTouchPoints > 0;
|
|
87
|
-
}
|
|
88
|
-
function getEffectiveTrigger() {
|
|
89
|
-
return tooltipProps.trigger === "adaptive" ? isTouchDevice() ? "click" : "hover" : tooltipProps.trigger || "hover";
|
|
90
|
-
}
|
|
91
|
-
let mouseEnterHandler = null, mouseLeaveHandler = null, clickHandler = null;
|
|
92
|
-
function setupTriggers() {
|
|
93
|
-
cleanupTriggers();
|
|
94
|
-
const effectiveTrigger = getEffectiveTrigger();
|
|
95
|
-
effectiveTrigger === "hover" ? (mouseEnterHandler = () => {
|
|
96
|
-
isOpen.value = !0;
|
|
97
|
-
}, mouseLeaveHandler = () => {
|
|
98
|
-
isOpen.value = !1;
|
|
99
|
-
}, el.addEventListener("mouseenter", mouseEnterHandler), el.addEventListener("mouseleave", mouseLeaveHandler)) : effectiveTrigger === "click" && (clickHandler = () => {
|
|
100
|
-
isOpen.value = !isOpen.value;
|
|
101
|
-
}, el.addEventListener("click", clickHandler));
|
|
102
|
-
}
|
|
103
|
-
function cleanupTriggers() {
|
|
104
|
-
mouseEnterHandler && (el.removeEventListener("mouseenter", mouseEnterHandler), mouseEnterHandler = null), mouseLeaveHandler && (el.removeEventListener("mouseleave", mouseLeaveHandler), mouseLeaveHandler = null), clickHandler && (el.removeEventListener("click", clickHandler), clickHandler = null);
|
|
105
|
-
}
|
|
106
|
-
nextTick(() => {
|
|
107
|
-
setupTriggers();
|
|
108
|
-
}), watch(isOpen, (value) => {
|
|
109
|
-
value ? createTooltip() : vNodeInstance && vNodeInstance?.vNode.component?.exposed?.close();
|
|
110
|
-
}, { immediate: !0 });
|
|
111
|
-
function destroy() {
|
|
112
|
-
cleanupTriggers(), vNodeInstance && (vNodeInstance.destroy(), vNodeInstance = null);
|
|
113
|
-
}
|
|
114
|
-
function updateProps(newProps) {
|
|
115
|
-
const oldTrigger = tooltipProps.trigger;
|
|
116
|
-
Object.assign(tooltipProps, newProps), isOpen.value = !!newProps.open, oldTrigger !== newProps.trigger && setupTriggers(), createTooltip();
|
|
117
|
-
}
|
|
118
|
-
tooltipInstances.set(el, {
|
|
119
|
-
destroy,
|
|
120
|
-
updateProps,
|
|
121
|
-
isOpen
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
update(el, binding) {
|
|
125
|
-
const instance = tooltipInstances.get(el);
|
|
126
|
-
if (instance) {
|
|
127
|
-
const newProps = this.getTooltipProps(binding);
|
|
128
|
-
instance.updateProps(newProps);
|
|
129
|
-
} else
|
|
130
|
-
this.mount(el, binding);
|
|
131
|
-
}
|
|
132
|
-
unmount(el) {
|
|
133
|
-
const instance = tooltipInstances.get(el);
|
|
134
|
-
instance && (instance.destroy(), tooltipInstances.delete(el));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
let globalHandler;
|
|
138
|
-
const directive = {
|
|
139
|
-
mounted(el, binding) {
|
|
140
|
-
return globalHandler || (globalHandler = new TooltipHandler()), globalHandler.mount(el, binding);
|
|
141
|
-
},
|
|
142
|
-
updated(el, binding) {
|
|
143
|
-
return globalHandler || (globalHandler = new TooltipHandler()), globalHandler.update(el, binding);
|
|
144
|
-
},
|
|
145
|
-
unmounted(el) {
|
|
146
|
-
globalHandler && globalHandler.unmount(el);
|
|
147
|
-
}
|
|
148
|
-
}, plugin = {
|
|
149
|
-
install: (app, options) => {
|
|
150
|
-
const handler = new TooltipHandler(options);
|
|
151
|
-
app.directive("tooltip", {
|
|
152
|
-
beforeMount: handler.mount.bind(handler),
|
|
153
|
-
updated: handler.update.bind(handler),
|
|
154
|
-
unmounted: handler.unmount.bind(handler)
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
export {
|
|
159
|
-
directive as vTooltip,
|
|
160
|
-
plugin as vTooltipInstall
|
|
161
|
-
};
|
|
1
|
+
import{t as MazPopover_default}from"../chunks/MazPopover.Co8BEopX.js";import{useMountComponent}from"../composables/useMountComponent.js";import{h,nextTick,ref,watch}from"vue";var tooltipInstances=new WeakMap;var TooltipHandler=class{defaultProps;constructor(options={}){this.defaultProps={open:!1,position:`top`,trigger:`hover`,role:`tooltip`,closeOnClickOutside:!1,closeOnEscape:!1,color:`contrast`,...options}}getTooltipProps(binding){let baseOptions={...this.defaultProps};return typeof binding.value==`string`?{...baseOptions,text:binding.value,position:this.getPositionFromModifiers(binding)||baseOptions.position||`top`}:{...baseOptions,...binding.value,position:this.getPositionFromModifiers(binding)||binding.value.position||baseOptions.position||`top`}}getPositionFromModifiers(binding){let modifiers=Object.keys(binding.modifiers);let validPositions=[`top`,`bottom`,`left`,`right`,`top-start`,`top-end`,`bottom-start`,`bottom-end`,`left-start`,`left-end`,`right-start`,`right-end`,`auto`];for(let modifier of modifiers)if(validPositions.includes(modifier))return modifier}mount(el,binding){let tooltipProps=this.getTooltipProps(binding);if(!tooltipProps.text&&!tooltipProps.html){console.warn(`[maz-ui](vTooltip) No text or html content provided`);return}let isOpen=ref(!!tooltipProps.open);let vNodeInstance=null;let createTooltip=()=>{vNodeInstance=useMountComponent(MazPopover_default,{props:{...tooltipProps,panelClass:[`m-tooltip-panel`,`maz-text-sm`,`maz-whitespace-pre-wrap`,`maz-break-words`,`maz-p-2`,`maz-max-w-xs`,tooltipProps.panelClass].filter(Boolean).join(` `),modelValue:isOpen.value,positionReference:el,onAfterCloseAnimation:()=>{vNodeInstance?.destroy(),vNodeInstance=null}},children:{default:()=>tooltipProps.html?h(`div`,{innerHTML:tooltipProps.html}):tooltipProps.text||``},element:el})};function isTouchDevice(){return`ontouchstart`in globalThis||navigator.maxTouchPoints>0}function getEffectiveTrigger(){return tooltipProps.trigger===`adaptive`?isTouchDevice()?`click`:`hover`:tooltipProps.trigger||`hover`}let mouseEnterHandler=null;let mouseLeaveHandler=null;let clickHandler=null;function setupTriggers(){cleanupTriggers();let effectiveTrigger=getEffectiveTrigger();effectiveTrigger===`hover`?(mouseEnterHandler=()=>{isOpen.value=!0},mouseLeaveHandler=()=>{isOpen.value=!1},el.addEventListener(`mouseenter`,mouseEnterHandler),el.addEventListener(`mouseleave`,mouseLeaveHandler)):effectiveTrigger===`click`&&(clickHandler=()=>{isOpen.value=!isOpen.value},el.addEventListener(`click`,clickHandler))}function cleanupTriggers(){mouseEnterHandler&&=(el.removeEventListener(`mouseenter`,mouseEnterHandler),null),mouseLeaveHandler&&=(el.removeEventListener(`mouseleave`,mouseLeaveHandler),null),clickHandler&&=(el.removeEventListener(`click`,clickHandler),null)}nextTick(()=>{setupTriggers()}),watch(isOpen,value=>{value?createTooltip():vNodeInstance&&vNodeInstance?.vNode.component?.exposed?.close()},{immediate:!0});function destroy(){cleanupTriggers(),vNodeInstance&&=(vNodeInstance.destroy(),null)}function updateProps(newProps){let oldTrigger=tooltipProps.trigger;Object.assign(tooltipProps,newProps),isOpen.value=!!newProps.open,oldTrigger!==newProps.trigger&&setupTriggers(),createTooltip()}tooltipInstances.set(el,{destroy,updateProps,isOpen})}update(el,binding){let instance=tooltipInstances.get(el);if(instance){let newProps=this.getTooltipProps(binding);instance.updateProps(newProps)}else this.mount(el,binding)}unmount(el){let instance=tooltipInstances.get(el);instance&&(instance.destroy(),tooltipInstances.delete(el))}};var globalHandler;var directive={mounted(el,binding){return globalHandler||=new TooltipHandler,globalHandler.mount(el,binding)},updated(el,binding){return globalHandler||=new TooltipHandler,globalHandler.update(el,binding)},unmounted(el){globalHandler&&globalHandler.unmount(el)}};var plugin={install:(app,options)=>{let handler=new TooltipHandler(options);app.directive(`tooltip`,{beforeMount:handler.mount.bind(handler),updated:handler.update.bind(handler),unmounted:handler.unmount.bind(handler)})}};export{directive as vTooltip,plugin as vTooltipInstall};
|
|
@@ -1,286 +1 @@
|
|
|
1
|
-
|
|
2
|
-
.maz-zoom-img {
|
|
3
|
-
position: fixed;
|
|
4
|
-
top: 0;
|
|
5
|
-
bottom: 0;
|
|
6
|
-
left: 0;
|
|
7
|
-
right: 0;
|
|
8
|
-
padding: 1rem;
|
|
9
|
-
z-index: 1050;
|
|
10
|
-
background-color: hsla(238, 15%, 40%, 0.7);
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: center;
|
|
13
|
-
justify-content: center;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.maz-zoom-img,
|
|
18
|
-
.maz-zoom-img * {
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.maz-zoom-img .maz-zoom-img__wrapper {
|
|
23
|
-
position: relative;
|
|
24
|
-
display: flex;
|
|
25
|
-
justify-content: center;
|
|
26
|
-
align-items: center;
|
|
27
|
-
min-width: 0;
|
|
28
|
-
min-height: 0;
|
|
29
|
-
max-width: 100%;
|
|
30
|
-
max-height: 100%;
|
|
31
|
-
transition: all 300ms ease-in-out;
|
|
32
|
-
opacity: 0;
|
|
33
|
-
transform: scale(0.5);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.maz-zoom-img.maz-animate .maz-zoom-img__wrapper {
|
|
37
|
-
opacity: 1;
|
|
38
|
-
transform: scale(1);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.maz-zoom-img.maz-animate .maz-zoom-img__loader {
|
|
42
|
-
position: absolute;
|
|
43
|
-
top: 0;
|
|
44
|
-
bottom: 0;
|
|
45
|
-
left: 0;
|
|
46
|
-
right: 0;
|
|
47
|
-
display: flex;
|
|
48
|
-
align-items: center;
|
|
49
|
-
justify-content: center;
|
|
50
|
-
background-color: hsla(238, 15%, 40%, 0.7);
|
|
51
|
-
border-radius: 1rem;
|
|
52
|
-
z-index: 2;
|
|
53
|
-
min-width: 60px;
|
|
54
|
-
min-height: 60px;
|
|
55
|
-
}
|
|
56
|
-
.maz-zoom-img.maz-animate .maz-zoom-img__loader[hidden] {
|
|
57
|
-
display: none;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@-webkit-keyframes spin {
|
|
61
|
-
0% { transform: rotate(0deg); }
|
|
62
|
-
100% { transform: rotate(360deg); }
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
@keyframes spin {
|
|
66
|
-
0% { transform: rotate(0deg); }
|
|
67
|
-
100% { transform: rotate(360deg); }
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.maz-zoom-img.maz-animate .maz-zoom-img__loader__svg {
|
|
71
|
-
animation: spin .6s linear infinite;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.maz-zoom-img img {
|
|
75
|
-
max-width: 100%;
|
|
76
|
-
max-height: 100%;
|
|
77
|
-
min-width: 0;
|
|
78
|
-
border-radius: 1rem;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.maz-zoom-img .maz-zoom-btn {
|
|
82
|
-
margin: 0 auto;
|
|
83
|
-
border: none;
|
|
84
|
-
background-color: hsla(0, 0%, 7%, 0.5);
|
|
85
|
-
box-shadow: 0 0 0.5rem 0 hsla(0, 0%, 0%, 0.2);
|
|
86
|
-
height: 2.2rem;
|
|
87
|
-
min-height: 2.2rem;
|
|
88
|
-
width: 2.2rem;
|
|
89
|
-
min-width: 2.2rem;
|
|
90
|
-
display: flex;
|
|
91
|
-
align-items: center;
|
|
92
|
-
justify-content: center;
|
|
93
|
-
border-radius: 2.2rem;
|
|
94
|
-
cursor: pointer;
|
|
95
|
-
flex: 0 0 auto;
|
|
96
|
-
outline: none;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.maz-zoom-img .maz-zoom-btn svg {
|
|
100
|
-
fill: white;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.maz-zoom-img .maz-zoom-btn.maz-zoom-btn--close {
|
|
104
|
-
position: absolute;
|
|
105
|
-
top: 0.5rem;
|
|
106
|
-
right: 0.5rem;
|
|
107
|
-
z-index: 1;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.maz-zoom-img .maz-zoom-btn.maz-zoom-btn--previous {
|
|
111
|
-
position: absolute;
|
|
112
|
-
left: 0.5rem;
|
|
113
|
-
z-index: 1;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.maz-zoom-img .maz-zoom-btn.maz-zoom-btn--next {
|
|
117
|
-
position: absolute;
|
|
118
|
-
right: 0.5rem;
|
|
119
|
-
z-index: 1;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.maz-zoom-img .maz-zoom-btn:hover {
|
|
123
|
-
background-color: hsl(0, 0%, 0%);
|
|
124
|
-
}`, svgs = {
|
|
125
|
-
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>',
|
|
126
|
-
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>',
|
|
127
|
-
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>',
|
|
128
|
-
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>'
|
|
129
|
-
};
|
|
130
|
-
class ZoomImgHandler {
|
|
131
|
-
options;
|
|
132
|
-
loader;
|
|
133
|
-
wrapper;
|
|
134
|
-
img;
|
|
135
|
-
keydownHandler;
|
|
136
|
-
onImgLoadedCallback;
|
|
137
|
-
buttonsAdded;
|
|
138
|
-
defaultOptions = {
|
|
139
|
-
scale: !0,
|
|
140
|
-
blur: !0,
|
|
141
|
-
disabled: !1
|
|
142
|
-
};
|
|
143
|
-
mouseEnterListener = void 0;
|
|
144
|
-
mouseLeaveListener = void 0;
|
|
145
|
-
renderPreviewListener = void 0;
|
|
146
|
-
constructor(binding) {
|
|
147
|
-
if (!binding.value)
|
|
148
|
-
throw new Error(
|
|
149
|
-
'[MazUI](zoom-img) Image path must be defined. Ex: `v-zoom-img="<PATH_TO_IMAGE>"`'
|
|
150
|
-
);
|
|
151
|
-
if (typeof binding.value == "object" && !binding.value.src)
|
|
152
|
-
throw new Error("[maz-ui](zoom-img) src of image must be provided");
|
|
153
|
-
this.buttonsAdded = !1, this.options = this.buildOptions(binding), 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);
|
|
154
|
-
}
|
|
155
|
-
buildOptions(binding) {
|
|
156
|
-
return {
|
|
157
|
-
...this.defaultOptions,
|
|
158
|
-
...typeof binding.value == "object" ? binding.value : { src: binding.value }
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
get allInstances() {
|
|
162
|
-
return [...document.querySelectorAll(".maz-zoom-img-instance")];
|
|
163
|
-
}
|
|
164
|
-
create(el) {
|
|
165
|
-
this.options.disabled || (el.style.cursor = "pointer", setTimeout(() => el.classList.add("maz-zoom-img-instance")), el.setAttribute("data-zoom-src", this.options.src), this.options.alt && el.setAttribute("data-zoom-alt", this.options.alt), el.style.transition = "all 300ms ease-in-out", this.mouseEnterListener = () => this.mouseEnter(el), this.mouseLeaveListener = () => this.mouseLeave(el), this.renderPreviewListener = () => this.renderPreview(el, this.options), el.addEventListener("mouseenter", this.mouseEnterListener), el.addEventListener("mouseleave", this.mouseLeaveListener), el.addEventListener("click", this.renderPreviewListener));
|
|
166
|
-
}
|
|
167
|
-
update(binding) {
|
|
168
|
-
this.options = this.buildOptions(binding);
|
|
169
|
-
}
|
|
170
|
-
remove(el) {
|
|
171
|
-
this.imgEventHandler(!1), this.mouseEnterListener && el.removeEventListener("mouseenter", this.mouseEnterListener), this.mouseLeaveListener && el.removeEventListener("mouseleave", this.mouseLeaveListener), this.renderPreviewListener && el.removeEventListener("click", this.renderPreviewListener), this.mouseEnterListener = void 0, this.mouseLeaveListener = void 0, this.renderPreviewListener = void 0, el.classList.remove("maz-zoom-img-instance"), el.removeAttribute("data-zoom-src"), el.removeAttribute("data-zoom-alt"), el.style.cursor = "";
|
|
172
|
-
}
|
|
173
|
-
renderPreview(el, options) {
|
|
174
|
-
el.classList.add(
|
|
175
|
-
"maz-is-open"
|
|
176
|
-
/* OPEN */
|
|
177
|
-
), this.addStyle(style);
|
|
178
|
-
const container = document.createElement("div");
|
|
179
|
-
container.classList.add("maz-zoom-img"), container.setAttribute("id", "MazImgPreviewFullsize"), container.addEventListener("click", (e) => {
|
|
180
|
-
container.isEqualNode(e.target) && this.closePreview();
|
|
181
|
-
}), typeof options == "object" && (this.img.setAttribute("src", options.src), options.alt && this.img.setAttribute("alt", options.alt), this.img.id = "MazImgElement"), this.wrapper.append(this.img), container.append(this.wrapper), document.body.append(container), this.keyboardEventHandler(!0), setTimeout(() => {
|
|
182
|
-
container && container.classList.add("maz-animate");
|
|
183
|
-
}, 100);
|
|
184
|
-
}
|
|
185
|
-
onImgLoaded() {
|
|
186
|
-
this.wrapper.style.width = `${this.img.width}px`, this.wrapper.style.minWidth = "200px", this.loader.hidden = !0;
|
|
187
|
-
const closeButton = this.getButton(), buttons = [], hasMultipleInstance = this.allInstances.length > 1;
|
|
188
|
-
if (!this.buttonsAdded) {
|
|
189
|
-
if (this.buttonsAdded = !0, hasMultipleInstance) {
|
|
190
|
-
const previousButton = this.getButton("previous"), nextButton = this.getButton("next");
|
|
191
|
-
buttons.push(previousButton, nextButton);
|
|
192
|
-
}
|
|
193
|
-
this.wrapper.append(closeButton), hasMultipleInstance && (this.wrapper.prepend(buttons[0]), this.wrapper.append(buttons[1]));
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
getLoader() {
|
|
197
|
-
const loader = document.createElement("div");
|
|
198
|
-
return loader.classList.add("maz-zoom-img__loader"), loader.innerHTML = svgs.spinner, loader;
|
|
199
|
-
}
|
|
200
|
-
mouseLeave(el) {
|
|
201
|
-
this.options.scale && (el.style.transform = ""), this.options.blur && (el.style.filter = ""), el.style.zIndex = "";
|
|
202
|
-
}
|
|
203
|
-
mouseEnter(el) {
|
|
204
|
-
el.style.zIndex = "1", this.options.scale && (el.style.transform = "scale(1.1)"), this.options.blur && (el.style.filter = "blur(2px)");
|
|
205
|
-
}
|
|
206
|
-
keydownLister(e) {
|
|
207
|
-
e.preventDefault(), (e.key === "Escape" || e.key === " ") && this.closePreview(), (e.key === "ArrowLeft" || e.key === "ArrowRight") && this.nextPreviousImage(e.key === "ArrowRight");
|
|
208
|
-
}
|
|
209
|
-
getButton(iconName = "close") {
|
|
210
|
-
const button = document.createElement("button");
|
|
211
|
-
button.innerHTML = svgs[iconName];
|
|
212
|
-
const getAction = () => iconName === "close" ? this.closePreview() : this.allInstances ? this.nextPreviousImage(iconName === "next") : null;
|
|
213
|
-
return button.addEventListener("click", () => {
|
|
214
|
-
getAction();
|
|
215
|
-
}), button.classList.add("maz-zoom-btn"), button.classList.add(`maz-zoom-btn--${iconName}`), button;
|
|
216
|
-
}
|
|
217
|
-
closePreview() {
|
|
218
|
-
const container = document.querySelector("#MazImgPreviewFullsize"), style2 = document.querySelector("#MazPreviewStyle"), instance2 = document.querySelector(
|
|
219
|
-
".maz-zoom-img-instance.maz-is-open"
|
|
220
|
-
);
|
|
221
|
-
instance2 && instance2.classList.remove(
|
|
222
|
-
"maz-is-open"
|
|
223
|
-
/* OPEN */
|
|
224
|
-
), container && container.classList.remove("maz-animate"), this.keyboardEventHandler(!1), setTimeout(() => {
|
|
225
|
-
container && container.remove(), style2 && style2.remove();
|
|
226
|
-
}, 300);
|
|
227
|
-
}
|
|
228
|
-
getNewInstanceIndex(newInstanceIndex) {
|
|
229
|
-
let nextIndex = newInstanceIndex;
|
|
230
|
-
return nextIndex < 0 ? nextIndex = this.allInstances.length - 1 : nextIndex >= this.allInstances.length && (nextIndex = 0), nextIndex;
|
|
231
|
-
}
|
|
232
|
-
nextPreviousImage(isNext) {
|
|
233
|
-
const selectNextInstance = isNext, currentInstance = document.querySelector(
|
|
234
|
-
".maz-zoom-img-instance.maz-is-open"
|
|
235
|
-
);
|
|
236
|
-
if (currentInstance) {
|
|
237
|
-
const currentInstanceIndex = this.allInstances.indexOf(currentInstance), newInstanceIndex = selectNextInstance ? currentInstanceIndex + 1 : currentInstanceIndex - 1, nextInstance = this.allInstances[this.getNewInstanceIndex(newInstanceIndex)];
|
|
238
|
-
nextInstance && this.useNextInstance(currentInstance, nextInstance);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
useNextInstance(currentInstance, nextInstance) {
|
|
242
|
-
currentInstance.classList.remove(
|
|
243
|
-
"maz-is-open"
|
|
244
|
-
/* OPEN */
|
|
245
|
-
), nextInstance.classList.add(
|
|
246
|
-
"maz-is-open"
|
|
247
|
-
/* OPEN */
|
|
248
|
-
);
|
|
249
|
-
const src = nextInstance.getAttribute("data-zoom-src"), alt = nextInstance.getAttribute("data-zoom-alt");
|
|
250
|
-
this.wrapper.style.width = "", this.loader.hidden = !1, src && this.img.setAttribute("src", src), alt && this.img.setAttribute("alt", alt);
|
|
251
|
-
}
|
|
252
|
-
addStyle(styleString) {
|
|
253
|
-
const style2 = document.createElement("style");
|
|
254
|
-
style2.id = "MazPreviewStyle", style2.textContent = styleString, document.head.append(style2);
|
|
255
|
-
}
|
|
256
|
-
keyboardEventHandler(add) {
|
|
257
|
-
if (add)
|
|
258
|
-
return document.addEventListener("keydown", this.keydownHandler);
|
|
259
|
-
document.removeEventListener("keydown", this.keydownHandler);
|
|
260
|
-
}
|
|
261
|
-
imgEventHandler(add) {
|
|
262
|
-
if (add)
|
|
263
|
-
return this.img.addEventListener("load", this.onImgLoadedCallback);
|
|
264
|
-
this.img.removeEventListener("load", this.onImgLoadedCallback);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
let instance;
|
|
268
|
-
const vZoomImg = {
|
|
269
|
-
created(el, binding) {
|
|
270
|
-
instance = new ZoomImgHandler(binding), instance.create(el);
|
|
271
|
-
},
|
|
272
|
-
updated(_el, binding) {
|
|
273
|
-
instance.update(binding);
|
|
274
|
-
},
|
|
275
|
-
unmounted(el) {
|
|
276
|
-
instance.remove(el);
|
|
277
|
-
}
|
|
278
|
-
}, plugin = {
|
|
279
|
-
install(app) {
|
|
280
|
-
app.directive("zoom-img", vZoomImg);
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
export {
|
|
284
|
-
vZoomImg,
|
|
285
|
-
plugin as vZoomImgInstall
|
|
286
|
-
};
|
|
1
|
+
import{n as vZoomImg,t as plugin}from"../chunks/vZoomImg.CaAHb98S.js";export{vZoomImg,plugin as vZoomImgInstall};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export*from"@maz-ui/utils";
|