@slopmachine/react 0.1.9 → 0.1.12
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/Agents.md +34 -0
- package/README.md +1 -1
- package/dist/index.d.mts +63 -3
- package/dist/index.d.ts +63 -3
- package/dist/index.js +386 -83
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +389 -83
- package/dist/index.mjs.map +1 -0
- package/package.json +3 -2
- package/src/components/SlopImage.tsx +144 -83
- package/src/components/SlopVideo.tsx +308 -0
- package/src/index.ts +8 -1
- package/tsconfig.json +1 -0
- package/tsup.config.ts +5 -4
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import React, { useMemo, useState } from "react";
|
|
3
3
|
import { clsx } from "clsx";
|
|
4
4
|
import { twMerge } from "tailwind-merge";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
buildImageUrl
|
|
7
|
+
} from "@slopmachine/core";
|
|
6
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
9
|
function cn(...inputs) {
|
|
8
10
|
return twMerge(clsx(inputs));
|
|
@@ -16,6 +18,7 @@ var SlopImage = ({
|
|
|
16
18
|
model,
|
|
17
19
|
variables = {},
|
|
18
20
|
baseUrl,
|
|
21
|
+
loader,
|
|
19
22
|
...props
|
|
20
23
|
}) => {
|
|
21
24
|
const rawSrc = useMemo(
|
|
@@ -91,11 +94,11 @@ var SlopImage = ({
|
|
|
91
94
|
overflow: "hidden"
|
|
92
95
|
},
|
|
93
96
|
children: [
|
|
94
|
-
/* @__PURE__ */ jsx(
|
|
97
|
+
loader ? /* @__PURE__ */ jsx(
|
|
95
98
|
"div",
|
|
96
99
|
{
|
|
97
100
|
className: cn(
|
|
98
|
-
"absolute inset-0 z-10 flex items-center justify-center
|
|
101
|
+
"absolute inset-0 z-10 flex items-center justify-center transition-opacity duration-300",
|
|
99
102
|
isLoading ? "opacity-100" : "opacity-0 pointer-events-none"
|
|
100
103
|
),
|
|
101
104
|
style: {
|
|
@@ -108,82 +111,267 @@ var SlopImage = ({
|
|
|
108
111
|
display: "flex",
|
|
109
112
|
alignItems: "center",
|
|
110
113
|
justifyContent: "center",
|
|
111
|
-
backgroundColor: "var(--muted, #f3f4f6)",
|
|
112
114
|
opacity: isLoading ? 1 : 0,
|
|
113
115
|
pointerEvents: isLoading ? "auto" : "none",
|
|
114
116
|
transition: "opacity 300ms ease-in-out"
|
|
115
117
|
},
|
|
116
|
-
children:
|
|
117
|
-
"div",
|
|
118
|
-
{
|
|
119
|
-
className: "flex flex-col items-center gap-2",
|
|
120
|
-
style: {
|
|
121
|
-
display: "flex",
|
|
122
|
-
flexDirection: "column",
|
|
123
|
-
alignItems: "center",
|
|
124
|
-
gap: "0.5rem"
|
|
125
|
-
},
|
|
126
|
-
children: [
|
|
127
|
-
/* @__PURE__ */ jsxs(
|
|
128
|
-
"svg",
|
|
129
|
-
{
|
|
130
|
-
className: "spinner size-6 text-muted-foreground",
|
|
131
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
132
|
-
fill: "none",
|
|
133
|
-
viewBox: "0 0 24 24",
|
|
134
|
-
style: {
|
|
135
|
-
width: "24px",
|
|
136
|
-
height: "24px",
|
|
137
|
-
color: "var(--muted-foreground, #6b7280)",
|
|
138
|
-
animation: "slop-spin 1s linear infinite"
|
|
139
|
-
},
|
|
140
|
-
children: [
|
|
141
|
-
/* @__PURE__ */ jsx(
|
|
142
|
-
"circle",
|
|
143
|
-
{
|
|
144
|
-
className: "opacity-25",
|
|
145
|
-
cx: "12",
|
|
146
|
-
cy: "12",
|
|
147
|
-
r: "10",
|
|
148
|
-
stroke: "currentColor",
|
|
149
|
-
strokeWidth: "4",
|
|
150
|
-
style: { opacity: 0.25 }
|
|
151
|
-
}
|
|
152
|
-
),
|
|
153
|
-
/* @__PURE__ */ jsx(
|
|
154
|
-
"path",
|
|
155
|
-
{
|
|
156
|
-
className: "opacity-75",
|
|
157
|
-
fill: "currentColor",
|
|
158
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",
|
|
159
|
-
style: { opacity: 0.75 }
|
|
160
|
-
}
|
|
161
|
-
)
|
|
162
|
-
]
|
|
163
|
-
}
|
|
164
|
-
),
|
|
165
|
-
/* @__PURE__ */ jsx(
|
|
166
|
-
"span",
|
|
167
|
-
{
|
|
168
|
-
className: "text-xs text-muted-foreground",
|
|
169
|
-
style: {
|
|
170
|
-
fontSize: "0.75rem",
|
|
171
|
-
color: "var(--muted-foreground, #6b7280)"
|
|
172
|
-
},
|
|
173
|
-
children: "Loading..."
|
|
174
|
-
}
|
|
175
|
-
)
|
|
176
|
-
]
|
|
177
|
-
}
|
|
178
|
-
)
|
|
118
|
+
children: loader
|
|
179
119
|
}
|
|
180
|
-
),
|
|
120
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
121
|
+
/* @__PURE__ */ jsx(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
className: cn(
|
|
125
|
+
"absolute inset-0 z-10 flex items-center justify-center bg-muted transition-opacity duration-300",
|
|
126
|
+
isLoading ? "opacity-100" : "opacity-0 pointer-events-none"
|
|
127
|
+
),
|
|
128
|
+
style: {
|
|
129
|
+
position: "absolute",
|
|
130
|
+
top: 0,
|
|
131
|
+
left: 0,
|
|
132
|
+
right: 0,
|
|
133
|
+
bottom: 0,
|
|
134
|
+
zIndex: 10,
|
|
135
|
+
display: "flex",
|
|
136
|
+
alignItems: "center",
|
|
137
|
+
justifyContent: "center",
|
|
138
|
+
backgroundColor: "var(--muted, #f3f4f6)",
|
|
139
|
+
opacity: isLoading ? 1 : 0,
|
|
140
|
+
pointerEvents: isLoading ? "auto" : "none",
|
|
141
|
+
transition: "opacity 300ms ease-in-out"
|
|
142
|
+
},
|
|
143
|
+
children: /* @__PURE__ */ jsxs(
|
|
144
|
+
"div",
|
|
145
|
+
{
|
|
146
|
+
className: "flex flex-col items-center gap-2",
|
|
147
|
+
style: {
|
|
148
|
+
display: "flex",
|
|
149
|
+
flexDirection: "column",
|
|
150
|
+
alignItems: "center",
|
|
151
|
+
gap: "0.5rem"
|
|
152
|
+
},
|
|
153
|
+
children: [
|
|
154
|
+
/* @__PURE__ */ jsxs(
|
|
155
|
+
"svg",
|
|
156
|
+
{
|
|
157
|
+
className: "spinner size-6 text-muted-foreground",
|
|
158
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
159
|
+
fill: "none",
|
|
160
|
+
viewBox: "0 0 24 24",
|
|
161
|
+
style: {
|
|
162
|
+
width: "24px",
|
|
163
|
+
height: "24px",
|
|
164
|
+
color: "var(--muted-foreground, #6b7280)",
|
|
165
|
+
animation: "slop-spin 1s linear infinite"
|
|
166
|
+
},
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ jsx(
|
|
169
|
+
"circle",
|
|
170
|
+
{
|
|
171
|
+
className: "opacity-25",
|
|
172
|
+
cx: "12",
|
|
173
|
+
cy: "12",
|
|
174
|
+
r: "10",
|
|
175
|
+
stroke: "currentColor",
|
|
176
|
+
strokeWidth: "4",
|
|
177
|
+
style: { opacity: 0.25 }
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
/* @__PURE__ */ jsx(
|
|
181
|
+
"path",
|
|
182
|
+
{
|
|
183
|
+
className: "opacity-75",
|
|
184
|
+
fill: "currentColor",
|
|
185
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",
|
|
186
|
+
style: { opacity: 0.75 }
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
),
|
|
192
|
+
/* @__PURE__ */ jsx(
|
|
193
|
+
"span",
|
|
194
|
+
{
|
|
195
|
+
className: "text-xs text-muted-foreground",
|
|
196
|
+
style: {
|
|
197
|
+
fontSize: "0.75rem",
|
|
198
|
+
color: "var(--muted-foreground, #6b7280)"
|
|
199
|
+
},
|
|
200
|
+
children: "Loading..."
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
),
|
|
208
|
+
/* @__PURE__ */ jsx(
|
|
209
|
+
"div",
|
|
210
|
+
{
|
|
211
|
+
className: cn(
|
|
212
|
+
"shimmer-effect absolute inset-0 bg-gradient-to-r from-muted via-muted/50 to-muted",
|
|
213
|
+
isLoading ? "opacity-100" : "opacity-0"
|
|
214
|
+
),
|
|
215
|
+
style: {
|
|
216
|
+
position: "absolute",
|
|
217
|
+
top: 0,
|
|
218
|
+
left: 0,
|
|
219
|
+
right: 0,
|
|
220
|
+
bottom: 0,
|
|
221
|
+
background: "linear-gradient(90deg, var(--muted, #f3f4f6) 0%, var(--muted-foreground, #e5e7eb) 50%, var(--muted, #f3f4f6) 100%)",
|
|
222
|
+
backgroundSize: "200% 100%",
|
|
223
|
+
animation: "slop-shimmer 2s ease-in-out infinite",
|
|
224
|
+
opacity: isLoading ? 1 : 0,
|
|
225
|
+
transition: "opacity 300ms"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
] }),
|
|
181
230
|
/* @__PURE__ */ jsx(
|
|
182
|
-
"
|
|
231
|
+
"img",
|
|
183
232
|
{
|
|
233
|
+
src,
|
|
234
|
+
alt,
|
|
235
|
+
onLoad: () => setIsLoading(false),
|
|
236
|
+
onError: () => setIsLoading(false),
|
|
184
237
|
className: cn(
|
|
185
|
-
"
|
|
186
|
-
isLoading ? "opacity-
|
|
238
|
+
"h-full w-full object-cover transition-opacity duration-500",
|
|
239
|
+
isLoading ? "opacity-0" : "opacity-100"
|
|
240
|
+
),
|
|
241
|
+
style: {
|
|
242
|
+
height: "100%",
|
|
243
|
+
width: "100%",
|
|
244
|
+
objectFit: "cover",
|
|
245
|
+
transition: "opacity 500ms",
|
|
246
|
+
opacity: isLoading ? 0 : 1
|
|
247
|
+
},
|
|
248
|
+
...props
|
|
249
|
+
},
|
|
250
|
+
src
|
|
251
|
+
)
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
] });
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// src/components/SlopVideo.tsx
|
|
259
|
+
import { useMemo as useMemo2, useState as useState2, useRef, useEffect } from "react";
|
|
260
|
+
import { clsx as clsx2 } from "clsx";
|
|
261
|
+
import { twMerge as twMerge2 } from "tailwind-merge";
|
|
262
|
+
import {
|
|
263
|
+
buildVideoUrl
|
|
264
|
+
} from "@slopmachine/core";
|
|
265
|
+
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
266
|
+
function cn2(...inputs) {
|
|
267
|
+
return twMerge2(clsx2(inputs));
|
|
268
|
+
}
|
|
269
|
+
var SlopVideo = ({
|
|
270
|
+
bucketId,
|
|
271
|
+
className,
|
|
272
|
+
aspectRatio = "16:9",
|
|
273
|
+
version,
|
|
274
|
+
resultId,
|
|
275
|
+
model,
|
|
276
|
+
variables = {},
|
|
277
|
+
duration,
|
|
278
|
+
baseUrl,
|
|
279
|
+
loader,
|
|
280
|
+
autoPlay = true,
|
|
281
|
+
loop = true,
|
|
282
|
+
muted = true,
|
|
283
|
+
playsInline = true,
|
|
284
|
+
...props
|
|
285
|
+
}) => {
|
|
286
|
+
const rawSrc = useMemo2(
|
|
287
|
+
() => buildVideoUrl({
|
|
288
|
+
bucketId,
|
|
289
|
+
aspectRatio,
|
|
290
|
+
version,
|
|
291
|
+
resultId,
|
|
292
|
+
variables,
|
|
293
|
+
duration,
|
|
294
|
+
baseUrl,
|
|
295
|
+
model
|
|
296
|
+
}),
|
|
297
|
+
[
|
|
298
|
+
bucketId,
|
|
299
|
+
aspectRatio,
|
|
300
|
+
version,
|
|
301
|
+
resultId,
|
|
302
|
+
variables,
|
|
303
|
+
duration,
|
|
304
|
+
baseUrl,
|
|
305
|
+
model
|
|
306
|
+
]
|
|
307
|
+
);
|
|
308
|
+
const [src, setSrc] = useState2(rawSrc);
|
|
309
|
+
useEffect(() => {
|
|
310
|
+
const timer = setTimeout(() => {
|
|
311
|
+
setSrc(rawSrc);
|
|
312
|
+
}, 100);
|
|
313
|
+
return () => clearTimeout(timer);
|
|
314
|
+
}, [rawSrc]);
|
|
315
|
+
const [isLoading, setIsLoading] = useState2(true);
|
|
316
|
+
const [currentSrc, setCurrentSrc] = useState2(src);
|
|
317
|
+
const videoRef = useRef(null);
|
|
318
|
+
if (src !== currentSrc) {
|
|
319
|
+
setCurrentSrc(src);
|
|
320
|
+
setIsLoading(true);
|
|
321
|
+
}
|
|
322
|
+
useEffect(() => {
|
|
323
|
+
if (!src) return;
|
|
324
|
+
fetch(src, { method: "HEAD" }).then(async (res) => {
|
|
325
|
+
if (!res.ok) {
|
|
326
|
+
try {
|
|
327
|
+
const errRes = await fetch(src);
|
|
328
|
+
const errJson = await errRes.json();
|
|
329
|
+
console.error("SlopVideo error:", res.status, errJson.error);
|
|
330
|
+
} catch (e) {
|
|
331
|
+
}
|
|
332
|
+
setIsLoading(false);
|
|
333
|
+
}
|
|
334
|
+
}).catch((err) => {
|
|
335
|
+
console.error(`Error fetching video from ${src}:`, err);
|
|
336
|
+
setIsLoading(false);
|
|
337
|
+
});
|
|
338
|
+
}, [src]);
|
|
339
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
340
|
+
/* @__PURE__ */ jsx2("style", { children: `
|
|
341
|
+
@keyframes slop-shimmer {
|
|
342
|
+
0% {
|
|
343
|
+
background-position: 200% 0;
|
|
344
|
+
}
|
|
345
|
+
100% {
|
|
346
|
+
background-position: -200% 0;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
@keyframes slop-spin {
|
|
350
|
+
from {
|
|
351
|
+
transform: rotate(0deg);
|
|
352
|
+
}
|
|
353
|
+
to {
|
|
354
|
+
transform: rotate(360deg);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
` }),
|
|
358
|
+
/* @__PURE__ */ jsxs2(
|
|
359
|
+
"div",
|
|
360
|
+
{
|
|
361
|
+
className: cn2("relative overflow-hidden", className),
|
|
362
|
+
style: {
|
|
363
|
+
aspectRatio: String(aspectRatio).replace(":", "/"),
|
|
364
|
+
backgroundColor: "var(--muted, #f3f4f6)",
|
|
365
|
+
position: "relative",
|
|
366
|
+
overflow: "hidden"
|
|
367
|
+
},
|
|
368
|
+
children: [
|
|
369
|
+
loader ? /* @__PURE__ */ jsx2(
|
|
370
|
+
"div",
|
|
371
|
+
{
|
|
372
|
+
className: cn2(
|
|
373
|
+
"absolute inset-0 z-10 flex items-center justify-center transition-opacity duration-300",
|
|
374
|
+
isLoading ? "opacity-100" : "opacity-0 pointer-events-none"
|
|
187
375
|
),
|
|
188
376
|
style: {
|
|
189
377
|
position: "absolute",
|
|
@@ -191,22 +379,138 @@ var SlopImage = ({
|
|
|
191
379
|
left: 0,
|
|
192
380
|
right: 0,
|
|
193
381
|
bottom: 0,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
382
|
+
zIndex: 10,
|
|
383
|
+
display: "flex",
|
|
384
|
+
alignItems: "center",
|
|
385
|
+
justifyContent: "center",
|
|
197
386
|
opacity: isLoading ? 1 : 0,
|
|
198
|
-
|
|
199
|
-
|
|
387
|
+
pointerEvents: isLoading ? "auto" : "none",
|
|
388
|
+
transition: "opacity 300ms ease-in-out"
|
|
389
|
+
},
|
|
390
|
+
children: loader
|
|
200
391
|
}
|
|
201
|
-
),
|
|
202
|
-
|
|
203
|
-
|
|
392
|
+
) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
393
|
+
/* @__PURE__ */ jsx2(
|
|
394
|
+
"div",
|
|
395
|
+
{
|
|
396
|
+
className: cn2(
|
|
397
|
+
"absolute inset-0 z-10 flex items-center justify-center bg-muted transition-opacity duration-300",
|
|
398
|
+
isLoading ? "opacity-100" : "opacity-0 pointer-events-none"
|
|
399
|
+
),
|
|
400
|
+
style: {
|
|
401
|
+
position: "absolute",
|
|
402
|
+
top: 0,
|
|
403
|
+
left: 0,
|
|
404
|
+
right: 0,
|
|
405
|
+
bottom: 0,
|
|
406
|
+
zIndex: 10,
|
|
407
|
+
display: "flex",
|
|
408
|
+
alignItems: "center",
|
|
409
|
+
justifyContent: "center",
|
|
410
|
+
backgroundColor: "var(--muted, #f3f4f6)",
|
|
411
|
+
opacity: isLoading ? 1 : 0,
|
|
412
|
+
pointerEvents: isLoading ? "auto" : "none",
|
|
413
|
+
transition: "opacity 300ms ease-in-out"
|
|
414
|
+
},
|
|
415
|
+
children: /* @__PURE__ */ jsxs2(
|
|
416
|
+
"div",
|
|
417
|
+
{
|
|
418
|
+
className: "flex flex-col items-center gap-2",
|
|
419
|
+
style: {
|
|
420
|
+
display: "flex",
|
|
421
|
+
flexDirection: "column",
|
|
422
|
+
alignItems: "center",
|
|
423
|
+
gap: "0.5rem"
|
|
424
|
+
},
|
|
425
|
+
children: [
|
|
426
|
+
/* @__PURE__ */ jsxs2(
|
|
427
|
+
"svg",
|
|
428
|
+
{
|
|
429
|
+
className: "spinner size-6 text-muted-foreground",
|
|
430
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
431
|
+
fill: "none",
|
|
432
|
+
viewBox: "0 0 24 24",
|
|
433
|
+
style: {
|
|
434
|
+
width: "24px",
|
|
435
|
+
height: "24px",
|
|
436
|
+
color: "var(--muted-foreground, #6b7280)",
|
|
437
|
+
animation: "slop-spin 1s linear infinite"
|
|
438
|
+
},
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ jsx2(
|
|
441
|
+
"circle",
|
|
442
|
+
{
|
|
443
|
+
className: "opacity-25",
|
|
444
|
+
cx: "12",
|
|
445
|
+
cy: "12",
|
|
446
|
+
r: "10",
|
|
447
|
+
stroke: "currentColor",
|
|
448
|
+
strokeWidth: "4",
|
|
449
|
+
style: { opacity: 0.25 }
|
|
450
|
+
}
|
|
451
|
+
),
|
|
452
|
+
/* @__PURE__ */ jsx2(
|
|
453
|
+
"path",
|
|
454
|
+
{
|
|
455
|
+
className: "opacity-75",
|
|
456
|
+
fill: "currentColor",
|
|
457
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",
|
|
458
|
+
style: { opacity: 0.75 }
|
|
459
|
+
}
|
|
460
|
+
)
|
|
461
|
+
]
|
|
462
|
+
}
|
|
463
|
+
),
|
|
464
|
+
/* @__PURE__ */ jsx2(
|
|
465
|
+
"span",
|
|
466
|
+
{
|
|
467
|
+
className: "text-xs text-muted-foreground",
|
|
468
|
+
style: {
|
|
469
|
+
fontSize: "0.75rem",
|
|
470
|
+
color: "var(--muted-foreground, #6b7280)"
|
|
471
|
+
},
|
|
472
|
+
children: "Loading..."
|
|
473
|
+
}
|
|
474
|
+
)
|
|
475
|
+
]
|
|
476
|
+
}
|
|
477
|
+
)
|
|
478
|
+
}
|
|
479
|
+
),
|
|
480
|
+
/* @__PURE__ */ jsx2(
|
|
481
|
+
"div",
|
|
482
|
+
{
|
|
483
|
+
className: cn2(
|
|
484
|
+
"shimmer-effect absolute inset-0 bg-gradient-to-r from-muted via-muted/50 to-muted",
|
|
485
|
+
isLoading ? "opacity-100" : "opacity-0"
|
|
486
|
+
),
|
|
487
|
+
style: {
|
|
488
|
+
position: "absolute",
|
|
489
|
+
top: 0,
|
|
490
|
+
left: 0,
|
|
491
|
+
right: 0,
|
|
492
|
+
bottom: 0,
|
|
493
|
+
background: "linear-gradient(90deg, var(--muted, #f3f4f6) 0%, var(--muted-foreground, #e5e7eb) 50%, var(--muted, #f3f4f6) 100%)",
|
|
494
|
+
backgroundSize: "200% 100%",
|
|
495
|
+
animation: "slop-shimmer 2s ease-in-out infinite",
|
|
496
|
+
opacity: isLoading ? 1 : 0,
|
|
497
|
+
transition: "opacity 300ms"
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
)
|
|
501
|
+
] }),
|
|
502
|
+
/* @__PURE__ */ jsx2(
|
|
503
|
+
"video",
|
|
204
504
|
{
|
|
505
|
+
ref: videoRef,
|
|
205
506
|
src,
|
|
206
|
-
|
|
207
|
-
|
|
507
|
+
autoPlay,
|
|
508
|
+
loop,
|
|
509
|
+
muted,
|
|
510
|
+
playsInline,
|
|
511
|
+
onLoadedData: () => setIsLoading(false),
|
|
208
512
|
onError: () => setIsLoading(false),
|
|
209
|
-
className:
|
|
513
|
+
className: cn2(
|
|
210
514
|
"h-full w-full object-cover transition-opacity duration-500",
|
|
211
515
|
isLoading ? "opacity-0" : "opacity-100"
|
|
212
516
|
),
|
|
@@ -227,5 +531,7 @@ var SlopImage = ({
|
|
|
227
531
|
] });
|
|
228
532
|
};
|
|
229
533
|
export {
|
|
230
|
-
SlopImage
|
|
534
|
+
SlopImage,
|
|
535
|
+
SlopVideo
|
|
231
536
|
};
|
|
537
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/SlopImage.tsx","../src/components/SlopVideo.tsx"],"sourcesContent":["import React, { useMemo, useState } from \"react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nimport {\n buildImageUrl,\n type SlopImageOptions,\n type ImageAspectRatio,\n} from \"@slopmachine/core\";\n\n// Utility for Tailwind classes\nfunction cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport interface SlopImageProps\n extends\n Omit<React.ImgHTMLAttributes<HTMLImageElement>, \"src\" | \"alt\">,\n Omit<SlopImageOptions, \"aspectRatio\"> {\n /**\n * The aspect ratio of the generated image. Defaults to \"1:1\".\n */\n aspectRatio?: ImageAspectRatio;\n /**\n * Custom React node to display while the image is loading.\n * If not provided, a default spinner and shimmer effect will be shown.\n */\n loader?: React.ReactNode;\n}\n\n/**\n * Renders an image generated by Slop Machine.\n *\n * This component automatically constructs the correct URL for the Slop Machine API,\n * displays a loading skeleton or custom loader while fetching, and handles errors.\n *\n * @example\n * ```tsx\n * <SlopImage\n * bucketId=\"my-bucket\"\n * resultId=\"some-result\"\n * aspectRatio=\"16:9\"\n * className=\"rounded-lg\"\n * />\n * ```\n *\n * @version 0.1.12\n */\nexport const SlopImage: React.FC<SlopImageProps> = ({\n bucketId,\n className,\n aspectRatio = \"1:1\",\n version,\n resultId,\n model,\n variables = {},\n baseUrl,\n loader,\n ...props\n}) => {\n // Construct API URL\n const rawSrc = useMemo(\n () =>\n buildImageUrl({\n bucketId,\n aspectRatio,\n version,\n resultId,\n variables,\n baseUrl,\n model,\n }),\n [bucketId, aspectRatio, version, resultId, variables, baseUrl, model],\n );\n\n const [src, setSrc] = useState(rawSrc);\n\n React.useEffect(() => {\n const timer = setTimeout(() => {\n setSrc(rawSrc);\n }, 100);\n return () => clearTimeout(timer);\n }, [rawSrc]);\n\n const alt = \"Generated image\";\n\n const [isLoading, setIsLoading] = useState(true);\n const [currentSrc, setCurrentSrc] = useState(src);\n\n if (src !== currentSrc) {\n setCurrentSrc(src);\n setIsLoading(true);\n }\n\n React.useEffect(() => {\n if (!src) return;\n\n fetch(src, { method: \"HEAD\" })\n .then(async (res) => {\n if (!res.ok) {\n // console.error(\n // `Failed to load image from ${src}. Status: ${res.status} ${res.statusText}`,\n // );\n try {\n const errRes = await fetch(src);\n const errJson = await errRes.json();\n console.error(\"SlopImage error:\", res.status, errJson.error);\n } catch (e) {\n // Failed to fetch or parse error details\n }\n setIsLoading(false);\n }\n })\n .catch((err) => {\n console.error(`Error fetching image from ${src}:`, err);\n setIsLoading(false);\n });\n }, [src]);\n\n return (\n <>\n <style>{`\n @keyframes slop-shimmer {\n 0% {\n background-position: 200% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n }\n @keyframes slop-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n }\n `}</style>\n <div\n className={cn(\"relative overflow-hidden\", className)}\n style={{\n aspectRatio: String(aspectRatio).replace(\":\", \"/\"),\n backgroundColor: \"var(--muted, #f3f4f6)\",\n position: \"relative\",\n overflow: \"hidden\",\n }}\n >\n {/* Loading UI */}\n {loader ? (\n <div\n className={cn(\n \"absolute inset-0 z-10 flex items-center justify-center transition-opacity duration-300\",\n isLoading ? \"opacity-100\" : \"opacity-0 pointer-events-none\",\n )}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n zIndex: 10,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n opacity: isLoading ? 1 : 0,\n pointerEvents: isLoading ? \"auto\" : \"none\",\n transition: \"opacity 300ms ease-in-out\",\n }}\n >\n {loader}\n </div>\n ) : (\n <>\n {/* Loading overlay */}\n <div\n className={cn(\n \"absolute inset-0 z-10 flex items-center justify-center bg-muted transition-opacity duration-300\",\n isLoading ? \"opacity-100\" : \"opacity-0 pointer-events-none\",\n )}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n zIndex: 10,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: \"var(--muted, #f3f4f6)\",\n opacity: isLoading ? 1 : 0,\n pointerEvents: isLoading ? \"auto\" : \"none\",\n transition: \"opacity 300ms ease-in-out\",\n }}\n >\n <div\n className=\"flex flex-col items-center gap-2\"\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: \"0.5rem\",\n }}\n >\n <svg\n className=\"spinner size-6 text-muted-foreground\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n style={{\n width: \"24px\",\n height: \"24px\",\n color: \"var(--muted-foreground, #6b7280)\",\n animation: \"slop-spin 1s linear infinite\",\n }}\n >\n <circle\n className=\"opacity-25\"\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n stroke=\"currentColor\"\n strokeWidth=\"4\"\n style={{ opacity: 0.25 }}\n />\n <path\n className=\"opacity-75\"\n fill=\"currentColor\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n style={{ opacity: 0.75 }}\n />\n </svg>\n <span\n className=\"text-xs text-muted-foreground\"\n style={{\n fontSize: \"0.75rem\",\n color: \"var(--muted-foreground, #6b7280)\",\n }}\n >\n Loading...\n </span>\n </div>\n </div>\n\n {/* Shimmer effect underneath */}\n <div\n className={cn(\n \"shimmer-effect absolute inset-0 bg-gradient-to-r from-muted via-muted/50 to-muted\",\n isLoading ? \"opacity-100\" : \"opacity-0\",\n )}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n background:\n \"linear-gradient(90deg, var(--muted, #f3f4f6) 0%, var(--muted-foreground, #e5e7eb) 50%, var(--muted, #f3f4f6) 100%)\",\n backgroundSize: \"200% 100%\",\n animation: \"slop-shimmer 2s ease-in-out infinite\",\n opacity: isLoading ? 1 : 0,\n transition: \"opacity 300ms\",\n }}\n />\n </>\n )}\n\n {/* Image */}\n <img\n key={src}\n src={src}\n alt={alt}\n onLoad={() => setIsLoading(false)}\n onError={() => setIsLoading(false)}\n className={cn(\n \"h-full w-full object-cover transition-opacity duration-500\",\n isLoading ? \"opacity-0\" : \"opacity-100\",\n )}\n style={{\n height: \"100%\",\n width: \"100%\",\n objectFit: \"cover\",\n transition: \"opacity 500ms\",\n opacity: isLoading ? 0 : 1,\n }}\n {...props}\n />\n </div>\n </>\n );\n};\n","import React, { useMemo, useState, useRef, useEffect } from \"react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nimport {\n buildVideoUrl,\n type SlopVideoOptions,\n type VideoAspectRatio,\n} from \"@slopmachine/core\";\n\n// Utility for Tailwind classes\nfunction cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport interface SlopVideoProps\n extends\n Omit<React.VideoHTMLAttributes<HTMLVideoElement>, \"src\">,\n Omit<SlopVideoOptions, \"aspectRatio\"> {\n /**\n * The aspect ratio of the generated video. Defaults to \"16:9\".\n */\n aspectRatio?: VideoAspectRatio;\n /**\n * Custom React node to display while the video is loading.\n * If not provided, a default spinner and shimmer effect will be shown.\n */\n loader?: React.ReactNode;\n}\n\n/**\n * Renders a video generated by Slop Machine.\n *\n * This component automatically constructs the correct URL for the Slop Machine API,\n * displays a loading skeleton or custom loader while fetching, and handles errors.\n *\n * @example\n * ```tsx\n * <SlopVideo\n * bucketId=\"my-bucket\"\n * resultId=\"some-result\"\n * aspectRatio=\"16:9\"\n * className=\"rounded-lg\"\n * autoPlay\n * loop\n * muted\n * />\n * ```\n */\nexport const SlopVideo: React.FC<SlopVideoProps> = ({\n bucketId,\n className,\n aspectRatio = \"16:9\",\n version,\n resultId,\n model,\n variables = {},\n duration,\n baseUrl,\n loader,\n autoPlay = true,\n loop = true,\n muted = true,\n playsInline = true,\n ...props\n}) => {\n // Construct API URL\n const rawSrc = useMemo(\n () =>\n buildVideoUrl({\n bucketId,\n aspectRatio,\n version,\n resultId,\n variables,\n duration,\n baseUrl,\n model,\n }),\n [\n bucketId,\n aspectRatio,\n version,\n resultId,\n variables,\n duration,\n baseUrl,\n model,\n ],\n );\n\n const [src, setSrc] = useState(rawSrc);\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setSrc(rawSrc);\n }, 100);\n return () => clearTimeout(timer);\n }, [rawSrc]);\n\n const [isLoading, setIsLoading] = useState(true);\n const [currentSrc, setCurrentSrc] = useState(src);\n const videoRef = useRef<HTMLVideoElement>(null);\n\n if (src !== currentSrc) {\n setCurrentSrc(src);\n setIsLoading(true);\n }\n\n useEffect(() => {\n if (!src) return;\n\n fetch(src, { method: \"HEAD\" })\n .then(async (res) => {\n if (!res.ok) {\n try {\n const errRes = await fetch(src);\n const errJson = await errRes.json();\n console.error(\"SlopVideo error:\", res.status, errJson.error);\n } catch (e) {\n // Failed to fetch or parse error details\n }\n setIsLoading(false);\n }\n })\n .catch((err) => {\n console.error(`Error fetching video from ${src}:`, err);\n setIsLoading(false);\n });\n }, [src]);\n\n return (\n <>\n <style>{`\n @keyframes slop-shimmer {\n 0% {\n background-position: 200% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n }\n @keyframes slop-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n }\n `}</style>\n <div\n className={cn(\"relative overflow-hidden\", className)}\n style={{\n aspectRatio: String(aspectRatio).replace(\":\", \"/\"),\n backgroundColor: \"var(--muted, #f3f4f6)\",\n position: \"relative\",\n overflow: \"hidden\",\n }}\n >\n {/* Loading UI */}\n {loader ? (\n <div\n className={cn(\n \"absolute inset-0 z-10 flex items-center justify-center transition-opacity duration-300\",\n isLoading ? \"opacity-100\" : \"opacity-0 pointer-events-none\",\n )}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n zIndex: 10,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n opacity: isLoading ? 1 : 0,\n pointerEvents: isLoading ? \"auto\" : \"none\",\n transition: \"opacity 300ms ease-in-out\",\n }}\n >\n {loader}\n </div>\n ) : (\n <>\n {/* Loading overlay */}\n <div\n className={cn(\n \"absolute inset-0 z-10 flex items-center justify-center bg-muted transition-opacity duration-300\",\n isLoading ? \"opacity-100\" : \"opacity-0 pointer-events-none\",\n )}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n zIndex: 10,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: \"var(--muted, #f3f4f6)\",\n opacity: isLoading ? 1 : 0,\n pointerEvents: isLoading ? \"auto\" : \"none\",\n transition: \"opacity 300ms ease-in-out\",\n }}\n >\n <div\n className=\"flex flex-col items-center gap-2\"\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: \"0.5rem\",\n }}\n >\n <svg\n className=\"spinner size-6 text-muted-foreground\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n style={{\n width: \"24px\",\n height: \"24px\",\n color: \"var(--muted-foreground, #6b7280)\",\n animation: \"slop-spin 1s linear infinite\",\n }}\n >\n <circle\n className=\"opacity-25\"\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n stroke=\"currentColor\"\n strokeWidth=\"4\"\n style={{ opacity: 0.25 }}\n />\n <path\n className=\"opacity-75\"\n fill=\"currentColor\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n style={{ opacity: 0.75 }}\n />\n </svg>\n <span\n className=\"text-xs text-muted-foreground\"\n style={{\n fontSize: \"0.75rem\",\n color: \"var(--muted-foreground, #6b7280)\",\n }}\n >\n Loading...\n </span>\n </div>\n </div>\n\n {/* Shimmer effect underneath */}\n <div\n className={cn(\n \"shimmer-effect absolute inset-0 bg-gradient-to-r from-muted via-muted/50 to-muted\",\n isLoading ? \"opacity-100\" : \"opacity-0\",\n )}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n background:\n \"linear-gradient(90deg, var(--muted, #f3f4f6) 0%, var(--muted-foreground, #e5e7eb) 50%, var(--muted, #f3f4f6) 100%)\",\n backgroundSize: \"200% 100%\",\n animation: \"slop-shimmer 2s ease-in-out infinite\",\n opacity: isLoading ? 1 : 0,\n transition: \"opacity 300ms\",\n }}\n />\n </>\n )}\n\n {/* Video */}\n <video\n key={src}\n ref={videoRef}\n src={src}\n autoPlay={autoPlay}\n loop={loop}\n muted={muted}\n playsInline={playsInline}\n onLoadedData={() => setIsLoading(false)}\n onError={() => setIsLoading(false)}\n className={cn(\n \"h-full w-full object-cover transition-opacity duration-500\",\n isLoading ? \"opacity-0\" : \"opacity-100\",\n )}\n style={{\n height: \"100%\",\n width: \"100%\",\n objectFit: \"cover\",\n transition: \"opacity 500ms\",\n opacity: isLoading ? 0 : 1,\n }}\n {...props}\n />\n </div>\n </>\n );\n};\n"],"mappings":";AAAA,OAAO,SAAS,SAAS,gBAAgB;AACzC,SAAS,YAA6B;AACtC,SAAS,eAAe;AAExB;AAAA,EACE;AAAA,OAGK;AAiHD,SAoDI,UApDJ,KAoFU,YApFV;AA9GN,SAAS,MAAM,QAAsB;AACnC,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;AAmCO,IAAM,YAAsC,CAAC;AAAA,EAClD;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,CAAC;AAAA,EACb;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AAEJ,QAAM,SAAS;AAAA,IACb,MACE,cAAc;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,CAAC,UAAU,aAAa,SAAS,UAAU,WAAW,SAAS,KAAK;AAAA,EACtE;AAEA,QAAM,CAAC,KAAK,MAAM,IAAI,SAAS,MAAM;AAErC,QAAM,UAAU,MAAM;AACpB,UAAM,QAAQ,WAAW,MAAM;AAC7B,aAAO,MAAM;AAAA,IACf,GAAG,GAAG;AACN,WAAO,MAAM,aAAa,KAAK;AAAA,EACjC,GAAG,CAAC,MAAM,CAAC;AAEX,QAAM,MAAM;AAEZ,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,GAAG;AAEhD,MAAI,QAAQ,YAAY;AACtB,kBAAc,GAAG;AACjB,iBAAa,IAAI;AAAA,EACnB;AAEA,QAAM,UAAU,MAAM;AACpB,QAAI,CAAC,IAAK;AAEV,UAAM,KAAK,EAAE,QAAQ,OAAO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V,KAAK;AAAA,kBACL,MAAM;AAAA,kBACN,OAAO;AAAA,kBACP,QAAQ;AAAA,kBACR,YACE;AAAA,kBACF,gBAAgB;AAAA,kBAChB,WAAW;AAAA,kBACX,SAAS,YAAY,IAAI;AAAA,kBACzB,YAAY;AAAA,gBACd;AAAA;AAAA,YACF;AAAA,aACF;AAAA,UAIF,gBAAAF;AAAA,YAAC;AAAA;AAAA,cAEC,KAAK;AAAA,cACL;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA,cAAc,MAAM,aAAa,KAAK;AAAA,cACtC,SAAS,MAAM,aAAa,KAAK;AAAA,cACjC,WAAWE;AAAA,gBACT;AAAA,gBACA,YAAY,cAAc;AAAA,cAC5B;AAAA,cACA,OAAO;AAAA,gBACL,QAAQ;AAAA,gBACR,OAAO;AAAA,gBACP,WAAW;AAAA,gBACX,YAAY;AAAA,gBACZ,SAAS,YAAY,IAAI;AAAA,cAC3B;AAAA,cACC,GAAG;AAAA;AAAA,YApBC;AAAA,UAqBP;AAAA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":["useMemo","useState","clsx","twMerge","Fragment","jsx","jsxs","cn"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slopmachine/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "The official React SDK for Slop Machine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.mjs",
|
|
12
|
-
"require": "./dist/index.js"
|
|
12
|
+
"require": "./dist/index.js",
|
|
13
|
+
"default": "./dist/index.js"
|
|
13
14
|
}
|
|
14
15
|
},
|
|
15
16
|
"scripts": {
|