@jiugeqqqqq/dsh-house 0.3.4 → 0.3.6
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 +8 -0
- package/cordis.patch.yml +1 -1
- package/lib/client.js +8 -0
- package/lib/host/index.js +35 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
> 每次发版都必须在这里写一条:改了什么、为什么改、别人要不要跟着动。
|
|
4
4
|
> 版本号跟 `package.json` 走,`npm i` 的人看这里就知道升了什么。
|
|
5
5
|
|
|
6
|
+
## 0.3.5 — 2026-10-29
|
|
7
|
+
|
|
8
|
+
- 页面加「完成」按钮:每条右边一键把条目从「正在长出来的」搬到「已经完工的」,不用再手动改文字(host 加 move 接口,子行一起搬)
|
|
9
|
+
|
|
10
|
+
## 0.3.4 — 2026-10-29
|
|
11
|
+
|
|
12
|
+
- 新增 house_done:把清单里做完的条目从「正在长出来的」自动搬到「已经完工的」(以前只能手改或永远挂着)
|
|
13
|
+
|
|
6
14
|
## 0.3.3 — 2026-10-29
|
|
7
15
|
|
|
8
16
|
- 修版本自检:本地和 npm 同版本时不再显示「可更新」(之前缓存里的旧判断没重算,出现过 v0.3.2 → 0.3.2 可更新)
|
package/cordis.patch.yml
CHANGED
package/lib/client.js
CHANGED
|
@@ -361,6 +361,14 @@ window.__ModuleLoader__.load({
|
|
|
361
361
|
),
|
|
362
362
|
React.createElement(
|
|
363
363
|
'div', { style: styles.rowActions },
|
|
364
|
+
// 做完了 → 一键搬到「已经完工的」(0.3.5)
|
|
365
|
+
g.title === '已经完工的'
|
|
366
|
+
? null
|
|
367
|
+
: React.createElement('button', {
|
|
368
|
+
style: styles.mini,
|
|
369
|
+
title: '做完了,搬到「已经完工的」',
|
|
370
|
+
onClick: function () { run('move', { line: item.line, to: '已经完工的' }); },
|
|
371
|
+
}, '完成'),
|
|
364
372
|
React.createElement('button', {
|
|
365
373
|
style: styles.mini, title: '改这一条',
|
|
366
374
|
onClick: function () { setEditingLine(item.line); setEditText(item.text); setConfirmLine(null); },
|
package/lib/host/index.js
CHANGED
|
@@ -888,6 +888,41 @@ export function apply(ctx, config = {}) {
|
|
|
888
888
|
return;
|
|
889
889
|
}
|
|
890
890
|
|
|
891
|
+
if (method === 'move') {
|
|
892
|
+
const lineNo = Number(body.line);
|
|
893
|
+
const toTitle = String(body.to ?? '已经完工的').trim() || '已经完工的';
|
|
894
|
+
if (!Number.isInteger(lineNo) || lineNo < 1 || lineNo > 100000) {
|
|
895
|
+
writeJson(response, 400, { ok: false, error: { code: 'invalid', message: '行号不对。' } });
|
|
896
|
+
return;
|
|
897
|
+
}
|
|
898
|
+
const result = await mutate((lines) => {
|
|
899
|
+
const idx = lineNo - 1;
|
|
900
|
+
if (idx >= lines.length) return false;
|
|
901
|
+
if (!lines[idx].trim().startsWith('- ')) return false;
|
|
902
|
+
// 条目 + 缩进子行整块搬走,别留孤儿
|
|
903
|
+
const count = blockLength(lines, idx);
|
|
904
|
+
const block = lines.slice(idx, idx + count);
|
|
905
|
+
lines.splice(idx, count);
|
|
906
|
+
let gi = lines.findIndex((l) => l.trim() === '## ' + toTitle);
|
|
907
|
+
if (gi < 0) {
|
|
908
|
+
lines.push('', '## ' + toTitle);
|
|
909
|
+
gi = lines.findIndex((l) => l.trim() === '## ' + toTitle);
|
|
910
|
+
}
|
|
911
|
+
let end = lines.length;
|
|
912
|
+
for (let i = gi + 1; i < lines.length; i += 1) {
|
|
913
|
+
if (/^##\s+/.test(lines[i])) { end = i; break; }
|
|
914
|
+
}
|
|
915
|
+
let insertAt = end;
|
|
916
|
+
for (let i = end - 1; i > gi; i -= 1) {
|
|
917
|
+
if (lines[i].trim()) { insertAt = i + 1; break; }
|
|
918
|
+
}
|
|
919
|
+
lines.splice(insertAt, 0, ...block);
|
|
920
|
+
return true;
|
|
921
|
+
});
|
|
922
|
+
writeJson(response, 200, result);
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
925
|
+
|
|
891
926
|
if (method === 'addGroup') {
|
|
892
927
|
const title = String(body.title ?? '').trim();
|
|
893
928
|
if (!title) {
|