@axium/tasks 0.4.10 → 0.4.12
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 +1 -1
- package/dist/common.js +1 -1
- package/lib/TaskList.svelte +27 -19
- package/locales/en.json +5 -1
- package/package.json +3 -3
- package/routes/tasks/+layout.ts +2 -2
- package/routes/tasks/+page.svelte +1 -1
- package/routes/tasks/[id]/+page.svelte +1 -1
package/dist/common.d.ts
CHANGED
|
@@ -128,7 +128,7 @@ declare const TasksAPI: {
|
|
|
128
128
|
}, z.core.$strip>];
|
|
129
129
|
readonly POST: readonly [z.ZodObject<{
|
|
130
130
|
all_completed: z.ZodOptional<z.ZodBoolean>;
|
|
131
|
-
}, z.core.$strip>,
|
|
131
|
+
}, z.core.$strip>, z.ZodUnknown];
|
|
132
132
|
readonly PUT: readonly [z.ZodObject<{
|
|
133
133
|
summary: z.ZodOptional<z.ZodString>;
|
|
134
134
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
package/dist/common.js
CHANGED
|
@@ -33,7 +33,7 @@ const TasksAPI = {
|
|
|
33
33
|
'task_lists/:id': {
|
|
34
34
|
GET: TaskList.required({ tasks: true }),
|
|
35
35
|
PATCH: [TaskListInit, TaskList],
|
|
36
|
-
POST: [TaskListUpdate,
|
|
36
|
+
POST: [TaskListUpdate, z.unknown()],
|
|
37
37
|
PUT: [TaskInit.omit({ listId: true }), Task],
|
|
38
38
|
DELETE: TaskList,
|
|
39
39
|
},
|
package/lib/TaskList.svelte
CHANGED
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
import { goto } from '$app/navigation';
|
|
3
3
|
import { page } from '$app/state';
|
|
4
4
|
import { copy } from '@axium/client/gui';
|
|
5
|
+
import type { UserPublic } from '@axium/core';
|
|
5
6
|
import { AccessControlDialog, Icon, Popover } from '@axium/client/components';
|
|
6
7
|
import { fetchAPI, text } from '@axium/client';
|
|
7
8
|
import type { Task, TaskList } from '@axium/tasks/common';
|
|
8
9
|
import type { WithRequired } from 'utilium';
|
|
9
10
|
import { download } from 'utilium/dom.js';
|
|
11
|
+
import { toastStatus } from '@axium/client/toast';
|
|
10
12
|
|
|
11
|
-
let {
|
|
12
|
-
$
|
|
13
|
+
let {
|
|
14
|
+
list = $bindable(),
|
|
15
|
+
lists = $bindable(),
|
|
16
|
+
user,
|
|
17
|
+
}: { list: WithRequired<TaskList, 'tasks'>; lists?: WithRequired<TaskList, 'tasks'>[]; user?: UserPublic } = $props();
|
|
13
18
|
|
|
14
19
|
let tasks = $state(list.tasks);
|
|
15
20
|
|
|
@@ -56,9 +61,12 @@
|
|
|
56
61
|
<div
|
|
57
62
|
class="menu-item"
|
|
58
63
|
onclick={() =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
toastStatus(
|
|
65
|
+
fetchAPI('DELETE', 'tasks/:id', {}, task.id).then(() => {
|
|
66
|
+
tasks.splice(tasks.indexOf(task), 1);
|
|
67
|
+
}),
|
|
68
|
+
text('tasks.toast_task_deleted')
|
|
69
|
+
)}
|
|
62
70
|
>
|
|
63
71
|
<Icon i="trash" />
|
|
64
72
|
<span>{text('generic.delete')}</span>
|
|
@@ -92,10 +100,13 @@
|
|
|
92
100
|
<div
|
|
93
101
|
class="menu-item"
|
|
94
102
|
onclick={() =>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
toastStatus(
|
|
104
|
+
fetchAPI('DELETE', 'task_lists/:id', {}, list.id).then(() => {
|
|
105
|
+
if (!lists) goto('/tasks');
|
|
106
|
+
else lists.splice(lists.indexOf(list), 1);
|
|
107
|
+
}),
|
|
108
|
+
text('tasks.toast_list_deleted')
|
|
109
|
+
)}
|
|
99
110
|
>
|
|
100
111
|
<Icon i="trash" />
|
|
101
112
|
<span>{text('generic.delete')}</span>
|
|
@@ -129,7 +140,10 @@
|
|
|
129
140
|
class="menu-item"
|
|
130
141
|
onclick={() => {
|
|
131
142
|
for (const task of tasks) task.completed = true;
|
|
132
|
-
|
|
143
|
+
toastStatus(
|
|
144
|
+
fetchAPI('POST', 'task_lists/:id', { all_completed: true }, list.id),
|
|
145
|
+
text('tasks.toast_all_completed')
|
|
146
|
+
);
|
|
133
147
|
}}
|
|
134
148
|
>
|
|
135
149
|
<Icon i="regular/circle-check" />
|
|
@@ -141,7 +155,7 @@
|
|
|
141
155
|
class="menu-item"
|
|
142
156
|
onclick={() => {
|
|
143
157
|
for (const task of tasks) task.completed = false;
|
|
144
|
-
fetchAPI('POST', 'task_lists/:id', { all_completed: false }, list.id);
|
|
158
|
+
toastStatus(fetchAPI('POST', 'task_lists/:id', { all_completed: false }, list.id), text('tasks.toast_all_pending'));
|
|
145
159
|
}}
|
|
146
160
|
>
|
|
147
161
|
<Icon i="regular/circle" />
|
|
@@ -165,16 +179,10 @@
|
|
|
165
179
|
</div>
|
|
166
180
|
{/if}
|
|
167
181
|
</Popover>
|
|
168
|
-
<AccessControlDialog bind:dialog={acl} item={list} itemType="task_lists"
|
|
182
|
+
<AccessControlDialog bind:dialog={acl} item={list} itemType="task_lists" {user} />
|
|
169
183
|
</div>
|
|
170
184
|
<div>
|
|
171
|
-
<button
|
|
172
|
-
class="icon-text"
|
|
173
|
-
onclick={() =>
|
|
174
|
-
fetchAPI('PUT', 'task_lists/:id', { summary: '' }, list.id)
|
|
175
|
-
.then(t => t)
|
|
176
|
-
.then(tasks.push.bind(tasks))}
|
|
177
|
-
>
|
|
185
|
+
<button class="icon-text" onclick={() => fetchAPI('PUT', 'task_lists/:id', { summary: '' }, list.id).then(t => tasks.push(t))}>
|
|
178
186
|
<Icon i="regular/circle-plus" />
|
|
179
187
|
<span>{text('tasks.new_task')}</span>
|
|
180
188
|
</button>
|
package/locales/en.json
CHANGED
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
"pending_heading": "Pending",
|
|
23
23
|
"pending_empty": "No pending tasks.",
|
|
24
24
|
"completed_heading": "Completed",
|
|
25
|
-
"completed_empty": "No completed tasks."
|
|
25
|
+
"completed_empty": "No completed tasks.",
|
|
26
|
+
"toast_all_completed": "All tasks marked as complete",
|
|
27
|
+
"toast_all_pending": "All tasks marked as pending",
|
|
28
|
+
"toast_task_deleted": "Task deleted",
|
|
29
|
+
"toast_list_deleted": "Task list deleted"
|
|
26
30
|
}
|
|
27
31
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/tasks",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.12",
|
|
4
4
|
"author": "James Prevett <axium@jamespre.dev>",
|
|
5
5
|
"description": "Tasks for Axium",
|
|
6
6
|
"funding": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"build": "tsc"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@axium/client": ">=0.
|
|
40
|
-
"@axium/core": ">=0.
|
|
39
|
+
"@axium/client": ">=0.20.0",
|
|
40
|
+
"@axium/core": ">=0.23.0",
|
|
41
41
|
"@axium/server": ">=0.35.0",
|
|
42
42
|
"@sveltejs/kit": "^2.27.3",
|
|
43
43
|
"utilium": "^2.6.3"
|
package/routes/tasks/+layout.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getCurrentSession } from '@axium/client/user';
|
|
2
|
-
import type { Session } from '@axium/core';
|
|
2
|
+
import type { Session, UserPublic } from '@axium/core';
|
|
3
3
|
|
|
4
4
|
export async function load({ parent, url }) {
|
|
5
|
-
let { session }: { session?: Session | null } = await parent();
|
|
5
|
+
let { session }: { session?: (Session & { user: UserPublic }) | null } = await parent();
|
|
6
6
|
|
|
7
7
|
session ||= await getCurrentSession().catch(() => null);
|
|
8
8
|
|