@axium/storage 0.4.1 → 0.4.2

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.
@@ -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?.togglePopover();
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
- selection.add(item.id);
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>
@@ -8,7 +8,7 @@ export const items = $state<StorageItemMetadata[]>([]);
8
8
 
9
9
  let lastSelected = $state<string>();
10
10
 
11
- export function getLastedSelected() {
11
+ export function getLastSelected() {
12
12
  return lastSelected;
13
13
  }
14
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/storage",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "author": "James Prevett <axium@jamespre.dev> (https://jamespre.dev)",
5
5
  "description": "User file storage for Axium",
6
6
  "funding": {