denwa-web-shared 1.0.16 → 1.0.18

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.
@@ -255,6 +255,15 @@ const generatePaginationArray = (pagination, baseUrl, initialParams) => {
255
255
  lastPage
256
256
  };
257
257
  };
258
+ const arrayToKeyValueObject = (arr) => {
259
+ return arr.reduce(
260
+ (acc, item) => {
261
+ acc[item] = item;
262
+ return acc;
263
+ },
264
+ {}
265
+ );
266
+ };
258
267
  function r(e) {
259
268
  var t, f, n = "";
260
269
  if ("string" == typeof e || "number" == typeof e) n += e;
@@ -6636,13 +6645,16 @@ const BasePicture = ({
6636
6645
  image2x,
6637
6646
  image1xWebp,
6638
6647
  image2xWebp,
6648
+ image1xAvif,
6649
+ image2xAvif,
6639
6650
  mobileImage1x,
6640
6651
  mobileImage2x,
6641
6652
  mobileImage1xWebp,
6642
6653
  mobileImage2xWebp,
6654
+ mobileImage1xAvif,
6655
+ mobileImage2xAvif,
6643
6656
  type,
6644
6657
  alt,
6645
- bgColorClass,
6646
6658
  mobileMaxWidth = 450,
6647
6659
  loading = "lazy",
6648
6660
  ...pictureProps
@@ -6664,6 +6676,14 @@ const BasePicture = ({
6664
6676
  type: "image/webp"
6665
6677
  }
6666
6678
  ),
6679
+ mobileImage1xAvif && /* @__PURE__ */ jsxRuntime.jsx(
6680
+ "source",
6681
+ {
6682
+ srcSet: `${mobileImage1xAvif} 1x${mobileImage2xAvif ? `, ${mobileImage2xAvif} 2x` : ""}`,
6683
+ media: `(max-width: ${mobileMaxWidth}px)`,
6684
+ type: "image/avif"
6685
+ }
6686
+ ),
6667
6687
  image1xWebp && /* @__PURE__ */ jsxRuntime.jsx(
6668
6688
  "source",
6669
6689
  {
@@ -6671,13 +6691,20 @@ const BasePicture = ({
6671
6691
  type: "image/webp"
6672
6692
  }
6673
6693
  ),
6694
+ image1xAvif && /* @__PURE__ */ jsxRuntime.jsx(
6695
+ "source",
6696
+ {
6697
+ srcSet: `${image1xAvif} 1x${image2xAvif ? `, ${image2xAvif} 2x` : ""}`,
6698
+ type: "image/avif"
6699
+ }
6700
+ ),
6674
6701
  /* @__PURE__ */ jsxRuntime.jsx("source", { srcSet: `${image1x} 1x${image2x ? `, ${image2x} 2x` : ""}`, type }),
6675
6702
  /* @__PURE__ */ jsxRuntime.jsx(
6676
6703
  "img",
6677
6704
  {
6678
6705
  ...imgProps,
6679
- className: cn(bgColorClass, imgProps == null ? void 0 : imgProps.className),
6680
- src: image1xWebp ? image1xWebp : image1x,
6706
+ className: imgProps == null ? void 0 : imgProps.className,
6707
+ src: image1x,
6681
6708
  alt,
6682
6709
  loading
6683
6710
  }
@@ -6687,6 +6714,7 @@ const BasePicture = ({
6687
6714
  exports.BasePicture = BasePicture;
6688
6715
  exports.THEME = THEME;
6689
6716
  exports.TIME = TIME;
6717
+ exports.arrayToKeyValueObject = arrayToKeyValueObject;
6690
6718
  exports.checkCorrectImageObject = checkCorrectImageObject;
6691
6719
  exports.cn = cn;
6692
6720
  exports.convertPhoneMask = convertPhoneMask;
@@ -253,6 +253,15 @@ const generatePaginationArray = (pagination, baseUrl, initialParams) => {
253
253
  lastPage
254
254
  };
255
255
  };
256
+ const arrayToKeyValueObject = (arr) => {
257
+ return arr.reduce(
258
+ (acc, item) => {
259
+ acc[item] = item;
260
+ return acc;
261
+ },
262
+ {}
263
+ );
264
+ };
256
265
  function r(e) {
257
266
  var t, f, n = "";
258
267
  if ("string" == typeof e || "number" == typeof e) n += e;
@@ -6634,13 +6643,16 @@ const BasePicture = ({
6634
6643
  image2x,
6635
6644
  image1xWebp,
6636
6645
  image2xWebp,
6646
+ image1xAvif,
6647
+ image2xAvif,
6637
6648
  mobileImage1x,
6638
6649
  mobileImage2x,
6639
6650
  mobileImage1xWebp,
6640
6651
  mobileImage2xWebp,
6652
+ mobileImage1xAvif,
6653
+ mobileImage2xAvif,
6641
6654
  type,
6642
6655
  alt,
6643
- bgColorClass,
6644
6656
  mobileMaxWidth = 450,
6645
6657
  loading = "lazy",
6646
6658
  ...pictureProps
@@ -6662,6 +6674,14 @@ const BasePicture = ({
6662
6674
  type: "image/webp"
6663
6675
  }
6664
6676
  ),
6677
+ mobileImage1xAvif && /* @__PURE__ */ jsx(
6678
+ "source",
6679
+ {
6680
+ srcSet: `${mobileImage1xAvif} 1x${mobileImage2xAvif ? `, ${mobileImage2xAvif} 2x` : ""}`,
6681
+ media: `(max-width: ${mobileMaxWidth}px)`,
6682
+ type: "image/avif"
6683
+ }
6684
+ ),
6665
6685
  image1xWebp && /* @__PURE__ */ jsx(
6666
6686
  "source",
6667
6687
  {
@@ -6669,13 +6689,20 @@ const BasePicture = ({
6669
6689
  type: "image/webp"
6670
6690
  }
6671
6691
  ),
6692
+ image1xAvif && /* @__PURE__ */ jsx(
6693
+ "source",
6694
+ {
6695
+ srcSet: `${image1xAvif} 1x${image2xAvif ? `, ${image2xAvif} 2x` : ""}`,
6696
+ type: "image/avif"
6697
+ }
6698
+ ),
6672
6699
  /* @__PURE__ */ jsx("source", { srcSet: `${image1x} 1x${image2x ? `, ${image2x} 2x` : ""}`, type }),
6673
6700
  /* @__PURE__ */ jsx(
6674
6701
  "img",
6675
6702
  {
6676
6703
  ...imgProps,
6677
- className: cn(bgColorClass, imgProps == null ? void 0 : imgProps.className),
6678
- src: image1xWebp ? image1xWebp : image1x,
6704
+ className: imgProps == null ? void 0 : imgProps.className,
6705
+ src: image1x,
6679
6706
  alt,
6680
6707
  loading
6681
6708
  }
@@ -6686,6 +6713,7 @@ export {
6686
6713
  BasePicture,
6687
6714
  THEME,
6688
6715
  TIME,
6716
+ arrayToKeyValueObject,
6689
6717
  checkCorrectImageObject,
6690
6718
  cn,
6691
6719
  convertPhoneMask,
@@ -124,3 +124,8 @@ export declare const prepareColor: ({ color1, color2, notFoundText, COLORS_NAMES
124
124
  * @param initialParams - Параметры url
125
125
  */
126
126
  export declare const generatePaginationArray: (pagination: IPaginate | null, baseUrl: string, initialParams: Record<string, string>) => PaginationResult;
127
+ /**
128
+ * @description Превращение массива в объект ключ-значение
129
+ * @param arr - Массив
130
+ */
131
+ export declare const arrayToKeyValueObject: <T extends string>(arr: T[]) => Record<T, T>;
@@ -6,13 +6,16 @@ interface BasePictureProps extends DetailedHTMLProps<HTMLAttributes<HTMLElement>
6
6
  image2x?: string;
7
7
  image1xWebp?: string;
8
8
  image2xWebp?: string;
9
+ image1xAvif?: string;
10
+ image2xAvif?: string;
9
11
  mobileImage1x?: string;
10
12
  mobileImage2x?: string;
11
13
  mobileImage1xWebp?: string;
12
14
  mobileImage2xWebp?: string;
15
+ mobileImage1xAvif?: string;
16
+ mobileImage2xAvif?: string;
13
17
  type: ImageType;
14
18
  alt: string;
15
- bgColorClass: string;
16
19
  mobileMaxWidth?: number;
17
20
  loading?: 'eager' | 'lazy';
18
21
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "denwa-web-shared",
3
3
  "private": false,
4
- "version": "1.0.16",
4
+ "version": "1.0.18",
5
5
  "type": "module",
6
6
  "author": "Denwa",
7
7
  "main": "dist/denwa-web-shared.cjs.js",