@slopmachine/svelte 0.1.24 → 0.1.26
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 +2 -2
- package/src/SlopImage.svelte +12 -5
- package/src/SlopText.svelte +4 -1
- package/src/SlopVideo.svelte +11 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slopmachine/svelte",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"llms": "https://docs.slopmachine.dev/llms.txt",
|
|
5
5
|
"llmsFull": "https://docs.slopmachine.dev/llms-full.txt",
|
|
6
6
|
"description": "The official Svelte SDK for Slop Machine",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"url": "git+https://github.com/slopmachine-dev/slopmachine-sdk.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@slopmachine/core": "^0.1.
|
|
22
|
+
"@slopmachine/core": "^0.1.25",
|
|
23
23
|
"@types/marked": "^5.0.2",
|
|
24
24
|
"marked": "^17.0.4"
|
|
25
25
|
},
|
package/src/SlopImage.svelte
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
/>
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
@version 0.1.
|
|
18
|
+
@version 0.1.26
|
|
19
19
|
-->
|
|
20
20
|
<script lang="ts">
|
|
21
21
|
import {
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
* Additional CSS classes to apply directly to the `<img />` element.
|
|
51
51
|
*/
|
|
52
52
|
imageClass?: string;
|
|
53
|
+
[key: string]: any;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
let {
|
|
@@ -61,10 +62,13 @@
|
|
|
61
62
|
variables = {},
|
|
62
63
|
baseUrl = undefined,
|
|
63
64
|
original = false,
|
|
65
|
+
attachments = undefined,
|
|
64
66
|
class: className = "",
|
|
65
67
|
objectFit = "cover",
|
|
66
68
|
imageClass = "",
|
|
67
69
|
loader,
|
|
70
|
+
onload,
|
|
71
|
+
onerror,
|
|
68
72
|
...restProps
|
|
69
73
|
}: SlopImageProps = $props();
|
|
70
74
|
|
|
@@ -80,6 +84,7 @@
|
|
|
80
84
|
baseUrl,
|
|
81
85
|
quality,
|
|
82
86
|
original,
|
|
87
|
+
attachments,
|
|
83
88
|
}),
|
|
84
89
|
);
|
|
85
90
|
let src = $state("");
|
|
@@ -140,12 +145,14 @@
|
|
|
140
145
|
}
|
|
141
146
|
});
|
|
142
147
|
|
|
143
|
-
function handleLoad() {
|
|
148
|
+
function handleLoad(e: Event) {
|
|
144
149
|
isLoading = false;
|
|
150
|
+
onload?.(e);
|
|
145
151
|
}
|
|
146
152
|
|
|
147
|
-
function handleError() {
|
|
153
|
+
function handleError(e: Event) {
|
|
148
154
|
isLoading = false;
|
|
155
|
+
onerror?.(e);
|
|
149
156
|
}
|
|
150
157
|
</script>
|
|
151
158
|
|
|
@@ -191,10 +198,10 @@
|
|
|
191
198
|
{src}
|
|
192
199
|
{alt}
|
|
193
200
|
style="object-fit: {objectFit};"
|
|
194
|
-
onload={handleLoad}
|
|
195
|
-
onerror={handleError}
|
|
196
201
|
class="slop-image {imageClass} {isLoading ? '' : 'loaded'}"
|
|
197
202
|
{...restProps}
|
|
203
|
+
onload={handleLoad}
|
|
204
|
+
onerror={handleError}
|
|
198
205
|
/>
|
|
199
206
|
</div>
|
|
200
207
|
</div>
|
package/src/SlopText.svelte
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* </SlopText>
|
|
24
24
|
* ```
|
|
25
25
|
*
|
|
26
|
-
* @version 0.1.
|
|
26
|
+
* @version 0.1.26
|
|
27
27
|
*/
|
|
28
28
|
interface Props {
|
|
29
29
|
// SlopTextOptions
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
model?: string | undefined;
|
|
34
34
|
variables?: Record<string, string | number | undefined | null> | undefined;
|
|
35
35
|
baseUrl?: string | undefined;
|
|
36
|
+
attachments?: string[] | undefined;
|
|
36
37
|
errorFallback?: import("svelte").Snippet<[any]>;
|
|
37
38
|
fallback?: import("svelte").Snippet;
|
|
38
39
|
class?: string;
|
|
@@ -47,6 +48,7 @@
|
|
|
47
48
|
model = undefined,
|
|
48
49
|
variables = undefined,
|
|
49
50
|
baseUrl = undefined,
|
|
51
|
+
attachments = undefined,
|
|
50
52
|
errorFallback,
|
|
51
53
|
fallback,
|
|
52
54
|
class: className = "",
|
|
@@ -72,6 +74,7 @@
|
|
|
72
74
|
resultId,
|
|
73
75
|
variables,
|
|
74
76
|
baseUrl,
|
|
77
|
+
attachments,
|
|
75
78
|
});
|
|
76
79
|
|
|
77
80
|
const response = await fetch(url);
|
package/src/SlopVideo.svelte
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
/>
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
@version 0.1.
|
|
21
|
+
@version 0.1.26
|
|
22
22
|
-->
|
|
23
23
|
<script lang="ts">
|
|
24
24
|
import {
|
|
@@ -63,12 +63,15 @@
|
|
|
63
63
|
duration,
|
|
64
64
|
baseUrl = undefined,
|
|
65
65
|
original = false,
|
|
66
|
+
attachments = undefined,
|
|
66
67
|
class: className = "",
|
|
67
68
|
loader,
|
|
68
69
|
autoplay = true,
|
|
69
70
|
loop = true,
|
|
70
71
|
muted = true,
|
|
71
72
|
playsinline = true,
|
|
73
|
+
onloadeddata,
|
|
74
|
+
onerror,
|
|
72
75
|
...restProps
|
|
73
76
|
}: SlopVideoProps = $props();
|
|
74
77
|
|
|
@@ -85,6 +88,7 @@
|
|
|
85
88
|
baseUrl,
|
|
86
89
|
quality,
|
|
87
90
|
original,
|
|
91
|
+
attachments,
|
|
88
92
|
}),
|
|
89
93
|
);
|
|
90
94
|
let src = $state("");
|
|
@@ -144,12 +148,14 @@
|
|
|
144
148
|
}
|
|
145
149
|
});
|
|
146
150
|
|
|
147
|
-
function handleLoadedData() {
|
|
151
|
+
function handleLoadedData(e: Event) {
|
|
148
152
|
isLoading = false;
|
|
153
|
+
onloadeddata?.(e);
|
|
149
154
|
}
|
|
150
155
|
|
|
151
|
-
function handleError() {
|
|
156
|
+
function handleError(e: Event) {
|
|
152
157
|
isLoading = false;
|
|
158
|
+
onerror?.(e);
|
|
153
159
|
}
|
|
154
160
|
</script>
|
|
155
161
|
|
|
@@ -198,10 +204,10 @@
|
|
|
198
204
|
{loop}
|
|
199
205
|
{muted}
|
|
200
206
|
{playsinline}
|
|
201
|
-
onloadeddata={handleLoadedData}
|
|
202
|
-
onerror={handleError}
|
|
203
207
|
class:loaded={!isLoading}
|
|
204
208
|
{...restProps}
|
|
209
|
+
onloadeddata={handleLoadedData}
|
|
210
|
+
onerror={handleError}
|
|
205
211
|
></video>
|
|
206
212
|
</div>
|
|
207
213
|
</div>
|