denwa-web-shared 1.0.46 → 1.0.47

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.
@@ -46,6 +46,20 @@ const CITY_MASK = {
46
46
  CITY_REGION: "{{CITY_REGION}}",
47
47
  CITY_REGION_DECL: "{{CITY_REGION_DECL}}"
48
48
  };
49
+ const getImageData = (basePath, filename, ext) => ({
50
+ image1x: `${basePath}/${filename}.${ext}`,
51
+ image2x: `${basePath}/${filename}_2x.${ext}`,
52
+ image1xWebp: `${basePath}/${filename}.webp`,
53
+ image2xWebp: `${basePath}/${filename}_2x.webp`,
54
+ image1xAvif: `${basePath}/${filename}.avif`,
55
+ image2xAvif: `${basePath}/${filename}_2x.avif`,
56
+ mobileImage1x: `${basePath}/${filename}_mobile.${ext}`,
57
+ mobileImage2x: `${basePath}/${filename}_mobile_2x.${ext}`,
58
+ mobileImage1xWebp: `${basePath}/${filename}_mobile.webp`,
59
+ mobileImage2xWebp: `${basePath}/${filename}_mobile_2x.webp`,
60
+ mobileImage1xAvif: `${basePath}/${filename}_mobile.avif`,
61
+ mobileImage2xAvif: `${basePath}/${filename}_mobile_2x.avif`
62
+ });
49
63
  const getNumberFormatter = (locale, options) => {
50
64
  return new Intl.NumberFormat(locale, options);
51
65
  };
@@ -6996,6 +7010,7 @@ exports.generatePaginationArray = generatePaginationArray;
6996
7010
  exports.generatePlaceholderColor = generatePlaceholderColor;
6997
7011
  exports.getByKey = getByKey;
6998
7012
  exports.getDateFormatter = getDateFormatter;
7013
+ exports.getImageData = getImageData;
6999
7014
  exports.getImagePrefix = getImagePrefix;
7000
7015
  exports.getLocaleField = getLocaleField;
7001
7016
  exports.getNumberFormatter = getNumberFormatter;
@@ -44,6 +44,20 @@ const CITY_MASK = {
44
44
  CITY_REGION: "{{CITY_REGION}}",
45
45
  CITY_REGION_DECL: "{{CITY_REGION_DECL}}"
46
46
  };
47
+ const getImageData = (basePath, filename, ext) => ({
48
+ image1x: `${basePath}/${filename}.${ext}`,
49
+ image2x: `${basePath}/${filename}_2x.${ext}`,
50
+ image1xWebp: `${basePath}/${filename}.webp`,
51
+ image2xWebp: `${basePath}/${filename}_2x.webp`,
52
+ image1xAvif: `${basePath}/${filename}.avif`,
53
+ image2xAvif: `${basePath}/${filename}_2x.avif`,
54
+ mobileImage1x: `${basePath}/${filename}_mobile.${ext}`,
55
+ mobileImage2x: `${basePath}/${filename}_mobile_2x.${ext}`,
56
+ mobileImage1xWebp: `${basePath}/${filename}_mobile.webp`,
57
+ mobileImage2xWebp: `${basePath}/${filename}_mobile_2x.webp`,
58
+ mobileImage1xAvif: `${basePath}/${filename}_mobile.avif`,
59
+ mobileImage2xAvif: `${basePath}/${filename}_mobile_2x.avif`
60
+ });
47
61
  const getNumberFormatter = (locale, options) => {
48
62
  return new Intl.NumberFormat(locale, options);
49
63
  };
@@ -6995,6 +7009,7 @@ export {
6995
7009
  generatePlaceholderColor,
6996
7010
  getByKey,
6997
7011
  getDateFormatter,
7012
+ getImageData,
6998
7013
  getImagePrefix,
6999
7014
  getLocaleField,
7000
7015
  getNumberFormatter,
@@ -1,4 +1,13 @@
1
1
  import { IPaginate, PaginationResult } from '../types';
2
+ import { PictureData } from '../types/picture-data';
3
+ /**
4
+ * @description Хелпер для генерации путей к адаптивным статичным изображениям (PictureData)
5
+ * @param basePath - Базовый путь к директории (например, '/compressed/cta')
6
+ * @param filename - Имя файла без расширения (например, 'cta-arrow')
7
+ * @param ext - Расширение исходного fallback-файла (по умолчанию 'jpg')
8
+ * @return Объект PictureData со всеми нужными форматами
9
+ */
10
+ export declare const getImageData: (basePath: string, filename: string, ext: "jpg" | "png") => PictureData;
2
11
  /**
3
12
  * @description Получить Intl для нужного языка
4
13
  * @param locale - Локаль
@@ -0,0 +1,14 @@
1
+ export interface PictureData {
2
+ image1x: string;
3
+ image2x: string;
4
+ image1xWebp: string;
5
+ image2xWebp: string;
6
+ image1xAvif: string;
7
+ image2xAvif: string;
8
+ mobileImage1x: string;
9
+ mobileImage2x: string;
10
+ mobileImage1xWebp: string;
11
+ mobileImage2xWebp: string;
12
+ mobileImage1xAvif: string;
13
+ mobileImage2xAvif: string;
14
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "denwa-web-shared",
3
3
  "private": false,
4
- "version": "1.0.46",
4
+ "version": "1.0.47",
5
5
  "type": "module",
6
6
  "author": "Denwa",
7
7
  "main": "dist/denwa-web-shared.cjs.js",