itube-specs 0.0.476 → 0.0.477

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,25 +1,25 @@
1
- import { ref } from 'vue';
2
1
  import { EAuthSteps } from '../runtime';
3
2
 
4
- const isAuthPopupOpen = ref<boolean>(false);
3
+ export const useAuthPopup = () => {
4
+ const isAuthPopupOpen = useState('auth-popup-open', () => false);
5
+ const currentStep = useState<EAuthSteps>('auth-popup-step', () => EAuthSteps.Registration);
6
+ const additionalText = useState<string | undefined>('auth-popup-text', () => undefined);
5
7
 
6
- const currentStep = ref(EAuthSteps.Registration);
7
- const additionalText = ref(undefined as string | undefined);
8
+ const openAuthPopup = (step: EAuthSteps, text?: string) => {
9
+ isAuthPopupOpen.value = true;
10
+ currentStep.value = step;
11
+ additionalText.value = text;
12
+ };
8
13
 
9
- const openAuthPopup = (step: EAuthSteps, text?: string) => {
10
- isAuthPopupOpen.value = true;
11
- currentStep.value = step;
12
- additionalText.value = text;
13
- };
14
+ const closeAuthPopup = () => {
15
+ isAuthPopupOpen.value = false;
16
+ };
14
17
 
15
- const closeAuthPopup = () => {
16
- isAuthPopupOpen.value = false;
18
+ return {
19
+ isAuthPopupOpen,
20
+ currentStep,
21
+ openAuthPopup,
22
+ closeAuthPopup,
23
+ additionalText,
24
+ };
17
25
  };
18
-
19
- export const useAuthPopup = () => ({
20
- isAuthPopupOpen,
21
- currentStep,
22
- openAuthPopup,
23
- closeAuthPopup,
24
- additionalText,
25
- });
@@ -1,25 +1,27 @@
1
1
  import { useScrollLock } from '@vueuse/core';
2
2
 
3
- let lockCount = 0;
4
- let isLockedRef: ReturnType<typeof useScrollLock> | null = null;
5
-
6
3
  export function useGlobalScrollLock() {
7
- if (!isLockedRef && process.client) {
4
+ const lockCount = useState('global-scroll-lock-count', () => 0);
5
+ let isLockedRef: ReturnType<typeof useScrollLock> | null = null;
6
+
7
+ if (process.client) {
8
8
  isLockedRef = useScrollLock(document.body);
9
9
  }
10
10
 
11
11
  function scrollLock() {
12
- lockCount++;
13
- if (lockCount === 1) {
14
- isLockedRef!.value = true;
12
+ lockCount.value++;
13
+ if (lockCount.value === 1 && isLockedRef) {
14
+ isLockedRef.value = true;
15
15
  }
16
16
  }
17
17
 
18
18
  function scrollUnlock() {
19
- lockCount--;
20
- if (lockCount <= 0) {
21
- lockCount = 0;
22
- isLockedRef!.value = false;
19
+ lockCount.value--;
20
+ if (lockCount.value <= 0) {
21
+ lockCount.value = 0;
22
+ if (isLockedRef) {
23
+ isLockedRef.value = false;
24
+ }
23
25
  }
24
26
  }
25
27
 
@@ -1,36 +1,37 @@
1
1
  import type { Ref } from 'vue';
2
- import { ref } from 'vue';
3
2
  import type { IVideoData, IVideoCard } from '../types';
4
3
  import { EAuthSteps } from '../runtime';
5
4
 
6
- const videoCard = ref<IVideoCard | IVideoData | null>(null);
7
- const isPlaylistAdd = ref(false);
8
- const selectValue = ref('' as string | string[] | undefined);
9
- const step = ref('add' as 'add' | 'new');
5
+ export const usePlaylistAdd = () => {
6
+ const videoCard = useState<IVideoCard | IVideoData | null>('playlist-add-card', () => null);
7
+ const isPlaylistAdd = useState('playlist-add-open', () => false);
8
+ const selectValue = useState<string | string[] | undefined>('playlist-add-select', () => '');
9
+ const step = useState<'add' | 'new'>('playlist-add-step', () => 'add');
10
10
 
11
- const { openAuthPopup } = useAuthPopup();
11
+ const { openAuthPopup } = useAuthPopup();
12
12
 
13
- const openPlaylistAdd = (isAuthorized: Ref<boolean>, card: IVideoCard | IVideoData) => {
14
- if (isAuthorized.value) {
15
- videoCard.value = card;
16
- isPlaylistAdd.value = true;
17
- } else {
18
- const authPopupText = 'register_first';
19
- openAuthPopup(EAuthSteps.Registration, authPopupText);
20
- }
21
- };
13
+ const openPlaylistAdd = (isAuthorized: Ref<boolean>, card: IVideoCard | IVideoData) => {
14
+ if (isAuthorized.value) {
15
+ videoCard.value = card;
16
+ isPlaylistAdd.value = true;
17
+ } else {
18
+ const authPopupText = 'register_first';
19
+ openAuthPopup(EAuthSteps.Registration, authPopupText);
20
+ }
21
+ };
22
22
 
23
- const closePlaylistAdd = () => {
24
- videoCard.value = null;
25
- isPlaylistAdd.value = false;
26
- step.value = 'add';
27
- };
23
+ const closePlaylistAdd = () => {
24
+ videoCard.value = null;
25
+ isPlaylistAdd.value = false;
26
+ step.value = 'add';
27
+ };
28
28
 
29
- export const usePlaylistAdd = () => ({
30
- isPlaylistAdd,
31
- videoCard,
32
- openPlaylistAdd,
33
- closePlaylistAdd,
34
- selectValue,
35
- step,
36
- });
29
+ return {
30
+ isPlaylistAdd,
31
+ videoCard,
32
+ openPlaylistAdd,
33
+ closePlaylistAdd,
34
+ selectValue,
35
+ step,
36
+ };
37
+ };
@@ -1,37 +1,37 @@
1
- import { ref } from 'vue';
2
1
  import { EPlaylistStep } from '../runtime';
3
2
  import type { IVideoCard, IPlaylistCard } from '../types';
4
3
 
5
- const deletedVideo = ref<IVideoCard | null | undefined>(null);
6
- const selectedPlaylist = ref<IPlaylistCard | undefined>(undefined);
7
- const isPlaylistEditOpen = ref<boolean>(false);
4
+ export const usePlaylistEdit = () => {
5
+ const deletedVideo = useState<IVideoCard | null | undefined>('playlist-edit-deleted-video', () => null);
6
+ const selectedPlaylist = useState<IPlaylistCard | undefined>('playlist-edit-selected', () => undefined);
7
+ const isPlaylistEditOpen = useState('playlist-edit-open', () => false);
8
+ const isBackToEdit = useState('playlist-edit-back', () => false);
9
+ const currentStep = useState<EPlaylistStep>('playlist-edit-step', () => EPlaylistStep.Edit);
8
10
 
9
- const isBackToEdit = ref(false);
10
- const currentStep = ref(EPlaylistStep.Edit);
11
+ const openPlaylistEdit = (step: EPlaylistStep, back: boolean = false, playlist?: IPlaylistCard, videoCard?: IVideoCard) => {
12
+ selectedPlaylist.value = playlist;
13
+ isPlaylistEditOpen.value = true;
14
+ currentStep.value = step;
15
+ isBackToEdit.value = back;
16
+ deletedVideo.value = videoCard;
17
+ };
11
18
 
12
- const openPlaylistEdit = (step: EPlaylistStep, back: boolean = false, playlist?: IPlaylistCard, videoCard?: IVideoCard) => {
13
- selectedPlaylist.value = playlist;
14
- isPlaylistEditOpen.value = true;
15
- currentStep.value = step;
16
- isBackToEdit.value = back;
17
- deletedVideo.value = videoCard;
18
- };
19
+ const closePlaylistEdit = () => {
20
+ if (isBackToEdit.value) {
21
+ openPlaylistEdit(EPlaylistStep.Edit, false, selectedPlaylist.value);
22
+ } else {
23
+ isPlaylistEditOpen.value = false;
24
+ isBackToEdit.value = false;
25
+ selectedPlaylist.value = undefined;
26
+ }
27
+ };
19
28
 
20
- const closePlaylistEdit = () => {
21
- if (isBackToEdit.value) {
22
- openPlaylistEdit(EPlaylistStep.Edit, false, selectedPlaylist.value);
23
- } else {
24
- isPlaylistEditOpen.value = false;
25
- isBackToEdit.value = false;
26
- selectedPlaylist.value = undefined;
27
- }
29
+ return {
30
+ isPlaylistEditOpen,
31
+ currentStep,
32
+ openPlaylistEdit,
33
+ closePlaylistEdit,
34
+ selectedPlaylist,
35
+ deletedVideo,
36
+ };
28
37
  };
29
-
30
- export const usePlaylistEdit = () => ({
31
- isPlaylistEditOpen,
32
- currentStep,
33
- openPlaylistEdit,
34
- closePlaylistEdit,
35
- selectedPlaylist,
36
- deletedVideo,
37
- });
@@ -1,21 +1,22 @@
1
- import { ref } from 'vue';
2
1
  import type { IVideoCard } from '../types';
3
2
 
4
- const isReportPopupOpen = ref<boolean>(false);
5
- const reportedVideoCard = ref<IVideoCard>({} as IVideoCard)
3
+ export const useReportPopup = () => {
4
+ const isReportPopupOpen = useState('report-popup-open', () => false);
5
+ const reportedVideoCard = useState<IVideoCard>('report-popup-card', () => ({} as IVideoCard));
6
6
 
7
- const openReportPopup = (card: IVideoCard) => {
8
- isReportPopupOpen.value = true;
9
- reportedVideoCard.value = card;
10
- };
7
+ const openReportPopup = (card: IVideoCard) => {
8
+ isReportPopupOpen.value = true;
9
+ reportedVideoCard.value = card;
10
+ };
11
11
 
12
- const closeReportPopup = () => {
13
- isReportPopupOpen.value = false;
14
- };
12
+ const closeReportPopup = () => {
13
+ isReportPopupOpen.value = false;
14
+ };
15
15
 
16
- export const useReportPopup = () => ({
17
- isReportPopupOpen,
18
- openReportPopup,
19
- closeReportPopup,
20
- reportedVideoCard,
21
- });
16
+ return {
17
+ isReportPopupOpen,
18
+ openReportPopup,
19
+ closeReportPopup,
20
+ reportedVideoCard,
21
+ };
22
+ };
@@ -1,23 +1,24 @@
1
- import { ref } from 'vue';
2
1
  import type { IVideoCard } from '../types';
3
2
 
4
- const isSharePopupOpen = ref<boolean>(false);
5
- const sharedVideoCard = ref<IVideoCard>({} as IVideoCard)
3
+ export const useSharePopup = () => {
4
+ const isSharePopupOpen = useState('share-popup-open', () => false);
5
+ const sharedVideoCard = useState<IVideoCard>('share-popup-card', () => ({} as IVideoCard));
6
6
 
7
- const openSharePopup = (card?: IVideoCard) => {
8
- isSharePopupOpen.value = true;
9
- if (card && Object.keys(card).length) {
10
- sharedVideoCard.value = card;
11
- }
12
- };
7
+ const openSharePopup = (card?: IVideoCard) => {
8
+ isSharePopupOpen.value = true;
9
+ if (card && Object.keys(card).length) {
10
+ sharedVideoCard.value = card;
11
+ }
12
+ };
13
13
 
14
- const closeSharePopup = () => {
15
- isSharePopupOpen.value = false;
16
- };
14
+ const closeSharePopup = () => {
15
+ isSharePopupOpen.value = false;
16
+ };
17
17
 
18
- export const useSharePopup = () => ({
19
- isSharePopupOpen,
20
- openSharePopup,
21
- closeSharePopup,
22
- sharedVideoCard,
23
- });
18
+ return {
19
+ isSharePopupOpen,
20
+ openSharePopup,
21
+ closeSharePopup,
22
+ sharedVideoCard,
23
+ };
24
+ };
@@ -3,50 +3,52 @@ import { parseApiError } from '../runtime';
3
3
  const SUCCESS_TIME = 3000;
4
4
  const ERROR_TIME = 5000;
5
5
 
6
- const snackbarIcon = ref('check-circle');
7
- const snackbarText = ref('');
8
- const snackbarButtonText = ref('');
9
- const isSnackBarInPopup = ref(false);
10
- const snackbarTheme = ref('success' as 'success' | 'error' | 'default');
11
- const snackbarTimer = ref(SUCCESS_TIME);
12
-
13
6
  let _timeoutClosure: null | ReturnType<typeof setTimeout> = null;
14
7
 
15
- const setErrorState = (error: any) => {
16
- snackbarText.value = parseApiError(error);
17
- snackbarTheme.value = 'error';
18
- snackbarIcon.value = 'exclamation-circle';
19
- snackbarTimer.value = ERROR_TIME;
20
- };
8
+ export const useSnackbar = () => {
9
+ const snackbarIcon = useState('snackbar-icon', () => 'check-circle');
10
+ const snackbarText = useState('snackbar-text', () => '');
11
+ const snackbarButtonText = useState('snackbar-button-text', () => '');
12
+ const isSnackBarInPopup = useState('snackbar-in-popup', () => false);
13
+ const snackbarTheme = useState<'success' | 'error' | 'default'>('snackbar-theme', () => 'success');
14
+ const snackbarTimer = useState('snackbar-timer', () => SUCCESS_TIME);
15
+
16
+ const setErrorState = (error: any) => {
17
+ snackbarText.value = parseApiError(error);
18
+ snackbarTheme.value = 'error';
19
+ snackbarIcon.value = 'exclamation-circle';
20
+ snackbarTimer.value = ERROR_TIME;
21
+ };
22
+
23
+ function showErrorSnack(message: string) {
24
+ if (_timeoutClosure) {
25
+ clearTimeout(_timeoutClosure);
26
+ }
27
+
28
+ snackbarTheme.value = 'error';
29
+ snackbarIcon.value = 'exclamation-circle';
30
+ snackbarText.value = message;
31
+ snackbarTimer.value = ERROR_TIME;
32
+
33
+ _timeoutClosure = setTimeout(resetSnackbar, snackbarTimer.value);
34
+ }
21
35
 
22
- function showErrorSnack(message: string) {
23
- if (_timeoutClosure) {
24
- clearTimeout(_timeoutClosure);
36
+ function resetSnackbar() {
37
+ snackbarIcon.value = 'check-circle';
38
+ snackbarText.value = '';
39
+ snackbarTheme.value = 'success';
40
+ snackbarTimer.value = SUCCESS_TIME;
25
41
  }
26
42
 
27
- snackbarTheme.value = 'error';
28
- snackbarIcon.value = 'exclamation-circle';
29
- snackbarText.value = message;
30
- snackbarTimer.value = ERROR_TIME;
31
-
32
- _timeoutClosure = setTimeout(resetSnackbar, snackbarTimer.value);
33
- }
34
-
35
- function resetSnackbar() {
36
- snackbarIcon.value = 'check-circle';
37
- snackbarText.value = '';
38
- snackbarTheme.value = 'success';
39
- snackbarTimer.value = SUCCESS_TIME;
40
- }
41
-
42
- export const useSnackbar = () => ({
43
- snackbarIcon,
44
- snackbarText,
45
- snackbarButtonText,
46
- snackbarTheme,
47
- snackbarTimer,
48
- setErrorState,
49
- showErrorSnack,
50
- isSnackBarInPopup,
51
- resetSnackbar,
52
- });
43
+ return {
44
+ snackbarIcon,
45
+ snackbarText,
46
+ snackbarButtonText,
47
+ snackbarTheme,
48
+ snackbarTimer,
49
+ setErrorState,
50
+ showErrorSnack,
51
+ isSnackBarInPopup,
52
+ resetSnackbar,
53
+ };
54
+ };
@@ -18,9 +18,8 @@ function omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K
18
18
  return result;
19
19
  }
20
20
 
21
- const { snackbarText, snackbarTheme, showErrorSnack } = useSnackbar();
22
-
23
21
  export const useUser = (apiService) => {
22
+ const { snackbarText, snackbarTheme, showErrorSnack } = useSnackbar();
24
23
  const register = async (form: IRegistrateForm) => {
25
24
  const response = await apiService.register(form);
26
25
  if (response) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.476",
4
+ "version": "0.0.477",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {
@@ -3,9 +3,9 @@ export enum ELanguage {
3
3
  German = 'de',
4
4
  Spanish = 'es',
5
5
  Korean = 'ko',
6
- Japanese = 'jp',
6
+ Japanese = 'ja',
7
7
  Italian = 'it',
8
8
  French = 'fr',
9
9
  Russian = 'ru',
10
- Chinese = 'ch',
10
+ Chinese = 'zh',
11
11
  }