@maas/vue-equipment 0.26.2 → 0.26.4

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/nuxt",
3
3
  "configKey": "vueEquipment",
4
- "version": "0.26.1"
4
+ "version": "0.26.3"
5
5
  }
@@ -11,12 +11,12 @@ const defaultOptions = {
11
11
  focusTarget: void 0,
12
12
  scrollLock: true
13
13
  };
14
+ const scrollLock = typeof window !== "undefined" ? useScrollLock(document?.documentElement) : ref(false);
14
15
  export function useDrawerApi(id, options) {
15
16
  const positionFixedElements = ref([]);
16
17
  const mappedId = computed(() => toValue(id) || uuid());
17
18
  const mappedOptions = defu(options, defaultOptions);
18
19
  const focusTrap = mappedOptions.focusTarget ? typeof mappedOptions.focusTrap === "boolean" ? useFocusTrap(mappedOptions.focusTarget) : useFocusTrap(mappedOptions.focusTarget, mappedOptions.focusTrap) : void 0;
19
- const scrollLock = mappedOptions.scrollLock && typeof window !== "undefined" ? useScrollLock(document.body) : ref(false);
20
20
  const { drawerStore, addInstance, removeInstance } = useDrawerStore();
21
21
  const { deleteState } = useDrawerState(mappedId.value);
22
22
  function progressCallback(payload) {
@@ -52,10 +52,14 @@ export function useDrawerApi(id, options) {
52
52
  }
53
53
  }
54
54
  function lockScroll() {
55
- scrollLock.value = true;
55
+ if (mappedOptions.scrollLock) {
56
+ scrollLock.value = true;
57
+ }
56
58
  }
57
59
  function unlockScroll() {
58
- scrollLock.value = false;
60
+ if (mappedOptions.scrollLock) {
61
+ scrollLock.value = false;
62
+ }
59
63
  }
60
64
  function addScrollLockPadding() {
61
65
  if (typeof window === "undefined")
@@ -9,12 +9,12 @@ const defaultOptions = {
9
9
  focusTarget: void 0,
10
10
  scrollLock: true
11
11
  };
12
+ const scrollLock = typeof window !== "undefined" ? useScrollLock(document?.documentElement) : ref(false);
12
13
  export function useModalApi(id, options) {
13
14
  const positionFixedElements = ref([]);
14
15
  const mappedId = computed(() => toValue(id) || uuid());
15
16
  const mappedOptions = defu(options, defaultOptions);
16
17
  const focusTrap = mappedOptions.focusTarget ? typeof mappedOptions.focusTrap === "boolean" ? useFocusTrap(mappedOptions.focusTarget) : useFocusTrap(mappedOptions.focusTarget, mappedOptions.focusTrap) : void 0;
17
- const scrollLock = mappedOptions.scrollLock && typeof window !== "undefined" ? useScrollLock(document.body) : ref(false);
18
18
  const { modalStore, addInstance, removeInstance } = useModalStore();
19
19
  const isActive = computed(() => modalStore.value.includes(mappedId.value));
20
20
  function open() {
@@ -34,10 +34,14 @@ export function useModalApi(id, options) {
34
34
  }
35
35
  }
36
36
  function lockScroll() {
37
- scrollLock.value = true;
37
+ if (mappedOptions.scrollLock) {
38
+ scrollLock.value = true;
39
+ }
38
40
  }
39
41
  function unlockScroll() {
40
- scrollLock.value = false;
42
+ if (mappedOptions.scrollLock) {
43
+ scrollLock.value = false;
44
+ }
41
45
  }
42
46
  function addScrollLockPadding() {
43
47
  if (typeof window === "undefined")
@@ -67,7 +67,7 @@ useIntersectionObserver(
67
67
  calculate()
68
68
  }
69
69
  },
70
- { rootMargin: '150% 0px 150% 0px', threshold: 0.01 }
70
+ { rootMargin: '150% 0px 150% 0px', threshold: 0.01, immediate: true }
71
71
  )
72
72
 
73
73
  provide(ScrollProgressKey, readonly(progress))
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@maas/vue-equipment",
3
3
  "description": "A magic collection of Vue composables, plugins, components and directives",
4
- "version": "0.26.2",
4
+ "version": "0.26.4",
5
5
  "author": "Robin Scholz <https://github.com/robinscholz>, Christoph Jeworutzki <https://github.com/ChristophJeworutzki>",
6
6
  "devDependencies": {
7
7
  "@antfu/ni": "^0.21.12",
8
8
  "@release-it/bumper": "^6.0.1",
9
9
  "@types/node": "^20.10.4",
10
+ "@vue/tsconfig": "^0.5.1",
10
11
  "release-it": "^17.0.1",
11
12
  "turbo": "^1.11.2"
12
13
  },