@neurodyn/react-ai-try-on 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -17924,6 +17924,12 @@ function ZoomIn(props) {
17924
17924
  ]
17925
17925
  });
17926
17926
  }
17927
+ function fallBackOnce(fallbackSrc) {
17928
+ return (event)=>{
17929
+ const image = event.currentTarget;
17930
+ if (fallbackSrc && image.getAttribute('src') !== fallbackSrc) image.src = fallbackSrc;
17931
+ };
17932
+ }
17927
17933
  function TryOnImagePanel({ children, className, ...props }) {
17928
17934
  return /*#__PURE__*/ jsx_runtime_jsx("div", {
17929
17935
  className: utils_cn('relative h-82 w-full overflow-hidden rounded-xl bg-background-base sm:h-100', className),
@@ -17948,9 +17954,7 @@ function PhotoBackdrop({ className, src }) {
17948
17954
  }
17949
17955
  function SmartPhotoLayer({ backdropClassName, className, fallbackSrc, imageClassName, photo }) {
17950
17956
  const src = photo?.src ?? fallbackSrc;
17951
- function handleError(event) {
17952
- if (fallbackSrc) event.currentTarget.src = fallbackSrc;
17953
- }
17957
+ const handleError = fallBackOnce(fallbackSrc);
17954
17958
  return /*#__PURE__*/ jsxs(Fragment, {
17955
17959
  children: [
17956
17960
  src && /*#__PURE__*/ jsx_runtime_jsx("img", {
@@ -17980,9 +17984,7 @@ function BlurredPhotoBackdrop({ className, fallbackSrc, photo }) {
17980
17984
  "aria-hidden": "true",
17981
17985
  className: utils_cn('absolute inset-0 size-full scale-125 object-cover blur-3xl', className),
17982
17986
  src: src,
17983
- onError: (event)=>{
17984
- if (fallbackSrc) event.currentTarget.src = fallbackSrc;
17985
- }
17987
+ onError: fallBackOnce(fallbackSrc)
17986
17988
  }),
17987
17989
  /*#__PURE__*/ jsx_runtime_jsx("div", {
17988
17990
  "aria-hidden": "true",
@@ -18136,9 +18138,7 @@ function TryOnPerson({ className, fallbackSrc, photo }) {
18136
18138
  alt: photo?.name ?? '',
18137
18139
  className: utils_cn('absolute left-1/2 top-0 h-full w-69 -translate-x-1/2 object-cover', className),
18138
18140
  src: src,
18139
- onError: (event)=>{
18140
- if (fallbackSrc) event.currentTarget.src = fallbackSrc;
18141
- }
18141
+ onError: fallBackOnce(fallbackSrc)
18142
18142
  });
18143
18143
  }
18144
18144
  function ProductThumbnail({ className, imageSrc, name }) {
@@ -19284,9 +19284,7 @@ function ErrorScreen({ view, onClose }) {
19284
19284
  alt: view.photo.name ?? '',
19285
19285
  className: "size-full object-cover",
19286
19286
  src: view.photo.src,
19287
- onError: (event)=>{
19288
- event.currentTarget.src = view.productImageSrc;
19289
- }
19287
+ onError: fallBackOnce(view.productImageSrc)
19290
19288
  }) : null
19291
19289
  })
19292
19290
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@neurodyn/react-ai-try-on",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },