@slopmachine/svelte 0.1.9 → 0.1.10
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 +1 -1
- package/src/SlopImage.svelte +38 -20
package/package.json
CHANGED
package/src/SlopImage.svelte
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { buildImageUrl, type SlopImageOptions } from "@slopmachine/core";
|
|
3
|
+
import type { Snippet } from "svelte";
|
|
3
4
|
|
|
4
5
|
interface Props extends SlopImageOptions {
|
|
5
6
|
class?: string;
|
|
7
|
+
loader?: Snippet;
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
let {
|
|
@@ -14,6 +16,7 @@
|
|
|
14
16
|
variables = {},
|
|
15
17
|
baseUrl = undefined,
|
|
16
18
|
class: className = "",
|
|
19
|
+
loader,
|
|
17
20
|
...restProps
|
|
18
21
|
}: Props = $props();
|
|
19
22
|
|
|
@@ -98,25 +101,36 @@
|
|
|
98
101
|
style="aspect-ratio: {aspectRatio.replace(':', '/')};"
|
|
99
102
|
>
|
|
100
103
|
{#if isLoading}
|
|
101
|
-
|
|
102
|
-
<div class="
|
|
103
|
-
|
|
104
|
-
class="spinner"
|
|
105
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
106
|
-
fill="none"
|
|
107
|
-
viewBox="0 0 24 24"
|
|
108
|
-
>
|
|
109
|
-
<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"
|
|
110
|
-
></circle>
|
|
111
|
-
<path
|
|
112
|
-
fill="currentColor"
|
|
113
|
-
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"
|
|
114
|
-
></path>
|
|
115
|
-
</svg>
|
|
116
|
-
<span>Loading...</span>
|
|
104
|
+
{#if loader}
|
|
105
|
+
<div class="custom-loader-wrapper">
|
|
106
|
+
{@render loader()}
|
|
117
107
|
</div>
|
|
118
|
-
|
|
119
|
-
|
|
108
|
+
{:else}
|
|
109
|
+
<div class="loading-overlay">
|
|
110
|
+
<div class="spinner-container">
|
|
111
|
+
<svg
|
|
112
|
+
class="spinner"
|
|
113
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
114
|
+
fill="none"
|
|
115
|
+
viewBox="0 0 24 24"
|
|
116
|
+
>
|
|
117
|
+
<circle
|
|
118
|
+
cx="12"
|
|
119
|
+
cy="12"
|
|
120
|
+
r="10"
|
|
121
|
+
stroke="currentColor"
|
|
122
|
+
stroke-width="4"
|
|
123
|
+
></circle>
|
|
124
|
+
<path
|
|
125
|
+
fill="currentColor"
|
|
126
|
+
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"
|
|
127
|
+
></path>
|
|
128
|
+
</svg>
|
|
129
|
+
<span>Loading...</span>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
<div class="shimmer-effect"></div>
|
|
133
|
+
{/if}
|
|
120
134
|
{/if}
|
|
121
135
|
|
|
122
136
|
<img
|
|
@@ -138,7 +152,8 @@
|
|
|
138
152
|
height: 100%;
|
|
139
153
|
}
|
|
140
154
|
|
|
141
|
-
.loading-overlay
|
|
155
|
+
.loading-overlay,
|
|
156
|
+
.custom-loader-wrapper {
|
|
142
157
|
position: absolute;
|
|
143
158
|
top: 0;
|
|
144
159
|
left: 0;
|
|
@@ -148,10 +163,13 @@
|
|
|
148
163
|
display: flex;
|
|
149
164
|
align-items: center;
|
|
150
165
|
justify-content: center;
|
|
151
|
-
background-color: var(--muted, #f3f4f6);
|
|
152
166
|
transition: opacity 300ms ease-in-out;
|
|
153
167
|
}
|
|
154
168
|
|
|
169
|
+
.loading-overlay {
|
|
170
|
+
background-color: var(--muted, #f3f4f6);
|
|
171
|
+
}
|
|
172
|
+
|
|
155
173
|
.spinner-container {
|
|
156
174
|
display: flex;
|
|
157
175
|
flex-direction: column;
|