@axium/storage 0.25.0 → 0.25.1
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/common.d.ts +2 -2
- package/dist/common.js +2 -2
- package/lib/List.svelte +2 -2
- package/package.json +1 -1
- package/routes/files/settings/+page.svelte +4 -2
package/dist/common.d.ts
CHANGED
|
@@ -154,12 +154,12 @@ export declare const UserStorageOptions: z.ZodDefault<z.ZodObject<{
|
|
|
154
154
|
}, z.core.$strip>>;
|
|
155
155
|
export interface UserStorageOptions extends z.infer<typeof UserStorageOptions> {
|
|
156
156
|
}
|
|
157
|
-
export declare const
|
|
157
|
+
export declare const StoragePreferences: z.ZodObject<{
|
|
158
158
|
sort_folders_first: z.ZodDefault<z.ZodBoolean>;
|
|
159
159
|
}, z.core.$strip>;
|
|
160
160
|
declare module '@axium/core/apps' {
|
|
161
161
|
interface $AppPreferences {
|
|
162
|
-
files: typeof
|
|
162
|
+
files: typeof StoragePreferences;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
/**
|
package/dist/common.js
CHANGED
|
@@ -69,12 +69,12 @@ export const UserStorageOptions = z
|
|
|
69
69
|
})
|
|
70
70
|
.partial()
|
|
71
71
|
.default({});
|
|
72
|
-
export const
|
|
72
|
+
export const StoragePreferences = z
|
|
73
73
|
.object({
|
|
74
74
|
sort_folders_first: z.boolean().default(true),
|
|
75
75
|
})
|
|
76
76
|
.register(zKeys, { prefix: 'storage.preferences' });
|
|
77
|
-
appPreferences.set('files',
|
|
77
|
+
appPreferences.set('files', StoragePreferences);
|
|
78
78
|
/**
|
|
79
79
|
* Formats:
|
|
80
80
|
*
|
package/lib/List.svelte
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { forMime as iconForMime } from '@axium/core/icons';
|
|
11
11
|
import { getDirectoryMetadata, updateItemMetadata } from '@axium/storage/client';
|
|
12
12
|
import { _downloadItem, copyShortURL } from '@axium/storage/client/frontend';
|
|
13
|
-
import { StorageItemSorting,
|
|
13
|
+
import { StorageItemSorting, StoragePreferences, type StorageItemMetadata } from '@axium/storage/common';
|
|
14
14
|
import Preview from './Preview.svelte';
|
|
15
15
|
|
|
16
16
|
const search = new URLSearchParams(location.search);
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
const activeItem = $derived(items.find(item => item.id === activeId));
|
|
39
39
|
const dialogs = $state<Record<string, HTMLDialogElement>>({});
|
|
40
40
|
|
|
41
|
-
const { sort_folders_first } = user ? await getAppPreferences(user.id, 'files') :
|
|
41
|
+
const { sort_folders_first } = user ? await getAppPreferences(user.id, 'files') : StoragePreferences.safeParse({}).data || {};
|
|
42
42
|
|
|
43
43
|
const sortedItems = $derived(
|
|
44
44
|
items.toSorted((_a, _b) => {
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { text } from '@axium/client';
|
|
3
3
|
import { AppPreferences } from '@axium/client/components';
|
|
4
|
-
import {
|
|
4
|
+
import { StoragePreferences } from '@axium/storage/common';
|
|
5
5
|
|
|
6
6
|
const { data } = $props();
|
|
7
|
+
|
|
8
|
+
if (!data.session) location.href = '/login?after=/files/settings';
|
|
7
9
|
</script>
|
|
8
10
|
|
|
9
11
|
<svelte:head>
|
|
10
12
|
<title>{text('page.files.settings.title')}</title>
|
|
11
13
|
</svelte:head>
|
|
12
14
|
|
|
13
|
-
<AppPreferences userId={data.session
|
|
15
|
+
<AppPreferences userId={data.session!.userId} appId="files" schema={StoragePreferences} />
|