@myoc/element 0.19.523 → 0.19.524

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.
package/dist/dev/index.js CHANGED
@@ -14789,6 +14789,7 @@ var updateImageCache = async ({
14789
14789
  if (fileData.mimeType === MIME_TYPES.binary) {
14790
14790
  throw new Error("Only images can be added to ImageCache");
14791
14791
  }
14792
+ const previousCacheEntry = imageCache.get(fileId);
14792
14793
  const imagePromise = loadHTMLImageElement(fileData.dataURL);
14793
14794
  const data = {
14794
14795
  image: imagePromise,
@@ -14796,7 +14797,16 @@ var updateImageCache = async ({
14796
14797
  };
14797
14798
  imageCache.set(fileId, data);
14798
14799
  const image = await imagePromise;
14799
- imageCache.set(fileId, { ...data, image });
14800
+ if (previousCacheEntry?.isPlaceholder) {
14801
+ imageCache.set(fileId, {
14802
+ ...data,
14803
+ image,
14804
+ placeholderImage: await previousCacheEntry.image,
14805
+ transitionStart: performance.now()
14806
+ });
14807
+ } else {
14808
+ imageCache.set(fileId, { ...data, image });
14809
+ }
14800
14810
  } catch (error) {
14801
14811
  erroredFiles.set(fileId, true);
14802
14812
  }