itube-specs 0.0.863 → 0.0.865

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.
@@ -61,7 +61,7 @@
61
61
  <script setup lang="ts">
62
62
  import { convertString, formatDate } from '../../runtime';
63
63
  import type { IChannelCard } from '../../types';
64
- import { CSS_BREAKPOINTS } from '../../lib/css-breakpoints';
64
+ import { CSS_BREAKPOINTS } from '../../config/css-breakpoints';
65
65
 
66
66
  const props = defineProps<{
67
67
  card: IChannelCard
@@ -176,7 +176,7 @@
176
176
  import { formatDate, ThumbSize } from '../../runtime';
177
177
  import type { IPlaylistCard, IProfileData, IThumbUrls } from '../../types';
178
178
  import { AuthorizationApiService } from '../../services/api/authorization.service';
179
- import { CSS_BREAKPOINTS } from '../../lib/css-breakpoints';
179
+ import { CSS_BREAKPOINTS } from '../../config/css-breakpoints';
180
180
 
181
181
  const props = defineProps<{
182
182
  card: IPlaylistCard
@@ -137,7 +137,7 @@
137
137
  <script setup lang="ts">
138
138
  import type { IVideoCard } from '../../../types';
139
139
  import { convertString, getDuration } from '../../../runtime';
140
- import { CSS_BREAKPOINTS } from '../../../lib/css-breakpoints';
140
+ import { CSS_BREAKPOINTS } from '../../../config/css-breakpoints';
141
141
 
142
142
  const featureFlags = useRuntimeConfig().public.featureFlags;
143
143
 
@@ -111,7 +111,7 @@
111
111
  import type { IModelFilter } from '../../types';
112
112
  import { onClickOutside } from '@vueuse/core';
113
113
  import { convertString, checkDeviceWidth } from '../../runtime';
114
- import { CSS_BREAKPOINTS } from '../../lib/css-breakpoints';
114
+ import { CSS_BREAKPOINTS } from '../../config/css-breakpoints';
115
115
 
116
116
  const props = defineProps<{
117
117
  filters: IModelFilter[]
@@ -78,7 +78,8 @@
78
78
 
79
79
  <script setup lang="ts">
80
80
  import { AuthSteps, onBackdropClick, checkDeviceWidth } from '../../runtime';
81
- import type { CssBreakpoints, IProfileData } from '../../types';
81
+ import type { IProfileData } from '../../types';
82
+ import { CSS_BREAKPOINTS } from '../../config/css-breakpoints';
82
83
  import { AuthorizationApiService } from '../../services/api/authorization.service';
83
84
 
84
85
  import { getNavigationItems } from '../../lib';
@@ -110,7 +111,7 @@ const { isAuthorized } = useUser(AuthorizationApiService);
110
111
 
111
112
  const burgerRef = ref();
112
113
 
113
- const breakpoints = useAppConfig().cssBreakpoints as Record<CssBreakpoints, number>;
114
+ const breakpoints = CSS_BREAKPOINTS;
114
115
  const { isMobile } = checkDeviceWidth(breakpoints);
115
116
 
116
117
  const { scrollLock, scrollUnlock } = useGlobalScrollLock();
@@ -62,7 +62,7 @@
62
62
  <script setup lang="ts">
63
63
  // На компоненте обязательно вызывать пропсы слота и вешать слот пропс (className) на непосредственных детей
64
64
  import { checkDeviceWidth } from '../../runtime';
65
- import type { CssBreakpoints } from '../../types';
65
+ import { CSS_BREAKPOINTS } from '../../config/css-breakpoints';
66
66
  import { onClickOutside } from '@vueuse/core';
67
67
 
68
68
  const dropdownRef = ref();
@@ -89,7 +89,7 @@ onClickOutside(dropdownRef, () => {
89
89
 
90
90
  const { scrollLock, scrollUnlock } = useGlobalScrollLock();
91
91
 
92
- const breakpoints = useAppConfig().cssBreakpoints as Record<CssBreakpoints, number>;
92
+ const breakpoints = CSS_BREAKPOINTS;
93
93
  const { isTablet } = checkDeviceWidth(breakpoints);
94
94
 
95
95
  function checkPosition() {
@@ -29,7 +29,7 @@
29
29
  <script setup lang="ts">
30
30
  import { checkDeviceWidth } from '../../runtime';
31
31
  import { onClickOutside } from '@vueuse/core';
32
- import type { CssBreakpoints } from '../../types';
32
+ import { CSS_BREAKPOINTS } from '../../config/css-breakpoints';
33
33
 
34
34
  defineProps<{
35
35
  right?: boolean
@@ -38,7 +38,7 @@ defineProps<{
38
38
  const tooltipRef = ref<HTMLElement>();
39
39
  const isOpen = ref(false);
40
40
 
41
- const breakpoints = useAppConfig().cssBreakpoints as Record<CssBreakpoints, number>;
41
+ const breakpoints = CSS_BREAKPOINTS;
42
42
  const { isMobile } = checkDeviceWidth(breakpoints);
43
43
 
44
44
  onClickOutside(tooltipRef, () => {
@@ -1,4 +1,5 @@
1
- import type { Language, Niche } from '~/runtime';
1
+ import type { Language, Niche } from '../runtime';
2
+ import { NicheHelper } from '../utils/niche-helper';
2
3
 
3
4
  /** Возвращает generateLink — генерирует путь с учётом текущей ниши и локали. */
4
5
  export const useGenerateLink = () => {
@@ -14,7 +15,9 @@ export const useGenerateLink = () => {
14
15
  const generateLink = (path: string, localeArg?: Language): string => {
15
16
  const cleanPath = path.startsWith('/') ? path : `/${path}`;
16
17
 
17
- const defaultNiche = useAppConfig().defaultNiche;
18
+ // Ниша сайта — из окружения (тем же значением уходит в заголовок X-Niche),
19
+ // список ниш — из per-site конфига проекта.
20
+ const defaultNiche = NicheHelper.getSiteDefaultNiche();
18
21
  const projectNiches = useAppConfig().niches as Niche[];
19
22
  const isOneNiche = projectNiches.length === 1;
20
23
 
@@ -0,0 +1,22 @@
1
+ /** Имя брейкпоинта. Совпадает с ключами `$brkpnts` в assets/scss/mixins/_breakpoints.scss. */
2
+ export type CssBreakpointName = 'xs' | 'xm' | 'sm' | 'md' | 'ml' | 'lg' | 'xl';
3
+
4
+ /**
5
+ * JS-зеркало брейкпоинтов из SCSS.
6
+ *
7
+ * Источник истины — `$brkpnts` в assets/scss/mixins/_breakpoints.scss: по нему работают
8
+ * миксины вёрстки. JS прочитать SCSS не может, поэтому здесь зеркало — оно нужно там, где
9
+ * ширину надо знать в скрипте: `sizes` у картинок, брейкпоинты свайпера, checkDeviceWidth.
10
+ *
11
+ * Значения обязаны совпадать с SCSS — это проверяет `check:breakpoints`. Разойдутся —
12
+ * атрибут `sizes` начнёт врать браузеру про точку переключения раскладки.
13
+ */
14
+ export const CSS_BREAKPOINTS: Record<CssBreakpointName, number> = {
15
+ xs: 475,
16
+ xm: 650,
17
+ sm: 960,
18
+ md: 1350,
19
+ ml: 1500,
20
+ lg: 1792,
21
+ xl: 2560,
22
+ };
@@ -0,0 +1,2 @@
1
+ export * from './themes';
2
+ export * from './css-breakpoints';
@@ -0,0 +1,29 @@
1
+ /** Имя темы = имя папки в assets/scss/themes/. */
2
+ export type ThemeName = 'light' | 'dark';
3
+
4
+ export interface ThemeMeta {
5
+ /** Подсказка браузеру для нативных контролов и скроллбаров. */
6
+ colorScheme: 'light' | 'dark';
7
+ /** Цвет хрома браузера. Обязан совпадать с `$body-bg` этой темы. */
8
+ themeColor: string;
9
+ }
10
+
11
+ /**
12
+ * JS-сторона тем: то, что нужно знать о теме вне Sass.
13
+ *
14
+ * Цвета живут в SCSS (assets/scss/themes/<name>/_theme.scss), но `theme-color` и
15
+ * `color-scheme` нужны в `nuxt.config` на этапе сборки, куда SCSS не дотягивается.
16
+ * Поэтому здесь минимальное дублирование — только хром браузера.
17
+ *
18
+ * Список должен совпадать с папками в assets/scss/themes/ — это проверяет `check:themes`.
19
+ */
20
+ export const themes: Record<ThemeName, ThemeMeta> = {
21
+ light: {
22
+ colorScheme: 'light',
23
+ themeColor: '#1e2a3a', // = $body-bg темы light ($color-slate-800)
24
+ },
25
+ dark: {
26
+ colorScheme: 'dark',
27
+ themeColor: '#0d0d0d', // = $body-bg темы dark ($color-black)
28
+ },
29
+ };
package/lib/index.ts CHANGED
@@ -15,4 +15,3 @@ export * from './scheme/categories-navigation';
15
15
  export * from './scheme/navigation-items';
16
16
  export * from './scheme/profile-navigation-items';
17
17
  export * from './scheme/additional-links-items';
18
- export * from './css-breakpoints';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.863",
4
+ "version": "0.0.865",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {
@@ -13,6 +13,7 @@
13
13
  "lint:css:fix": "stylelint \"**/*.{scss,vue}\" --fix --allow-empty-input",
14
14
  "check:themes": "node scripts/check-themes.mjs",
15
15
  "check:styles": "node scripts/check-styles.mjs",
16
+ "check:breakpoints": "node scripts/check-breakpoints.mjs",
16
17
  "test": "NODE_OPTIONS='--no-warnings' vitest",
17
18
  "prepare": "husky"
18
19
  },
@@ -41,6 +42,10 @@
41
42
  "import": "./lib/index.ts",
42
43
  "default": "./lib/index.ts"
43
44
  },
45
+ "./config": {
46
+ "import": "./config/index.ts",
47
+ "default": "./config/index.ts"
48
+ },
44
49
  "./services/*": "./services/*.ts",
45
50
  "./composables/*": "./composables/*.ts",
46
51
  "./utils/*": "./utils/*.ts",
@@ -53,6 +58,7 @@
53
58
  "services/",
54
59
  "utils/",
55
60
  "types/",
61
+ "config/",
56
62
  "lib/",
57
63
  "middleware/",
58
64
  "plugins/",
@@ -28,7 +28,7 @@ import { SearchApiService } from '../../services/api/search.service';
28
28
  import { VideosApiService } from '../../services/api/videos.service';
29
29
  import { ModelsApiService } from '../../services/api/models.service';
30
30
  import { AsyncData, ThumbSize } from '../../runtime';
31
- import { CSS_BREAKPOINTS } from '../../lib';
31
+ import { CSS_BREAKPOINTS } from '../../config';
32
32
 
33
33
  const featureFlags = useRuntimeConfig().public.featureFlags;
34
34
 
@@ -1,7 +1,7 @@
1
1
  import { useBreakpoints } from '@vueuse/core';
2
- import type { CssBreakpoints } from '../../types';
2
+ import type { CssBreakpointName } from '../../config/css-breakpoints';
3
3
 
4
- function breakpoints(breakpoints: Record<CssBreakpoints, number>) {
4
+ function breakpoints(breakpoints: Record<CssBreakpointName, number>) {
5
5
  return useBreakpoints(
6
6
  {
7
7
  xs: breakpoints.xs,
@@ -17,7 +17,7 @@ function breakpoints(breakpoints: Record<CssBreakpoints, number>) {
17
17
  * Возвращает реактивные флаги isMobile и isTablet на основе переданных breakpoints.
18
18
  * @param projectBreakpoints - набор брейкпоинтов проекта (xs, sm, md, lg, xl) в пикселях
19
19
  */
20
- export const checkDeviceWidth = (projectBreakpoints: Record<CssBreakpoints, number>) => {
20
+ export const checkDeviceWidth = (projectBreakpoints: Record<CssBreakpointName, number>) => {
21
21
  const isMobile = breakpoints(projectBreakpoints).smaller('sm');
22
22
  const isTablet = breakpoints(projectBreakpoints).smaller('md');
23
23
 
package/types/index.d.ts CHANGED
@@ -57,7 +57,6 @@ export * from './search-top-models.d.ts';
57
57
  export * from './select-item.d.ts';
58
58
  export * from './model-group.d.ts';
59
59
  export * from './change-email-form.d.ts';
60
- export * from './css-breakpoints.d.ts';
61
60
  export * from './button-sizes.d.ts';
62
61
  export * from './button-themes.d.ts';
63
62
  export * from './report-request.d.ts';
@@ -1,15 +0,0 @@
1
- export type CssBreakpointName = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
2
-
3
- /**
4
- * Брейкпоинты на проекте,
5
- * должны совпадать с тем что в CSS assets/scss/_breakpoints.scss
6
- *
7
- * Используется для свайпера, для установки брейкпоинтов у него.
8
- */
9
- export const CSS_BREAKPOINTS: Record<CssBreakpointName, number> = {
10
- xs: 475,
11
- sm: 960,
12
- md: 1350,
13
- lg: 1600,
14
- xl: 2560,
15
- };
@@ -1 +0,0 @@
1
- export type CssBreakpoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl';