@axium/storage 0.4.1 → 0.4.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/server.js +1 -7
- package/lib/StorageSidebarItem.svelte +27 -5
- package/lib/sidebar.svelte.ts +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -139,13 +139,7 @@ addRoute({
|
|
|
139
139
|
.catch(withError('Could not delete item'));
|
|
140
140
|
if (item.type == 'inode/directory')
|
|
141
141
|
return item;
|
|
142
|
-
|
|
143
|
-
.selectFrom('storage')
|
|
144
|
-
.where('hash', '=', Uint8Array.fromHex(item.hash))
|
|
145
|
-
.select(eb => eb.fn.countAll().as('count'))
|
|
146
|
-
.executeTakeFirstOrThrow();
|
|
147
|
-
if (!Number(count))
|
|
148
|
-
unlinkSync(join(config.storage.data, item.hash));
|
|
142
|
+
unlinkSync(join(config.storage.data, item.id));
|
|
149
143
|
return item;
|
|
150
144
|
},
|
|
151
145
|
});
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { ClipboardCopy, FormDialog, Icon } from '@axium/server/components';
|
|
4
4
|
import { deleteItem, updateItemMetadata } from '@axium/storage/client';
|
|
5
5
|
import type { StorageItemMetadata } from '@axium/storage/common';
|
|
6
|
-
import StorageSidebarItem from './StorageSidebarItem.svelte';
|
|
7
6
|
import { debug, getDirectory, selection, toggle, toggleRange } from '@axium/storage/sidebar';
|
|
7
|
+
import StorageSidebarItem from './StorageSidebarItem.svelte';
|
|
8
8
|
|
|
9
9
|
let {
|
|
10
10
|
item = $bindable(),
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
function oncontextmenu(e: MouseEvent) {
|
|
22
22
|
e.preventDefault();
|
|
23
23
|
e.stopPropagation();
|
|
24
|
-
popover
|
|
24
|
+
popover!.togglePopover();
|
|
25
|
+
_forcePopover = true;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
function onclick(e: MouseEvent) {
|
|
@@ -29,10 +30,24 @@
|
|
|
29
30
|
else if (e.ctrlKey) toggle(item.id);
|
|
30
31
|
else {
|
|
31
32
|
selection.clear();
|
|
32
|
-
|
|
33
|
+
toggle(item.id);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
let _forcePopover = false;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Workaround for https://github.com/whatwg/html/issues/10905
|
|
41
|
+
* @todo Remove when the problem is fixed.
|
|
42
|
+
*/
|
|
43
|
+
function onpointerup(e: PointerEvent) {
|
|
44
|
+
if (!_forcePopover) return;
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
popover!.togglePopover();
|
|
48
|
+
_forcePopover = false;
|
|
49
|
+
}
|
|
50
|
+
|
|
36
51
|
let children = $state<StorageItemMetadata[]>([]);
|
|
37
52
|
</script>
|
|
38
53
|
|
|
@@ -43,6 +58,7 @@
|
|
|
43
58
|
e.preventDefault();
|
|
44
59
|
dialogs[name].showModal();
|
|
45
60
|
}}
|
|
61
|
+
class="action"
|
|
46
62
|
>
|
|
47
63
|
<Icon {i} --size="14px" />
|
|
48
64
|
{text}
|
|
@@ -59,7 +75,7 @@
|
|
|
59
75
|
|
|
60
76
|
{#if item.type == 'inode/directory'}
|
|
61
77
|
<details>
|
|
62
|
-
<summary class={['StorageSidebarItem', selection.has(item.id) && 'selected']} {onclick} {oncontextmenu}>
|
|
78
|
+
<summary class={['StorageSidebarItem', selection.has(item.id) && 'selected']} {onclick} {oncontextmenu} {onpointerup}>
|
|
63
79
|
<Icon i={icon.forMime(item.type)} />
|
|
64
80
|
<span class="name">{item.name}</span>
|
|
65
81
|
</summary>
|
|
@@ -76,7 +92,7 @@
|
|
|
76
92
|
</div>
|
|
77
93
|
</details>
|
|
78
94
|
{:else}
|
|
79
|
-
<div class={['StorageSidebarItem', selection.has(item.id) && 'selected']} {onclick} {oncontextmenu}>
|
|
95
|
+
<div class={['StorageSidebarItem', selection.has(item.id) && 'selected']} {onclick} {oncontextmenu} {onpointerup}>
|
|
80
96
|
<Icon i={icon.forMime(item.type)} />
|
|
81
97
|
<span class="name">{item.name}</span>
|
|
82
98
|
</div>
|
|
@@ -163,4 +179,10 @@
|
|
|
163
179
|
details > div {
|
|
164
180
|
padding-left: 0.5em;
|
|
165
181
|
}
|
|
182
|
+
|
|
183
|
+
div.action:hover {
|
|
184
|
+
cursor: pointer;
|
|
185
|
+
background-color: #223;
|
|
186
|
+
border-radius: 0.25em;
|
|
187
|
+
}
|
|
166
188
|
</style>
|
package/lib/sidebar.svelte.ts
CHANGED