itube-specs 0.0.358 → 0.0.359

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.
@@ -83,8 +83,9 @@
83
83
  </template>
84
84
 
85
85
  <script setup lang="ts">
86
- import { onBackdropClick, scrollLock, isMobile } from '../../runtime';
86
+ import { onBackdropClick, isMobile } from '../../runtime';
87
87
  import type { CssBreakpoints } from '../../types';
88
+ import { useScrollLock } from '@vueuse/core';
88
89
 
89
90
  const {resetSnackbar} = useSnackbar();
90
91
 
@@ -105,22 +106,40 @@ const props = defineProps<{
105
106
  notModal?: boolean
106
107
  }>()
107
108
 
109
+ const isLocked = useScrollLock(
110
+ typeof document !== 'undefined' ? document.body : null
111
+ );
112
+
113
+ watch(
114
+ () => props.modelValue,
115
+ (newVal) => {
116
+ if (newVal) {
117
+ nextTick(() => {
118
+ isLocked.value = true;
119
+
120
+ if (props.notModal) {
121
+ popupRef.value?.show();
122
+ } else {
123
+ popupRef.value?.showModal();
124
+ }
125
+ popupRef.value?.focus({ preventScroll: true });
126
+ });
127
+ } else {
128
+ isLocked.value = false;
129
+ }
130
+ },
131
+ { immediate: true }
132
+ );
133
+
108
134
  onMounted(() => {
109
135
  isSnackBarInPopup.value = true;
110
136
  resetSnackbar();
111
- setTimeout(() => scrollLock().lockScroll(), 100);
112
- if (props.notModal) {
113
- popupRef.value.show();
114
- } else {
115
- popupRef.value.showModal();
116
- }
117
- popupRef.value.focus({ preventScroll: true })
118
- })
137
+ });
119
138
 
120
139
  onBeforeUnmount(() => {
121
140
  isSnackBarInPopup.value = false;
122
- scrollLock().unlockScroll();
123
- })
141
+ isLocked.value = false;
142
+ });
124
143
 
125
144
  function close() {
126
145
  emit('close');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.358",
4
+ "version": "0.0.359",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {
@@ -1,19 +1,8 @@
1
1
  const lockScroll = () => {
2
- if (typeof window === 'undefined') return;
3
-
4
- document.body.style.position = 'fixed';
5
- document.body.style.left = '0';
6
- document.body.style.right = '0';
7
2
  document.body.style.overflow = 'hidden';
8
3
  };
9
4
 
10
5
  const unlockScroll = () => {
11
- if (typeof window === 'undefined') return;
12
-
13
- document.body.style.position = '';
14
- document.body.style.top = '';
15
- document.body.style.left = '';
16
- document.body.style.right = '';
17
6
  document.body.style.overflow = '';
18
7
  };
19
8