itube-specs 0.0.788 → 0.0.790

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.
@@ -22,10 +22,14 @@ import type { Player, PlayerOptions, VideoSource, LocaleCode, AdsOptions, Previe
22
22
  import { AdvertsHelper } from '@/utils/adverts-helper';
23
23
  import { AdSpotType, ThumbSize } from '../../runtime';
24
24
  import type { IVideoData, IVideoCard } from '../../types';
25
- import { PLAYER_PERSIST_KEY } from '~/lib/player';
26
- import actionsIcon from '~/assets/icons/scenes/actions.svg?raw';
27
- import locationIcon from '~/assets/icons/scenes/location.svg?raw';
28
- import modelsIcon from '~/assets/icons/scenes/models.svg?raw';
25
+ import playIcon from '~/assets/icons/player/play.svg?raw';
26
+ import fullscreenIcon from '~/assets/icons/player/fullscreen.svg?raw';
27
+ import seekIcon from '~/assets/icons/player/seek.svg?raw';
28
+ import settingsIcon from '~/assets/icons/player/settings.svg?raw';
29
+ import channelAvatarIcon from '~/assets/icons/player/channel-avatar.svg?raw';
30
+ import actionsIcon from '~/assets/icons/player/actions.svg?raw';
31
+ import locationIcon from '~/assets/icons/player/location.svg?raw';
32
+ import modelsIcon from '~/assets/icons/player/models.svg?raw';
29
33
 
30
34
  const props = defineProps<{
31
35
  data: IVideoData
@@ -76,39 +80,46 @@ function onSourceChange(): void {
76
80
  }
77
81
  }
78
82
 
79
- // Наша иконка play (public/img/play.svg) для опции icons плеер ждёт сырой <svg>.
80
- // currentColor вместо хардкода — чтобы цвет задавал сам плеер (solid/inverted).
81
- const PLAY_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"/></svg>';
82
-
83
- const FULLSCREEN_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/></svg>';
84
-
85
- // Одна иконка перемотки; «назад» та же, отражённая через scaleX(-1) в стилях (.imp-*--seek-back svg).
86
- const SEEK_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>';
83
+ // Ключ localStorage, под которым плеер (опция persist) хранит громкость/mute и состояние
84
+ // тумблера autoplay-next.
85
+ const PLAYER_PERSIST_KEY = 'itube-player';
86
+
87
+ // Иконки плеера сырыми <svg> (?raw): itube-modern-player принимает не имя/компонент, а
88
+ // строку svg — options.icons и sceneGroups[].icon.svg. currentColor у иконок — чтобы цвет
89
+ // задавал сам плеер (solid/inverted, перекраска в меню сцен). bigPlay идёт и в SSR-заглушку
90
+ // (renderPlaceholder читает icons.bigPlay). seek одна «назад» отражается через scaleX(-1)
91
+ // в стилях (.imp-*--seek-back svg).
92
+ const PLAYER_ICONS = {
93
+ play: playIcon,
94
+ bigPlay: playIcon,
95
+ fullscreen: fullscreenIcon,
96
+ settings: settingsIcon,
97
+ seekForward: seekIcon,
98
+ seekBack: seekIcon,
99
+ };
87
100
 
88
- const SETTINGS_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" fill="currentColor"><path d="M47.16,21.221l-5.91-0.966c-0.346-1.186-0.819-2.326-1.411-3.405l3.45-4.917c0.279-0.397,0.231-0.938-0.112-1.282 l-3.889-3.887c-0.347-0.346-0.893-0.391-1.291-0.104l-4.843,3.481c-1.089-0.602-2.239-1.08-3.432-1.427l-1.031-5.886 C28.607,2.35,28.192,2,27.706,2h-5.5c-0.49,0-0.908,0.355-0.987,0.839l-0.956,5.854c-1.2,0.345-2.352,0.818-3.437,1.412l-4.83-3.45 c-0.399-0.285-0.942-0.239-1.289,0.106L6.82,10.648c-0.343,0.343-0.391,0.883-0.112,1.28l3.399,4.863 c-0.605,1.095-1.087,2.254-1.438,3.46l-5.831,0.971c-0.482,0.08-0.836,0.498-0.836,0.986v5.5c0,0.485,0.348,0.9,0.825,0.985 l5.831,1.034c0.349,1.203,0.831,2.362,1.438,3.46l-3.441,4.813c-0.284,0.397-0.239,0.942,0.106,1.289l3.888,3.891 c0.343,0.343,0.884,0.391,1.281,0.112l4.87-3.411c1.093,0.601,2.248,1.078,3.445,1.424l0.976,5.861C21.3,47.647,21.717,48,22.206,48 h5.5c0.485,0,0.9-0.348,0.984-0.825l1.045-5.89c1.199-0.353,2.348-0.833,3.43-1.435l4.905,3.441 c0.398,0.281,0.938,0.232,1.282-0.111l3.888-3.891c0.346-0.347,0.391-0.894,0.104-1.292l-3.498-4.857 c0.593-1.08,1.064-2.222,1.407-3.408l5.918-1.039c0.479-0.084,0.827-0.5,0.827-0.985v-5.5C47.999,21.718,47.644,21.3,47.16,21.221z M25,32c-3.866,0-7-3.134-7-7c0-3.866,3.134-7,7-7s7,3.134,7,7C32,28.866,28.866,32,25,32z"/></svg>';
101
+ // Аватар-заглушка канала для чанка previewMeta ховер-превью (просто кружок, как в дизайне).
102
+ const CHANNEL_META_ICON = channelAvatarIcon;
89
103
 
90
- // Аватар-заглушка канала для чанка previewMeta просто кружок (как в дизайне).
91
- const CHANNEL_META_ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="12"/></svg>';
104
+ // Иконки типов сцен по id группы (timelinesGroups).
105
+ const SCENE_ICONS: Record<string, string> = {
106
+ actions: actionsIcon,
107
+ locations: locationIcon,
108
+ scene: modelsIcon,
109
+ };
92
110
 
93
111
  const PLAYER_LOCALES: LocaleCode[] = ['en', 'ru', 'de', 'es', 'it', 'ja', 'ko', 'zh', 'pt', 'ar', 'hi'];
94
112
  const playerLanguage = computed<LocaleCode>(() =>
95
113
  PLAYER_LOCALES.includes(locale.value as LocaleCode) ? locale.value as LocaleCode : 'en'
96
114
  );
97
115
 
98
- // Иконки типов сцен (inline через ?raw — в меню перекрашиваются под currentColor).
99
- const SCENE_ICON: Record<string, string> = {
100
- actions: actionsIcon,
101
- locations: locationIcon,
102
- scene: modelsIcon,
103
- };
104
-
105
116
  // timelinesGroups уже очищены клинером ({ id, title, scenes }) — добавляем только иконку по id.
106
117
  const sceneGroups = computed<SceneGroup[] | undefined>(() => {
107
118
  const groups = props.data.timelinesGroups;
108
119
  if (!groups?.length) return undefined;
109
120
 
110
121
  return groups.map((group) => {
111
- const icon = SCENE_ICON[group.id];
122
+ const icon = SCENE_ICONS[group.id];
112
123
  return icon ? { ...group, icon: { svg: icon } } : group;
113
124
  });
114
125
  });
@@ -217,8 +228,7 @@ const options = computed<Omit<PlayerOptions, 'source'>>(() => ({
217
228
  // Порядок правого кластера: sceneTypes → gear (настройки) → fullscreen (последней).
218
229
  order: ['sceneTypes', 'gear', 'fullscreen'],
219
230
  },
220
- // bigPlay идёт и в SSR-заглушку (renderPlaceholder читает icons.bigPlay).
221
- icons: { play: PLAY_ICON, bigPlay: PLAY_ICON, fullscreen: FULLSCREEN_ICON, settings: SETTINGS_ICON, seekForward: SEEK_ICON, seekBack: SEEK_ICON },
231
+ icons: PLAYER_ICONS,
222
232
  // Заголовок дропдауна выбора типа сцен (дефолт «Scene type»).
223
233
  labels: { sceneTypes: t('timeline_markers') },
224
234
  // Запоминаем громкость/mute в localStorage.
@@ -51,15 +51,14 @@ export const useFetchVideo = async (
51
51
  )(),
52
52
  );
53
53
 
54
- // Рефетчим только пока остаёмся на этой же странице видео (?view / переход между
55
- // роликами по path в рамках того же роута). Параметр маршрута называется `slug` и в
56
- // /videos/[slug], и в /categories/[slug], /models/[slug] и т.п. при уходе на любой
57
- // другой [slug]-роут (напр. /categories/hunk) identifier стал бы чужим слагом (непустым)
58
- // и мы бы дёрнули getVideoById с ним (400), после чего watchEffect страницы кинул бы 404.
59
- // Имя роута для video→video (path/?view) не меняется, а при смене типа страницы — меняется.
60
- const videoRouteName = route.name;
61
- watch(identifier, (value) => {
62
- if (value && route.name === videoRouteName) refresh();
54
+ // Рефетч ТОЛЬКО при смене ?view (переключение ролика плеером/next-video без смены path).
55
+ // НЕ следим за identifier/slug: смена path-параметра сама пересоздаёт страницу (дефолтный
56
+ // key <NuxtPage> = путь с подставленным параметром) setup перезапускается и фетчит заново.
57
+ // Следить за slug нельзя: route.params.slug общий для всех [slug]-роутов, и при уходе на
58
+ // /categories/<slug> и т.п. watch дёргал бы getVideoById с чужим слагом (400 + ложный 404).
59
+ // ?view при таком уходе не становится истинным, поэтому рефетча на уходе нет.
60
+ watch(view, (value) => {
61
+ if (value) refresh();
63
62
  });
64
63
 
65
64
  return { data, status, error };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.788",
4
+ "version": "0.0.790",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {