@axium/storage 0.7.7 → 0.7.8

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/plugin.d.ts CHANGED
@@ -58,5 +58,10 @@ declare const _default: {
58
58
  blakejs: string;
59
59
  zod: string;
60
60
  };
61
+ apps: {
62
+ id: string;
63
+ name: string;
64
+ icon: string;
65
+ }[];
61
66
  };
62
67
  export default _default;
package/dist/plugin.js CHANGED
@@ -7,7 +7,6 @@ import { sql } from 'kysely';
7
7
  import pkg from '../package.json' with { type: 'json' };
8
8
  import './common.js';
9
9
  import './server.js';
10
- import { addApp } from '@axium/server/apps';
11
10
  async function statusText() {
12
11
  const { storage: items } = await count('storage');
13
12
  const { size } = await database
@@ -61,12 +60,6 @@ async function clean(opt) {
61
60
  .executeTakeFirstOrThrow()
62
61
  .then(done);
63
62
  }
64
- addApp({
65
- id: 'files',
66
- name: 'Files',
67
- version: pkg.version,
68
- icon: 'folders',
69
- });
70
63
  export default {
71
64
  ...pkg,
72
65
  statusText,
package/lib/List.svelte CHANGED
@@ -1,7 +1,8 @@
1
1
  <script lang="ts">
2
+ import { goto } from '$app/navigation';
3
+ import { FormDialog, Icon } from '@axium/client/components';
2
4
  import { formatBytes } from '@axium/core/format';
3
5
  import { forMime as iconForMime } from '@axium/core/icons';
4
- import { FormDialog, Icon } from '@axium/client/components';
5
6
  import { getDirectoryMetadata, updateItemMetadata } from '@axium/storage/client';
6
7
  import type { StorageItemMetadata } from '@axium/storage/common';
7
8
  import '../styles/list.css';
@@ -39,18 +40,6 @@
39
40
  {/if}
40
41
  {/snippet}
41
42
 
42
- {#snippet _item(item: StorageItemMetadata, i: number)}
43
- <div class="list-item">
44
- <dfn title={item.type}><Icon i={iconForMime(item.type)} /></dfn>
45
- <span class="name">{item.name}</span>
46
- <span>{item.modifiedAt.toLocaleString()}</span>
47
- <span>{item.type == 'inode/directory' ? '—' : formatBytes(item.size)}</span>
48
- {@render action('rename', 'pencil', i)}
49
- {@render action('download', 'download', i)}
50
- {@render action('trash', 'trash', i)}
51
- </div>
52
- {/snippet}
53
-
54
43
  <div class="list">
55
44
  <div class="list-item list-header">
56
45
  <span></span>
@@ -59,11 +48,23 @@
59
48
  <span>Size</span>
60
49
  </div>
61
50
  {#each items as item, i (item.id)}
62
- {#if item.type == 'inode/directory' && appMode}
63
- <a class="list-item-container" href="/files/{item.id}">{@render _item(item, i)}</a>
64
- {:else}
65
- {@render _item(item, i)}
66
- {/if}
51
+ <div
52
+ class="list-item"
53
+ onclick={async () => {
54
+ if (item.type != 'inode/directory') {
55
+ // @todo get preview
56
+ } else if (appMode) goto('/files/' + item.id);
57
+ else items = await getDirectoryMetadata(item.id);
58
+ }}
59
+ >
60
+ <dfn title={item.type}><Icon i={iconForMime(item.type)} /></dfn>
61
+ <span class="name">{item.name}</span>
62
+ <span>{item.modifiedAt.toLocaleString()}</span>
63
+ <span>{item.type == 'inode/directory' ? '—' : formatBytes(item.size)}</span>
64
+ {@render action('rename', 'pencil', i)}
65
+ {@render action('download', 'download', i)}
66
+ {@render action('trash', 'trash', i)}
67
+ </div>
67
68
  {:else}
68
69
  <p class="list-empty">{emptyText}</p>
69
70
  {/each}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/storage",
3
- "version": "0.7.7",
3
+ "version": "0.7.8",
4
4
  "author": "James Prevett <axium@jamespre.dev> (https://jamespre.dev)",
5
5
  "description": "User file storage for Axium",
6
6
  "funding": {
@@ -39,13 +39,20 @@
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@axium/client": ">=0.4.4",
42
- "@axium/core": ">=0.6.0",
43
- "@axium/server": ">=0.22.5",
42
+ "@axium/core": ">=0.7.0",
43
+ "@axium/server": ">=0.23.0",
44
44
  "@sveltejs/kit": "^2.27.3",
45
45
  "utilium": "^2.3.8"
46
46
  },
47
47
  "dependencies": {
48
48
  "blakejs": "^1.2.1",
49
49
  "zod": "^4.0.5"
50
- }
50
+ },
51
+ "apps": [
52
+ {
53
+ "id": "files",
54
+ "name": "Files",
55
+ "icon": "folders"
56
+ }
57
+ ]
51
58
  }
package/styles/list.css CHANGED
@@ -30,6 +30,7 @@
30
30
 
31
31
  .list-item:not(.list-header):hover {
32
32
  background-color: var(--bg-alt);
33
+ cursor: pointer;
33
34
  }
34
35
 
35
36
  p.list-empty {