dsh-task-card 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +112 -3
- package/cordis.patch.yml +9 -0
- package/lib/client.js +3214 -0
- package/lib/index.js +1591 -0
- package/lib/skill/task-card/SKILL.md +106 -0
- package/lib/skill/task-card/bin/instantiate-skeleton.mjs +2618 -0
- package/lib/skill/task-card/config.example.md +35 -0
- package/lib/skill/task-card/integrations/state-patch.md +173 -0
- package/lib/skill/task-card/references/delegation.md +121 -0
- package/lib/skill/task-card/references/dependency.md +128 -0
- package/lib/skill/task-card/references/gate-rules.md +176 -0
- package/lib/skill/task-card/references/recovery.md +106 -0
- package/lib/skill/task-card/references/task-format.md +613 -0
- package/lib/skill/task-card/references/workflows.md +109 -0
- package/lib/skill/task-card/templates/TASKFINISH-row.md +14 -0
- package/lib/skill/task-card/templates/TASKS-row.md +16 -0
- package/lib/skill/task-card/templates/delegation-brief.md +27 -0
- package/lib/skill/task-card/templates/integration-brief.md +32 -0
- package/lib/skill/task-card/templates/integration-map.yaml +32 -0
- package/lib/skill/task-card/templates/project-doc.md +25 -0
- package/lib/skill/task-card/templates/receipt.md +37 -0
- package/lib/skill/task-card/templates/skeleton.md +38 -0
- package/lib/skill/task-card/templates/skill-eval-report.md +82 -0
- package/lib/skill/task-card/templates/skill-eval-request.md +52 -0
- package/lib/skill/task-card/templates/skill-eval.md +40 -0
- package/lib/skill/task-card/templates/task.md +69 -0
- package/package.json +61 -3
package/lib/client.js
ADDED
|
@@ -0,0 +1,3214 @@
|
|
|
1
|
+
/* dsh-task-card client half — generated by scripts/build.mjs; do not edit. */
|
|
2
|
+
window.__ModuleLoader__.load({
|
|
3
|
+
id: "dsh-task-card",
|
|
4
|
+
factory: (require) => {
|
|
5
|
+
var module = { exports: {} };
|
|
6
|
+
var exports = module.exports;
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
|
|
27
|
+
// src/client/index.tsx
|
|
28
|
+
var index_exports = {};
|
|
29
|
+
__export(index_exports, {
|
|
30
|
+
CURRENT_SESSION_KEY: () => CURRENT_SESSION_KEY,
|
|
31
|
+
TaskCardIcon: () => TaskCardIcon,
|
|
32
|
+
TaskCardPanel: () => TaskCardPanel,
|
|
33
|
+
__test: () => __test,
|
|
34
|
+
apply: () => apply,
|
|
35
|
+
buildNewTaskPrompt: () => buildNewTaskPrompt,
|
|
36
|
+
continuePrompt: () => continuePrompt,
|
|
37
|
+
currentSessionId: () => currentSessionId,
|
|
38
|
+
inject: () => inject,
|
|
39
|
+
isInsideDirectory: () => isInsideDirectory,
|
|
40
|
+
joinProjectPath: () => joinProjectPath,
|
|
41
|
+
persistedSessionId: () => persistedSessionId,
|
|
42
|
+
reopenPrompt: () => reopenPrompt,
|
|
43
|
+
resolveClientProjectRoot: () => resolveClientProjectRoot,
|
|
44
|
+
resolveClientProjectTarget: () => resolveClientProjectTarget,
|
|
45
|
+
sessionCreateOptions: () => sessionCreateOptions,
|
|
46
|
+
sessionCwdForSession: () => sessionCwdForSession,
|
|
47
|
+
sessionFileAddress: () => sessionFileAddress,
|
|
48
|
+
windowsPath: () => windowsPath,
|
|
49
|
+
workspacePathForSession: () => workspacePathForSession
|
|
50
|
+
});
|
|
51
|
+
module.exports = __toCommonJS(index_exports);
|
|
52
|
+
var import_react3 = require("react");
|
|
53
|
+
|
|
54
|
+
// src/shared/protocol.ts
|
|
55
|
+
var PLUGIN_ID = "dsh-task-card";
|
|
56
|
+
var SNAPSHOT_ROUTES = {
|
|
57
|
+
/** GET:返回当前快照。 */
|
|
58
|
+
get: "/task-card/snapshot",
|
|
59
|
+
/** POST:丢弃缓存后重新读盘再返回快照(M2 无缓存,语义先占位)。 */
|
|
60
|
+
refresh: "/task-card/refresh",
|
|
61
|
+
/** GET:按 id 读取单张卡的 task.md 原文(详情预览用;只读、不缓存)。 */
|
|
62
|
+
card: "/task-card/card",
|
|
63
|
+
/** GET:按 id 列出任务目录内的文件树(打开任务文件用;只读、有深度/数量上限)。 */
|
|
64
|
+
files: "/task-card/files",
|
|
65
|
+
/** GET/POST:读取/保存插件设置(写 DSH 插件配置,不写任务文件)。 */
|
|
66
|
+
settings: "/task-card/settings"
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/client/model.ts
|
|
70
|
+
var COLOR = {
|
|
71
|
+
bg: "var(--dsw-alias-bg-base)",
|
|
72
|
+
layer1: "var(--dsw-alias-bg-layer-1)",
|
|
73
|
+
layer2: "var(--dsw-alias-bg-layer-2)",
|
|
74
|
+
card: "var(--dsw-alias-card-fill)",
|
|
75
|
+
cardHover: "var(--dsw-alias-card-fill-hover)",
|
|
76
|
+
text: "var(--dsw-alias-label-primary)",
|
|
77
|
+
secondary: "var(--dsw-alias-label-secondary)",
|
|
78
|
+
tertiary: "var(--dsw-alias-label-tertiary)",
|
|
79
|
+
border: "var(--dsw-alias-border-l3)",
|
|
80
|
+
borderSoft: "var(--dsw-alias-border-l2)",
|
|
81
|
+
hover: "var(--dsw-alias-interactive-bg-hover)",
|
|
82
|
+
brand: "var(--dsw-alias-brand-primary)",
|
|
83
|
+
business: "var(--dsw-alias-state-business-primary)",
|
|
84
|
+
success: "var(--dsw-alias-state-success-primary)",
|
|
85
|
+
done: "var(--dsw-alias-state-done-primary)",
|
|
86
|
+
warn: "var(--dsw-alias-state-warn-primary)",
|
|
87
|
+
error: "var(--dsw-alias-state-error-primary)",
|
|
88
|
+
idle: "var(--dsw-alias-state-idle-primary)",
|
|
89
|
+
link: "var(--dsw-alias-link)",
|
|
90
|
+
chartTools: "var(--dsw-alias-chart-tools)",
|
|
91
|
+
overlay: "var(--dsw-alias-bg-overlay)",
|
|
92
|
+
onColor: "var(--dsw-alias-label-on-color)"
|
|
93
|
+
};
|
|
94
|
+
function tint(color, pct) {
|
|
95
|
+
return `color-mix(in srgb, ${color} ${pct}%, var(--dsw-alias-bg-base))`;
|
|
96
|
+
}
|
|
97
|
+
function alpha(color, pct) {
|
|
98
|
+
return `color-mix(in srgb, ${color} ${pct}%, transparent)`;
|
|
99
|
+
}
|
|
100
|
+
function mix(first, second, firstPct = 50) {
|
|
101
|
+
return `color-mix(in srgb, ${first} ${firstPct}%, ${second})`;
|
|
102
|
+
}
|
|
103
|
+
var DEFAULT_COLOR_STRENGTH = 75;
|
|
104
|
+
var COLOR_STRENGTH_KEY = "dsh.task-card.colorStrength";
|
|
105
|
+
function clampColorStrength(value) {
|
|
106
|
+
return Math.max(0, Math.min(100, Math.round(value)));
|
|
107
|
+
}
|
|
108
|
+
function colorTintPercent(strength) {
|
|
109
|
+
return Math.round(clampColorStrength(strength) * 0.35);
|
|
110
|
+
}
|
|
111
|
+
function loadColorStrength() {
|
|
112
|
+
try {
|
|
113
|
+
const raw = localStorage.getItem(COLOR_STRENGTH_KEY);
|
|
114
|
+
if (raw !== null) {
|
|
115
|
+
const value = Number.parseInt(raw, 10);
|
|
116
|
+
if (Number.isFinite(value)) return clampColorStrength(value);
|
|
117
|
+
}
|
|
118
|
+
} catch {
|
|
119
|
+
}
|
|
120
|
+
return DEFAULT_COLOR_STRENGTH;
|
|
121
|
+
}
|
|
122
|
+
var STYLE_META = [
|
|
123
|
+
{ key: "plain", label: "\u7B80\u6D01", hint: "\u6587\u5B57\u4F18\u5148\uFF0C\u514B\u5236\u7559\u767D", icon: "list" },
|
|
124
|
+
{ key: "icon", label: "\u56FE\u6807", hint: "\u56FE\u6807\u8F85\u52A9\u8BC6\u522B\uFF0C\u5E73\u8861\u4FE1\u606F\u91CF", icon: "grid" },
|
|
125
|
+
{ key: "vivid", label: "\u5F69\u8272", hint: "\u72B6\u6001\u8272 + \u5927\u56FE\u6807\uFF0C\u6700\u5FEB\u626B\u8BFB", icon: "palette" }
|
|
126
|
+
];
|
|
127
|
+
function loadStyle() {
|
|
128
|
+
try {
|
|
129
|
+
const value = localStorage.getItem("dsh.task-card.style");
|
|
130
|
+
if (value === "plain" || value === "icon" || value === "vivid") return value;
|
|
131
|
+
} catch {
|
|
132
|
+
}
|
|
133
|
+
return "icon";
|
|
134
|
+
}
|
|
135
|
+
var CATEGORY_META = {
|
|
136
|
+
feature: { label: "\u529F\u80FD", icon: "sparkles", color: COLOR.business, hint: "\u65B0\u589E\u80FD\u529B\u6216\u7528\u6237\u4F53\u9A8C\u6539\u8FDB" },
|
|
137
|
+
fix: { label: "\u4FEE\u590D", icon: "wrench", color: COLOR.error, hint: "\u4FEE\u590D\u7F3A\u9677/\u56DE\u5F52" },
|
|
138
|
+
refactor: { label: "\u91CD\u6784", icon: "shuffle", color: COLOR.done, hint: "\u4E0D\u6539\u53D8\u884C\u4E3A\u7684\u7ED3\u6784\u8C03\u6574" },
|
|
139
|
+
docs: { label: "\u6587\u6863", icon: "book", color: mix(COLOR.business, COLOR.success, 62), hint: "\u6587\u6863/\u8BF4\u660E/\u793A\u4F8B" },
|
|
140
|
+
test: { label: "\u6D4B\u8BD5", icon: "flask", color: COLOR.success, hint: "\u6D4B\u8BD5\u3001\u6821\u9A8C\u3001\u8D28\u91CF\u95E8\u7981" },
|
|
141
|
+
research: { label: "\u8C03\u7814", icon: "search", color: COLOR.warn, hint: "\u8C03\u7814\u3001\u8BC4\u4F30\u3001\u9009\u578B\u3001\u539F\u578B" },
|
|
142
|
+
design: { label: "\u8BBE\u8BA1", icon: "palette", color: mix(COLOR.done, COLOR.warn, 55), hint: "\u8BBE\u8BA1\u7A3F\u3001\u65B9\u6848\u3001\u4FE1\u606F\u67B6\u6784" },
|
|
143
|
+
ops: { label: "\u8FD0\u7EF4", icon: "server", color: mix(COLOR.business, COLOR.done, 48), hint: "\u6784\u5EFA\u3001CI\u3001\u90E8\u7F72\u3001\u6570\u636E\u64CD\u4F5C" },
|
|
144
|
+
maintenance: { label: "\u7EF4\u62A4", icon: "tool", color: COLOR.idle, hint: "\u4F9D\u8D56\u5347\u7EA7\u3001\u6E05\u7406\u3001\u6280\u672F\u503A\u3001\u6846\u67B6\u7EF4\u62A4" },
|
|
145
|
+
perf: { label: "\u6027\u80FD", icon: "gauge", color: mix(COLOR.warn, COLOR.error, 42), hint: "\u6027\u80FD\u5206\u6790\u3001\u4F18\u5316\u3001\u57FA\u51C6" },
|
|
146
|
+
security: { label: "\u5B89\u5168", icon: "shield", color: mix(COLOR.error, COLOR.done, 38), hint: "\u5B89\u5168\u5BA1\u8BA1\u3001\u52A0\u56FA\u3001\u6F0F\u6D1E\u5904\u7F6E\u3001\u5408\u89C4" },
|
|
147
|
+
release: { label: "\u53D1\u5E03", icon: "rocket", color: mix(COLOR.success, COLOR.business, 45), hint: "\u7248\u672C\u53D1\u5E03\u3001\u53D1\u5E03\u68C0\u67E5\u3001\u56DE\u6EDA\u4E0E\u516C\u544A" }
|
|
148
|
+
};
|
|
149
|
+
function categoryMeta(category) {
|
|
150
|
+
return (category === null ? void 0 : CATEGORY_META[category]) ?? {
|
|
151
|
+
label: "\u672A\u5206\u7C7B",
|
|
152
|
+
icon: "help",
|
|
153
|
+
color: COLOR.secondary,
|
|
154
|
+
hint: "\u5361\u4E0A\u6CA1\u6709 category \u5B57\u6BB5\uFF08\u65E7\u5361\u517C\u5BB9\uFF09"
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
var STATUS_META = {
|
|
158
|
+
todo: { label: "\u5F85\u5F00\u59CB", icon: "clock", color: COLOR.idle, hint: "active \u4E14\u8FD8\u6CA1\u6709\u4EFB\u4F55\u9A8C\u6536/\u6B65\u9AA4\u8FDB\u5C55" },
|
|
159
|
+
active: { label: "\u8FDB\u884C\u4E2D", icon: "play", color: COLOR.business, hint: "active \u4E14\u5728\u63A8\u8FDB" },
|
|
160
|
+
review: { label: "\u5F85\u5173\u5355", icon: "check", color: COLOR.success, hint: "active \u4F46 A* \u9A8C\u6536\u5DF2\u5168\u90E8\u52FE\u9009" },
|
|
161
|
+
paused: { label: "\u6682\u505C", icon: "pause", color: COLOR.warn, hint: "paused" },
|
|
162
|
+
blocked: { label: "\u963B\u585E", icon: "block", color: COLOR.error, hint: "blocked\uFF08\u4EFB\u52A1\u7EA7\u6216\u4F9D\u8D56\u672A\u89E3\uFF09" },
|
|
163
|
+
done: { label: "\u5DF2\u5B8C\u6210", icon: "done", color: COLOR.done, hint: "done / \u5DF2\u5F52\u6863" },
|
|
164
|
+
cancelled: { label: "\u5DF2\u53D6\u6D88", icon: "cancel", color: COLOR.secondary, hint: "cancelled" },
|
|
165
|
+
unknown: { label: "\u672A\u89E3\u6790", icon: "help", color: COLOR.secondary, hint: "status \u7F3A\u5931\u6216\u4E0D\u662F\u5408\u6CD5\u679A\u4E3E" }
|
|
166
|
+
};
|
|
167
|
+
function displayStatus(card) {
|
|
168
|
+
if (card.status === "cancelled") return "cancelled";
|
|
169
|
+
if (card.status === "done" || card.archived) return "done";
|
|
170
|
+
if (card.status === "blocked") return "blocked";
|
|
171
|
+
if (card.status === "paused") return "paused";
|
|
172
|
+
if (card.status === "active") {
|
|
173
|
+
if (card.acceptance.total > 0 && card.acceptance.done >= card.acceptance.total) return "review";
|
|
174
|
+
const stepDone = card.steps?.done ?? 0;
|
|
175
|
+
if (stepDone === 0 && card.acceptance.done === 0) return "todo";
|
|
176
|
+
return "active";
|
|
177
|
+
}
|
|
178
|
+
return "unknown";
|
|
179
|
+
}
|
|
180
|
+
function statusMeta(card) {
|
|
181
|
+
return STATUS_META[displayStatus(card)];
|
|
182
|
+
}
|
|
183
|
+
function progressArcColor(card) {
|
|
184
|
+
return card.steps === null ? COLOR.secondary : COLOR.brand;
|
|
185
|
+
}
|
|
186
|
+
var UI_FONT_BASE = "var(--dsw-font-markdown-base-font-size, var(--dsh-content-font-size, 14px))";
|
|
187
|
+
function fontPx(px) {
|
|
188
|
+
return `calc(${UI_FONT_BASE} * ${Number((px / 13).toFixed(4))})`;
|
|
189
|
+
}
|
|
190
|
+
var DAY = 24 * 60 * 60 * 1e3;
|
|
191
|
+
function cardFlags(card, now = Date.now()) {
|
|
192
|
+
const flags = [];
|
|
193
|
+
if (card.focus) flags.push({ key: "focus", label: "\u7126\u70B9", tone: "info", icon: "sparkles", hint: "\u603B\u8D26\u91CC\u552F\u4E00\u7684 \u2605" });
|
|
194
|
+
if (card.archived) flags.push({ key: "archived", label: "\u5DF2\u5F52\u6863", tone: "muted", icon: "done", hint: "\u5DF2\u79FB\u5165 TASKFINISH.md" });
|
|
195
|
+
if (card.registered === false) {
|
|
196
|
+
flags.push({ key: "unregistered", label: "\u672A\u6CE8\u518C", tone: "warn", icon: "alert", hint: "\u6709 task.md \u4F46\u6CA1\u6709\u767B\u8BB0\u8FDB\u603B\u8D26" });
|
|
197
|
+
}
|
|
198
|
+
if (card.diagnostics.length > 0) {
|
|
199
|
+
flags.push({ key: "drift", label: "\u6570\u636E\u544A\u8B66", tone: "error", icon: "alert", hint: card.diagnostics.join("\uFF1B") });
|
|
200
|
+
}
|
|
201
|
+
if (card.blockedBy.length > 0 && card.status !== "blocked") {
|
|
202
|
+
flags.push({ key: "waiting", label: `\u4F9D\u8D56 ${card.blockedBy.length}`, tone: "warn", icon: "branch", hint: `blocked-by\uFF1A${card.blockedBy.join("\u3001")}` });
|
|
203
|
+
}
|
|
204
|
+
if (card.steps === null) {
|
|
205
|
+
flags.push({ key: "no-steps", label: "\u672A\u62C6\u5206\u6B65\u9AA4", tone: "muted", icon: "list", hint: "\u65E7\u5361\u6CA1\u6709 steps \u5757" });
|
|
206
|
+
}
|
|
207
|
+
if (card.category === null) {
|
|
208
|
+
flags.push({ key: "no-category", label: "\u672A\u5206\u7C7B", tone: "muted", icon: "help", hint: "\u5EFA\u8BAE\u8865 category\uFF08\u89C1\u683C\u5F0F\u5951\u7EA6 \xA72\uFF09" });
|
|
209
|
+
}
|
|
210
|
+
if (card.updated !== null) {
|
|
211
|
+
const updated = Date.parse(`${card.updated}T00:00:00`);
|
|
212
|
+
if (Number.isFinite(updated) && now - updated > 14 * DAY) {
|
|
213
|
+
flags.push({ key: "stale", label: "\u4E45\u672A\u66F4\u65B0", tone: "warn", icon: "clock", hint: `updated \u5DF2\u8D85\u8FC7 14 \u5929\uFF08${card.updated}\uFF09` });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return flags;
|
|
217
|
+
}
|
|
218
|
+
function flowSummary(card) {
|
|
219
|
+
const steps = card.steps;
|
|
220
|
+
if (steps === null) {
|
|
221
|
+
return { total: 0, done: 0, nodeTotal: 0, percent: 0, graph: false, decisions: 0, loops: 0, retries: 0, failed: 0, current: null };
|
|
222
|
+
}
|
|
223
|
+
const nodes = steps.nodes;
|
|
224
|
+
return {
|
|
225
|
+
total: steps.total,
|
|
226
|
+
done: steps.done,
|
|
227
|
+
nodeTotal: nodes.length,
|
|
228
|
+
percent: steps.total === 0 ? 0 : Math.round(steps.done / steps.total * 100),
|
|
229
|
+
graph: nodes.some((node) => (node.kind ?? "step") !== "step" || (node.retry ?? null) !== null || (node.pass ?? null) !== null || (node.exhausted ?? null) !== null),
|
|
230
|
+
decisions: nodes.filter((node) => (node.kind ?? "step") === "decision").length,
|
|
231
|
+
loops: nodes.filter((node) => (node.kind ?? "step") === "loop").length,
|
|
232
|
+
retries: nodes.filter((node) => (node.retry ?? null) !== null).length,
|
|
233
|
+
failed: nodes.filter((node) => node.failed).length,
|
|
234
|
+
current: nodes.find((node) => node.id === steps.current) ?? null
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function centeredScrollTop(view, row) {
|
|
238
|
+
return Math.max(0, Math.round(row.top - view.top + view.scrollTop - view.height / 2 + row.height / 2));
|
|
239
|
+
}
|
|
240
|
+
function stepLabel(card) {
|
|
241
|
+
if (card.steps === null) return null;
|
|
242
|
+
const { done, total, nodes } = card.steps;
|
|
243
|
+
return nodes.length > total ? `${done}/${total} \xB7 ${nodes.length} \u8282\u70B9` : `${done}/${total}`;
|
|
244
|
+
}
|
|
245
|
+
function nodeVisual(node) {
|
|
246
|
+
if (node.checked || node.status === "done") return { glyph: "\u2713", tone: "done" };
|
|
247
|
+
if (node.status === "skipped" || node.status === "waived") return { glyph: "\u21B7", tone: "skipped" };
|
|
248
|
+
if (node.status === "failed" || node.failed) return { glyph: "!", tone: "failed" };
|
|
249
|
+
if (node.status === "blocked") return { glyph: "\u26D4", tone: "blocked" };
|
|
250
|
+
if (node.status === "doing") return { glyph: "\u2192", tone: "doing" };
|
|
251
|
+
return { glyph: "\xB7", tone: "pending" };
|
|
252
|
+
}
|
|
253
|
+
var STATUS_RANK = {
|
|
254
|
+
active: 0,
|
|
255
|
+
review: 1,
|
|
256
|
+
todo: 2,
|
|
257
|
+
paused: 3,
|
|
258
|
+
blocked: 4,
|
|
259
|
+
done: 5,
|
|
260
|
+
cancelled: 6,
|
|
261
|
+
unknown: 7
|
|
262
|
+
};
|
|
263
|
+
function isClosedCard(card) {
|
|
264
|
+
return card.archived || card.status === "done" || card.status === "cancelled";
|
|
265
|
+
}
|
|
266
|
+
function viewCards(cards, view) {
|
|
267
|
+
return cards.filter((card) => view === "completed" ? isClosedCard(card) : !isClosedCard(card));
|
|
268
|
+
}
|
|
269
|
+
function matchesFilter(card, filter) {
|
|
270
|
+
if (filter === null) return true;
|
|
271
|
+
if (filter.type === "status") return displayStatus(card) === filter.key;
|
|
272
|
+
return (card.category ?? "unknown") === filter.key;
|
|
273
|
+
}
|
|
274
|
+
var PAGE_SIZE = 10;
|
|
275
|
+
function statusRank(card) {
|
|
276
|
+
if (card.focus) return -1;
|
|
277
|
+
return STATUS_RANK[displayStatus(card)];
|
|
278
|
+
}
|
|
279
|
+
function sortCards(cards) {
|
|
280
|
+
return [...cards].sort((a, b) => {
|
|
281
|
+
const diff = statusRank(a) - statusRank(b);
|
|
282
|
+
if (diff !== 0) return diff;
|
|
283
|
+
return (b.updated ?? "").localeCompare(a.updated ?? "");
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
function stateCounts(cards) {
|
|
287
|
+
const counts = /* @__PURE__ */ new Map();
|
|
288
|
+
for (const card of cards) {
|
|
289
|
+
const key = displayStatus(card);
|
|
290
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
291
|
+
}
|
|
292
|
+
const order = ["active", "review", "todo", "paused", "blocked", "done", "cancelled", "unknown"];
|
|
293
|
+
return order.filter((key) => (counts.get(key) ?? 0) > 0 || key === "active" || key === "done").map((key) => ({
|
|
294
|
+
key,
|
|
295
|
+
label: STATUS_META[key].label,
|
|
296
|
+
count: counts.get(key) ?? 0,
|
|
297
|
+
color: STATUS_META[key].color,
|
|
298
|
+
icon: STATUS_META[key].icon
|
|
299
|
+
}));
|
|
300
|
+
}
|
|
301
|
+
function categoryCounts(cards) {
|
|
302
|
+
const counts = /* @__PURE__ */ new Map();
|
|
303
|
+
for (const card of cards) {
|
|
304
|
+
const key = card.category === null ? "unknown" : card.category;
|
|
305
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
306
|
+
}
|
|
307
|
+
const order = [...Object.keys(CATEGORY_META), "unknown"];
|
|
308
|
+
return order.filter((key) => (counts.get(key) ?? 0) > 0).map((key) => {
|
|
309
|
+
const meta = key === "unknown" ? categoryMeta(null) : CATEGORY_META[key];
|
|
310
|
+
return { key, label: meta.label, count: counts.get(key) ?? 0, color: meta.color, icon: meta.icon };
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
function ledgerMismatches(snapshot) {
|
|
314
|
+
const issues = [];
|
|
315
|
+
const rows = new Map(snapshot.ledger.rows.map((row) => [row.id, row]));
|
|
316
|
+
const cardIds = new Set(snapshot.cards.map((card) => card.id));
|
|
317
|
+
for (const card of snapshot.cards) {
|
|
318
|
+
if (card.archived) continue;
|
|
319
|
+
const row = rows.get(card.id);
|
|
320
|
+
if (row === void 0) {
|
|
321
|
+
issues.push(card.registered ? `${card.id}\uFF1A\u5361\u6807\u8BB0\u5DF2\u767B\u8BB0\uFF0C\u4F46\u603B\u8D26\u6CA1\u6709\u8FD9\u4E00\u884C` : `${card.id}\uFF1A\u672A\u767B\u8BB0\u603B\u8D26\uFF08\u5361 status=${card.status ?? "null"}\uFF09`);
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
if (!card.registered) issues.push(`${card.id}\uFF1A\u603B\u8D26\u6709\u884C\uFF0C\u4F46\u5361\u672A\u6807\u8BB0\u767B\u8BB0`);
|
|
325
|
+
if (card.status !== null && row.status !== card.status) {
|
|
326
|
+
issues.push(`${card.id}\uFF1A\u5361 status=${card.status}\uFF0C\u603B\u8D26 status=${row.status}`);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
for (const row of snapshot.ledger.rows) {
|
|
330
|
+
if (!cardIds.has(row.id)) issues.push(`${row.id}\uFF1A\u603B\u8D26\u767B\u8BB0\u4E86\uFF0C\u4F46\u627E\u4E0D\u5230\u4EFB\u52A1\u5361`);
|
|
331
|
+
}
|
|
332
|
+
return issues;
|
|
333
|
+
}
|
|
334
|
+
function shortDate(value) {
|
|
335
|
+
return value === null ? "" : value.slice(5);
|
|
336
|
+
}
|
|
337
|
+
function plainText(value) {
|
|
338
|
+
if (value === null) return "";
|
|
339
|
+
return value.replace(/`([^`]+)`/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/\s+/g, " ").trim();
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// src/client/icons.tsx
|
|
343
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
344
|
+
var PATHS = {
|
|
345
|
+
card: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
346
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "4", y: "3", width: "16", height: "18", rx: "2.5" }),
|
|
347
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 8h8M8 12h8M8 16h5" })
|
|
348
|
+
] }),
|
|
349
|
+
plus: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 5v14M5 12h14" }),
|
|
350
|
+
refresh: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
351
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M20 11a8.1 8.1 0 0 0-15.5-2M4 5v4h4" }),
|
|
352
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 13a8.1 8.1 0 0 0 15.5 2M20 19v-4h-4" })
|
|
353
|
+
] }),
|
|
354
|
+
play: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 5.5v13l10-6.5z" }),
|
|
355
|
+
bolt: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13 2 4.5 13.5H11l-1 8.5 9-12h-6.5z" }),
|
|
356
|
+
folder: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
357
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3.5 7a2 2 0 0 1 2-2h4l2 2h7a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2z" }),
|
|
358
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3.5 10h17" })
|
|
359
|
+
] }),
|
|
360
|
+
chevronRight: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m9 5 7 7-7 7" }),
|
|
361
|
+
chevronLeft: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m15 5-7 7 7 7" }),
|
|
362
|
+
chevronDown: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m5 9 7 7 7-7" }),
|
|
363
|
+
close: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6 6l12 12M18 6 6 18" }),
|
|
364
|
+
check: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m5 12 4.5 4.5L19 7" }),
|
|
365
|
+
dot: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "4", fill: "currentColor", stroke: "none" }),
|
|
366
|
+
pause: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M9 5v14M15 5v14" }) }),
|
|
367
|
+
block: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
368
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
369
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m5.6 5.6 12.8 12.8" })
|
|
370
|
+
] }),
|
|
371
|
+
done: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
372
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
373
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m8 12 2.8 2.8L16.5 9" })
|
|
374
|
+
] }),
|
|
375
|
+
cancel: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
376
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
377
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m9 9 6 6M15 9l-6 6" })
|
|
378
|
+
] }),
|
|
379
|
+
alert: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
380
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 3.5 21 20H3z" }),
|
|
381
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 9v5M12 17.2v.1" })
|
|
382
|
+
] }),
|
|
383
|
+
clock: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
384
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
385
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 7v5l3.5 2" })
|
|
386
|
+
] }),
|
|
387
|
+
branch: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
388
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "6", cy: "6", r: "2.2" }),
|
|
389
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "18", cy: "18", r: "2.2" }),
|
|
390
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "18", cy: "6", r: "2.2" }),
|
|
391
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8.2 6H12a4 4 0 0 1 4 4v6M6 8.2V16a4 4 0 0 0 4 4h5.8" })
|
|
392
|
+
] }),
|
|
393
|
+
loop: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
394
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M17 3.5 20.5 7 17 10.5" }),
|
|
395
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M20 7H8a4 4 0 0 0-4 4v1" }),
|
|
396
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M7 20.5 3.5 17 7 13.5" }),
|
|
397
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 17h12a4 4 0 0 0 4-4v-1" })
|
|
398
|
+
] }),
|
|
399
|
+
retry: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
400
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3.5 12a8.5 8.5 0 1 0 2.6-6.1" }),
|
|
401
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3.5 4.5v5h5" })
|
|
402
|
+
] }),
|
|
403
|
+
file: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
404
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13.5 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9.5z" }),
|
|
405
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13.5 3v6.5H20M8 13h8M8 17h6" })
|
|
406
|
+
] }),
|
|
407
|
+
sparkles: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
408
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m12 3 1.6 4.4L18 9l-4.4 1.6L12 15l-1.6-4.4L6 9l4.4-1.6z" }),
|
|
409
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m18.5 14 .8 2.2 2.2.8-2.2.8-.8 2.2-.8-2.2-2.2-.8 2.2-.8z" }),
|
|
410
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m5 15 .6 1.6L7.2 17l-1.6.6L5 19.2l-.6-1.6L2.8 17l1.6-.4z" })
|
|
411
|
+
] }),
|
|
412
|
+
wrench: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M14.5 6.5a4.5 4.5 0 0 0-5.8 5.8L3.5 17.5 6.5 20.5l5.2-5.2a4.5 4.5 0 0 0 5.8-5.8l-2.6 2.6-2.4-2.4z" }),
|
|
413
|
+
shuffle: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
414
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 7h3.2c4.8 0 4.8 10 9.6 10H20" }),
|
|
415
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m17 14 3 3-3 3" }),
|
|
416
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 17h3.2c1.5 0 2.6-1 3.6-2.3M14.2 9.3C15 8.1 16 7 17 7h3" }),
|
|
417
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m17 4 3 3-3 3" })
|
|
418
|
+
] }),
|
|
419
|
+
book: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
420
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 5.5A2.5 2.5 0 0 1 6.5 3H20v16H6.5A2.5 2.5 0 0 0 4 21.5z" }),
|
|
421
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 5.5v16M8 7h8M8 11h8" })
|
|
422
|
+
] }),
|
|
423
|
+
flask: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
424
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M9 3h6M10 3v5L5 19a2 2 0 0 0 1.8 2h10.4A2 2 0 0 0 19 19l-5-11V3" }),
|
|
425
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M7.5 14h9" })
|
|
426
|
+
] }),
|
|
427
|
+
search: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
428
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "10.5", cy: "10.5", r: "6.5" }),
|
|
429
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m15.5 15.5 4.5 4.5" })
|
|
430
|
+
] }),
|
|
431
|
+
palette: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
432
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 3a9 9 0 1 0 0 18c1.8 0 2.4-1 2.4-1.8 0-1.2-1-1.6-1-2.8 0-1.2 1-2.1 2.2-2.1H18a3 3 0 0 0 3-3.2A9 9 0 0 0 12 3z" }),
|
|
433
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "7.8", cy: "11", r: ".9", fill: "currentColor", stroke: "none" }),
|
|
434
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "10.2", cy: "7.2", r: ".9", fill: "currentColor", stroke: "none" }),
|
|
435
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "14.5", cy: "7.6", r: ".9", fill: "currentColor", stroke: "none" })
|
|
436
|
+
] }),
|
|
437
|
+
server: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
438
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "3.5", y: "4", width: "17", height: "7", rx: "2" }),
|
|
439
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "3.5", y: "13", width: "17", height: "7", rx: "2" }),
|
|
440
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M7 7.5h.01M7 16.5h.01" })
|
|
441
|
+
] }),
|
|
442
|
+
tool: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M14.5 6.5a4.5 4.5 0 0 0-5.8 5.8L3.5 17.5 6.5 20.5l5.2-5.2a4.5 4.5 0 0 0 5.8-5.8l-2.6 2.6-2.4-2.4z" }) }),
|
|
443
|
+
gauge: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
444
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 18a9 9 0 1 1 16 0" }),
|
|
445
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m12 13 4-4M12 18h.01" })
|
|
446
|
+
] }),
|
|
447
|
+
shield: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
448
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 3 20 6v5c0 4.6-3.2 8-8 10-4.8-2-8-5.4-8-10V6z" }),
|
|
449
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m8.5 12 2.4 2.4 4.8-5" })
|
|
450
|
+
] }),
|
|
451
|
+
rocket: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
452
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 3c3.5 1.5 6 5 6 9l-3 3H9l-3-3c0-4 2.5-7.5 6-9z" }),
|
|
453
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M9 15c-2 1-3 3-3 6 3 0 5-1 6-3M15 15c2 1 3 3 3 6-3 0-5-1-6-3" }),
|
|
454
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "9", r: "1.6" })
|
|
455
|
+
] }),
|
|
456
|
+
info: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
457
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
458
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 11v5M12 8h.01" })
|
|
459
|
+
] }),
|
|
460
|
+
settings: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
461
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 6h8M16 6h4M4 12h4M12 12h8M4 18h8M16 18h4" }),
|
|
462
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "14", cy: "6", r: "2" }),
|
|
463
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "10", cy: "12", r: "2" }),
|
|
464
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "14", cy: "18", r: "2" })
|
|
465
|
+
] }),
|
|
466
|
+
more: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "5", cy: "12", r: "1.4", fill: "currentColor", stroke: "none" }),
|
|
468
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "1.4", fill: "currentColor", stroke: "none" }),
|
|
469
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "19", cy: "12", r: "1.4", fill: "currentColor", stroke: "none" })
|
|
470
|
+
] }),
|
|
471
|
+
external: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
472
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M14 4h6v6M20 4l-9 9" }),
|
|
473
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h4" })
|
|
474
|
+
] }),
|
|
475
|
+
copy: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
476
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "9", y: "9", width: "11", height: "11", rx: "2" }),
|
|
477
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M15 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h3" })
|
|
478
|
+
] }),
|
|
479
|
+
list: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
480
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 6h13M8 12h13M8 18h13" }),
|
|
481
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3.5 6h.01M3.5 12h.01M3.5 18h.01" })
|
|
482
|
+
] }),
|
|
483
|
+
grid: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
484
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "3.5", y: "3.5", width: "7", height: "7", rx: "1.5" }),
|
|
485
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "13.5", y: "3.5", width: "7", height: "7", rx: "1.5" }),
|
|
486
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "3.5", y: "13.5", width: "7", height: "7", rx: "1.5" }),
|
|
487
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "13.5", y: "13.5", width: "7", height: "7", rx: "1.5" })
|
|
488
|
+
] }),
|
|
489
|
+
eye: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
490
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.5 12s3.5-6.5 9.5-6.5S21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12z" }),
|
|
491
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "2.7" })
|
|
492
|
+
] }),
|
|
493
|
+
layers: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
494
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m12 3 9 5-9 5-9-5z" }),
|
|
495
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m3 13 9 5 9-5M3 17l9 5 9-5" })
|
|
496
|
+
] }),
|
|
497
|
+
tag: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
498
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3.5 11.5V5a1.5 1.5 0 0 1 1.5-1.5h6.5L20.5 12 12 20.5z" }),
|
|
499
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "7.7", cy: "7.7", r: "1.1" })
|
|
500
|
+
] }),
|
|
501
|
+
help: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
502
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
503
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M9.5 9a2.5 2.5 0 1 1 4 2c-.9.7-1.5 1.2-1.5 2.5M12 17h.01" })
|
|
504
|
+
] })
|
|
505
|
+
};
|
|
506
|
+
function Icon({ name, size = 16, strokeWidth = 1.8, style }) {
|
|
507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
508
|
+
"svg",
|
|
509
|
+
{
|
|
510
|
+
width: size,
|
|
511
|
+
height: size,
|
|
512
|
+
viewBox: "0 0 24 24",
|
|
513
|
+
fill: "none",
|
|
514
|
+
stroke: "currentColor",
|
|
515
|
+
strokeWidth,
|
|
516
|
+
strokeLinecap: "round",
|
|
517
|
+
strokeLinejoin: "round",
|
|
518
|
+
"aria-hidden": "true",
|
|
519
|
+
focusable: "false",
|
|
520
|
+
style: { flex: "0 0 auto", display: "block", ...style },
|
|
521
|
+
children: PATHS[name]
|
|
522
|
+
}
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// src/client/markdown.tsx
|
|
527
|
+
var import_react = require("react");
|
|
528
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
529
|
+
function MarkdownView({ text, options = {} }) {
|
|
530
|
+
const { frontMatter, body } = splitFrontMatter(text);
|
|
531
|
+
const blocks = renderBlocks(body.split(/\r?\n/), options, "md");
|
|
532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { fontSize: "var(--dsw-font-markdown-base-font-size, var(--dsh-content-font-size, 14px))", lineHeight: 1.72, color: COLOR.text, wordBreak: "break-word" }, children: [
|
|
533
|
+
frontMatter === null ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { style: { marginBottom: 10, border: `1px solid ${COLOR.borderSoft}`, borderRadius: 6, padding: "4px 8px", background: COLOR.layer1 }, children: [
|
|
534
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { style: { cursor: "pointer", fontSize: "calc(var(--dsw-font-markdown-base-font-size, var(--dsh-content-font-size, 14px)) - 3px)", color: COLOR.secondary }, children: "front-matter\uFF08\u5143\u6570\u636E\uFF0C\u70B9\u51FB\u5C55\u5F00\uFF09" }),
|
|
535
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { style: { margin: "6px 0 2px", fontSize: "calc(var(--dsw-font-markdown-base-font-size, var(--dsh-content-font-size, 14px)) - 2px)", lineHeight: 1.55, color: COLOR.secondary, whiteSpace: "pre-wrap", fontFamily: "ui-monospace, SFMono-Regular, Consolas, monospace" }, children: frontMatter })
|
|
536
|
+
] }),
|
|
537
|
+
blocks
|
|
538
|
+
] });
|
|
539
|
+
}
|
|
540
|
+
function splitFrontMatter(text) {
|
|
541
|
+
const normalized = text.replace(/^\uFEFF/, "");
|
|
542
|
+
if (!normalized.startsWith("---")) return { frontMatter: null, body: normalized };
|
|
543
|
+
const lines = normalized.split(/\r?\n/);
|
|
544
|
+
if ((lines[0] ?? "").trim() !== "---") return { frontMatter: null, body: normalized };
|
|
545
|
+
for (let i = 1; i < lines.length; i += 1) {
|
|
546
|
+
if ((lines[i] ?? "").trim() === "---") {
|
|
547
|
+
return {
|
|
548
|
+
frontMatter: lines.slice(1, i).join("\n"),
|
|
549
|
+
body: lines.slice(i + 1).join("\n")
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
return { frontMatter: null, body: normalized };
|
|
554
|
+
}
|
|
555
|
+
var HEADING = /^(#{1,6})\s+(.*)$/;
|
|
556
|
+
var HR = /^\s*(?:---+|\*\*\*+|___+)\s*$/;
|
|
557
|
+
var FENCE = /^\s*```(.*)$/;
|
|
558
|
+
var LIST = /^(\s*)([-*+]|\d+\.)\s+(.*)$/;
|
|
559
|
+
var BLOCKQUOTE = /^\s*>\s?(.*)$/;
|
|
560
|
+
var TABLE_ROW = /^\s*\|.*\|\s*$/;
|
|
561
|
+
var TABLE_SEP = /^\s*\|?[\s:|-]+\|[\s:|-]*$/;
|
|
562
|
+
function renderBlocks(lines, options, keyPrefix) {
|
|
563
|
+
const out = [];
|
|
564
|
+
let i = 0;
|
|
565
|
+
let key = 0;
|
|
566
|
+
const nextKey = () => `${keyPrefix}-${key++}`;
|
|
567
|
+
while (i < lines.length) {
|
|
568
|
+
const line = lines[i] ?? "";
|
|
569
|
+
if (line.trim() === "") {
|
|
570
|
+
i += 1;
|
|
571
|
+
continue;
|
|
572
|
+
}
|
|
573
|
+
const heading = HEADING.exec(line);
|
|
574
|
+
if (heading !== null) {
|
|
575
|
+
const level = (heading[1] ?? "").length;
|
|
576
|
+
const text = (heading[2] ?? "").trim();
|
|
577
|
+
if (level === 2 && text.startsWith("\u6267\u884C\u53F2") && options.collapseExecutionHistory !== false) {
|
|
578
|
+
const bodyLines = [];
|
|
579
|
+
i += 1;
|
|
580
|
+
while (i < lines.length) {
|
|
581
|
+
const candidate = lines[i] ?? "";
|
|
582
|
+
const nextHeading = HEADING.exec(candidate);
|
|
583
|
+
if (nextHeading !== null && (nextHeading[1] ?? "").length <= 2) break;
|
|
584
|
+
bodyLines.push(candidate);
|
|
585
|
+
i += 1;
|
|
586
|
+
}
|
|
587
|
+
const count = bodyLines.filter((item) => LIST.test(item) || item.trim().startsWith("- ")).length;
|
|
588
|
+
out.push(
|
|
589
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { style: { margin: "12px 0", border: `1px solid ${COLOR.borderSoft}`, borderRadius: 6, padding: "4px 8px", background: COLOR.layer1 }, children: [
|
|
590
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("summary", { style: { cursor: "pointer", fontSize: "calc(var(--dsw-font-markdown-base-font-size, var(--dsh-content-font-size, 14px)) - 3px)", color: COLOR.secondary }, children: [
|
|
591
|
+
"\u6267\u884C\u53F2\uFF08",
|
|
592
|
+
count > 0 ? `${count} \u6761` : "\u6B63\u6587",
|
|
593
|
+
"\uFF0C\u9ED8\u8BA4\u6298\u53E0\uFF1B\u5951\u7EA6\u8981\u6C42\u4E0D\u4E3B\u52A8\u6E32\u67D3\uFF09"
|
|
594
|
+
] }),
|
|
595
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { marginTop: 4 }, children: renderBlocks(bodyLines, options, `${keyPrefix}-hist`) })
|
|
596
|
+
] }, nextKey())
|
|
597
|
+
);
|
|
598
|
+
continue;
|
|
599
|
+
}
|
|
600
|
+
out.push(renderHeading(level, text, nextKey()));
|
|
601
|
+
i += 1;
|
|
602
|
+
continue;
|
|
603
|
+
}
|
|
604
|
+
if (HR.test(line)) {
|
|
605
|
+
out.push(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("hr", { style: { border: "none", borderTop: `1px solid ${COLOR.borderSoft}`, margin: "14px 0" } }, nextKey()));
|
|
606
|
+
i += 1;
|
|
607
|
+
continue;
|
|
608
|
+
}
|
|
609
|
+
const fence = FENCE.exec(line);
|
|
610
|
+
if (fence !== null) {
|
|
611
|
+
const code = [];
|
|
612
|
+
i += 1;
|
|
613
|
+
while (i < lines.length && !/^\s*```/.test(lines[i] ?? "")) {
|
|
614
|
+
code.push(lines[i] ?? "");
|
|
615
|
+
i += 1;
|
|
616
|
+
}
|
|
617
|
+
i += 1;
|
|
618
|
+
out.push(
|
|
619
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { style: { margin: "8px 0", padding: "8px 10px", borderRadius: 6, border: `1px solid ${COLOR.borderSoft}`, background: COLOR.layer2, overflowX: "auto", fontSize: "calc(var(--dsw-font-markdown-base-font-size, var(--dsh-content-font-size, 14px)) - 1.5px)", lineHeight: 1.55, fontFamily: "ui-monospace, SFMono-Regular, Consolas, monospace" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { children: code.join("\n") }) }, nextKey())
|
|
620
|
+
);
|
|
621
|
+
continue;
|
|
622
|
+
}
|
|
623
|
+
if (BLOCKQUOTE.test(line)) {
|
|
624
|
+
const quote = [];
|
|
625
|
+
while (i < lines.length && BLOCKQUOTE.test(lines[i] ?? "")) {
|
|
626
|
+
quote.push(BLOCKQUOTE.exec(lines[i] ?? "")?.[1] ?? "");
|
|
627
|
+
i += 1;
|
|
628
|
+
}
|
|
629
|
+
out.push(
|
|
630
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("blockquote", { style: { margin: "8px 0", padding: "2px 10px", borderLeft: `3px solid ${COLOR.brand}`, color: COLOR.secondary, background: COLOR.layer1 }, children: renderInline(quote.join("\n"), `${keyPrefix}-q`) }, nextKey())
|
|
631
|
+
);
|
|
632
|
+
continue;
|
|
633
|
+
}
|
|
634
|
+
if (LIST.test(line)) {
|
|
635
|
+
const items = [];
|
|
636
|
+
while (i < lines.length) {
|
|
637
|
+
const match = LIST.exec(lines[i] ?? "");
|
|
638
|
+
if (match === null) break;
|
|
639
|
+
const indent = (match[1] ?? "").length;
|
|
640
|
+
const marker = match[2] ?? "-";
|
|
641
|
+
let text = match[3] ?? "";
|
|
642
|
+
let checked = null;
|
|
643
|
+
const box = /^\[([ xX])\]\s*(.*)$/.exec(text);
|
|
644
|
+
if (box !== null) {
|
|
645
|
+
checked = (box[1] ?? "").toLowerCase() === "x";
|
|
646
|
+
text = box[2] ?? "";
|
|
647
|
+
}
|
|
648
|
+
items.push({ level: Math.min(6, Math.floor(indent / 2)), marker, text, checked });
|
|
649
|
+
i += 1;
|
|
650
|
+
}
|
|
651
|
+
out.push(renderList(items, keyPrefix, nextKey()));
|
|
652
|
+
continue;
|
|
653
|
+
}
|
|
654
|
+
if (TABLE_ROW.test(line) && i + 1 < lines.length && TABLE_SEP.test(lines[i + 1] ?? "")) {
|
|
655
|
+
const rows = [];
|
|
656
|
+
while (i < lines.length && TABLE_ROW.test(lines[i] ?? "")) {
|
|
657
|
+
const raw = (lines[i] ?? "").trim().replace(/^\|/, "").replace(/\|$/, "");
|
|
658
|
+
rows.push(raw.split("|").map((cell) => cell.trim()));
|
|
659
|
+
i += 1;
|
|
660
|
+
if (i < lines.length && TABLE_SEP.test(lines[i] ?? "")) {
|
|
661
|
+
i += 1;
|
|
662
|
+
while (i < lines.length && TABLE_ROW.test(lines[i] ?? "")) {
|
|
663
|
+
const row = (lines[i] ?? "").trim().replace(/^\|/, "").replace(/\|$/, "");
|
|
664
|
+
rows.push(row.split("|").map((cell) => cell.trim()));
|
|
665
|
+
i += 1;
|
|
666
|
+
}
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
out.push(renderTable(rows, keyPrefix, nextKey()));
|
|
671
|
+
continue;
|
|
672
|
+
}
|
|
673
|
+
const paragraph = [line];
|
|
674
|
+
i += 1;
|
|
675
|
+
while (i < lines.length) {
|
|
676
|
+
const candidate = lines[i] ?? "";
|
|
677
|
+
if (candidate.trim() === "" || HEADING.test(candidate) || HR.test(candidate) || FENCE.test(candidate) || BLOCKQUOTE.test(candidate) || LIST.test(candidate) || TABLE_ROW.test(candidate) && i + 1 < lines.length && TABLE_SEP.test(lines[i + 1] ?? "")) break;
|
|
678
|
+
paragraph.push(candidate);
|
|
679
|
+
i += 1;
|
|
680
|
+
}
|
|
681
|
+
out.push(
|
|
682
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { style: { margin: "6px 0", whiteSpace: "pre-wrap" }, children: renderInline(paragraph.join("\n"), `${keyPrefix}-p-${key}`) }, nextKey())
|
|
683
|
+
);
|
|
684
|
+
}
|
|
685
|
+
return out;
|
|
686
|
+
}
|
|
687
|
+
function renderHeading(level, text, key) {
|
|
688
|
+
const size = level === 1 ? "calc(var(--dsw-font-markdown-base-font-size, var(--dsh-content-font-size, 14px)) + 3px)" : level === 2 ? "calc(var(--dsw-font-markdown-base-font-size, var(--dsh-content-font-size, 14px)) + 2px)" : level === 3 ? "calc(var(--dsw-font-markdown-base-font-size, var(--dsh-content-font-size, 14px)) + 1px)" : "calc(var(--dsw-font-markdown-base-font-size, var(--dsh-content-font-size, 14px)) - 1px)";
|
|
689
|
+
const marginTop = level <= 2 ? 18 : 12;
|
|
690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
691
|
+
"div",
|
|
692
|
+
{
|
|
693
|
+
role: "heading",
|
|
694
|
+
"aria-level": level,
|
|
695
|
+
style: {
|
|
696
|
+
margin: `${marginTop}px 0 6px`,
|
|
697
|
+
fontSize: size,
|
|
698
|
+
fontWeight: level <= 2 ? 700 : 600,
|
|
699
|
+
lineHeight: 1.4,
|
|
700
|
+
color: COLOR.text,
|
|
701
|
+
...level <= 2 ? { paddingBottom: 4, borderBottom: `1px solid ${COLOR.borderSoft}` } : {}
|
|
702
|
+
},
|
|
703
|
+
children: renderInline(text, `${key}-h`)
|
|
704
|
+
},
|
|
705
|
+
key
|
|
706
|
+
);
|
|
707
|
+
}
|
|
708
|
+
function renderList(items, keyPrefix, key) {
|
|
709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { margin: "4px 0" }, children: items.map((item, index) => {
|
|
710
|
+
const indent = item.level * 14;
|
|
711
|
+
const isOrdered = /\d+\./.test(item.marker);
|
|
712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", gap: 6, paddingLeft: indent, lineHeight: 1.65 }, children: [
|
|
713
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { flex: "0 0 auto", minWidth: 12, color: item.checked === true ? COLOR.success : COLOR.secondary, fontFamily: "ui-monospace, monospace", fontSize: "calc(var(--dsw-font-markdown-base-font-size, var(--dsh-content-font-size, 14px)) - 1px)" }, children: item.checked === null ? isOrdered ? item.marker : item.level === 0 ? "\u2022" : "\u25E6" : item.checked ? "\u2611" : "\u2610" }),
|
|
714
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { flex: 1, minWidth: 0, color: item.checked === true ? COLOR.secondary : COLOR.text }, children: renderInline(item.text, `${keyPrefix}-li-${index}`) })
|
|
715
|
+
] }, `${keyPrefix}-li-${index}`);
|
|
716
|
+
}) }, key);
|
|
717
|
+
}
|
|
718
|
+
function renderTable(rows, keyPrefix, key) {
|
|
719
|
+
if (rows.length === 0) return null;
|
|
720
|
+
const [head, ...body] = rows;
|
|
721
|
+
const cellStyle = { padding: "4px 7px", borderBottom: `1px solid ${COLOR.borderSoft}`, textAlign: "left", verticalAlign: "top" };
|
|
722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { margin: "8px 0", overflowX: "auto", border: `1px solid ${COLOR.borderSoft}`, borderRadius: 6 }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("table", { style: { borderCollapse: "collapse", width: "100%", fontSize: "calc(var(--dsw-font-markdown-base-font-size, var(--dsh-content-font-size, 14px)) - 1px)" }, children: [
|
|
723
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: (head ?? []).map((cell, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { style: { ...cellStyle, color: COLOR.secondary, fontWeight: 600, background: COLOR.layer1 }, children: renderInline(cell, `${keyPrefix}-th-${index}`) }, `${keyPrefix}-th-${index}`)) }) }),
|
|
724
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tbody", { children: body.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: row.map((cell, cellIndex) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { style: cellStyle, children: renderInline(cell, `${keyPrefix}-td-${rowIndex}-${cellIndex}`) }, `${keyPrefix}-td-${rowIndex}-${cellIndex}`)) }, `${keyPrefix}-tr-${rowIndex}`)) })
|
|
725
|
+
] }) }, key);
|
|
726
|
+
}
|
|
727
|
+
var INLINE = /(\*\*[^*]+\*\*|`[^`]+`|\[[^\]]+\]\((?:https?:\/\/)[^)\s]+\))/g;
|
|
728
|
+
function renderInline(text, keyPrefix) {
|
|
729
|
+
const nodes = [];
|
|
730
|
+
let last = 0;
|
|
731
|
+
let index = 0;
|
|
732
|
+
for (const match of text.matchAll(INLINE)) {
|
|
733
|
+
const start = match.index ?? 0;
|
|
734
|
+
if (start > last) nodes.push(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react.Fragment, { children: text.slice(last, start) }, `${keyPrefix}-t-${index++}`));
|
|
735
|
+
const token = match[0];
|
|
736
|
+
if (token.startsWith("**") && token.endsWith("**")) {
|
|
737
|
+
nodes.push(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: token.slice(2, -2) }, `${keyPrefix}-b-${index++}`));
|
|
738
|
+
} else if (token.startsWith("`") && token.endsWith("`")) {
|
|
739
|
+
nodes.push(
|
|
740
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { style: { padding: "0 4px", borderRadius: 4, background: COLOR.layer2, border: `1px solid ${COLOR.borderSoft}`, fontFamily: "ui-monospace, SFMono-Regular, Consolas, monospace", fontSize: "0.94em" }, children: token.slice(1, -1) }, `${keyPrefix}-c-${index++}`)
|
|
741
|
+
);
|
|
742
|
+
} else {
|
|
743
|
+
const link = /^\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)$/.exec(token);
|
|
744
|
+
if (link !== null) {
|
|
745
|
+
nodes.push(
|
|
746
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { href: link[2], target: "_blank", rel: "noreferrer noopener", style: { color: COLOR.link, textDecoration: "underline" }, children: link[1] }, `${keyPrefix}-a-${index++}`)
|
|
747
|
+
);
|
|
748
|
+
} else {
|
|
749
|
+
nodes.push(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react.Fragment, { children: token }, `${keyPrefix}-x-${index++}`));
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
last = start + token.length;
|
|
753
|
+
}
|
|
754
|
+
if (last < text.length) nodes.push(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react.Fragment, { children: text.slice(last) }, `${keyPrefix}-t-${index++}`));
|
|
755
|
+
return nodes;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// src/client/flow.tsx
|
|
759
|
+
var import_react2 = require("react");
|
|
760
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
761
|
+
function ProgressButton({ card, style, onOpen, onLeave }) {
|
|
762
|
+
const summary = flowSummary(card);
|
|
763
|
+
const meta = statusMeta(card);
|
|
764
|
+
const color = card.steps === null ? COLOR.secondary : meta.color;
|
|
765
|
+
const arcColor = progressArcColor(card);
|
|
766
|
+
const size = style === "vivid" ? 22 : 20;
|
|
767
|
+
const radius = size / 2 - 2.5;
|
|
768
|
+
const circumference = 2 * Math.PI * radius;
|
|
769
|
+
const offset = circumference * (1 - summary.percent / 100);
|
|
770
|
+
const open = (target) => onOpen(target.getBoundingClientRect());
|
|
771
|
+
if (card.steps === null) {
|
|
772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
773
|
+
"span",
|
|
774
|
+
{
|
|
775
|
+
title: "\u65E7\u5361\u6CA1\u6709 steps \u5757\uFF0C\u65E0\u6CD5\u753B\u6D41\u7A0B\u8FDB\u5EA6",
|
|
776
|
+
style: { display: "inline-flex", alignItems: "center", gap: 4, fontSize: fontPx(10.5), color: COLOR.tertiary, border: `1px dashed ${COLOR.borderSoft}`, borderRadius: 999, padding: "2px 8px", whiteSpace: "nowrap" },
|
|
777
|
+
children: [
|
|
778
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: "list", size: 13 }),
|
|
779
|
+
" \u672A\u62C6\u5206"
|
|
780
|
+
]
|
|
781
|
+
}
|
|
782
|
+
);
|
|
783
|
+
}
|
|
784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
785
|
+
"button",
|
|
786
|
+
{
|
|
787
|
+
type: "button",
|
|
788
|
+
onMouseEnter: (event) => open(event.currentTarget),
|
|
789
|
+
onMouseLeave: onLeave,
|
|
790
|
+
onFocus: (event) => open(event.currentTarget),
|
|
791
|
+
onBlur: onLeave,
|
|
792
|
+
onClick: (event) => {
|
|
793
|
+
event.stopPropagation();
|
|
794
|
+
open(event.currentTarget);
|
|
795
|
+
},
|
|
796
|
+
onKeyDown: (event) => {
|
|
797
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
798
|
+
event.stopPropagation();
|
|
799
|
+
event.preventDefault();
|
|
800
|
+
open(event.currentTarget);
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
title: `\u8FDB\u5EA6 ${summary.done}/${summary.total}${summary.nodeTotal > summary.total ? ` \xB7 ${summary.nodeTotal} \u8282\u70B9` : ""} \xB7 \u60AC\u505C\u67E5\u770B\u6D41\u7A0B${summary.graph ? "\uFF08\u542B\u5206\u652F/\u5FAA\u73AF\uFF09" : ""}`,
|
|
804
|
+
"aria-haspopup": "dialog",
|
|
805
|
+
"aria-label": `\u6D41\u7A0B\u8FDB\u5EA6 ${summary.done}/${summary.total}${summary.nodeTotal > summary.total ? `\uFF0C\u5171 ${summary.nodeTotal} \u4E2A\u8282\u70B9` : ""}\uFF0C\u60AC\u505C\u6216\u805A\u7126\u67E5\u770B\u6D41\u7A0B\u5730\u56FE`,
|
|
806
|
+
style: {
|
|
807
|
+
display: "inline-flex",
|
|
808
|
+
alignItems: "center",
|
|
809
|
+
gap: 5,
|
|
810
|
+
border: `1px solid ${style === "plain" ? COLOR.borderSoft : alpha(color, 30)}`,
|
|
811
|
+
background: style === "vivid" ? tint(color, 10) : "transparent",
|
|
812
|
+
borderRadius: 999,
|
|
813
|
+
padding: style === "plain" ? "0 2px 0 0" : "1px 7px 1px 2px",
|
|
814
|
+
cursor: "pointer",
|
|
815
|
+
color: COLOR.text,
|
|
816
|
+
flex: "0 0 auto"
|
|
817
|
+
},
|
|
818
|
+
children: [
|
|
819
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, "aria-hidden": "true", style: { display: "block" }, children: [
|
|
820
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: size / 2, cy: size / 2, r: radius, fill: "none", stroke: alpha(COLOR.text, 22), strokeWidth: 3.2 }),
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
822
|
+
"circle",
|
|
823
|
+
{
|
|
824
|
+
cx: size / 2,
|
|
825
|
+
cy: size / 2,
|
|
826
|
+
r: radius,
|
|
827
|
+
fill: "none",
|
|
828
|
+
stroke: arcColor,
|
|
829
|
+
strokeWidth: 4.2,
|
|
830
|
+
strokeLinecap: "round",
|
|
831
|
+
strokeDasharray: circumference,
|
|
832
|
+
strokeDashoffset: offset,
|
|
833
|
+
transform: `rotate(-90 ${size / 2} ${size / 2})`
|
|
834
|
+
}
|
|
835
|
+
)
|
|
836
|
+
] }),
|
|
837
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 3, lineHeight: 1.05 }, children: [
|
|
838
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: { fontSize: fontPx(13.5), fontFamily: "ui-monospace, SFMono-Regular, Consolas, monospace", color: COLOR.text }, children: [
|
|
839
|
+
summary.done,
|
|
840
|
+
"/",
|
|
841
|
+
summary.total
|
|
842
|
+
] }),
|
|
843
|
+
summary.graph ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: summary.loops > 0 ? "loop" : summary.decisions > 0 ? "branch" : "retry", size: 11, style: { color } }) : null
|
|
844
|
+
] })
|
|
845
|
+
]
|
|
846
|
+
}
|
|
847
|
+
);
|
|
848
|
+
}
|
|
849
|
+
function FlowPopover({
|
|
850
|
+
card,
|
|
851
|
+
style,
|
|
852
|
+
anchor,
|
|
853
|
+
onEnter,
|
|
854
|
+
onLeave,
|
|
855
|
+
onClose
|
|
856
|
+
}) {
|
|
857
|
+
(0, import_react2.useEffect)(() => {
|
|
858
|
+
const onKey = (event) => {
|
|
859
|
+
if (event.key === "Escape") onClose();
|
|
860
|
+
};
|
|
861
|
+
document.addEventListener("keydown", onKey);
|
|
862
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
863
|
+
}, [onClose]);
|
|
864
|
+
const scroller = (0, import_react2.useRef)(null);
|
|
865
|
+
const currentStepId = card.steps === null ? null : card.steps.current;
|
|
866
|
+
(0, import_react2.useEffect)(() => {
|
|
867
|
+
const box = scroller.current;
|
|
868
|
+
if (box === null) return;
|
|
869
|
+
const row = box.querySelector("[data-flow-current]");
|
|
870
|
+
box.scrollTop = row === null ? 0 : centeredScrollTop(
|
|
871
|
+
{ top: box.getBoundingClientRect().top, scrollTop: box.scrollTop, height: box.clientHeight },
|
|
872
|
+
row.getBoundingClientRect()
|
|
873
|
+
);
|
|
874
|
+
}, [card.id, currentStepId]);
|
|
875
|
+
const summary = flowSummary(card);
|
|
876
|
+
const meta = statusMeta(card);
|
|
877
|
+
const viewportWidth = typeof window === "undefined" ? 1280 : window.innerWidth;
|
|
878
|
+
const viewportHeight = typeof window === "undefined" ? 800 : window.innerHeight;
|
|
879
|
+
const width = Math.min(470, viewportWidth - 24);
|
|
880
|
+
const estimatedHeight = Math.min(430, viewportHeight * 0.72);
|
|
881
|
+
let left = anchor === null ? viewportWidth - width - 16 : anchor.right - width;
|
|
882
|
+
left = Math.max(12, Math.min(left, viewportWidth - width - 12));
|
|
883
|
+
let top = anchor === null ? 64 : anchor.bottom + 8;
|
|
884
|
+
if (top + estimatedHeight > viewportHeight - 12) {
|
|
885
|
+
top = Math.max(12, (anchor === null ? 100 : anchor.top) - estimatedHeight - 8);
|
|
886
|
+
}
|
|
887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
888
|
+
"div",
|
|
889
|
+
{
|
|
890
|
+
role: "dialog",
|
|
891
|
+
"aria-label": `\u4EFB\u52A1 ${card.id} \u7684\u6D41\u7A0B\u8FDB\u5EA6`,
|
|
892
|
+
onMouseEnter: onEnter,
|
|
893
|
+
onMouseLeave: onLeave,
|
|
894
|
+
style: {
|
|
895
|
+
position: "fixed",
|
|
896
|
+
left,
|
|
897
|
+
top,
|
|
898
|
+
zIndex: 110,
|
|
899
|
+
width,
|
|
900
|
+
maxHeight: "min(72vh, 460px)",
|
|
901
|
+
display: "flex",
|
|
902
|
+
flexDirection: "column",
|
|
903
|
+
background: COLOR.bg,
|
|
904
|
+
border: `1px solid ${style === "vivid" ? alpha(meta.color, 45) : COLOR.border}`,
|
|
905
|
+
borderRadius: 10,
|
|
906
|
+
boxShadow: "0 18px 54px rgba(0,0,0,0.3)",
|
|
907
|
+
overflow: "hidden"
|
|
908
|
+
},
|
|
909
|
+
children: [
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", gap: 8, padding: "9px 11px", borderBottom: `1px solid ${COLOR.borderSoft}`, background: style === "vivid" ? tint(meta.color, 7) : COLOR.layer1 }, children: [
|
|
911
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { width: 28, height: 28, borderRadius: 7, display: "inline-flex", alignItems: "center", justifyContent: "center", color: meta.color, background: tint(meta.color, 14), border: `1px solid ${alpha(meta.color, 25)}` }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: meta.icon, size: 16 }) }),
|
|
912
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
913
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: fontPx(12.5), fontWeight: 600, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: card.title ?? card.id }),
|
|
914
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { fontSize: fontPx(10.5), color: COLOR.secondary, display: "flex", gap: 7, flexWrap: "wrap", marginTop: 1 }, children: [
|
|
915
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontFamily: "ui-monospace, monospace" }, children: card.id }),
|
|
916
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
|
|
917
|
+
"\u8FDB\u5EA6 ",
|
|
918
|
+
summary.done,
|
|
919
|
+
"/",
|
|
920
|
+
summary.total
|
|
921
|
+
] }),
|
|
922
|
+
summary.decisions > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: { color: COLOR.link }, children: [
|
|
923
|
+
"\u25C6 ",
|
|
924
|
+
summary.decisions,
|
|
925
|
+
" \u5206\u652F"
|
|
926
|
+
] }) : null,
|
|
927
|
+
summary.loops > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: { color: COLOR.business }, children: [
|
|
928
|
+
"\u21BB ",
|
|
929
|
+
summary.loops,
|
|
930
|
+
" \u5FAA\u73AF"
|
|
931
|
+
] }) : null,
|
|
932
|
+
summary.retries > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: { color: COLOR.warn }, children: [
|
|
933
|
+
"\u21BA ",
|
|
934
|
+
summary.retries,
|
|
935
|
+
" \u91CD\u8BD5"
|
|
936
|
+
] }) : null,
|
|
937
|
+
summary.failed > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: { color: COLOR.error }, children: [
|
|
938
|
+
"! ",
|
|
939
|
+
summary.failed,
|
|
940
|
+
" \u8017\u5C3D"
|
|
941
|
+
] }) : null
|
|
942
|
+
] })
|
|
943
|
+
] }),
|
|
944
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", onClick: onClose, "aria-label": "\u5173\u95ED\u6D41\u7A0B\u5730\u56FE", style: { border: "none", background: "transparent", color: COLOR.secondary, cursor: "pointer", padding: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: "close", size: 16 }) })
|
|
945
|
+
] }),
|
|
946
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ref: scroller, style: { flex: 1, minHeight: 0, overflowY: "auto", padding: "9px 11px" }, children: card.steps === null ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: fontPx(12), color: COLOR.secondary }, children: "\u65E7\u5361\u6CA1\u6709 steps \u5757\uFF0C\u6D41\u7A0B\u4E0D\u53EF\u753B\u3002" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FlowMap, { card, style }) }),
|
|
947
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { borderTop: `1px solid ${COLOR.borderSoft}`, padding: "7px 11px", fontSize: fontPx(10), color: COLOR.tertiary, display: "flex", flexWrap: "wrap", gap: 8 }, children: [
|
|
948
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "\u2713 \u5B8C\u6210" }),
|
|
949
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "\u2192 \u5F53\u524D" }),
|
|
950
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { color: COLOR.link }, children: "\u25C6 \u6761\u4EF6\u5206\u652F" }),
|
|
951
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { color: COLOR.business }, children: "\u21BB \u53EF\u6570\u5FAA\u73AF" }),
|
|
952
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { color: COLOR.warn }, children: "\u21BA \u91CD\u8BD5" }),
|
|
953
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "\u21B7 \u8DF3\u8FC7/\u653E\u5F03" }),
|
|
954
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { marginLeft: "auto" }, children: "goto / \u5E76\u884C\u4E0D\u5728\u6838\u5FC3\u5951\u7EA6\u5185\uFF08\xA73.7\uFF09" })
|
|
955
|
+
] })
|
|
956
|
+
]
|
|
957
|
+
}
|
|
958
|
+
);
|
|
959
|
+
}
|
|
960
|
+
function FlowMap({ card, style }) {
|
|
961
|
+
const steps = card.steps;
|
|
962
|
+
if (steps === null) return null;
|
|
963
|
+
const nodes = steps.nodes.map(normalizeNode);
|
|
964
|
+
const byId = new Map(nodes.map((node) => [node.id, node]));
|
|
965
|
+
const bodyIds = new Set(nodes.flatMap((node) => node.loop?.body ?? []));
|
|
966
|
+
const branchIds = new Set(nodes.flatMap((node) => node.branches.map((branch) => branch.go).filter((id) => id !== null)));
|
|
967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: nodes.map((node) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
968
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
969
|
+
NodeRow,
|
|
970
|
+
{
|
|
971
|
+
node,
|
|
972
|
+
current: steps.current === node.id,
|
|
973
|
+
style,
|
|
974
|
+
extraIndent: Math.min(2, (bodyIds.has(node.id) ? 1 : 0) + (branchIds.has(node.id) ? 1 : 0))
|
|
975
|
+
}
|
|
976
|
+
),
|
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Edges, { node, byId })
|
|
978
|
+
] }, node.id)) });
|
|
979
|
+
}
|
|
980
|
+
function normalizeNode(node) {
|
|
981
|
+
return {
|
|
982
|
+
...node,
|
|
983
|
+
kind: node.kind ?? "step",
|
|
984
|
+
skill: node.skill ?? null,
|
|
985
|
+
branches: node.branches ?? [],
|
|
986
|
+
loop: node.loop ?? null,
|
|
987
|
+
retry: node.retry ?? null,
|
|
988
|
+
exhausted: node.exhausted ?? null,
|
|
989
|
+
pass: node.pass ?? null,
|
|
990
|
+
failed: node.failed ?? false
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
function nodeColor(node) {
|
|
994
|
+
if (node.status === "done") return COLOR.success;
|
|
995
|
+
if (node.status === "doing") return COLOR.business;
|
|
996
|
+
if (node.status === "blocked" || node.status === "failed" || node.failed) return COLOR.error;
|
|
997
|
+
if (node.status === "skipped" || node.status === "waived") return COLOR.tertiary;
|
|
998
|
+
return COLOR.secondary;
|
|
999
|
+
}
|
|
1000
|
+
function NodeRow({ node, current, style, extraIndent = 0 }) {
|
|
1001
|
+
const visual = nodeVisual(node);
|
|
1002
|
+
const color = nodeColor(node);
|
|
1003
|
+
const kindLabel = node.kind === "decision" ? "\u6761\u4EF6\u5206\u652F" : node.kind === "loop" ? "\u5FAA\u73AF" : null;
|
|
1004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1005
|
+
"div",
|
|
1006
|
+
{
|
|
1007
|
+
"data-flow-current": current ? "" : void 0,
|
|
1008
|
+
style: {
|
|
1009
|
+
display: "flex",
|
|
1010
|
+
alignItems: "flex-start",
|
|
1011
|
+
gap: 7,
|
|
1012
|
+
padding: "3px 6px",
|
|
1013
|
+
marginLeft: (node.depth - 1) * 14 + extraIndent * 14,
|
|
1014
|
+
borderRadius: 5,
|
|
1015
|
+
border: `1px solid ${current ? alpha(color, 40) : "transparent"}`,
|
|
1016
|
+
background: current ? style === "vivid" ? tint(color, 12) : COLOR.layer1 : "transparent"
|
|
1017
|
+
},
|
|
1018
|
+
children: [
|
|
1019
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-hidden": "true", style: { width: 13, flex: "0 0 auto", textAlign: "center", color, fontFamily: "ui-monospace, monospace", fontSize: fontPx(12), lineHeight: fontPx(18) }, children: visual.glyph }),
|
|
1020
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontFamily: "ui-monospace, monospace", fontSize: fontPx(11), color: node.status === "skipped" || node.status === "waived" ? COLOR.tertiary : COLOR.text, flex: "0 0 auto", lineHeight: fontPx(18) }, children: node.id }),
|
|
1021
|
+
node.skill === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1022
|
+
"span",
|
|
1023
|
+
{
|
|
1024
|
+
title: `\u6309 ${node.skill} \u89C4\u8303\u6267\u884C`,
|
|
1025
|
+
style: { fontSize: fontPx(9), lineHeight: fontPx(15), padding: "0 4px", borderRadius: 999, color: COLOR.link, border: `1px solid ${alpha(COLOR.link, 30)}`, flex: "0 0 auto", whiteSpace: "nowrap" },
|
|
1026
|
+
children: [
|
|
1027
|
+
"skill:",
|
|
1028
|
+
node.skill
|
|
1029
|
+
]
|
|
1030
|
+
}
|
|
1031
|
+
),
|
|
1032
|
+
kindLabel === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontSize: fontPx(9), lineHeight: fontPx(15), padding: "0 4px", borderRadius: 999, color: node.kind === "decision" ? COLOR.link : COLOR.business, border: `1px solid ${alpha(node.kind === "decision" ? COLOR.link : COLOR.business, 30)}`, flex: "0 0 auto" }, children: kindLabel }),
|
|
1033
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { flex: 1, minWidth: 0, fontSize: fontPx(11.5), lineHeight: fontPx(18), color: node.status === "skipped" || node.status === "waived" ? COLOR.tertiary : current ? COLOR.text : COLOR.secondary, textDecoration: node.status === "skipped" || node.status === "waived" ? "line-through" : "none" }, children: node.text ?? "\uFF08\u65E0\u63CF\u8FF0\uFF09" }),
|
|
1034
|
+
current ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontSize: fontPx(9.5), color, flex: "0 0 auto", lineHeight: fontPx(18) }, children: "\u5F53\u524D" }) : null,
|
|
1035
|
+
node.failed ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontSize: fontPx(9.5), color: COLOR.error, flex: "0 0 auto", lineHeight: fontPx(18) }, children: "\u91CD\u8BD5\u8017\u5C3D" }) : null,
|
|
1036
|
+
node.block !== null ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontSize: fontPx(9.5), color: COLOR.error, flex: "0 0 auto", lineHeight: fontPx(18) }, children: "\u963B\u585E" }) : null
|
|
1037
|
+
]
|
|
1038
|
+
}
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
function Edges({ node, byId }) {
|
|
1042
|
+
const blocks = [];
|
|
1043
|
+
const stateOf = (target2) => {
|
|
1044
|
+
if (target2 === null || target2 === "") return { label: "\u672A\u5199", color: COLOR.tertiary };
|
|
1045
|
+
if (target2 === "end") return { label: "\u7ED3\u675F", color: COLOR.secondary };
|
|
1046
|
+
const found = byId.get(target2);
|
|
1047
|
+
if (found === void 0) return { label: "\u7F3A\u5931", color: COLOR.error };
|
|
1048
|
+
if (found.checked || found.status === "done") return { label: "\u5DF2\u5B8C\u6210", color: COLOR.success };
|
|
1049
|
+
if (found.status === "doing") return { label: "\u5F53\u524D", color: COLOR.business };
|
|
1050
|
+
if (found.status === "skipped" || found.status === "waived") return { label: "\u672A\u9009", color: COLOR.tertiary };
|
|
1051
|
+
if (found.status === "blocked") return { label: "\u963B\u585E", color: COLOR.error };
|
|
1052
|
+
if (found.status === "failed") return { label: "\u8017\u5C3D", color: COLOR.error };
|
|
1053
|
+
return { label: "\u5F85\u8D70", color: COLOR.secondary };
|
|
1054
|
+
};
|
|
1055
|
+
const target = (id) => {
|
|
1056
|
+
const state = stateOf(id);
|
|
1057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
|
|
1058
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontFamily: "ui-monospace, monospace", color: COLOR.secondary }, children: id ?? "\u2014" }),
|
|
1059
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { color: state.color, fontSize: fontPx(9.5) }, children: state.label })
|
|
1060
|
+
] });
|
|
1061
|
+
};
|
|
1062
|
+
if (node.kind === "decision") {
|
|
1063
|
+
blocks.push(
|
|
1064
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Lane, { color: COLOR.link, children: [
|
|
1065
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { color: node.decisionRef === null ? COLOR.warn : COLOR.link }, children: node.decisionRef === null ? "\u6761\u4EF6\u5206\u652F\u5C1A\u672A\u9489\u51B3\u7B56\uFF1B\u4E24\u6761\u8DEF\u5F84\u90FD\u4FDD\u7559" : `\u5DF2\u9489\u51B3\u7B56 ${node.decisionRef}\uFF08\u539F\u56E0\u89C1\u300C\u5173\u952E\u51B3\u7B56\u300D\uFF09` }),
|
|
1066
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { borderLeft: `1px solid ${alpha(COLOR.link, 26)}`, marginLeft: 3, paddingLeft: 8, display: "flex", flexDirection: "column", gap: 2 }, children: node.branches.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { color: COLOR.tertiary }, children: "\uFF08\u6CA1\u6709\u53EF\u89E3\u6790\u7684\u5206\u652F\uFF09" }) : node.branches.map((branch, index) => {
|
|
1067
|
+
const state = stateOf(branch.go);
|
|
1068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", alignItems: "baseline", gap: 4 }, children: [
|
|
1069
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { color: COLOR.border, fontFamily: "monospace" }, children: index === node.branches.length - 1 ? "\u2514" : "\u251C" }),
|
|
1070
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: "branch", size: 12, style: { color: state.color } }),
|
|
1071
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: { color: state.color }, children: [
|
|
1072
|
+
"\u5982\u679C ",
|
|
1073
|
+
branch.condition ?? "\uFF08\u65E0\u6807\u7B7E\uFF09"
|
|
1074
|
+
] }),
|
|
1075
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { color: COLOR.tertiary }, children: "\u2192" }),
|
|
1076
|
+
target(branch.go),
|
|
1077
|
+
state.label === "\u672A\u9009" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: { color: COLOR.tertiary }, children: [
|
|
1078
|
+
"\uFF08",
|
|
1079
|
+
node.decisionRef ?? "\u7559\u75D5",
|
|
1080
|
+
"\uFF09"
|
|
1081
|
+
] }) : null
|
|
1082
|
+
] }, `${node.id}-b-${branch.go}-${index}`);
|
|
1083
|
+
}) })
|
|
1084
|
+
] }, `${node.id}-decision`)
|
|
1085
|
+
);
|
|
1086
|
+
}
|
|
1087
|
+
if (node.kind === "loop") {
|
|
1088
|
+
const loop = node.loop;
|
|
1089
|
+
if (loop !== null) {
|
|
1090
|
+
blocks.push(
|
|
1091
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Lane, { color: COLOR.business, children: [
|
|
1092
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { color: COLOR.business }, children: [
|
|
1093
|
+
"\u21BB \u904D\u5386 ",
|
|
1094
|
+
loop.over ?? "\uFF08\u672A\u5199 over\uFF09",
|
|
1095
|
+
loop.overCount === null ? "" : `\uFF08${loop.overCount} \u9879\uFF09`,
|
|
1096
|
+
" \xB7 \u8FED\u4EE3 ",
|
|
1097
|
+
loop.iter === null ? "\u2014" : `${loop.iter.done ?? 0}/${loop.iter.total ?? "?"}`
|
|
1098
|
+
] }),
|
|
1099
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { borderLeft: `1px solid ${alpha(COLOR.business, 28)}`, marginLeft: 3, paddingLeft: 8, display: "flex", flexDirection: "column", gap: 2 }, children: [
|
|
1100
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { color: COLOR.tertiary }, children: "\u4F53" }),
|
|
1101
|
+
loop.body.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { color: COLOR.tertiary }, children: "\uFF08\u672A\u5199 body\uFF09" }) : loop.body.map((id, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", alignItems: "baseline", gap: 4 }, children: [
|
|
1102
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { color: COLOR.border, fontFamily: "monospace" }, children: index === loop.body.length - 1 ? "\u2514" : "\u251C" }),
|
|
1103
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontFamily: "ui-monospace, monospace", color: COLOR.secondary }, children: id }),
|
|
1104
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { color: stateOf(id).color, fontSize: fontPx(9.5) }, children: stateOf(id).label })
|
|
1105
|
+
] }, `${node.id}-body-${id}`)),
|
|
1106
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { color: COLOR.tertiary }, children: [
|
|
1107
|
+
"\u51FA\u53E3 \u2192 ",
|
|
1108
|
+
target(loop.exit)
|
|
1109
|
+
] })
|
|
1110
|
+
] })
|
|
1111
|
+
] }, `${node.id}-loop`)
|
|
1112
|
+
);
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
if (node.retry !== null) {
|
|
1116
|
+
const state = node.failed ? COLOR.error : COLOR.warn;
|
|
1117
|
+
blocks.push(
|
|
1118
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Lane, { color: state, children: [
|
|
1119
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { color: state }, children: [
|
|
1120
|
+
"\u21BA \u91CD\u8BD5 ",
|
|
1121
|
+
node.retry.done ?? 0,
|
|
1122
|
+
"/",
|
|
1123
|
+
node.retry.total ?? "?",
|
|
1124
|
+
node.failed ? " \xB7 \u5DF2\u8017\u5C3D\u4E14\u672A\u5B8C\u6210" : ""
|
|
1125
|
+
] }),
|
|
1126
|
+
node.pass === null && node.exhausted === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { borderLeft: `1px solid ${alpha(state, 26)}`, marginLeft: 3, paddingLeft: 8, display: "flex", flexDirection: "column", gap: 2 }, children: [
|
|
1127
|
+
node.pass === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
1128
|
+
"\u901A\u8FC7 \u2192 ",
|
|
1129
|
+
target(node.pass)
|
|
1130
|
+
] }),
|
|
1131
|
+
node.exhausted === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
1132
|
+
"\u8017\u5C3D \u2192 ",
|
|
1133
|
+
target(node.exhausted)
|
|
1134
|
+
] })
|
|
1135
|
+
] })
|
|
1136
|
+
] }, `${node.id}-retry`)
|
|
1137
|
+
);
|
|
1138
|
+
} else if (node.pass !== null || node.exhausted !== null) {
|
|
1139
|
+
blocks.push(
|
|
1140
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Lane, { color: COLOR.warn, children: [
|
|
1141
|
+
node.pass === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
1142
|
+
"\u901A\u8FC7 \u2192 ",
|
|
1143
|
+
target(node.pass)
|
|
1144
|
+
] }),
|
|
1145
|
+
node.exhausted === null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
1146
|
+
"\u8017\u5C3D \u2192 ",
|
|
1147
|
+
target(node.exhausted)
|
|
1148
|
+
] })
|
|
1149
|
+
] }, `${node.id}-exit`)
|
|
1150
|
+
);
|
|
1151
|
+
}
|
|
1152
|
+
if (node.kind === "step" && node.next !== null) {
|
|
1153
|
+
blocks.push(
|
|
1154
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { paddingLeft: 16, display: "flex", alignItems: "baseline", gap: 4, fontSize: fontPx(10.5), color: COLOR.secondary }, children: [
|
|
1155
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { color: COLOR.border, fontFamily: "monospace" }, children: "\u2514" }),
|
|
1156
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { name: "chevronRight", size: 12, style: { color: COLOR.tertiary } }),
|
|
1157
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { color: COLOR.tertiary }, children: "\u4E0B\u4E00\u6B65" }),
|
|
1158
|
+
target(node.next)
|
|
1159
|
+
] }, `${node.id}-next`)
|
|
1160
|
+
);
|
|
1161
|
+
}
|
|
1162
|
+
if (node.block !== null) {
|
|
1163
|
+
blocks.push(
|
|
1164
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { paddingLeft: 16, fontSize: fontPx(10.5), lineHeight: fontPx(18), color: COLOR.error }, children: [
|
|
1165
|
+
"\u26D4 \u963B\u585E\uFF1A",
|
|
1166
|
+
node.block
|
|
1167
|
+
] }, `${node.id}-block`)
|
|
1168
|
+
);
|
|
1169
|
+
}
|
|
1170
|
+
if (blocks.length === 0) return null;
|
|
1171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 3, margin: "1px 0 4px" }, children: blocks });
|
|
1172
|
+
}
|
|
1173
|
+
function Lane({ color, children }) {
|
|
1174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1175
|
+
"div",
|
|
1176
|
+
{
|
|
1177
|
+
style: {
|
|
1178
|
+
marginLeft: 14,
|
|
1179
|
+
borderLeft: `2px solid ${alpha(color, 38)}`,
|
|
1180
|
+
paddingLeft: 8,
|
|
1181
|
+
display: "flex",
|
|
1182
|
+
flexDirection: "column",
|
|
1183
|
+
gap: 2,
|
|
1184
|
+
fontSize: fontPx(10.5),
|
|
1185
|
+
lineHeight: fontPx(18)
|
|
1186
|
+
},
|
|
1187
|
+
children
|
|
1188
|
+
}
|
|
1189
|
+
);
|
|
1190
|
+
}
|
|
1191
|
+
function StatusDot({ card, size = 7 }) {
|
|
1192
|
+
const meta = statusMeta(card);
|
|
1193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-hidden": "true", style: { width: size, height: size, borderRadius: 999, background: meta.color, display: "inline-block", flex: "0 0 auto" } });
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
// src/client/index.tsx
|
|
1197
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1198
|
+
var inject = ["slots", "sidebarRightTabs", "sidebarRight", "remote", "remote.session"];
|
|
1199
|
+
var PANEL_ID = PLUGIN_ID;
|
|
1200
|
+
var TAB_KIND = "task-card";
|
|
1201
|
+
var DISPLAY_NAME = "\u4EFB\u52A1\u5361";
|
|
1202
|
+
var STYLE_KEY = "dsh.task-card.style";
|
|
1203
|
+
var runtime = {};
|
|
1204
|
+
var runtimeContext = null;
|
|
1205
|
+
var CURRENT_SESSION_KEY = "dsh.sessions.current";
|
|
1206
|
+
function persistedSessionId(raw) {
|
|
1207
|
+
if (raw === null || raw === "") return null;
|
|
1208
|
+
try {
|
|
1209
|
+
const value = JSON.parse(raw);
|
|
1210
|
+
if (typeof value === "string") return value;
|
|
1211
|
+
if (value !== null && typeof value === "object") {
|
|
1212
|
+
const record = value;
|
|
1213
|
+
if (typeof record.sessionId === "string") return record.sessionId;
|
|
1214
|
+
const nested = record.state;
|
|
1215
|
+
if (nested !== null && typeof nested === "object" && typeof nested.sessionId === "string") {
|
|
1216
|
+
return nested.sessionId;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
} catch {
|
|
1220
|
+
}
|
|
1221
|
+
return null;
|
|
1222
|
+
}
|
|
1223
|
+
function workspacePathForSession(items, sessionId) {
|
|
1224
|
+
if (sessionId === null) return null;
|
|
1225
|
+
const item = items.find((candidate) => candidate.sessionIds.includes(sessionId));
|
|
1226
|
+
return item === void 0 ? null : item.path;
|
|
1227
|
+
}
|
|
1228
|
+
function sessionCwdForSession(byId, sessionId) {
|
|
1229
|
+
if (sessionId === null) return null;
|
|
1230
|
+
const cwd = byId[sessionId]?.cwd;
|
|
1231
|
+
return typeof cwd === "string" && cwd !== "" ? cwd : null;
|
|
1232
|
+
}
|
|
1233
|
+
function normalizedDir(value) {
|
|
1234
|
+
return value.replace(/[\\/]+$/, "");
|
|
1235
|
+
}
|
|
1236
|
+
function currentSessionId() {
|
|
1237
|
+
try {
|
|
1238
|
+
return persistedSessionId(localStorage.getItem(CURRENT_SESSION_KEY));
|
|
1239
|
+
} catch {
|
|
1240
|
+
return null;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
function resolveClientProjectTarget(services = runtime, sessionId = currentSessionId()) {
|
|
1244
|
+
try {
|
|
1245
|
+
const sessions = services.sessions ?? runtimeContext?.get?.("sessions");
|
|
1246
|
+
const workspaces = services.workspaces ?? runtimeContext?.get?.("workspaces");
|
|
1247
|
+
const items = workspaces?.list.getSnapshot().items ?? [];
|
|
1248
|
+
const owner = sessionId === null ? void 0 : items.find((candidate) => candidate.sessionIds.includes(sessionId));
|
|
1249
|
+
const cwd = sessionCwdForSession(sessions?.list?.getSnapshot().byId ?? {}, sessionId);
|
|
1250
|
+
const byCwd = cwd === null ? void 0 : items.find((candidate) => normalizedDir(candidate.path) === normalizedDir(cwd));
|
|
1251
|
+
return {
|
|
1252
|
+
path: cwd ?? owner?.path ?? byCwd?.path ?? null,
|
|
1253
|
+
workspaceId: owner?.workspaceId ?? byCwd?.workspaceId ?? null
|
|
1254
|
+
};
|
|
1255
|
+
} catch {
|
|
1256
|
+
return { path: null, workspaceId: null };
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
function resolveClientProjectRoot(services = runtime) {
|
|
1260
|
+
return resolveClientProjectTarget(services).path;
|
|
1261
|
+
}
|
|
1262
|
+
function sessionCreateOptions(target) {
|
|
1263
|
+
return target.workspaceId === null ? null : { workspaceId: target.workspaceId };
|
|
1264
|
+
}
|
|
1265
|
+
function captureRuntime(ctx) {
|
|
1266
|
+
const get = (name) => {
|
|
1267
|
+
try {
|
|
1268
|
+
return ctx.get?.(name);
|
|
1269
|
+
} catch {
|
|
1270
|
+
return void 0;
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1273
|
+
return {
|
|
1274
|
+
sessions: get("sessions"),
|
|
1275
|
+
uiWorkspace: get("uiWorkspace"),
|
|
1276
|
+
conversation: get("conversation"),
|
|
1277
|
+
remote: get("remote"),
|
|
1278
|
+
workspaces: get("workspaces"),
|
|
1279
|
+
sidebarRight: get("sidebarRight")
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
function joinProjectPath(projectRoot, rel) {
|
|
1283
|
+
const base = projectRoot.replace(/[\\/]+$/, "");
|
|
1284
|
+
const child = rel.replace(/^[\\/]+/, "");
|
|
1285
|
+
return child === "" ? base : `${base}/${child}`;
|
|
1286
|
+
}
|
|
1287
|
+
function windowsPath(path) {
|
|
1288
|
+
return path.replace(/\//g, "\\");
|
|
1289
|
+
}
|
|
1290
|
+
function continuePrompt(id) {
|
|
1291
|
+
return `\u7EE7\u7EED\u4EFB\u52A1 ${id}`;
|
|
1292
|
+
}
|
|
1293
|
+
function reopenPrompt(id) {
|
|
1294
|
+
return `\u91CD\u5F00\u4EFB\u52A1 ${id}\uFF08\u4ECE\u5DF2\u5B8C\u6210/\u5F52\u6863\u6062\u590D\u4E3A active\uFF0C\u4FDD\u7559\u539F\u5361\u3001\u539F\u76EE\u6807\u548C\u6267\u884C\u53F2\uFF09`;
|
|
1295
|
+
}
|
|
1296
|
+
function buildNewTaskPrompt(title, category, goal) {
|
|
1297
|
+
const meta = categoryMeta(category);
|
|
1298
|
+
const lines = [
|
|
1299
|
+
`\u5F00\u4EFB\u52A1 ${title.trim()}`,
|
|
1300
|
+
`\u4EFB\u52A1\u6027\u8D28\uFF1A${meta.label}${category === null ? "" : `\uFF08category: ${category}\uFF09`}`
|
|
1301
|
+
];
|
|
1302
|
+
const trimmed = goal.trim();
|
|
1303
|
+
if (trimmed !== "") lines.push(`\u4E00\u53E5\u8BDD\u76EE\u6807\uFF1A${trimmed}`);
|
|
1304
|
+
return lines.join("\n");
|
|
1305
|
+
}
|
|
1306
|
+
function errorText(error) {
|
|
1307
|
+
return error instanceof Error ? error.message : String(error);
|
|
1308
|
+
}
|
|
1309
|
+
function sessionFileAddress(sessionId, path) {
|
|
1310
|
+
const encodeSegment = (segment) => encodeURIComponent(segment).replace(/%3A/gi, ":");
|
|
1311
|
+
const normalized = path.replace(/\\/g, "/").replace(/^(?:\.\/)+/, "");
|
|
1312
|
+
const encodedPath = normalized.split("/").map(encodeSegment).join("/");
|
|
1313
|
+
return `dsh-resource://file/session/${encodeSegment(sessionId)}/${encodedPath}`;
|
|
1314
|
+
}
|
|
1315
|
+
function isInsideDirectory(base, path) {
|
|
1316
|
+
const normalize = (value) => value.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
1317
|
+
const root = normalize(base);
|
|
1318
|
+
if (root === "") return false;
|
|
1319
|
+
const windows = /^[A-Za-z]:[\\/]/.test(base) || /^[\\/]{2}/.test(base);
|
|
1320
|
+
const fold = (value) => windows ? value.toLowerCase() : value;
|
|
1321
|
+
const folder = fold(root);
|
|
1322
|
+
const target = fold(normalize(path));
|
|
1323
|
+
return target === folder || target.startsWith(`${folder}/`);
|
|
1324
|
+
}
|
|
1325
|
+
var DETAIL_FONT = {
|
|
1326
|
+
title: fontPx(15),
|
|
1327
|
+
body: fontPx(13),
|
|
1328
|
+
smallBody: fontPx(12),
|
|
1329
|
+
small: fontPx(11),
|
|
1330
|
+
tiny: fontPx(10),
|
|
1331
|
+
micro: fontPx(9.5)
|
|
1332
|
+
};
|
|
1333
|
+
function secondaryText(extra = {}) {
|
|
1334
|
+
return { color: COLOR.secondary, fontSize: DETAIL_FONT.small, lineHeight: 1.45, ...extra };
|
|
1335
|
+
}
|
|
1336
|
+
function ActionButton({ children, icon, onClick, tone = "secondary", style, disabled = false, title, compact = false }) {
|
|
1337
|
+
const [hover, setHover] = (0, import_react3.useState)(false);
|
|
1338
|
+
const vivid = style === "vivid";
|
|
1339
|
+
const primary = tone === "primary";
|
|
1340
|
+
const danger = tone === "danger";
|
|
1341
|
+
const color = primary ? COLOR.onColor : danger ? COLOR.error : COLOR.text;
|
|
1342
|
+
const background = disabled ? COLOR.layer1 : primary ? hover ? COLOR.brand : tint(COLOR.brand, 88) : danger ? hover ? tint(COLOR.error, 14) : "transparent" : hover ? vivid ? COLOR.cardHover : COLOR.hover : "transparent";
|
|
1343
|
+
const border = primary ? "none" : `1px solid ${danger ? alpha(COLOR.error, 40) : COLOR.borderSoft}`;
|
|
1344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1345
|
+
"button",
|
|
1346
|
+
{
|
|
1347
|
+
type: "button",
|
|
1348
|
+
title,
|
|
1349
|
+
disabled,
|
|
1350
|
+
onMouseEnter: () => setHover(true),
|
|
1351
|
+
onMouseLeave: () => setHover(false),
|
|
1352
|
+
onClick: (event) => {
|
|
1353
|
+
event.stopPropagation();
|
|
1354
|
+
onClick();
|
|
1355
|
+
},
|
|
1356
|
+
onKeyDown: (event) => event.stopPropagation(),
|
|
1357
|
+
style: {
|
|
1358
|
+
display: "inline-flex",
|
|
1359
|
+
alignItems: "center",
|
|
1360
|
+
justifyContent: "center",
|
|
1361
|
+
gap: style === "plain" ? 0 : 5,
|
|
1362
|
+
fontSize: compact ? fontPx(12) : fontPx(12.5),
|
|
1363
|
+
lineHeight: compact ? fontPx(23) : fontPx(24),
|
|
1364
|
+
padding: compact ? "1px 9px" : "2px 10px",
|
|
1365
|
+
borderRadius: 7,
|
|
1366
|
+
border,
|
|
1367
|
+
background,
|
|
1368
|
+
color: disabled ? COLOR.tertiary : color,
|
|
1369
|
+
cursor: disabled ? "default" : "pointer",
|
|
1370
|
+
opacity: disabled ? 0.7 : 1,
|
|
1371
|
+
whiteSpace: "nowrap",
|
|
1372
|
+
transition: "background 140ms ease, color 140ms ease"
|
|
1373
|
+
},
|
|
1374
|
+
children: [
|
|
1375
|
+
icon === void 0 || style === "plain" ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: icon, size: compact ? 13 : 14 }),
|
|
1376
|
+
children
|
|
1377
|
+
]
|
|
1378
|
+
}
|
|
1379
|
+
);
|
|
1380
|
+
}
|
|
1381
|
+
function CopyPathButton({ style, relativePath, absolutePath, onCopy }) {
|
|
1382
|
+
const [open, setOpen] = (0, import_react3.useState)(false);
|
|
1383
|
+
const item = (kind, label, value) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1384
|
+
"button",
|
|
1385
|
+
{
|
|
1386
|
+
type: "button",
|
|
1387
|
+
onClick: () => {
|
|
1388
|
+
onCopy(kind);
|
|
1389
|
+
setOpen(false);
|
|
1390
|
+
},
|
|
1391
|
+
style: { display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 2, border: "none", background: "transparent", padding: "5px 7px", borderRadius: 5, cursor: "pointer", textAlign: "left", color: COLOR.text },
|
|
1392
|
+
children: [
|
|
1393
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontSize: fontPx(10.5) }, children: label }),
|
|
1394
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontSize: fontPx(9.5), color: COLOR.secondary, fontFamily: "ui-monospace, monospace", wordBreak: "break-all" }, children: value })
|
|
1395
|
+
]
|
|
1396
|
+
}
|
|
1397
|
+
);
|
|
1398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { position: "relative", display: "inline-flex" }, children: [
|
|
1399
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, icon: "copy", onClick: () => setOpen((value) => !value), title: "\u590D\u5236\u4EFB\u52A1\u6587\u4EF6\u5939\u8DEF\u5F84", children: "\u590D\u5236\u8DEF\u5F84" }),
|
|
1400
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1401
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { onClick: (event) => {
|
|
1402
|
+
event.stopPropagation();
|
|
1403
|
+
setOpen(false);
|
|
1404
|
+
}, style: { position: "fixed", inset: 0, zIndex: 40 } }),
|
|
1405
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { onClick: (event) => event.stopPropagation(), style: { position: "absolute", left: 0, top: "calc(100% + 4px)", zIndex: 41, width: 320, maxWidth: "calc(100vw - 24px)", background: COLOR.bg, border: `1px solid ${COLOR.border}`, borderRadius: 8, boxShadow: "0 10px 32px rgba(0,0,0,0.25)", padding: 5 }, children: [
|
|
1406
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: fontPx(9.5), color: COLOR.tertiary, padding: "2px 7px 4px" }, children: "\u590D\u5236\u4EFB\u52A1\u6587\u4EF6\u5939" }),
|
|
1407
|
+
item("relative", "\u76F8\u5BF9\u8DEF\u5F84", relativePath),
|
|
1408
|
+
item("absolute", "\u7EDD\u5BF9\u8DEF\u5F84", absolutePath)
|
|
1409
|
+
] })
|
|
1410
|
+
] }) : null
|
|
1411
|
+
] });
|
|
1412
|
+
}
|
|
1413
|
+
function TaskFilesButton({ style, compact = false, cardId, projectRoot, onOpenFile, onOpenFileExternal }) {
|
|
1414
|
+
const trigger = (0, import_react3.useRef)(null);
|
|
1415
|
+
const [open, setOpen] = (0, import_react3.useState)(false);
|
|
1416
|
+
const [anchor, setAnchor] = (0, import_react3.useState)(null);
|
|
1417
|
+
const [expanded, setExpanded] = (0, import_react3.useState)(/* @__PURE__ */ new Set());
|
|
1418
|
+
const [state, setState] = (0, import_react3.useState)({ loading: false, error: null, data: null });
|
|
1419
|
+
(0, import_react3.useEffect)(() => {
|
|
1420
|
+
if (!open) return;
|
|
1421
|
+
let cancelled = false;
|
|
1422
|
+
setState({ loading: true, error: null, data: null });
|
|
1423
|
+
void requestTaskFiles(cardId, projectRoot).then((data) => {
|
|
1424
|
+
if (cancelled) return;
|
|
1425
|
+
setState({ loading: false, error: null, data });
|
|
1426
|
+
setExpanded(new Set(data.entries.filter((entry) => entry.kind === "dir").map((entry) => entry.path)));
|
|
1427
|
+
}).catch((cause) => {
|
|
1428
|
+
if (!cancelled) setState({ loading: false, error: errorText(cause), data: null });
|
|
1429
|
+
});
|
|
1430
|
+
return () => {
|
|
1431
|
+
cancelled = true;
|
|
1432
|
+
};
|
|
1433
|
+
}, [open, cardId, projectRoot]);
|
|
1434
|
+
const toggle = (path) => {
|
|
1435
|
+
setExpanded((current) => {
|
|
1436
|
+
const next = new Set(current);
|
|
1437
|
+
if (next.has(path)) next.delete(path);
|
|
1438
|
+
else next.add(path);
|
|
1439
|
+
return next;
|
|
1440
|
+
});
|
|
1441
|
+
};
|
|
1442
|
+
const renderEntries = (entries, depth) => entries.map((entry) => {
|
|
1443
|
+
const dir = entry.kind === "dir";
|
|
1444
|
+
const isOpen = dir && expanded.has(entry.path);
|
|
1445
|
+
const rowStyle = {
|
|
1446
|
+
display: "flex",
|
|
1447
|
+
alignItems: "center",
|
|
1448
|
+
gap: 4,
|
|
1449
|
+
border: "none",
|
|
1450
|
+
background: "transparent",
|
|
1451
|
+
padding: `3px 6px 3px ${6 + depth * 13}px`,
|
|
1452
|
+
borderRadius: 4,
|
|
1453
|
+
cursor: "pointer",
|
|
1454
|
+
textAlign: "left",
|
|
1455
|
+
color: entry.name === "task.md" ? COLOR.text : COLOR.secondary,
|
|
1456
|
+
fontSize: fontPx(11),
|
|
1457
|
+
lineHeight: fontPx(17)
|
|
1458
|
+
};
|
|
1459
|
+
const name = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: entry.name });
|
|
1460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
1461
|
+
dir ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1462
|
+
"button",
|
|
1463
|
+
{
|
|
1464
|
+
type: "button",
|
|
1465
|
+
onClick: (event) => {
|
|
1466
|
+
event.stopPropagation();
|
|
1467
|
+
toggle(entry.path);
|
|
1468
|
+
},
|
|
1469
|
+
title: isOpen ? "\u6536\u8D77\u6587\u4EF6\u5939" : "\u5C55\u5F00\u6587\u4EF6\u5939",
|
|
1470
|
+
style: { ...rowStyle, width: "100%" },
|
|
1471
|
+
children: [
|
|
1472
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: isOpen ? "chevronDown" : "chevronRight", size: 11 }),
|
|
1473
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "folder", size: 12 }),
|
|
1474
|
+
name
|
|
1475
|
+
]
|
|
1476
|
+
}
|
|
1477
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1478
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1479
|
+
"button",
|
|
1480
|
+
{
|
|
1481
|
+
type: "button",
|
|
1482
|
+
onClick: (event) => {
|
|
1483
|
+
event.stopPropagation();
|
|
1484
|
+
onOpenFile(entry.path);
|
|
1485
|
+
setOpen(false);
|
|
1486
|
+
},
|
|
1487
|
+
title: `\u5728\u53F3\u4FA7\u9884\u89C8 ${windowsPath(entry.path)}`,
|
|
1488
|
+
style: { ...rowStyle, flex: "1 1 auto", minWidth: 0 },
|
|
1489
|
+
children: [
|
|
1490
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "file", size: 11 }),
|
|
1491
|
+
name,
|
|
1492
|
+
entry.size !== null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { fontSize: fontPx(9), color: COLOR.tertiary }, children: [
|
|
1493
|
+
entry.size,
|
|
1494
|
+
"B"
|
|
1495
|
+
] }) : null
|
|
1496
|
+
]
|
|
1497
|
+
}
|
|
1498
|
+
),
|
|
1499
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1500
|
+
"button",
|
|
1501
|
+
{
|
|
1502
|
+
type: "button",
|
|
1503
|
+
onClick: (event) => {
|
|
1504
|
+
event.stopPropagation();
|
|
1505
|
+
onOpenFileExternal(entry.path);
|
|
1506
|
+
},
|
|
1507
|
+
title: `\u7528\u7CFB\u7EDF\u9ED8\u8BA4\u7A0B\u5E8F\u6253\u5F00 ${windowsPath(entry.path)}`,
|
|
1508
|
+
"aria-label": `\u7528\u7CFB\u7EDF\u9ED8\u8BA4\u7A0B\u5E8F\u6253\u5F00 ${entry.name}`,
|
|
1509
|
+
style: { flex: "0 0 auto", border: "none", background: "transparent", color: COLOR.tertiary, cursor: "pointer", padding: "3px 6px", borderRadius: 4, lineHeight: fontPx(17) },
|
|
1510
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "external", size: 11 })
|
|
1511
|
+
}
|
|
1512
|
+
)
|
|
1513
|
+
] }),
|
|
1514
|
+
isOpen && entry.children.length > 0 ? renderEntries(entry.children, depth + 1) : null
|
|
1515
|
+
] }, entry.path);
|
|
1516
|
+
});
|
|
1517
|
+
const width = 360;
|
|
1518
|
+
const height = 300;
|
|
1519
|
+
const left = anchor === null || typeof window === "undefined" ? 8 : Math.max(8, Math.min(anchor.left, window.innerWidth - width - 8));
|
|
1520
|
+
const top = anchor === null || typeof window === "undefined" ? 8 : Math.max(8, Math.min(anchor.bottom + 4, window.innerHeight - height - 8));
|
|
1521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { ref: trigger, style: { position: "relative", display: "inline-flex" }, children: [
|
|
1522
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1523
|
+
ActionButton,
|
|
1524
|
+
{
|
|
1525
|
+
style,
|
|
1526
|
+
icon: "file",
|
|
1527
|
+
compact,
|
|
1528
|
+
onClick: () => {
|
|
1529
|
+
if (open) {
|
|
1530
|
+
setOpen(false);
|
|
1531
|
+
return;
|
|
1532
|
+
}
|
|
1533
|
+
setAnchor(trigger.current?.getBoundingClientRect() ?? null);
|
|
1534
|
+
setOpen(true);
|
|
1535
|
+
},
|
|
1536
|
+
title: "\u6253\u5F00\u4EFB\u52A1\u6587\u4EF6\uFF08\u5F39\u51FA\u4EFB\u52A1\u76EE\u5F55\u6587\u4EF6\u6811\uFF1B\u70B9\u6587\u4EF6\u5728\u53F3\u4FA7\u9884\u89C8\uFF0C\u884C\u5C3E\u56FE\u6807\u6309\u94AE\u7528\u7CFB\u7EDF\u9ED8\u8BA4\u7A0B\u5E8F\u6253\u5F00\uFF09",
|
|
1537
|
+
children: "\u6253\u5F00\u4EFB\u52A1\u6587\u4EF6"
|
|
1538
|
+
}
|
|
1539
|
+
),
|
|
1540
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1541
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { onClick: (event) => {
|
|
1542
|
+
event.stopPropagation();
|
|
1543
|
+
setOpen(false);
|
|
1544
|
+
}, style: { position: "fixed", inset: 0, zIndex: 60 } }),
|
|
1545
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { onClick: (event) => event.stopPropagation(), style: { position: "fixed", left, top, zIndex: 61, width, maxWidth: "calc(100vw - 16px)", height, display: "flex", flexDirection: "column", background: COLOR.bg, border: `1px solid ${COLOR.border}`, borderRadius: 9, boxShadow: "0 14px 42px rgba(0,0,0,0.3)", overflow: "hidden" }, children: [
|
|
1546
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 5, padding: "7px 9px", borderBottom: `1px solid ${COLOR.borderSoft}` }, children: [
|
|
1547
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "file", size: 12 }),
|
|
1548
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontSize: fontPx(11), fontWeight: 600 }, children: "\u4EFB\u52A1\u6587\u4EF6" }),
|
|
1549
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontSize: fontPx(9.5), color: COLOR.tertiary, fontFamily: "ui-monospace, monospace" }, children: cardId }),
|
|
1550
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", onClick: () => setOpen(false), style: { marginLeft: "auto", border: "none", background: "transparent", color: COLOR.secondary, cursor: "pointer", fontSize: fontPx(13), padding: "0 2px" }, "aria-label": "\u5173\u95ED", children: "\xD7" })
|
|
1551
|
+
] }),
|
|
1552
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1, minHeight: 0, overflowY: "auto", padding: "4px 3px" }, children: [
|
|
1553
|
+
state.loading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { ...secondaryText({ padding: "8px 6px" }) }, children: "\u8BFB\u53D6\u6587\u4EF6\u5217\u8868\u2026" }) : null,
|
|
1554
|
+
state.error !== null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { ...secondaryText({ padding: "8px 6px", color: COLOR.error }) }, children: state.error }) : null,
|
|
1555
|
+
state.data !== null && state.data.entries.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { ...secondaryText({ padding: "8px 6px" }) }, children: "\u4EFB\u52A1\u76EE\u5F55\u4E3A\u7A7A\u3002" }) : null,
|
|
1556
|
+
state.data !== null ? renderEntries(state.data.entries, 0) : null
|
|
1557
|
+
] }),
|
|
1558
|
+
state.data?.truncated ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { padding: "5px 9px", borderTop: `1px solid ${COLOR.borderSoft}`, fontSize: fontPx(9.5), color: COLOR.warn }, children: "\u6587\u4EF6\u8F83\u591A\uFF0C\u53EA\u5217\u5230\u4E0A\u9650\uFF1B\u53EF\u5728\u6587\u4EF6\u9762\u677F\u7EE7\u7EED\u67E5\u770B\u3002" }) : null,
|
|
1559
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { padding: "4px 9px 6px", borderTop: `1px solid ${COLOR.borderSoft}`, fontSize: fontPx(9.5), color: COLOR.tertiary }, children: "\u70B9\u51FB\u6587\u4EF6\u5728\u53F3\u4FA7\u9884\u89C8 \xB7 \u884C\u5C3E\u56FE\u6807\u6309\u94AE\u7528\u7CFB\u7EDF\u9ED8\u8BA4\u7A0B\u5E8F\u6253\u5F00" })
|
|
1560
|
+
] })
|
|
1561
|
+
] }) : null
|
|
1562
|
+
] });
|
|
1563
|
+
}
|
|
1564
|
+
function Pill({ children, color, filled = false, icon }) {
|
|
1565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1566
|
+
"span",
|
|
1567
|
+
{
|
|
1568
|
+
style: {
|
|
1569
|
+
display: "inline-flex",
|
|
1570
|
+
alignItems: "center",
|
|
1571
|
+
gap: 4,
|
|
1572
|
+
fontSize: DETAIL_FONT.small,
|
|
1573
|
+
lineHeight: fontPx(18),
|
|
1574
|
+
padding: "0 7px",
|
|
1575
|
+
borderRadius: 999,
|
|
1576
|
+
color: filled ? COLOR.onColor : color,
|
|
1577
|
+
background: filled ? color : alpha(color, 10),
|
|
1578
|
+
border: `1px solid ${filled ? "transparent" : alpha(color, 28)}`,
|
|
1579
|
+
whiteSpace: "nowrap",
|
|
1580
|
+
flex: "0 0 auto"
|
|
1581
|
+
},
|
|
1582
|
+
children: [
|
|
1583
|
+
icon === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: icon, size: 11 }),
|
|
1584
|
+
children
|
|
1585
|
+
]
|
|
1586
|
+
}
|
|
1587
|
+
);
|
|
1588
|
+
}
|
|
1589
|
+
function FlagPill({ flag, style }) {
|
|
1590
|
+
const toneColor = flag.tone === "error" ? COLOR.error : flag.tone === "warn" ? COLOR.warn : flag.tone === "info" ? COLOR.brand : COLOR.secondary;
|
|
1591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1592
|
+
"span",
|
|
1593
|
+
{
|
|
1594
|
+
title: flag.hint,
|
|
1595
|
+
style: {
|
|
1596
|
+
display: "inline-flex",
|
|
1597
|
+
alignItems: "center",
|
|
1598
|
+
gap: 2,
|
|
1599
|
+
fontSize: DETAIL_FONT.tiny,
|
|
1600
|
+
lineHeight: fontPx(17),
|
|
1601
|
+
color: flag.tone === "muted" ? COLOR.tertiary : toneColor,
|
|
1602
|
+
background: style === "plain" ? "transparent" : alpha(toneColor, 8),
|
|
1603
|
+
border: style === "plain" ? "none" : `1px solid ${alpha(toneColor, 22)}`,
|
|
1604
|
+
borderRadius: 999,
|
|
1605
|
+
padding: style === "plain" ? 0 : "0 5px",
|
|
1606
|
+
whiteSpace: "nowrap"
|
|
1607
|
+
},
|
|
1608
|
+
children: [
|
|
1609
|
+
style === "plain" ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: flag.icon, size: 10 }),
|
|
1610
|
+
flag.label
|
|
1611
|
+
]
|
|
1612
|
+
}
|
|
1613
|
+
);
|
|
1614
|
+
}
|
|
1615
|
+
function TaskCard({ card, style, colorStrength, busyKey, onOpen, onCopyName, onFlow, onFlowLeave, onContinue, onRun, onReopen, projectRoot, onOpenTaskFile, onOpenTaskFileExternal }) {
|
|
1616
|
+
const [hover, setHover] = (0, import_react3.useState)(false);
|
|
1617
|
+
const [nameHover, setNameHover] = (0, import_react3.useState)(false);
|
|
1618
|
+
const status = statusMeta(card);
|
|
1619
|
+
const category = categoryMeta(card.category);
|
|
1620
|
+
const flags = cardFlags(card);
|
|
1621
|
+
const vivid = style === "vivid";
|
|
1622
|
+
const iconMode = style !== "plain";
|
|
1623
|
+
const summary = flowSummary(card);
|
|
1624
|
+
const archived = card.archived;
|
|
1625
|
+
const closed = isClosedCard(card);
|
|
1626
|
+
const tintPct = colorTintPercent(colorStrength);
|
|
1627
|
+
const borderColor = vivid ? alpha(category.color, Math.min(58, 24 + tintPct)) : iconMode ? alpha(category.color, Math.min(42, 12 + Math.round(tintPct * 0.6))) : hover ? COLOR.border : COLOR.borderSoft;
|
|
1628
|
+
const background = vivid ? tint(category.color, Math.round(tintPct * 0.8)) : iconMode ? tint(category.color, Math.round(tintPct * 0.4)) : COLOR.card;
|
|
1629
|
+
const visibleFlags = flags.filter((flag) => flag.key !== "archived").slice(0, 2);
|
|
1630
|
+
const isBusy = busyKey !== null && busyKey.startsWith(card.id);
|
|
1631
|
+
const goalText = plainText(card.goal);
|
|
1632
|
+
const nextText = plainText(card.sections.next);
|
|
1633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1634
|
+
"article",
|
|
1635
|
+
{
|
|
1636
|
+
"aria-label": `\u4EFB\u52A1 ${card.id}\uFF1A${card.title ?? "\u672A\u89E3\u6790"}\uFF1B${status.label}\uFF1B\u8FDB\u5EA6 ${summary.done}/${summary.total}`,
|
|
1637
|
+
style: {
|
|
1638
|
+
position: "relative",
|
|
1639
|
+
display: "flex",
|
|
1640
|
+
flexDirection: "column",
|
|
1641
|
+
gap: 8,
|
|
1642
|
+
padding: iconMode ? "11px 12px 10px" : "10px 11px 9px",
|
|
1643
|
+
borderRadius: vivid ? 10 : 8,
|
|
1644
|
+
border: `1px solid ${borderColor}`,
|
|
1645
|
+
background,
|
|
1646
|
+
minWidth: 0,
|
|
1647
|
+
opacity: 1,
|
|
1648
|
+
overflow: "hidden",
|
|
1649
|
+
transition: "border-color 150ms ease"
|
|
1650
|
+
},
|
|
1651
|
+
children: [
|
|
1652
|
+
iconMode ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { "aria-hidden": "true", style: { position: "absolute", left: 0, top: 0, bottom: 0, width: vivid ? 4 : 3, background: category.color } }) : null,
|
|
1653
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
1654
|
+
iconMode ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1655
|
+
"span",
|
|
1656
|
+
{
|
|
1657
|
+
"aria-hidden": "true",
|
|
1658
|
+
style: {
|
|
1659
|
+
width: vivid ? 36 : 30,
|
|
1660
|
+
height: vivid ? 36 : 30,
|
|
1661
|
+
borderRadius: vivid ? 9 : 7,
|
|
1662
|
+
display: "inline-flex",
|
|
1663
|
+
alignItems: "center",
|
|
1664
|
+
justifyContent: "center",
|
|
1665
|
+
flex: "0 0 auto",
|
|
1666
|
+
color: category.color,
|
|
1667
|
+
background: tint(category.color, Math.min(38, tintPct + 10)),
|
|
1668
|
+
border: `1px solid ${alpha(category.color, Math.min(58, 20 + tintPct))}`
|
|
1669
|
+
},
|
|
1670
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: category.icon, size: vivid ? 21 : 18 })
|
|
1671
|
+
}
|
|
1672
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StatusDot, { card, size: 8 }) }),
|
|
1673
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1, minWidth: 0, display: "flex", alignItems: "center", gap: 5 }, children: [
|
|
1674
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1675
|
+
"button",
|
|
1676
|
+
{
|
|
1677
|
+
type: "button",
|
|
1678
|
+
onClick: (event) => {
|
|
1679
|
+
event.stopPropagation();
|
|
1680
|
+
onCopyName();
|
|
1681
|
+
},
|
|
1682
|
+
onMouseEnter: () => setNameHover(true),
|
|
1683
|
+
onMouseLeave: () => setNameHover(false),
|
|
1684
|
+
title: `\u70B9\u51FB\u590D\u5236\u4EFB\u52A1\u5361\u540D\u79F0\u300C${card.id}\u300D\u5230\u526A\u8D34\u677F`,
|
|
1685
|
+
"aria-label": `\u590D\u5236\u4EFB\u52A1\u5361\u540D\u79F0 ${card.id}`,
|
|
1686
|
+
style: {
|
|
1687
|
+
display: "inline-flex",
|
|
1688
|
+
alignItems: "center",
|
|
1689
|
+
gap: 3,
|
|
1690
|
+
flex: "0 1 auto",
|
|
1691
|
+
minWidth: 0,
|
|
1692
|
+
padding: "2px 3px",
|
|
1693
|
+
margin: "-2px -3px",
|
|
1694
|
+
border: "none",
|
|
1695
|
+
background: "transparent",
|
|
1696
|
+
fontFamily: "ui-monospace, SFMono-Regular, Consolas, monospace",
|
|
1697
|
+
fontSize: fontPx(11),
|
|
1698
|
+
lineHeight: 1.45,
|
|
1699
|
+
color: nameHover ? COLOR.text : COLOR.tertiary,
|
|
1700
|
+
textDecoration: nameHover ? "underline" : "none",
|
|
1701
|
+
textDecorationStyle: "dashed",
|
|
1702
|
+
textUnderlineOffset: 2,
|
|
1703
|
+
cursor: "copy"
|
|
1704
|
+
},
|
|
1705
|
+
children: [
|
|
1706
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: card.id }),
|
|
1707
|
+
nameHover ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "copy", size: 10 }) : null
|
|
1708
|
+
]
|
|
1709
|
+
}
|
|
1710
|
+
),
|
|
1711
|
+
card.focus ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { title: "\u7126\u70B9\u4EFB\u52A1", style: { color: COLOR.brand, fontSize: fontPx(12) }, children: "\u2605" }) : null,
|
|
1712
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Pill, { color: status.color, filled: vivid, icon: iconMode ? status.icon : void 0, children: status.label }),
|
|
1713
|
+
isBusy ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontSize: fontPx(10), color: COLOR.warn }, children: "\u5904\u7406\u4E2D\u2026" }) : null
|
|
1714
|
+
] }),
|
|
1715
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ProgressButton, { card, style, onOpen: onFlow, onLeave: onFlowLeave })
|
|
1716
|
+
] }),
|
|
1717
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1718
|
+
"div",
|
|
1719
|
+
{
|
|
1720
|
+
role: "button",
|
|
1721
|
+
tabIndex: 0,
|
|
1722
|
+
"aria-label": `\u6253\u5F00\u4EFB\u52A1\u8BE6\u60C5\uFF08${card.id}\uFF09`,
|
|
1723
|
+
title: "\u70B9\u51FB\u6807\u9898\u6216\u63CF\u8FF0\u6253\u5F00\u8BE6\u60C5",
|
|
1724
|
+
onMouseEnter: () => setHover(true),
|
|
1725
|
+
onMouseLeave: () => setHover(false),
|
|
1726
|
+
onClick: onOpen,
|
|
1727
|
+
onKeyDown: (event) => {
|
|
1728
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
1729
|
+
event.preventDefault();
|
|
1730
|
+
onOpen();
|
|
1731
|
+
},
|
|
1732
|
+
style: {
|
|
1733
|
+
display: "flex",
|
|
1734
|
+
flexDirection: "column",
|
|
1735
|
+
gap: 3,
|
|
1736
|
+
minWidth: 0,
|
|
1737
|
+
margin: "0 -6px",
|
|
1738
|
+
padding: "3px 6px",
|
|
1739
|
+
borderRadius: 7,
|
|
1740
|
+
cursor: "pointer",
|
|
1741
|
+
background: hover ? COLOR.hover : "transparent",
|
|
1742
|
+
transition: "background 150ms ease"
|
|
1743
|
+
},
|
|
1744
|
+
children: [
|
|
1745
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1746
|
+
"div",
|
|
1747
|
+
{
|
|
1748
|
+
style: {
|
|
1749
|
+
fontSize: fontPx(13.5),
|
|
1750
|
+
lineHeight: 1.42,
|
|
1751
|
+
fontWeight: 600,
|
|
1752
|
+
color: COLOR.text,
|
|
1753
|
+
display: "-webkit-box",
|
|
1754
|
+
WebkitLineClamp: 2,
|
|
1755
|
+
WebkitBoxOrient: "vertical",
|
|
1756
|
+
overflow: "hidden"
|
|
1757
|
+
},
|
|
1758
|
+
children: card.title ?? "\u672A\u89E3\u6790\u6807\u9898"
|
|
1759
|
+
}
|
|
1760
|
+
),
|
|
1761
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { title: goalText === "" ? "\u672A\u5199\u76EE\u6807" : goalText, style: { display: "flex", gap: 6, fontSize: fontPx(11.5), lineHeight: 1.5, color: goalText === "" ? COLOR.tertiary : COLOR.secondary }, children: [
|
|
1762
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: "0 0 auto", color: category.color, fontSize: fontPx(10.5), lineHeight: fontPx(17) }, children: "\u76EE\u6807" }),
|
|
1763
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: goalText === "" ? "\u672A\u5199\u76EE\u6807" : goalText })
|
|
1764
|
+
] }),
|
|
1765
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { title: nextText === "" ? "\u672A\u5199\u4E0B\u4E00\u6B65" : nextText, style: { display: "flex", gap: 6, fontSize: fontPx(11.5), lineHeight: 1.5, color: nextText === "" ? COLOR.tertiary : COLOR.secondary }, children: [
|
|
1766
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: "0 0 auto", color: status.color, fontSize: fontPx(10.5), lineHeight: fontPx(17) }, children: "\u4E0B\u4E00\u6B65" }),
|
|
1767
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: nextText === "" ? "\u672A\u5199\u4E0B\u4E00\u6B65" : nextText })
|
|
1768
|
+
] })
|
|
1769
|
+
]
|
|
1770
|
+
}
|
|
1771
|
+
),
|
|
1772
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap", ...secondaryText({ fontSize: fontPx(10.5) }), marginTop: "auto" }, children: [
|
|
1773
|
+
iconMode ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: category.icon, size: 11 }) : null,
|
|
1774
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: category.color }, children: category.label }),
|
|
1775
|
+
card.updated === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1776
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: COLOR.border }, children: "\xB7" }),
|
|
1777
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 2 }, children: [
|
|
1778
|
+
iconMode ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "clock", size: 10 }) : null,
|
|
1779
|
+
"\u66F4\u65B0 ",
|
|
1780
|
+
shortDate(card.updated)
|
|
1781
|
+
] })
|
|
1782
|
+
] }),
|
|
1783
|
+
visibleFlags.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: COLOR.border }, children: "\xB7" }) : null,
|
|
1784
|
+
visibleFlags.map((flag) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FlagPill, { flag, style }, flag.key))
|
|
1785
|
+
] }),
|
|
1786
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, marginTop: 1, flexWrap: "wrap" }, children: [
|
|
1787
|
+
closed ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1788
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, icon: "refresh", tone: "primary", compact: true, disabled: isBusy, onClick: onReopen, title: `\u65B0\u5EFA\u4F1A\u8BDD\u5E76\u628A\u300C${reopenPrompt(card.id)}\u300D\u653E\u8FDB\u8349\u7A3F\uFF0C\u4E0D\u81EA\u52A8\u53D1\u9001`, children: "\u91CD\u65B0\u5F00\u542F" }),
|
|
1789
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: secondaryText({ fontSize: fontPx(10.5) }), children: archived ? "\u5F52\u6863\u5361\u53EA\u8BFB" : "\u5DF2\u5B8C\u6210" })
|
|
1790
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1791
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, icon: "play", tone: "primary", compact: true, disabled: isBusy, onClick: onContinue, title: `\u65B0\u5EFA\u4F1A\u8BDD\u5E76\u628A\u300C${continuePrompt(card.id)}\u300D\u653E\u8FDB\u8349\u7A3F\uFF0C\u4E0D\u81EA\u52A8\u53D1\u9001`, children: "\u7EE7\u7EED" }),
|
|
1792
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, icon: "bolt", compact: true, disabled: isBusy, onClick: onRun, title: `\u65B0\u5EFA\u4F1A\u8BDD\u5E76\u81EA\u52A8\u6267\u884C\u300C${continuePrompt(card.id)}\u300D`, children: "\u6267\u884C" })
|
|
1793
|
+
] }),
|
|
1794
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 } }),
|
|
1795
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TaskFilesButton, { style, compact: true, cardId: card.id, projectRoot, onOpenFile: onOpenTaskFile, onOpenFileExternal: onOpenTaskFileExternal })
|
|
1796
|
+
] })
|
|
1797
|
+
]
|
|
1798
|
+
}
|
|
1799
|
+
);
|
|
1800
|
+
}
|
|
1801
|
+
function filterLabel(filter) {
|
|
1802
|
+
if (filter === null) return "";
|
|
1803
|
+
if (filter.type === "status") return STATUS_META[filter.key]?.label ?? filter.key;
|
|
1804
|
+
return categoryMeta(filter.key).label;
|
|
1805
|
+
}
|
|
1806
|
+
function StyleSwitch({ style, onChange }) {
|
|
1807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { display: "inline-flex", alignItems: "center", gap: 2, padding: 2, borderRadius: 7, border: `1px solid ${COLOR.borderSoft}`, background: COLOR.layer1 }, children: STYLE_META.map((item) => {
|
|
1808
|
+
const active = style === item.key;
|
|
1809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1810
|
+
"button",
|
|
1811
|
+
{
|
|
1812
|
+
type: "button",
|
|
1813
|
+
title: item.hint,
|
|
1814
|
+
"aria-pressed": active,
|
|
1815
|
+
onClick: () => onChange(item.key),
|
|
1816
|
+
style: {
|
|
1817
|
+
display: "inline-flex",
|
|
1818
|
+
alignItems: "center",
|
|
1819
|
+
gap: 3,
|
|
1820
|
+
border: "none",
|
|
1821
|
+
borderRadius: 5,
|
|
1822
|
+
padding: "2px 7px",
|
|
1823
|
+
fontSize: fontPx(11),
|
|
1824
|
+
lineHeight: fontPx(20),
|
|
1825
|
+
cursor: "pointer",
|
|
1826
|
+
color: active ? COLOR.text : COLOR.secondary,
|
|
1827
|
+
background: active ? COLOR.card : "transparent",
|
|
1828
|
+
boxShadow: active ? `0 0 0 1px ${COLOR.borderSoft}` : "none"
|
|
1829
|
+
},
|
|
1830
|
+
children: [
|
|
1831
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: item.icon, size: 13 }),
|
|
1832
|
+
item.label
|
|
1833
|
+
]
|
|
1834
|
+
},
|
|
1835
|
+
item.key
|
|
1836
|
+
);
|
|
1837
|
+
}) });
|
|
1838
|
+
}
|
|
1839
|
+
var CONFIG_SOURCE_LABEL = {
|
|
1840
|
+
project: "\u4ED3\u5E93 task-card.config.yml",
|
|
1841
|
+
plugin: "\u63D2\u4EF6\u8BBE\u7F6E",
|
|
1842
|
+
default: "\u5185\u7F6E\u9ED8\u8BA4"
|
|
1843
|
+
};
|
|
1844
|
+
function ConfigInfo({ config }) {
|
|
1845
|
+
const [open, setOpen] = (0, import_react3.useState)(false);
|
|
1846
|
+
const row = (label, value) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", gap: 6, fontSize: fontPx(10.5), lineHeight: 1.55 }, children: [
|
|
1847
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: COLOR.tertiary, flex: "0 0 auto" }, children: label }),
|
|
1848
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: COLOR.secondary, wordBreak: "break-all" }, children: value })
|
|
1849
|
+
] });
|
|
1850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { position: "relative", display: "inline-flex" }, children: [
|
|
1851
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1852
|
+
"button",
|
|
1853
|
+
{
|
|
1854
|
+
type: "button",
|
|
1855
|
+
onClick: () => setOpen((value) => !value),
|
|
1856
|
+
title: "\u6570\u636E\u6E90\u4E0E\u7248\u672C\uFF08\u53EA\u8BFB\uFF09",
|
|
1857
|
+
"aria-expanded": open,
|
|
1858
|
+
style: {
|
|
1859
|
+
display: "inline-flex",
|
|
1860
|
+
alignItems: "center",
|
|
1861
|
+
border: `1px solid ${open ? COLOR.border : COLOR.borderSoft}`,
|
|
1862
|
+
borderRadius: 7,
|
|
1863
|
+
padding: "3px 7px",
|
|
1864
|
+
lineHeight: fontPx(20),
|
|
1865
|
+
fontSize: fontPx(12),
|
|
1866
|
+
cursor: "pointer",
|
|
1867
|
+
color: open ? COLOR.text : COLOR.secondary,
|
|
1868
|
+
background: open ? COLOR.card : "transparent"
|
|
1869
|
+
},
|
|
1870
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "info", size: 13 })
|
|
1871
|
+
}
|
|
1872
|
+
),
|
|
1873
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1874
|
+
"div",
|
|
1875
|
+
{
|
|
1876
|
+
style: {
|
|
1877
|
+
position: "absolute",
|
|
1878
|
+
top: "calc(100% + 6px)",
|
|
1879
|
+
right: 0,
|
|
1880
|
+
zIndex: 60,
|
|
1881
|
+
width: "min(320px, 82vw)",
|
|
1882
|
+
border: `1px solid ${COLOR.border}`,
|
|
1883
|
+
borderRadius: 8,
|
|
1884
|
+
padding: "8px 10px",
|
|
1885
|
+
background: COLOR.bg,
|
|
1886
|
+
boxShadow: "0 10px 30px rgba(0,0,0,0.18)",
|
|
1887
|
+
display: "flex",
|
|
1888
|
+
flexDirection: "column",
|
|
1889
|
+
gap: 4
|
|
1890
|
+
},
|
|
1891
|
+
children: [
|
|
1892
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: fontPx(11.5), fontWeight: 700 }, children: "\u6570\u636E\u6E90\u4E0E\u7248\u672C" }),
|
|
1893
|
+
config === null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: fontPx(10.5), color: COLOR.secondary }, children: "\u5FEB\u7167\u8FD8\u672A\u52A0\u8F7D\u3002" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1894
|
+
row("\u63D2\u4EF6", `v${"0.1.0"}`),
|
|
1895
|
+
row("\u9879\u76EE\u6839", config.projectRoot),
|
|
1896
|
+
row("\u6570\u636E\u76EE\u5F55", `${config.dataDir}/\uFF08${CONFIG_SOURCE_LABEL[config.configSources.dataDir]}\uFF09`),
|
|
1897
|
+
row("\u603B\u8D26", `${config.ledgerFile}\uFF08${CONFIG_SOURCE_LABEL[config.configSources.ledgerName]}\uFF09`),
|
|
1898
|
+
row("\u5F52\u6863", `${config.archiveFile}\uFF08${CONFIG_SOURCE_LABEL[config.configSources.archiveName]}\uFF09`),
|
|
1899
|
+
row("\u9879\u76EE\u914D\u7F6E", config.configFile === null ? "\u65E0\uFF08\u7528\u63D2\u4EF6\u8BBE\u7F6E/\u9ED8\u8BA4\uFF09" : `${config.configFile}\uFF08\u4F18\u5148\uFF09`)
|
|
1900
|
+
] }),
|
|
1901
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: fontPx(10), color: COLOR.tertiary, lineHeight: 1.55, paddingTop: 2 }, children: "\u6539\u76EE\u5F55/\u6587\u4EF6\u540D\u8BF7\u70B9 \u2699 \u8BBE\u7F6E\uFF08\u5B58\u672C\u673A\u63D2\u4EF6\u914D\u7F6E\uFF09\uFF1B\u4ED3\u5E93\u6839\u6709 task-card.config.yml \u65F6\u5B83\u4F18\u5148\u3002" })
|
|
1902
|
+
]
|
|
1903
|
+
}
|
|
1904
|
+
) : null
|
|
1905
|
+
] });
|
|
1906
|
+
}
|
|
1907
|
+
function ColorSettings({ strength, onChange }) {
|
|
1908
|
+
const [open, setOpen] = (0, import_react3.useState)(false);
|
|
1909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { position: "relative", display: "inline-flex" }, children: [
|
|
1910
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1911
|
+
"button",
|
|
1912
|
+
{
|
|
1913
|
+
type: "button",
|
|
1914
|
+
onClick: () => setOpen((value) => !value),
|
|
1915
|
+
title: "\u914D\u8272\uFF1A\u4EFB\u52A1\u7C7B\u578B\u989C\u8272\u5F3A\u5EA6",
|
|
1916
|
+
"aria-expanded": open,
|
|
1917
|
+
style: {
|
|
1918
|
+
display: "inline-flex",
|
|
1919
|
+
alignItems: "center",
|
|
1920
|
+
gap: 4,
|
|
1921
|
+
border: `1px solid ${open ? COLOR.border : COLOR.borderSoft}`,
|
|
1922
|
+
borderRadius: 7,
|
|
1923
|
+
padding: "2px 8px",
|
|
1924
|
+
fontSize: fontPx(11),
|
|
1925
|
+
lineHeight: fontPx(20),
|
|
1926
|
+
cursor: "pointer",
|
|
1927
|
+
color: COLOR.text,
|
|
1928
|
+
background: open ? COLOR.card : "transparent"
|
|
1929
|
+
},
|
|
1930
|
+
children: [
|
|
1931
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "palette", size: 13 }),
|
|
1932
|
+
" \u914D\u8272"
|
|
1933
|
+
]
|
|
1934
|
+
}
|
|
1935
|
+
),
|
|
1936
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1937
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { onClick: () => setOpen(false), style: { position: "fixed", inset: 0, zIndex: 40 } }),
|
|
1938
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1939
|
+
"div",
|
|
1940
|
+
{
|
|
1941
|
+
style: {
|
|
1942
|
+
position: "absolute",
|
|
1943
|
+
right: 0,
|
|
1944
|
+
top: "calc(100% + 6px)",
|
|
1945
|
+
zIndex: 41,
|
|
1946
|
+
width: 286,
|
|
1947
|
+
maxWidth: "calc(100vw - 24px)",
|
|
1948
|
+
background: COLOR.bg,
|
|
1949
|
+
border: `1px solid ${COLOR.border}`,
|
|
1950
|
+
borderRadius: 9,
|
|
1951
|
+
boxShadow: "0 12px 40px rgba(0,0,0,0.28)",
|
|
1952
|
+
padding: "9px 10px",
|
|
1953
|
+
display: "flex",
|
|
1954
|
+
flexDirection: "column",
|
|
1955
|
+
gap: 7
|
|
1956
|
+
},
|
|
1957
|
+
children: [
|
|
1958
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: fontPx(11), fontWeight: 600 }, children: "\u4EFB\u52A1\u7C7B\u578B\u989C\u8272" }),
|
|
1959
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { display: "grid", gridTemplateColumns: "repeat(3, minmax(0, 1fr))", gap: "4px 6px" }, children: Object.entries(CATEGORY_META).map(([key, meta]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 4, fontSize: fontPx(10), color: COLOR.secondary, whiteSpace: "nowrap" }, children: [
|
|
1960
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { width: 11, height: 11, borderRadius: 3, background: meta.color, border: `1px solid ${alpha(meta.color, 50)}`, flex: "0 0 auto" } }),
|
|
1961
|
+
meta.label
|
|
1962
|
+
] }, key)) }),
|
|
1963
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", flexDirection: "column", gap: 3, fontSize: fontPx(10.5), color: COLOR.secondary }, children: [
|
|
1964
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { display: "flex", justifyContent: "space-between" }, children: [
|
|
1965
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u8272\u5F69\u5F3A\u5EA6" }),
|
|
1966
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontFamily: "ui-monospace, monospace", color: COLOR.text }, children: strength })
|
|
1967
|
+
] }),
|
|
1968
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1969
|
+
"input",
|
|
1970
|
+
{
|
|
1971
|
+
type: "range",
|
|
1972
|
+
min: 0,
|
|
1973
|
+
max: 100,
|
|
1974
|
+
step: 1,
|
|
1975
|
+
value: strength,
|
|
1976
|
+
onChange: (event) => onChange(clampColorStrength(Number(event.target.value))),
|
|
1977
|
+
style: { width: "100%", accentColor: COLOR.business, cursor: "pointer" }
|
|
1978
|
+
}
|
|
1979
|
+
)
|
|
1980
|
+
] }),
|
|
1981
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: fontPx(9.5), lineHeight: 1.5, color: COLOR.tertiary }, children: "\u8C03\u9AD8\u4F1A\u8BA9\u7C7B\u578B\u8272\u5757\u3001\u5361\u7247\u5E95\u8272\u548C\u5DE6\u8FB9\u6761\u66F4\u660E\u663E\uFF1B\u72B6\u6001\u8272\u4ECD\u7531\u72B6\u6001\u80F6\u56CA\u4E0E\u8FDB\u5EA6\u73AF\u8868\u8FBE\u3002" })
|
|
1982
|
+
]
|
|
1983
|
+
}
|
|
1984
|
+
)
|
|
1985
|
+
] }) : null
|
|
1986
|
+
] });
|
|
1987
|
+
}
|
|
1988
|
+
function TopBar({ style, colorStrength, view, count, focusId, loading, config, onStyle, onColorStrength, onNew, onSettings, onRefresh }) {
|
|
1989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap", paddingBottom: 7 }, children: [
|
|
1990
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 5, fontSize: fontPx(14), fontWeight: 700 }, children: [
|
|
1991
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "card", size: 15 }),
|
|
1992
|
+
DISPLAY_NAME
|
|
1993
|
+
] }),
|
|
1994
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: secondaryText({ fontSize: fontPx(10.5) }), children: [
|
|
1995
|
+
view === "active" ? "\u6D3B\u8DC3" : "\u5DF2\u5B8C\u6210",
|
|
1996
|
+
" ",
|
|
1997
|
+
count,
|
|
1998
|
+
" \u4E2A",
|
|
1999
|
+
focusId === null ? "" : ` \xB7 \u7126\u70B9 ${focusId}`
|
|
2000
|
+
] }),
|
|
2001
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { marginLeft: "auto", display: "inline-flex", alignItems: "center", gap: 5, flexWrap: "wrap" }, children: [
|
|
2002
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StyleSwitch, { style, onChange: onStyle }),
|
|
2003
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ColorSettings, { strength: colorStrength, onChange: onColorStrength }),
|
|
2004
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2005
|
+
"button",
|
|
2006
|
+
{
|
|
2007
|
+
type: "button",
|
|
2008
|
+
onClick: onSettings,
|
|
2009
|
+
title: "\u8BBE\u7F6E\uFF1A\u6570\u636E\u76EE\u5F55 / \u603B\u8D26\u6587\u4EF6\u540D / \u5F52\u6863\u6587\u4EF6\u540D",
|
|
2010
|
+
style: { display: "inline-flex", alignItems: "center", border: `1px solid ${COLOR.borderSoft}`, borderRadius: 7, padding: "3px 7px", lineHeight: fontPx(20), fontSize: fontPx(12), cursor: "pointer", color: COLOR.secondary, background: "transparent" },
|
|
2011
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "settings", size: 13 })
|
|
2012
|
+
}
|
|
2013
|
+
),
|
|
2014
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ConfigInfo, { config }),
|
|
2015
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2016
|
+
"button",
|
|
2017
|
+
{
|
|
2018
|
+
type: "button",
|
|
2019
|
+
onClick: onNew,
|
|
2020
|
+
title: "\u65B0\u5EFA\u4EFB\u52A1\uFF08\u65B0\u4F1A\u8BDD\uFF1B\u53EF\u53EA\u8D77\u8349\u6216\u76F4\u63A5\u6267\u884C\uFF09",
|
|
2021
|
+
style: { display: "inline-flex", alignItems: "center", gap: 5, border: "none", borderRadius: 7, padding: "3px 10px", fontSize: fontPx(12), lineHeight: fontPx(22), cursor: "pointer", color: COLOR.onColor, background: COLOR.brand },
|
|
2022
|
+
children: [
|
|
2023
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "plus", size: 14 }),
|
|
2024
|
+
" \u65B0\u5EFA\u4EFB\u52A1"
|
|
2025
|
+
]
|
|
2026
|
+
}
|
|
2027
|
+
),
|
|
2028
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2029
|
+
"button",
|
|
2030
|
+
{
|
|
2031
|
+
type: "button",
|
|
2032
|
+
onClick: onRefresh,
|
|
2033
|
+
disabled: loading,
|
|
2034
|
+
title: "\u91CD\u65B0\u8BFB\u53D6\u4EFB\u52A1\u5361\u6587\u4EF6",
|
|
2035
|
+
style: { display: "inline-flex", alignItems: "center", gap: 5, border: `1px solid ${COLOR.borderSoft}`, borderRadius: 7, padding: "2px 9px", fontSize: fontPx(12), lineHeight: fontPx(22), cursor: loading ? "default" : "pointer", color: loading ? COLOR.secondary : COLOR.text, background: "transparent" },
|
|
2036
|
+
children: [
|
|
2037
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "refresh", size: 13, style: loading ? { animation: "tc-spin 900ms linear infinite" } : void 0 }),
|
|
2038
|
+
loading ? "\u5237\u65B0\u4E2D" : "\u5237\u65B0"
|
|
2039
|
+
]
|
|
2040
|
+
}
|
|
2041
|
+
)
|
|
2042
|
+
] })
|
|
2043
|
+
] });
|
|
2044
|
+
}
|
|
2045
|
+
function ViewSwitch({ view, activeCount, completedCount, onChange }) {
|
|
2046
|
+
const item = (key, label, count) => {
|
|
2047
|
+
const active = view === key;
|
|
2048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2049
|
+
"button",
|
|
2050
|
+
{
|
|
2051
|
+
type: "button",
|
|
2052
|
+
onClick: () => onChange(key),
|
|
2053
|
+
"aria-pressed": active,
|
|
2054
|
+
style: {
|
|
2055
|
+
display: "inline-flex",
|
|
2056
|
+
alignItems: "center",
|
|
2057
|
+
gap: 4,
|
|
2058
|
+
border: "none",
|
|
2059
|
+
borderRadius: 5,
|
|
2060
|
+
padding: "2px 8px",
|
|
2061
|
+
fontSize: fontPx(11),
|
|
2062
|
+
lineHeight: fontPx(19),
|
|
2063
|
+
cursor: "pointer",
|
|
2064
|
+
color: active ? COLOR.text : COLOR.secondary,
|
|
2065
|
+
background: active ? COLOR.card : "transparent",
|
|
2066
|
+
boxShadow: active ? `0 0 0 1px ${COLOR.borderSoft}` : "none",
|
|
2067
|
+
whiteSpace: "nowrap"
|
|
2068
|
+
},
|
|
2069
|
+
children: [
|
|
2070
|
+
label,
|
|
2071
|
+
" ",
|
|
2072
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: active ? COLOR.text : COLOR.tertiary, fontFamily: "ui-monospace, monospace" }, children: count })
|
|
2073
|
+
]
|
|
2074
|
+
},
|
|
2075
|
+
key
|
|
2076
|
+
);
|
|
2077
|
+
};
|
|
2078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 2, padding: 2, borderRadius: 7, border: `1px solid ${COLOR.borderSoft}`, background: COLOR.layer1 }, children: [
|
|
2079
|
+
item("active", "\u6D3B\u8DC3", activeCount),
|
|
2080
|
+
item("completed", "\u5DF2\u5B8C\u6210", completedCount)
|
|
2081
|
+
] });
|
|
2082
|
+
}
|
|
2083
|
+
function StatsBar({ cards, allCards, view, filter, style, open, onToggle, onView, onFilter, onOpenCard }) {
|
|
2084
|
+
const statuses = stateCounts(cards).filter((item) => item.count > 0);
|
|
2085
|
+
const categories = categoryCounts(cards);
|
|
2086
|
+
const activeCount = allCards.filter((card) => !isClosedCard(card)).length;
|
|
2087
|
+
const completedCount = allCards.filter(isClosedCard).length;
|
|
2088
|
+
const chipStyle = (selected2 = false, color = COLOR.secondary) => ({
|
|
2089
|
+
display: "inline-flex",
|
|
2090
|
+
alignItems: "center",
|
|
2091
|
+
gap: 3,
|
|
2092
|
+
border: `1px solid ${selected2 ? alpha(color, 55) : style === "plain" ? COLOR.borderSoft : "transparent"}`,
|
|
2093
|
+
background: selected2 ? tint(color, 16) : style === "plain" ? "transparent" : COLOR.layer1,
|
|
2094
|
+
borderRadius: 999,
|
|
2095
|
+
padding: style === "plain" ? 0 : "2px 8px",
|
|
2096
|
+
fontSize: fontPx(10.5),
|
|
2097
|
+
lineHeight: fontPx(19),
|
|
2098
|
+
color: selected2 ? COLOR.text : COLOR.secondary,
|
|
2099
|
+
cursor: "pointer",
|
|
2100
|
+
whiteSpace: "nowrap"
|
|
2101
|
+
});
|
|
2102
|
+
const selected = (type, key) => filter !== null && filter.type === type && filter.key === key;
|
|
2103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { position: "relative", paddingBottom: 7 }, children: [
|
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 5, flexWrap: "wrap" }, children: [
|
|
2105
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ViewSwitch, { view, activeCount, completedCount, onChange: onView }),
|
|
2106
|
+
statuses.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: COLOR.border, margin: "0 1px" }, children: "\u2502" }) : null,
|
|
2107
|
+
statuses.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { type: "button", onClick: () => onFilter({ type: "status", key: item.key }), title: `${item.label} ${item.count}\uFF1A\u70B9\u51FB\u7B5B\u9009\uFF0C\u518D\u70B9\u53D6\u6D88`, style: chipStyle(selected("status", item.key), item.color), children: [
|
|
2108
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { width: 6, height: 6, borderRadius: 999, background: item.color } }),
|
|
2109
|
+
item.label,
|
|
2110
|
+
" ",
|
|
2111
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: COLOR.text }, children: item.count })
|
|
2112
|
+
] }, `s-${item.key}`)),
|
|
2113
|
+
categories.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: COLOR.border, margin: "0 1px" }, children: "\u2502" }) : null,
|
|
2114
|
+
categories.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { type: "button", onClick: () => onFilter({ type: "category", key: item.key }), title: `${item.label} ${item.count}\uFF1A\u70B9\u51FB\u7B5B\u9009\u8BE5\u7C7B\u578B\uFF0C\u518D\u70B9\u53D6\u6D88`, style: chipStyle(selected("category", item.key), item.color), children: [
|
|
2115
|
+
style === "plain" ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: item.icon, size: 12 }),
|
|
2116
|
+
item.label,
|
|
2117
|
+
" ",
|
|
2118
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: COLOR.text }, children: item.count })
|
|
2119
|
+
] }, `k-${item.key}`)),
|
|
2120
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { type: "button", onClick: onToggle, title: "\u67E5\u770B\u5168\u90E8\u7EDF\u8BA1\u660E\u7EC6", style: { ...chipStyle(), color: COLOR.link, marginLeft: "auto" }, children: [
|
|
2121
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "info", size: 12 }),
|
|
2122
|
+
" \u660E\u7EC6"
|
|
2123
|
+
] })
|
|
2124
|
+
] }),
|
|
2125
|
+
filter === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 5, marginTop: 5, fontSize: fontPx(10.5), color: COLOR.secondary }, children: [
|
|
2126
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7B5B\u9009\uFF1A" }),
|
|
2127
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: COLOR.text }, children: filterLabel(filter) }),
|
|
2128
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2129
|
+
"button",
|
|
2130
|
+
{
|
|
2131
|
+
type: "button",
|
|
2132
|
+
onClick: () => onFilter({ type: filter.type, key: filter.key }),
|
|
2133
|
+
style: { border: "none", background: "transparent", color: COLOR.link, cursor: "pointer", fontSize: fontPx(10.5), padding: 0 },
|
|
2134
|
+
children: "\u6E05\u9664"
|
|
2135
|
+
}
|
|
2136
|
+
)
|
|
2137
|
+
] }),
|
|
2138
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
2139
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { onClick: onToggle, style: { position: "fixed", inset: 0, zIndex: 30 } }),
|
|
2140
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2141
|
+
"div",
|
|
2142
|
+
{
|
|
2143
|
+
style: {
|
|
2144
|
+
position: "absolute",
|
|
2145
|
+
left: 0,
|
|
2146
|
+
right: 0,
|
|
2147
|
+
top: "100%",
|
|
2148
|
+
zIndex: 31,
|
|
2149
|
+
maxHeight: 360,
|
|
2150
|
+
overflowY: "auto",
|
|
2151
|
+
background: COLOR.bg,
|
|
2152
|
+
border: `1px solid ${COLOR.border}`,
|
|
2153
|
+
borderRadius: 8,
|
|
2154
|
+
boxShadow: "0 10px 36px rgba(0,0,0,0.25)",
|
|
2155
|
+
padding: "8px 10px",
|
|
2156
|
+
display: "flex",
|
|
2157
|
+
gap: 16,
|
|
2158
|
+
flexWrap: "wrap",
|
|
2159
|
+
fontSize: fontPx(11),
|
|
2160
|
+
lineHeight: fontPx(19)
|
|
2161
|
+
},
|
|
2162
|
+
children: [
|
|
2163
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StatsGroup, { title: "\u6309\u72B6\u6001", rows: statuses.map((item) => ({ ...item, ids: cards.filter((card) => displayStatus(card) === item.key).map((card) => card.id) })), onOpenCard }),
|
|
2164
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StatsGroup, { title: "\u6309\u6027\u8D28", rows: categories.map((item) => ({ ...item, ids: cards.filter((card) => (card.category ?? "unknown") === item.key).map((card) => card.id) })), onOpenCard })
|
|
2165
|
+
]
|
|
2166
|
+
}
|
|
2167
|
+
)
|
|
2168
|
+
] }) : null
|
|
2169
|
+
] });
|
|
2170
|
+
}
|
|
2171
|
+
function StatsGroup({ title, rows, onOpenCard }) {
|
|
2172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { minWidth: 160, flex: "1 1 160px" }, children: [
|
|
2173
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { ...secondaryText({ fontSize: fontPx(10.5), marginBottom: 3 }) }, children: title }),
|
|
2174
|
+
rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: secondaryText(), children: "\uFF08\u7A7A\uFF09" }) : rows.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", gap: 6, padding: "1px 0" }, children: [
|
|
2175
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { width: 6, height: 6, borderRadius: 999, background: item.color, marginTop: 7, flex: "0 0 auto" } }),
|
|
2176
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
2177
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", gap: 8 }, children: [
|
|
2178
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: item.label }),
|
|
2179
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: COLOR.text }, children: item.count })
|
|
2180
|
+
] }),
|
|
2181
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { display: "flex", gap: 4, flexWrap: "wrap", marginTop: 1 }, children: item.ids.map((id) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", onClick: () => onOpenCard(id), style: { border: "none", background: "transparent", padding: 0, color: COLOR.link, cursor: "pointer", fontSize: fontPx(9.5), fontFamily: "ui-monospace, monospace" }, children: id }, id)) })
|
|
2182
|
+
] })
|
|
2183
|
+
] }, item.key))
|
|
2184
|
+
] });
|
|
2185
|
+
}
|
|
2186
|
+
function DetailView({ card, style, cardFile, tab, busyKey, onTab, onBack, onReloadFile, onCopyPath, relativePath, absolutePath, projectRoot, onOpenTaskFile, onOpenTaskFileExternal, onOpenDoc, onContinue, onRun, onReopen, onFlow }) {
|
|
2187
|
+
const status = statusMeta(card);
|
|
2188
|
+
const category = categoryMeta(card.category);
|
|
2189
|
+
const flags = cardFlags(card);
|
|
2190
|
+
const summary = flowSummary(card);
|
|
2191
|
+
const vivid = style === "vivid";
|
|
2192
|
+
const isBusy = busyKey !== null && busyKey.startsWith(card.id);
|
|
2193
|
+
const closed = isClosedCard(card);
|
|
2194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", flexDirection: "column", minHeight: 0, flex: 1, fontSize: DETAIL_FONT.body }, children: [
|
|
2195
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, paddingBottom: 7, flexWrap: "wrap" }, children: [
|
|
2196
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, icon: "chevronLeft", compact: true, onClick: onBack, title: "\u8FD4\u56DE\u4EFB\u52A1\u5217\u8868", children: "\u8FD4\u56DE" }),
|
|
2197
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontFamily: "ui-monospace, monospace", fontSize: DETAIL_FONT.small, color: COLOR.tertiary }, children: card.id }),
|
|
2198
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Pill, { color: status.color, filled: vivid, icon: status.icon, children: status.label }),
|
|
2199
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Pill, { color: category.color, icon: category.icon, children: category.label }),
|
|
2200
|
+
card.focus ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: COLOR.brand, fontSize: DETAIL_FONT.small }, children: "\u2605" }) : null,
|
|
2201
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { marginLeft: "auto", ...secondaryText({ fontSize: DETAIL_FONT.tiny }) }, children: card.updated === null ? "" : `\u66F4\u65B0 ${card.updated}` })
|
|
2202
|
+
] }),
|
|
2203
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: DETAIL_FONT.title, fontWeight: 700, lineHeight: 1.4 }, children: card.title ?? "\u672A\u89E3\u6790\u6807\u9898" }),
|
|
2204
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 5, flexWrap: "wrap", marginTop: 4, ...secondaryText({ fontSize: DETAIL_FONT.tiny }) }, children: [
|
|
2205
|
+
card.tags.length === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 2 }, children: [
|
|
2206
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "tag", size: 9 }),
|
|
2207
|
+
card.tags.join(" / ")
|
|
2208
|
+
] }),
|
|
2209
|
+
flags.map((flag) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FlagPill, { flag, style }, flag.key))
|
|
2210
|
+
] }),
|
|
2211
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 5, marginTop: 8, flexWrap: "wrap" }, children: [
|
|
2212
|
+
closed ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
2213
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, icon: "refresh", tone: "primary", disabled: isBusy, onClick: onReopen, title: "\u65B0\u5EFA\u4F1A\u8BDD\u5E76\u628A\u91CD\u5F00\u63D0\u793A\u653E\u8FDB\u8349\u7A3F\uFF0C\u4E0D\u81EA\u52A8\u53D1\u9001\uFF1B\u63D2\u4EF6\u672C\u8EAB\u4E0D\u5199\u4EFB\u52A1\u5361", children: "\u91CD\u65B0\u5F00\u542F" }),
|
|
2214
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: secondaryText({ fontSize: DETAIL_FONT.tiny }), children: card.archived ? "\u5F52\u6863\u5361\u53EA\u8BFB" : "\u5DF2\u5B8C\u6210" })
|
|
2215
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, icon: "play", tone: "primary", disabled: isBusy, onClick: onContinue, title: "\u65B0\u5EFA\u4F1A\u8BDD\uFF0C\u53EA\u586B\u8349\u7A3F\u4E0D\u53D1\u9001", children: "\u7EE7\u7EED\u4EFB\u52A1" }),
|
|
2217
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, icon: "bolt", disabled: isBusy, onClick: onRun, title: "\u65B0\u5EFA\u4F1A\u8BDD\u5E76\u81EA\u52A8\u6267\u884C", children: "\u6267\u884C\u4EFB\u52A1" })
|
|
2218
|
+
] }),
|
|
2219
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TaskFilesButton, { style, cardId: card.id, projectRoot, onOpenFile: onOpenTaskFile, onOpenFileExternal: onOpenTaskFileExternal }),
|
|
2220
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CopyPathButton, { style, relativePath, absolutePath, onCopy: onCopyPath }),
|
|
2221
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, icon: "branch", onClick: onFlow, title: "\u67E5\u770B\u6D41\u7A0B\u5730\u56FE", children: "\u6D41\u7A0B" }),
|
|
2222
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { marginLeft: "auto", ...secondaryText({ fontSize: DETAIL_FONT.tiny }) }, children: [
|
|
2223
|
+
"\u8FDB\u5EA6 ",
|
|
2224
|
+
summary.done,
|
|
2225
|
+
"/",
|
|
2226
|
+
summary.total,
|
|
2227
|
+
" \xB7 \u9A8C\u6536 ",
|
|
2228
|
+
card.acceptance.done,
|
|
2229
|
+
"/",
|
|
2230
|
+
card.acceptance.total
|
|
2231
|
+
] })
|
|
2232
|
+
] }),
|
|
2233
|
+
card.docs.length === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 5, marginTop: 7, flexWrap: "wrap", ...secondaryText({ fontSize: DETAIL_FONT.tiny }) }, children: [
|
|
2234
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "file", size: 10 }),
|
|
2235
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5FC5\u8BFB\u6587\u6863" }),
|
|
2236
|
+
card.docs.map((doc) => {
|
|
2237
|
+
const name = doc.path.split("/").pop() ?? doc.path;
|
|
2238
|
+
if (doc.error !== null || !doc.exists) {
|
|
2239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { title: doc.error ?? `\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${doc.path}`, style: { color: COLOR.warn }, children: [
|
|
2240
|
+
name,
|
|
2241
|
+
"\uFF08",
|
|
2242
|
+
doc.error ?? "\u4E0D\u5B58\u5728",
|
|
2243
|
+
"\uFF09"
|
|
2244
|
+
] }, doc.path);
|
|
2245
|
+
}
|
|
2246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2247
|
+
"button",
|
|
2248
|
+
{
|
|
2249
|
+
type: "button",
|
|
2250
|
+
onClick: () => onOpenDoc(doc.path),
|
|
2251
|
+
title: `\u5728\u53F3\u4FA7\u9884\u89C8 ${doc.path}\uFF08${doc.lines ?? "?"} \u884C\uFF1B\u63A8\u8FDB\u524D\u5FC5\u8BFB\uFF09`,
|
|
2252
|
+
style: { border: "none", background: "transparent", padding: 0, cursor: "pointer", color: COLOR.link, textDecoration: "underline", fontSize: DETAIL_FONT.tiny, fontFamily: "ui-monospace, monospace" },
|
|
2253
|
+
children: name
|
|
2254
|
+
},
|
|
2255
|
+
doc.path
|
|
2256
|
+
);
|
|
2257
|
+
})
|
|
2258
|
+
] }),
|
|
2259
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { display: "flex", alignItems: "center", gap: 2, marginTop: 9, padding: 2, borderRadius: 7, border: `1px solid ${COLOR.borderSoft}`, background: COLOR.layer1, alignSelf: "flex-start" }, children: [["structured", "\u7ED3\u6784\u5316", "layers"], ["preview", "\u539F\u6587\u9884\u89C8", "file"]].map(([key, label, icon]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2260
|
+
"button",
|
|
2261
|
+
{
|
|
2262
|
+
type: "button",
|
|
2263
|
+
onClick: () => onTab(key),
|
|
2264
|
+
style: { display: "inline-flex", alignItems: "center", gap: 4, border: "none", borderRadius: 5, padding: "2px 9px", fontSize: DETAIL_FONT.small, lineHeight: fontPx(19), cursor: "pointer", color: tab === key ? COLOR.text : COLOR.secondary, background: tab === key ? COLOR.card : "transparent", boxShadow: tab === key ? `0 0 0 1px ${COLOR.borderSoft}` : "none" },
|
|
2265
|
+
children: [
|
|
2266
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: icon, size: 11 }),
|
|
2267
|
+
" ",
|
|
2268
|
+
label
|
|
2269
|
+
]
|
|
2270
|
+
},
|
|
2271
|
+
key
|
|
2272
|
+
)) }),
|
|
2273
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { flex: 1, minHeight: 0, overflowY: "auto", marginTop: 7, paddingRight: 3 }, children: tab === "preview" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PreviewPane, { card, cardFile, onReload: onReloadFile }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StructuredPane, { card, style, onFlow }) })
|
|
2274
|
+
] });
|
|
2275
|
+
}
|
|
2276
|
+
function PreviewPane({ card, cardFile, onReload }) {
|
|
2277
|
+
if (cardFile.loading) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: secondaryText({ paddingTop: 4 }), children: "\u8BFB\u53D6 task.md \u539F\u6587\u2026" });
|
|
2278
|
+
if (cardFile.error !== null) {
|
|
2279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { paddingTop: 4 }, children: [
|
|
2280
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: DETAIL_FONT.smallBody, color: COLOR.error, marginBottom: 6 }, children: [
|
|
2281
|
+
"\u539F\u6587\u9884\u89C8\u5931\u8D25\uFF1A",
|
|
2282
|
+
cardFile.error
|
|
2283
|
+
] }),
|
|
2284
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style: "icon", icon: "refresh", onClick: onReload, children: "\u91CD\u8BD5" })
|
|
2285
|
+
] });
|
|
2286
|
+
}
|
|
2287
|
+
if (cardFile.data === null) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: secondaryText({ paddingTop: 4 }), children: "\u8FD8\u6CA1\u6709\u8BFB\u5230\u539F\u6587\u3002" });
|
|
2288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
2289
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4, ...secondaryText({ fontSize: DETAIL_FONT.micro }) }, children: [
|
|
2290
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontFamily: "ui-monospace, monospace" }, children: cardFile.data.path }),
|
|
2291
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { marginLeft: "auto" }, children: [
|
|
2292
|
+
cardFile.data.markdown.length,
|
|
2293
|
+
" \u5B57\u7B26",
|
|
2294
|
+
cardFile.data.truncated ? "\uFF08\u8D85\u9650\u622A\u65AD\uFF09" : ""
|
|
2295
|
+
] })
|
|
2296
|
+
] }),
|
|
2297
|
+
cardFile.data.truncated ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: DETAIL_FONT.small, color: COLOR.warn, marginBottom: 4 }, children: "\u6587\u4EF6\u8D85\u8FC7 1 MiB\uFF0C\u53EA\u9884\u89C8\u524D 1 MiB\u3002" }) : null,
|
|
2298
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MarkdownView, { text: cardFile.data.markdown })
|
|
2299
|
+
] });
|
|
2300
|
+
}
|
|
2301
|
+
function StructuredPane({ card, style, onFlow }) {
|
|
2302
|
+
const sectionTitle = (text, extra) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, margin: "13px 0 5px", fontSize: DETAIL_FONT.small, fontWeight: 700, color: COLOR.secondary, letterSpacing: 0.2 }, children: [
|
|
2303
|
+
text,
|
|
2304
|
+
extra
|
|
2305
|
+
] });
|
|
2306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
2307
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 5, marginTop: 2 }, children: [
|
|
2308
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontSize: DETAIL_FONT.small, color: COLOR.secondary }, children: "\u72B6\u6001\u65D7\u6807" }),
|
|
2309
|
+
cardFlags(card).map((flag) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FlagPill, { flag, style }, flag.key)),
|
|
2310
|
+
card.category === null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontSize: DETAIL_FONT.tiny, color: COLOR.warn }, children: "\u672A\u5206\u7C7B\uFF1A\u8865 `category` \u540E\u7EDF\u8BA1\u66F4\u51C6" }) : null
|
|
2311
|
+
] }),
|
|
2312
|
+
sectionTitle("\u76EE\u6807"),
|
|
2313
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: DETAIL_FONT.smallBody, lineHeight: 1.65, borderLeft: `3px solid ${categoryMeta(card.category).color}`, background: COLOR.layer1, padding: "6px 9px" }, children: card.goal ?? "\uFF08\u672A\u5199\u4E00\u53E5\u8BDD\u76EE\u6807\uFF09" }),
|
|
2314
|
+
sectionTitle(`\u9A8C\u6536 ${card.acceptance.done}/${card.acceptance.total}`),
|
|
2315
|
+
card.acceptance.items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: secondaryText(), children: "\u672A\u89E3\u6790\u5230 A* \u9A8C\u6536\u9879" }) : card.acceptance.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", gap: 6, fontSize: DETAIL_FONT.smallBody, lineHeight: fontPx(20) }, children: [
|
|
2316
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { width: 13, color: item.checked ? COLOR.success : COLOR.tertiary, fontFamily: "ui-monospace, monospace" }, children: item.checked ? "\u2611" : "\u2610" }),
|
|
2317
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { color: item.checked ? COLOR.secondary : COLOR.text }, children: [
|
|
2318
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontFamily: "ui-monospace, monospace", color: COLOR.tertiary }, children: item.id }),
|
|
2319
|
+
" ",
|
|
2320
|
+
item.text
|
|
2321
|
+
] })
|
|
2322
|
+
] }, item.id)),
|
|
2323
|
+
sectionTitle(`\u6B65\u9AA4 ${stepLabel(card) ?? "\u672A\u62C6\u5206"}`, /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", onClick: onFlow, style: { border: "none", background: "transparent", color: COLOR.link, cursor: "pointer", fontSize: DETAIL_FONT.tiny, padding: 0 }, children: "\u6D41\u7A0B\u5730\u56FE" })),
|
|
2324
|
+
card.steps === null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: secondaryText(), children: "\u65E7\u5361\u6CA1\u6709 steps \u5757\uFF08\u5408\u6CD5\u517C\u5BB9\uFF09" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FlowMap, { card, style }),
|
|
2325
|
+
card.sections.next === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
2326
|
+
sectionTitle("\u4E0B\u4E00\u6B65"),
|
|
2327
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: DETAIL_FONT.smallBody, lineHeight: 1.65, borderLeft: `3px solid ${COLOR.brand}`, background: COLOR.layer1, padding: "6px 9px" }, children: card.sections.next })
|
|
2328
|
+
] }),
|
|
2329
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("details", { style: { marginTop: 12, border: `1px solid ${COLOR.borderSoft}`, borderRadius: 6, padding: "4px 8px" }, children: [
|
|
2330
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("summary", { style: { cursor: "pointer", fontSize: DETAIL_FONT.small, color: COLOR.secondary }, children: [
|
|
2331
|
+
"\u5DF2\u9A8C\u8BC1\u4E8B\u5B9E ",
|
|
2332
|
+
card.sections.verifiedFacts,
|
|
2333
|
+
" \xB7 \u5173\u952E\u51B3\u7B56 ",
|
|
2334
|
+
card.sections.decisions
|
|
2335
|
+
] }),
|
|
2336
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { marginTop: 4 }, children: [
|
|
2337
|
+
card.sections.verifiedFactsList.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: secondaryText(), children: "\uFF08\u7A7A\uFF09" }) : card.sections.verifiedFactsList.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: DETAIL_FONT.smallBody, lineHeight: 1.6 }, children: [
|
|
2338
|
+
"\xB7 ",
|
|
2339
|
+
item
|
|
2340
|
+
] }, `f-${index}`)),
|
|
2341
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { ...secondaryText({ margin: "7px 0 2px" }) }, children: "\u5173\u952E\u51B3\u7B56" }),
|
|
2342
|
+
card.sections.decisionsList.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: secondaryText(), children: "\uFF08\u7A7A\uFF09" }) : card.sections.decisionsList.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: DETAIL_FONT.smallBody, lineHeight: 1.6 }, children: [
|
|
2343
|
+
"\xB7 ",
|
|
2344
|
+
item
|
|
2345
|
+
] }, `d-${index}`))
|
|
2346
|
+
] })
|
|
2347
|
+
] }),
|
|
2348
|
+
card.sections.resume === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
2349
|
+
sectionTitle("Resume \u6307\u9488"),
|
|
2350
|
+
card.sections.resume.where === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: DETAIL_FONT.smallBody, lineHeight: 1.6 }, children: [
|
|
2351
|
+
"\u505A\u5230\u54EA\uFF1A",
|
|
2352
|
+
card.sections.resume.where
|
|
2353
|
+
] }),
|
|
2354
|
+
card.sections.resume.entry === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: DETAIL_FONT.smallBody, lineHeight: 1.6 }, children: [
|
|
2355
|
+
"\u5165\u53E3\uFF1A",
|
|
2356
|
+
card.sections.resume.entry
|
|
2357
|
+
] }),
|
|
2358
|
+
card.sections.resume.pauseReason === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: DETAIL_FONT.smallBody, lineHeight: 1.6 }, children: [
|
|
2359
|
+
"\u6682\u505C\u539F\u56E0\uFF1A",
|
|
2360
|
+
card.sections.resume.pauseReason
|
|
2361
|
+
] })
|
|
2362
|
+
] }),
|
|
2363
|
+
sectionTitle("\u6267\u884C\u53F2"),
|
|
2364
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: secondaryText(), children: [
|
|
2365
|
+
"\u5171 ",
|
|
2366
|
+
card.sections.executionLines,
|
|
2367
|
+
" \u6761\uFF1B\u6309\u5951\u7EA6\u9ED8\u8BA4\u4E0D\u6E32\u67D3\u6B63\u6587\u3002\u9700\u8981\u770B\u539F\u6587\u8BF7\u5207\u300C\u539F\u6587\u9884\u89C8\u300D\uFF0C\u6267\u884C\u53F2\u7AE0\u8282\u4E5F\u662F\u6298\u53E0\u7684\u3002"
|
|
2368
|
+
] }),
|
|
2369
|
+
card.archived ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { marginTop: 10, ...secondaryText() }, children: "\u5F52\u6863\u5361\uFF1A\u72B6\u6001\u4E0E\u4EA7\u7269\u4EE5 TASKFINISH.md / \u539F\u5361\u4E3A\u51C6\u3002" }) : null
|
|
2370
|
+
] });
|
|
2371
|
+
}
|
|
2372
|
+
function NewTaskDialog({ style, busy, onClose, onSubmit }) {
|
|
2373
|
+
const [title, setTitle] = (0, import_react3.useState)("");
|
|
2374
|
+
const [category, setCategory] = (0, import_react3.useState)("feature");
|
|
2375
|
+
const [goal, setGoal] = (0, import_react3.useState)("");
|
|
2376
|
+
const [error, setError] = (0, import_react3.useState)(null);
|
|
2377
|
+
(0, import_react3.useEffect)(() => {
|
|
2378
|
+
const onKey = (event) => {
|
|
2379
|
+
if (event.key === "Escape") onClose();
|
|
2380
|
+
};
|
|
2381
|
+
document.addEventListener("keydown", onKey);
|
|
2382
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
2383
|
+
}, [onClose]);
|
|
2384
|
+
const submit = (autoRun) => {
|
|
2385
|
+
if (title.trim() === "") {
|
|
2386
|
+
setError("\u5148\u5199\u4EFB\u52A1\u540D\uFF08\u767D\u8BDD\u4E00\u53E5\u8BDD\uFF09");
|
|
2387
|
+
return;
|
|
2388
|
+
}
|
|
2389
|
+
setError(null);
|
|
2390
|
+
onSubmit({ title: title.trim(), category, goal: goal.trim() }, autoRun);
|
|
2391
|
+
};
|
|
2392
|
+
const fieldStyle = {
|
|
2393
|
+
width: "100%",
|
|
2394
|
+
boxSizing: "border-box",
|
|
2395
|
+
border: `1px solid ${COLOR.border}`,
|
|
2396
|
+
borderRadius: 6,
|
|
2397
|
+
background: COLOR.layer1,
|
|
2398
|
+
color: COLOR.text,
|
|
2399
|
+
fontSize: fontPx(12),
|
|
2400
|
+
padding: "5px 8px",
|
|
2401
|
+
outline: "none"
|
|
2402
|
+
};
|
|
2403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2404
|
+
"div",
|
|
2405
|
+
{
|
|
2406
|
+
role: "presentation",
|
|
2407
|
+
onMouseDown: (event) => {
|
|
2408
|
+
if (event.target === event.currentTarget) onClose();
|
|
2409
|
+
},
|
|
2410
|
+
style: { position: "fixed", inset: 0, zIndex: 130, background: "var(--dsw-alias-bg-mask-1)", display: "flex", alignItems: "center", justifyContent: "center", padding: 16 },
|
|
2411
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { role: "dialog", "aria-modal": "true", "aria-label": "\u65B0\u5EFA\u4EFB\u52A1", style: { width: "min(420px, 94vw)", background: COLOR.bg, border: `1px solid ${COLOR.border}`, borderRadius: 10, boxShadow: "0 18px 60px rgba(0,0,0,0.32)", overflow: "hidden" }, children: [
|
|
2412
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, padding: "10px 12px", borderBottom: `1px solid ${COLOR.borderSoft}`, background: COLOR.layer1 }, children: [
|
|
2413
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "plus", size: 15 }),
|
|
2414
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontSize: fontPx(13), fontWeight: 700 }, children: "\u65B0\u5EFA\u4EFB\u52A1" }),
|
|
2415
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { ...secondaryText({ fontSize: fontPx(10) }), marginLeft: "auto" }, children: "\u4F1A\u8D70\u5F00\u5361\u95E8\u7981" }),
|
|
2416
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", onClick: onClose, "aria-label": "\u5173\u95ED", style: { border: "none", background: "transparent", color: COLOR.secondary, cursor: "pointer", padding: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "close", size: 15 }) })
|
|
2417
|
+
] }),
|
|
2418
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { padding: "10px 12px", display: "flex", flexDirection: "column", gap: 9 }, children: [
|
|
2419
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", flexDirection: "column", gap: 3, fontSize: fontPx(11), color: COLOR.secondary }, children: [
|
|
2420
|
+
"\u4EFB\u52A1\u540D\uFF08\u767D\u8BDD\u4E00\u53E5\u8BDD\uFF09",
|
|
2421
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { autoFocus: true, value: title, onChange: (event) => setTitle(event.target.value), placeholder: "\u4F8B\u5982\uFF1A\u7ED9\u4EFB\u52A1\u5361\u52A0\u6D41\u7A0B\u5730\u56FE", style: fieldStyle, onKeyDown: (event) => {
|
|
2422
|
+
if (event.key === "Enter" && !event.shiftKey) submit(false);
|
|
2423
|
+
} })
|
|
2424
|
+
] }),
|
|
2425
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", flexDirection: "column", gap: 3, fontSize: fontPx(11), color: COLOR.secondary }, children: [
|
|
2426
|
+
"\u4EFB\u52A1\u6027\u8D28\uFF08\u56FA\u5B9A\u5206\u7C7B\uFF09",
|
|
2427
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("select", { value: category, onChange: (event) => setCategory(event.target.value), style: fieldStyle, children: Object.entries(CATEGORY_OPTIONS).map(([key, meta]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("option", { value: key, children: [
|
|
2428
|
+
meta.label,
|
|
2429
|
+
" \xB7 ",
|
|
2430
|
+
meta.hint
|
|
2431
|
+
] }, key)) })
|
|
2432
|
+
] }),
|
|
2433
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", flexDirection: "column", gap: 3, fontSize: fontPx(11), color: COLOR.secondary }, children: [
|
|
2434
|
+
"\u4E00\u53E5\u8BDD\u76EE\u6807\uFF08\u53EF\u9009\uFF09",
|
|
2435
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("textarea", { value: goal, onChange: (event) => setGoal(event.target.value), rows: 2, placeholder: "\u8BF4\u4E0D\u6E05\u4EC0\u4E48\u7B97\u5B8C\u6210\u5C31\u522B\u5F00\u5361", style: { ...fieldStyle, resize: "vertical", fontFamily: "inherit" } })
|
|
2436
|
+
] }),
|
|
2437
|
+
error === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: fontPx(11), color: COLOR.error }, children: error }),
|
|
2438
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { ...secondaryText({ fontSize: fontPx(10), lineHeight: 1.55 }) }, children: "\u8D77\u8349 = \u6253\u5F00\u65B0\u4F1A\u8BDD\u5E76\u628A\u5F00\u5361\u6307\u4EE4\u653E\u8FDB\u8F93\u5165\u6846\uFF08\u4E0D\u53D1\u9001\uFF09\uFF1B\u6267\u884C = \u65B0\u4F1A\u8BDD\u81EA\u52A8\u8FD0\u884C\uFF0C\u8BA9 agent \u6309\u95E8\u7981\u8865\u95EE\u7F3A\u5931\u4FE1\u606F\u3002" }),
|
|
2439
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
|
|
2440
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 } }),
|
|
2441
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, onClick: onClose, disabled: busy, children: "\u53D6\u6D88" }),
|
|
2442
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, icon: "file", onClick: () => submit(false), disabled: busy, children: "\u4EC5\u8D77\u8349" }),
|
|
2443
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, icon: "play", tone: "primary", onClick: () => submit(true), disabled: busy, children: "\u5F00\u59CB\u6267\u884C" })
|
|
2444
|
+
] })
|
|
2445
|
+
] })
|
|
2446
|
+
] })
|
|
2447
|
+
}
|
|
2448
|
+
);
|
|
2449
|
+
}
|
|
2450
|
+
var CATEGORY_OPTIONS = CATEGORY_META;
|
|
2451
|
+
function baseName(path) {
|
|
2452
|
+
if (path === null || path === "") return null;
|
|
2453
|
+
const parts = path.split("/");
|
|
2454
|
+
return parts[parts.length - 1] ?? null;
|
|
2455
|
+
}
|
|
2456
|
+
function SettingsDialog({ style, snapshot, onClose, onSaved }) {
|
|
2457
|
+
const [loading, setLoading] = (0, import_react3.useState)(true);
|
|
2458
|
+
const [state, setState] = (0, import_react3.useState)(null);
|
|
2459
|
+
const [error, setError] = (0, import_react3.useState)(null);
|
|
2460
|
+
const [saving, setSaving] = (0, import_react3.useState)(false);
|
|
2461
|
+
const [tasksDir, setTasksDir] = (0, import_react3.useState)("");
|
|
2462
|
+
const [ledgerName, setLedgerName] = (0, import_react3.useState)("");
|
|
2463
|
+
const [archiveName, setArchiveName] = (0, import_react3.useState)("");
|
|
2464
|
+
(0, import_react3.useEffect)(() => {
|
|
2465
|
+
let cancelled = false;
|
|
2466
|
+
void (async () => {
|
|
2467
|
+
try {
|
|
2468
|
+
const next = await requestSettings(snapshot?.projectRoot ?? null);
|
|
2469
|
+
if (cancelled) return;
|
|
2470
|
+
setState(next);
|
|
2471
|
+
setTasksDir(next.values.tasksDir !== "" ? next.values.tasksDir : "tasks");
|
|
2472
|
+
setLedgerName(next.values.ledgerName !== "" ? next.values.ledgerName : "TASKS.md");
|
|
2473
|
+
setArchiveName(next.values.archiveName !== "" ? next.values.archiveName : "TASKFINISH.md");
|
|
2474
|
+
} catch (cause) {
|
|
2475
|
+
if (!cancelled) setError(errorText(cause));
|
|
2476
|
+
} finally {
|
|
2477
|
+
if (!cancelled) setLoading(false);
|
|
2478
|
+
}
|
|
2479
|
+
})();
|
|
2480
|
+
return () => {
|
|
2481
|
+
cancelled = true;
|
|
2482
|
+
};
|
|
2483
|
+
}, []);
|
|
2484
|
+
const editable = state?.editable === true;
|
|
2485
|
+
const submit = () => {
|
|
2486
|
+
if (!editable || saving) return;
|
|
2487
|
+
setSaving(true);
|
|
2488
|
+
setError(null);
|
|
2489
|
+
void (async () => {
|
|
2490
|
+
try {
|
|
2491
|
+
await saveSettings({ tasksDir: tasksDir.trim(), ledgerName: ledgerName.trim(), archiveName: archiveName.trim() }, snapshot?.projectRoot ?? null);
|
|
2492
|
+
onSaved();
|
|
2493
|
+
} catch (cause) {
|
|
2494
|
+
setError(errorText(cause));
|
|
2495
|
+
setSaving(false);
|
|
2496
|
+
}
|
|
2497
|
+
})();
|
|
2498
|
+
};
|
|
2499
|
+
const fieldStyle = {
|
|
2500
|
+
width: "100%",
|
|
2501
|
+
boxSizing: "border-box",
|
|
2502
|
+
border: `1px solid ${COLOR.border}`,
|
|
2503
|
+
borderRadius: 6,
|
|
2504
|
+
background: COLOR.layer1,
|
|
2505
|
+
color: COLOR.text,
|
|
2506
|
+
fontSize: fontPx(12),
|
|
2507
|
+
padding: "5px 8px",
|
|
2508
|
+
outline: "none"
|
|
2509
|
+
};
|
|
2510
|
+
const field = (label, value, onChange) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", flexDirection: "column", gap: 3, fontSize: fontPx(11), color: COLOR.secondary }, children: [
|
|
2511
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: label }),
|
|
2512
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2513
|
+
"input",
|
|
2514
|
+
{
|
|
2515
|
+
value,
|
|
2516
|
+
disabled: !editable,
|
|
2517
|
+
onChange: (event) => onChange(event.target.value),
|
|
2518
|
+
style: fieldStyle
|
|
2519
|
+
}
|
|
2520
|
+
)
|
|
2521
|
+
] });
|
|
2522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2523
|
+
"div",
|
|
2524
|
+
{
|
|
2525
|
+
role: "presentation",
|
|
2526
|
+
onMouseDown: (event) => {
|
|
2527
|
+
if (event.target === event.currentTarget) onClose();
|
|
2528
|
+
},
|
|
2529
|
+
style: { position: "fixed", inset: 0, zIndex: 131, background: "var(--dsw-alias-bg-mask-1)", display: "flex", alignItems: "center", justifyContent: "center", padding: 16 },
|
|
2530
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { role: "dialog", "aria-modal": "true", "aria-label": "\u4EFB\u52A1\u5361\u8BBE\u7F6E", style: { width: "min(440px, 94vw)", background: COLOR.bg, border: `1px solid ${COLOR.border}`, borderRadius: 10, boxShadow: "0 18px 60px rgba(0,0,0,0.32)", overflow: "hidden" }, children: [
|
|
2531
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, padding: "10px 12px", borderBottom: `1px solid ${COLOR.borderSoft}`, background: COLOR.layer1 }, children: [
|
|
2532
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "settings", size: 15 }),
|
|
2533
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontSize: fontPx(13), fontWeight: 700 }, children: "\u4EFB\u52A1\u5361\u8BBE\u7F6E" }),
|
|
2534
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { ...secondaryText({ fontSize: fontPx(10) }), marginLeft: "auto" }, children: "\u5199\u5165\u9879\u76EE\u914D\u7F6E" }),
|
|
2535
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", onClick: onClose, "aria-label": "\u5173\u95ED", style: { border: "none", background: "transparent", color: COLOR.secondary, cursor: "pointer", padding: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "close", size: 15 }) })
|
|
2536
|
+
] }),
|
|
2537
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { padding: "10px 12px", display: "flex", flexDirection: "column", gap: 9 }, children: loading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { ...secondaryText(), display: "inline-flex", alignItems: "center", gap: 5 }, children: [
|
|
2538
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "refresh", size: 12, style: { animation: "tc-spin 900ms linear infinite" } }),
|
|
2539
|
+
" \u8BFB\u53D6\u8BBE\u7F6E\u2026"
|
|
2540
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
2541
|
+
field("\u6570\u636E\u76EE\u5F55\uFF08\u76F8\u5BF9\u9879\u76EE\u6839\uFF09", tasksDir, setTasksDir),
|
|
2542
|
+
field("\u603B\u8D26\u6587\u4EF6\u540D", ledgerName, setLedgerName),
|
|
2543
|
+
field("\u5F52\u6863\u6587\u4EF6\u540D", archiveName, setArchiveName),
|
|
2544
|
+
snapshot === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { ...secondaryText({ fontSize: fontPx(10), lineHeight: 1.6 }) }, children: [
|
|
2545
|
+
"\u5F53\u524D\u751F\u6548\uFF1A",
|
|
2546
|
+
snapshot.dataDir,
|
|
2547
|
+
"/\uFF08",
|
|
2548
|
+
CONFIG_SOURCE_LABEL[snapshot.configSources.dataDir],
|
|
2549
|
+
"\uFF09\xB7 ",
|
|
2550
|
+
baseName(snapshot.ledger.file),
|
|
2551
|
+
" \xB7 ",
|
|
2552
|
+
baseName(snapshot.archive.file)
|
|
2553
|
+
] }),
|
|
2554
|
+
state !== null && !state.editable ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: fontPx(10.5), lineHeight: 1.6, color: COLOR.warn }, children: state.reason }) : null,
|
|
2555
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { ...secondaryText({ fontSize: fontPx(10), lineHeight: 1.55 }) }, children: [
|
|
2556
|
+
"\u4FDD\u5B58\u4F1A\u5199\u5165\u5F53\u524D\u9879\u76EE\u7684 ",
|
|
2557
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: "task-card.config.yml" }),
|
|
2558
|
+
"\uFF1A\u9879\u76EE\u6CA1\u6709\u8BE5\u6587\u4EF6\u65F6\u521B\u5EFA\uFF0C\u53EA\u6539\u8FD9\u4E09\u4E2A\u952E\u3001 \u5176\u4ED6\u952E\u4E0E\u6CE8\u91CA\u4FDD\u6301\u4E0D\u53D8\u3002git \u91CC\u4F1A\u51FA\u73B0\u8FD9\u6B21\u6539\u52A8\uFF0C\u9700\u8981\u4F60\u63D0\u4EA4\u3002"
|
|
2559
|
+
] }),
|
|
2560
|
+
error === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: fontPx(11), color: COLOR.error }, children: error }),
|
|
2561
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
|
|
2562
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 } }),
|
|
2563
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, onClick: onClose, disabled: saving, children: "\u53D6\u6D88" }),
|
|
2564
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, icon: "check", tone: "primary", onClick: submit, disabled: !editable || saving, children: saving ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58\u5230\u9879\u76EE\u914D\u7F6E" })
|
|
2565
|
+
] })
|
|
2566
|
+
] }) })
|
|
2567
|
+
] })
|
|
2568
|
+
}
|
|
2569
|
+
);
|
|
2570
|
+
}
|
|
2571
|
+
async function requestSnapshot(refresh, projectRoot) {
|
|
2572
|
+
const route = refresh ? SNAPSHOT_ROUTES.refresh : SNAPSHOT_ROUTES.get;
|
|
2573
|
+
const query = projectRoot === null ? "" : `?projectRoot=${encodeURIComponent(projectRoot)}`;
|
|
2574
|
+
const response = await fetch(`${route}${query}`, { method: refresh ? "POST" : "GET" });
|
|
2575
|
+
const payload = await response.json();
|
|
2576
|
+
if (!response.ok || !payload.ok || payload.data === void 0) throw new Error(payload.error ?? `\u5FEB\u7167\u8BF7\u6C42\u5931\u8D25\uFF08HTTP ${response.status}\uFF09`);
|
|
2577
|
+
return payload.data;
|
|
2578
|
+
}
|
|
2579
|
+
async function requestCardFile(id, projectRoot) {
|
|
2580
|
+
const params = new URLSearchParams({ id });
|
|
2581
|
+
if (projectRoot !== null) params.set("projectRoot", projectRoot);
|
|
2582
|
+
const response = await fetch(`${SNAPSHOT_ROUTES.card}?${params.toString()}`);
|
|
2583
|
+
const payload = await response.json();
|
|
2584
|
+
if (!response.ok || !payload.ok || payload.data === void 0) throw new Error(payload.error ?? `\u539F\u6587\u8BF7\u6C42\u5931\u8D25\uFF08HTTP ${response.status}\uFF09`);
|
|
2585
|
+
return payload.data;
|
|
2586
|
+
}
|
|
2587
|
+
async function requestTaskFiles(id, projectRoot) {
|
|
2588
|
+
const params = new URLSearchParams({ id });
|
|
2589
|
+
if (projectRoot !== null) params.set("projectRoot", projectRoot);
|
|
2590
|
+
const response = await fetch(`${SNAPSHOT_ROUTES.files}?${params.toString()}`);
|
|
2591
|
+
const payload = await response.json();
|
|
2592
|
+
if (!response.ok || !payload.ok || payload.data === void 0) throw new Error(payload.error ?? `\u4EFB\u52A1\u6587\u4EF6\u5217\u8868\u5931\u8D25\uFF08HTTP ${response.status}\uFF09`);
|
|
2593
|
+
return payload.data;
|
|
2594
|
+
}
|
|
2595
|
+
async function requestSettings(projectRoot) {
|
|
2596
|
+
const query = projectRoot === null ? "" : `?projectRoot=${encodeURIComponent(projectRoot)}`;
|
|
2597
|
+
const response = await fetch(`${SNAPSHOT_ROUTES.settings}${query}`);
|
|
2598
|
+
const payload = await response.json();
|
|
2599
|
+
if (!response.ok || !payload.ok || payload.data === void 0) throw new Error(payload.error ?? `\u8BBE\u7F6E\u8BFB\u53D6\u5931\u8D25\uFF08HTTP ${response.status}\uFF09`);
|
|
2600
|
+
return payload.data;
|
|
2601
|
+
}
|
|
2602
|
+
async function saveSettings(values, projectRoot) {
|
|
2603
|
+
const query = projectRoot === null ? "" : `?projectRoot=${encodeURIComponent(projectRoot)}`;
|
|
2604
|
+
const response = await fetch(`${SNAPSHOT_ROUTES.settings}${query}`, {
|
|
2605
|
+
method: "POST",
|
|
2606
|
+
headers: { "content-type": "application/json" },
|
|
2607
|
+
body: JSON.stringify(values)
|
|
2608
|
+
});
|
|
2609
|
+
const payload = await response.json();
|
|
2610
|
+
if (!response.ok || !payload.ok) throw new Error(payload.error ?? `\u8BBE\u7F6E\u4FDD\u5B58\u5931\u8D25\uFF08HTTP ${response.status}\uFF09`);
|
|
2611
|
+
}
|
|
2612
|
+
function TaskCardPanel() {
|
|
2613
|
+
const [snapshot, setSnapshot] = (0, import_react3.useState)(null);
|
|
2614
|
+
const [loading, setLoading] = (0, import_react3.useState)(true);
|
|
2615
|
+
const [error, setError] = (0, import_react3.useState)(null);
|
|
2616
|
+
const [style, setStyle] = (0, import_react3.useState)(loadStyle);
|
|
2617
|
+
const [colorStrength, setColorStrength] = (0, import_react3.useState)(loadColorStrength);
|
|
2618
|
+
const [view, setView] = (0, import_react3.useState)("active");
|
|
2619
|
+
const [filter, setFilter] = (0, import_react3.useState)(null);
|
|
2620
|
+
const [visibleCount, setVisibleCount] = (0, import_react3.useState)(PAGE_SIZE);
|
|
2621
|
+
const [detailId, setDetailId] = (0, import_react3.useState)(null);
|
|
2622
|
+
const [flowHover, setFlowHover] = (0, import_react3.useState)(null);
|
|
2623
|
+
const [statsOpen, setStatsOpen] = (0, import_react3.useState)(false);
|
|
2624
|
+
const [diagnosticsOpen, setDiagnosticsOpen] = (0, import_react3.useState)(false);
|
|
2625
|
+
const [consistencyOpen, setConsistencyOpen] = (0, import_react3.useState)(false);
|
|
2626
|
+
const [toast, setToast] = (0, import_react3.useState)(null);
|
|
2627
|
+
const [newTaskOpen, setNewTaskOpen] = (0, import_react3.useState)(false);
|
|
2628
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react3.useState)(false);
|
|
2629
|
+
const [busyKey, setBusyKey] = (0, import_react3.useState)(null);
|
|
2630
|
+
const [detailTab, setDetailTab] = (0, import_react3.useState)("structured");
|
|
2631
|
+
const [cardFile, setCardFile] = (0, import_react3.useState)({ loading: false, error: null, data: null });
|
|
2632
|
+
const lastRoot = (0, import_react3.useRef)(null);
|
|
2633
|
+
const cardFileSeq = (0, import_react3.useRef)(0);
|
|
2634
|
+
const showToast = (text, tone = "info") => setToast({ text, tone, seq: Date.now() });
|
|
2635
|
+
const load = async (refresh) => {
|
|
2636
|
+
setLoading(true);
|
|
2637
|
+
setError(null);
|
|
2638
|
+
try {
|
|
2639
|
+
const projectRoot = resolveClientProjectRoot();
|
|
2640
|
+
lastRoot.current = projectRoot;
|
|
2641
|
+
setSnapshot(await requestSnapshot(refresh, projectRoot));
|
|
2642
|
+
} catch (cause) {
|
|
2643
|
+
setError(errorText(cause));
|
|
2644
|
+
} finally {
|
|
2645
|
+
setLoading(false);
|
|
2646
|
+
}
|
|
2647
|
+
};
|
|
2648
|
+
(0, import_react3.useEffect)(() => {
|
|
2649
|
+
void load(false);
|
|
2650
|
+
}, []);
|
|
2651
|
+
(0, import_react3.useEffect)(() => {
|
|
2652
|
+
const check = () => {
|
|
2653
|
+
const next = resolveClientProjectRoot();
|
|
2654
|
+
if (next !== null && next !== lastRoot.current) {
|
|
2655
|
+
lastRoot.current = next;
|
|
2656
|
+
void load(true);
|
|
2657
|
+
}
|
|
2658
|
+
};
|
|
2659
|
+
const timer = window.setInterval(check, 2500);
|
|
2660
|
+
window.addEventListener("focus", check);
|
|
2661
|
+
const sessions = runtime.sessions ?? runtimeContext?.get?.("sessions");
|
|
2662
|
+
const workspaces = runtime.workspaces ?? runtimeContext?.get?.("workspaces");
|
|
2663
|
+
const unsubscribeSessions = sessions?.list?.subscribe?.(check);
|
|
2664
|
+
const unsubscribeWorkspaces = workspaces?.list.subscribe?.(check);
|
|
2665
|
+
return () => {
|
|
2666
|
+
window.clearInterval(timer);
|
|
2667
|
+
window.removeEventListener("focus", check);
|
|
2668
|
+
unsubscribeSessions?.();
|
|
2669
|
+
unsubscribeWorkspaces?.();
|
|
2670
|
+
};
|
|
2671
|
+
}, []);
|
|
2672
|
+
(0, import_react3.useEffect)(() => {
|
|
2673
|
+
try {
|
|
2674
|
+
localStorage.setItem(STYLE_KEY, style);
|
|
2675
|
+
} catch {
|
|
2676
|
+
}
|
|
2677
|
+
}, [style]);
|
|
2678
|
+
(0, import_react3.useEffect)(() => {
|
|
2679
|
+
try {
|
|
2680
|
+
localStorage.setItem(COLOR_STRENGTH_KEY, String(clampColorStrength(colorStrength)));
|
|
2681
|
+
} catch {
|
|
2682
|
+
}
|
|
2683
|
+
}, [colorStrength]);
|
|
2684
|
+
(0, import_react3.useEffect)(() => {
|
|
2685
|
+
setVisibleCount(PAGE_SIZE);
|
|
2686
|
+
}, [view, filter]);
|
|
2687
|
+
(0, import_react3.useEffect)(() => {
|
|
2688
|
+
if (toast === null) return;
|
|
2689
|
+
const timer = window.setTimeout(() => setToast(null), 4200);
|
|
2690
|
+
return () => window.clearTimeout(timer);
|
|
2691
|
+
}, [toast]);
|
|
2692
|
+
const detail = detailId === null ? null : (snapshot?.cards ?? []).find((card) => card.id === detailId) ?? null;
|
|
2693
|
+
const flowCard = flowHover === null ? null : (snapshot?.cards ?? []).find((card) => card.id === flowHover.cardId) ?? null;
|
|
2694
|
+
const allCards = snapshot?.cards ?? [];
|
|
2695
|
+
const completedCount = allCards.filter(isClosedCard).length;
|
|
2696
|
+
const activeCount = allCards.length - completedCount;
|
|
2697
|
+
const scopeCards = viewCards(allCards, view);
|
|
2698
|
+
const filteredCards = sortCards(scopeCards.filter((card) => matchesFilter(card, filter)));
|
|
2699
|
+
const visibleCards = filteredCards.slice(0, visibleCount);
|
|
2700
|
+
const remainingCards = Math.max(0, filteredCards.length - visibleCards.length);
|
|
2701
|
+
const flowTimer = (0, import_react3.useRef)(null);
|
|
2702
|
+
const cancelFlowClose = () => {
|
|
2703
|
+
if (flowTimer.current !== null) {
|
|
2704
|
+
window.clearTimeout(flowTimer.current);
|
|
2705
|
+
flowTimer.current = null;
|
|
2706
|
+
}
|
|
2707
|
+
};
|
|
2708
|
+
const openFlow = (cardId, anchor) => {
|
|
2709
|
+
cancelFlowClose();
|
|
2710
|
+
setFlowHover({ cardId, anchor });
|
|
2711
|
+
};
|
|
2712
|
+
const scheduleFlowClose = () => {
|
|
2713
|
+
cancelFlowClose();
|
|
2714
|
+
flowTimer.current = window.setTimeout(() => setFlowHover(null), 220);
|
|
2715
|
+
};
|
|
2716
|
+
const closeFlow = () => {
|
|
2717
|
+
cancelFlowClose();
|
|
2718
|
+
setFlowHover(null);
|
|
2719
|
+
};
|
|
2720
|
+
(0, import_react3.useEffect)(() => () => {
|
|
2721
|
+
if (flowTimer.current !== null) window.clearTimeout(flowTimer.current);
|
|
2722
|
+
}, []);
|
|
2723
|
+
const reloadFile = (id) => {
|
|
2724
|
+
const seq = ++cardFileSeq.current;
|
|
2725
|
+
setCardFile({ loading: true, error: null, data: null });
|
|
2726
|
+
const projectRoot = snapshot?.projectRoot ?? resolveClientProjectRoot();
|
|
2727
|
+
void requestCardFile(id, projectRoot).then((data) => {
|
|
2728
|
+
if (seq === cardFileSeq.current) setCardFile({ loading: false, error: null, data });
|
|
2729
|
+
}).catch((cause) => {
|
|
2730
|
+
if (seq === cardFileSeq.current) setCardFile({ loading: false, error: errorText(cause), data: null });
|
|
2731
|
+
});
|
|
2732
|
+
};
|
|
2733
|
+
(0, import_react3.useEffect)(() => {
|
|
2734
|
+
if (detailId === null) {
|
|
2735
|
+
cardFileSeq.current += 1;
|
|
2736
|
+
setCardFile({ loading: false, error: null, data: null });
|
|
2737
|
+
return;
|
|
2738
|
+
}
|
|
2739
|
+
if (detailTab !== "preview") {
|
|
2740
|
+
cardFileSeq.current += 1;
|
|
2741
|
+
return;
|
|
2742
|
+
}
|
|
2743
|
+
reloadFile(detailId);
|
|
2744
|
+
}, [detailId, snapshot?.projectRoot, detailTab]);
|
|
2745
|
+
const openDetail = (id) => {
|
|
2746
|
+
setDetailId(id);
|
|
2747
|
+
setDetailTab("structured");
|
|
2748
|
+
setStatsOpen(false);
|
|
2749
|
+
closeFlow();
|
|
2750
|
+
};
|
|
2751
|
+
const changeView = (next) => {
|
|
2752
|
+
setView(next);
|
|
2753
|
+
setFilter(null);
|
|
2754
|
+
setVisibleCount(PAGE_SIZE);
|
|
2755
|
+
setStatsOpen(false);
|
|
2756
|
+
};
|
|
2757
|
+
const chooseFilter = (next) => {
|
|
2758
|
+
setFilter((current) => current !== null && current.type === next.type && current.key === next.key ? null : next);
|
|
2759
|
+
setVisibleCount(PAGE_SIZE);
|
|
2760
|
+
setStatsOpen(false);
|
|
2761
|
+
};
|
|
2762
|
+
const startSession = async (prompt, autoRun) => {
|
|
2763
|
+
const sessions = runtime.sessions ?? runtimeContext?.get?.("sessions");
|
|
2764
|
+
const workspace = runtime.uiWorkspace ?? runtimeContext?.get?.("uiWorkspace");
|
|
2765
|
+
if (sessions === void 0 || workspace === void 0) {
|
|
2766
|
+
throw new Error("\u5BBF\u4E3B\u4F1A\u8BDD\u670D\u52A1\u4E0D\u53EF\u7528\uFF08sessions / uiWorkspace \u672A\u6CE8\u5165\uFF09\uFF1B\u53EF\u5148\u590D\u5236 prompt \u624B\u52A8\u7C98\u8D34");
|
|
2767
|
+
}
|
|
2768
|
+
const target = resolveClientProjectTarget();
|
|
2769
|
+
if (target.path === null) {
|
|
2770
|
+
throw new Error("\u6CA1\u6709\u627E\u5230\u5F53\u524D\u4F1A\u8BDD\u7684\u9879\u76EE\u6839\uFF0C\u672A\u65B0\u5EFA\u4F1A\u8BDD\uFF1B\u8BF7\u5148\u5728\u9879\u76EE\u91CC\u6253\u5F00\u4E00\u4E2A\u4F1A\u8BDD");
|
|
2771
|
+
}
|
|
2772
|
+
if (target.workspaceId === null) {
|
|
2773
|
+
throw new Error("\u6CA1\u6709\u627E\u5230\u5F53\u524D\u4F1A\u8BDD\u6240\u5C5E\u5DE5\u4F5C\u533A\uFF0C\u672A\u65B0\u5EFA\u4F1A\u8BDD\uFF08\u907F\u514D\u5EFA\u5230\u65E0\u9879\u76EE\u7684\u7A7A\u4F1A\u8BDD\uFF09\uFF1B\u8BF7\u5148\u5728\u8BE5\u9879\u76EE\u7684\u4F1A\u8BDD\u91CC\u91CD\u8BD5");
|
|
2774
|
+
}
|
|
2775
|
+
const draftConversation = autoRun ? void 0 : runtime.conversation ?? runtimeContext?.get?.("conversation");
|
|
2776
|
+
if (!autoRun && draftConversation === void 0) {
|
|
2777
|
+
throw new Error("\u5BBF\u4E3B\u8F93\u5165\u6846\u670D\u52A1\u4E0D\u53EF\u7528\uFF08conversation \u672A\u6CE8\u5165\uFF09\uFF0C\u672A\u65B0\u5EFA\u4F1A\u8BDD\uFF1B\u53EF\u5148\u590D\u5236 prompt \u624B\u52A8\u7C98\u8D34");
|
|
2778
|
+
}
|
|
2779
|
+
const createOptions = sessionCreateOptions(target);
|
|
2780
|
+
if (createOptions === null) throw new Error("\u6CA1\u6709\u627E\u5230\u5F53\u524D\u4F1A\u8BDD\u6240\u5C5E\u5DE5\u4F5C\u533A\uFF0C\u672A\u65B0\u5EFA\u4F1A\u8BDD");
|
|
2781
|
+
const id = await sessions.create(createOptions);
|
|
2782
|
+
const reference = sessions.retain(id, { source: "taskCard" });
|
|
2783
|
+
try {
|
|
2784
|
+
await reference.ready;
|
|
2785
|
+
if (!autoRun) {
|
|
2786
|
+
if (draftConversation === void 0) throw new Error("\u5BBF\u4E3B\u8F93\u5165\u6846\u670D\u52A1\u4E0D\u53EF\u7528\uFF08conversation \u672A\u6CE8\u5165\uFF09");
|
|
2787
|
+
const result = draftConversation.input.requestDraftInitialization(reference.binding, { prompt, whenDraftExists: "replace" });
|
|
2788
|
+
if (result === "blocked") throw new Error("\u65B0\u4F1A\u8BDD\u8F93\u5165\u6846\u6B63\u5FD9\uFF0C\u8349\u7A3F\u6CA1\u6709\u5199\u5165\uFF1B\u8BF7\u7A0D\u540E\u91CD\u8BD5");
|
|
2789
|
+
}
|
|
2790
|
+
workspace.openSession(id);
|
|
2791
|
+
if (autoRun) {
|
|
2792
|
+
const result = await reference.binding.session.prompt([{ type: "text", text: prompt }], "queue");
|
|
2793
|
+
if (!result.ok) throw new Error(`\u81EA\u52A8\u6267\u884C\u6CA1\u6709\u9001\u8FBE\uFF1A${result.error?.message ?? result.error?.code ?? "\u5BBF\u4E3B\u62D2\u7EDD"}`);
|
|
2794
|
+
}
|
|
2795
|
+
} finally {
|
|
2796
|
+
reference.release();
|
|
2797
|
+
}
|
|
2798
|
+
};
|
|
2799
|
+
const runAction = async (key, action, success) => {
|
|
2800
|
+
if (busyKey !== null) return;
|
|
2801
|
+
setBusyKey(key);
|
|
2802
|
+
try {
|
|
2803
|
+
await action();
|
|
2804
|
+
showToast(success, "success");
|
|
2805
|
+
} catch (cause) {
|
|
2806
|
+
showToast(errorText(cause), "error");
|
|
2807
|
+
} finally {
|
|
2808
|
+
setBusyKey(null);
|
|
2809
|
+
}
|
|
2810
|
+
};
|
|
2811
|
+
const handleContinue = (card) => {
|
|
2812
|
+
const prompt = continuePrompt(card.id);
|
|
2813
|
+
void runAction(`continue:${card.id}`, async () => {
|
|
2814
|
+
await startSession(prompt, false);
|
|
2815
|
+
}, `\u5DF2\u5728\u65B0\u4F1A\u8BDD\u8349\u7A3F\u91CC\u586B\u5165\u300C${prompt}\u300D\uFF0C\u6CA1\u6709\u81EA\u52A8\u53D1\u9001`);
|
|
2816
|
+
};
|
|
2817
|
+
const handleRun = (card) => {
|
|
2818
|
+
const prompt = continuePrompt(card.id);
|
|
2819
|
+
void runAction(`run:${card.id}`, async () => {
|
|
2820
|
+
await startSession(prompt, true);
|
|
2821
|
+
}, `\u5DF2\u5728\u65B0\u4F1A\u8BDD\u81EA\u52A8\u6267\u884C\u300C${prompt}\u300D`);
|
|
2822
|
+
};
|
|
2823
|
+
const handleReopen = (card) => {
|
|
2824
|
+
const prompt = reopenPrompt(card.id);
|
|
2825
|
+
void runAction(`reopen:${card.id}`, async () => {
|
|
2826
|
+
await startSession(prompt, false);
|
|
2827
|
+
}, `\u5DF2\u5728\u65B0\u4F1A\u8BDD\u8349\u7A3F\u91CC\u586B\u5165\u300C${prompt}\u300D\uFF0C\u6CA1\u6709\u81EA\u52A8\u53D1\u9001`);
|
|
2828
|
+
};
|
|
2829
|
+
const handleNewTask = (input, autoRun) => {
|
|
2830
|
+
const prompt = buildNewTaskPrompt(input.title, input.category, input.goal);
|
|
2831
|
+
void runAction("new-task", async () => {
|
|
2832
|
+
await startSession(prompt, autoRun);
|
|
2833
|
+
setNewTaskOpen(false);
|
|
2834
|
+
}, autoRun ? "\u5DF2\u5728\u65B0\u4F1A\u8BDD\u6267\u884C\u5F00\u5361\u6307\u4EE4" : "\u5DF2\u5728\u65B0\u4F1A\u8BDD\u8349\u7A3F\u91CC\u586B\u5165\u5F00\u5361\u6307\u4EE4\uFF0C\u6CA1\u6709\u81EA\u52A8\u53D1\u9001");
|
|
2835
|
+
};
|
|
2836
|
+
const tryPreviewInSidebar = (absolutePath) => {
|
|
2837
|
+
const sidebar = runtime.sidebarRight ?? runtimeContext?.get?.("sidebarRight");
|
|
2838
|
+
if (sidebar === void 0) return "\u5F53\u524D\u73AF\u5883\u6CA1\u6709 DSH \u53F3\u4FA7\u680F\u9884\u89C8\u670D\u52A1";
|
|
2839
|
+
const sessionId = sidebar.mounted?.getSnapshot() ?? currentSessionId();
|
|
2840
|
+
if (sessionId === void 0 || sessionId === null) return "\u6CA1\u6709\u627E\u5230\u5F53\u524D\u4F1A\u8BDD";
|
|
2841
|
+
const workspace = resolveClientProjectTarget(runtime, sessionId).path;
|
|
2842
|
+
if (workspace === null) return "\u8BFB\u4E0D\u5230\u5F53\u524D\u4F1A\u8BDD\u7684\u5DE5\u4F5C\u76EE\u5F55";
|
|
2843
|
+
if (!isInsideDirectory(workspace, absolutePath)) return "\u8FD9\u4E2A\u6587\u4EF6\u4E0D\u5728\u5F53\u524D\u4F1A\u8BDD\u7684\u5DE5\u4F5C\u533A\u91CC\uFF0CDSH \u9884\u89C8\u6253\u4E0D\u5F00";
|
|
2844
|
+
try {
|
|
2845
|
+
sidebar.openResource(sessionFileAddress(sessionId, absolutePath));
|
|
2846
|
+
return null;
|
|
2847
|
+
} catch (cause) {
|
|
2848
|
+
return `DSH \u9884\u89C8\u6CA1\u6253\u5F00\uFF08${errorText(cause)}\uFF09`;
|
|
2849
|
+
}
|
|
2850
|
+
};
|
|
2851
|
+
const openWithSystem = async (absolutePath) => {
|
|
2852
|
+
const remote = runtime.remote ?? runtimeContext?.get?.("remote");
|
|
2853
|
+
if (remote === void 0) throw new Error("\u5BBF\u4E3B\u6587\u4EF6\u670D\u52A1\u4E0D\u53EF\u7528\uFF08remote \u672A\u6CE8\u5165\uFF09");
|
|
2854
|
+
const hostPath = /^[A-Za-z]:[\\/]/.test(absolutePath) ? windowsPath(absolutePath) : absolutePath;
|
|
2855
|
+
const result = await remote.session.openWorkspacePath({ path: hostPath });
|
|
2856
|
+
if (!result.ok) throw new Error(`\u6253\u5F00\u6587\u4EF6\u5931\u8D25\uFF1A${result.error?.message ?? "\u5BBF\u4E3B\u62D2\u7EDD"}`);
|
|
2857
|
+
};
|
|
2858
|
+
const openProjectFile = (absolutePath, displayName, mode) => {
|
|
2859
|
+
void (async () => {
|
|
2860
|
+
try {
|
|
2861
|
+
const reason = mode === "system" ? "" : tryPreviewInSidebar(absolutePath);
|
|
2862
|
+
if (reason === null) {
|
|
2863
|
+
showToast(`\u5DF2\u5728\u53F3\u4FA7\u9884\u89C8 ${displayName}`, "success");
|
|
2864
|
+
return;
|
|
2865
|
+
}
|
|
2866
|
+
try {
|
|
2867
|
+
await openWithSystem(absolutePath);
|
|
2868
|
+
} catch (cause) {
|
|
2869
|
+
throw new Error(reason === "" ? errorText(cause) : `${reason}\uFF1B\u6539\u7528\u7CFB\u7EDF\u9ED8\u8BA4\u7A0B\u5E8F\u4E5F\u6CA1\u6253\u5F00\uFF1A${errorText(cause)}`);
|
|
2870
|
+
}
|
|
2871
|
+
showToast(
|
|
2872
|
+
reason === "" ? `\u5DF2\u7528\u7CFB\u7EDF\u9ED8\u8BA4\u7A0B\u5E8F\u6253\u5F00 ${displayName}` : `${reason}\uFF0C\u5DF2\u6539\u7528\u7CFB\u7EDF\u9ED8\u8BA4\u7A0B\u5E8F\u6253\u5F00 ${displayName}`,
|
|
2873
|
+
reason === "" ? "success" : "info"
|
|
2874
|
+
);
|
|
2875
|
+
} catch (cause) {
|
|
2876
|
+
showToast(errorText(cause), "error");
|
|
2877
|
+
}
|
|
2878
|
+
})();
|
|
2879
|
+
};
|
|
2880
|
+
const handleOpenTaskFile = (card, relativePath, mode) => {
|
|
2881
|
+
if (snapshot === null) {
|
|
2882
|
+
showToast("\u5FEB\u7167\u8FD8\u6CA1\u52A0\u8F7D", "error");
|
|
2883
|
+
return;
|
|
2884
|
+
}
|
|
2885
|
+
openProjectFile(joinProjectPath(joinProjectPath(snapshot.projectRoot, card.dir), relativePath), windowsPath(relativePath), mode);
|
|
2886
|
+
};
|
|
2887
|
+
const handleOpenDoc = (relativePath) => {
|
|
2888
|
+
if (snapshot === null) {
|
|
2889
|
+
showToast("\u5FEB\u7167\u8FD8\u6CA1\u52A0\u8F7D", "error");
|
|
2890
|
+
return;
|
|
2891
|
+
}
|
|
2892
|
+
openProjectFile(joinProjectPath(snapshot.projectRoot, relativePath), relativePath, "preview");
|
|
2893
|
+
};
|
|
2894
|
+
const copyText = (text, label) => {
|
|
2895
|
+
void (async () => {
|
|
2896
|
+
try {
|
|
2897
|
+
await navigator.clipboard.writeText(text);
|
|
2898
|
+
showToast(`\u5DF2\u590D\u5236${label}`, "success");
|
|
2899
|
+
} catch {
|
|
2900
|
+
showToast(`\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u590D\u5236\uFF1A${text}`, "error");
|
|
2901
|
+
}
|
|
2902
|
+
})();
|
|
2903
|
+
};
|
|
2904
|
+
const diagnostics = snapshot === null ? [] : [...snapshot.diagnostics, ...snapshot.cards.flatMap((card) => card.diagnostics.map((item) => `${card.id}: ${item}`))];
|
|
2905
|
+
const consistencyIssues = snapshot === null ? [] : ledgerMismatches(snapshot);
|
|
2906
|
+
const noTaskData = snapshot !== null && snapshot.cards.length === 0 && snapshot.ledger.rows.length === 0 && snapshot.archive.rows.length === 0;
|
|
2907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { position: "relative", display: "flex", flexDirection: "column", height: "100%", minHeight: 0, background: COLOR.bg, color: COLOR.text, fontSize: fontPx(12.5), padding: "10px 12px 8px" }, children: [
|
|
2908
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: "@keyframes tc-spin { to { transform: rotate(360deg) } }" }),
|
|
2909
|
+
detail === null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
2910
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2911
|
+
TopBar,
|
|
2912
|
+
{
|
|
2913
|
+
style,
|
|
2914
|
+
colorStrength,
|
|
2915
|
+
view,
|
|
2916
|
+
count: scopeCards.length,
|
|
2917
|
+
focusId: snapshot?.focusId ?? null,
|
|
2918
|
+
loading,
|
|
2919
|
+
config: snapshot === null ? null : {
|
|
2920
|
+
projectRoot: snapshot.projectRoot,
|
|
2921
|
+
dataDir: snapshot.dataDir,
|
|
2922
|
+
ledgerFile: snapshot.ledger.file,
|
|
2923
|
+
archiveFile: snapshot.archive.file,
|
|
2924
|
+
configSources: snapshot.configSources,
|
|
2925
|
+
configFile: snapshot.configFile
|
|
2926
|
+
},
|
|
2927
|
+
onStyle: setStyle,
|
|
2928
|
+
onColorStrength: setColorStrength,
|
|
2929
|
+
onNew: () => setNewTaskOpen(true),
|
|
2930
|
+
onSettings: () => setSettingsOpen(true),
|
|
2931
|
+
onRefresh: () => void load(true)
|
|
2932
|
+
}
|
|
2933
|
+
),
|
|
2934
|
+
snapshot === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2935
|
+
StatsBar,
|
|
2936
|
+
{
|
|
2937
|
+
cards: scopeCards,
|
|
2938
|
+
allCards,
|
|
2939
|
+
view,
|
|
2940
|
+
filter,
|
|
2941
|
+
style,
|
|
2942
|
+
open: statsOpen,
|
|
2943
|
+
onToggle: () => setStatsOpen((value) => !value),
|
|
2944
|
+
onView: changeView,
|
|
2945
|
+
onFilter: chooseFilter,
|
|
2946
|
+
onOpenCard: openDetail
|
|
2947
|
+
}
|
|
2948
|
+
)
|
|
2949
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2950
|
+
DetailView,
|
|
2951
|
+
{
|
|
2952
|
+
card: detail,
|
|
2953
|
+
style,
|
|
2954
|
+
cardFile,
|
|
2955
|
+
tab: detailTab,
|
|
2956
|
+
busyKey,
|
|
2957
|
+
onTab: setDetailTab,
|
|
2958
|
+
onBack: () => setDetailId(null),
|
|
2959
|
+
onReloadFile: () => reloadFile(detail.id),
|
|
2960
|
+
relativePath: windowsPath(detail.dir),
|
|
2961
|
+
absolutePath: windowsPath(snapshot === null ? detail.dir : joinProjectPath(snapshot.projectRoot, detail.dir)),
|
|
2962
|
+
projectRoot: snapshot?.projectRoot ?? "",
|
|
2963
|
+
onOpenTaskFile: (path) => handleOpenTaskFile(detail, path, "preview"),
|
|
2964
|
+
onOpenTaskFileExternal: (path) => handleOpenTaskFile(detail, path, "system"),
|
|
2965
|
+
onOpenDoc: handleOpenDoc,
|
|
2966
|
+
onCopyPath: (kind) => copyText(
|
|
2967
|
+
kind === "relative" ? windowsPath(detail.dir) : windowsPath(snapshot === null ? detail.dir : joinProjectPath(snapshot.projectRoot, detail.dir)),
|
|
2968
|
+
kind === "relative" ? "\u4EFB\u52A1\u6587\u4EF6\u5939\u76F8\u5BF9\u8DEF\u5F84" : "\u4EFB\u52A1\u6587\u4EF6\u5939\u7EDD\u5BF9\u8DEF\u5F84"
|
|
2969
|
+
),
|
|
2970
|
+
onContinue: () => handleContinue(detail),
|
|
2971
|
+
onRun: () => handleRun(detail),
|
|
2972
|
+
onReopen: () => handleReopen(detail),
|
|
2973
|
+
onFlow: () => openFlow(detail.id, null)
|
|
2974
|
+
}
|
|
2975
|
+
),
|
|
2976
|
+
diagnostics.length > 0 && detail === null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { paddingBottom: 4 }, children: [
|
|
2977
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { type: "button", onClick: () => setDiagnosticsOpen((value) => !value), style: { display: "inline-flex", alignItems: "center", gap: 4, fontSize: fontPx(10.5), color: noTaskData ? COLOR.secondary : COLOR.warn, background: "transparent", border: "none", padding: 0, cursor: "pointer", textAlign: "left" }, children: [
|
|
2978
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: noTaskData ? "info" : "alert", size: 11 }),
|
|
2979
|
+
noTaskData ? `\u8FD9\u4E2A\u9879\u76EE\u8FD8\u6CA1\u6709\u4EFB\u52A1\u5361\u6570\u636E\uFF08${diagnostics.length} \u6761\u8BCA\u65AD\uFF09` : `${diagnostics.length} \u6761\u6570\u636E\u544A\u8B66\uFF08${diagnosticsOpen ? "\u6536\u8D77" : "\u70B9\u5F00\u770B\u660E\u7EC6"}\uFF1B\u53EA\u8BFB\u3001\u4E0D\u81EA\u52A8\u4FEE\u590D\uFF09`
|
|
2980
|
+
] }),
|
|
2981
|
+
diagnosticsOpen ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { marginTop: 3, maxHeight: 110, overflowY: "auto", border: `1px solid ${COLOR.borderSoft}`, borderRadius: 6, padding: "4px 8px", background: COLOR.layer1 }, children: diagnostics.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: fontPx(10.5), lineHeight: fontPx(18), color: COLOR.secondary }, children: [
|
|
2982
|
+
"\xB7 ",
|
|
2983
|
+
item
|
|
2984
|
+
] }, `diag-${index}`)) }) : null
|
|
2985
|
+
] }) : null,
|
|
2986
|
+
consistencyIssues.length > 0 && detail === null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { paddingBottom: 4 }, children: [
|
|
2987
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { type: "button", onClick: () => setConsistencyOpen((value) => !value), style: { display: "inline-flex", alignItems: "center", gap: 4, fontSize: DETAIL_FONT.small, color: COLOR.error, background: "transparent", border: "none", padding: 0, cursor: "pointer", textAlign: "left" }, children: [
|
|
2988
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "alert", size: 11 }),
|
|
2989
|
+
"\u53EA\u8BFB\u4E00\u81F4\u6027\u544A\u8B66\uFF1A\u5361\u4E0E\u603B\u8D26\u6709 ",
|
|
2990
|
+
consistencyIssues.length,
|
|
2991
|
+
" \u5904\u4E0D\u4E00\u81F4\uFF08",
|
|
2992
|
+
consistencyOpen ? "\u6536\u8D77" : "\u70B9\u5F00\u770B\u660E\u7EC6",
|
|
2993
|
+
"\uFF1B\u63D2\u4EF6\u4E0D\u4F1A\u6539\u6587\u4EF6\uFF09"
|
|
2994
|
+
] }),
|
|
2995
|
+
consistencyOpen ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { marginTop: 3, maxHeight: 130, overflowY: "auto", border: `1px solid ${alpha(COLOR.error, 35)}`, borderRadius: 6, padding: "4px 8px", background: COLOR.layer1 }, children: [
|
|
2996
|
+
consistencyIssues.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: DETAIL_FONT.small, lineHeight: fontPx(18), color: COLOR.secondary }, children: [
|
|
2997
|
+
"\xB7 ",
|
|
2998
|
+
item
|
|
2999
|
+
] }, `consistency-${index}`)),
|
|
3000
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { marginTop: 3, fontSize: DETAIL_FONT.micro, color: COLOR.tertiary }, children: "\u4EE5\u4E0A\u53EA\u63D0\u793A\uFF1B\u8BF7\u624B\u52A8\u6838\u5BF9 task.md \u4E0E TASKS.md \u540E\u4FEE\u6B63\uFF0C\u63D2\u4EF6\u53EA\u8BFB\u3002" })
|
|
3001
|
+
] }) : null
|
|
3002
|
+
] }) : null,
|
|
3003
|
+
detail === null ? loading && snapshot === null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { ...secondaryText(), paddingTop: 8, display: "inline-flex", alignItems: "center", gap: 5 }, children: [
|
|
3004
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "refresh", size: 12, style: { animation: "tc-spin 900ms linear infinite" } }),
|
|
3005
|
+
" \u52A0\u8F7D\u4EFB\u52A1\u5361\u2026"
|
|
3006
|
+
] }) : error !== null && snapshot === null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { paddingTop: 8 }, children: [
|
|
3007
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: fontPx(12), color: COLOR.error, marginBottom: 6 }, children: [
|
|
3008
|
+
"\u5FEB\u7167\u8BFB\u53D6\u5931\u8D25\uFF1A",
|
|
3009
|
+
error
|
|
3010
|
+
] }),
|
|
3011
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, icon: "refresh", onClick: () => void load(true), children: "\u91CD\u8BD5" })
|
|
3012
|
+
] }) : scopeCards.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { paddingTop: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
3013
|
+
"div",
|
|
3014
|
+
{
|
|
3015
|
+
style: {
|
|
3016
|
+
display: "flex",
|
|
3017
|
+
flexDirection: "column",
|
|
3018
|
+
gap: 8,
|
|
3019
|
+
padding: "12px 14px",
|
|
3020
|
+
border: `1px solid ${noTaskData ? COLOR.borderSoft : alpha(COLOR.business, 28)}`,
|
|
3021
|
+
borderRadius: 9,
|
|
3022
|
+
background: noTaskData ? COLOR.layer1 : tint(COLOR.business, 5)
|
|
3023
|
+
},
|
|
3024
|
+
children: [
|
|
3025
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: fontPx(13), fontWeight: 600 }, children: noTaskData ? "\u8FD9\u4E2A\u9879\u76EE\u8FD8\u6CA1\u6709\u4EFB\u52A1\u5361" : view === "active" ? "\u6CA1\u6709\u6D3B\u8DC3\u4EFB\u52A1" : "\u8FD8\u6CA1\u6709\u5DF2\u5B8C\u6210\u4EFB\u52A1" }),
|
|
3026
|
+
snapshot !== null ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { ...secondaryText(), wordBreak: "break-all" }, children: [
|
|
3027
|
+
"\u6570\u636E\u6E90\uFF1A",
|
|
3028
|
+
snapshot.dataDir,
|
|
3029
|
+
"/\uFF08\u9879\u76EE\u6839 ",
|
|
3030
|
+
snapshot.projectRoot,
|
|
3031
|
+
"\uFF0C",
|
|
3032
|
+
CONFIG_SOURCE_LABEL[snapshot.configSources.dataDir],
|
|
3033
|
+
"\uFF09"
|
|
3034
|
+
] }) : null,
|
|
3035
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { ...secondaryText(), lineHeight: 1.6 }, children: noTaskData ? "\u5F53\u524D\u9879\u76EE\u6CA1\u6709\u8BFB\u5230 tasks/ \u6570\u636E\u3002\u53EF\u4EE5\u76F4\u63A5\u65B0\u5EFA\u4EFB\u52A1\uFF0Cagent \u4F1A\u6309\u5F00\u5361\u95E8\u7981\u521B\u5EFA tasks/ \u548C\u603B\u8D26\uFF1B\u4E5F\u53EF\u4EE5\u5148\u5728\u9879\u76EE\u91CC\u5EFA\u597D tasks/ \u518D\u5237\u65B0\u3002" : view === "active" ? `\u5DF2\u5B8C\u6210/\u5F52\u6863\u7684 ${completedCount} \u4E2A\u4EFB\u52A1\u5728\u9876\u90E8\u300C\u5DF2\u5B8C\u6210\u300D\u89C6\u56FE\u91CC\uFF0C\u9ED8\u8BA4\u4E0D\u6DF7\u5728\u6D3B\u8DC3\u5217\u8868\u3002` : `\u8FD8\u6709 ${activeCount} \u4E2A\u6D3B\u8DC3\u4EFB\u52A1\u5728\u300C\u6D3B\u8DC3\u300D\u89C6\u56FE\uFF1B\u5173\u5355\u540E\u5F52\u6863\u7684\u4EFB\u52A1\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002` }),
|
|
3036
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap", paddingTop: 1 }, children: [
|
|
3037
|
+
view === "active" && completedCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(ActionButton, { style, icon: "check", tone: "primary", onClick: () => changeView("completed"), children: [
|
|
3038
|
+
"\u67E5\u770B\u5DF2\u5B8C\u6210\uFF08",
|
|
3039
|
+
completedCount,
|
|
3040
|
+
"\uFF09"
|
|
3041
|
+
] }) : null,
|
|
3042
|
+
view === "completed" && activeCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(ActionButton, { style, icon: "list", tone: "primary", onClick: () => changeView("active"), children: [
|
|
3043
|
+
"\u67E5\u770B\u6D3B\u8DC3\uFF08",
|
|
3044
|
+
activeCount,
|
|
3045
|
+
"\uFF09"
|
|
3046
|
+
] }) : null,
|
|
3047
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, icon: "plus", tone: noTaskData || view === "active" && completedCount === 0 ? "primary" : "secondary", onClick: () => setNewTaskOpen(true), children: "\u65B0\u5EFA\u4EFB\u52A1" })
|
|
3048
|
+
] })
|
|
3049
|
+
]
|
|
3050
|
+
}
|
|
3051
|
+
) }) : filteredCards.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { paddingTop: 8, display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
3052
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: fontPx(12) }, children: "\u5F53\u524D\u7B5B\u9009\u6CA1\u6709\u5339\u914D\u4EFB\u52A1\u3002" }),
|
|
3053
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActionButton, { style, icon: "close", onClick: () => setFilter(null), children: "\u6E05\u9664\u7B5B\u9009" })
|
|
3054
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1, minHeight: 0, overflowY: "auto", paddingBottom: 8, marginTop: 2 }, children: [
|
|
3055
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3056
|
+
"div",
|
|
3057
|
+
{
|
|
3058
|
+
style: {
|
|
3059
|
+
display: "grid",
|
|
3060
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(min(280px, 100%), 1fr))",
|
|
3061
|
+
gap: 10,
|
|
3062
|
+
alignContent: "start"
|
|
3063
|
+
},
|
|
3064
|
+
children: visibleCards.map((card) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3065
|
+
TaskCard,
|
|
3066
|
+
{
|
|
3067
|
+
card,
|
|
3068
|
+
style,
|
|
3069
|
+
colorStrength,
|
|
3070
|
+
busyKey,
|
|
3071
|
+
onOpen: () => openDetail(card.id),
|
|
3072
|
+
onCopyName: () => copyText(card.id, `\u4EFB\u52A1\u5361\u540D\u79F0 ${card.id}`),
|
|
3073
|
+
onFlow: (anchor) => openFlow(card.id, anchor),
|
|
3074
|
+
onFlowLeave: scheduleFlowClose,
|
|
3075
|
+
onContinue: () => handleContinue(card),
|
|
3076
|
+
onRun: () => handleRun(card),
|
|
3077
|
+
onReopen: () => handleReopen(card),
|
|
3078
|
+
projectRoot: snapshot?.projectRoot ?? "",
|
|
3079
|
+
onOpenTaskFile: (path) => handleOpenTaskFile(card, path, "preview"),
|
|
3080
|
+
onOpenTaskFileExternal: (path) => handleOpenTaskFile(card, path, "system")
|
|
3081
|
+
},
|
|
3082
|
+
card.dir
|
|
3083
|
+
))
|
|
3084
|
+
}
|
|
3085
|
+
),
|
|
3086
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { display: "flex", justifyContent: "center", padding: "10px 0 2px" }, children: remainingCards > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(ActionButton, { style, icon: "chevronDown", onClick: () => setVisibleCount((value) => value + PAGE_SIZE), children: [
|
|
3087
|
+
"\u52A0\u8F7D\u66F4\u591A\uFF08\u5269\u4F59 ",
|
|
3088
|
+
remainingCards,
|
|
3089
|
+
" \u4E2A\uFF09"
|
|
3090
|
+
] }) : filteredCards.length > PAGE_SIZE ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: secondaryText({ fontSize: fontPx(10) }), children: [
|
|
3091
|
+
"\u5DF2\u52A0\u8F7D\u5168\u90E8 ",
|
|
3092
|
+
filteredCards.length,
|
|
3093
|
+
" \u4E2A"
|
|
3094
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: secondaryText({ fontSize: fontPx(10) }), children: [
|
|
3095
|
+
"\u5171 ",
|
|
3096
|
+
filteredCards.length,
|
|
3097
|
+
" \u4E2A"
|
|
3098
|
+
] }) })
|
|
3099
|
+
] }) : null,
|
|
3100
|
+
flowCard === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3101
|
+
FlowPopover,
|
|
3102
|
+
{
|
|
3103
|
+
card: flowCard,
|
|
3104
|
+
style,
|
|
3105
|
+
anchor: flowHover === null ? null : flowHover.anchor,
|
|
3106
|
+
onEnter: cancelFlowClose,
|
|
3107
|
+
onLeave: scheduleFlowClose,
|
|
3108
|
+
onClose: closeFlow
|
|
3109
|
+
}
|
|
3110
|
+
),
|
|
3111
|
+
newTaskOpen ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(NewTaskDialog, { style, busy: busyKey === "new-task", onClose: () => setNewTaskOpen(false), onSubmit: handleNewTask }) : null,
|
|
3112
|
+
settingsOpen ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3113
|
+
SettingsDialog,
|
|
3114
|
+
{
|
|
3115
|
+
style,
|
|
3116
|
+
snapshot,
|
|
3117
|
+
onClose: () => setSettingsOpen(false),
|
|
3118
|
+
onSaved: () => {
|
|
3119
|
+
setSettingsOpen(false);
|
|
3120
|
+
showToast("\u5DF2\u4FDD\u5B58\u5230 task-card.config.yml\uFF08git \u91CC\u4F1A\u51FA\u73B0\u6539\u52A8\uFF09", "success");
|
|
3121
|
+
window.setTimeout(() => void load(true), 250);
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3124
|
+
) : null,
|
|
3125
|
+
toast === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3126
|
+
"div",
|
|
3127
|
+
{
|
|
3128
|
+
role: "status",
|
|
3129
|
+
onClick: () => setToast(null),
|
|
3130
|
+
style: {
|
|
3131
|
+
position: "absolute",
|
|
3132
|
+
left: 12,
|
|
3133
|
+
right: 12,
|
|
3134
|
+
bottom: 10,
|
|
3135
|
+
zIndex: 140,
|
|
3136
|
+
padding: "6px 10px",
|
|
3137
|
+
borderRadius: 7,
|
|
3138
|
+
background: toast.tone === "error" ? tint(COLOR.error, 16) : toast.tone === "success" ? tint(COLOR.success, 16) : COLOR.layer2,
|
|
3139
|
+
border: `1px solid ${toast.tone === "error" ? alpha(COLOR.error, 45) : toast.tone === "success" ? alpha(COLOR.success, 45) : COLOR.border}`,
|
|
3140
|
+
fontSize: fontPx(11),
|
|
3141
|
+
lineHeight: 1.5,
|
|
3142
|
+
color: COLOR.text,
|
|
3143
|
+
cursor: "pointer",
|
|
3144
|
+
boxShadow: "0 6px 24px rgba(0,0,0,0.2)"
|
|
3145
|
+
},
|
|
3146
|
+
children: toast.text
|
|
3147
|
+
}
|
|
3148
|
+
)
|
|
3149
|
+
] });
|
|
3150
|
+
}
|
|
3151
|
+
function TaskCardIcon({ size = 18 }) {
|
|
3152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
3153
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: "4", y: "3", width: "16", height: "18", rx: "2.5" }),
|
|
3154
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M8 8h8M8 12h8M8 16h5" })
|
|
3155
|
+
] });
|
|
3156
|
+
}
|
|
3157
|
+
function apply(ctx) {
|
|
3158
|
+
runtime = captureRuntime(ctx);
|
|
3159
|
+
runtimeContext = ctx;
|
|
3160
|
+
const effect = ctx.effect ?? ((fn) => void fn());
|
|
3161
|
+
const slots = ctx.slots;
|
|
3162
|
+
const rightTabs = ctx.sidebarRightTabs;
|
|
3163
|
+
if (rightTabs !== void 0 && slots !== void 0) {
|
|
3164
|
+
effect(() => rightTabs.register({
|
|
3165
|
+
id: PANEL_ID,
|
|
3166
|
+
kind: TAB_KIND,
|
|
3167
|
+
title: () => DISPLAY_NAME,
|
|
3168
|
+
guide: [{ id: "task-card", order: 20, title: () => DISPLAY_NAME, description: () => `\u53EA\u8BFB${DISPLAY_NAME}\u770B\u677F\uFF08\u96C6\u5408\u9875 / \u8BE6\u60C5\uFF09`, icon: TaskCardIcon }],
|
|
3169
|
+
// 2026-12-01 用户实测:切到预览再切回「任务卡」,看板回到列表首页。声明保留面板后状态不丢;
|
|
3170
|
+
// 代价是访问过的面板在后台保持挂载(项目根轮询继续跑),影响小。
|
|
3171
|
+
keepMounted: true
|
|
3172
|
+
}), "task-card: right sidebar tab type");
|
|
3173
|
+
effect(() => {
|
|
3174
|
+
slots.inject("sidebar.right.pane.tab", () => slots.register({ name: "sidebar.right.pane.tab", key: PANEL_ID }, TaskCardPanel));
|
|
3175
|
+
}, "task-card: right sidebar pane body");
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3178
|
+
var __test = {
|
|
3179
|
+
statusRank,
|
|
3180
|
+
sortCards,
|
|
3181
|
+
stateCounts,
|
|
3182
|
+
categoryCounts,
|
|
3183
|
+
stepLabel,
|
|
3184
|
+
displayStatus,
|
|
3185
|
+
cardFlags,
|
|
3186
|
+
flowSummary,
|
|
3187
|
+
progressArcColor,
|
|
3188
|
+
fontPx,
|
|
3189
|
+
categoryMeta,
|
|
3190
|
+
clampColorStrength,
|
|
3191
|
+
colorTintPercent,
|
|
3192
|
+
isClosedCard,
|
|
3193
|
+
matchesFilter,
|
|
3194
|
+
viewCards,
|
|
3195
|
+
PAGE_SIZE,
|
|
3196
|
+
continuePrompt,
|
|
3197
|
+
reopenPrompt,
|
|
3198
|
+
persistedSessionId,
|
|
3199
|
+
sessionCwdForSession,
|
|
3200
|
+
sessionCreateOptions,
|
|
3201
|
+
windowsPath,
|
|
3202
|
+
workspacePathForSession,
|
|
3203
|
+
buildNewTaskPrompt,
|
|
3204
|
+
joinProjectPath,
|
|
3205
|
+
ledgerMismatches,
|
|
3206
|
+
sessionFileAddress,
|
|
3207
|
+
isInsideDirectory,
|
|
3208
|
+
centeredScrollTop
|
|
3209
|
+
};
|
|
3210
|
+
|
|
3211
|
+
return module.exports;
|
|
3212
|
+
},
|
|
3213
|
+
});
|
|
3214
|
+
|