@maas/vue-equipment 0.9.8 → 0.9.9

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@maas/vue-equipment",
3
3
  "configKey": "vueEquipment",
4
- "version": "0.9.7"
4
+ "version": "0.9.8"
5
5
  }
@@ -77,7 +77,7 @@ useIntersectionObserver(
77
77
  calculate()
78
78
  }
79
79
  },
80
- { rootMargin: '150% 0px 150% 0px' },
80
+ { rootMargin: '150% 0px 150% 0px', threshold: 0.01 },
81
81
  )
82
82
 
83
83
  provide('mapValue', mapValue)
@@ -1,5 +1,5 @@
1
1
  import { ref, inject, toValue } from "vue";
2
- import { useElementBounding, useWindowSize } from "@vueuse/core";
2
+ import { useWindowSize } from "@vueuse/core";
3
3
  import { ScrollPositionKey } from "../symbols/index.mjs";
4
4
  import { clampValue } from "@maas/vue-equipment/utils";
5
5
  export function useScrollApi(params) {
@@ -9,13 +9,13 @@ export function useScrollApi(params) {
9
9
  const parentRect = ref();
10
10
  const start = ref(0);
11
11
  const end = ref(0);
12
- const splitLocation = (location) => {
12
+ function splitLocation(location) {
13
13
  return {
14
14
  child: location.match(/^[a-z]+/)[0],
15
15
  parent: location.match(/[a-z]+$/)[0]
16
16
  };
17
- };
18
- const getOffsetTop = (points) => {
17
+ }
18
+ function getOffsetTop(points) {
19
19
  let y = 0;
20
20
  if (!childRect.value)
21
21
  return y;
@@ -53,18 +53,18 @@ export function useScrollApi(params) {
53
53
  break;
54
54
  }
55
55
  return y;
56
- };
57
- const getCalculations = () => {
56
+ }
57
+ function getCalculations() {
58
58
  childRect.value = toValue(child)?.getBoundingClientRect();
59
- parentRect.value = toValue(parent) ? useElementBounding(parent) : { ...useWindowSize(), top: 0 };
59
+ parentRect.value = toValue(parent) ? toValue(parent)?.getBoundingClientRect() : { ...useWindowSize(), top: 0 };
60
60
  start.value = getOffsetTop(splitLocation(from));
61
61
  end.value = getOffsetTop(splitLocation(to));
62
- };
63
- const getProgress = () => {
62
+ }
63
+ function getProgress() {
64
64
  const scrollY = toValue(scrollPosition?.y) || 0;
65
65
  const total = Math.abs(end.value - start.value);
66
66
  const current = scrollY - start.value;
67
67
  return clampValue(current / total, 0, 1);
68
- };
68
+ }
69
69
  return { getCalculations, getProgress };
70
70
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maas/vue-equipment",
3
3
  "description": "A magic collection of Vue composables, plugins, components and directives",
4
- "version": "0.9.8",
4
+ "version": "0.9.9",
5
5
  "author": "Robin Scholz <https://github.com/robinscholz>, Christoph Jeworutzki <https://github.com/ChristophJeworutzki>",
6
6
  "devDependencies": {
7
7
  "@antfu/ni": "^0.21.5",