@alexsun-top/opencode-chat-room 0.7.6 → 0.7.7

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +5 -5
  3. package/README.zh-CN.md +5 -5
  4. package/dist/cli.js +735 -164
  5. package/package.json +2 -1
  6. package/plugin.ts +15 -3
  7. package/server/assets/base.css +0 -2
  8. package/server/assets/chat/doc-preview.js +11 -2
  9. package/server/assets/chat/editor.js +10 -7
  10. package/server/assets/chat/events.js +1 -1
  11. package/server/assets/chat/index.js +2 -0
  12. package/server/assets/chat/locales/de.js +18 -0
  13. package/server/assets/chat/locales/es.js +18 -0
  14. package/server/assets/chat/locales/fr.js +18 -0
  15. package/server/assets/chat/locales/it.js +18 -0
  16. package/server/assets/chat/locales/ja.js +18 -0
  17. package/server/assets/chat/locales/ko.js +18 -0
  18. package/server/assets/chat/markdown.js +27 -1
  19. package/server/assets/chat/messages.js +1 -0
  20. package/server/assets/chat/palette.js +9 -4
  21. package/server/assets/chat/questions.js +1 -0
  22. package/server/assets/chat/rooms.js +6 -1
  23. package/server/assets/chat/shortcuts.js +14 -3
  24. package/server/assets/chat/state.js +36 -0
  25. package/server/assets/chat/system-messages.js +3 -1
  26. package/server/assets/chat/task-form.js +197 -0
  27. package/server/assets/chat/task-row.js +169 -0
  28. package/server/assets/chat/tasks.js +494 -0
  29. package/server/assets/responsive.css +26 -1
  30. package/server/assets/tasks.css +422 -0
  31. package/server/chat.html +97 -19
  32. package/server/member-routes.ts +3 -0
  33. package/server/sw.js +12 -2
  34. package/server/task-routes.ts +53 -0
  35. package/skills/chatroom/SKILL.md +3 -1
  36. package/src/README.md +3 -3
  37. package/src/agent/task-tool.ts +155 -0
  38. package/src/center/center-client.ts +44 -0
  39. package/src/rooms/tasks.ts +246 -0
  40. package/src/runtime/v2-plugin.ts +11 -2
  41. package/src/state/sqlite-state.ts +67 -0
  42. package/src/tui/app.mjs +5 -3
  43. package/src/tui/main.mjs +4 -4
  44. package/src/tui/markdown.mjs +29 -5
  45. package/src/tui/mentions.mjs +218 -0
  46. package/src/tui/message-app.mjs +3 -2
  47. package/src/tui/palette-app.mjs +9 -2
  48. package/src/tui/ui-content.mjs +9 -2
  49. package/src/tui/ui-mentions.mjs +44 -0
  50. package/src/tui/ui-suggest-view.mjs +63 -0
  51. package/src/tui/ui-suggest.mjs +197 -0
  52. package/src/tui/ui-theme.mjs +2 -1
  53. package/src/tui/ui-view.mjs +2 -0
  54. package/src/tui/ui.mjs +17 -9
@@ -303,6 +303,24 @@ export const messages = {
303
303
  filesPreviewFailed: "Could not load this preview.", filesDownloadFailed: "Could not download this file.",
304
304
  filesPreviewLabel: ({ name }) => `Preview ${name}`, filesDownloadLabel: ({ name }) => `Download ${name}`,
305
305
  filesDeleteLabel: ({ name }) => `Delete ${name}`, filesRefresh: "Refresh files",
306
+ tasksTitle: "Tasks", tasksEyebrow: "Room tasks", tasksRefresh: "Refresh tasks", tasksMenuLabel: "Task actions",
307
+ tasksClearCompleted: "Clear completed", tasksClearConfirm: ({ count }) => `Clear ${count} completed task${count === 1 ? "" : "s"}? This cannot be undone.`,
308
+ tasksClearFailed: "Could not clear completed tasks. Try again.",
309
+ tasksLoading: "Loading tasks…", tasksLoadFailed: "Could not load tasks. Try again.", tasksEmpty: "No tasks yet. Add the first one.",
310
+ tasksEmptyFiltered: "No tasks with this status.", tasksCreate: "Add task", tasksTitleLabel: "Title",
311
+ tasksTitlePlaceholder: "What needs doing?", tasksDescriptionLabel: "Description", tasksDescriptionPlaceholder: "Add details, links, or acceptance notes",
312
+ tasksAssigneeLabel: "Assignee", tasksUnassigned: "Unassigned", tasksFilterLabel: "Show", tasksFilterAll: "All statuses",
313
+ tasksDueDateLabel: "Due date", tasksDueOn: ({ date }) => `Due ${date}`, tasksOverdue: "Overdue",
314
+ tasksParticipantsLabel: "Participants", tasksParticipantsMeta: ({ names }) => `Participants: ${names}`,
315
+ tasksConclusionLabel: "Conclusion", tasksConclusionPlaceholder: "What was the outcome?",
316
+ tasksStepsLabel: "Steps", tasksAddStep: "Add step", tasksRemoveStep: "Remove step", tasksStepPlaceholder: "Describe a step",
317
+ tasksStepDoneLabel: "Step done", tasksStepsHint: "Up to 30 steps. Check the ones that are done.",
318
+ tasksStepsProgress: ({ done, total }) => `${done} of ${total} step${total === 1 ? "" : "s"} done`,
319
+ tasksStatusTodo: "To do", tasksStatusDoing: "Doing", tasksStatusDone: "Done",
320
+ tasksSummary: ({ count }) => `${count} task${count === 1 ? "" : "s"}`, tasksCreator: ({ name }) => `Created by ${name}`, tasksUpdated: ({ time }) => `Updated ${time}`,
321
+ tasksEditLabel: ({ title }) => `Edit ${title}`, tasksDeleteLabel: ({ title }) => `Delete ${title}`, tasksStatusFor: ({ title }) => `Status for ${title}`,
322
+ tasksInvalid: "Add a title of 1–200 characters.", tasksCreateFailed: "Could not add this task. Try again.", tasksUpdateFailed: "Could not update this task. Try again.",
323
+ tasksDeleteFailed: "Could not delete this task. Try again.", tasksDeleteConfirm: ({ title }) => `Delete “${title}”? This cannot be undone.`,
306
324
  earlierMessages: "Earlier messages omitted", messagesBetweenOmitted: "Messages between this reading point and latest are omitted.", you: "You", saved: "Saved",
307
325
  savedMemory: "Saved for this tab only", copyFailed: ({ id }) => `Copy failed. Copy manually: ${id}`,
308
326
  copyMessage: "Copy", copiedMessage: "Copied", copyMessageFailed: "Could not copy. Select and copy the message manually.", wrapCode: "Wrap code",
@@ -433,6 +451,24 @@ export const messages = {
433
451
  filesPreviewFailed: "无法加载预览。", filesDownloadFailed: "无法下载此文件。",
434
452
  filesPreviewLabel: ({ name }) => `预览 ${name}`, filesDownloadLabel: ({ name }) => `下载 ${name}`,
435
453
  filesDeleteLabel: ({ name }) => `删除 ${name}`, filesRefresh: "刷新文件",
454
+ tasksTitle: "任务", tasksEyebrow: "房间任务", tasksRefresh: "刷新任务", tasksMenuLabel: "任务操作",
455
+ tasksClearCompleted: "清除已完成任务", tasksClearConfirm: ({ count }) => `清除 ${count} 个已完成任务?此操作无法撤销。`,
456
+ tasksClearFailed: "无法清除已完成任务,请重试。",
457
+ tasksLoading: "正在加载任务…", tasksLoadFailed: "无法加载任务,请重试。", tasksEmpty: "还没有任务,添加第一个吧。",
458
+ tasksEmptyFiltered: "此状态下没有任务。", tasksCreate: "添加任务", tasksTitleLabel: "标题",
459
+ tasksTitlePlaceholder: "需要做什么?", tasksDescriptionLabel: "描述", tasksDescriptionPlaceholder: "补充细节、链接或完成标准",
460
+ tasksAssigneeLabel: "负责人", tasksUnassigned: "未指派", tasksFilterLabel: "显示", tasksFilterAll: "全部状态",
461
+ tasksDueDateLabel: "截止日期", tasksDueOn: ({ date }) => `截止 ${date}`, tasksOverdue: "已逾期",
462
+ tasksParticipantsLabel: "参与人员", tasksParticipantsMeta: ({ names }) => `参与人员:${names}`,
463
+ tasksConclusionLabel: "结论", tasksConclusionPlaceholder: "最终结果如何?",
464
+ tasksStepsLabel: "完成步骤", tasksAddStep: "添加步骤", tasksRemoveStep: "删除步骤", tasksStepPlaceholder: "描述一个步骤",
465
+ tasksStepDoneLabel: "步骤已完成", tasksStepsHint: "最多 30 个步骤,勾选已完成的步骤。",
466
+ tasksStepsProgress: ({ done, total }) => `已完成 ${done}/${total} 步`,
467
+ tasksStatusTodo: "待办", tasksStatusDoing: "进行中", tasksStatusDone: "已完成",
468
+ tasksSummary: ({ count }) => `${count} 个任务`, tasksCreator: ({ name }) => `由 ${name} 创建`, tasksUpdated: ({ time }) => `更新于 ${time}`,
469
+ tasksEditLabel: ({ title }) => `编辑 ${title}`, tasksDeleteLabel: ({ title }) => `删除 ${title}`, tasksStatusFor: ({ title }) => `${title} 的状态`,
470
+ tasksInvalid: "标题需为 1–200 个字符。", tasksCreateFailed: "无法添加任务,请重试。", tasksUpdateFailed: "无法更新任务,请重试。",
471
+ tasksDeleteFailed: "无法删除任务,请重试。", tasksDeleteConfirm: ({ title }) => `删除“${title}”?此操作无法撤销。`,
436
472
  joined: "已加入", joinAction: "加入房间", unreadMessages: ({ count }) => `${count} 条未读`,
437
473
  today: "今天", yesterday: "昨天", earlierMessages: "更早的消息已省略", messagesBetweenOmitted: "此阅读位置与最新消息之间的部分消息已省略。", you: "我", saved: "已保存",
438
474
  savedMemory: "仅保存于当前标签页", copyFailed: ({ id }) => `复制失败,请手动复制:${id}`,
@@ -23,7 +23,9 @@ function formatLine(line, app) {
23
23
 
24
24
  export function formatSystemMessage(message, app) {
25
25
  // `<at>@name</at>` is an editor token; system rows and previews show the plain mention.
26
- let text = String(message?.text ?? "").replace(/<at>([\s\S]*?)<\/at>/g, "$1");
26
+ let text = String(message?.text ?? "")
27
+ .replace(/<at>@all<\/at>/g, `@${app.t("allMembers")}`)
28
+ .replace(/<at>([\s\S]*?)<\/at>/g, "$1");
27
29
  // Resource markers are internal IDs. A rail preview must not expose them.
28
30
  const resources = /\[\[resource:[0-9a-f-]{36}\]\]/gi;
29
31
  if (resources.test(text)) {
@@ -0,0 +1,197 @@
1
+ // Task form fields shared by the create and edit forms: people pickers and steps.
2
+ import { icon } from "./icons.js";
3
+
4
+ export const TITLE_MAX = 200, TEXT_MAX = 5000, STEP_MAX = 300, STEPS_MAX = 30;
5
+
6
+ export const roomPeople = (app) => {
7
+ const room = app.state.room;
8
+ return [...new Set([
9
+ ...(room?.participants || []).map((person) => person.name),
10
+ ...(app.state.memberSessions.get(room?.id) || []).map((member) => member.name),
11
+ ].filter(Boolean))]
12
+ .sort((left, right) => String(left).localeCompare(String(right), app.intlLocale()));
13
+ };
14
+
15
+ export const fillAssignees = (app, select, value) => {
16
+ const names = roomPeople(app);
17
+ if (value && !names.includes(value)) names.push(value);
18
+ select.textContent = "";
19
+ const add = (name, label) => {
20
+ const option = document.createElement("option");
21
+ option.value = name;
22
+ option.textContent = label;
23
+ select.append(option);
24
+ };
25
+ add("", app.t("tasksUnassigned"));
26
+ names.forEach((name) => add(name, name));
27
+ select.value = names.includes(value) ? value : "";
28
+ };
29
+
30
+ export const fillPeople = (app, container, selected = []) => {
31
+ container.textContent = "";
32
+ const names = roomPeople(app);
33
+ // Keep participants who left visible so an unrelated edit does not drop them.
34
+ for (const name of selected) if (!names.includes(name)) names.push(name);
35
+ names.sort((left, right) => String(left).localeCompare(String(right), app.intlLocale()));
36
+ for (const name of names) {
37
+ const label = document.createElement("label");
38
+ label.className = "task-person";
39
+ const input = document.createElement("input");
40
+ input.type = "checkbox"; input.value = name; input.checked = selected.includes(name);
41
+ const text = document.createElement("span");
42
+ text.textContent = name;
43
+ label.append(input, text);
44
+ container.append(label);
45
+ }
46
+ };
47
+
48
+ export const readPeople = (container) => [...container.querySelectorAll('input[type="checkbox"]:checked')]
49
+ .map((input) => input.value);
50
+
51
+ // One editor for create and edit forms: text, done flag, and a remove button.
52
+ export function createStepsEditor(app, container, addButton, initial = []) {
53
+ const rows = [];
54
+ const sync = () => { addButton.disabled = rows.length >= STEPS_MAX; };
55
+ const addRow = (step = {}) => {
56
+ if (rows.length >= STEPS_MAX) return null;
57
+ const row = document.createElement("div");
58
+ row.className = "task-step-row";
59
+ const done = document.createElement("input");
60
+ done.type = "checkbox"; done.className = "task-step-done"; done.checked = step.done === true;
61
+ done.setAttribute("data-i18n-aria-label", "tasksStepDoneLabel");
62
+ done.setAttribute("aria-label", app.t("tasksStepDoneLabel"));
63
+ const text = document.createElement("input");
64
+ text.className = "input task-step-text"; text.maxLength = STEP_MAX; text.autocomplete = "off";
65
+ text.value = step.text || "";
66
+ text.setAttribute("data-i18n-placeholder", "tasksStepPlaceholder");
67
+ text.setAttribute("data-i18n-aria-label", "tasksStepPlaceholder");
68
+ text.placeholder = app.t("tasksStepPlaceholder");
69
+ text.setAttribute("aria-label", app.t("tasksStepPlaceholder"));
70
+ const remove = document.createElement("button");
71
+ remove.type = "button"; remove.className = "task-action task-step-remove";
72
+ remove.setAttribute("data-i18n-aria-label", "tasksRemoveStep");
73
+ remove.setAttribute("aria-label", app.t("tasksRemoveStep"));
74
+ remove.innerHTML = icon("dismiss");
75
+ remove.addEventListener("click", () => {
76
+ rows.splice(rows.indexOf(row), 1);
77
+ row.remove();
78
+ sync();
79
+ addButton.focus();
80
+ });
81
+ row.append(done, text, remove);
82
+ container.append(row);
83
+ rows.push(row);
84
+ sync();
85
+ return row;
86
+ };
87
+ const read = () => rows
88
+ .map((row) => ({ text: row.querySelector(".task-step-text").value.trim(), done: row.querySelector(".task-step-done").checked }))
89
+ .filter((step) => step.text);
90
+ const reset = () => { rows.splice(0).forEach((row) => row.remove()); sync(); };
91
+ addButton.addEventListener("click", () => addRow()?.querySelector(".task-step-text").focus());
92
+ initial.forEach((step) => addRow(step));
93
+ return { addRow, read, reset };
94
+ }
95
+
96
+ export const buildTaskForm = (view, task) => {
97
+ const { app } = view;
98
+ const form = document.createElement("form");
99
+ form.className = "task-edit-form";
100
+ form.noValidate = true;
101
+ const field = (className, key, control) => {
102
+ const label = document.createElement("label");
103
+ const text = document.createElement("span");
104
+ label.className = `field task-field ${className}`;
105
+ text.className = "field-label";
106
+ text.dataset.i18n = key;
107
+ text.textContent = app.t(key);
108
+ label.append(text, control);
109
+ return label;
110
+ };
111
+ const legendField = (className, key, children) => {
112
+ const set = document.createElement("fieldset");
113
+ const legend = document.createElement("legend");
114
+ const text = document.createElement("span");
115
+ set.className = `field task-field ${className}`;
116
+ legend.className = "field-label";
117
+ text.dataset.i18n = key;
118
+ text.textContent = app.t(key);
119
+ legend.append(text);
120
+ set.append(legend, ...children);
121
+ return set;
122
+ };
123
+ const title = document.createElement("input");
124
+ title.className = "input task-edit-title";
125
+ title.maxLength = TITLE_MAX;
126
+ title.autocomplete = "off";
127
+ title.value = task.title;
128
+ const description = document.createElement("textarea");
129
+ description.className = "input task-edit-description";
130
+ description.rows = 2;
131
+ description.maxLength = TEXT_MAX;
132
+ description.value = task.description || "";
133
+ const due = document.createElement("input");
134
+ due.className = "input task-edit-due";
135
+ due.type = "date";
136
+ due.value = view.dateValue(task.dueDate);
137
+ const assignee = document.createElement("select");
138
+ assignee.className = "input task-edit-assignee tasks-select";
139
+ fillAssignees(app, assignee, task.assignee || "");
140
+ const people = document.createElement("div");
141
+ people.className = "task-people";
142
+ fillPeople(app, people, view.participantsOf(task));
143
+ const stepsBox = document.createElement("div");
144
+ stepsBox.className = "task-steps-editor";
145
+ const addStep = document.createElement("button");
146
+ addStep.type = "button";
147
+ addStep.className = "btn ghost small task-add-step";
148
+ addStep.dataset.i18n = "tasksAddStep";
149
+ addStep.textContent = app.t("tasksAddStep");
150
+ const steps = createStepsEditor(app, stepsBox, addStep, view.stepsOf(task));
151
+ const conclusion = document.createElement("textarea");
152
+ conclusion.className = "input task-edit-conclusion";
153
+ conclusion.rows = 2;
154
+ conclusion.maxLength = TEXT_MAX;
155
+ conclusion.value = task.conclusion || "";
156
+ const actions = document.createElement("div");
157
+ actions.className = "task-edit-actions";
158
+ const cancel = document.createElement("button");
159
+ cancel.type = "button";
160
+ cancel.className = "btn ghost small";
161
+ cancel.dataset.i18n = "cancel";
162
+ cancel.textContent = app.t("cancel");
163
+ cancel.addEventListener("click", () => view.onCancel(task));
164
+ const save = document.createElement("button");
165
+ save.type = "submit";
166
+ save.className = "btn primary small";
167
+ save.dataset.i18n = "save";
168
+ save.textContent = app.t("save");
169
+ actions.append(cancel, save);
170
+ form.append(
171
+ field("task-edit-title-field", "tasksTitleLabel", title),
172
+ field("task-edit-description-field", "tasksDescriptionLabel", description),
173
+ field("task-edit-due-field", "tasksDueDateLabel", due),
174
+ field("task-edit-assignee-field", "tasksAssigneeLabel", assignee),
175
+ legendField("task-edit-participants-field", "tasksParticipantsLabel", [people]),
176
+ legendField("task-edit-steps-field", "tasksStepsLabel", [stepsBox, addStep]),
177
+ field("task-edit-conclusion-field", "tasksConclusionLabel", conclusion),
178
+ actions,
179
+ );
180
+ form.addEventListener("submit", async (event) => {
181
+ event.preventDefault();
182
+ const nextTitle = title.value.trim();
183
+ if (!nextTitle || Array.from(nextTitle).length > TITLE_MAX) {
184
+ view.showError("tasksInvalid");
185
+ title.focus();
186
+ return;
187
+ }
188
+ save.disabled = true;
189
+ const saved = await view.onSave(task, {
190
+ title: nextTitle, description: description.value.trim(), dueDate: due.value,
191
+ participants: readPeople(people), conclusion: conclusion.value.trim(),
192
+ assignee: assignee.value, steps: steps.read(),
193
+ });
194
+ if (!saved) save.disabled = false;
195
+ });
196
+ return form;
197
+ };
@@ -0,0 +1,169 @@
1
+ // Task rows: a compact summary of people, due date, steps, and conclusion.
2
+ import { icon } from "./icons.js";
3
+ import { buildTaskForm } from "./task-form.js";
4
+
5
+ const STATUSES = ["todo", "doing", "done"];
6
+ const STATUS_LABELS = { todo: "tasksStatusTodo", doing: "tasksStatusDoing", done: "tasksStatusDone" };
7
+
8
+ const statusSelect = (view, task) => {
9
+ const app = view.app;
10
+ const select = document.createElement("select");
11
+ select.className = "input task-status-select";
12
+ select.setAttribute("aria-label", app.t("tasksStatusFor", { title: task.title }));
13
+ for (const status of STATUSES) {
14
+ const option = document.createElement("option");
15
+ option.value = status;
16
+ option.textContent = app.t(STATUS_LABELS[status]);
17
+ select.append(option);
18
+ }
19
+ select.value = view.statusOf(task);
20
+ select.addEventListener("change", () => void view.onStatus(task, select));
21
+ return select;
22
+ };
23
+
24
+ const actionButton = (view, task, key, name) => {
25
+ const app = view.app;
26
+ const button = document.createElement("button");
27
+ const label = app.t(key, { title: task.title });
28
+ button.type = "button";
29
+ button.className = `task-action task-action-${name}`;
30
+ button.dataset.taskAction = name;
31
+ button.setAttribute("aria-label", label);
32
+ button.title = label;
33
+ button.innerHTML = icon(name);
34
+ button.addEventListener("click", () => name === "delete" ? void view.onDelete(task) : view.onEdit(task));
35
+ return button;
36
+ };
37
+
38
+ export const buildTaskRow = (view, task, index) => {
39
+ const app = view.app;
40
+ const row = document.createElement("li");
41
+ const status = view.statusOf(task), steps = view.stepsOf(task);
42
+ row.className = "task-row";
43
+ row.dataset.taskId = task.id;
44
+ row.dataset.status = status;
45
+ row.style.setProperty("--task-i", String(Math.min(index, 9)));
46
+ if (view.isEditing(task)) {
47
+ row.classList.add("task-row-editing");
48
+ row.append(buildTaskForm(view, task));
49
+ return row;
50
+ }
51
+ const main = document.createElement("div");
52
+ main.className = "task-main";
53
+ const titleLine = document.createElement("div");
54
+ titleLine.className = "task-title-line";
55
+ const title = document.createElement("h4");
56
+ title.className = "task-title";
57
+ title.textContent = task.title;
58
+ const badge = document.createElement("span");
59
+ badge.className = "task-status";
60
+ badge.dataset.status = status;
61
+ badge.textContent = app.t(STATUS_LABELS[status]);
62
+ titleLine.append(title, badge);
63
+ main.append(titleLine);
64
+ if (task.description) {
65
+ const description = document.createElement("p");
66
+ description.className = "task-description";
67
+ description.textContent = task.description;
68
+ main.append(description);
69
+ }
70
+ if (steps.length) {
71
+ const done = steps.filter((step) => step.done).length;
72
+ const progress = document.createElement("div");
73
+ progress.className = "task-progress";
74
+ const head = document.createElement("div");
75
+ head.className = "task-progress-head";
76
+ const label = document.createElement("span");
77
+ label.textContent = app.t("tasksStepsProgress", { done, total: steps.length });
78
+ const track = document.createElement("span");
79
+ track.className = "task-progress-track";
80
+ track.setAttribute("role", "progressbar");
81
+ track.setAttribute("aria-valuemin", "0");
82
+ track.setAttribute("aria-valuemax", String(steps.length));
83
+ track.setAttribute("aria-valuenow", String(done));
84
+ track.setAttribute("aria-label", label.textContent);
85
+ const fill = document.createElement("span");
86
+ fill.className = "task-progress-fill";
87
+ fill.style.width = `${Math.round(done / steps.length * 100)}%`;
88
+ track.append(fill);
89
+ head.append(label);
90
+ const list = document.createElement("ul");
91
+ list.className = "task-steps";
92
+ steps.forEach((step, position) => {
93
+ const item = document.createElement("li");
94
+ item.className = `task-step${step.done ? " is-done" : ""}`;
95
+ const toggle = document.createElement("input");
96
+ toggle.type = "checkbox";
97
+ toggle.className = "task-step-toggle";
98
+ toggle.checked = step.done;
99
+ toggle.disabled = !view.canStatus(task);
100
+ toggle.dataset.stepIndex = String(position);
101
+ toggle.setAttribute("aria-label", `${app.t("tasksStepDoneLabel")}: ${step.text}`);
102
+ toggle.addEventListener("change", () => void view.onToggleStep(task, position, toggle));
103
+ const text = document.createElement("span");
104
+ text.className = "task-step-text";
105
+ text.textContent = step.text;
106
+ item.append(toggle, text);
107
+ list.append(item);
108
+ });
109
+ progress.append(head, track, list);
110
+ main.append(progress);
111
+ }
112
+ const meta = document.createElement("p");
113
+ meta.className = "task-meta";
114
+ const creator = document.createElement("span");
115
+ creator.className = "task-creator";
116
+ creator.textContent = app.t("tasksCreator", { name: task.creatorName || app.t("guest") });
117
+ const assignee = document.createElement("span");
118
+ assignee.className = "task-assignee";
119
+ if (!task.assignee) assignee.classList.add("is-unassigned");
120
+ assignee.innerHTML = icon("people");
121
+ const assigneeName = document.createElement("span");
122
+ assigneeName.textContent = `${app.t("tasksAssigneeLabel")}: ${task.assignee || app.t("tasksUnassigned")}`;
123
+ assignee.append(assigneeName);
124
+ meta.append(creator, assignee);
125
+ const participants = view.participantsOf(task);
126
+ if (participants.length) {
127
+ const people = document.createElement("span");
128
+ people.className = "task-participants";
129
+ people.textContent = app.t("tasksParticipantsMeta", { names: participants.join(", ") });
130
+ meta.append(people);
131
+ }
132
+ const dueDate = view.dateValue(task.dueDate);
133
+ if (dueDate) {
134
+ const due = document.createElement("span");
135
+ due.className = "task-due";
136
+ if (view.isOverdue(task)) due.classList.add("is-overdue");
137
+ due.textContent = app.t("tasksDueOn", { date: view.formatDue(dueDate) });
138
+ if (view.isOverdue(task)) due.textContent += ` · ${app.t("tasksOverdue")}`;
139
+ meta.append(due);
140
+ }
141
+ const updated = view.updatedOf(task);
142
+ if (updated) {
143
+ const time = document.createElement("time");
144
+ time.className = "task-updated";
145
+ time.dateTime = new Date(updated).toISOString();
146
+ time.textContent = app.t("tasksUpdated", { time: app.fmtTime(updated) });
147
+ meta.append(time);
148
+ }
149
+ main.append(meta);
150
+ if (task.conclusion) {
151
+ const conclusion = document.createElement("p");
152
+ conclusion.className = "task-conclusion";
153
+ const label = document.createElement("span");
154
+ label.className = "task-conclusion-label";
155
+ label.textContent = app.t("tasksConclusionLabel");
156
+ const text = document.createElement("span");
157
+ text.textContent = task.conclusion;
158
+ conclusion.append(label, text);
159
+ main.append(conclusion);
160
+ }
161
+ const actions = document.createElement("div");
162
+ actions.className = "task-row-actions";
163
+ if (view.canStatus(task)) actions.append(statusSelect(view, task));
164
+ if (view.canEdit(task)) actions.append(actionButton(view, task, "tasksEditLabel", "edit"));
165
+ if (view.canEdit(task)) actions.append(actionButton(view, task, "tasksDeleteLabel", "delete"));
166
+ row.append(main);
167
+ if (actions.childElementCount) row.append(actions);
168
+ return row;
169
+ };