@maas/vue-equipment 1.0.0-beta.18 → 1.0.0-beta.19
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/nuxt/module.json +1 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue.d.ts +1 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue.d.ts +1 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue.d.ts +2 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue.d.ts +1 -1
- package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue.d.ts +1 -1
- package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue.d.ts +1 -1
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +1 -1
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +8 -8
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +2 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue.d.ts +1 -1
- package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +6 -6
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +18 -1
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue.d.ts +1 -1
- package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetection.mjs +13 -3
- package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.d.ts +2 -2
- package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.mjs +34 -29
- package/package.json +1 -1
package/dist/nuxt/module.json
CHANGED
|
@@ -21,7 +21,7 @@ declare const mappedAnimation: import("vue").ComputedRef<{
|
|
|
21
21
|
declare const onBeforeEnter: () => void, onEnter: () => void, onAfterEnter: () => Promise<void>, onBeforeLeave: () => void, onLeave: () => void, onAfterLeave: () => void;
|
|
22
22
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
23
23
|
declare var __VLS_13: {
|
|
24
|
-
viewActive:
|
|
24
|
+
viewActive: boolean | undefined;
|
|
25
25
|
};
|
|
26
26
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
27
27
|
default?: (props: typeof __VLS_13) => any;
|
|
@@ -13,7 +13,7 @@ declare const mappedDisabled: import("vue").ComputedRef<boolean | undefined>;
|
|
|
13
13
|
declare const onMouseenter: () => void, onClick: () => void;
|
|
14
14
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
15
15
|
declare var __VLS_12: {
|
|
16
|
-
viewActive:
|
|
16
|
+
viewActive: boolean | undefined;
|
|
17
17
|
};
|
|
18
18
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
19
19
|
default?: (props: typeof __VLS_12) => any;
|
|
@@ -8,7 +8,7 @@ declare const mappedId: import("vue").ComputedRef<string>;
|
|
|
8
8
|
declare const view: import("../types/index.js").AccordionView;
|
|
9
9
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
10
10
|
declare var __VLS_6: {
|
|
11
|
-
viewActive:
|
|
11
|
+
viewActive: boolean;
|
|
12
12
|
};
|
|
13
13
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
14
14
|
default?: (props: typeof __VLS_6) => any;
|
|
@@ -10,7 +10,7 @@ declare function guardedSelect(): void;
|
|
|
10
10
|
declare function onClick(event: MouseEvent): void;
|
|
11
11
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
12
12
|
declare var __VLS_1: {
|
|
13
|
-
itemActive:
|
|
13
|
+
itemActive: boolean;
|
|
14
14
|
itemDisabled: boolean;
|
|
15
15
|
};
|
|
16
16
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
@@ -15,8 +15,8 @@ declare const mappedDisabled: import("vue").ComputedRef<boolean>;
|
|
|
15
15
|
declare const onMouseenter: () => Promise<void>, onClick: (e: MouseEvent) => Promise<void>;
|
|
16
16
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
17
17
|
declare var __VLS_12: {
|
|
18
|
-
viewActive:
|
|
19
|
-
triggerDisabled:
|
|
18
|
+
viewActive: boolean | undefined;
|
|
19
|
+
triggerDisabled: boolean;
|
|
20
20
|
};
|
|
21
21
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
22
22
|
default?: (props: typeof __VLS_12) => any;
|
|
@@ -6,7 +6,7 @@ declare const mappedId: import("vue").ComputedRef<string>;
|
|
|
6
6
|
declare const view: import("../types/index.js").CommandView;
|
|
7
7
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
8
8
|
declare var __VLS_1: {
|
|
9
|
-
viewActive:
|
|
9
|
+
viewActive: boolean;
|
|
10
10
|
};
|
|
11
11
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
12
12
|
default?: (props: typeof __VLS_1) => any;
|
|
@@ -6,7 +6,7 @@ interface MagicCookieItemProps {
|
|
|
6
6
|
declare const item: import("../types/index.js").CookieItem;
|
|
7
7
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
8
8
|
declare var __VLS_1: {
|
|
9
|
-
item:
|
|
9
|
+
item: import("../types/index.js").CookieItem;
|
|
10
10
|
};
|
|
11
11
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
12
12
|
default?: (props: typeof __VLS_1) => any;
|
|
@@ -5,7 +5,7 @@ declare const state: import("../types/index.js").CookieState;
|
|
|
5
5
|
declare const onBeforeEnter: () => void, onEnter: () => void, onAfterEnter: () => Promise<void>, onBeforeLeave: () => void, onLeave: () => void, onAfterLeave: () => void;
|
|
6
6
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
7
7
|
declare var __VLS_18: {
|
|
8
|
-
viewActive:
|
|
8
|
+
viewActive: boolean;
|
|
9
9
|
};
|
|
10
10
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
11
11
|
default?: (props: typeof __VLS_18) => any;
|
|
@@ -68,10 +68,10 @@ declare const mappedOptions: Omit<MagicDraggableOptions, keyof MagicDraggableOpt
|
|
|
68
68
|
easing?: (t: number) => number;
|
|
69
69
|
};
|
|
70
70
|
});
|
|
71
|
+
tag: "div" | "dialog";
|
|
71
72
|
scrollLock: boolean | {
|
|
72
73
|
padding: boolean;
|
|
73
74
|
};
|
|
74
|
-
tag: "div" | "dialog";
|
|
75
75
|
snapPoints: import("../types/index.js").DraggableSnapPoint[];
|
|
76
76
|
initial: {
|
|
77
77
|
snapPoint?: import("../types/index.js").DraggableSnapPoint;
|
|
@@ -76,6 +76,9 @@ declare const mappedOptions: Omit<MagicDrawerOptions, keyof MagicDrawerOptions>
|
|
|
76
76
|
easing?: (t: number) => number;
|
|
77
77
|
};
|
|
78
78
|
});
|
|
79
|
+
backdrop: boolean;
|
|
80
|
+
tag: "div" | "dialog";
|
|
81
|
+
focusTrap: boolean | import("focus-trap").Options;
|
|
79
82
|
scrollLock: {
|
|
80
83
|
padding: boolean;
|
|
81
84
|
} | ((boolean | {
|
|
@@ -107,6 +110,10 @@ declare const mappedOptions: Omit<MagicDrawerOptions, keyof MagicDrawerOptions>
|
|
|
107
110
|
} & true, "padding"> & {
|
|
108
111
|
padding: boolean;
|
|
109
112
|
});
|
|
113
|
+
teleport: {
|
|
114
|
+
target?: string;
|
|
115
|
+
disabled?: boolean;
|
|
116
|
+
};
|
|
110
117
|
keyListener: ({
|
|
111
118
|
close?: string[] | false;
|
|
112
119
|
} & import("../../../../utils/index.js").RequireAll<{
|
|
@@ -120,15 +127,8 @@ declare const mappedOptions: Omit<MagicDrawerOptions, keyof MagicDrawerOptions>
|
|
|
120
127
|
}>, "close"> & {
|
|
121
128
|
close: (false | string[] | undefined) & (false | string[]);
|
|
122
129
|
});
|
|
123
|
-
position: "
|
|
124
|
-
backdrop: boolean;
|
|
125
|
-
tag: "div" | "dialog";
|
|
126
|
-
focusTrap: boolean | import("focus-trap").Options;
|
|
130
|
+
position: "right" | "left" | "top" | "bottom";
|
|
127
131
|
snapPoints: import("../types/index.js").DrawerSnapPoint[];
|
|
128
|
-
teleport: {
|
|
129
|
-
target?: string;
|
|
130
|
-
disabled?: boolean;
|
|
131
|
-
};
|
|
132
132
|
initial: {
|
|
133
133
|
open?: boolean;
|
|
134
134
|
transition?: boolean;
|
|
@@ -10,7 +10,7 @@ declare function guardedUnselect(): void;
|
|
|
10
10
|
declare function onClick(event: MouseEvent): void;
|
|
11
11
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
12
12
|
declare var __VLS_1: {
|
|
13
|
-
itemActive:
|
|
13
|
+
itemActive: boolean;
|
|
14
14
|
itemDisabled: boolean;
|
|
15
15
|
};
|
|
16
16
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
@@ -12,7 +12,7 @@ declare const onClick: () => void, onMouseenter: () => void;
|
|
|
12
12
|
declare let channel: import("../types/index.js").MenuChannel;
|
|
13
13
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
14
14
|
declare var __VLS_11: {
|
|
15
|
-
channelActive:
|
|
15
|
+
channelActive: boolean;
|
|
16
16
|
remoteDisabled: boolean;
|
|
17
17
|
};
|
|
18
18
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
@@ -14,8 +14,8 @@ declare const mappedTabindex: import("vue").ComputedRef<0 | undefined>;
|
|
|
14
14
|
declare const onMouseenter: () => void, onClick: (e: MouseEvent) => void;
|
|
15
15
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
16
16
|
declare var __VLS_13: {
|
|
17
|
-
viewActive:
|
|
18
|
-
triggerDisabled:
|
|
17
|
+
viewActive: boolean | undefined;
|
|
18
|
+
triggerDisabled: boolean;
|
|
19
19
|
};
|
|
20
20
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
21
21
|
default?: (props: typeof __VLS_13) => any;
|
|
@@ -7,7 +7,7 @@ declare const mappedId: import("vue").ComputedRef<string>;
|
|
|
7
7
|
declare const view: import("../types/index.js").MenuView;
|
|
8
8
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
9
9
|
declare var __VLS_1: {
|
|
10
|
-
viewActive:
|
|
10
|
+
viewActive: boolean;
|
|
11
11
|
};
|
|
12
12
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
13
13
|
default?: (props: typeof __VLS_1) => any;
|
|
@@ -12,19 +12,19 @@ declare const mappedOptions: Omit<MagicModalOptions, keyof MagicModalOptions> &
|
|
|
12
12
|
content?: string;
|
|
13
13
|
backdrop?: string;
|
|
14
14
|
};
|
|
15
|
-
scrollLock: boolean | {
|
|
16
|
-
padding: boolean;
|
|
17
|
-
};
|
|
18
|
-
keyListener: {
|
|
19
|
-
close?: string[] | false;
|
|
20
|
-
};
|
|
21
15
|
backdrop: boolean;
|
|
22
16
|
tag: "div" | "dialog";
|
|
23
17
|
focusTrap: boolean | import("focus-trap").Options;
|
|
18
|
+
scrollLock: boolean | {
|
|
19
|
+
padding: boolean;
|
|
20
|
+
};
|
|
24
21
|
teleport: {
|
|
25
22
|
target?: string;
|
|
26
23
|
disabled?: boolean;
|
|
27
24
|
};
|
|
25
|
+
keyListener: {
|
|
26
|
+
close?: string[] | false;
|
|
27
|
+
};
|
|
28
28
|
};
|
|
29
29
|
declare const mappedId: string;
|
|
30
30
|
declare const close: () => void;
|
|
@@ -22,7 +22,24 @@ declare const scrollReturn: {
|
|
|
22
22
|
};
|
|
23
23
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
24
24
|
declare var __VLS_1: {
|
|
25
|
-
scrollReturn:
|
|
25
|
+
scrollReturn: {
|
|
26
|
+
x: import("vue").WritableComputedRef<number, number>;
|
|
27
|
+
y: import("vue").WritableComputedRef<number, number>;
|
|
28
|
+
isScrolling: import("vue").ShallowRef<boolean, boolean>;
|
|
29
|
+
arrivedState: {
|
|
30
|
+
left: boolean;
|
|
31
|
+
right: boolean;
|
|
32
|
+
top: boolean;
|
|
33
|
+
bottom: boolean;
|
|
34
|
+
};
|
|
35
|
+
directions: {
|
|
36
|
+
left: boolean;
|
|
37
|
+
right: boolean;
|
|
38
|
+
top: boolean;
|
|
39
|
+
bottom: boolean;
|
|
40
|
+
};
|
|
41
|
+
measure(): void;
|
|
42
|
+
};
|
|
26
43
|
};
|
|
27
44
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
28
45
|
default?: (props: typeof __VLS_1) => any;
|
|
@@ -6,7 +6,7 @@ interface MagicScrollSceneProps {
|
|
|
6
6
|
declare const progress: import("vue").ShallowRef<number, number>;
|
|
7
7
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
8
8
|
declare var __VLS_1: {
|
|
9
|
-
progress:
|
|
9
|
+
progress: number;
|
|
10
10
|
};
|
|
11
11
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
12
12
|
default?: (props: typeof __VLS_1) => any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowRef, reactive, computed, toValue } from "vue";
|
|
2
|
-
import { useElementBounding } from "@vueuse/core";
|
|
2
|
+
import { useElementBounding, useWindowSize } from "@vueuse/core";
|
|
3
3
|
import { useMagicEmitter } from "@maas/vue-equipment/plugins";
|
|
4
4
|
export function useCollisionDetection(args) {
|
|
5
5
|
const { id, scrollY, child, parent, offset } = args;
|
|
@@ -25,8 +25,18 @@ export function useCollisionDetection(args) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
+
const { width, height } = useWindowSize();
|
|
29
|
+
const windowBoundingRect = {
|
|
30
|
+
width,
|
|
31
|
+
height,
|
|
32
|
+
right: width,
|
|
33
|
+
bottom: height,
|
|
34
|
+
top: shallowRef(0),
|
|
35
|
+
left: shallowRef(0)
|
|
36
|
+
};
|
|
28
37
|
const childBoundingRect = useElementBounding(child);
|
|
29
38
|
const parentBoundingRect = useElementBounding(parent);
|
|
39
|
+
const mappedParentBoundingRect = toValue(parent) ? parentBoundingRect : windowBoundingRect;
|
|
30
40
|
const mappedOffset = { top: 0, bottom: 0, ...offset };
|
|
31
41
|
const lastScrollY = shallowRef(0);
|
|
32
42
|
const scrollDirection = shallowRef();
|
|
@@ -101,7 +111,7 @@ export function useCollisionDetection(args) {
|
|
|
101
111
|
}
|
|
102
112
|
const offset2 = mappedOffset[parentEdge];
|
|
103
113
|
const mappedChildEdge = toValue(childBoundingRect[childEdge]);
|
|
104
|
-
const mappedParentEdge = toValue(
|
|
114
|
+
const mappedParentEdge = toValue(mappedParentBoundingRect[parentEdge]) + offset2;
|
|
105
115
|
if (direction === "down" && mappedChildEdge <= mappedParentEdge || direction === "up" && mappedChildEdge >= mappedParentEdge) {
|
|
106
116
|
alerted[direction][childEdge][parentEdge] = true;
|
|
107
117
|
useMagicEmitter().emit("collision", {
|
|
@@ -119,7 +129,7 @@ export function useCollisionDetection(args) {
|
|
|
119
129
|
}
|
|
120
130
|
const offset2 = mappedOffset[parentEdge];
|
|
121
131
|
const mappedChildEdge = toValue(childBoundingRect[childEdge]);
|
|
122
|
-
const mappedParentEdge = toValue(
|
|
132
|
+
const mappedParentEdge = toValue(mappedParentBoundingRect[parentEdge]) + offset2;
|
|
123
133
|
if (direction === "down" && mappedChildEdge >= mappedParentEdge || direction === "up" && mappedChildEdge <= mappedParentEdge) {
|
|
124
134
|
alerted[direction][childEdge][parentEdge] = false;
|
|
125
135
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type MaybeRef, type MaybeRefOrGetter } from 'vue';
|
|
2
2
|
import type { ScrollIntersection } from '../../types/index.js';
|
|
3
|
-
type
|
|
3
|
+
type UseScrollApiArgs = {
|
|
4
4
|
child: MaybeRef<HTMLElement | null | undefined>;
|
|
5
5
|
parent: MaybeRefOrGetter<HTMLElement | null | undefined>;
|
|
6
6
|
from: ScrollIntersection;
|
|
7
7
|
to: ScrollIntersection;
|
|
8
8
|
};
|
|
9
|
-
export declare function useScrollApi(
|
|
9
|
+
export declare function useScrollApi(args: UseScrollApiArgs): {
|
|
10
10
|
getCalculations: () => void;
|
|
11
11
|
getProgress: () => number;
|
|
12
12
|
};
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ref,
|
|
3
2
|
shallowRef,
|
|
4
3
|
inject,
|
|
5
4
|
toValue
|
|
6
5
|
} from "vue";
|
|
7
|
-
import { useWindowSize } from "@vueuse/core";
|
|
8
|
-
import { MagicScrollReturn } from "../../symbols/index.mjs";
|
|
6
|
+
import { useElementBounding, useWindowSize } from "@vueuse/core";
|
|
9
7
|
import { clampValue } from "@maas/vue-equipment/utils";
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import { MagicScrollReturn } from "../../symbols/index.mjs";
|
|
9
|
+
export function useScrollApi(args) {
|
|
10
|
+
const { child, parent, from, to } = args;
|
|
12
11
|
const scrollReturn = inject(MagicScrollReturn, void 0);
|
|
13
|
-
const childRect = ref(void 0);
|
|
14
|
-
const parentRect = ref(void 0);
|
|
15
12
|
const start = shallowRef(0);
|
|
16
13
|
const end = shallowRef(0);
|
|
17
|
-
const { width
|
|
14
|
+
const { width, height } = useWindowSize();
|
|
15
|
+
const windowBoundingRect = {
|
|
16
|
+
width,
|
|
17
|
+
height,
|
|
18
|
+
right: width,
|
|
19
|
+
bottom: height,
|
|
20
|
+
top: shallowRef(0),
|
|
21
|
+
left: shallowRef(0)
|
|
22
|
+
};
|
|
23
|
+
const childBoundingRect = useElementBounding(child);
|
|
24
|
+
const parentBoundingRect = useElementBounding(parent);
|
|
25
|
+
const mappedParentBoundingRect = toValue(parent) ? parentBoundingRect : windowBoundingRect;
|
|
18
26
|
function splitLocation(location) {
|
|
19
27
|
return {
|
|
20
28
|
child: location.match(/^[a-z]+/)[0],
|
|
@@ -23,55 +31,52 @@ export function useScrollApi(params) {
|
|
|
23
31
|
}
|
|
24
32
|
function getOffsetTop(points) {
|
|
25
33
|
let y = 0;
|
|
26
|
-
if (!childRect.value) return y;
|
|
27
34
|
const scrollY = toValue(scrollReturn?.y) || 0;
|
|
35
|
+
const parentTop = mappedParentBoundingRect.top.value;
|
|
36
|
+
const parentHeight = mappedParentBoundingRect.height.value;
|
|
37
|
+
const childTop = childBoundingRect.top.value;
|
|
38
|
+
const childHeight = childBoundingRect.height.value;
|
|
39
|
+
if (!childHeight) {
|
|
40
|
+
return y;
|
|
41
|
+
}
|
|
28
42
|
switch (points.child) {
|
|
29
43
|
case "top":
|
|
30
|
-
y +=
|
|
44
|
+
y += childTop + scrollY;
|
|
31
45
|
break;
|
|
32
46
|
case "center":
|
|
33
|
-
y +=
|
|
47
|
+
y += childTop + childHeight / 2 + scrollY;
|
|
34
48
|
break;
|
|
35
49
|
case "bottom":
|
|
36
|
-
y +=
|
|
50
|
+
y += childTop + childHeight + scrollY;
|
|
37
51
|
break;
|
|
38
52
|
}
|
|
39
|
-
if (!
|
|
53
|
+
if (!mappedParentBoundingRect.height.value) {
|
|
40
54
|
return y;
|
|
41
55
|
}
|
|
42
|
-
const dimensions = {
|
|
43
|
-
width: toValue(parentRect.value.width),
|
|
44
|
-
height: toValue(parentRect.value.height),
|
|
45
|
-
top: toValue(parentRect.value.top)
|
|
46
|
-
};
|
|
47
56
|
switch (points.parent) {
|
|
48
57
|
case "top":
|
|
49
|
-
y -=
|
|
58
|
+
y -= parentTop;
|
|
50
59
|
break;
|
|
51
60
|
case "center":
|
|
52
|
-
y -=
|
|
61
|
+
y -= parentTop + parentHeight / 2;
|
|
53
62
|
break;
|
|
54
63
|
case "bottom":
|
|
55
|
-
y -=
|
|
64
|
+
y -= parentTop + parentHeight;
|
|
56
65
|
break;
|
|
57
66
|
case "initial":
|
|
58
|
-
y -=
|
|
67
|
+
y -= childTop + scrollY;
|
|
59
68
|
break;
|
|
60
69
|
}
|
|
61
70
|
return y;
|
|
62
71
|
}
|
|
63
72
|
function getCalculations() {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
width: windowWidth.value,
|
|
67
|
-
height: windowHeight.value,
|
|
68
|
-
top: 0
|
|
69
|
-
};
|
|
73
|
+
childBoundingRect.update();
|
|
74
|
+
parentBoundingRect.update();
|
|
70
75
|
start.value = getOffsetTop(splitLocation(from));
|
|
71
76
|
end.value = getOffsetTop(splitLocation(to));
|
|
72
77
|
}
|
|
73
78
|
function getProgress() {
|
|
74
|
-
const scrollY = toValue(scrollReturn?.y)
|
|
79
|
+
const scrollY = toValue(scrollReturn?.y) ?? 0;
|
|
75
80
|
const total = Math.abs(end.value - start.value);
|
|
76
81
|
const current = scrollY - start.value;
|
|
77
82
|
return clampValue(current / total, 0, 1);
|