@maas/vue-equipment 1.0.0-beta.5 → 1.0.0-beta.7
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/composables/index.d.ts +5 -5
- package/dist/composables/index.js +14 -8
- package/dist/composables/index.js.map +1 -1
- package/dist/nuxt/module.json +1 -1
- package/dist/nuxt/module.mjs +2 -2
- package/dist/plugins/.turbo/turbo-lint.log +2 -2
- package/dist/plugins/MagicAccordion/demo/data/footer.json +1 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue.d.ts +3 -3
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue.d.ts +2 -2
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue +4 -5
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue.d.ts +3 -157
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue.d.ts +2 -2
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionTrigger.d.ts +1 -1
- package/dist/plugins/MagicAccordion/src/symbols/index.d.ts +2 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue +11 -4
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue.d.ts +32 -0
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +0 -4
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +3 -8
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue +3 -6
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue.d.ts +3 -87
- package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue +7 -7
- package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue.d.ts +1 -4
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue +3 -4
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue.d.ts +3 -157
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue.d.ts +3 -3
- package/dist/plugins/MagicCommand/src/composables/private/useCommandScroll.d.ts +2 -2
- package/dist/plugins/MagicCommand/src/composables/private/useCommandState.mjs +1 -1
- package/dist/plugins/MagicCommand/src/composables/private/useCommandTrigger.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/symbols/index.d.ts +4 -4
- package/dist/plugins/MagicCommand/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue.d.ts +3 -3
- package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue.d.ts +3 -3
- package/dist/plugins/MagicCookie/src/symbols/index.d.ts +2 -2
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +10 -12
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +3 -24
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.d.ts +2 -2
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.mjs +3 -3
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableScrollLock.mjs +2 -2
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.d.ts +3 -3
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.mjs +12 -15
- package/dist/plugins/MagicDraggable/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +20 -21
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +188 -0
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDOM.mjs +2 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.d.ts +2 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +3 -3
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerGuards.d.ts +1 -1
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerGuards.mjs +28 -10
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerProgress.d.ts +2 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.d.ts +3 -3
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.mjs +16 -14
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerWheel.d.ts +1 -1
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue +15 -15
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue.d.ts +25 -0
- package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeApi.d.ts +1 -1
- package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeApi.mjs +8 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue.d.ts +27 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue +3 -6
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +56 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue +5 -7
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue.d.ts +53 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +1 -12
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +3 -8
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue +6 -6
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue.d.ts +1 -85
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue.d.ts +2 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue +3 -4
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +3 -157
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue.d.ts +3 -3
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCursor.d.ts +3 -3
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCursor.mjs +4 -4
- package/dist/plugins/MagicMenu/src/composables/private/useMenuDOM.mjs +2 -2
- package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/symbols/index.d.ts +4 -4
- package/dist/plugins/MagicModal/src/components/MagicModal.vue +6 -6
- package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +60 -0
- package/dist/plugins/MagicModal/src/composables/private/useModalDOM.mjs +2 -2
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue +13 -13
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue.d.ts +1 -5
- package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.d.ts +3 -3
- package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.mjs +2 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue +14 -8
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue.d.ts +1 -4
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +20 -20
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue.d.ts +34 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +19 -8
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue.d.ts +1 -4
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +35 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue.d.ts +5 -5
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue +3 -4
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue.d.ts +6 -11
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue +3 -4
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue.d.ts +1 -4
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +23 -24
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue.d.ts +73 -0
- package/dist/plugins/MagicPlayer/src/components/icons/FullscreenEnter.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/FullscreenExit.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/Pause.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/Play.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/VolumeOff.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/VolumeOn.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/Waiting.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.d.ts +2 -2
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.mjs +3 -3
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.d.ts +10 -10
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.mjs +15 -9
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.d.ts +13 -13
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +18 -11
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.d.ts +3 -3
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +3 -3
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.d.ts +6 -6
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.mjs +4 -4
- package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.d.ts +20 -20
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue +17 -8
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue.d.ts +4 -10
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +7 -7
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue.d.ts +4 -10
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +3 -3
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +18 -10
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue.d.ts +4 -9
- package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetection.d.ts +2 -2
- package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetection.mjs +3 -3
- package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.mjs +14 -4
- package/dist/plugins/MagicScroll/src/symbols/index.d.ts +1 -1
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue +9 -10
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue.d.ts +1 -59
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue +5 -8
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue.d.ts +3 -8
- package/dist/plugins/MagicToast/src/composables/private/useToastDrag.mjs +21 -21
- package/dist/plugins/MagicToast/src/composables/private/useToastScrollLock.mjs +2 -2
- package/dist/plugins/MagicToast/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicToast/src/utils/defaultOptions.mjs +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -77,40 +77,19 @@ declare const mappedOptions: Omit<MagicDraggableOptions, keyof MagicDraggableOpt
|
|
|
77
77
|
snapPoint?: import("../types").DraggableSnapPoint;
|
|
78
78
|
};
|
|
79
79
|
};
|
|
80
|
-
declare const elRef: import("vue").Ref<HTMLElement | undefined, HTMLElement | undefined>;
|
|
81
|
-
declare const wrapperRef: import("vue").Ref<HTMLDivElement | undefined, HTMLDivElement | undefined>;
|
|
82
80
|
declare const dragging: import("vue").Ref<boolean, boolean>;
|
|
83
81
|
declare const disabled: import("vue").ComputedRef<boolean>;
|
|
84
82
|
declare const style: import("vue").ComputedRef<string>, hasDragged: import("vue").ComputedRef<boolean>;
|
|
85
83
|
declare function guardedPointerdown(event: PointerEvent): void;
|
|
86
84
|
declare function guardedClick(event: PointerEvent): void;
|
|
87
85
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
88
|
-
declare
|
|
89
|
-
declare const __VLS_2: {
|
|
90
|
-
__ctx?: {
|
|
91
|
-
attrs?: any;
|
|
92
|
-
expose?: any;
|
|
93
|
-
slots?: any;
|
|
94
|
-
emit?: any;
|
|
95
|
-
props?: {} & Record<string, unknown>;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
declare var __VLS_6: (Parameters<NonNullable<(typeof __VLS_5)["expose"]>>[0] | null);
|
|
99
|
-
declare var __VLS_10: {};
|
|
100
|
-
declare var __VLS_5: __VLS_PickFunctionalComponentCtx<typeof __VLS_0, typeof __VLS_2>;
|
|
86
|
+
declare var __VLS_12: {};
|
|
101
87
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
102
|
-
default?: (props: typeof
|
|
88
|
+
default?: (props: typeof __VLS_12) => any;
|
|
103
89
|
}>;
|
|
104
|
-
type __VLS_TemplateRefs = {
|
|
105
|
-
drawerRef: typeof __VLS_nativeElements['div'];
|
|
106
|
-
wrapperRef: typeof __VLS_nativeElements['div'];
|
|
107
|
-
elRef: typeof __VLS_6;
|
|
108
|
-
};
|
|
109
90
|
declare const __VLS_self: import("vue").DefineComponent<MagicDraggableProps, {
|
|
110
91
|
toValue: typeof toValue;
|
|
111
92
|
mappedOptions: typeof mappedOptions;
|
|
112
|
-
elRef: typeof elRef;
|
|
113
|
-
wrapperRef: typeof wrapperRef;
|
|
114
93
|
dragging: typeof dragging;
|
|
115
94
|
disabled: typeof disabled;
|
|
116
95
|
style: typeof style;
|
|
@@ -118,7 +97,7 @@ declare const __VLS_self: import("vue").DefineComponent<MagicDraggableProps, {
|
|
|
118
97
|
guardedPointerdown: typeof guardedPointerdown;
|
|
119
98
|
guardedClick: typeof guardedClick;
|
|
120
99
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicDraggableProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
121
|
-
declare const __VLS_component: import("vue").DefineComponent<MagicDraggableProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicDraggableProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false,
|
|
100
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicDraggableProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicDraggableProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
122
101
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
123
102
|
export default _default;
|
|
124
103
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -2,8 +2,8 @@ import { type Ref, type MaybeRef } from 'vue';
|
|
|
2
2
|
import type { DraggableDefaultOptions } from '../../types/index.js';
|
|
3
3
|
type UseDraggableDragArgs = {
|
|
4
4
|
id: MaybeRef<string>;
|
|
5
|
-
elRef: Ref<HTMLElement |
|
|
6
|
-
wrapperRef: Ref<HTMLDivElement |
|
|
5
|
+
elRef: Ref<HTMLElement | null>;
|
|
6
|
+
wrapperRef: Ref<HTMLDivElement | null>;
|
|
7
7
|
threshold: MaybeRef<DraggableDefaultOptions['threshold']>;
|
|
8
8
|
snapPoints: MaybeRef<DraggableDefaultOptions['snapPoints']>;
|
|
9
9
|
animation: MaybeRef<DraggableDefaultOptions['animation']>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
shallowRef,
|
|
3
3
|
computed,
|
|
4
4
|
toValue,
|
|
5
5
|
nextTick,
|
|
@@ -58,8 +58,8 @@ export function useDraggableDrag(args) {
|
|
|
58
58
|
let cancelPointerup = void 0;
|
|
59
59
|
let cancelPointermove = void 0;
|
|
60
60
|
let cancelTouchend = void 0;
|
|
61
|
-
const momentumThresholdReached =
|
|
62
|
-
const distanceThresholdReached =
|
|
61
|
+
const momentumThresholdReached = shallowRef(false);
|
|
62
|
+
const distanceThresholdReached = shallowRef(false);
|
|
63
63
|
const style = computed(
|
|
64
64
|
() => `transform: translate3d(${draggedX.value}px, ${draggedY.value}px, 0)`
|
|
65
65
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
1
|
+
import { shallowRef, ref } from "vue";
|
|
2
2
|
import { useScrollLock } from "@vueuse/core";
|
|
3
3
|
import { matchClass } from "@maas/vue-equipment/utils";
|
|
4
|
-
const scrollLock = typeof window !== "undefined" ? useScrollLock(document?.documentElement) :
|
|
4
|
+
const scrollLock = typeof window !== "undefined" ? useScrollLock(document?.documentElement) : shallowRef(false);
|
|
5
5
|
export function useDraggableScrollLock() {
|
|
6
6
|
const positionFixedElements = ref([]);
|
|
7
7
|
function lockScroll() {
|
|
@@ -22,13 +22,13 @@ type SnapToArgs = {
|
|
|
22
22
|
};
|
|
23
23
|
export declare function useDraggableSnap(args: UseDraggableSnapArgs): {
|
|
24
24
|
mappedSnapPoints: import("@vueuse/core").ComputedRefWithControl<Coordinates[]>;
|
|
25
|
-
activeSnapPoint: Ref<("center" | "
|
|
25
|
+
activeSnapPoint: Ref<("center" | "left" | "top" | "right" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right") | ["center" | "left" | "top" | "right" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right", offset?: {
|
|
26
26
|
x?: number | undefined;
|
|
27
27
|
y?: number | undefined;
|
|
28
|
-
} | undefined] | undefined, "center" | "
|
|
28
|
+
} | undefined] | undefined, "center" | "left" | "top" | "right" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | ["center" | "left" | "top" | "right" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right", offset?: {
|
|
29
29
|
x?: number;
|
|
30
30
|
y?: number;
|
|
31
|
-
} | undefined] | ["center" | "
|
|
31
|
+
} | undefined] | ["center" | "left" | "top" | "right" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right", offset?: {
|
|
32
32
|
x?: number | undefined;
|
|
33
33
|
y?: number | undefined;
|
|
34
34
|
} | undefined] | undefined>;
|
|
@@ -18,17 +18,14 @@ export function useDraggableSnap(args) {
|
|
|
18
18
|
const snapPointsMap = computedWithControl(
|
|
19
19
|
() => toValue(snapPoints),
|
|
20
20
|
() => {
|
|
21
|
-
const mapped = toValue(snapPoints).reduce(
|
|
22
|
-
(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
{}
|
|
31
|
-
);
|
|
21
|
+
const mapped = toValue(snapPoints).reduce((acc, current) => {
|
|
22
|
+
const key = mapSnapPoint(current);
|
|
23
|
+
if (key) {
|
|
24
|
+
const mappedKey = `x${key.x}y${key.y}`;
|
|
25
|
+
acc[mappedKey] = current;
|
|
26
|
+
}
|
|
27
|
+
return acc;
|
|
28
|
+
}, {});
|
|
32
29
|
return mapped;
|
|
33
30
|
}
|
|
34
31
|
);
|
|
@@ -51,7 +48,7 @@ export function useDraggableSnap(args) {
|
|
|
51
48
|
x: mappedOffset.x,
|
|
52
49
|
y: mappedOffset.y
|
|
53
50
|
};
|
|
54
|
-
case "top
|
|
51
|
+
case "top":
|
|
55
52
|
return {
|
|
56
53
|
x: wrapperRect.value.width / 2 + mappedOffset.x - elRect.value.width / 2,
|
|
57
54
|
y: mappedOffset.y
|
|
@@ -61,7 +58,7 @@ export function useDraggableSnap(args) {
|
|
|
61
58
|
x: wrapperRect.value.width - mappedOffset.x - elRect.value.width,
|
|
62
59
|
y: mappedOffset.y
|
|
63
60
|
};
|
|
64
|
-
case "
|
|
61
|
+
case "left":
|
|
65
62
|
return {
|
|
66
63
|
x: mappedOffset.x,
|
|
67
64
|
y: wrapperRect.value.height / 2 + mappedOffset.y - elRect.value.height / 2
|
|
@@ -71,7 +68,7 @@ export function useDraggableSnap(args) {
|
|
|
71
68
|
x: wrapperRect.value.width / 2 - elRect.value.width / 2 + mappedOffset.x,
|
|
72
69
|
y: wrapperRect.value.height / 2 - elRect.value.height / 2 + mappedOffset.y
|
|
73
70
|
};
|
|
74
|
-
case "
|
|
71
|
+
case "right":
|
|
75
72
|
return {
|
|
76
73
|
x: wrapperRect.value.width - mappedOffset.x - elRect.value.width,
|
|
77
74
|
y: wrapperRect.value.height / 2 + mappedOffset.y - elRect.value.height / 2
|
|
@@ -81,7 +78,7 @@ export function useDraggableSnap(args) {
|
|
|
81
78
|
x: mappedOffset.x,
|
|
82
79
|
y: wrapperRect.value.height + mappedOffset.y - elRect.value.height
|
|
83
80
|
};
|
|
84
|
-
case "bottom
|
|
81
|
+
case "bottom":
|
|
85
82
|
return {
|
|
86
83
|
x: wrapperRect.value.width / 2 + mappedOffset.x - elRect.value.width / 2,
|
|
87
84
|
y: wrapperRect.value.height - mappedOffset.y - elRect.value.height
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RequireAll } from '@maas/vue-equipment/utils';
|
|
2
|
-
type Position = 'top-left' | 'top
|
|
2
|
+
type Position = 'top-left' | 'top' | 'top-right' | 'left' | 'center' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right';
|
|
3
3
|
export type Coordinates = {
|
|
4
4
|
x: number;
|
|
5
5
|
y: number;
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
import { defineComponent as _defineComponent } from "vue";
|
|
3
3
|
import { unref as _unref, renderSlot as _renderSlot, vShow as _vShow, withModifiers as _withModifiers, createElementVNode as _createElementVNode, withDirectives as _withDirectives, Transition as _Transition, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createElementBlock as _createElementBlock, resolveDynamicComponent as _resolveDynamicComponent, normalizeStyle as _normalizeStyle, createVNode as _createVNode, mergeProps as _mergeProps, Teleport as _Teleport } from "vue";
|
|
4
4
|
const _hoisted_1 = ["data-id", "data-dragging", "data-wheeling", "data-disabled", "data-position"];
|
|
5
|
-
const _hoisted_2 = {
|
|
6
|
-
|
|
5
|
+
const _hoisted_2 = {
|
|
6
|
+
ref: "wrapper",
|
|
7
|
+
class: "magic-drawer__wrapper"
|
|
8
|
+
};
|
|
9
|
+
const _hoisted_3 = { class: "magic-drawer__content" };
|
|
10
|
+
const _hoisted_4 = {
|
|
7
11
|
key: 0,
|
|
8
12
|
class: "magic-drawer__overlay"
|
|
9
13
|
};
|
|
10
14
|
import {
|
|
11
|
-
|
|
15
|
+
useTemplateRef,
|
|
16
|
+
shallowRef,
|
|
12
17
|
watch,
|
|
13
18
|
computed,
|
|
14
19
|
nextTick,
|
|
@@ -56,9 +61,9 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
56
61
|
}
|
|
57
62
|
});
|
|
58
63
|
const mappedOptions = customDefu(__props.options, defaultOptions);
|
|
59
|
-
const elRef =
|
|
60
|
-
const drawerRef =
|
|
61
|
-
const wrapperRef =
|
|
64
|
+
const elRef = useTemplateRef("el");
|
|
65
|
+
const drawerRef = useTemplateRef("drawer");
|
|
66
|
+
const wrapperRef = useTemplateRef("wrapper");
|
|
62
67
|
const {
|
|
63
68
|
trapFocus,
|
|
64
69
|
releaseFocus,
|
|
@@ -71,7 +76,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
71
76
|
focusTrap: mappedOptions.focusTrap
|
|
72
77
|
});
|
|
73
78
|
const { isActive, open, close } = useMagicDrawer(__props.id);
|
|
74
|
-
const overshoot =
|
|
79
|
+
const overshoot = shallowRef(0);
|
|
75
80
|
const {
|
|
76
81
|
position,
|
|
77
82
|
snapPoints,
|
|
@@ -109,9 +114,9 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
109
114
|
const { initializeState, deleteState } = useDrawerState(__props.id);
|
|
110
115
|
const state = initializeState();
|
|
111
116
|
const { dragging, wheeling } = toRefs(state);
|
|
112
|
-
const innerActive =
|
|
113
|
-
const wrapperActive =
|
|
114
|
-
const wasActive =
|
|
117
|
+
const innerActive = shallowRef(false);
|
|
118
|
+
const wrapperActive = shallowRef(false);
|
|
119
|
+
const wasActive = shallowRef(false);
|
|
115
120
|
const {
|
|
116
121
|
onBeforeEnter,
|
|
117
122
|
onEnter,
|
|
@@ -250,8 +255,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
250
255
|
disabled: _unref(mappedOptions).teleport?.disabled
|
|
251
256
|
}, [
|
|
252
257
|
_createElementVNode("div", _mergeProps({
|
|
253
|
-
|
|
254
|
-
ref: drawerRef,
|
|
258
|
+
ref: "drawer",
|
|
255
259
|
class: "magic-drawer",
|
|
256
260
|
"data-id": toValue(_ctx.id),
|
|
257
261
|
"data-dragging": _unref(dragging),
|
|
@@ -285,11 +289,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
285
289
|
}, 8, ["name"])) : _createCommentVNode("v-if", true),
|
|
286
290
|
_createElementVNode(
|
|
287
291
|
"div",
|
|
288
|
-
|
|
289
|
-
ref_key: "wrapperRef",
|
|
290
|
-
ref: wrapperRef,
|
|
291
|
-
class: "magic-drawer__wrapper"
|
|
292
|
-
},
|
|
292
|
+
_hoisted_2,
|
|
293
293
|
[
|
|
294
294
|
_createVNode(_Transition, {
|
|
295
295
|
name: contentTransition.value,
|
|
@@ -304,11 +304,10 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
304
304
|
default: _withCtx(() => [
|
|
305
305
|
_withDirectives(_createElementVNode(
|
|
306
306
|
"div",
|
|
307
|
-
|
|
307
|
+
_hoisted_3,
|
|
308
308
|
[
|
|
309
309
|
(_openBlock(), _createBlock(_resolveDynamicComponent(_unref(mappedOptions).tag), {
|
|
310
|
-
|
|
311
|
-
ref: elRef,
|
|
310
|
+
ref: "el",
|
|
312
311
|
class: "magic-drawer__drag",
|
|
313
312
|
style: _normalizeStyle(_unref(style)),
|
|
314
313
|
onPointerdown: guardedPointerdown,
|
|
@@ -316,7 +315,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
316
315
|
}, {
|
|
317
316
|
default: _withCtx(() => [
|
|
318
317
|
_renderSlot(_ctx.$slots, "default"),
|
|
319
|
-
_unref(hasDragged) ? (_openBlock(), _createElementBlock("div",
|
|
318
|
+
_unref(hasDragged) ? (_openBlock(), _createElementBlock("div", _hoisted_4)) : _createCommentVNode("v-if", true)
|
|
320
319
|
]),
|
|
321
320
|
_: 3
|
|
322
321
|
/* FORWARDED */
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { toValue, type MaybeRef } from 'vue';
|
|
2
|
+
import type { MagicDrawerOptions } from '../types/index.js';
|
|
3
|
+
import '@maas/vue-equipment/utils/css/animations/fade-in.css';
|
|
4
|
+
import '@maas/vue-equipment/utils/css/animations/fade-out.css';
|
|
5
|
+
import '@maas/vue-equipment/utils/css/animations/slide-ltr-in.css';
|
|
6
|
+
import '@maas/vue-equipment/utils/css/animations/slide-rtl-in.css';
|
|
7
|
+
import '@maas/vue-equipment/utils/css/animations/slide-ttb-in.css';
|
|
8
|
+
import '@maas/vue-equipment/utils/css/animations/slide-btt-in.css';
|
|
9
|
+
import '@maas/vue-equipment/utils/css/animations/slide-ltr-out.css';
|
|
10
|
+
import '@maas/vue-equipment/utils/css/animations/slide-rtl-out.css';
|
|
11
|
+
import '@maas/vue-equipment/utils/css/animations/slide-ttb-out.css';
|
|
12
|
+
import '@maas/vue-equipment/utils/css/animations/slide-btt-out.css';
|
|
13
|
+
interface MagicDrawerProps {
|
|
14
|
+
id: MaybeRef<string>;
|
|
15
|
+
options?: MagicDrawerOptions;
|
|
16
|
+
}
|
|
17
|
+
declare const mappedOptions: Omit<MagicDrawerOptions, keyof MagicDrawerOptions> & Omit<import("../types/index").DrawerDefaultOptions, keyof MagicDrawerOptions> & {
|
|
18
|
+
threshold: ({
|
|
19
|
+
lock?: number;
|
|
20
|
+
distance?: number;
|
|
21
|
+
momentum?: number;
|
|
22
|
+
} & import("../../../../utils").RequireAll<{
|
|
23
|
+
lock?: number;
|
|
24
|
+
distance?: number;
|
|
25
|
+
momentum?: number;
|
|
26
|
+
}>) | (Omit<{
|
|
27
|
+
lock?: number;
|
|
28
|
+
distance?: number;
|
|
29
|
+
momentum?: number;
|
|
30
|
+
}, "lock" | "distance" | "momentum"> & Omit<{
|
|
31
|
+
lock?: number;
|
|
32
|
+
distance?: number;
|
|
33
|
+
momentum?: number;
|
|
34
|
+
} & import("../../../../utils").RequireAll<{
|
|
35
|
+
lock?: number;
|
|
36
|
+
distance?: number;
|
|
37
|
+
momentum?: number;
|
|
38
|
+
}>, "lock" | "distance" | "momentum"> & {
|
|
39
|
+
lock: number;
|
|
40
|
+
distance: number;
|
|
41
|
+
momentum: number;
|
|
42
|
+
});
|
|
43
|
+
transition: {
|
|
44
|
+
content?: string;
|
|
45
|
+
backdrop?: string;
|
|
46
|
+
};
|
|
47
|
+
disabled: boolean;
|
|
48
|
+
animation: ({
|
|
49
|
+
snap?: {
|
|
50
|
+
duration?: number;
|
|
51
|
+
easing?: (t: number) => number;
|
|
52
|
+
};
|
|
53
|
+
} & import("../../../../utils").RequireAll<{
|
|
54
|
+
snap?: {
|
|
55
|
+
duration?: number;
|
|
56
|
+
easing?: (t: number) => number;
|
|
57
|
+
};
|
|
58
|
+
}>) | (Omit<{
|
|
59
|
+
snap?: {
|
|
60
|
+
duration?: number;
|
|
61
|
+
easing?: (t: number) => number;
|
|
62
|
+
};
|
|
63
|
+
}, "snap"> & Omit<{
|
|
64
|
+
snap?: {
|
|
65
|
+
duration?: number;
|
|
66
|
+
easing?: (t: number) => number;
|
|
67
|
+
};
|
|
68
|
+
} & import("../../../../utils").RequireAll<{
|
|
69
|
+
snap?: {
|
|
70
|
+
duration?: number;
|
|
71
|
+
easing?: (t: number) => number;
|
|
72
|
+
};
|
|
73
|
+
}>, "snap"> & {
|
|
74
|
+
snap: {
|
|
75
|
+
duration?: number;
|
|
76
|
+
easing?: (t: number) => number;
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
backdrop: boolean;
|
|
80
|
+
tag: "dialog" | "div";
|
|
81
|
+
focusTrap: boolean | import("focus-trap").Options;
|
|
82
|
+
scrollLock: {
|
|
83
|
+
padding: boolean;
|
|
84
|
+
} | ((boolean | {
|
|
85
|
+
padding: boolean;
|
|
86
|
+
}) & import("../../../../utils").RequireAll<boolean | {
|
|
87
|
+
padding: boolean;
|
|
88
|
+
} | undefined>) | (Omit<{
|
|
89
|
+
padding: boolean;
|
|
90
|
+
}, "padding"> & Omit<false & import("../../../../utils").RequireAll<{
|
|
91
|
+
padding: boolean;
|
|
92
|
+
}>, "padding"> & {
|
|
93
|
+
padding: boolean;
|
|
94
|
+
}) | (Omit<{
|
|
95
|
+
padding: boolean;
|
|
96
|
+
}, "padding"> & Omit<true & import("../../../../utils").RequireAll<{
|
|
97
|
+
padding: boolean;
|
|
98
|
+
}>, "padding"> & {
|
|
99
|
+
padding: boolean;
|
|
100
|
+
}) | (Omit<{
|
|
101
|
+
padding: boolean;
|
|
102
|
+
}, "padding"> & Omit<{
|
|
103
|
+
padding: boolean;
|
|
104
|
+
} & false, "padding"> & {
|
|
105
|
+
padding: boolean;
|
|
106
|
+
}) | (Omit<{
|
|
107
|
+
padding: boolean;
|
|
108
|
+
}, "padding"> & Omit<{
|
|
109
|
+
padding: boolean;
|
|
110
|
+
} & true, "padding"> & {
|
|
111
|
+
padding: boolean;
|
|
112
|
+
});
|
|
113
|
+
teleport: {
|
|
114
|
+
target?: string;
|
|
115
|
+
disabled?: boolean;
|
|
116
|
+
};
|
|
117
|
+
keyListener: ({
|
|
118
|
+
close?: string[] | false;
|
|
119
|
+
} & import("../../../../utils").RequireAll<{
|
|
120
|
+
close?: string[] | false;
|
|
121
|
+
}>) | (Omit<{
|
|
122
|
+
close?: string[] | false;
|
|
123
|
+
}, "close"> & Omit<{
|
|
124
|
+
close?: string[] | false;
|
|
125
|
+
} & import("../../../../utils").RequireAll<{
|
|
126
|
+
close?: string[] | false;
|
|
127
|
+
}>, "close"> & {
|
|
128
|
+
close: (false | string[] | undefined) & (false | string[]);
|
|
129
|
+
});
|
|
130
|
+
position: "left" | "top" | "right" | "bottom";
|
|
131
|
+
snapPoints: import("../types/index").DrawerSnapPoint[];
|
|
132
|
+
initial: {
|
|
133
|
+
open?: boolean;
|
|
134
|
+
transition?: boolean;
|
|
135
|
+
snapPoint?: import("../types/index").DrawerSnapPoint;
|
|
136
|
+
};
|
|
137
|
+
enableMousewheel: boolean;
|
|
138
|
+
preventZoom: boolean;
|
|
139
|
+
preventDragClose: boolean;
|
|
140
|
+
};
|
|
141
|
+
declare const disabled: import("vue").ComputedRef<boolean>;
|
|
142
|
+
declare const style: import("vue").ComputedRef<string>, hasDragged: import("vue").ComputedRef<boolean>;
|
|
143
|
+
declare const dragging: import("vue").Ref<boolean, boolean>, wheeling: import("vue").Ref<boolean, boolean>;
|
|
144
|
+
declare const innerActive: import("vue").ShallowRef<boolean, boolean>;
|
|
145
|
+
declare const wrapperActive: import("vue").ShallowRef<boolean, boolean>;
|
|
146
|
+
declare const onBeforeEnter: () => void, onEnter: () => void, onAfterEnter: () => Promise<void>, onBeforeLeave: () => void, onLeave: () => void, onAfterLeave: () => void;
|
|
147
|
+
declare const backdropTransition: import("vue").ComputedRef<string | undefined>;
|
|
148
|
+
declare const contentTransition: import("vue").ComputedRef<string | undefined>;
|
|
149
|
+
declare function guardedPointerdown(event: PointerEvent): void;
|
|
150
|
+
declare function guardedClick(event: PointerEvent): void;
|
|
151
|
+
declare function guardedClose(): void;
|
|
152
|
+
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
153
|
+
declare var __VLS_9: {}, __VLS_35: {};
|
|
154
|
+
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
155
|
+
backdrop?: (props: typeof __VLS_9) => any;
|
|
156
|
+
} & {
|
|
157
|
+
default?: (props: typeof __VLS_35) => any;
|
|
158
|
+
}>;
|
|
159
|
+
declare const __VLS_self: import("vue").DefineComponent<MagicDrawerProps, {
|
|
160
|
+
toValue: typeof toValue;
|
|
161
|
+
mappedOptions: typeof mappedOptions;
|
|
162
|
+
disabled: typeof disabled;
|
|
163
|
+
style: typeof style;
|
|
164
|
+
hasDragged: typeof hasDragged;
|
|
165
|
+
dragging: typeof dragging;
|
|
166
|
+
wheeling: typeof wheeling;
|
|
167
|
+
innerActive: typeof innerActive;
|
|
168
|
+
wrapperActive: typeof wrapperActive;
|
|
169
|
+
onBeforeEnter: typeof onBeforeEnter;
|
|
170
|
+
onEnter: typeof onEnter;
|
|
171
|
+
onAfterEnter: typeof onAfterEnter;
|
|
172
|
+
onBeforeLeave: typeof onBeforeLeave;
|
|
173
|
+
onLeave: typeof onLeave;
|
|
174
|
+
onAfterLeave: typeof onAfterLeave;
|
|
175
|
+
backdropTransition: typeof backdropTransition;
|
|
176
|
+
contentTransition: typeof contentTransition;
|
|
177
|
+
guardedPointerdown: typeof guardedPointerdown;
|
|
178
|
+
guardedClick: typeof guardedClick;
|
|
179
|
+
guardedClose: typeof guardedClose;
|
|
180
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicDrawerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
181
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicDrawerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicDrawerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
182
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
183
|
+
export default _default;
|
|
184
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
185
|
+
new (): {
|
|
186
|
+
$slots: S;
|
|
187
|
+
};
|
|
188
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
1
|
+
import { ref, shallowRef } from "vue";
|
|
2
2
|
import { defu } from "defu";
|
|
3
3
|
import { useScrollLock } from "@vueuse/core";
|
|
4
4
|
import { useFocusTrap } from "@vueuse/integrations/useFocusTrap";
|
|
@@ -8,7 +8,7 @@ const defaultOptions = {
|
|
|
8
8
|
focusTarget: void 0,
|
|
9
9
|
scrollLock: true
|
|
10
10
|
};
|
|
11
|
-
const scrollLock = typeof window !== "undefined" ? useScrollLock(document?.documentElement) :
|
|
11
|
+
const scrollLock = typeof window !== "undefined" ? useScrollLock(document?.documentElement) : shallowRef(false);
|
|
12
12
|
export function useDrawerDOM(args) {
|
|
13
13
|
const positionFixedElements = ref([]);
|
|
14
14
|
const mappedOptions = defu(args, defaultOptions);
|
|
@@ -2,8 +2,8 @@ import { type Ref, type MaybeRef } from 'vue';
|
|
|
2
2
|
import type { DrawerDefaultOptions } from '../../types/index.js';
|
|
3
3
|
type UseDrawerDragArgs = {
|
|
4
4
|
id: MaybeRef<string>;
|
|
5
|
-
elRef: Ref<HTMLElement |
|
|
6
|
-
wrapperRef: Ref<HTMLDivElement |
|
|
5
|
+
elRef: Ref<HTMLElement | null>;
|
|
6
|
+
wrapperRef: Ref<HTMLDivElement | null>;
|
|
7
7
|
position: MaybeRef<DrawerDefaultOptions['position']>;
|
|
8
8
|
snapPoints: MaybeRef<DrawerDefaultOptions['snapPoints']>;
|
|
9
9
|
threshold: MaybeRef<DrawerDefaultOptions['threshold']>;
|
|
@@ -383,9 +383,9 @@ export function useDrawerDrag(args) {
|
|
|
383
383
|
shouldClose.value = false;
|
|
384
384
|
checkDirection({ x: e.screenX, y: e.screenY });
|
|
385
385
|
if (!scrollLock) {
|
|
386
|
-
const
|
|
387
|
-
if (
|
|
388
|
-
scrollLock = useScrollLock(
|
|
386
|
+
const scrollLockTarget = lockScroll(e.target);
|
|
387
|
+
if (scrollLockTarget) {
|
|
388
|
+
scrollLock = useScrollLock(scrollLockTarget);
|
|
389
389
|
scrollLock.value = true;
|
|
390
390
|
}
|
|
391
391
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Ref, type MaybeRef } from 'vue';
|
|
2
2
|
import type { DrawerSnapPoint, DrawerDefaultOptions } from '../../types/index.js';
|
|
3
3
|
interface UseDrawerGuardsArgs {
|
|
4
|
-
elRef: Ref<HTMLElement |
|
|
4
|
+
elRef: Ref<HTMLElement | null>;
|
|
5
5
|
absDirectionX: MaybeRef<'with' | 'against' | undefined>;
|
|
6
6
|
absDirectionY: MaybeRef<'with' | 'against' | undefined>;
|
|
7
7
|
position: MaybeRef<DrawerDefaultOptions['position']>;
|
|
@@ -8,6 +8,20 @@ export function useDrawerGuards(args) {
|
|
|
8
8
|
const canSnap = computed(() => {
|
|
9
9
|
return toValue(activeSnapPoint) !== 1 && !!toValue(activeSnapPoint);
|
|
10
10
|
});
|
|
11
|
+
function canScrollY(element) {
|
|
12
|
+
const style = window.getComputedStyle(element);
|
|
13
|
+
const overflowY = style.overflowY;
|
|
14
|
+
const canScroll = ["auto", "scroll"].includes(overflowY);
|
|
15
|
+
const hasOverflow = Math.round(element.scrollHeight) > Math.round(element.clientHeight);
|
|
16
|
+
return canScroll && hasOverflow;
|
|
17
|
+
}
|
|
18
|
+
function canScrollX(element) {
|
|
19
|
+
const style = window.getComputedStyle(element);
|
|
20
|
+
const overflowX = style.overflowX;
|
|
21
|
+
const canScroll = ["auto", "scroll"].includes(overflowX);
|
|
22
|
+
const hasOverflow = Math.round(element.scrollWidth) > Math.round(element.clientWidth);
|
|
23
|
+
return canScroll && hasOverflow;
|
|
24
|
+
}
|
|
11
25
|
function canDrag(el) {
|
|
12
26
|
let element = el;
|
|
13
27
|
if (hasCursor.value) {
|
|
@@ -22,7 +36,7 @@ export function useDrawerGuards(args) {
|
|
|
22
36
|
}
|
|
23
37
|
switch (position) {
|
|
24
38
|
case "bottom":
|
|
25
|
-
if (element
|
|
39
|
+
if (canScrollY(element)) {
|
|
26
40
|
if (element.scrollTop > 0) {
|
|
27
41
|
return false;
|
|
28
42
|
}
|
|
@@ -35,7 +49,7 @@ export function useDrawerGuards(args) {
|
|
|
35
49
|
}
|
|
36
50
|
break;
|
|
37
51
|
case "top":
|
|
38
|
-
if (element
|
|
52
|
+
if (canScrollY(element)) {
|
|
39
53
|
const maxScroll = element.scrollHeight - element.clientHeight;
|
|
40
54
|
if (element.scrollTop < maxScroll) {
|
|
41
55
|
return false;
|
|
@@ -49,7 +63,7 @@ export function useDrawerGuards(args) {
|
|
|
49
63
|
}
|
|
50
64
|
break;
|
|
51
65
|
case "right":
|
|
52
|
-
if (element
|
|
66
|
+
if (canScrollX(element)) {
|
|
53
67
|
if (element.scrollLeft > 0) {
|
|
54
68
|
return false;
|
|
55
69
|
}
|
|
@@ -62,7 +76,7 @@ export function useDrawerGuards(args) {
|
|
|
62
76
|
}
|
|
63
77
|
break;
|
|
64
78
|
case "left":
|
|
65
|
-
if (element
|
|
79
|
+
if (canScrollX(element)) {
|
|
66
80
|
const maxScroll = element.scrollWidth - element.clientWidth;
|
|
67
81
|
if (element.scrollLeft < maxScroll) {
|
|
68
82
|
return false;
|
|
@@ -89,13 +103,13 @@ export function useDrawerGuards(args) {
|
|
|
89
103
|
switch (position) {
|
|
90
104
|
case "bottom":
|
|
91
105
|
case "top":
|
|
92
|
-
if (element
|
|
106
|
+
if (canScrollY(element)) {
|
|
93
107
|
return false;
|
|
94
108
|
}
|
|
95
109
|
break;
|
|
96
110
|
case "left":
|
|
97
111
|
case "right":
|
|
98
|
-
if (element
|
|
112
|
+
if (canScrollX(element)) {
|
|
99
113
|
return false;
|
|
100
114
|
}
|
|
101
115
|
break;
|
|
@@ -117,41 +131,45 @@ export function useDrawerGuards(args) {
|
|
|
117
131
|
}
|
|
118
132
|
switch (position) {
|
|
119
133
|
case "bottom":
|
|
120
|
-
if (element
|
|
134
|
+
if (canScrollY(element)) {
|
|
121
135
|
if (element.scrollTop === 0 || canSnap.value) {
|
|
122
136
|
if (toValue(absDirectionY) === "against") {
|
|
123
137
|
return element;
|
|
124
138
|
}
|
|
125
139
|
}
|
|
140
|
+
return void 0;
|
|
126
141
|
}
|
|
127
142
|
break;
|
|
128
143
|
case "top":
|
|
129
|
-
if (element
|
|
144
|
+
if (canScrollY(element)) {
|
|
130
145
|
const maxScroll = element.scrollHeight - element.clientHeight;
|
|
131
146
|
if (element.scrollTop === maxScroll || canSnap.value) {
|
|
132
147
|
if (toValue(absDirectionY) === "against") {
|
|
133
148
|
return element;
|
|
134
149
|
}
|
|
135
150
|
}
|
|
151
|
+
return void 0;
|
|
136
152
|
}
|
|
137
153
|
break;
|
|
138
154
|
case "right":
|
|
139
|
-
if (element
|
|
155
|
+
if (canScrollX(element)) {
|
|
140
156
|
if (element.scrollLeft === 0 || canSnap.value) {
|
|
141
157
|
if (toValue(absDirectionX) === "against") {
|
|
142
158
|
return element;
|
|
143
159
|
}
|
|
144
160
|
}
|
|
161
|
+
return void 0;
|
|
145
162
|
}
|
|
146
163
|
break;
|
|
147
164
|
case "left":
|
|
148
|
-
if (element
|
|
165
|
+
if (canScrollX(element)) {
|
|
149
166
|
const maxScroll = element.scrollWidth - element.clientWidth;
|
|
150
167
|
if (element.scrollLeft === maxScroll || canSnap.value) {
|
|
151
168
|
if (toValue(absDirectionX) === "against") {
|
|
152
169
|
return element;
|
|
153
170
|
}
|
|
154
171
|
}
|
|
172
|
+
return void 0;
|
|
155
173
|
}
|
|
156
174
|
break;
|
|
157
175
|
}
|
|
@@ -2,8 +2,8 @@ import { type Ref, type MaybeRef } from 'vue';
|
|
|
2
2
|
import type { DrawerDefaultOptions } from '../../types/index.js';
|
|
3
3
|
interface UseDrawerProgressArgs {
|
|
4
4
|
id: MaybeRef<string>;
|
|
5
|
-
elRef: Ref<HTMLElement |
|
|
6
|
-
drawerRef: Ref<HTMLDivElement |
|
|
5
|
+
elRef: Ref<HTMLElement | null>;
|
|
6
|
+
drawerRef: Ref<HTMLDivElement | null>;
|
|
7
7
|
position: MaybeRef<DrawerDefaultOptions['position']>;
|
|
8
8
|
overshoot: MaybeRef<number>;
|
|
9
9
|
}
|