fix(tasktree): revert regressed outline layout

This commit is contained in:
root
2026-07-21 13:38:09 +02:00
parent 12b6bbff10
commit 48db528a26
2 changed files with 11 additions and 12 deletions
@@ -56,7 +56,7 @@ const combinedMarkdown = computed(() => {
}); });
function plainTitle(task: TaskTreeTask) { function plainTitle(task: TaskTreeTask) {
return task.title.replace(/^R\d+(?:\.\d+){0,2}\s+/u, "").replace(/\[([^\]]+)\]\([^)]+\)/gu, "$1").replace(/`([^`]+)`/gu, "$1").trim(); return task.title.replace(/\[([^\]]+)\]\([^)]+\)/gu, "$1").replace(/`([^`]+)`/gu, "$1").trim();
} }
function plainReportTitle(report: TaskTreeReport) { function plainReportTitle(report: TaskTreeReport) {
return report.title.replace(/\[([^\]]+)\]\([^)]+\)/gu, "$1").replace(/`([^`]+)`/gu, "$1").trim(); return report.title.replace(/\[([^\]]+)\]\([^)]+\)/gu, "$1").replace(/`([^`]+)`/gu, "$1").trim();
@@ -357,7 +357,6 @@ function tickClass(date: Date) {
}; };
} }
function statusLabel(status: string) { return ({ pending: "待处理", in_progress: "进行中", completed: "已完成", blocked: "阻塞" } as Record<string, string>)[status] || status; } function statusLabel(status: string) { return ({ pending: "待处理", in_progress: "进行中", completed: "已完成", blocked: "阻塞" } as Record<string, string>)[status] || status; }
function displayTaskTitle(task: TaskTreeTask) { return task.title.replace(/^R\d+(?:\.\d+){0,2}\s+/u, ""); }
function taskKindLabel(kind: TaskTreeTask["kind"]) { return ({ task: "Task", subtask: "Subtask", subsubtask: "Subsubtask" })[kind]; } function taskKindLabel(kind: TaskTreeTask["kind"]) { return ({ task: "Task", subtask: "Subtask", subsubtask: "Subsubtask" })[kind]; }
function plainTaskTitle(task: TaskTreeTask | null) { function plainTaskTitle(task: TaskTreeTask | null) {
return String(task?.title || "任务详情").replace(/\[([^\]]+)\]\([^)]+\)/gu, "$1").replace(/`([^`]+)`/gu, "$1").trim(); return String(task?.title || "任务详情").replace(/\[([^\]]+)\]\([^)]+\)/gu, "$1").replace(/`([^`]+)`/gu, "$1").trim();
@@ -449,7 +448,6 @@ function syncSelectedTaskFromRoute() {
<div v-else class="tasktree-labels-canvas tasktree-detail-labels"> <div v-else class="tasktree-labels-canvas tasktree-detail-labels">
<section v-for="root in rootTasks" :key="root.id" class="tasktree-task-group"> <section v-for="root in rootTasks" :key="root.id" class="tasktree-task-group">
<div class="tasktree-label" :data-task-id="root.id" :data-dated="Boolean(root.startAt || root.dueAt)"> <div class="tasktree-label" :data-task-id="root.id" :data-dated="Boolean(root.startAt || root.dueAt)">
<span class="tasktree-outline-ref">{{ root.outlineRef }}</span>
<button <button
v-if="childrenByParent.has(root.id)" v-if="childrenByParent.has(root.id)"
class="tasktree-disclosure" class="tasktree-disclosure"
@@ -465,7 +463,8 @@ function syncSelectedTaskFromRoute() {
<span v-else class="tasktree-disclosure-spacer" aria-hidden="true" /> <span v-else class="tasktree-disclosure-spacer" aria-hidden="true" />
<div class="tasktree-title" role="button" tabindex="0" @click="selectTaskFromTitle($event, root)" @keydown.enter="selectTask(root)"> <div class="tasktree-title" role="button" tabindex="0" @click="selectTaskFromTitle($event, root)" @keydown.enter="selectTask(root)">
<span class="tasktree-status" :data-status="root.status" /> <span class="tasktree-status" :data-status="root.status" />
<MessageMarkdown class="tasktree-title-markdown" :source="displayTaskTitle(root)" /> <span class="tasktree-outline-ref">{{ root.outlineRef }}</span>
<MessageMarkdown class="tasktree-title-markdown" :source="root.title" />
</div> </div>
</div> </div>
<div <div
@@ -477,7 +476,6 @@ function syncSelectedTaskFromRoute() {
@wheel="handleChildWheel($event, root.id, 'labels')" @wheel="handleChildWheel($event, root.id, 'labels')"
> >
<div v-for="task in visibleDescendants(root.id)" :key="task.id" class="tasktree-label" :class="task.kind" :data-task-id="task.id" :data-dated="Boolean(task.startAt || task.dueAt)"> <div v-for="task in visibleDescendants(root.id)" :key="task.id" class="tasktree-label" :class="task.kind" :data-task-id="task.id" :data-dated="Boolean(task.startAt || task.dueAt)">
<span class="tasktree-outline-ref">{{ task.outlineRef }}</span>
<button <button
v-if="childrenByParent.has(task.id)" v-if="childrenByParent.has(task.id)"
class="tasktree-disclosure" class="tasktree-disclosure"
@@ -493,7 +491,8 @@ function syncSelectedTaskFromRoute() {
<span v-else class="tasktree-disclosure-spacer" aria-hidden="true" /> <span v-else class="tasktree-disclosure-spacer" aria-hidden="true" />
<div class="tasktree-title" role="button" tabindex="0" @click="selectTaskFromTitle($event, task)" @keydown.enter="selectTask(task)"> <div class="tasktree-title" role="button" tabindex="0" @click="selectTaskFromTitle($event, task)" @keydown.enter="selectTask(task)">
<span class="tasktree-status" :data-status="task.status" /> <span class="tasktree-status" :data-status="task.status" />
<MessageMarkdown class="tasktree-title-markdown" :source="displayTaskTitle(task)" /> <span class="tasktree-outline-ref">{{ task.outlineRef }}</span>
<MessageMarkdown class="tasktree-title-markdown" :source="task.title" />
</div> </div>
</div> </div>
</div> </div>
@@ -617,12 +616,12 @@ function syncSelectedTaskFromRoute() {
.tasktree-labels-canvas { min-height: 100%; align-content: start; } .tasktree-labels-canvas { min-height: 100%; align-content: start; }
.tasktree-overview-labels { display: grid; grid-auto-rows: 68px; } .tasktree-overview-labels { display: grid; grid-auto-rows: 68px; }
.tasktree-task-group { min-width: 0; } .tasktree-task-group { min-width: 0; }
.tasktree-label { height: 46px; border-bottom: 1px solid #edf0ef; background: #fff; padding: 0 8px; display: grid; grid-template-columns: 9ch 24px minmax(0, 1fr); align-items: center; color: var(--text-primary); min-width: 0; } .tasktree-label { height: 46px; border-bottom: 1px solid #edf0ef; background: #fff; padding: 0 8px; display: flex; align-items: center; color: var(--text-primary); min-width: 0; }
.tasktree-task-group > .tasktree-label { background: #f7f9f8; font-weight: 600; } .tasktree-task-group > .tasktree-label { background: #f7f9f8; font-weight: 600; }
.tasktree-label:hover { background: #f2f7f5; } .tasktree-label:hover { background: #f2f7f5; }
.tasktree-outline-ref { min-width: 0; padding-right: 7px; overflow: hidden; color: #64767b; font-family: var(--console-font-mono); font-size: 10px; font-weight: 700; line-height: 18px; text-align: right; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; } .tasktree-outline-ref { flex: 0 0 auto; color: #587078; font-family: var(--console-font-mono); font-size: 11px; font-weight: 700; }
.tasktree-label.subtask, .tasktree-label.subtask { padding-left: 30px; color: var(--text-secondary); }
.tasktree-label.subsubtask { color: var(--text-secondary); } .tasktree-label.subsubtask { padding-left: 54px; color: var(--text-secondary); }
.tasktree-group-label { height: 68px; padding: 9px 14px; display: grid; align-content: center; gap: 5px; cursor: pointer; } .tasktree-group-label { height: 68px; padding: 9px 14px; display: grid; align-content: center; gap: 5px; cursor: pointer; }
.tasktree-group-label > span { color: var(--text-secondary); font-family: var(--console-font-mono); font-size: 10px; } .tasktree-group-label > span { color: var(--text-secondary); font-family: var(--console-font-mono); font-size: 10px; }
.tasktree-group-title { display: flex; min-width: 0; align-items: center; gap: 8px; color: var(--text-primary); font-size: 15px; font-weight: 700; } .tasktree-group-title { display: flex; min-width: 0; align-items: center; gap: 8px; color: var(--text-primary); font-size: 15px; font-weight: 700; }
@@ -631,13 +630,13 @@ function syncSelectedTaskFromRoute() {
.tasktree-disclosure-spacer { width: 24px; height: 28px; flex: 0 0 24px; } .tasktree-disclosure-spacer { width: 24px; height: 28px; flex: 0 0 24px; }
.tasktree-disclosure { display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; } .tasktree-disclosure { display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; }
.tasktree-disclosure:hover { color: var(--text-primary); background: var(--surface-secondary); } .tasktree-disclosure:hover { color: var(--text-primary); background: var(--surface-secondary); }
.tasktree-title { display: flex; align-items: center; gap: 7px; min-width: 0; width: 100%; height: 100%; padding: 0 4px 0 3px; color: inherit; text-align: left; cursor: pointer; } .tasktree-title { display: flex; flex: 1 1 auto; align-items: center; gap: 8px; min-width: 0; height: 100%; padding: 0 4px; color: inherit; text-align: left; cursor: pointer; }
.tasktree-title:focus-visible { outline: 2px solid #2376c9; outline-offset: -2px; } .tasktree-title:focus-visible { outline: 2px solid #2376c9; outline-offset: -2px; }
.tasktree-title-markdown { min-width: 0; overflow: hidden; } .tasktree-title-markdown { min-width: 0; overflow: hidden; }
.tasktree-title-markdown :deep(p) { min-width: 0; margin: 0; overflow: hidden; font: inherit; text-overflow: ellipsis; white-space: nowrap; } .tasktree-title-markdown :deep(p) { min-width: 0; margin: 0; overflow: hidden; font: inherit; text-overflow: ellipsis; white-space: nowrap; }
.tasktree-title-markdown :deep(a) { color: #1766ad; text-decoration: underline; text-underline-offset: 2px; } .tasktree-title-markdown :deep(a) { color: #1766ad; text-decoration: underline; text-underline-offset: 2px; }
.tasktree-title-markdown :deep(code) { padding: 1px 3px; border: 1px solid var(--border-subtle); background: var(--surface-secondary); color: inherit; font-size: 0.9em; } .tasktree-title-markdown :deep(code) { padding: 1px 3px; border: 1px solid var(--border-subtle); background: var(--surface-secondary); color: inherit; font-size: 0.9em; }
.tasktree-status { width: 6px; height: 6px; border-radius: 50%; background: #83909c; flex: 0 0 auto; } .tasktree-status { width: 7px; height: 7px; border-radius: 50%; background: #83909c; flex: 0 0 auto; }
.tasktree-status[data-status="completed"] { background: #1f9d67; } .tasktree-status[data-status="completed"] { background: #1f9d67; }
.tasktree-status[data-status="in_progress"] { background: #2376c9; } .tasktree-status[data-status="in_progress"] { background: #2376c9; }
.tasktree-status[data-status="blocked"] { background: #c73e48; } .tasktree-status[data-status="blocked"] { background: #c73e48; }