@axium/client 0.13.1 → 0.13.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/assets/styles.css +1 -2
- package/lib/Upload.svelte +27 -17
- package/package.json +1 -1
package/assets/styles.css
CHANGED
|
@@ -141,9 +141,8 @@ dialog form {
|
|
|
141
141
|
|
|
142
142
|
progress {
|
|
143
143
|
appearance: none;
|
|
144
|
-
border: none;
|
|
145
144
|
height: 0.5em;
|
|
146
|
-
border-radius:
|
|
145
|
+
border-radius: 0.5em;
|
|
147
146
|
overflow: hidden;
|
|
148
147
|
background-color: var(--bg-normal);
|
|
149
148
|
border: 1px solid var(--border-accent);
|
package/lib/Upload.svelte
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
name = 'files',
|
|
8
8
|
input = $bindable(),
|
|
9
9
|
files = $bindable(),
|
|
10
|
-
progress = $bindable(),
|
|
10
|
+
progress = $bindable([]),
|
|
11
11
|
...rest
|
|
12
12
|
}: HTMLInputAttributes & { input?: HTMLInputElement; progress?: [current: number, max: number][] } = $props();
|
|
13
13
|
|
|
@@ -18,23 +18,33 @@
|
|
|
18
18
|
<label for={id} class={[files?.length && 'file']}>
|
|
19
19
|
{#each files! as file, i}
|
|
20
20
|
<Icon i={forMime(file.type)} />
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
21
|
+
{#if !progress[i]}
|
|
22
|
+
<div class="name">
|
|
23
|
+
<span>{file.name}</span>
|
|
24
|
+
</div>
|
|
25
|
+
<button
|
|
26
|
+
onclick={e => {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
const dt = new DataTransfer();
|
|
29
|
+
for (let f of files!) if (file !== f) dt.items.add(f);
|
|
30
|
+
input!.files = files = dt.files;
|
|
31
|
+
}}
|
|
32
|
+
style:display="contents"
|
|
33
|
+
>
|
|
34
|
+
<Icon i="trash" />
|
|
35
|
+
</button>
|
|
36
|
+
{:else if progress[i][0] == progress[i][1]}
|
|
37
|
+
<div class="name">
|
|
38
|
+
<span>{file.name}</span>
|
|
39
|
+
</div>
|
|
40
|
+
<Icon i="cloud-check" />
|
|
41
|
+
{:else}
|
|
42
|
+
<div class="name">
|
|
43
|
+
<span>{file.name}</span>
|
|
24
44
|
<progress value={progress[i][0]} max={progress[i][1]}></progress>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
onclick={e => {
|
|
29
|
-
e.preventDefault();
|
|
30
|
-
const dt = new DataTransfer();
|
|
31
|
-
for (let f of files!) if (file !== f) dt.items.add(f);
|
|
32
|
-
input!.files = files = dt.files;
|
|
33
|
-
}}
|
|
34
|
-
style:display="contents"
|
|
35
|
-
>
|
|
36
|
-
<Icon i="trash" />
|
|
37
|
-
</button>
|
|
45
|
+
</div>
|
|
46
|
+
<Icon i="cloud-arrow-up" />
|
|
47
|
+
{/if}
|
|
38
48
|
{:else}
|
|
39
49
|
<Icon i="upload" /> Upload
|
|
40
50
|
{/each}
|