svelte-remote-image 0.4.1 → 0.4.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.
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script>import { browser } from "$app/environment";
|
|
2
2
|
import { afterUpdate } from "svelte";
|
|
3
3
|
export let src;
|
|
4
|
-
export let style;
|
|
5
4
|
export const alt = "";
|
|
6
5
|
export const title = "";
|
|
6
|
+
export let style = "";
|
|
7
|
+
let className = "";
|
|
8
|
+
export { className as class };
|
|
7
9
|
const imgId = `svelte-remote-image-${alt.replaceAll(" ", "-")}-${Math.round(Math.random() * 1e7)}`;
|
|
8
10
|
const getImgElement = () => browser ? document.getElementById(imgId) : null;
|
|
9
11
|
let visibilityStyle = "invisible";
|
|
@@ -60,7 +62,7 @@ const handleLoaded = () => {
|
|
|
60
62
|
width={imgSrc.w}
|
|
61
63
|
height={imgSrc.h}
|
|
62
64
|
{style}
|
|
63
|
-
class={visibilityStyle}
|
|
65
|
+
class={`${className} ${visibilityStyle}`}
|
|
64
66
|
src={imgSrc.img}
|
|
65
67
|
srcset={imgSrc.srcsets ? imgSrc.srcsets.map((s) => `${s.src} ${s.w}w`).join(', ') : ''}
|
|
66
68
|
alt={alt}
|
|
@@ -3,9 +3,10 @@ import type { ImgSrc } from './type.js';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
src: ImgSrc;
|
|
6
|
-
style: any;
|
|
7
6
|
alt?: string | undefined;
|
|
8
7
|
title?: string | undefined;
|
|
8
|
+
style?: string | undefined;
|
|
9
|
+
class?: string | undefined;
|
|
9
10
|
};
|
|
10
11
|
events: {
|
|
11
12
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script>import { browser } from "$app/environment";
|
|
2
2
|
import { afterUpdate } from "svelte";
|
|
3
3
|
export let src;
|
|
4
|
-
export let style = "";
|
|
5
4
|
export const alt = "";
|
|
6
5
|
export const title = "";
|
|
6
|
+
export let style = "";
|
|
7
|
+
let className = "";
|
|
8
|
+
export { className as class };
|
|
7
9
|
const imgId = `svelte-remote-image-${alt.replaceAll(" ", "-")}-${Math.round(Math.random() * 1e7)}`;
|
|
8
10
|
const getImgElement = () => browser ? document.getElementById(imgId) : null;
|
|
9
11
|
let loadStatus = "loading";
|
|
@@ -89,7 +91,7 @@ const handleLoaded = (e) => {
|
|
|
89
91
|
width={src.w}
|
|
90
92
|
height={src.h}
|
|
91
93
|
{style}
|
|
92
|
-
class={src.blur ? `image-blur-${loadStatus}` :
|
|
94
|
+
class={src.blur ? `image-blur-${loadStatus} ${className}` : className}
|
|
93
95
|
src={src.img}
|
|
94
96
|
alt={alt}
|
|
95
97
|
title={title}
|
|
@@ -3,9 +3,10 @@ import type { PictureSrc } from './type.js';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
src: PictureSrc;
|
|
6
|
-
style?: string | undefined;
|
|
7
6
|
alt?: string | undefined;
|
|
8
7
|
title?: string | undefined;
|
|
8
|
+
style?: string | undefined;
|
|
9
|
+
class?: string | undefined;
|
|
9
10
|
};
|
|
10
11
|
events: {
|
|
11
12
|
[evt: string]: CustomEvent<any>;
|