itube-specs 0.0.859 → 0.0.862

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.
package/README.md CHANGED
@@ -66,6 +66,9 @@ npm run patch # npm version patch — бамп версии перед п
66
66
  ```
67
67
 
68
68
  Pre-commit (husky + lint-staged): на закоммиченных файлах прогоняются `eslint --fix` и `stylelint --fix`.
69
+ ⚠️ **Шаблоны `.vue` не типизируются вообще.** Обычный `tsc` их не читает, а `vue-tsc` не подключён (накопился
70
+ бэклог ошибок в шаблонах, подключение — отдельная задача). Значит чистый `tsc` ничего не говорит про выражения
71
+ в шаблоне: арифметика над строковым union, неверный тип пропа, переименованное поле пройдут молча.
69
72
 
70
73
  ---
71
74
 
@@ -175,9 +178,9 @@ ad-конфиг), теперь читается из `runtimeConfig.public` (з
175
178
  - **Компоненты** — `pathPrefix: true`: имя = папка + файл (`ui/icon.vue` → `<UiIcon>`), BEM-класс = kebab
176
179
  тега. Корень папки — `index.vue` (или `main.vue`, если иначе имя было бы односложным).
177
180
  - **`as const`** вместо `enum` — доменные наборы в `runtime/constants/`, тип через
178
- `typeof X[keyof typeof X]`. В enum не положить строку из API, он остаётся в бандле, и в
179
- опубликованном пакете `import type` на нём ломается в рантайме. Фреймворковые union'ы не
180
- оборачивать. Подробнее — в [CLAUDE.md](./CLAUDE.md).
181
+ `typeof X[keyof typeof X]`, значения строковые. Enum остаётся в бандле, в опубликованном пакете
182
+ `import type` на нём ломается в рантайме, а там, где значение приходит из API/URL/куки, сырую строку
183
+ в него не положить. Фреймворковые union'ы не оборачивать. Подробнее — в [CLAUDE.md](./CLAUDE.md).
181
184
  - **Стили** — co-location в `<style lang="scss">` без `scoped`, flat-BEM, только дизайн-токены.
182
185
  `vars` и `mixins` **авто-инжектятся** через `additionalData` приложения, поэтому в блоке компонента
183
186
  `@use` писать не надо. Сам `sass` в слое не установлен — SCSS компилируется внутри приложения, но
@@ -10,7 +10,7 @@
10
10
  transparent-backdrop
11
11
  :back="isBackShow"
12
12
  class="auth-popup"
13
- @back="currentStep -= 1"
13
+ @back="goBack"
14
14
  >
15
15
  <template #title>{{ $t('auth.create_new') }}</template>
16
16
  <AuthRegister
@@ -27,12 +27,12 @@
27
27
  transparent-backdrop
28
28
  :back="isBackShow"
29
29
  class="auth-popup"
30
- @back="currentStep -= 1"
30
+ @back="goBack"
31
31
  >
32
32
  <template #title>{{ $t('auth.welcome_back') }}</template>
33
33
  <AuthLogin
34
34
  @forgot="onRecoveryClick"
35
- @create="currentStep -= 1"
35
+ @create="currentStep = AuthSteps.Registration"
36
36
  />
37
37
  </UiPopup>
38
38
  </transition>
@@ -44,7 +44,7 @@
44
44
  transparent-backdrop
45
45
  :back="isBackShow"
46
46
  class="auth-popup"
47
- @back="currentStep -= 1"
47
+ @back="goBack"
48
48
  >
49
49
  <template #title>{{ $t('auth.recovery_title')}}</template>
50
50
  <AuthRecovery @login="onLoginClick"/>
@@ -59,6 +59,20 @@ const { isAuthPopupOpen, currentStep, additionalText } = useAuthPopup();
59
59
 
60
60
  const backShow = ref(false);
61
61
 
62
+ // Куда ведёт «назад» с каждого шага. Registration — начальный, назад с него нет.
63
+ const previousStep: Partial<Record<AuthSteps, AuthSteps>> = {
64
+ [AuthSteps.Login]: AuthSteps.Registration,
65
+ [AuthSteps.Recovery]: AuthSteps.Login,
66
+ };
67
+
68
+ function goBack(): void {
69
+ const previous = previousStep[currentStep.value];
70
+
71
+ if (previous) {
72
+ currentStep.value = previous;
73
+ }
74
+ }
75
+
62
76
  function onLoginClick(): void {
63
77
  currentStep.value = AuthSteps.Login;
64
78
  backShow.value = true;
@@ -142,8 +142,7 @@
142
142
 
143
143
  <script setup lang="ts">
144
144
  import type { IVideoCard, IPlaylistCard, IProfileData } from '../../types';
145
- import type { PlaylistType } from '../../runtime';
146
- import { AuthSteps, PlaylistStep } from '../../runtime';
145
+ import { AuthSteps, PlaylistStep, PlaylistType } from '../../runtime';
147
146
  import { AuthorizationApiService } from '../../services/api/authorization.service';
148
147
 
149
148
  const props = defineProps<{
@@ -167,7 +166,7 @@ const sharePlaylistCard = computed<IPlaylistCard>(() => ({
167
166
  videosCount: props.items.length,
168
167
  thumbUrls: props.items.slice(0, 4).map(item => item.thumbUrls || { webp: {} }),
169
168
  created: 0,
170
- playlistType: 'public' as unknown as PlaylistType,
169
+ playlistType: PlaylistType.Public,
171
170
  }));
172
171
 
173
172
  const { isAuthorized } = useUser(AuthorizationApiService);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.859",
4
+ "version": "0.0.862",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  export const AuthSteps = {
2
- Registration: 1,
3
- Login: 2,
4
- Recovery: 3,
2
+ Registration: 'registration',
3
+ Login: 'login',
4
+ Recovery: 'recovery',
5
5
  } as const;
6
6
 
7
7
  export type AuthSteps = typeof AuthSteps[keyof typeof AuthSteps];
@@ -1,7 +1,7 @@
1
1
  export const PlaylistStep = {
2
- Edit: 1,
3
- Delete: 2,
4
- DeleteVideo: 3,
2
+ Edit: 'edit',
3
+ Delete: 'delete',
4
+ DeleteVideo: 'delete-video',
5
5
  } as const;
6
6
 
7
7
  export type PlaylistStep = typeof PlaylistStep[keyof typeof PlaylistStep];