denwa-web-shared 1.0.19 → 1.0.21

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.
@@ -6641,41 +6641,43 @@ const responseSchema = object({
6641
6641
  });
6642
6642
  const BasePicture = ({
6643
6643
  imgProps,
6644
- image1x,
6645
- image2x,
6646
- image1xWebp,
6647
- image2xWebp,
6648
- image1xAvif,
6649
- image2xAvif,
6650
- mobileImage1x,
6651
- mobileImage2x,
6652
- mobileImage1xWebp,
6653
- mobileImage2xWebp,
6654
- mobileImage1xAvif,
6655
- mobileImage2xAvif,
6644
+ data,
6656
6645
  type,
6657
6646
  alt,
6658
6647
  mobileMaxWidth = 450,
6659
6648
  loading = "lazy",
6660
6649
  ...pictureProps
6661
6650
  }) => {
6651
+ const {
6652
+ image1x,
6653
+ image2x,
6654
+ image1xWebp,
6655
+ image2xWebp,
6656
+ image1xAvif,
6657
+ image2xAvif,
6658
+ mobileImage1x,
6659
+ mobileImage2x,
6660
+ mobileImage1xWebp,
6661
+ mobileImage2xWebp,
6662
+ mobileImage1xAvif,
6663
+ mobileImage2xAvif
6664
+ } = data;
6662
6665
  return /* @__PURE__ */ jsxRuntime.jsxs("picture", { ...pictureProps, children: [
6663
- mobileImage1x && /* @__PURE__ */ jsxRuntime.jsx(
6666
+ image1xAvif && /* @__PURE__ */ jsxRuntime.jsx(
6664
6667
  "source",
6665
6668
  {
6666
- srcSet: `${mobileImage1x} 1x${mobileImage2x ? `, ${mobileImage2x} 2x` : ""}`,
6667
- media: `(max-width: ${mobileMaxWidth}px)`,
6668
- type
6669
+ srcSet: `${image1xAvif} 1x${image2xAvif ? `, ${image2xAvif} 2x` : ""}`,
6670
+ type: "image/avif"
6669
6671
  }
6670
6672
  ),
6671
- mobileImage1xWebp && /* @__PURE__ */ jsxRuntime.jsx(
6673
+ image1xWebp && /* @__PURE__ */ jsxRuntime.jsx(
6672
6674
  "source",
6673
6675
  {
6674
- srcSet: `${mobileImage1xWebp} 1x${mobileImage2xWebp ? `, ${mobileImage2xWebp} 2x` : ""}`,
6675
- media: `(max-width: ${mobileMaxWidth}px)`,
6676
+ srcSet: `${image1xWebp} 1x${image2xWebp ? `, ${image2xWebp} 2x` : ""}`,
6676
6677
  type: "image/webp"
6677
6678
  }
6678
6679
  ),
6680
+ /* @__PURE__ */ jsxRuntime.jsx("source", { srcSet: `${image1x} 1x${image2x ? `, ${image2x} 2x` : ""}`, type }),
6679
6681
  mobileImage1xAvif && /* @__PURE__ */ jsxRuntime.jsx(
6680
6682
  "source",
6681
6683
  {
@@ -6684,29 +6686,31 @@ const BasePicture = ({
6684
6686
  type: "image/avif"
6685
6687
  }
6686
6688
  ),
6687
- image1xWebp && /* @__PURE__ */ jsxRuntime.jsx(
6689
+ mobileImage1xWebp && /* @__PURE__ */ jsxRuntime.jsx(
6688
6690
  "source",
6689
6691
  {
6690
- srcSet: `${image1xWebp} 1x${image2xWebp ? `, ${image2xWebp} 2x` : ""}`,
6692
+ srcSet: `${mobileImage1xWebp} 1x${mobileImage2xWebp ? `, ${mobileImage2xWebp} 2x` : ""}`,
6693
+ media: `(max-width: ${mobileMaxWidth}px)`,
6691
6694
  type: "image/webp"
6692
6695
  }
6693
6696
  ),
6694
- image1xAvif && /* @__PURE__ */ jsxRuntime.jsx(
6697
+ mobileImage1x && /* @__PURE__ */ jsxRuntime.jsx(
6695
6698
  "source",
6696
6699
  {
6697
- srcSet: `${image1xAvif} 1x${image2xAvif ? `, ${image2xAvif} 2x` : ""}`,
6698
- type: "image/avif"
6700
+ srcSet: `${mobileImage1x} 1x${mobileImage2x ? `, ${mobileImage2x} 2x` : ""}`,
6701
+ media: `(max-width: ${mobileMaxWidth}px)`,
6702
+ type
6699
6703
  }
6700
6704
  ),
6701
- /* @__PURE__ */ jsxRuntime.jsx("source", { srcSet: `${image1x} 1x${image2x ? `, ${image2x} 2x` : ""}`, type }),
6702
6705
  /* @__PURE__ */ jsxRuntime.jsx(
6703
6706
  "img",
6704
6707
  {
6705
6708
  ...imgProps,
6706
- className: imgProps == null ? void 0 : imgProps.className,
6707
6709
  src: image1x,
6708
6710
  alt,
6709
- loading
6711
+ loading,
6712
+ decoding: loading === "eager" ? "sync" : "async",
6713
+ fetchPriority: loading === "eager" ? "high" : "low"
6710
6714
  }
6711
6715
  )
6712
6716
  ] });
@@ -6639,41 +6639,43 @@ const responseSchema = object({
6639
6639
  });
6640
6640
  const BasePicture = ({
6641
6641
  imgProps,
6642
- image1x,
6643
- image2x,
6644
- image1xWebp,
6645
- image2xWebp,
6646
- image1xAvif,
6647
- image2xAvif,
6648
- mobileImage1x,
6649
- mobileImage2x,
6650
- mobileImage1xWebp,
6651
- mobileImage2xWebp,
6652
- mobileImage1xAvif,
6653
- mobileImage2xAvif,
6642
+ data,
6654
6643
  type,
6655
6644
  alt,
6656
6645
  mobileMaxWidth = 450,
6657
6646
  loading = "lazy",
6658
6647
  ...pictureProps
6659
6648
  }) => {
6649
+ const {
6650
+ image1x,
6651
+ image2x,
6652
+ image1xWebp,
6653
+ image2xWebp,
6654
+ image1xAvif,
6655
+ image2xAvif,
6656
+ mobileImage1x,
6657
+ mobileImage2x,
6658
+ mobileImage1xWebp,
6659
+ mobileImage2xWebp,
6660
+ mobileImage1xAvif,
6661
+ mobileImage2xAvif
6662
+ } = data;
6660
6663
  return /* @__PURE__ */ jsxs("picture", { ...pictureProps, children: [
6661
- mobileImage1x && /* @__PURE__ */ jsx(
6664
+ image1xAvif && /* @__PURE__ */ jsx(
6662
6665
  "source",
6663
6666
  {
6664
- srcSet: `${mobileImage1x} 1x${mobileImage2x ? `, ${mobileImage2x} 2x` : ""}`,
6665
- media: `(max-width: ${mobileMaxWidth}px)`,
6666
- type
6667
+ srcSet: `${image1xAvif} 1x${image2xAvif ? `, ${image2xAvif} 2x` : ""}`,
6668
+ type: "image/avif"
6667
6669
  }
6668
6670
  ),
6669
- mobileImage1xWebp && /* @__PURE__ */ jsx(
6671
+ image1xWebp && /* @__PURE__ */ jsx(
6670
6672
  "source",
6671
6673
  {
6672
- srcSet: `${mobileImage1xWebp} 1x${mobileImage2xWebp ? `, ${mobileImage2xWebp} 2x` : ""}`,
6673
- media: `(max-width: ${mobileMaxWidth}px)`,
6674
+ srcSet: `${image1xWebp} 1x${image2xWebp ? `, ${image2xWebp} 2x` : ""}`,
6674
6675
  type: "image/webp"
6675
6676
  }
6676
6677
  ),
6678
+ /* @__PURE__ */ jsx("source", { srcSet: `${image1x} 1x${image2x ? `, ${image2x} 2x` : ""}`, type }),
6677
6679
  mobileImage1xAvif && /* @__PURE__ */ jsx(
6678
6680
  "source",
6679
6681
  {
@@ -6682,29 +6684,31 @@ const BasePicture = ({
6682
6684
  type: "image/avif"
6683
6685
  }
6684
6686
  ),
6685
- image1xWebp && /* @__PURE__ */ jsx(
6687
+ mobileImage1xWebp && /* @__PURE__ */ jsx(
6686
6688
  "source",
6687
6689
  {
6688
- srcSet: `${image1xWebp} 1x${image2xWebp ? `, ${image2xWebp} 2x` : ""}`,
6690
+ srcSet: `${mobileImage1xWebp} 1x${mobileImage2xWebp ? `, ${mobileImage2xWebp} 2x` : ""}`,
6691
+ media: `(max-width: ${mobileMaxWidth}px)`,
6689
6692
  type: "image/webp"
6690
6693
  }
6691
6694
  ),
6692
- image1xAvif && /* @__PURE__ */ jsx(
6695
+ mobileImage1x && /* @__PURE__ */ jsx(
6693
6696
  "source",
6694
6697
  {
6695
- srcSet: `${image1xAvif} 1x${image2xAvif ? `, ${image2xAvif} 2x` : ""}`,
6696
- type: "image/avif"
6698
+ srcSet: `${mobileImage1x} 1x${mobileImage2x ? `, ${mobileImage2x} 2x` : ""}`,
6699
+ media: `(max-width: ${mobileMaxWidth}px)`,
6700
+ type
6697
6701
  }
6698
6702
  ),
6699
- /* @__PURE__ */ jsx("source", { srcSet: `${image1x} 1x${image2x ? `, ${image2x} 2x` : ""}`, type }),
6700
6703
  /* @__PURE__ */ jsx(
6701
6704
  "img",
6702
6705
  {
6703
6706
  ...imgProps,
6704
- className: imgProps == null ? void 0 : imgProps.className,
6705
6707
  src: image1x,
6706
6708
  alt,
6707
- loading
6709
+ loading,
6710
+ decoding: loading === "eager" ? "sync" : "async",
6711
+ fetchPriority: loading === "eager" ? "high" : "low"
6708
6712
  }
6709
6713
  )
6710
6714
  ] });
@@ -1,7 +1,14 @@
1
1
  import { DetailedHTMLProps, FC, HTMLAttributes, ImgHTMLAttributes } from 'react';
2
2
  import { ImageType } from '../types';
3
- export interface BasePictureProps extends DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement> {
3
+ export interface BasePictureProps extends DetailedHTMLProps<HTMLAttributes<HTMLPictureElement>, HTMLPictureElement> {
4
4
  imgProps?: DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
5
+ data: PictureData;
6
+ type: ImageType;
7
+ alt: string;
8
+ mobileMaxWidth?: number;
9
+ loading?: 'eager' | 'lazy';
10
+ }
11
+ export interface PictureData {
5
12
  image1x: string;
6
13
  image2x?: string;
7
14
  image1xWebp?: string;
@@ -14,9 +21,5 @@ export interface BasePictureProps extends DetailedHTMLProps<HTMLAttributes<HTMLE
14
21
  mobileImage2xWebp?: string;
15
22
  mobileImage1xAvif?: string;
16
23
  mobileImage2xAvif?: string;
17
- type: ImageType;
18
- alt: string;
19
- mobileMaxWidth?: number;
20
- loading?: 'eager' | 'lazy';
21
24
  }
22
25
  export declare const BasePicture: FC<BasePictureProps>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "denwa-web-shared",
3
3
  "private": false,
4
- "version": "1.0.19",
4
+ "version": "1.0.21",
5
5
  "type": "module",
6
6
  "author": "Denwa",
7
7
  "main": "dist/denwa-web-shared.cjs.js",