next-blurhash-previews 0.0.3-beta45 → 0.0.3-beta48

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.
@@ -10,7 +10,7 @@ export const blurhashPlugin = publicPath => () => {
10
10
  let outstanding = 0;
11
11
 
12
12
  visitParents(tree, "image", async (node, ancestors) => {
13
- let { url: imagePath, alt } = node;
13
+ let { url: imagePath, alt = "" } = node;
14
14
 
15
15
  const originalImg = imagePath;
16
16
  if (!/http/.test(imagePath)) {
@@ -28,6 +28,8 @@ export const blurhashPlugin = publicPath => () => {
28
28
 
29
29
  const blurHash = await getBlurhash(imagePath);
30
30
 
31
+ const { w, h } = blurHash;
32
+
31
33
  console.log(
32
34
  colors.green(`Finished processing ${imagePath}\n\t`, blurHash)
33
35
  );
@@ -37,7 +39,7 @@ export const blurhashPlugin = publicPath => () => {
37
39
 
38
40
  const newNode = `
39
41
  <blurhash-image url="${originalImg}" preview='${JSON.stringify(blurHash)}'>
40
- <img alt="${alt || ""}" src="${originalImg}" slot="image" />
42
+ <img alt="${alt}" width="${w}" src="${originalImg}" slot="image" />
41
43
  <canvas width="${blurHash.w}" height="${blurHash.h}" slot="preview"></canvas>
42
44
  </blurhash-image>`.trim();
43
45
 
@@ -53,7 +53,9 @@ class ImageWithPreview extends HTMLElement {
53
53
  }
54
54
 
55
55
  #imgLoad = () => {
56
- this.sd.innerHTML = `<slot name="image"></slot>`;
56
+ setTimeout(() => {
57
+ this.sd.innerHTML = `<slot name="image"></slot>`;
58
+ }, 19000);
57
59
  };
58
60
 
59
61
  attributeChangedCallback(name) {
@@ -44,7 +44,9 @@ class ImageWithPreview extends HTMLElement {
44
44
  }
45
45
  }
46
46
  #imgLoad = () => {
47
- this.sd.innerHTML = \`<slot name="image"></slot>\`;
47
+ setTimeout(() => {
48
+ this.sd.innerHTML = \`<slot name="image"></slot>\`;
49
+ }, 19e3);
48
50
  };
49
51
  attributeChangedCallback(name) {
50
52
  if (this.#canvasEl && name === "preview") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-blurhash-previews",
3
- "version": "0.0.3-beta45",
3
+ "version": "0.0.3-beta48",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "index.js",