@slopmachine/react 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/dist/index.js CHANGED
@@ -45,9 +45,10 @@ function cn(...inputs) {
45
45
  }
46
46
  var SlopImage = ({
47
47
  bucketId,
48
- prompt,
49
48
  className,
50
49
  aspectRatio = "1:1",
50
+ version,
51
+ resultId,
51
52
  model,
52
53
  variables = {},
53
54
  baseUrl,
@@ -56,13 +57,14 @@ var SlopImage = ({
56
57
  const rawSrc = (0, import_react.useMemo)(
57
58
  () => (0, import_core.buildImageUrl)({
58
59
  bucketId,
59
- prompt,
60
60
  aspectRatio,
61
+ version,
62
+ resultId,
61
63
  variables,
62
64
  baseUrl,
63
65
  model
64
66
  }),
65
- [bucketId, prompt, aspectRatio, variables, baseUrl, model]
67
+ [bucketId, aspectRatio, version, resultId, variables, baseUrl, model]
66
68
  );
67
69
  const [src, setSrc] = (0, import_react.useState)(rawSrc);
68
70
  import_react.default.useEffect(() => {
@@ -71,10 +73,7 @@ var SlopImage = ({
71
73
  }, 100);
72
74
  return () => clearTimeout(timer);
73
75
  }, [rawSrc]);
74
- const alt = (0, import_react.useMemo)(
75
- () => (0, import_core.interpolatePrompt)(prompt, variables) ?? "Generated image",
76
- [prompt, variables]
77
- );
76
+ const alt = "Generated image";
78
77
  const [isLoading, setIsLoading] = (0, import_react.useState)(true);
79
78
  const [currentSrc, setCurrentSrc] = (0, import_react.useState)(src);
80
79
  if (src !== currentSrc) {
package/dist/index.mjs CHANGED
@@ -2,19 +2,17 @@
2
2
  import React, { useMemo, useState } from "react";
3
3
  import { clsx } from "clsx";
4
4
  import { twMerge } from "tailwind-merge";
5
- import {
6
- buildImageUrl,
7
- interpolatePrompt
8
- } from "@slopmachine/core";
5
+ import { buildImageUrl } from "@slopmachine/core";
9
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
7
  function cn(...inputs) {
11
8
  return twMerge(clsx(inputs));
12
9
  }
13
10
  var SlopImage = ({
14
11
  bucketId,
15
- prompt,
16
12
  className,
17
13
  aspectRatio = "1:1",
14
+ version,
15
+ resultId,
18
16
  model,
19
17
  variables = {},
20
18
  baseUrl,
@@ -23,13 +21,14 @@ var SlopImage = ({
23
21
  const rawSrc = useMemo(
24
22
  () => buildImageUrl({
25
23
  bucketId,
26
- prompt,
27
24
  aspectRatio,
25
+ version,
26
+ resultId,
28
27
  variables,
29
28
  baseUrl,
30
29
  model
31
30
  }),
32
- [bucketId, prompt, aspectRatio, variables, baseUrl, model]
31
+ [bucketId, aspectRatio, version, resultId, variables, baseUrl, model]
33
32
  );
34
33
  const [src, setSrc] = useState(rawSrc);
35
34
  React.useEffect(() => {
@@ -38,10 +37,7 @@ var SlopImage = ({
38
37
  }, 100);
39
38
  return () => clearTimeout(timer);
40
39
  }, [rawSrc]);
41
- const alt = useMemo(
42
- () => interpolatePrompt(prompt, variables) ?? "Generated image",
43
- [prompt, variables]
44
- );
40
+ const alt = "Generated image";
45
41
  const [isLoading, setIsLoading] = useState(true);
46
42
  const [currentSrc, setCurrentSrc] = useState(src);
47
43
  if (src !== currentSrc) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slopmachine/react",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "The official React SDK for Slop Machine",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -2,11 +2,7 @@ import React, { useMemo, useState } from "react";
2
2
  import { clsx, type ClassValue } from "clsx";
3
3
  import { twMerge } from "tailwind-merge";
4
4
 
5
- import {
6
- buildImageUrl,
7
- interpolatePrompt,
8
- type SlopImageOptions,
9
- } from "@slopmachine/core";
5
+ import { buildImageUrl, type SlopImageOptions } from "@slopmachine/core";
10
6
 
11
7
  // Utility for Tailwind classes
12
8
  function cn(...inputs: ClassValue[]) {
@@ -20,9 +16,10 @@ interface SlopImageProps
20
16
 
21
17
  export const SlopImage: React.FC<SlopImageProps> = ({
22
18
  bucketId,
23
- prompt,
24
19
  className,
25
20
  aspectRatio = "1:1",
21
+ version,
22
+ resultId,
26
23
  model,
27
24
  variables = {},
28
25
  baseUrl,
@@ -33,13 +30,14 @@ export const SlopImage: React.FC<SlopImageProps> = ({
33
30
  () =>
34
31
  buildImageUrl({
35
32
  bucketId,
36
- prompt,
37
33
  aspectRatio,
34
+ version,
35
+ resultId,
38
36
  variables,
39
37
  baseUrl,
40
38
  model,
41
39
  }),
42
- [bucketId, prompt, aspectRatio, variables, baseUrl, model],
40
+ [bucketId, aspectRatio, version, resultId, variables, baseUrl, model],
43
41
  );
44
42
 
45
43
  const [src, setSrc] = useState(rawSrc);
@@ -51,10 +49,7 @@ export const SlopImage: React.FC<SlopImageProps> = ({
51
49
  return () => clearTimeout(timer);
52
50
  }, [rawSrc]);
53
51
 
54
- const alt = useMemo(
55
- () => interpolatePrompt(prompt, variables) ?? "Generated image",
56
- [prompt, variables],
57
- );
52
+ const alt = "Generated image";
58
53
 
59
54
  const [isLoading, setIsLoading] = useState(true);
60
55
  const [currentSrc, setCurrentSrc] = useState(src);