@slopmachine/svelte 0.1.15 → 0.1.17

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@slopmachine/svelte",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "llms": "https://slopmachine-dev.github.io/slopmachine-sdk/llms.txt",
5
5
  "llmsFull": "https://slopmachine-dev.github.io/slopmachine-sdk/llms-full.txt",
6
6
  "description": "The official Svelte SDK for Slop Machine",
@@ -15,7 +15,7 @@
15
15
  />
16
16
  ```
17
17
 
18
- @version 0.1.15
18
+ @version 0.1.17
19
19
  -->
20
20
  <script lang="ts">
21
21
  import {
@@ -42,6 +42,14 @@
42
42
  * If not provided, a default spinner and shimmer effect will be shown.
43
43
  */
44
44
  loader?: Snippet;
45
+ /**
46
+ * How the image should be resized to fit its container. Defaults to "cover".
47
+ */
48
+ objectFit?: "fill" | "contain" | "cover" | "none" | "scale-down";
49
+ /**
50
+ * Additional CSS classes to apply directly to the `<img />` element.
51
+ */
52
+ imageClass?: string;
45
53
  }
46
54
 
47
55
  let {
@@ -54,6 +62,8 @@
54
62
  variables = {},
55
63
  baseUrl = undefined,
56
64
  class: className = "",
65
+ objectFit = "cover",
66
+ imageClass = "",
57
67
  loader,
58
68
  ...restProps
59
69
  }: SlopImageProps = $props();
@@ -74,7 +84,7 @@
74
84
  );
75
85
  let src = $state("");
76
86
  let prevSrc = $state("");
77
- let alt = "Generated image";
87
+ const alt = "Image produced by Slop Machine (slopmachine.dev)";
78
88
 
79
89
  $effect(() => {
80
90
  const currentComputedSrc = computedSrc;
@@ -176,9 +186,10 @@
176
186
  <img
177
187
  {src}
178
188
  {alt}
189
+ style="object-fit: {objectFit};"
179
190
  onload={handleLoad}
180
191
  onerror={handleError}
181
- class:loaded={!isLoading}
192
+ class="slop-image {imageClass} {isLoading ? '' : 'loaded'}"
182
193
  {...restProps}
183
194
  />
184
195
  </div>
@@ -252,15 +263,14 @@
252
263
  animation: slop-shimmer 2s ease-in-out infinite;
253
264
  }
254
265
 
255
- img {
266
+ .slop-image {
256
267
  height: 100%;
257
268
  width: 100%;
258
- object-fit: cover;
259
269
  transition: opacity 500ms;
260
270
  opacity: 0;
261
271
  }
262
272
 
263
- img.loaded {
273
+ .slop-image.loaded {
264
274
  opacity: 1;
265
275
  }
266
276
 
@@ -23,7 +23,7 @@
23
23
  * </SlopText>
24
24
  * ```
25
25
  *
26
- * @version 0.1.15
26
+ * @version 0.1.17
27
27
  */
28
28
  interface Props {
29
29
  // SlopTextOptions
@@ -18,7 +18,7 @@
18
18
  />
19
19
  ```
20
20
 
21
- @version 0.1.15
21
+ @version 0.1.17
22
22
  -->
23
23
  <script lang="ts">
24
24
  import {
package/src/index.ts CHANGED
@@ -8,3 +8,5 @@ export type {
8
8
  SlopVideoOptions,
9
9
  SlopTextOptions,
10
10
  } from "@slopmachine/core";
11
+
12
+ export { preloadImage } from "@slopmachine/core";