@slopmachine/svelte 0.1.2 → 0.1.3
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/package.json +1 -1
- package/src/SlopImage.svelte +16 -10
package/package.json
CHANGED
package/src/SlopImage.svelte
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
buildImageUrl,
|
|
4
|
-
interpolatePrompt,
|
|
5
|
-
type SlopImageOptions,
|
|
6
|
-
} from "@slopmachine/core";
|
|
2
|
+
import { buildImageUrl, type SlopImageOptions } from "@slopmachine/core";
|
|
7
3
|
|
|
8
4
|
interface Props extends SlopImageOptions {
|
|
9
5
|
class?: string;
|
|
@@ -11,8 +7,9 @@
|
|
|
11
7
|
|
|
12
8
|
let {
|
|
13
9
|
bucketId,
|
|
14
|
-
prompt,
|
|
15
10
|
aspectRatio = "1:1",
|
|
11
|
+
version,
|
|
12
|
+
resultId,
|
|
16
13
|
model,
|
|
17
14
|
variables = {},
|
|
18
15
|
baseUrl = undefined,
|
|
@@ -23,16 +20,25 @@
|
|
|
23
20
|
let isLoading = $state(true);
|
|
24
21
|
|
|
25
22
|
let computedSrc = $derived(
|
|
26
|
-
buildImageUrl({
|
|
23
|
+
buildImageUrl({
|
|
24
|
+
bucketId,
|
|
25
|
+
aspectRatio,
|
|
26
|
+
version,
|
|
27
|
+
resultId,
|
|
28
|
+
variables,
|
|
29
|
+
baseUrl,
|
|
30
|
+
model,
|
|
31
|
+
}),
|
|
27
32
|
);
|
|
28
33
|
let src = $state("");
|
|
29
34
|
let prevSrc = $state("");
|
|
30
|
-
let alt =
|
|
35
|
+
let alt = "Generated image";
|
|
31
36
|
|
|
32
37
|
$effect(() => {
|
|
38
|
+
const currentComputedSrc = computedSrc;
|
|
33
39
|
const timeout = setTimeout(() => {
|
|
34
|
-
if (src !==
|
|
35
|
-
src =
|
|
40
|
+
if (src !== currentComputedSrc) {
|
|
41
|
+
src = currentComputedSrc;
|
|
36
42
|
}
|
|
37
43
|
}, 50);
|
|
38
44
|
|