@slopmachine/svelte 0.0.1 → 0.0.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.
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@slopmachine/svelte",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Svelte wrapper for SlopMachine",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
7
7
  "svelte": "src/index.ts",
8
8
  "exports": {
9
9
  ".": {
10
+ "types": "./src/index.ts",
10
11
  "svelte": "./src/index.ts",
11
12
  "default": "./src/index.ts"
12
13
  }
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { buildImageUrl, type SlopMachineOptions } from "@slopmachine/core";
2
+ import { buildImageUrl, interpolatePrompt, type SlopMachineOptions } from "@slopmachine/core";
3
3
 
4
4
  interface Props extends SlopMachineOptions{
5
5
  class?: string;
@@ -19,6 +19,7 @@
19
19
 
20
20
  let src = $derived(buildImageUrl({ prompt, aspectRatio, variables, baseUrl, model }));
21
21
  let prevSrc = $state("");
22
+ let alt = $derived(interpolatePrompt( prompt, variables ) ?? "Generated image");
22
23
 
23
24
  $effect(() => {
24
25
  if (src !== prevSrc) {
@@ -59,7 +60,7 @@
59
60
 
60
61
  <img
61
62
  {src}
62
- alt={prompt}
63
+ {alt}
63
64
  onload={handleLoad}
64
65
  class:loaded={!isLoading}
65
66
  {...restProps}