@axium/tasks 0.4.9 → 0.4.11
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 +20 -16
- package/locales/en.json +31 -0
- package/package.json +2 -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
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import type { Task, TaskList } from '@axium/tasks/common';
|
|
8
8
|
import type { WithRequired } from 'utilium';
|
|
9
9
|
import { download } from 'utilium/dom.js';
|
|
10
|
+
import { toastStatus } from '@axium/client/toast';
|
|
10
11
|
|
|
11
12
|
let { list = $bindable(), lists = $bindable() }: { list: WithRequired<TaskList, 'tasks'>; lists?: WithRequired<TaskList, 'tasks'>[] } =
|
|
12
13
|
$props();
|
|
@@ -56,9 +57,12 @@
|
|
|
56
57
|
<div
|
|
57
58
|
class="menu-item"
|
|
58
59
|
onclick={() =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
toastStatus(
|
|
61
|
+
fetchAPI('DELETE', 'tasks/:id', {}, task.id).then(() => {
|
|
62
|
+
tasks.splice(tasks.indexOf(task), 1);
|
|
63
|
+
}),
|
|
64
|
+
text('tasks.toast_task_deleted')
|
|
65
|
+
)}
|
|
62
66
|
>
|
|
63
67
|
<Icon i="trash" />
|
|
64
68
|
<span>{text('generic.delete')}</span>
|
|
@@ -92,10 +96,13 @@
|
|
|
92
96
|
<div
|
|
93
97
|
class="menu-item"
|
|
94
98
|
onclick={() =>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
toastStatus(
|
|
100
|
+
fetchAPI('DELETE', 'task_lists/:id', {}, list.id).then(() => {
|
|
101
|
+
if (!lists) goto('/tasks');
|
|
102
|
+
else lists.splice(lists.indexOf(list), 1);
|
|
103
|
+
}),
|
|
104
|
+
text('tasks.toast_list_deleted')
|
|
105
|
+
)}
|
|
99
106
|
>
|
|
100
107
|
<Icon i="trash" />
|
|
101
108
|
<span>{text('generic.delete')}</span>
|
|
@@ -129,7 +136,10 @@
|
|
|
129
136
|
class="menu-item"
|
|
130
137
|
onclick={() => {
|
|
131
138
|
for (const task of tasks) task.completed = true;
|
|
132
|
-
|
|
139
|
+
toastStatus(
|
|
140
|
+
fetchAPI('POST', 'task_lists/:id', { all_completed: true }, list.id),
|
|
141
|
+
text('tasks.toast_all_completed')
|
|
142
|
+
);
|
|
133
143
|
}}
|
|
134
144
|
>
|
|
135
145
|
<Icon i="regular/circle-check" />
|
|
@@ -141,7 +151,7 @@
|
|
|
141
151
|
class="menu-item"
|
|
142
152
|
onclick={() => {
|
|
143
153
|
for (const task of tasks) task.completed = false;
|
|
144
|
-
fetchAPI('POST', 'task_lists/:id', { all_completed: false }, list.id);
|
|
154
|
+
toastStatus(fetchAPI('POST', 'task_lists/:id', { all_completed: false }, list.id), text('tasks.toast_all_pending'));
|
|
145
155
|
}}
|
|
146
156
|
>
|
|
147
157
|
<Icon i="regular/circle" />
|
|
@@ -168,13 +178,7 @@
|
|
|
168
178
|
<AccessControlDialog bind:dialog={acl} item={list} itemType="task_lists" editable />
|
|
169
179
|
</div>
|
|
170
180
|
<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
|
-
>
|
|
181
|
+
<button class="icon-text" onclick={() => fetchAPI('PUT', 'task_lists/:id', { summary: '' }, list.id).then(t => tasks.push(t))}>
|
|
178
182
|
<Icon i="regular/circle-plus" />
|
|
179
183
|
<span>{text('tasks.new_task')}</span>
|
|
180
184
|
</button>
|
package/locales/en.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"app_name": {
|
|
3
|
+
"tasks": "Tasks"
|
|
4
|
+
},
|
|
5
|
+
"tasks": {
|
|
6
|
+
"list_page_title": "Tasks — {name}",
|
|
7
|
+
"back_to_main": "Back to Tasks",
|
|
8
|
+
"new_list": "New List",
|
|
9
|
+
"list_init": {
|
|
10
|
+
"submit": "Create List",
|
|
11
|
+
"name": "Name",
|
|
12
|
+
"description": "Description <span class='subtle'>(optional)</span>"
|
|
13
|
+
},
|
|
14
|
+
"copy_id": "Copy ID",
|
|
15
|
+
"copy_link": "Copy Link",
|
|
16
|
+
"export_list": "Export",
|
|
17
|
+
"share_list": "Share",
|
|
18
|
+
"mark_all_complete": "Complete All",
|
|
19
|
+
"mark_all_pending": "Un-complete All",
|
|
20
|
+
"open_new_tab": "Open in New Tab",
|
|
21
|
+
"new_task": "Add Task",
|
|
22
|
+
"pending_heading": "Pending",
|
|
23
|
+
"pending_empty": "No pending tasks.",
|
|
24
|
+
"completed_heading": "Completed",
|
|
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"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/tasks",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.11",
|
|
4
4
|
"author": "James Prevett <axium@jamespre.dev>",
|
|
5
5
|
"description": "Tasks for Axium",
|
|
6
6
|
"funding": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"dist",
|
|
30
30
|
"lib",
|
|
31
31
|
"routes",
|
|
32
|
+
"locales",
|
|
32
33
|
"db.json"
|
|
33
34
|
],
|
|
34
35
|
"scripts": {
|