itube-specs 0.0.615 → 0.0.617

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.
@@ -98,7 +98,7 @@ function onMoreClick() {
98
98
  }
99
99
 
100
100
  onMounted(() => {
101
- checkIsElementOverflow();
101
+ requestAnimationFrame(() => checkIsElementOverflow());
102
102
  });
103
103
 
104
104
  let checkTimer: ReturnType<typeof setTimeout> | null = null;
@@ -77,20 +77,23 @@ onClickOutside(dropdownRef, () => {
77
77
  const { scrollLock, scrollUnlock } = useGlobalScrollLock();
78
78
 
79
79
  const breakpoints = useAppConfig().cssBreakpoints as Record<CssBreakpoints, number>;
80
+ const isMobile = isMobileWidth(breakpoints);
80
81
 
81
82
  function checkPosition() {
82
- if (!dropdownRef.value || !menuRef.value || isMobileWidth(breakpoints).value) return
83
- const triggerRect = dropdownRef.value.getBoundingClientRect()
84
- const menuHeight = menuRef.value.scrollHeight
85
- const spaceBelow = window.innerHeight - triggerRect.bottom
86
- autoTop.value = menuHeight > spaceBelow
83
+ if (!dropdownRef.value || !menuRef.value || isMobile.value) return
84
+ requestAnimationFrame(() => {
85
+ const triggerRect = dropdownRef.value.getBoundingClientRect()
86
+ const menuHeight = menuRef.value.scrollHeight
87
+ const spaceBelow = window.innerHeight - triggerRect.bottom
88
+ autoTop.value = menuHeight > spaceBelow
89
+ })
87
90
  }
88
91
 
89
92
  function openDropdown() {
90
93
  open.value = !open.value
91
94
  if (open.value) nextTick(() => checkPosition())
92
95
 
93
- if (isMobileWidth(breakpoints).value) {
96
+ if (isMobile.value) {
94
97
  nextTick(() => {
95
98
  if (menuRef.value?.showModal) {
96
99
  menuRef.value.showModal();
@@ -103,7 +106,7 @@ function openDropdown() {
103
106
  function close() {
104
107
  open.value = false;
105
108
 
106
- if (isMobileWidth(breakpoints).value) {
109
+ if (isMobile.value) {
107
110
  scrollUnlock()
108
111
  nextTick(() => {
109
112
  menuRef.value?.close?.()
@@ -114,7 +117,7 @@ function close() {
114
117
  let hoverTimeout: ReturnType<typeof setTimeout> | null = null
115
118
 
116
119
  function mouseHandler(event: boolean) {
117
- if (!isMobileWidth(breakpoints).value && props.openByHover) {
120
+ if (!isMobile.value && props.openByHover) {
118
121
  if (hoverTimeout) clearTimeout(hoverTimeout)
119
122
 
120
123
  if (event) {
@@ -4,14 +4,18 @@ export function useGlobalScrollLock() {
4
4
  const lockCount = useState('global-scroll-lock-count', () => 0);
5
5
  let isLockedRef: ReturnType<typeof useScrollLock> | null = null;
6
6
 
7
- if (import.meta.client) {
8
- isLockedRef = useScrollLock(document.body);
7
+ function getLockedRef() {
8
+ if (!isLockedRef && import.meta.client) {
9
+ isLockedRef = useScrollLock(document.body);
10
+ }
11
+ return isLockedRef;
9
12
  }
10
13
 
11
14
  function scrollLock() {
12
15
  lockCount.value++;
13
- if (lockCount.value === 1 && isLockedRef) {
14
- isLockedRef.value = true;
16
+ const ref = getLockedRef();
17
+ if (lockCount.value === 1 && ref) {
18
+ ref.value = true;
15
19
  }
16
20
  }
17
21
 
@@ -19,8 +23,9 @@ export function useGlobalScrollLock() {
19
23
  lockCount.value--;
20
24
  if (lockCount.value <= 0) {
21
25
  lockCount.value = 0;
22
- if (isLockedRef) {
23
- isLockedRef.value = false;
26
+ const ref = getLockedRef();
27
+ if (ref) {
28
+ ref.value = false;
24
29
  }
25
30
  }
26
31
  }
@@ -2,7 +2,6 @@ import { FeatureFlags } from '~/config/featureFlags.config';
2
2
 
3
3
  export function useNavigationItems() {
4
4
  const { favoritesLink } = useFavorites();
5
-
6
5
  const navigationItems = computed(() => {
7
6
  const favLink = favoritesLink.value ?? '';
8
7
 
@@ -125,7 +125,7 @@ export const useUser = (apiService) => {
125
125
  };
126
126
 
127
127
  return {
128
- isAuthorized: computed(() => import.meta.client && !!useCookie('jwtoken').value),
128
+ isAuthorized: computed(() => !!useCookie('jwtoken').value),
129
129
  register,
130
130
  login,
131
131
  password,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.615",
4
+ "version": "0.0.617",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {