dsh-task-ledger 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +1226 -0
- package/dist/client.js.map +1 -0
- package/dist/host/board.d.ts +6 -0
- package/dist/host/board.js +4 -1
- package/package.json +16 -3
- package/skill/package.json +1 -1
- package/skill/scripts/progress.py +29 -13
package/dist/client.js
ADDED
|
@@ -0,0 +1,1226 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "dsh-task-ledger",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
9
|
+
//#region src/client/api.ts
|
|
10
|
+
/** host 路由前缀(全仓唯一;与 host/routes.ts 的 API_PREFIX 对应)。 */
|
|
11
|
+
const API_PREFIX = "api/task-ledger";
|
|
12
|
+
const DEFAULT_TIMEOUT_MS = 8e3;
|
|
13
|
+
/**
|
|
14
|
+
* 错误响应榨人话:host 路由(routes.ts)发的是 `{ error: "..." }`,那里的话是**能直接上界面的**
|
|
15
|
+
* (带工作区名、python3 起不来之类的原文)。不带它界面上只剩「HTTP 500」,等于没报错。
|
|
16
|
+
*/
|
|
17
|
+
function httpErrorMessage(status, body) {
|
|
18
|
+
try {
|
|
19
|
+
const parsed = JSON.parse(body);
|
|
20
|
+
if (typeof parsed.error === "string" && parsed.error !== "") return `HTTP ${status}:${parsed.error}`;
|
|
21
|
+
} catch {}
|
|
22
|
+
const text = body.trim().slice(0, 200);
|
|
23
|
+
return text === "" ? `HTTP ${String(status)}` : `HTTP ${String(status)}:${text}`;
|
|
24
|
+
}
|
|
25
|
+
/** 带超时的 JSON 取数(相对路径,同源)。 */
|
|
26
|
+
async function fetchJson(path, init = {}, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
27
|
+
const controller = new AbortController();
|
|
28
|
+
const timer = setTimeout(() => {
|
|
29
|
+
controller.abort(new DOMException(`请求超时(${timeoutMs}ms 未响应)`, "TimeoutError"));
|
|
30
|
+
}, timeoutMs);
|
|
31
|
+
try {
|
|
32
|
+
const res = await fetch(`${API_PREFIX}${path}`, {
|
|
33
|
+
...init,
|
|
34
|
+
signal: controller.signal,
|
|
35
|
+
cache: "no-store"
|
|
36
|
+
});
|
|
37
|
+
if (!res.ok) throw new Error(httpErrorMessage(res.status, await res.text().catch(() => "")));
|
|
38
|
+
return await res.json();
|
|
39
|
+
} finally {
|
|
40
|
+
clearTimeout(timer);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** 首页快照(在办全量 + 两个完成类统计 + 各工作区身份)。 */
|
|
44
|
+
function fetchBoard() {
|
|
45
|
+
return fetchJson("/board");
|
|
46
|
+
}
|
|
47
|
+
/** 已结案列表(服务端按窗口 / 标签 / 分页过滤)。 */
|
|
48
|
+
function fetchHistory(params) {
|
|
49
|
+
const query = new URLSearchParams();
|
|
50
|
+
if (params.since !== void 0) query.set("since", params.since);
|
|
51
|
+
if (params.until !== void 0) query.set("until", params.until);
|
|
52
|
+
if (params.tag !== void 0 && params.tag !== "") query.set("tag", params.tag);
|
|
53
|
+
if (params.limit !== void 0) query.set("limit", String(params.limit));
|
|
54
|
+
const suffix = query.toString();
|
|
55
|
+
return fetchJson(`/history${suffix === "" ? "" : `?${suffix}`}`).then((body) => body.records ?? []);
|
|
56
|
+
}
|
|
57
|
+
/** 单条在办 + 过程文档正文(展开行用)。 */
|
|
58
|
+
function fetchTaskDetail(workspaceId, taskId) {
|
|
59
|
+
return fetchJson(`/task?${new URLSearchParams({
|
|
60
|
+
ws: workspaceId,
|
|
61
|
+
id: taskId
|
|
62
|
+
}).toString()}`);
|
|
63
|
+
}
|
|
64
|
+
/** 筛选项候选(在办全量 + 近 13 个月历史的去重 owner / category / tag)。 */
|
|
65
|
+
function fetchFilters() {
|
|
66
|
+
return fetchJson("/filters");
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/client/format.ts
|
|
70
|
+
/**
|
|
71
|
+
* 客户端时间口径**单源**:补零 / 时刻串 / 时间范围 → `--since` / `--until`。
|
|
72
|
+
* 走**本机时区**;解析失败按调用方给的兜底返回(不编造时间)。
|
|
73
|
+
*
|
|
74
|
+
* ⚠️ 与 skill 脚本的边界一致:`--since` 取当天 00:00、`--until` 只给日期时含当天整天
|
|
75
|
+
* (脚本 `normalize_time` 的 `date_only_ref="23:59:59"`),故这里只拼 `YYYY-MM-DD`。
|
|
76
|
+
*/
|
|
77
|
+
function pad2(value) {
|
|
78
|
+
return String(value).padStart(2, "0");
|
|
79
|
+
}
|
|
80
|
+
/** ISO → `YYYY-MM-DD HH:mm`(`seconds: true` 时补 `:ss`);解析失败返回 `fallback`(缺省原串)。 */
|
|
81
|
+
function formatDateTime(iso, opts) {
|
|
82
|
+
const ms = Date.parse(iso);
|
|
83
|
+
if (Number.isNaN(ms)) return opts?.fallback ?? iso;
|
|
84
|
+
const d = new Date(ms);
|
|
85
|
+
const base = `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())} ${pad2(d.getHours())}:${pad2(d.getMinutes())}`;
|
|
86
|
+
return opts?.seconds === true ? `${base}:${pad2(d.getSeconds())}` : base;
|
|
87
|
+
}
|
|
88
|
+
/** 周一 00:00 所在日期(与 host `board.ts` 的 `mondayDateString` 同口径:周一为一周之始)。 */
|
|
89
|
+
function mondayOf(now) {
|
|
90
|
+
const date = new Date(now);
|
|
91
|
+
date.setDate(date.getDate() - (date.getDay() + 6) % 7);
|
|
92
|
+
return date;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* 时间范围 → `{ since, until }`(`YYYY-MM-DD`,含边界)。`all` 返回空对象 = 不拼参数。
|
|
96
|
+
* 近一年 = 今天往前推 365 天(与统计卡「近 13 个月文件」不同口径:那是文件窗口,这是创建时间过滤)。
|
|
97
|
+
*/
|
|
98
|
+
function rangeToDates(range, now = /* @__PURE__ */ new Date()) {
|
|
99
|
+
const ymd = (date) => `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())}`;
|
|
100
|
+
if (range === "week") return {
|
|
101
|
+
since: ymd(mondayOf(now)),
|
|
102
|
+
until: ymd(now)
|
|
103
|
+
};
|
|
104
|
+
if (range === "month") return {
|
|
105
|
+
since: ymd(new Date(now.getFullYear(), now.getMonth(), 1)),
|
|
106
|
+
until: ymd(now)
|
|
107
|
+
};
|
|
108
|
+
if (range === "year") {
|
|
109
|
+
const start = new Date(now);
|
|
110
|
+
start.setDate(start.getDate() - 365);
|
|
111
|
+
return {
|
|
112
|
+
since: ymd(start),
|
|
113
|
+
until: ymd(now)
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return {};
|
|
117
|
+
}
|
|
118
|
+
/** 任务行是否落在时间范围内(在办侧在浏览器里筛;无创建时间的行按「不带时间过滤」处理)。 */
|
|
119
|
+
function withinRange(created, since, until) {
|
|
120
|
+
if (since === void 0 && until === void 0) return true;
|
|
121
|
+
if (created === null || created === void 0 || created === "") return false;
|
|
122
|
+
const day = created.slice(0, 10);
|
|
123
|
+
if (since !== void 0 && day < since) return false;
|
|
124
|
+
if (until !== void 0 && day > until) return false;
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
let state = {
|
|
128
|
+
status: "loading",
|
|
129
|
+
board: null,
|
|
130
|
+
error: null,
|
|
131
|
+
history: [],
|
|
132
|
+
historyStatus: "idle",
|
|
133
|
+
historyError: null,
|
|
134
|
+
filters: null,
|
|
135
|
+
query: {
|
|
136
|
+
bucket: "all",
|
|
137
|
+
range: "all",
|
|
138
|
+
tag: "",
|
|
139
|
+
keyword: "",
|
|
140
|
+
limit: 500
|
|
141
|
+
},
|
|
142
|
+
refreshing: false
|
|
143
|
+
};
|
|
144
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
145
|
+
/** 首读只触发一次(谁先订阅谁触发),之后一律靠 `refresh()` / `setQuery()`。 */
|
|
146
|
+
let booted = false;
|
|
147
|
+
/** 在途轮次:迟到的响应按 token 丢弃,避免旧结果盖新结果。 */
|
|
148
|
+
let runToken = 0;
|
|
149
|
+
function emit() {
|
|
150
|
+
for (const listener of [...listeners]) listener();
|
|
151
|
+
}
|
|
152
|
+
function set(patch) {
|
|
153
|
+
state = {
|
|
154
|
+
...state,
|
|
155
|
+
...patch
|
|
156
|
+
};
|
|
157
|
+
emit();
|
|
158
|
+
}
|
|
159
|
+
function boardSnapshot() {
|
|
160
|
+
return state;
|
|
161
|
+
}
|
|
162
|
+
function boardSubscribe(listener) {
|
|
163
|
+
listeners.add(listener);
|
|
164
|
+
if (!booted) {
|
|
165
|
+
booted = true;
|
|
166
|
+
refresh();
|
|
167
|
+
}
|
|
168
|
+
return () => {
|
|
169
|
+
listeners.delete(listener);
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/** 重读:在办快照 + 筛选项 +(已结案档时)历史列表。 */
|
|
173
|
+
async function refresh() {
|
|
174
|
+
const token = ++runToken;
|
|
175
|
+
set({ refreshing: true });
|
|
176
|
+
try {
|
|
177
|
+
const board = await fetchBoard();
|
|
178
|
+
if (token !== runToken) return;
|
|
179
|
+
set({
|
|
180
|
+
status: "ready",
|
|
181
|
+
board,
|
|
182
|
+
error: null
|
|
183
|
+
});
|
|
184
|
+
loadFilters(token);
|
|
185
|
+
if (state.query.bucket === "closed") await loadHistory(token);
|
|
186
|
+
} catch (error) {
|
|
187
|
+
if (token !== runToken) return;
|
|
188
|
+
set({
|
|
189
|
+
status: "error",
|
|
190
|
+
error: error instanceof Error ? error.message : String(error)
|
|
191
|
+
});
|
|
192
|
+
} finally {
|
|
193
|
+
if (token === runToken) set({ refreshing: false });
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
async function loadFilters(token) {
|
|
197
|
+
try {
|
|
198
|
+
const filters = await fetchFilters();
|
|
199
|
+
if (token === runToken) set({ filters });
|
|
200
|
+
} catch {}
|
|
201
|
+
}
|
|
202
|
+
async function loadHistory(token) {
|
|
203
|
+
const { range, tag, limit } = state.query;
|
|
204
|
+
const dates = rangeToDates(range);
|
|
205
|
+
set({
|
|
206
|
+
historyStatus: "loading",
|
|
207
|
+
historyError: null
|
|
208
|
+
});
|
|
209
|
+
try {
|
|
210
|
+
const records = await fetchHistory({
|
|
211
|
+
...dates,
|
|
212
|
+
tag,
|
|
213
|
+
limit
|
|
214
|
+
});
|
|
215
|
+
if (token !== runToken) return;
|
|
216
|
+
set({
|
|
217
|
+
history: records,
|
|
218
|
+
historyStatus: "ready"
|
|
219
|
+
});
|
|
220
|
+
} catch (error) {
|
|
221
|
+
if (token !== runToken) return;
|
|
222
|
+
set({
|
|
223
|
+
historyStatus: "error",
|
|
224
|
+
historyError: error instanceof Error ? error.message : String(error)
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/** 改筛选:已结案档要重取历史(服务端过滤);在办档只在浏览器里重筛(数据已全)。 */
|
|
229
|
+
function setQuery(patch) {
|
|
230
|
+
const query = {
|
|
231
|
+
...state.query,
|
|
232
|
+
...patch
|
|
233
|
+
};
|
|
234
|
+
set({ query });
|
|
235
|
+
if (query.bucket === "closed") loadHistory(++runToken);
|
|
236
|
+
}
|
|
237
|
+
/** 「加载更多」:加大 limit 重取(skill 脚本无 offset,笨办法;500 条一页无感)。 */
|
|
238
|
+
function loadMoreHistory() {
|
|
239
|
+
setQuery({ limit: state.query.limit + 500 });
|
|
240
|
+
}
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/client/rows.ts
|
|
243
|
+
/**
|
|
244
|
+
* 列表行的筛选 / 排序(**唯一**实现,纯函数、不碰网络):页面只渲染,不各写一份过滤。
|
|
245
|
+
*
|
|
246
|
+
* 单独成文件是为了能被冒烟直测(store.ts 引 api.ts,Node 剥类型解析不了无扩展名相对导入)。
|
|
247
|
+
*/
|
|
248
|
+
/** 关键字命中(标题 / 任务号 / 人 / 分类 / 标签;已结案另含「完成了什么」)。 */
|
|
249
|
+
function hitKeyword(keyword, parts) {
|
|
250
|
+
const needle = keyword.trim().toLowerCase();
|
|
251
|
+
if (needle === "") return true;
|
|
252
|
+
return parts.some((part) => part?.toLowerCase().includes(needle) === true);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* 当前筛选下的列表行:
|
|
256
|
+
* - 已结案档:history 由服务端按窗口 / 标签 / 分页过滤,浏览器只补关键字;
|
|
257
|
+
* - 在办三档:快照已含全部在办 ⇒ 全在浏览器里筛(档位 / 时间 / 标签 / 关键字)。
|
|
258
|
+
*/
|
|
259
|
+
function selectRows(current) {
|
|
260
|
+
const { board, history, query } = current;
|
|
261
|
+
if (query.bucket === "closed") return history.filter((record) => hitKeyword(query.keyword, [
|
|
262
|
+
record.summary,
|
|
263
|
+
record.workpackage,
|
|
264
|
+
record.owner,
|
|
265
|
+
record.category,
|
|
266
|
+
...record.tags ?? []
|
|
267
|
+
])).map((record, index) => ({
|
|
268
|
+
kind: "closed",
|
|
269
|
+
key: `${record.src ?? ""}:${record.time ?? ""}:${index}`,
|
|
270
|
+
record
|
|
271
|
+
}));
|
|
272
|
+
const dates = rangeToDates(query.range);
|
|
273
|
+
return (board?.tasks ?? []).filter((task) => {
|
|
274
|
+
if (query.bucket === "open" && task.status !== "open") return false;
|
|
275
|
+
if (query.bucket === "mine" && !isMine(task, board)) return false;
|
|
276
|
+
if (!withinRange(task.created, dates.since, dates.until)) return false;
|
|
277
|
+
if (query.tag !== "" && !(task.tags ?? []).includes(query.tag)) return false;
|
|
278
|
+
return hitKeyword(query.keyword, [
|
|
279
|
+
task.title,
|
|
280
|
+
task.id,
|
|
281
|
+
task.owner,
|
|
282
|
+
task.creator,
|
|
283
|
+
task.category,
|
|
284
|
+
...task.tags ?? []
|
|
285
|
+
]);
|
|
286
|
+
}).sort((a, b) => String(b.created ?? b.started ?? "").localeCompare(String(a.created ?? a.started ?? ""))).map((task) => ({
|
|
287
|
+
kind: "task",
|
|
288
|
+
key: `${task.workspace.id}:${task.id}`,
|
|
289
|
+
task,
|
|
290
|
+
mine: isMine(task, board)
|
|
291
|
+
}));
|
|
292
|
+
}
|
|
293
|
+
/** 「我的」判定:owner = 该工作区的当前 git 身份,且状态是 doing / blocked(与 host 统计同口径)。 */
|
|
294
|
+
function isMine(task, board) {
|
|
295
|
+
if (board === null) return false;
|
|
296
|
+
const identity = board.identities[task.workspace.id] ?? null;
|
|
297
|
+
if (identity === null || identity === "") return false;
|
|
298
|
+
return task.owner === identity && (task.status === "doing" || task.status === "blocked");
|
|
299
|
+
}
|
|
300
|
+
//#endregion
|
|
301
|
+
//#region src/client/tokens.ts
|
|
302
|
+
/**
|
|
303
|
+
* 语义 token 层:`--dtl-*`(dtl = dsh-task-ledger)。
|
|
304
|
+
*
|
|
305
|
+
* 规矩(与 docs/design/ui-style.md 两条硬约束一致):
|
|
306
|
+
* - **只有本文件定义 `--dtl-*`**;其它文件一律 `var(--dtl-*)` 消费,不许直接写 `var(--dsw-*)`;
|
|
307
|
+
* - 每个 token 都带兜底值 ⇒ 宿主升级换名时不炸(最坏退到兜底色,不会白屏);
|
|
308
|
+
* - 明暗差异只写在本文件末尾的 `body[data-ds-dark-theme]` 段:能靠宿主 alias 表达的
|
|
309
|
+
* 一律不写覆盖(alias 自己随主题变),只有「固定中性面 / 半透明底」这类 alias 表达不了的才进该段。
|
|
310
|
+
*
|
|
311
|
+
* 明暗判据 = `body[data-ds-dark-theme]`(宿主 0.2.0-rc.2 源码核实:启动脚本 toggleAttribute 写入)。
|
|
312
|
+
* 插件**禁用** `prefers-color-scheme`(它跟系统、不跟用户在宿主里的选择)。
|
|
313
|
+
* 因为判据是纯 CSS 选择器 ⇒ 宿主切主题即生效,**不需要 MutationObserver**。
|
|
314
|
+
*
|
|
315
|
+
* 挂载点 = `body`:插件界面(含将来 portal 到 body 的弹层)全在 body 内,零调用点成本。
|
|
316
|
+
*/
|
|
317
|
+
const UI_TOKENS_CSS = `
|
|
318
|
+
body{
|
|
319
|
+
/* ── 文字四档 ─────────────────────────────────────────────────── */
|
|
320
|
+
--dtl-fg:var(--dsw-alias-label-primary,#1f2328);
|
|
321
|
+
--dtl-fg-2:var(--dsw-alias-label-secondary,#5c6370);
|
|
322
|
+
--dtl-fg-3:var(--dsw-alias-label-tertiary,#767d87);
|
|
323
|
+
--dtl-fg-4:var(--dsw-alias-label-caption,#9aa1ab);
|
|
324
|
+
/* 反色面上的字(角标 / 实心钮):暗色下是 bluish-1000 ⇒ 用 -foreground 而非 -inverted */
|
|
325
|
+
--dtl-fg-inverse:var(--dsw-alias-label-primary-foreground,#fff);
|
|
326
|
+
|
|
327
|
+
/* ── 面 ──────────────────────────────────────────────────────── */
|
|
328
|
+
--dtl-surface-1:var(--dsw-alias-bg-layer-1,#fff);
|
|
329
|
+
--dtl-surface-2:var(--dsw-alias-bg-layer-2,#fff);
|
|
330
|
+
--dtl-surface-base:var(--dsw-alias-bg-base,#fff);
|
|
331
|
+
/* 固定中性实面(自绘浮标 / 角标这类必须自己变的东西) */
|
|
332
|
+
--dtl-solid:var(--dsw-static-neutral-00,#fff);
|
|
333
|
+
--dtl-on-solid:var(--dsw-alias-label-primary,#1f2328);
|
|
334
|
+
|
|
335
|
+
/* ── 描边 ────────────────────────────────────────────────────── */
|
|
336
|
+
--dtl-border:var(--dsw-alias-border-l2,#0000001a);
|
|
337
|
+
--dtl-border-strong:var(--dsw-alias-border-l3,#0000001f);
|
|
338
|
+
|
|
339
|
+
/* ── 语义色 ──────────────────────────────────────────────────── */
|
|
340
|
+
/* 蓝色强调 / 选中一律走这条(不是 --dsw-alias-brand-primary:它明色近黑、暗色近白) */
|
|
341
|
+
--dtl-business:var(--dsw-alias-state-business-primary,#3b5bdb);
|
|
342
|
+
--dtl-success:var(--dsw-alias-state-success-primary,#22c55e);
|
|
343
|
+
/* ⚠️ 宿主是 state-warn(不是 state-warning,后者无此定义) */
|
|
344
|
+
--dtl-warning:var(--dsw-alias-state-warn-primary,#f59e0b);
|
|
345
|
+
--dtl-danger:var(--dsw-alias-state-error-primary,#ec1313);
|
|
346
|
+
/* 语义色实面上的字(角标):红绿黄都是中调 ⇒ 白字两个主题都可读 */
|
|
347
|
+
--dtl-on-signal:#fff;
|
|
348
|
+
/* 语义色浅底:用 color-mix 现算 ⇒ 状态色跟随宿主 alias,主题一换自动成立 */
|
|
349
|
+
--dtl-business-soft:color-mix(in srgb,var(--dtl-business) 8%,transparent);
|
|
350
|
+
--dtl-success-soft:color-mix(in srgb,var(--dtl-success) 8%,transparent);
|
|
351
|
+
--dtl-warning-soft:color-mix(in srgb,var(--dtl-warning) 8%,transparent);
|
|
352
|
+
--dtl-danger-soft:color-mix(in srgb,var(--dtl-danger) 8%,transparent);
|
|
353
|
+
|
|
354
|
+
/* ── 交互底 ──────────────────────────────────────────────────── */
|
|
355
|
+
--dtl-hover:var(--dsw-alias-interactive-bg-hover,rgba(38,49,72,.06));
|
|
356
|
+
/* 展开行底:带透明度的蓝,透出卡片底色(灰底跟斑马纹分不出来) */
|
|
357
|
+
--dtl-open-bg:rgba(37,99,235,.10);
|
|
358
|
+
--dtl-open-bg-soft:rgba(37,99,235,.05);
|
|
359
|
+
/* chip / 标签小底板:浅色下要看得见 ⇒ 掺 7% 近黑;hover 加倍 */
|
|
360
|
+
--dtl-chip-bg:rgba(15,15,15,.07);
|
|
361
|
+
--dtl-chip-bg-hover:rgba(15,15,15,.14);
|
|
362
|
+
|
|
363
|
+
/* ── 圆角 / 间距 / 控件高度 / 字号 ────────────────────────────── */
|
|
364
|
+
--dtl-radius-sm:var(--dsw-radius-sm,8px);
|
|
365
|
+
--dtl-radius-md:var(--dsw-radius-md,12px);
|
|
366
|
+
--dtl-radius-lg:var(--dsw-radius-lg,16px);
|
|
367
|
+
--dtl-space-1:4px;
|
|
368
|
+
--dtl-space-2:8px;
|
|
369
|
+
--dtl-space-3:12px;
|
|
370
|
+
--dtl-space-4:16px;
|
|
371
|
+
--dtl-control-h-sm:24px;
|
|
372
|
+
--dtl-control-h-md:28px;
|
|
373
|
+
--dtl-control-h-lg:32px;
|
|
374
|
+
--dtl-font-xs:var(--dsw-font-xxxs-11-font-size,11px);
|
|
375
|
+
--dtl-font-sm:var(--dsw-font-xxs-12-font-size,12px);
|
|
376
|
+
--dtl-font-md:var(--dsw-font-xs-13-font-size,13px);
|
|
377
|
+
--dtl-font-lg:var(--dsw-font-s-14-font-size,14px);
|
|
378
|
+
--dtl-font-xl:var(--dsw-font-base-16-font-size,16px);
|
|
379
|
+
--dtl-font-mono:var(--ds-font-family-code,monospace);
|
|
380
|
+
|
|
381
|
+
/* ── 投影 / 动效 / 层级 ──────────────────────────────────────── */
|
|
382
|
+
--dtl-shadow-1:var(--dsw-elevation-soft,0 4px 16px 0 #00000008);
|
|
383
|
+
--dtl-shadow-2:var(--dsw-shadow-lv3,0 12px 32px 0 #00000014);
|
|
384
|
+
--dtl-dur:var(--ds-transition-duration,.2s);
|
|
385
|
+
--dtl-ease:var(--ds-ease-in-out,cubic-bezier(.4,0,.2,1));
|
|
386
|
+
--dtl-z-badge:20;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/* ── 明暗差异的唯一落点 ─────────────────────────────────────────
|
|
390
|
+
只放 alias 表达不了的固定面 / 半透明底;颜色若能靠 alias 自动跟随,一律不写在这里。 */
|
|
391
|
+
body[data-ds-dark-theme]{
|
|
392
|
+
--dtl-solid:var(--dsw-static-neutral-900,#0f0f0f);
|
|
393
|
+
--dtl-on-solid:var(--dsw-static-neutral-00,#fff);
|
|
394
|
+
/* 暗色下蓝要更亮、透明度更高才压得住深底 */
|
|
395
|
+
--dtl-open-bg:rgba(96,165,250,.18);
|
|
396
|
+
--dtl-open-bg-soft:rgba(96,165,250,.08);
|
|
397
|
+
/* 暗色 chip 底板反过来掺白 */
|
|
398
|
+
--dtl-chip-bg:rgba(255,255,255,.08);
|
|
399
|
+
--dtl-chip-bg-hover:rgba(255,255,255,.16);
|
|
400
|
+
/* 语义色浅底在深色下压到 5%(8% 在深底上偏重) */
|
|
401
|
+
--dtl-business-soft:color-mix(in srgb,var(--dtl-business) 5%,transparent);
|
|
402
|
+
--dtl-success-soft:color-mix(in srgb,var(--dtl-success) 5%,transparent);
|
|
403
|
+
--dtl-warning-soft:color-mix(in srgb,var(--dtl-warning) 5%,transparent);
|
|
404
|
+
--dtl-danger-soft:color-mix(in srgb,var(--dtl-danger) 5%,transparent);
|
|
405
|
+
}
|
|
406
|
+
`;
|
|
407
|
+
//#endregion
|
|
408
|
+
//#region src/client/ui.ts
|
|
409
|
+
/**
|
|
410
|
+
* UI 基础层:样式单源 + 共用元件。
|
|
411
|
+
*
|
|
412
|
+
* 两条纪律(用户 2026-10-17 要求「该抽象的必须抽象」):
|
|
413
|
+
* 1. **样式**:所有颜色 / 圆角 / 字号一律 `var(--dtl-*)`(定义只在 tokens.ts),
|
|
414
|
+
* 任何文件不许再写第二份 `var(--dsw-*)`、也不许自造 `--dtl-*`;
|
|
415
|
+
* 需要 hover / focus / 动画的(内联样式表达不了)才有资格进这里的 `UI_BASE_CSS`。
|
|
416
|
+
* 2. **元件**:卡 / chip / 下拉 / 空态 / 搜索框各只有一份实现,页面与浮标共用。
|
|
417
|
+
*/
|
|
418
|
+
/** 基础层样式(幂等注入;只装 hover / focus / 动画这些内联样式写不了的部分)。 */
|
|
419
|
+
const UI_BASE_CSS = `
|
|
420
|
+
/* 统计卡:可点、hover 抬底、选中走蓝描边 + 浅蓝底 */
|
|
421
|
+
.dtl-card{
|
|
422
|
+
display:flex;flex-direction:column;gap:var(--dtl-space-1);
|
|
423
|
+
padding:var(--dtl-space-3) var(--dtl-space-4);
|
|
424
|
+
border:1px solid var(--dtl-border);border-radius:var(--dtl-radius-md);
|
|
425
|
+
background:var(--dtl-surface-1);color:var(--dtl-fg);
|
|
426
|
+
cursor:pointer;text-align:left;font:inherit;
|
|
427
|
+
transition:background var(--dtl-dur) var(--dtl-ease),border-color var(--dtl-dur) var(--dtl-ease);
|
|
428
|
+
}
|
|
429
|
+
.dtl-card:hover{background:var(--dtl-hover)}
|
|
430
|
+
.dtl-card[aria-pressed="true"]{border-color:var(--dtl-business);background:var(--dtl-business-soft)}
|
|
431
|
+
.dtl-card:focus-visible{outline:2px solid var(--dtl-business);outline-offset:2px}
|
|
432
|
+
|
|
433
|
+
/* 列表行:头部可点,hover 抬底;展开行走 --dtl-open-bg */
|
|
434
|
+
.dtl-row{border:1px solid var(--dtl-border);border-radius:var(--dtl-radius-md);overflow:hidden}
|
|
435
|
+
.dtl-row + .dtl-row{margin-top:var(--dtl-space-2)}
|
|
436
|
+
.dtl-row-head{
|
|
437
|
+
display:flex;align-items:center;gap:var(--dtl-space-2);
|
|
438
|
+
width:100%;padding:var(--dtl-space-3);border:0;background:transparent;
|
|
439
|
+
color:inherit;font:inherit;text-align:left;cursor:pointer;
|
|
440
|
+
transition:background var(--dtl-dur) var(--dtl-ease);
|
|
441
|
+
}
|
|
442
|
+
.dtl-row-head:hover{background:var(--dtl-hover)}
|
|
443
|
+
.dtl-row-head:focus-visible{outline:2px solid var(--dtl-business);outline-offset:-2px}
|
|
444
|
+
.dtl-row[data-open="true"]{background:var(--dtl-open-bg)}
|
|
445
|
+
.dtl-row-body{padding:0 var(--dtl-space-3) var(--dtl-space-3);border-top:1px solid var(--dtl-border)}
|
|
446
|
+
|
|
447
|
+
/* chip(分类 / 标签):小底板走 --dtl-chip-bg,hover 加深 */
|
|
448
|
+
.dtl-chip{
|
|
449
|
+
display:inline-flex;align-items:center;gap:var(--dtl-space-1);
|
|
450
|
+
padding:0 var(--dtl-space-2);height:20px;border-radius:var(--dtl-radius-sm);
|
|
451
|
+
background:var(--dtl-chip-bg);color:var(--dtl-fg-2);
|
|
452
|
+
font-size:var(--dtl-font-xs);white-space:nowrap;max-width:20ch;overflow:hidden;text-overflow:ellipsis;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/* 原生下拉 / 输入框:宿主没有廉价的选择器,用原生控件 + token 配色(不用自绘菜单) */
|
|
456
|
+
.dtl-select,.dtl-input{
|
|
457
|
+
height:var(--dtl-control-h-md);box-sizing:border-box;
|
|
458
|
+
padding:0 var(--dtl-space-2);border:1px solid var(--dtl-border);border-radius:var(--dtl-radius-sm);
|
|
459
|
+
background:var(--dtl-surface-1);color:var(--dtl-fg);
|
|
460
|
+
font-family:inherit;font-size:var(--dtl-font-md);
|
|
461
|
+
}
|
|
462
|
+
.dtl-input{padding-left:var(--dtl-space-3);min-width:220px}
|
|
463
|
+
.dtl-select:focus-visible,.dtl-input:focus-visible{outline:2px solid var(--dtl-business);outline-offset:1px}
|
|
464
|
+
|
|
465
|
+
/* 空态:真空 = 虚线引导卡;筛选空 = 小字 */
|
|
466
|
+
.dtl-empty-guide{
|
|
467
|
+
padding:var(--dtl-space-4);border:1px dashed var(--dtl-border-strong);border-radius:var(--dtl-radius-md);
|
|
468
|
+
background:transparent;
|
|
469
|
+
}
|
|
470
|
+
.dtl-empty-filtered{padding:var(--dtl-space-4) 0;color:var(--dtl-fg-3);font-size:var(--dtl-font-md)}
|
|
471
|
+
|
|
472
|
+
/* 浮标角标:0→n 跳变时一次脉冲,不自动消失 */
|
|
473
|
+
.dtl-badge{
|
|
474
|
+
position:absolute;top:-2px;right:-2px;min-width:16px;height:16px;padding:0 4px;
|
|
475
|
+
border-radius:8px;background:var(--dtl-danger);color:var(--dtl-on-signal);
|
|
476
|
+
font-size:10px;line-height:16px;text-align:center;font-weight:600;
|
|
477
|
+
}
|
|
478
|
+
.dtl-badge[data-pulse="true"]{animation:dtl-pulse 900ms var(--dtl-ease) 1}
|
|
479
|
+
@keyframes dtl-pulse{0%{transform:scale(.6);opacity:.4}60%{transform:scale(1.15)}100%{transform:scale(1)}}
|
|
480
|
+
|
|
481
|
+
/* 过程正文:宽度受限、长行折行 */
|
|
482
|
+
.dtl-worklog{max-width:72ch;font-size:var(--dtl-font-md);line-height:1.6}
|
|
483
|
+
`;
|
|
484
|
+
const STYLE_ID = "dtl-ui-base";
|
|
485
|
+
/** 幂等注入 token 层 + 基础层(面板与浮标谁先挂载都只注入一次)。 */
|
|
486
|
+
function ensureUiBase() {
|
|
487
|
+
if (typeof document === "undefined") return;
|
|
488
|
+
if (document.getElementById(STYLE_ID) !== null) return;
|
|
489
|
+
const style = document.createElement("style");
|
|
490
|
+
style.id = STYLE_ID;
|
|
491
|
+
style.textContent = `${UI_TOKENS_CSS}\n${UI_BASE_CSS}`;
|
|
492
|
+
document.head.appendChild(style);
|
|
493
|
+
}
|
|
494
|
+
/** 统计卡:点一下联动下方列表筛选(aria-pressed = 选中态)。 */
|
|
495
|
+
function StatCard(props) {
|
|
496
|
+
return (0, react.createElement)("button", {
|
|
497
|
+
type: "button",
|
|
498
|
+
className: "dtl-card",
|
|
499
|
+
"aria-pressed": props.active,
|
|
500
|
+
title: props.title,
|
|
501
|
+
onClick: props.onClick
|
|
502
|
+
}, (0, react.createElement)("span", { style: {
|
|
503
|
+
fontSize: "var(--dtl-font-sm)",
|
|
504
|
+
color: "var(--dtl-fg-2)"
|
|
505
|
+
} }, props.label), (0, react.createElement)("span", { style: {
|
|
506
|
+
fontSize: "24px",
|
|
507
|
+
fontWeight: 600,
|
|
508
|
+
lineHeight: 1.2
|
|
509
|
+
} }, props.value));
|
|
510
|
+
}
|
|
511
|
+
/** chip(分类 / 标签 / 工作区名)。 */
|
|
512
|
+
function Chip(props) {
|
|
513
|
+
const style = {};
|
|
514
|
+
if (props.tone === "signal" && props.color !== void 0) {
|
|
515
|
+
style.background = props.color;
|
|
516
|
+
style.color = "var(--dtl-on-signal)";
|
|
517
|
+
}
|
|
518
|
+
return (0, react.createElement)("span", {
|
|
519
|
+
className: "dtl-chip",
|
|
520
|
+
style,
|
|
521
|
+
title: props.text
|
|
522
|
+
}, props.text);
|
|
523
|
+
}
|
|
524
|
+
/** 原生下拉(时间 / 标签筛选共用一份)。 */
|
|
525
|
+
function Select(props) {
|
|
526
|
+
return (0, react.createElement)("select", {
|
|
527
|
+
className: "dtl-select",
|
|
528
|
+
"aria-label": props.ariaLabel,
|
|
529
|
+
value: props.value,
|
|
530
|
+
onChange: (event) => {
|
|
531
|
+
props.onChange(event.target.value);
|
|
532
|
+
}
|
|
533
|
+
}, props.options.map((option) => (0, react.createElement)("option", {
|
|
534
|
+
key: option.value,
|
|
535
|
+
value: option.value
|
|
536
|
+
}, option.label)));
|
|
537
|
+
}
|
|
538
|
+
/** 搜索框(关键字过滤)。 */
|
|
539
|
+
function SearchInput(props) {
|
|
540
|
+
return (0, react.createElement)("input", {
|
|
541
|
+
className: "dtl-input",
|
|
542
|
+
type: "search",
|
|
543
|
+
"aria-label": props.ariaLabel,
|
|
544
|
+
placeholder: props.placeholder,
|
|
545
|
+
value: props.value,
|
|
546
|
+
spellCheck: false,
|
|
547
|
+
onChange: (event) => {
|
|
548
|
+
props.onChange(event.target.value);
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
/** 空态:`guide` = 真空引导卡(虚线),`filtered` = 筛选空小字。 */
|
|
553
|
+
function EmptyState(props) {
|
|
554
|
+
if (props.tone === "filtered") return (0, react.createElement)("div", { className: "dtl-empty-filtered" }, props.title);
|
|
555
|
+
return (0, react.createElement)("div", { className: "dtl-empty-guide" }, (0, react.createElement)("div", { style: {
|
|
556
|
+
fontSize: "var(--dtl-font-lg)",
|
|
557
|
+
fontWeight: 600,
|
|
558
|
+
marginBottom: "var(--dtl-space-1)"
|
|
559
|
+
} }, props.title), props.hint === void 0 ? null : (0, react.createElement)("div", { style: {
|
|
560
|
+
fontSize: "var(--dtl-font-md)",
|
|
561
|
+
color: "var(--dtl-fg-2)"
|
|
562
|
+
} }, props.hint));
|
|
563
|
+
}
|
|
564
|
+
//#endregion
|
|
565
|
+
//#region src/client/task-row.ts
|
|
566
|
+
/**
|
|
567
|
+
* 任务列表行(宿主**无表格件** ⇒ 自绘,几何参照官方 `DisclosureRow`,状态走官方 `StateDot`)。
|
|
568
|
+
* 定稿见 docs/design/features/board-home.md §二 与 docs/design/ui-style.md:
|
|
569
|
+
* 状态语义 open=idle / doing=ongoing / blocked=warning / 已结案=done。
|
|
570
|
+
*
|
|
571
|
+
* 行展开 = 过程文档路径 + 过程正文(在办走 `GET /task` 取正文;已结案只有路径——
|
|
572
|
+
* host 没有按历史行取正文的路由,不编造内容)。
|
|
573
|
+
*/
|
|
574
|
+
/** 行的状态点语义(在办三态 + 已结案)。 */
|
|
575
|
+
function dotOf(row) {
|
|
576
|
+
if (row.kind === "closed") return "done";
|
|
577
|
+
if (row.task.status === "blocked") return "warning";
|
|
578
|
+
if (row.task.status === "doing") return "ongoing";
|
|
579
|
+
return "idle";
|
|
580
|
+
}
|
|
581
|
+
/** 行标题:在办 = 任务名(缺则任务号);已结案 = 任务包名(缺则「完成了什么」首句)。 */
|
|
582
|
+
function titleOf(row) {
|
|
583
|
+
if (row.kind === "task") return row.task.title ?? row.task.id;
|
|
584
|
+
const title = row.record.workpackage ?? row.record.summary;
|
|
585
|
+
return title !== void 0 && title !== "" ? title : row.record.src ?? "—";
|
|
586
|
+
}
|
|
587
|
+
/** 行的「谁」:负责人优先,没有就创建人,都没有 = 未认领。 */
|
|
588
|
+
function whoOf(row) {
|
|
589
|
+
if (row.kind === "task") return row.task.owner ?? row.task.creator ?? null;
|
|
590
|
+
return row.record.owner ?? null;
|
|
591
|
+
}
|
|
592
|
+
function TaskRowView(props) {
|
|
593
|
+
const { t, row } = props;
|
|
594
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
595
|
+
const mdLabels = (0, react.useMemo)(() => ({
|
|
596
|
+
code: {
|
|
597
|
+
copyLabel: t("mdCopy"),
|
|
598
|
+
copiedLabel: t("mdCopied")
|
|
599
|
+
},
|
|
600
|
+
footnotes: t("mdFootnotes")
|
|
601
|
+
}), [t]);
|
|
602
|
+
/** 行的时间:在办 doing/blocked 看开始、其余看创建;已结案看结案。 */
|
|
603
|
+
const stamp = row.kind === "closed" ? {
|
|
604
|
+
value: row.record.time ?? row.record.created ?? null,
|
|
605
|
+
label: t("fieldFinished")
|
|
606
|
+
} : row.task.status === "open" ? {
|
|
607
|
+
value: row.task.created ?? null,
|
|
608
|
+
label: t("fieldCreated")
|
|
609
|
+
} : {
|
|
610
|
+
value: row.task.started ?? row.task.created ?? null,
|
|
611
|
+
label: t("fieldStarted")
|
|
612
|
+
};
|
|
613
|
+
const when = stamp.value === null || stamp.value === void 0 || stamp.value === "" ? t("timeUnknown") : formatDateTime(stamp.value, { fallback: t("timeUnknown") });
|
|
614
|
+
const who = whoOf(row);
|
|
615
|
+
const workspace = row.kind === "task" ? row.task.workspace : row.record.workspace;
|
|
616
|
+
const category = row.kind === "task" ? row.task.category : row.record.category;
|
|
617
|
+
const tags = (row.kind === "task" ? row.task.tags : row.record.tags) ?? [];
|
|
618
|
+
const logPath = row.kind === "task" ? row.task.worklog : row.record.log;
|
|
619
|
+
return (0, react.createElement)("div", {
|
|
620
|
+
className: "dtl-row",
|
|
621
|
+
"data-open": open
|
|
622
|
+
}, (0, react.createElement)("button", {
|
|
623
|
+
type: "button",
|
|
624
|
+
className: "dtl-row-head",
|
|
625
|
+
"aria-expanded": open,
|
|
626
|
+
title: open ? t("collapseAria") : t("expandAria"),
|
|
627
|
+
onClick: () => {
|
|
628
|
+
setOpen(!open);
|
|
629
|
+
}
|
|
630
|
+
}, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: dotOf(row) }), (0, react.createElement)("span", {
|
|
631
|
+
style: {
|
|
632
|
+
flex: "1 1 auto",
|
|
633
|
+
minWidth: 0,
|
|
634
|
+
overflow: "hidden",
|
|
635
|
+
textOverflow: "ellipsis",
|
|
636
|
+
whiteSpace: "nowrap",
|
|
637
|
+
fontSize: "var(--dtl-font-md)"
|
|
638
|
+
},
|
|
639
|
+
title: titleOf(row)
|
|
640
|
+
}, titleOf(row)), category === null || category === void 0 || category === "" ? null : (0, react.createElement)(Chip, { text: category }), tags.slice(0, 2).map((tag) => (0, react.createElement)(Chip, {
|
|
641
|
+
key: tag,
|
|
642
|
+
text: `#${tag}`
|
|
643
|
+
})), (0, react.createElement)("span", { style: {
|
|
644
|
+
display: "flex",
|
|
645
|
+
alignItems: "center",
|
|
646
|
+
gap: "var(--dtl-space-2)",
|
|
647
|
+
color: "var(--dtl-fg-3)",
|
|
648
|
+
fontSize: "var(--dtl-font-xs)",
|
|
649
|
+
whiteSpace: "nowrap"
|
|
650
|
+
} }, workspace === void 0 ? null : (0, react.createElement)("span", null, workspace.title), (0, react.createElement)("span", { title: stamp.value ?? void 0 }, `${stamp.label} ${when}`), (0, react.createElement)("span", null, who === null || who === "" ? t("ownerUnclaimed") : `@${who}`)), (0, react.createElement)(open ? _deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular : _deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutlineRegular, { size: 16 })), open ? (0, react.createElement)("div", { className: "dtl-row-body" }, (0, react.createElement)("div", { style: {
|
|
651
|
+
margin: "var(--dtl-space-2) 0",
|
|
652
|
+
fontSize: "var(--dtl-font-sm)",
|
|
653
|
+
color: "var(--dtl-fg-2)"
|
|
654
|
+
} }, `${t("worklogTitle")}·${t("worklogPath")}:${logPath === null || logPath === void 0 || logPath === "" ? t("worklogMissing") : logPath}`), row.kind === "closed" ? (0, react.createElement)("div", { style: {
|
|
655
|
+
fontSize: "var(--dtl-font-md)",
|
|
656
|
+
color: "var(--dtl-fg-2)"
|
|
657
|
+
} }, row.record.summary ?? "") : (0, react.createElement)(WorklogBody, {
|
|
658
|
+
t,
|
|
659
|
+
workspaceId: row.task.workspace.id,
|
|
660
|
+
taskId: row.task.id,
|
|
661
|
+
labels: mdLabels
|
|
662
|
+
})) : null);
|
|
663
|
+
}
|
|
664
|
+
/** 在办行的过程正文:**展开才取**(首屏不为正文付代价),且只在挂载时取一次(不随重渲染重取)。 */
|
|
665
|
+
function WorklogBody(props) {
|
|
666
|
+
const { t, workspaceId, taskId, labels } = props;
|
|
667
|
+
const [detail, setDetail] = (0, react.useState)(null);
|
|
668
|
+
const [failed, setFailed] = (0, react.useState)(null);
|
|
669
|
+
(0, react.useEffect)(() => {
|
|
670
|
+
let alive = true;
|
|
671
|
+
fetchTaskDetail(workspaceId, taskId).then((body) => {
|
|
672
|
+
if (alive) setDetail(body);
|
|
673
|
+
}).catch((error) => {
|
|
674
|
+
if (alive) setFailed(error instanceof Error ? error.message : String(error));
|
|
675
|
+
});
|
|
676
|
+
return () => {
|
|
677
|
+
alive = false;
|
|
678
|
+
};
|
|
679
|
+
}, [workspaceId, taskId]);
|
|
680
|
+
if (failed !== null) return (0, react.createElement)("div", { style: {
|
|
681
|
+
color: "var(--dtl-danger)",
|
|
682
|
+
fontSize: "var(--dtl-font-sm)"
|
|
683
|
+
} }, `${t("loadFailed")}:${failed}`);
|
|
684
|
+
if (detail === null) return (0, react.createElement)("div", { style: {
|
|
685
|
+
color: "var(--dtl-fg-3)",
|
|
686
|
+
fontSize: "var(--dtl-font-sm)"
|
|
687
|
+
} }, t("loading"));
|
|
688
|
+
if (detail.worklog === null) return (0, react.createElement)("div", { style: {
|
|
689
|
+
color: "var(--dtl-fg-3)",
|
|
690
|
+
fontSize: "var(--dtl-font-sm)"
|
|
691
|
+
} }, t("worklogMissing"));
|
|
692
|
+
return (0, react.createElement)("div", { className: "dtl-worklog" }, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.MarkdownText, {
|
|
693
|
+
text: detail.worklog,
|
|
694
|
+
labels,
|
|
695
|
+
variant: "compact"
|
|
696
|
+
}));
|
|
697
|
+
}
|
|
698
|
+
//#endregion
|
|
699
|
+
//#region src/client/board-home.ts
|
|
700
|
+
/**
|
|
701
|
+
* 看板首页(`main` 槽整页内容):4 统计卡(可点联动筛选)+ 筛选行 + 统一任务列表。
|
|
702
|
+
* 定稿见 docs/design/features/board-home.md §二;按钮矩阵归「任务按钮与会话交接」任务(写入路径 A/B 未拍板),
|
|
703
|
+
* 本页**不画**任务动作按钮——不先斩后奏。
|
|
704
|
+
*
|
|
705
|
+
* 刷新纪律(2026-10-17 拍板):挂载首读 + 手动刷新按钮,**不轮询**;空态三分(未就绪不渲染 / 真空引导卡 / 筛选空小字)。
|
|
706
|
+
*/
|
|
707
|
+
/** 整页容器:占满中栏、自己滚动。 */
|
|
708
|
+
const pageStyle = {
|
|
709
|
+
height: "100%",
|
|
710
|
+
width: "100%",
|
|
711
|
+
boxSizing: "border-box",
|
|
712
|
+
overflow: "auto",
|
|
713
|
+
padding: "24px 22px",
|
|
714
|
+
color: "var(--dtl-fg)"
|
|
715
|
+
};
|
|
716
|
+
const headerStyle = {
|
|
717
|
+
display: "flex",
|
|
718
|
+
alignItems: "center",
|
|
719
|
+
justifyContent: "space-between",
|
|
720
|
+
gap: "var(--dtl-space-3)",
|
|
721
|
+
flexWrap: "wrap",
|
|
722
|
+
marginBottom: "var(--dtl-space-4)"
|
|
723
|
+
};
|
|
724
|
+
const titleStyle = {
|
|
725
|
+
fontSize: "var(--dtl-font-xl)",
|
|
726
|
+
fontWeight: 600
|
|
727
|
+
};
|
|
728
|
+
const statsGridStyle = {
|
|
729
|
+
display: "grid",
|
|
730
|
+
gridTemplateColumns: "repeat(auto-fit,minmax(160px,1fr))",
|
|
731
|
+
gap: "var(--dtl-space-3)",
|
|
732
|
+
marginBottom: "var(--dtl-space-4)"
|
|
733
|
+
};
|
|
734
|
+
const filterRowStyle = {
|
|
735
|
+
display: "flex",
|
|
736
|
+
alignItems: "center",
|
|
737
|
+
gap: "var(--dtl-space-2)",
|
|
738
|
+
flexWrap: "wrap",
|
|
739
|
+
marginBottom: "var(--dtl-space-3)"
|
|
740
|
+
};
|
|
741
|
+
const hintStyle = {
|
|
742
|
+
fontSize: "var(--dtl-font-sm)",
|
|
743
|
+
color: "var(--dtl-fg-2)"
|
|
744
|
+
};
|
|
745
|
+
function BoardHome(props) {
|
|
746
|
+
const { t, onBack } = props;
|
|
747
|
+
ensureUiBase();
|
|
748
|
+
const state = (0, react.useSyncExternalStore)(boardSubscribe, boardSnapshot);
|
|
749
|
+
const [tab, setTab] = (0, react.useState)("tasks");
|
|
750
|
+
(0, react.useEffect)(() => {
|
|
751
|
+
refresh();
|
|
752
|
+
}, []);
|
|
753
|
+
const board = state.board;
|
|
754
|
+
const rows = (0, react.useMemo)(() => selectRows(state), [state]);
|
|
755
|
+
const tagOptions = (0, react.useMemo)(() => [{
|
|
756
|
+
value: "",
|
|
757
|
+
label: t("tagAll")
|
|
758
|
+
}, ...(state.filters?.tags ?? []).map((tag) => ({
|
|
759
|
+
value: tag,
|
|
760
|
+
label: `#${tag}`
|
|
761
|
+
}))], [state.filters, t]);
|
|
762
|
+
/** 统计卡 → 筛选联动(点第二下不反选:档位语义是「切到这一档」,不是开关)。 */
|
|
763
|
+
const card = (label, value, bucket, range) => (0, react.createElement)(StatCard, {
|
|
764
|
+
label: t(label),
|
|
765
|
+
value,
|
|
766
|
+
active: state.query.bucket === bucket && (bucket !== "closed" || state.query.range === range),
|
|
767
|
+
onClick: () => {
|
|
768
|
+
setQuery({
|
|
769
|
+
bucket,
|
|
770
|
+
range,
|
|
771
|
+
limit: 500
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
return (0, react.createElement)("div", { style: pageStyle }, (0, react.createElement)("div", { style: {
|
|
776
|
+
display: "flex",
|
|
777
|
+
justifyContent: "center"
|
|
778
|
+
} }, (0, react.createElement)("div", { style: {
|
|
779
|
+
width: "100%",
|
|
780
|
+
maxWidth: "1120px",
|
|
781
|
+
minWidth: 0,
|
|
782
|
+
boxSizing: "border-box"
|
|
783
|
+
} }, (0, react.createElement)("div", { style: headerStyle }, (0, react.createElement)("div", { style: {
|
|
784
|
+
display: "flex",
|
|
785
|
+
alignItems: "center",
|
|
786
|
+
gap: "var(--dtl-space-3)",
|
|
787
|
+
minWidth: 0
|
|
788
|
+
} }, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
789
|
+
variant: "outline",
|
|
790
|
+
size: "md",
|
|
791
|
+
onClick: onBack
|
|
792
|
+
}, `← ${t("backToConversation")}`), (0, react.createElement)("div", { style: titleStyle }, t("panelTitle"))), (0, react.createElement)("div", { style: {
|
|
793
|
+
display: "flex",
|
|
794
|
+
alignItems: "center",
|
|
795
|
+
gap: "var(--dtl-space-2)"
|
|
796
|
+
} }, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.SegmentedControl, {
|
|
797
|
+
id: "dtl-tab",
|
|
798
|
+
value: tab,
|
|
799
|
+
label: t("panelTitle"),
|
|
800
|
+
options: [{
|
|
801
|
+
value: "tasks",
|
|
802
|
+
label: t("tabTasks")
|
|
803
|
+
}, {
|
|
804
|
+
value: "stats",
|
|
805
|
+
label: t("tabStats")
|
|
806
|
+
}],
|
|
807
|
+
onChange: setTab
|
|
808
|
+
}), (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
809
|
+
variant: "outline",
|
|
810
|
+
size: "md",
|
|
811
|
+
icon: (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineRegular, { size: 16 }),
|
|
812
|
+
title: t("refresh"),
|
|
813
|
+
disabled: state.refreshing,
|
|
814
|
+
onClick: () => {
|
|
815
|
+
refresh();
|
|
816
|
+
}
|
|
817
|
+
}, state.refreshing ? t("refreshing") : t("refresh")))), tab === "stats" ? (0, react.createElement)("div", { style: hintStyle }, t("statsPlaceholder")) : (0, react.createElement)("div", null, board === null ? null : (0, react.createElement)("div", { style: statsGridStyle }, card("statMyActive", String(board.stats.myActive), "mine", "all"), card("statOpen", String(board.stats.open), "open", "all"), card("statWeekDone", String(board.closed.weekDone), "closed", "week"), card("statYearDone", board.closed.yearCapped ? t("countCapped") : String(board.closed.yearDone), "closed", "year")), (0, react.createElement)("div", { style: filterRowStyle }, (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.SegmentedControl, {
|
|
818
|
+
id: "dtl-bucket",
|
|
819
|
+
value: state.query.bucket,
|
|
820
|
+
label: t("bucketLabel"),
|
|
821
|
+
options: [
|
|
822
|
+
{
|
|
823
|
+
value: "all",
|
|
824
|
+
label: t("bucketAll")
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
value: "mine",
|
|
828
|
+
label: t("bucketMine")
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
value: "open",
|
|
832
|
+
label: t("bucketOpen")
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
value: "closed",
|
|
836
|
+
label: t("bucketClosed")
|
|
837
|
+
}
|
|
838
|
+
],
|
|
839
|
+
onChange: (next) => {
|
|
840
|
+
setQuery({
|
|
841
|
+
bucket: next,
|
|
842
|
+
limit: 500
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
}), (0, react.createElement)(Select, {
|
|
846
|
+
value: state.query.range,
|
|
847
|
+
ariaLabel: t("rangeLabel"),
|
|
848
|
+
options: [
|
|
849
|
+
{
|
|
850
|
+
value: "all",
|
|
851
|
+
label: t("rangeAll")
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
value: "week",
|
|
855
|
+
label: t("rangeWeek")
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
value: "month",
|
|
859
|
+
label: t("rangeMonth")
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
value: "year",
|
|
863
|
+
label: t("rangeYear")
|
|
864
|
+
}
|
|
865
|
+
],
|
|
866
|
+
onChange: (next) => {
|
|
867
|
+
setQuery({
|
|
868
|
+
range: next,
|
|
869
|
+
limit: 500
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
}), (0, react.createElement)(Select, {
|
|
873
|
+
value: state.query.tag,
|
|
874
|
+
ariaLabel: t("tagAll"),
|
|
875
|
+
options: tagOptions,
|
|
876
|
+
onChange: (next) => {
|
|
877
|
+
setQuery({
|
|
878
|
+
tag: next,
|
|
879
|
+
limit: 500
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
}), (0, react.createElement)(SearchInput, {
|
|
883
|
+
value: state.query.keyword,
|
|
884
|
+
placeholder: t("searchPlaceholder"),
|
|
885
|
+
ariaLabel: t("searchPlaceholder"),
|
|
886
|
+
onChange: (next) => {
|
|
887
|
+
setQuery({ keyword: next });
|
|
888
|
+
}
|
|
889
|
+
})), state.status === "loading" && board === null ? null : state.status === "error" && board === null ? (0, react.createElement)("div", { style: {
|
|
890
|
+
display: "flex",
|
|
891
|
+
alignItems: "center",
|
|
892
|
+
gap: "var(--dtl-space-2)"
|
|
893
|
+
} }, (0, react.createElement)("span", { style: {
|
|
894
|
+
color: "var(--dtl-danger)",
|
|
895
|
+
fontSize: "var(--dtl-font-md)"
|
|
896
|
+
} }, `${t("loadFailed")}:${state.error ?? ""}`), (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
897
|
+
variant: "outline",
|
|
898
|
+
size: "sm",
|
|
899
|
+
onClick: () => {
|
|
900
|
+
refresh();
|
|
901
|
+
}
|
|
902
|
+
}, t("retry"))) : board !== null && board.workspaces.length === 0 ? (0, react.createElement)(EmptyState, {
|
|
903
|
+
tone: "guide",
|
|
904
|
+
title: t("emptyNoWorkspace"),
|
|
905
|
+
hint: t("emptyNoWorkspaceHint")
|
|
906
|
+
}) : state.query.bucket === "closed" && state.historyStatus === "loading" && state.history.length === 0 ? (0, react.createElement)("div", { style: hintStyle }, t("loading")) : state.query.bucket === "closed" && state.historyStatus === "error" ? (0, react.createElement)("div", { style: {
|
|
907
|
+
display: "flex",
|
|
908
|
+
alignItems: "center",
|
|
909
|
+
gap: "var(--dtl-space-2)"
|
|
910
|
+
} }, (0, react.createElement)("span", { style: {
|
|
911
|
+
color: "var(--dtl-danger)",
|
|
912
|
+
fontSize: "var(--dtl-font-md)"
|
|
913
|
+
} }, `${t("loadFailed")}:${state.historyError ?? ""}`), (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
914
|
+
variant: "outline",
|
|
915
|
+
size: "sm",
|
|
916
|
+
onClick: () => {
|
|
917
|
+
setQuery({});
|
|
918
|
+
}
|
|
919
|
+
}, t("retry"))) : rows.length === 0 ? (0, react.createElement)(EmptyState, {
|
|
920
|
+
tone: isPristine(state) ? "guide" : "filtered",
|
|
921
|
+
title: isPristine(state) ? t("emptyNoTask") : t("emptyFiltered"),
|
|
922
|
+
hint: isPristine(state) ? t("emptyNoTaskHint") : void 0
|
|
923
|
+
}) : (0, react.createElement)("div", null, rows.map((row) => (0, react.createElement)(TaskRowView, {
|
|
924
|
+
key: row.key,
|
|
925
|
+
t,
|
|
926
|
+
row
|
|
927
|
+
})), (0, react.createElement)("div", { style: {
|
|
928
|
+
...filterRowStyle,
|
|
929
|
+
marginTop: "var(--dtl-space-3)",
|
|
930
|
+
color: "var(--dtl-fg-3)",
|
|
931
|
+
fontSize: "var(--dtl-font-xs)"
|
|
932
|
+
} }, (0, react.createElement)("span", null, t("showingCount", { n: rows.length })), state.query.bucket === "closed" && state.history.length >= state.query.limit ? (0, react.createElement)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
933
|
+
variant: "outline",
|
|
934
|
+
size: "sm",
|
|
935
|
+
disabled: state.historyStatus === "loading",
|
|
936
|
+
onClick: () => {
|
|
937
|
+
loadMoreHistory();
|
|
938
|
+
}
|
|
939
|
+
}, state.historyStatus === "loading" ? t("loading") : t("loadMore")) : null))))));
|
|
940
|
+
}
|
|
941
|
+
/** 是否「什么都没筛」:真空才给引导卡,一有筛选就只能是「筛选空」。 */
|
|
942
|
+
function isPristine(state) {
|
|
943
|
+
const { query } = state;
|
|
944
|
+
return query.bucket === "all" && query.range === "all" && query.tag === "" && query.keyword.trim() === "";
|
|
945
|
+
}
|
|
946
|
+
//#endregion
|
|
947
|
+
//#region src/client/locales.ts
|
|
948
|
+
/** 把宿主给的无参 t 包成带占位符替换的 t(官方模板一律 `{name}`)。 */
|
|
949
|
+
function interpolateTranslate(base) {
|
|
950
|
+
return (key, params) => {
|
|
951
|
+
const raw = base(key);
|
|
952
|
+
if (params === void 0) return raw;
|
|
953
|
+
return raw.replace(/\{(\w+)\}/g, (match, name) => name in params ? String(params[name]) : match);
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
const zh = {
|
|
957
|
+
panelTitle: "任务台账",
|
|
958
|
+
backToConversation: "返回会话",
|
|
959
|
+
tabTasks: "任务",
|
|
960
|
+
tabStats: "统计",
|
|
961
|
+
statsPlaceholder: "统计报表尚未开建(本版只有任务首页)",
|
|
962
|
+
statMyActive: "我的待办",
|
|
963
|
+
statOpen: "待认领",
|
|
964
|
+
statWeekDone: "本周已完成",
|
|
965
|
+
statYearDone: "近一年完成",
|
|
966
|
+
countCapped: "1万+",
|
|
967
|
+
bucketLabel: "状态档",
|
|
968
|
+
bucketAll: "全部",
|
|
969
|
+
bucketMine: "我的待办",
|
|
970
|
+
bucketOpen: "待认领",
|
|
971
|
+
bucketClosed: "已结案",
|
|
972
|
+
rangeLabel: "时间",
|
|
973
|
+
rangeAll: "全部时间",
|
|
974
|
+
rangeWeek: "本周",
|
|
975
|
+
rangeMonth: "本月",
|
|
976
|
+
rangeYear: "近一年",
|
|
977
|
+
tagAll: "全部标签",
|
|
978
|
+
searchPlaceholder: "搜索标题 / 负责人 / 任务号",
|
|
979
|
+
refresh: "刷新",
|
|
980
|
+
refreshing: "读取中…",
|
|
981
|
+
loading: "加载中…",
|
|
982
|
+
retry: "重试",
|
|
983
|
+
loadFailed: "读取失败",
|
|
984
|
+
emptyNoWorkspace: "没有检测到台账工作区",
|
|
985
|
+
emptyNoWorkspaceHint: "宿主已添加的工作区里,还没有含 ledger/progress.json 的目录。",
|
|
986
|
+
emptyNoTask: "还没有任务",
|
|
987
|
+
emptyNoTaskHint: "在任一工作区里用 task-ledger skill 建任务(/ledger),这里就会看到它。",
|
|
988
|
+
emptyFiltered: "当前筛选下没有任务",
|
|
989
|
+
showingCount: "显示 {n} 条",
|
|
990
|
+
loadMore: "加载更多",
|
|
991
|
+
noMore: "没有更多了",
|
|
992
|
+
expandAria: "展开详情",
|
|
993
|
+
collapseAria: "收起详情",
|
|
994
|
+
fieldOwner: "负责人",
|
|
995
|
+
fieldCreator: "创建人",
|
|
996
|
+
fieldCreated: "创建",
|
|
997
|
+
fieldStarted: "开始",
|
|
998
|
+
fieldFinished: "结案",
|
|
999
|
+
fieldWorkspace: "工作区",
|
|
1000
|
+
fieldCategory: "分类",
|
|
1001
|
+
ownerUnclaimed: "未认领",
|
|
1002
|
+
timeUnknown: "时间未知",
|
|
1003
|
+
statusOpen: "待认领",
|
|
1004
|
+
statusDoing: "进行中",
|
|
1005
|
+
statusBlocked: "受阻",
|
|
1006
|
+
statusClosed: "已结案",
|
|
1007
|
+
worklogTitle: "过程文档",
|
|
1008
|
+
worklogMissing: "过程文档缺失(文件已不在盘上)",
|
|
1009
|
+
worklogPath: "路径",
|
|
1010
|
+
badgeTitle: "我名下进行中 + 受阻的任务数",
|
|
1011
|
+
openBoard: "打开任务台账",
|
|
1012
|
+
mdCopy: "复制",
|
|
1013
|
+
mdCopied: "已复制",
|
|
1014
|
+
mdFootnotes: "脚注"
|
|
1015
|
+
};
|
|
1016
|
+
const en = {
|
|
1017
|
+
panelTitle: "Task ledger",
|
|
1018
|
+
backToConversation: "Back to conversation",
|
|
1019
|
+
tabTasks: "Tasks",
|
|
1020
|
+
tabStats: "Stats",
|
|
1021
|
+
statsPlaceholder: "The stats report is not built yet (this release ships the task home only)",
|
|
1022
|
+
statMyActive: "My active",
|
|
1023
|
+
statOpen: "Unclaimed",
|
|
1024
|
+
statWeekDone: "Closed this week",
|
|
1025
|
+
statYearDone: "Closed in the last year",
|
|
1026
|
+
countCapped: "10k+",
|
|
1027
|
+
bucketLabel: "Status",
|
|
1028
|
+
bucketAll: "All",
|
|
1029
|
+
bucketMine: "My active",
|
|
1030
|
+
bucketOpen: "Unclaimed",
|
|
1031
|
+
bucketClosed: "Closed",
|
|
1032
|
+
rangeLabel: "Time",
|
|
1033
|
+
rangeAll: "Any time",
|
|
1034
|
+
rangeWeek: "This week",
|
|
1035
|
+
rangeMonth: "This month",
|
|
1036
|
+
rangeYear: "Last year",
|
|
1037
|
+
tagAll: "All tags",
|
|
1038
|
+
searchPlaceholder: "Search title / owner / task id",
|
|
1039
|
+
refresh: "Refresh",
|
|
1040
|
+
refreshing: "Loading…",
|
|
1041
|
+
loading: "Loading…",
|
|
1042
|
+
retry: "Retry",
|
|
1043
|
+
loadFailed: "Failed to load",
|
|
1044
|
+
emptyNoWorkspace: "No ledger workspace detected",
|
|
1045
|
+
emptyNoWorkspaceHint: "None of the workspaces added to the host contains ledger/progress.json.",
|
|
1046
|
+
emptyNoTask: "No tasks yet",
|
|
1047
|
+
emptyNoTaskHint: "Create one with the task-ledger skill (/ledger) in any workspace and it shows up here.",
|
|
1048
|
+
emptyFiltered: "No task matches the current filters",
|
|
1049
|
+
showingCount: "Showing {n}",
|
|
1050
|
+
loadMore: "Load more",
|
|
1051
|
+
noMore: "No more",
|
|
1052
|
+
expandAria: "Expand details",
|
|
1053
|
+
collapseAria: "Collapse details",
|
|
1054
|
+
fieldOwner: "Owner",
|
|
1055
|
+
fieldCreator: "Creator",
|
|
1056
|
+
fieldCreated: "Created",
|
|
1057
|
+
fieldStarted: "Started",
|
|
1058
|
+
fieldFinished: "Closed",
|
|
1059
|
+
fieldWorkspace: "Workspace",
|
|
1060
|
+
fieldCategory: "Category",
|
|
1061
|
+
ownerUnclaimed: "unclaimed",
|
|
1062
|
+
timeUnknown: "unknown time",
|
|
1063
|
+
statusOpen: "Unclaimed",
|
|
1064
|
+
statusDoing: "In progress",
|
|
1065
|
+
statusBlocked: "Blocked",
|
|
1066
|
+
statusClosed: "Closed",
|
|
1067
|
+
worklogTitle: "Process log",
|
|
1068
|
+
worklogMissing: "Process log is missing (the file is no longer on disk)",
|
|
1069
|
+
worklogPath: "Path",
|
|
1070
|
+
badgeTitle: "Tasks I own that are in progress or blocked",
|
|
1071
|
+
openBoard: "Open the task ledger",
|
|
1072
|
+
mdCopy: "Copy",
|
|
1073
|
+
mdCopied: "Copied",
|
|
1074
|
+
mdFootnotes: "Footnotes"
|
|
1075
|
+
};
|
|
1076
|
+
/** 宿主未提供 t 时的兜底(保持中文:宿主语言服务缺席不该让界面变键名)。 */
|
|
1077
|
+
const fallbackTranslate = (key, params) => {
|
|
1078
|
+
const raw = zh[key];
|
|
1079
|
+
if (params === void 0) return raw;
|
|
1080
|
+
return raw.replace(/\{(\w+)\}/g, (match, name) => name in params ? String(params[name]) : match);
|
|
1081
|
+
};
|
|
1082
|
+
//#endregion
|
|
1083
|
+
//#region src/client/overlay-entry.ts
|
|
1084
|
+
/**
|
|
1085
|
+
* 右上浮标入口(`shell.overlay` list 条目,全帧浮层,条目并排添加不替换)。
|
|
1086
|
+
* 定位用宿主变量 `--dsh-frame-overlay-top`(标题栏净空 + 20px),**不写死 top 值**;
|
|
1087
|
+
* 浮层默认 `pointer-events:none`、子元素自动恢复 ⇒ 自绘条目不挡下方应用。
|
|
1088
|
+
*
|
|
1089
|
+
* 角标 = 我名下 `doing` + `blocked` 计数(host 统计真值,SSE 已否 ⇒ 取自同一份快照,>0 才画);
|
|
1090
|
+
* 0→n 跳变时一次脉冲动画,不自动消失。宿主**无**通知 API ⇒ 「通知」就是这个角标。
|
|
1091
|
+
*/
|
|
1092
|
+
/** 台账图标(黑白线条,描边走 currentColor ⇒ 随主题反色)。 */
|
|
1093
|
+
function LedgerIcon(props) {
|
|
1094
|
+
const size = props.size ?? 18;
|
|
1095
|
+
const stroke = {
|
|
1096
|
+
fill: "none",
|
|
1097
|
+
stroke: "currentColor",
|
|
1098
|
+
strokeWidth: 7,
|
|
1099
|
+
strokeLinecap: "round",
|
|
1100
|
+
strokeLinejoin: "round"
|
|
1101
|
+
};
|
|
1102
|
+
return (0, react.createElement)("svg", {
|
|
1103
|
+
width: size,
|
|
1104
|
+
height: size,
|
|
1105
|
+
viewBox: "0 0 128 128",
|
|
1106
|
+
"aria-hidden": true
|
|
1107
|
+
}, (0, react.createElement)("path", {
|
|
1108
|
+
d: "M96 34 A10 10 0 0 1 106 44 V102 A10 10 0 0 1 96 112 H32 A10 10 0 0 1 22 102 V44 A10 10 0 0 1 32 34 Z",
|
|
1109
|
+
...stroke
|
|
1110
|
+
}), (0, react.createElement)("path", {
|
|
1111
|
+
d: "M50 22 V46 M78 22 V46",
|
|
1112
|
+
...stroke
|
|
1113
|
+
}), (0, react.createElement)("path", {
|
|
1114
|
+
d: "M44 66 H84 M44 86 H70",
|
|
1115
|
+
...stroke
|
|
1116
|
+
}));
|
|
1117
|
+
}
|
|
1118
|
+
function OverlayEntry(props) {
|
|
1119
|
+
const { t, onOpen } = props;
|
|
1120
|
+
ensureUiBase();
|
|
1121
|
+
const count = (0, react.useSyncExternalStore)(boardSubscribe, boardSnapshot).board?.stats.myActive ?? 0;
|
|
1122
|
+
const previous = (0, react.useRef)(0);
|
|
1123
|
+
const [pulse, setPulse] = (0, react.useState)(0);
|
|
1124
|
+
(0, react.useEffect)(() => {
|
|
1125
|
+
if (count > previous.current) setPulse((value) => value + 1);
|
|
1126
|
+
previous.current = count;
|
|
1127
|
+
}, [count]);
|
|
1128
|
+
return (0, react.createElement)("div", { style: {
|
|
1129
|
+
position: "absolute",
|
|
1130
|
+
top: "var(--dsh-frame-overlay-top,20px)",
|
|
1131
|
+
right: "12px",
|
|
1132
|
+
zIndex: "var(--dtl-z-badge,20)",
|
|
1133
|
+
pointerEvents: "auto"
|
|
1134
|
+
} }, (0, react.createElement)("button", {
|
|
1135
|
+
type: "button",
|
|
1136
|
+
title: t("openBoard"),
|
|
1137
|
+
"aria-label": t("openBoard"),
|
|
1138
|
+
onClick: onOpen,
|
|
1139
|
+
style: {
|
|
1140
|
+
position: "relative",
|
|
1141
|
+
display: "flex",
|
|
1142
|
+
alignItems: "center",
|
|
1143
|
+
justifyContent: "center",
|
|
1144
|
+
width: "32px",
|
|
1145
|
+
height: "32px",
|
|
1146
|
+
padding: 0,
|
|
1147
|
+
border: "1px solid var(--dtl-border)",
|
|
1148
|
+
borderRadius: "var(--dtl-radius-sm)",
|
|
1149
|
+
background: "var(--dtl-solid)",
|
|
1150
|
+
color: "var(--dtl-on-solid)",
|
|
1151
|
+
boxShadow: "var(--dtl-shadow-1)",
|
|
1152
|
+
cursor: "pointer"
|
|
1153
|
+
}
|
|
1154
|
+
}, (0, react.createElement)(LedgerIcon, { size: 18 }), count > 0 ? (0, react.createElement)("span", {
|
|
1155
|
+
key: pulse,
|
|
1156
|
+
className: "dtl-badge",
|
|
1157
|
+
"data-pulse": pulse > 0,
|
|
1158
|
+
title: t("badgeTitle")
|
|
1159
|
+
}, String(count)) : null));
|
|
1160
|
+
}
|
|
1161
|
+
//#endregion
|
|
1162
|
+
//#region src/client/index.ts
|
|
1163
|
+
/**
|
|
1164
|
+
* 浏览器半入口(client bundle,产物 dist/client.js):装配层,不写业务逻辑。
|
|
1165
|
+
*
|
|
1166
|
+
* 三处注册各自挂进「服务就位才触发」的 slots 注入(参考插件真机教训:顶层 inject 声明
|
|
1167
|
+
* 组合满足不了的依赖会让 entry 一直 pending、卡死整个 dsh 启动):
|
|
1168
|
+
* · locale 字典(zh / en)——界面语言跟随宿主,插件不自备开关;
|
|
1169
|
+
* · `main` keyed 槽整页(看板首页);
|
|
1170
|
+
* · `shell.overlay` list 槽浮标入口(点开 = `ctx.layout.selectPanel(<看板 id>)`)。
|
|
1171
|
+
*
|
|
1172
|
+
* 宿主能力一律**本地结构化声明**,不 import 官方包(rc 接口会无声变);
|
|
1173
|
+
* `t` 席位由宿主渲染器按注册项的 `locale:` 声明合成进组件 props。
|
|
1174
|
+
*/
|
|
1175
|
+
/** 命名空间(settings / locale / 面板 id 同名,便于对应)。 */
|
|
1176
|
+
const NS = "dsh-task-ledger";
|
|
1177
|
+
/** `main` 槽的 key(非 `conversation` ⇒ 不绑 Session)。 */
|
|
1178
|
+
const PANEL_ID = NS;
|
|
1179
|
+
/** `shell.overlay` list 条目的 id(新 id = 并排添加,不替换宿主条目)。 */
|
|
1180
|
+
const OVERLAY_ID = `${NS}-badge`;
|
|
1181
|
+
/** 宿主没给 t 席位时的兜底(键名绝不上界面)。 */
|
|
1182
|
+
const t = interpolateTranslate((key, params) => fallbackTranslate(key, params));
|
|
1183
|
+
function apply(ctx) {
|
|
1184
|
+
ctx.inject(["locale"], (localeCtx) => {
|
|
1185
|
+
ctx.effect(() => localeCtx.locale?.register(NS, {
|
|
1186
|
+
zh,
|
|
1187
|
+
en
|
|
1188
|
+
}));
|
|
1189
|
+
});
|
|
1190
|
+
let selectPanel = () => {};
|
|
1191
|
+
ctx.inject(["layout"], (sub) => {
|
|
1192
|
+
const layout = sub.layout;
|
|
1193
|
+
if (layout !== void 0) selectPanel = (id) => {
|
|
1194
|
+
layout.selectPanel(id);
|
|
1195
|
+
};
|
|
1196
|
+
});
|
|
1197
|
+
ctx.inject(["slots"], (sub) => {
|
|
1198
|
+
sub.slots.inject("main", () => sub.slots.register({
|
|
1199
|
+
name: "main",
|
|
1200
|
+
key: PANEL_ID,
|
|
1201
|
+
locale: NS
|
|
1202
|
+
}, (props) => (0, react.createElement)(BoardHome, {
|
|
1203
|
+
t: props.t ?? t,
|
|
1204
|
+
onBack: () => {
|
|
1205
|
+
selectPanel(null);
|
|
1206
|
+
}
|
|
1207
|
+
})));
|
|
1208
|
+
sub.slots.inject("shell.overlay", () => sub.slots.register({
|
|
1209
|
+
name: "shell.overlay",
|
|
1210
|
+
id: OVERLAY_ID,
|
|
1211
|
+
locale: NS
|
|
1212
|
+
}, (props) => (0, react.createElement)(OverlayEntry, {
|
|
1213
|
+
t: props.t ?? t,
|
|
1214
|
+
onOpen: () => {
|
|
1215
|
+
selectPanel(PANEL_ID);
|
|
1216
|
+
}
|
|
1217
|
+
})));
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
//#endregion
|
|
1221
|
+
exports.apply = apply;
|
|
1222
|
+
return module.exports;
|
|
1223
|
+
}
|
|
1224
|
+
});
|
|
1225
|
+
|
|
1226
|
+
//# sourceMappingURL=client.js.map
|