dsh-matrix-todo 1.0.1 → 1.1.1
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/CHANGELOG.md +19 -0
- package/LICENSE +1 -1
- package/README.md +101 -159
- package/client.js +47 -4
- package/cordis.patch.yml +4 -4
- package/icon.svg +7 -7
- package/index.js +123 -122
- package/lib/store.js +511 -469
- package/locale/en.json +5 -5
- package/locale/zh.json +5 -5
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.1
|
|
4
|
+
|
|
5
|
+
- GitHub account rename: the repository moved from
|
|
6
|
+
`Zhang-Eli/dsh-matrix-todo` to `wzvx/dsh-matrix-todo`. Package metadata
|
|
7
|
+
(author/repository/homepage/bugs), README links, LICENSE and the settings
|
|
8
|
+
panel footer ("Developed by wzvx", repo/issues links) now point at the new
|
|
9
|
+
handle. No functional changes.
|
|
10
|
+
|
|
11
|
+
## 1.1.0
|
|
12
|
+
|
|
13
|
+
- First-run guide: when the panel opens on an empty store, the client sends
|
|
14
|
+
seven localized onboarding to-dos (one per interaction: add, drag, edit,
|
|
15
|
+
quadrant split, settings, overdue coloring, date picker). The Host writes
|
|
16
|
+
them once behind a new `seeded` flag, so deleting the guide never brings it
|
|
17
|
+
back; an existing list is treated as already seeded (no duplicates for
|
|
18
|
+
upgrades).
|
|
19
|
+
- New `seed` API action: idempotent, accepts localized titles from the client,
|
|
20
|
+
validates them like any other create, and stamps their own creation order.
|
|
21
|
+
|
|
3
22
|
## 1.0.1
|
|
4
23
|
|
|
5
24
|
- Drop the module-level window guard so the client bundle re-registers after
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,203 +1,145 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img alt="node" src="https://img.shields.io/badge/node-%3E%3D22-3178c6" />
|
|
3
|
+
<img alt="npm" src="https://img.shields.io/npm/v/dsh-matrix-todo?label=dsh-matrix-todo" />
|
|
4
|
+
<img alt="license" src="https://img.shields.io/badge/license-MIT-2ea44f" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
1
7
|
# 四象限待办 · dsh-matrix-todo
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
## 1. 它是什么
|
|
4
10
|
|
|
5
|
-
|
|
6
|
-
- 矩阵视图:立即做 / 计划做 / 委托做 / 别做,四个象限自动撑满面板、各自计数
|
|
7
|
-
- 拖动四象限中心的圆点即可调整行/列比例,双击圆点恢复均分
|
|
8
|
-
- 每个象限都能直接点击空白处或底部「+ 添加」就地新增,可为该条设置截止日期
|
|
9
|
-
- 到期日临期/逾期会在行内变色标识,逾期标题转为警示色
|
|
10
|
-
- 拖动任意待办可在象限内上下排序,或直接拖到另一个象限
|
|
11
|
-
- 双击待办文字即可就地重写标题,回车保存、Esc 取消
|
|
12
|
-
- 完成一项时在**插件面板正中**(不含左侧边栏)弹出随机鼓励浮窗(中英各 8 条,避免连续重复)
|
|
13
|
-
- 顶部一键切换「四象限 ↔ 已完成」,已完成项可恢复或删除,清空需二次确认
|
|
14
|
-
- 齿轮设置:紧急列在左 / 在右、边框风格(卡片 / 田字格 / 十字线)、象限底色(纯色 / 淡彩)、圆角幅度、待办字号、文字显示、日期显示、侧栏名称、恢复默认
|
|
15
|
-
- 设置面板底部有一条链接行:左侧「反馈问题」,右侧是带头像的「*Developed by* Zhang-Eli」(都在系统浏览器中打开)
|
|
16
|
-
- 极简风:界面颜色只用 `--dsw-alias-*` 主题 token(淡彩底色由 token 混出),跟随明暗外观与配色风格
|
|
17
|
-
- 界面文案中英双语,跟随 Harness 语言设置
|
|
11
|
+
DeepSeek Harness 的侧栏四象限待办插件。主界面就是艾森豪威尔矩阵(重要 × 紧急),右上角一键切换「已完成」视图;所有数据只存在你本机的一个 JSON 文件里。
|
|
18
12
|
|
|
19
|
-
|
|
13
|
+
- **不是一条长列表**:待办天然落在「立即做 / 计划做 / 委托做 / 别做」四个象限,拖到别的象限就自动改「重要 / 紧急」标记
|
|
14
|
+
- **到期会提醒**:当天到期加粗警示,逾期整行转红;日期(`11-15`)或倒计时(`7d`、`-3d`)两种显示可切换
|
|
15
|
+
- **首开有引导**:第一次打开且清单为空时,自动写入 7 条本地化引导待办,覆盖四个象限的用法;删掉后不再出现
|
|
16
|
+
- **布局随你调**:紧急列左右、边框风格、象限底色、圆角、字号、行列比例(拖中心圆点,双击复位)
|
|
17
|
+
- **跟随主题**:界面颜色全部取自 Harness 主题 token,明暗外观自动适配
|
|
18
|
+
- **中英双语**:文案跟随 Harness 语言设置
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
## 2. 效果预览
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
dsh plugin --profile desktop add dsh-matrix-todo
|
|
25
|
-
```
|
|
22
|
+
四象限面板(淡彩底色版):
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+

|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
plugin_manager install_bundle target: dsh-matrix-todo
|
|
31
|
-
```
|
|
26
|
+
同一面板(纯净底色版):
|
|
32
27
|
|
|
33
|
-
|
|
28
|
+

|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
| 区域 | 你能做什么 |
|
|
31
|
+
|---|---|
|
|
32
|
+
| 标题行(左上) | 「待办 · 重要 × 紧急」定位说明 |
|
|
33
|
+
| 顶部切换(右上) | 「四象限 ↔ 已完成」两个视图互切,已完成可恢复或删除 |
|
|
34
|
+
| 象限头部 | 象限名、重要/紧急标记、本象限计数 |
|
|
35
|
+
| 待办行 | 勾选完成;双击标题就地编辑;日期固定在最右侧 |
|
|
36
|
+
| 象限空白处 /「+ 添加」 | 就地新增一条属于该象限的待办 |
|
|
37
|
+
| 矩阵中心圆点 | 拖动调整行列比例,双击恢复均分 |
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
## 3. 快速开始
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
### 3.1 前置条件
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
| 项目 | 要求 |
|
|
44
|
+
|---|---|
|
|
45
|
+
| DeepSeek Harness | 桌面版已安装可用 |
|
|
46
|
+
| 运行环境 | Host 自带 Node.js ≥ 22,无需单独安装 |
|
|
47
|
+
| 权限 | 可读写 Harness profile 数据目录 |
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
- 新增项直接使用该象限的重要/紧急标记,不需要先选分类。
|
|
47
|
-
- 新增区右侧的日历按钮打开日期面板:
|
|
48
|
-
- **单击**某天只预览/改选,面板保持打开,可以反复点选;
|
|
49
|
-
- **双击**某天即确定截止日期,面板关闭并**自动把这条待办加入该象限**;
|
|
50
|
-
- 面板里还能切换月份、选「今天」、或「清除」已选日期。
|
|
51
|
-
- 也可以只单击选好日期后按回车提交,效果相同(带上该日期)。
|
|
49
|
+
### 3.2 安装
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
从 npm 安装(推荐):
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
dsh plugin --profile desktop add dsh-matrix-todo
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
或在 Harness 的插件市场里搜索 `dsh-matrix-todo` 点击安装。
|
|
54
58
|
|
|
55
|
-
|
|
56
|
-
- 日期固定在每行最右侧,两种显示方式可在设置里切换:**日期**(如 `11-11`)或**倒计时**(如 `7d`、`0d`、`-3d`)。
|
|
57
|
-
- 点日期本身会打开同一个自绘日历:单击预览、双击确认保存;「清除」可去掉日期。还没设日期的行,悬浮工具条里会出现日历按钮作为入口。
|
|
59
|
+
从源码目录安装(想直接改代码的人):
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
```bash
|
|
62
|
+
git clone https://github.com/wzvx/dsh-matrix-todo.git
|
|
63
|
+
```
|
|
60
64
|
|
|
61
|
-
|
|
62
|
-
- 拖到另一个象限的列表里松手,该条会连同「重要 / 紧急」标记一起移过去,并落在外框高亮的目标象限。
|
|
63
|
-
- 顺序会持久保存;一旦手动排过序,之后新增的待办仍排在该象限最前面。
|
|
65
|
+
然后在 Harness 插件管理工具里:
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
```text
|
|
68
|
+
plugin_manager install_bundle target: <本仓库绝对路径>
|
|
69
|
+
```
|
|
66
70
|
|
|
67
|
-
|
|
71
|
+
安装后**重启 DeepSeek Harness** 生效。
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
| --- | --- | --- |
|
|
71
|
-
| 按期完成(当天或提前完成,或未设日期) | 表扬,「Well done! 按期完成」「漂亮,正好赶上」等 | 成功色对勾 |
|
|
72
|
-
| 逾期完成(完成时截止日期已过) | 勉励,「完成了就好,下次早点开始」「逾期也完成了,值得肯定」等 | 品牌色箭头 |
|
|
73
|
+
### 3.3 首次配置
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
1. 打开侧栏「四象限待办」入口。
|
|
76
|
+
2. 空清单首开自动出现 7 条引导待办,教你拖拽排序、双击编辑、日期面板。
|
|
77
|
+
3. 试一遍:把一条待办拖进别的象限;双击标题改名;点日历按钮设截止日期(单击预览、双击确认)。
|
|
78
|
+
4. 右上角齿轮可调边框、底色、字号、紧急方向;改完即时生效并自动保存。
|
|
75
79
|
|
|
76
|
-
|
|
80
|
+
### 3.4 在新环境还原
|
|
77
81
|
|
|
78
|
-
|
|
79
|
-
- 回车或点击别处保存,Esc 取消;标题去空白后为空(或没有改动)则视为放弃修改。
|
|
82
|
+
全部数据就一个文件:
|
|
80
83
|
|
|
81
|
-
|
|
84
|
+
```text
|
|
85
|
+
%DSH_PROFILE_DIR%\data\dsh-matrix-todo\todos.json
|
|
86
|
+
```
|
|
82
87
|
|
|
83
|
-
|
|
84
|
-
- 行内悬浮(或键盘聚焦)出现小按钮:改「重要」、改「紧急」、设日期、删除;改标记会即时在象限间移动。
|
|
85
|
-
- 「清空已完成」点一次变成「确认清空」,再点一次才真正清除(3 秒后自动退回)。
|
|
88
|
+
把它拷到新环境同一位置,装好插件即全部回来(待办 + 界面设置)。想放别处,在插件配置里覆盖:
|
|
86
89
|
|
|
87
|
-
|
|
90
|
+
```yaml
|
|
91
|
+
- id: matrix-todo
|
|
92
|
+
config:
|
|
93
|
+
dataPath: 'D:\notes\todos.json'
|
|
94
|
+
```
|
|
88
95
|
|
|
89
|
-
|
|
96
|
+
### 3.5 验证
|
|
90
97
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
| 边框风格 | 卡片 / 田字格 / 十字线 | 卡片=四个圆角框;田字格=外框 + 中间十字线;十字线=只有中间十字、无外框;默认十字线 |
|
|
95
|
-
| 象限底色 | 纯色 / 淡彩 | 淡彩用低饱和主题色给四个象限分别铺一层很淡的底色;默认纯色 |
|
|
96
|
-
| 圆角幅度 | 0–24px(步长 2) | 卡片风格作用于每个象限框,田字格/十字线风格作用于外框;默认 10px |
|
|
97
|
-
| 字号 | 11–17px(步长 1) | 待办标题与象限内输入框的字号;默认 14px |
|
|
98
|
-
| 文字显示 | 完整换行 / 单行截断 | 完整换行时内容全部展示;单行截断时超长内容以省略号收尾;默认完整换行 |
|
|
99
|
-
| 侧边栏名称 | 0–24 字 | 自定义左侧入口显示的文字,留空则用默认的「四象限待办」 |
|
|
100
|
-
| 日期显示 | 日期 / 倒计时 | 日期显示 `11-11`;倒计时显示距今天数 `7d`、`0d`、逾期 `-3d`;默认倒计时 |
|
|
101
|
-
| 恢复默认 | 按钮 | 立即回到 紧急在右 / 十字线 / 纯色 / 10px / 14px / 完整换行 / 倒计时 / 均分 |
|
|
98
|
+
- 重启后侧栏出现「四象限待办」;
|
|
99
|
+
- 打开面板能看到四个象限,首开空清单自动出现 7 条引导;
|
|
100
|
+
- 数据文件在上面的路径存在。
|
|
102
101
|
|
|
103
|
-
|
|
102
|
+
## 4. 设计取舍
|
|
104
103
|
|
|
105
|
-
|
|
104
|
+
- **不提供 agent 工具**:Harness 已自带待办工具 `personal_todo`,面板刻意不再暴露第二套待办语义,避免两个真源。
|
|
105
|
+
- **引导只写一次**:删掉引导即视为「已学会」,之后不会再自动回来;想再看见见常见问题。
|
|
106
|
+
- **单文件 + 原子写盘**:数据以「临时文件 + 替换」方式落盘,中途断电不损坏原文件;文件真损坏时先备份为 `todos.corrupt-<时间戳>.json`,再以空清单启动。
|
|
107
|
+
- **装完要重启**:面板在 Harness 启动时挂载,没有热更新。
|
|
108
|
+
- **颜色只用主题 token**:面板不自带配色,深色浅色模式都自动融入。
|
|
109
|
+
- **新条目排最前**:没手动排序前按创建时间倒序派生;一旦拖过,你的顺序就是最终顺序。
|
|
106
110
|
|
|
107
|
-
|
|
111
|
+
## 5. 卸载与回滚
|
|
108
112
|
|
|
109
|
-
|
|
113
|
+
```bash
|
|
114
|
+
dsh plugin --profile desktop remove dsh-matrix-todo
|
|
115
|
+
```
|
|
110
116
|
|
|
111
|
-
|
|
117
|
+
或在插件市场移除,然后重启 Harness。
|
|
112
118
|
|
|
113
|
-
|
|
119
|
+
- 卸载**不会**删除你的待办数据,`todos.json` 仍在数据目录;
|
|
120
|
+
- 想彻底清掉数据:删除 `%DSH_PROFILE_DIR%\data\dsh-matrix-todo\` 目录;
|
|
121
|
+
- 回滚:把备份(`todos.corrupt-<时间戳>.json` 或你自己的拷贝)恢复为 `todos.json` 再启动。
|
|
114
122
|
|
|
115
|
-
|
|
116
|
-
| --- | --- | --- | --- |
|
|
117
|
-
| 最左 | 反馈问题 | `https://github.com/Zhang-Eli/dsh-matrix-todo/issues` | 提 issue、报告 bug |
|
|
118
|
-
| 最右 | *Developed by* + 头像 + Zhang-Eli | `https://github.com/Zhang-Eli` | 顺序为斜体的「Developed by」、16px 圆形 GitHub 头像、用户名;只有用户名是可点击链接,跳转 GitHub |
|
|
123
|
+
## 6. 常见问题
|
|
119
124
|
|
|
120
|
-
|
|
125
|
+
**装完侧栏没有「四象限待办」?**
|
|
126
|
+
重启 DeepSeek Harness,面板在启动时加载。
|
|
121
127
|
|
|
122
|
-
|
|
128
|
+
**怎么让 7 条引导待办再出现?**
|
|
129
|
+
清空全部待办,把 `todos.json` 里的 `seeded` 改成 `false`,重启 Harness 再打开面板。
|
|
123
130
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
"version": 1,
|
|
127
|
-
"todos": [
|
|
128
|
-
{
|
|
129
|
-
"id": "e_m3k2_ab12",
|
|
130
|
-
"title": "交周报",
|
|
131
|
-
"important": true,
|
|
132
|
-
"urgent": false,
|
|
133
|
-
"done": false,
|
|
134
|
-
"dueDate": "2026-11-15",
|
|
135
|
-
"createdAt": "2026-11-09T10:00:00.000Z",
|
|
136
|
-
"updatedAt": "2026-11-09T10:00:00.000Z",
|
|
137
|
-
"completedAt": null
|
|
138
|
-
}
|
|
139
|
-
],
|
|
140
|
-
"settings": {
|
|
141
|
-
"urgentSide": "right",
|
|
142
|
-
"frame": "cross",
|
|
143
|
-
"radius": 10,
|
|
144
|
-
"tint": "plain",
|
|
145
|
-
"fontSize": 14,
|
|
146
|
-
"dueFormat": "countdown",
|
|
147
|
-
"titleStyle": "wrap",
|
|
148
|
-
"colRatio": 0.5,
|
|
149
|
-
"rowRatio": 0.5,
|
|
150
|
-
"navLabel": ""
|
|
151
|
-
},
|
|
152
|
-
"reordered": false
|
|
153
|
-
}
|
|
154
|
-
```
|
|
131
|
+
**待办怎么变红了?**
|
|
132
|
+
截止日期已过。今天到期会加粗警示,逾期日期和标题都转红;设置里可在「日期 / 倒计时」两种显示间切换。
|
|
155
133
|
|
|
156
|
-
|
|
134
|
+
**手改 todos.json 好像没生效?**
|
|
135
|
+
非法值会被忽略并回落默认。请退出 Harness 后再编辑,或改完重启让它重新读取。
|
|
157
136
|
|
|
158
|
-
|
|
137
|
+
**换机器 / 换盘怎么迁移?**
|
|
138
|
+
拷 `todos.json` 到新环境同一位置即可;也可以用 `dataPath` 指定自定义路径(见 3.4)。
|
|
159
139
|
|
|
160
|
-
|
|
140
|
+
**有没有批量操作?**
|
|
141
|
+
没有多选;一次拖拽移动一条。唯一的批量入口是「清空已完成」,需要二次确认。
|
|
161
142
|
|
|
162
|
-
|
|
163
|
-
- id: matrix-todo
|
|
164
|
-
config:
|
|
165
|
-
dataPath: 'D:\notes\todos.json'
|
|
166
|
-
```
|
|
143
|
+
## 7. License
|
|
167
144
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
Host 半在 `/matrix-todo/api` 注册 prefix 路由,只接受 POST,并做同源/回环校验:
|
|
171
|
-
|
|
172
|
-
| 方法 | body | 说明 |
|
|
173
|
-
| --- | --- | --- |
|
|
174
|
-
| `list` | `{}` | 取全部待办与设置 |
|
|
175
|
-
| `create` | `{ title, important, urgent, dueDate? }` | 新建 |
|
|
176
|
-
| `update` | `{ id, title?, important?, urgent?, dueDate? }` | 改字段(含象限标记、截止日期;`dueDate: null` 清除) |
|
|
177
|
-
| `toggle` | `{ id }` | 完成 / 恢复 |
|
|
178
|
-
| `reorder` | `{ id, important?, urgent?, beforeId }` | 拖动结果:移到目标象限并插到 `beforeId` 之前(`null` = 末尾) |
|
|
179
|
-
| `remove` | `{ id }` | 删除 |
|
|
180
|
-
| `clearCompleted` | `{}` | 清空已完成 |
|
|
181
|
-
| `saveSettings` | `{ urgentSide?, frame?, radius?, tint?, fontSize?, dueFormat?, titleStyle?, colRatio?, rowRatio?, navLabel? }` | 合并保存界面设置 |
|
|
182
|
-
|
|
183
|
-
成功返回 `{ ok: true, result: { todos, settings } }`;失败返回 `{ ok: false, error: { code, message } }`,状态码 `invalid-input` 400 / `not-found` 404 / `io-error` 500。标题去空白后 1–200 字符,清单上限 500 条,圆角 0–24 整数,字号 11–17 整数,`dueDate` 必须是真实存在的 `YYYY-MM-DD` 日期。
|
|
184
|
-
|
|
185
|
-
## 文件结构
|
|
186
|
-
|
|
187
|
-
| 文件 | 作用 |
|
|
188
|
-
| --- | --- |
|
|
189
|
-
| `package.json` | 包清单:`dsh.bundle.patch` + `dsh.client`(web、immediately、locale/sidebar 依赖) |
|
|
190
|
-
| `cordis.patch.yml` | 插入插件行 `matrix-todo` |
|
|
191
|
-
| `index.js` | Host 半:注册 HTTP 路由,管理 store 生命周期 |
|
|
192
|
-
| `lib/store.js` | 文件型 store:待办与设置、校验、原子写、备份损坏文件 |
|
|
193
|
-
| `client.js` | Client 半:侧栏入口、矩阵与已完成两个视图、设置面板、全部样式 |
|
|
194
|
-
| `locale/en.json`、`locale/zh.json` | 插件管理器的标题/描述 |
|
|
195
|
-
| `icon.svg` | 插件图标(2×2 矩阵) |
|
|
196
|
-
|
|
197
|
-
## 已知边界
|
|
198
|
-
|
|
199
|
-
- 不提供 agent 工具;待办数据只由面板读写(Harness 已自带 `personal_todo` 工具,避免重复暴露两套语义)。
|
|
200
|
-
- 没有多选与批量操作;一次拖拽只移动一条,删除也只针对单条。
|
|
201
|
-
- 淡彩底色用 CSS `color-mix()` 从主题 token 混出;很旧的 Chromium 不支持时自动回落到单色背景。
|
|
202
|
-
- 侧栏图标与面板的视觉细节无法在无浏览器控制的环境里截图验证;本次通过实时插槽注册、接口契约、存储测试与语法/资源检查验证。
|
|
203
|
-
- 改 `client.js` 由 HMR 自动拾取;改 `index.js` / `lib/store.js`(Host 半)需要重启该插件行或重启 Harness。
|
|
145
|
+
MIT © wzvx,详见 `LICENSE`。
|
package/client.js
CHANGED
|
@@ -47,9 +47,9 @@ window.__ModuleLoader__.load({
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
/** Author links shown at the foot of the settings panel (external, new tab). */
|
|
50
|
-
const AUTHOR_NAME = '
|
|
50
|
+
const AUTHOR_NAME = 'wzvx';
|
|
51
51
|
const AUTHOR_URL = 'https://github.com/' + AUTHOR_NAME;
|
|
52
|
-
const REPO_URL = 'https://github.com/
|
|
52
|
+
const REPO_URL = 'https://github.com/wzvx/dsh-matrix-todo';
|
|
53
53
|
const ISSUES_URL = REPO_URL + '/issues';
|
|
54
54
|
|
|
55
55
|
/** Keep a split ratio inside the range the Host accepts. */
|
|
@@ -83,6 +83,13 @@ window.__ModuleLoader__.load({
|
|
|
83
83
|
'item.due.overdue': 'Overdue',
|
|
84
84
|
'item.drag': 'Drag to reorder or move to another quadrant',
|
|
85
85
|
'item.edit': 'Double-click to edit',
|
|
86
|
+
'seed.add': 'Click an empty spot or "+ Add" to create a to-do',
|
|
87
|
+
'seed.drag': 'Drag a to-do to reorder it or move it to another quadrant',
|
|
88
|
+
'seed.edit': 'Double-click the text to edit it',
|
|
89
|
+
'seed.split': 'Drag the center dot to resize quadrants; double-click resets',
|
|
90
|
+
'seed.settings': 'Use the gear to change border, tint, font size, urgent side',
|
|
91
|
+
'seed.overdue': 'Overdue items turn red',
|
|
92
|
+
'seed.date': 'Date panel: single-click to preview, double-click to confirm',
|
|
86
93
|
'quickAdd.due': 'Due date',
|
|
87
94
|
'toast.praise.1': 'Well done! Right on time.',
|
|
88
95
|
'toast.praise.2': 'Nice — done before the deadline.',
|
|
@@ -167,6 +174,13 @@ window.__ModuleLoader__.load({
|
|
|
167
174
|
'item.due.overdue': '已逾期',
|
|
168
175
|
'item.drag': '拖动可排序,或移到其他象限',
|
|
169
176
|
'item.edit': '双击编辑',
|
|
177
|
+
'seed.add': '点空白处或「+ 添加」新增待办',
|
|
178
|
+
'seed.drag': '拖拽待办可在象限内排序,或移到别的象限',
|
|
179
|
+
'seed.edit': '双击待办文字即可编辑',
|
|
180
|
+
'seed.split': '拖动中心圆点调整象限大小,双击复位',
|
|
181
|
+
'seed.settings': '右上角齿轮可改边框、底色、字号、紧急方向',
|
|
182
|
+
'seed.overdue': '未按期完成的待办会变红',
|
|
183
|
+
'seed.date': '日期面板:单击选择,双击确定',
|
|
170
184
|
'quickAdd.due': '截止日期',
|
|
171
185
|
'toast.praise.1': 'Well done! 按期完成',
|
|
172
186
|
'toast.praise.2': '漂亮,正好赶上',
|
|
@@ -320,6 +334,30 @@ window.__ModuleLoader__.load({
|
|
|
320
334
|
return year === new Date().getFullYear() ? parts[1] + '-' + parts[2] : key;
|
|
321
335
|
}
|
|
322
336
|
|
|
337
|
+
/** Day key `offset` days from today (negative = past). */
|
|
338
|
+
function dayKeyOffset(offset) {
|
|
339
|
+
const date = new Date();
|
|
340
|
+
date.setDate(date.getDate() + offset);
|
|
341
|
+
return dayKeyOf(date);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* First-run guide rows, sent once to the Host with localized titles. They
|
|
346
|
+
* demonstrate all four quadrants, including an overdue row and a date-picker
|
|
347
|
+
* row; the Host flag makes them one-shot, so deleting them sticks.
|
|
348
|
+
*/
|
|
349
|
+
function seedItems(t) {
|
|
350
|
+
return [
|
|
351
|
+
{ title: t('seed.add'), important: true, urgent: true },
|
|
352
|
+
{ title: t('seed.drag'), important: true, urgent: false },
|
|
353
|
+
{ title: t('seed.edit'), important: true, urgent: false },
|
|
354
|
+
{ title: t('seed.split'), important: true, urgent: false },
|
|
355
|
+
{ title: t('seed.settings'), important: false, urgent: true },
|
|
356
|
+
{ title: t('seed.overdue'), important: false, urgent: true, dueDate: dayKeyOffset(-3) },
|
|
357
|
+
{ title: t('seed.date'), important: false, urgent: false, dueDate: dayKeyOffset(30) },
|
|
358
|
+
];
|
|
359
|
+
}
|
|
360
|
+
|
|
323
361
|
/** `overdue` / `today` / `future` for an open todo's due date. */
|
|
324
362
|
function dueStateOf(dueDate) {
|
|
325
363
|
if (typeof dueDate !== 'string' || dueDate === '') return null;
|
|
@@ -1413,14 +1451,19 @@ window.__ModuleLoader__.load({
|
|
|
1413
1451
|
|
|
1414
1452
|
const load = useCallback(async () => {
|
|
1415
1453
|
try {
|
|
1416
|
-
|
|
1454
|
+
let result = await fetchApi('list');
|
|
1455
|
+
// Brand-new store: ask the Host to write the localized guide rows once.
|
|
1456
|
+
if (result.seeded === false && Array.isArray(result.todos) && result.todos.length === 0) {
|
|
1457
|
+
result = await fetchApi('seed', { items: seedItems(t) });
|
|
1458
|
+
}
|
|
1459
|
+
applyResult(result);
|
|
1417
1460
|
} catch (err) {
|
|
1418
1461
|
setError(messageOf(err));
|
|
1419
1462
|
setTodos((current) => (current === null ? [] : current));
|
|
1420
1463
|
} finally {
|
|
1421
1464
|
setLoaded(true);
|
|
1422
1465
|
}
|
|
1423
|
-
}, [applyResult, messageOf]);
|
|
1466
|
+
}, [applyResult, messageOf, t]);
|
|
1424
1467
|
|
|
1425
1468
|
useEffect(() => {
|
|
1426
1469
|
void load();
|
package/cordis.patch.yml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# Eisenhower-matrix to-do list: one sidebar entry, one main panel, and a
|
|
2
|
-
# file-backed store served through /matrix-todo/api.
|
|
3
|
-
- insert:
|
|
4
|
-
- id: matrix-todo
|
|
1
|
+
# Eisenhower-matrix to-do list: one sidebar entry, one main panel, and a
|
|
2
|
+
# file-backed store served through /matrix-todo/api.
|
|
3
|
+
- insert:
|
|
4
|
+
- id: matrix-todo
|
|
5
5
|
name: dsh-matrix-todo
|
package/icon.svg
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Eisenhower to-do">
|
|
2
|
-
<rect x="4" y="4" width="56" height="56" rx="14" fill="#17181c"/>
|
|
3
|
-
<rect x="11" y="11" width="19" height="19" rx="5" fill="#e88989"/>
|
|
4
|
-
<rect x="34" y="11" width="19" height="19" rx="5" fill="#93a3e6"/>
|
|
5
|
-
<rect x="11" y="34" width="19" height="19" rx="5" fill="#d3a866"/>
|
|
6
|
-
<rect x="34" y="34" width="19" height="19" rx="5" fill="#4b4e56"/>
|
|
7
|
-
</svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Eisenhower to-do">
|
|
2
|
+
<rect x="4" y="4" width="56" height="56" rx="14" fill="#17181c"/>
|
|
3
|
+
<rect x="11" y="11" width="19" height="19" rx="5" fill="#e88989"/>
|
|
4
|
+
<rect x="34" y="11" width="19" height="19" rx="5" fill="#93a3e6"/>
|
|
5
|
+
<rect x="11" y="34" width="19" height="19" rx="5" fill="#d3a866"/>
|
|
6
|
+
<rect x="34" y="34" width="19" height="19" rx="5" fill="#4b4e56"/>
|
|
7
|
+
</svg>
|