@axium/notes 0.4.3 → 0.4.5
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 +18 -6
- package/lib/Note.svelte +1 -1
- package/lib/tsconfig.json +1 -1
- package/package.json +6 -5
- package/routes/notes/+layout.ts +7 -0
- package/routes/notes/+page.svelte +7 -2
- package/routes/tsconfig.json +1 -1
- package/dist/web_hook.d.ts +0 -8
- package/dist/web_hook.js +0 -4
package/dist/common.d.ts
CHANGED
|
@@ -24,10 +24,12 @@ export declare const Note: z.ZodObject<{
|
|
|
24
24
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
25
25
|
id: z.ZodUUID;
|
|
26
26
|
name: z.ZodString;
|
|
27
|
-
|
|
27
|
+
username: z.ZodString;
|
|
28
|
+
email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEmail>>>;
|
|
28
29
|
emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
|
|
29
30
|
preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
|
|
30
31
|
debug: z.ZodDefault<z.ZodBoolean>;
|
|
32
|
+
theme: z.ZodDefault<z.ZodLiteral<"default" | "light" | "forest" | "midnight" | "beach" | "cherry" | "volcano">>;
|
|
31
33
|
}, z.core.$strip>>>;
|
|
32
34
|
roles: z.ZodArray<z.ZodString>;
|
|
33
35
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -59,10 +61,12 @@ declare const NotesAPI: {
|
|
|
59
61
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
60
62
|
id: z.ZodUUID;
|
|
61
63
|
name: z.ZodString;
|
|
62
|
-
|
|
64
|
+
username: z.ZodString;
|
|
65
|
+
email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEmail>>>;
|
|
63
66
|
emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
|
|
64
67
|
preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
|
|
65
68
|
debug: z.ZodDefault<z.ZodBoolean>;
|
|
69
|
+
theme: z.ZodDefault<z.ZodLiteral<"default" | "light" | "forest" | "midnight" | "beach" | "cherry" | "volcano">>;
|
|
66
70
|
}, z.core.$strip>>>;
|
|
67
71
|
roles: z.ZodArray<z.ZodString>;
|
|
68
72
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -95,10 +99,12 @@ declare const NotesAPI: {
|
|
|
95
99
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
96
100
|
id: z.ZodUUID;
|
|
97
101
|
name: z.ZodString;
|
|
98
|
-
|
|
102
|
+
username: z.ZodString;
|
|
103
|
+
email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEmail>>>;
|
|
99
104
|
emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
|
|
100
105
|
preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
|
|
101
106
|
debug: z.ZodDefault<z.ZodBoolean>;
|
|
107
|
+
theme: z.ZodDefault<z.ZodLiteral<"default" | "light" | "forest" | "midnight" | "beach" | "cherry" | "volcano">>;
|
|
102
108
|
}, z.core.$strip>>>;
|
|
103
109
|
roles: z.ZodArray<z.ZodString>;
|
|
104
110
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -128,10 +134,12 @@ declare const NotesAPI: {
|
|
|
128
134
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
129
135
|
id: z.ZodUUID;
|
|
130
136
|
name: z.ZodString;
|
|
131
|
-
|
|
137
|
+
username: z.ZodString;
|
|
138
|
+
email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEmail>>>;
|
|
132
139
|
emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
|
|
133
140
|
preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
|
|
134
141
|
debug: z.ZodDefault<z.ZodBoolean>;
|
|
142
|
+
theme: z.ZodDefault<z.ZodLiteral<"default" | "light" | "forest" | "midnight" | "beach" | "cherry" | "volcano">>;
|
|
135
143
|
}, z.core.$strip>>>;
|
|
136
144
|
roles: z.ZodArray<z.ZodString>;
|
|
137
145
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -164,10 +172,12 @@ declare const NotesAPI: {
|
|
|
164
172
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
165
173
|
id: z.ZodUUID;
|
|
166
174
|
name: z.ZodString;
|
|
167
|
-
|
|
175
|
+
username: z.ZodString;
|
|
176
|
+
email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEmail>>>;
|
|
168
177
|
emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
|
|
169
178
|
preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
|
|
170
179
|
debug: z.ZodDefault<z.ZodBoolean>;
|
|
180
|
+
theme: z.ZodDefault<z.ZodLiteral<"default" | "light" | "forest" | "midnight" | "beach" | "cherry" | "volcano">>;
|
|
171
181
|
}, z.core.$strip>>>;
|
|
172
182
|
roles: z.ZodArray<z.ZodString>;
|
|
173
183
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -195,10 +205,12 @@ declare const NotesAPI: {
|
|
|
195
205
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
196
206
|
id: z.ZodUUID;
|
|
197
207
|
name: z.ZodString;
|
|
198
|
-
|
|
208
|
+
username: z.ZodString;
|
|
209
|
+
email: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEmail>>>;
|
|
199
210
|
emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
|
|
200
211
|
preferences: z.ZodOptional<z.ZodLazy<z.ZodObject<{
|
|
201
212
|
debug: z.ZodDefault<z.ZodBoolean>;
|
|
213
|
+
theme: z.ZodDefault<z.ZodLiteral<"default" | "light" | "forest" | "midnight" | "beach" | "cherry" | "volcano">>;
|
|
202
214
|
}, z.core.$strip>>>;
|
|
203
215
|
roles: z.ZodArray<z.ZodString>;
|
|
204
216
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
package/lib/Note.svelte
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { fetchAPI, text } from '@axium/client';
|
|
5
5
|
import { dynamicRows } from '@axium/client/attachments';
|
|
6
6
|
import { AccessControlDialog, Icon, Popover } from '@axium/client/components';
|
|
7
|
-
import { copy } from '@axium/client/
|
|
7
|
+
import { copy } from '@axium/client/web';
|
|
8
8
|
import { toastStatus } from '@axium/client/toast';
|
|
9
9
|
import { checkAndMatchACL, type UserPublic } from '@axium/core';
|
|
10
10
|
import type { Note } from '@axium/notes/common';
|
package/lib/tsconfig.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/notes",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"author": "James Prevett <axium@jamespre.dev>",
|
|
5
5
|
"description": "Notes for Axium",
|
|
6
6
|
"funding": {
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"build": "tsc"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@axium/client": ">=0.
|
|
40
|
-
"@axium/core": ">=0.
|
|
41
|
-
"@axium/server": ">=0.
|
|
39
|
+
"@axium/client": ">=0.37.0",
|
|
40
|
+
"@axium/core": ">=0.39.0",
|
|
41
|
+
"@axium/server": ">=0.55.0",
|
|
42
42
|
"@sveltejs/kit": "^2.27.3",
|
|
43
43
|
"utilium": "^3.0.0"
|
|
44
44
|
},
|
|
@@ -46,11 +46,12 @@
|
|
|
46
46
|
"zod": "^4.0.5"
|
|
47
47
|
},
|
|
48
48
|
"axium": {
|
|
49
|
+
"locales": "locales",
|
|
49
50
|
"server": {
|
|
50
51
|
"routes": "routes",
|
|
51
52
|
"hooks": "./dist/hooks.js",
|
|
52
53
|
"db": "./db.json",
|
|
53
|
-
"web_client_hooks": "./dist/
|
|
54
|
+
"web_client_hooks": "./dist/common.js"
|
|
54
55
|
},
|
|
55
56
|
"apps": [
|
|
56
57
|
{
|
package/routes/notes/+layout.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
import { connect } from '@axium/client/socket';
|
|
2
|
+
import { schemas } from '@axium/client/sync';
|
|
1
3
|
import { getCurrentSession } from '@axium/client/user';
|
|
2
4
|
import type { Session, UserPublic } from '@axium/core';
|
|
5
|
+
import { Note } from '@axium/notes/common';
|
|
6
|
+
|
|
7
|
+
schemas.set('notes', Note);
|
|
3
8
|
|
|
4
9
|
export async function load({ parent }) {
|
|
5
10
|
let { session }: { session?: (Session & { user: UserPublic }) | null } = await parent();
|
|
6
11
|
|
|
7
12
|
session ||= await getCurrentSession().catch(() => null);
|
|
8
13
|
|
|
14
|
+
if (session) await connect().catch(() => null);
|
|
15
|
+
|
|
9
16
|
return { session };
|
|
10
17
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { fetchAPI, text } from '@axium/client';
|
|
3
3
|
import { Icon } from '@axium/client/components';
|
|
4
|
+
import { syncObjects } from '@axium/client/reactive';
|
|
4
5
|
import { toast } from '@axium/client/toast';
|
|
5
6
|
import { Note } from '@axium/notes/components';
|
|
6
7
|
|
|
@@ -8,10 +9,14 @@
|
|
|
8
9
|
|
|
9
10
|
let notes = $state(data.notes);
|
|
10
11
|
$effect(() => {
|
|
11
|
-
notes.sort((a, b) =>
|
|
12
|
+
notes.sort((a, b) => +b.pinned - +a.pinned);
|
|
12
13
|
});
|
|
14
|
+
|
|
15
|
+
const onfocusout = syncObjects(notes, 'notes');
|
|
13
16
|
</script>
|
|
14
17
|
|
|
18
|
+
<svelte:window {onfocusout} />
|
|
19
|
+
|
|
15
20
|
<svelte:head>
|
|
16
21
|
<title>{text('app_name.notes')}</title>
|
|
17
22
|
</svelte:head>
|
|
@@ -24,7 +29,7 @@
|
|
|
24
29
|
onclick={async () => {
|
|
25
30
|
try {
|
|
26
31
|
const result = await fetchAPI('PUT', 'users/:id/notes', { title: '' }, data.session.userId);
|
|
27
|
-
notes.
|
|
32
|
+
notes.unshift(result);
|
|
28
33
|
} catch (e) {
|
|
29
34
|
toast('error', e);
|
|
30
35
|
}
|
package/routes/tsconfig.json
CHANGED
package/dist/web_hook.d.ts
DELETED
package/dist/web_hook.js
DELETED