@axium/storage 0.5.1 → 0.5.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.
package/lib/List.svelte CHANGED
@@ -8,7 +8,7 @@
8
8
  let { items = $bindable([]), appMode }: { appMode?: boolean; items: StorageItemMetadata[] } = $props();
9
9
 
10
10
  let activeIndex = $state<number>(-1);
11
- let activeItem = $derived(items[activeIndex]);
11
+ let activeItem = $derived(activeIndex == -1 ? null : items[activeIndex]);
12
12
  const dialogs = $state<Record<string, HTMLDialogElement>>({});
13
13
  </script>
14
14
 
@@ -68,13 +68,13 @@
68
68
  bind:dialog={dialogs.rename}
69
69
  submitText="Rename"
70
70
  submit={async (data: { name: string }) => {
71
- await updateItemMetadata(activeItem.id, data);
72
- activeItem.name = data.name;
71
+ await updateItemMetadata(activeItem!.id, data);
72
+ activeItem!.name = data.name;
73
73
  }}
74
74
  >
75
75
  <div>
76
76
  <label for="name">Name</label>
77
- <input name="name" type="text" required value={activeItem.name} />
77
+ <input name="name" type="text" required value={activeItem?.name} />
78
78
  </div>
79
79
  </FormDialog>
80
80
  <FormDialog
@@ -82,7 +82,7 @@
82
82
  submitText="Trash"
83
83
  submitDanger
84
84
  submit={async () => {
85
- await updateItemMetadata(activeItem.id, { trash: true });
85
+ await updateItemMetadata(activeItem!.id, { trash: true });
86
86
  if (activeIndex != -1) items.splice(activeIndex, 1);
87
87
  }}
88
88
  >
@@ -92,14 +92,14 @@
92
92
  bind:dialog={dialogs.download}
93
93
  submitText="Download"
94
94
  submit={async () => {
95
- if (activeItem.type == 'inode/directory') {
96
- const children = await getDirectoryMetadata(activeItem.id);
95
+ if (activeItem!.type == 'inode/directory') {
96
+ const children = await getDirectoryMetadata(activeItem!.id);
97
97
  for (const child of children) open(child.dataURL, '_blank');
98
- } else open(activeItem.dataURL, '_blank');
98
+ } else open(activeItem!.dataURL, '_blank');
99
99
  }}
100
100
  >
101
101
  <p>
102
- We are not responsible for the contents of this {activeItem.type == 'inode/directory' ? 'folder' : 'file'}. <br />
102
+ We are not responsible for the contents of this {activeItem?.type == 'inode/directory' ? 'folder' : 'file'}. <br />
103
103
  Are you sure you want to download {@render _itemName()}?
104
104
  </p>
105
105
  </FormDialog>
package/lib/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../tsconfig.json",
2
+ "extends": ["../tsconfig.json", "../.svelte-kit/tsconfig.json"],
3
3
  "compilerOptions": {
4
4
  "rootDir": "..",
5
5
  "noEmit": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/storage",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "author": "James Prevett <axium@jamespre.dev> (https://jamespre.dev)",
5
5
  "description": "User file storage for Axium",
6
6
  "funding": {