dsh-workbench-tasks 5.2.45 → 5.2.47

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/lib/client.js CHANGED
@@ -2471,7 +2471,7 @@ var require_switch = __commonJS({
2471
2471
  "packages/addons/lib/switch.cjs"(exports2, module2) {
2472
2472
  "use strict";
2473
2473
  var SWITCH_STYLES = [
2474
- ".wbctl-switch{display:inline-flex;align-items:center;gap:7px;min-height:24px;padding:2px;border:0;background:transparent;font:inherit;font-size:12px;color:var(--wb-muted,#6b7280);cursor:pointer;user-select:none;border-radius:999px}",
2474
+ ".wbctl-switch{display:inline-flex;align-items:center;gap:7px;white-space:nowrap;min-height:24px;padding:2px;border:0;background:transparent;font:inherit;font-size:12px;color:var(--wb-muted,#6b7280);cursor:pointer;user-select:none;border-radius:999px}",
2475
2475
  ".wbctl-switch-track{position:relative;display:inline-flex;align-items:center;box-sizing:border-box;width:34px;height:20px;padding:2px;border-radius:999px;background:color-mix(in oklab,currentColor 22%,transparent);transition:background .16s ease;flex:none}",
2476
2476
  ".wbctl-switch-knob{display:block;width:16px;height:16px;border-radius:50%;background:var(--wb-card,#fff);box-shadow:0 1px 2px rgba(0,0,0,.25);transition:transform .16s ease}",
2477
2477
  ".wbctl-switch[aria-checked=true]{color:var(--wb-accent,#2563eb)}",
@@ -5829,6 +5829,10 @@ var require_action_schema_style = __commonJS({
5829
5829
  "." + P + "-copy:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
5830
5830
  "." + P + " details>summary{cursor:pointer;font-size:11.5px;color:var(--dsw-alias-label-secondary,inherit);width:max-content}",
5831
5831
  "." + P + " details>summary:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
5832
+ // 参数折叠面板:折叠时只留一行「参数 · 必填 n」,展开后与表格之间留一点气口。
5833
+ "." + P + "-params{min-width:0}",
5834
+ "." + P + "-params>summary{user-select:none;max-width:100%}",
5835
+ "." + P + "-params[open]>summary{margin-bottom:6px}",
5832
5836
  "." + P + "-empty{padding:24px;text-align:center;border:1px dashed var(--wb-border,#e3e5e9);border-radius:10px;color:var(--dsw-alias-label-tertiary,inherit)}",
5833
5837
  "." + P + "-error{padding:12px;border:1px solid var(--dsw-alias-state-error-primary,#d9534f);border-radius:10px;color:var(--dsw-alias-state-error-primary,#d9534f);display:flex;gap:10px;align-items:center;flex-wrap:wrap;overflow-wrap:anywhere}",
5834
5838
  "." + P + "-toast{position:sticky;bottom:8px;align-self:flex-start;border-radius:999px;padding:3px 10px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);font-size:11.5px;max-width:100%}",
@@ -5908,6 +5912,10 @@ var require_action_schema_view = __commonJS({
5908
5912
  paramCount: function(n) {
5909
5913
  return n + " \u4E2A\u53C2\u6570";
5910
5914
  },
5915
+ params: "\u53C2\u6570",
5916
+ requiredCount: function(n) {
5917
+ return "\u5FC5\u586B " + n;
5918
+ },
5911
5919
  examples: "\u793A\u4F8B",
5912
5920
  noExamples: "\u65E0\u793A\u4F8B",
5913
5921
  copy: "\u590D\u5236",
@@ -5971,6 +5979,10 @@ var require_action_schema_view = __commonJS({
5971
5979
  paramCount: function(n) {
5972
5980
  return n + " params";
5973
5981
  },
5982
+ params: "Parameters",
5983
+ requiredCount: function(n) {
5984
+ return n + " required";
5985
+ },
5974
5986
  examples: "Examples",
5975
5987
  noExamples: "No examples",
5976
5988
  copy: "Copy",
@@ -6109,6 +6121,8 @@ var require_action_schema_view = __commonJS({
6109
6121
  var toast = toastState[0], setToast = toastState[1];
6110
6122
  var savingState = React.useState("");
6111
6123
  var saving = savingState[0], setSaving = savingState[1];
6124
+ var foldsState = React.useState({});
6125
+ var folds = foldsState[0], setFolds = foldsState[1];
6112
6126
  React.useEffect(function() {
6113
6127
  injectCss();
6114
6128
  }, []);
@@ -6208,6 +6222,15 @@ var require_action_schema_view = __commonJS({
6208
6222
  }
6209
6223
  Promise.resolve(api.call("actions.setActionOrigins", { action: name, origins: next })).then(done, fail);
6210
6224
  }
6225
+ function paramsOpen(action) {
6226
+ if (Object.prototype.hasOwnProperty.call(folds, action.name)) return folds[action.name] === true;
6227
+ return Boolean(String(query || "").trim()) || reqMode !== "all" || Boolean(typePick);
6228
+ }
6229
+ function resetFolds() {
6230
+ setFolds(function(prev) {
6231
+ return Object.keys(prev).length ? {} : prev;
6232
+ });
6233
+ }
6211
6234
  var all = snap && Array.isArray(snap.actions) ? snap.actions.filter(function(a) {
6212
6235
  return a && a.domain === DOMAIN;
6213
6236
  }) : [];
@@ -6304,6 +6327,10 @@ var require_action_schema_view = __commonJS({
6304
6327
  }
6305
6328
  function card(action) {
6306
6329
  var rows = paramRows(action);
6330
+ var required = rows.filter(function(row) {
6331
+ return row.required;
6332
+ }).length;
6333
+ var open = paramsOpen(action);
6307
6334
  var examples = Array.isArray(action.examples) ? action.examples : [];
6308
6335
  return h(
6309
6336
  "div",
@@ -6324,18 +6351,38 @@ var require_action_schema_view = __commonJS({
6324
6351
  ),
6325
6352
  action.description ? h("p", { className: P + "-desc" }, Highlight.hit(action.description, kw)) : null,
6326
6353
  rows.length ? h(
6327
- "table",
6328
- { className: P + "-table" },
6329
- h("thead", null, h(
6330
- "tr",
6331
- null,
6332
- h("th", null, t.colName),
6333
- h("th", null, t.colType),
6334
- h("th", null, t.colReq),
6335
- h("th", null, t.colExtra),
6336
- h("th", null, t.colDesc)
6337
- )),
6338
- h("tbody", null, rows.map(paramRow))
6354
+ "details",
6355
+ {
6356
+ className: P + "-params",
6357
+ "data-params-fold": action.name,
6358
+ open,
6359
+ // 原生 details 自带键盘与无障碍语义,这里只记下用户的开合;
6360
+ // 筛选变化引起的程序性开合也会触发 toggle,记下的值与当次默认一致,随后由 resetFolds 清掉。
6361
+ onToggle: function(e) {
6362
+ var next = !!(e && e.currentTarget && e.currentTarget.open);
6363
+ setFolds(function(prev) {
6364
+ if (prev[action.name] === next) return prev;
6365
+ var out = Object.assign({}, prev);
6366
+ out[action.name] = next;
6367
+ return out;
6368
+ });
6369
+ }
6370
+ },
6371
+ h("summary", null, t.params + (required ? " \xB7 " + t.requiredCount(required) : "")),
6372
+ h(
6373
+ "table",
6374
+ { className: P + "-table" },
6375
+ h("thead", null, h(
6376
+ "tr",
6377
+ null,
6378
+ h("th", null, t.colName),
6379
+ h("th", null, t.colType),
6380
+ h("th", null, t.colReq),
6381
+ h("th", null, t.colExtra),
6382
+ h("th", null, t.colDesc)
6383
+ )),
6384
+ h("tbody", null, rows.map(paramRow))
6385
+ )
6339
6386
  ) : h("div", { className: P + "-none" }, t.noParams),
6340
6387
  h(
6341
6388
  "div",
@@ -6412,6 +6459,7 @@ var require_action_schema_view = __commonJS({
6412
6459
  "aria-label": t.search,
6413
6460
  onChange: function(e) {
6414
6461
  setQuery(e.target.value);
6462
+ resetFolds();
6415
6463
  }
6416
6464
  })
6417
6465
  ),
@@ -6423,6 +6471,7 @@ var require_action_schema_view = __commonJS({
6423
6471
  "select",
6424
6472
  { value: reqMode, "aria-label": t.filterReq, onChange: function(e) {
6425
6473
  setReqMode(e.target.value);
6474
+ resetFolds();
6426
6475
  } },
6427
6476
  h("option", { value: "all" }, t.all),
6428
6477
  h("option", { value: "required" }, t.onlyRequired),
@@ -6437,6 +6486,7 @@ var require_action_schema_view = __commonJS({
6437
6486
  "select",
6438
6487
  { value: typePick, "aria-label": t.filterType, onChange: function(e) {
6439
6488
  setTypePick(e.target.value);
6489
+ resetFolds();
6440
6490
  } },
6441
6491
  h("option", { value: "" }, t.allTypes),
6442
6492
  typeOptions.map(function(name) {
@@ -6882,6 +6932,25 @@ var require_copy = __commonJS({
6882
6932
  }
6883
6933
  });
6884
6934
 
6935
+ // packages/addons/lib/icon-label.cjs
6936
+ var require_icon_label = __commonJS({
6937
+ "packages/addons/lib/icon-label.cjs"(exports2, module2) {
6938
+ "use strict";
6939
+ var VISUALLY_HIDDEN = "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap";
6940
+ module2.exports = function iconLabel(h, Icon2, text, options) {
6941
+ var opts = options || {};
6942
+ var cls = "wb-icon-label" + (opts.short ? " wb-icon-label-short" : "") + (Icon2 ? "" : " wb-icon-label-fallback");
6943
+ return h(
6944
+ "span",
6945
+ { className: cls, title: typeof text === "string" ? text : void 0 },
6946
+ Icon2 ? h(Icon2, { size: 14, strokeWidth: 2, "aria-hidden": true, focusable: false }) : null,
6947
+ h("span", { className: "wb-icon-label-text" }, text)
6948
+ );
6949
+ };
6950
+ module2.exports.styles = ".wb-icon-label{display:inline-flex;align-items:center;gap:5px;max-width:100%;vertical-align:middle;text-align:start}.wb-icon-label>svg{flex:none}.wb-icon-label>span{min-width:0;overflow-wrap:anywhere}button .wb-icon-label:not(.wb-icon-label-fallback) .wb-icon-label-text{" + VISUALLY_HIDDEN + "}button .wb-icon-label.wb-icon-label-short .wb-icon-label-text{position:static;width:auto;height:auto;margin:0;overflow:visible;clip-path:none;white-space:normal}";
6951
+ }
6952
+ });
6953
+
6885
6954
  // packages/addons/lib/icons.cjs
6886
6955
  var require_icons = __commonJS({
6887
6956
  "packages/addons/lib/icons.cjs"(exports2, module2) {
@@ -6905,6 +6974,11 @@ var require_icons = __commonJS({
6905
6974
  return h(C, attrs);
6906
6975
  }
6907
6976
  var set = { ICONS, Icon: Icon2 };
6977
+ set.label = function(name, text, options2) {
6978
+ return require_icon_label()(h, function NamedIcon(props) {
6979
+ return h(Icon2, Object.assign({ name }, props));
6980
+ }, text, options2);
6981
+ };
6908
6982
  if (opts.tabIcon) {
6909
6983
  set.tabIcon = function(name) {
6910
6984
  return function TabIcon() {
@@ -8151,7 +8225,7 @@ var require_icons2 = __commonJS({
8151
8225
  refresh: (init_refresh_cw(), __toCommonJS(refresh_cw_exports)).default
8152
8226
  // 「原邮件」回链:从邮件建出来的任务要能跳回去看一眼原文。
8153
8227
  }, {});
8154
- module2.exports = { ICONS: set.ICONS, Icon: set.Icon };
8228
+ module2.exports = { ICONS: set.ICONS, Icon: set.Icon, label: set.label };
8155
8229
  }
8156
8230
  });
8157
8231
 
@@ -14887,7 +14961,7 @@ var require_timeline_view = __commonJS({
14887
14961
  var TimelineView = require_timeline_view()({ React, COPY, injectCss, statusInfo, configView, CFG_FALLBACK, TaskItem, EditModal, DoneModal, TimelineModal, CreateModal });
14888
14962
  host.registerAddon({
14889
14963
  id: "wb-addon-tasks",
14890
- version: "5.2.45",
14964
+ version: "5.2.47",
14891
14965
  icon: ICONS["list-checks"],
14892
14966
  // 贡献声明写在 registerAddon 里:卸载任务插件时宿主按 addonId 一起撤销,
14893
14967
  // 不会在邮件里留一个渲染即报错的孤儿按钮。
package/lib/index.js CHANGED
@@ -17,6 +17,11 @@ import { registerActivityCalendarAction } from "./stats/activity-calendar.js";
17
17
  import { registerTimelineStatsAction } from "./stats/timeline-stats.js";
18
18
  import { DIFFICULTY_GUIDANCE } from "./task/model/task-difficulty.js";
19
19
  import { bindClock, ensureSchema } from "./db/db.js";
20
+ import { createRequire } from "node:module";
21
+
22
+ // 版本号只认 package.json:首页插件卡读的就是这里注册的 version,
23
+ // 之前手写字面量经常忘记跟着 package.json 一起改,卡片会一直显示旧版本。
24
+ const ADDON_VERSION = createRequire(import.meta.url)("../package.json").version;
20
25
  import { ensureTaskTagSource } from "./tagging/tagging.js";
21
26
  import { exportTasksData, importTasksData } from "./infra/backup.js";
22
27
  import { taskSync } from "./infra/sync.js";
@@ -129,7 +134,7 @@ export function apply(ctx) {
129
134
  id: "wb-addon-tasks",
130
135
  title: "任务",
131
136
  description: "任务树 + 统计/记录/时间线/配置/数据五个视图:紧急/已关闭/已开启/已完成/总览,可按标签筛选(需安装标签插件),附统计报表与只读数据浏览",
132
- version: "5.2.40",
137
+ version: ADDON_VERSION,
133
138
  category: "work",
134
139
  tables: ["task", "task_node", "task_timeline", "task_timeline_link", "task_workspace", "task_workspace_link"],
135
140
  sync: taskSync,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-workbench-tasks",
3
- "version": "5.2.45",
3
+ "version": "5.2.47",
4
4
  "description": "个人工作台任务插件:任务树、优先级、截止日、时间线与重启",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -17,7 +17,7 @@
17
17
  "id": "wb-addon-tasks",
18
18
  "title": "任务",
19
19
  "description": "任务树 + 统计/记录/时间线/工作区/配置/数据/命令/Action 八个视图:紧急/已关闭/已开启/已完成/总览,可按标签筛选,附统计报表与表数据浏览",
20
- "version": "5.2.45",
20
+ "version": "5.2.47",
21
21
  "minShell": "0.8.4",
22
22
  "tables": [
23
23
  "task",
@@ -101,7 +101,7 @@
101
101
  "./package.json": "./package.json"
102
102
  },
103
103
  "dependencies": {
104
- "dsh-workbench-host": "^0.10.2"
104
+ "dsh-workbench-host": "^0.10.6"
105
105
  },
106
106
  "dsh": {
107
107
  "bundle": {