dsh-plugin-haitang-todo 1.3.22 → 1.3.23
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/client.js +119 -36
- package/index.js +18 -2
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -28,15 +28,14 @@ window.__ModuleLoader__.load({
|
|
|
28
28
|
/** Document-relative base of the Host API (see index.js). */
|
|
29
29
|
const API_BASE = 'api/sidebarTodo';
|
|
30
30
|
/** Bump CLIENT_BUILD whenever client.js changes, so the running page is identifiable. */
|
|
31
|
-
const CLIENT_VERSION = '1.3.
|
|
32
|
-
const CLIENT_BUILD = '2026-11-
|
|
31
|
+
const CLIENT_VERSION = '1.3.39';
|
|
32
|
+
const CLIENT_BUILD = '2026-11-27T10:10';
|
|
33
33
|
/** Debounce before a change is written to this browser and the Host. */
|
|
34
34
|
const SAVE_DELAY = 700;
|
|
35
35
|
|
|
36
36
|
const EN = {
|
|
37
37
|
title: 'Sidebar Todo',
|
|
38
38
|
label: 'Sidebar Todo',
|
|
39
|
-
description: 'The workbench todo page, in the sidebar: period calendar, category lanes, repeat rules and completion ticks.',
|
|
40
39
|
backToChat: 'Back to chat',
|
|
41
40
|
sync: 'Sync workbench',
|
|
42
41
|
syncing: 'Syncing…',
|
|
@@ -50,6 +49,8 @@ window.__ModuleLoader__.load({
|
|
|
50
49
|
autoLayout: 'Auto',
|
|
51
50
|
weekView: 'Week view',
|
|
52
51
|
prev: 'Previous',
|
|
52
|
+
prevMonth: 'Previous month',
|
|
53
|
+
nextMonth: 'Next month',
|
|
53
54
|
next: 'Next',
|
|
54
55
|
reset: 'Today',
|
|
55
56
|
resetMonth: 'This month',
|
|
@@ -97,8 +98,6 @@ window.__ModuleLoader__.load({
|
|
|
97
98
|
saved: 'Saved',
|
|
98
99
|
savingLabel: 'Saving…',
|
|
99
100
|
hostError: 'Writing the local file failed; the changes stay in this browser for now.',
|
|
100
|
-
mergedNotice: 'Newer data from another writer was merged automatically; refresh to see the latest.',
|
|
101
|
-
mergedConflicts: 'conflicts:',
|
|
102
101
|
storageBlocked: 'This browser blocked local storage; changes last only until the page closes.',
|
|
103
102
|
syncOk: 'Imported workbench todos',
|
|
104
103
|
syncNone: 'No workbench todo data found.',
|
|
@@ -179,7 +178,6 @@ window.__ModuleLoader__.load({
|
|
|
179
178
|
const ZH = {
|
|
180
179
|
title: '侧栏待办',
|
|
181
180
|
label: '侧栏待办',
|
|
182
|
-
description: '工作台待办事项的侧栏版:周期日历清单、象限视图、重复规则与完成打勾,数据可自动保存并从工作台同步。',
|
|
183
181
|
backToChat: '回到对话',
|
|
184
182
|
sync: '同步工作台',
|
|
185
183
|
syncing: '同步中…',
|
|
@@ -193,6 +191,8 @@ window.__ModuleLoader__.load({
|
|
|
193
191
|
autoLayout: '自适应',
|
|
194
192
|
weekView: '返回周视图',
|
|
195
193
|
prev: '上一周',
|
|
194
|
+
prevMonth: '上一月',
|
|
195
|
+
nextMonth: '下一月',
|
|
196
196
|
next: '下一周',
|
|
197
197
|
reset: '回到今天',
|
|
198
198
|
resetMonth: '回到本月',
|
|
@@ -240,8 +240,6 @@ window.__ModuleLoader__.load({
|
|
|
240
240
|
saved: '已保存',
|
|
241
241
|
savingLabel: '保存中…',
|
|
242
242
|
hostError: '本地文件写入失败,内容暂时只保存在浏览器里。',
|
|
243
|
-
mergedNotice: '已自动合并其他入口写入的新数据,刷新面板后可看到最新内容',
|
|
244
|
-
mergedConflicts: '冲突条目',
|
|
245
243
|
storageBlocked: '浏览器拒绝了本地存储,内容只在关闭页面之前有效。',
|
|
246
244
|
syncOk: '已导入工作台待办',
|
|
247
245
|
syncNone: '没找到工作台待办数据。',
|
|
@@ -361,10 +359,10 @@ window.__ModuleLoader__.load({
|
|
|
361
359
|
'.dsh-todo-day{border-right:1px solid var(--dsw-alias-border-l1);min-height:270px;cursor:pointer;display:flex;flex-direction:column}',
|
|
362
360
|
'.dsh-todo-day:last-child{border-right:0}',
|
|
363
361
|
'.dsh-todo-day--today{background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-state-success-primary);border-radius:6px}',
|
|
364
|
-
'.dsh-todo-day-head{padding:9px 9px;border-bottom:1px solid var(--dsw-alias-border-l1);font-size:11px;',
|
|
362
|
+
'.dsh-todo-day-head{display:flex;align-items:flex-start;gap:5px;padding:9px 9px;border-bottom:1px solid var(--dsw-alias-border-l1);font-size:11px;',
|
|
365
363
|
'color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-2)}',
|
|
366
364
|
'.dsh-todo-day--today .dsh-todo-day-head{color:var(--dsw-alias-brand-primary)}',
|
|
367
|
-
'.dsh-todo-day-head b{display:
|
|
365
|
+
'.dsh-todo-day-head b{display:inline;font-size:17px;color:var(--dsw-alias-label-primary)}',
|
|
368
366
|
'.dsh-todo-day--today .dsh-todo-day-head b{color:var(--dsw-alias-brand-primary)}',
|
|
369
367
|
'.dsh-todo-task-list{flex:1 1 auto;padding:8px;display:flex;flex-direction:column;gap:7px;min-height:0;cursor:pointer}',
|
|
370
368
|
'.dsh-todo-task{border:1px solid var(--dsw-alias-border-l1);border-left:3px solid var(--dsw-alias-brand-primary);',
|
|
@@ -376,7 +374,9 @@ window.__ModuleLoader__.load({
|
|
|
376
374
|
'.dsh-todo-period-panel{display:flex;flex-direction:column;flex:0 0 auto;min-height:0;overflow:visible}',
|
|
377
375
|
'.dsh-todo-period-body{flex:1 1 auto;min-height:0;overflow:visible}',
|
|
378
376
|
'.dsh-todo-weeks{display:flex;flex-direction:column;min-height:0;gap:13px}',
|
|
379
|
-
'.dsh-todo-weeks .dsh-todo-week{flex:0 0 auto;display:flex;flex-direction:
|
|
377
|
+
'.dsh-todo-weeks .dsh-todo-week{flex:0 0 auto;display:flex;flex-direction:row;min-height:140px}',
|
|
378
|
+
'.dsh-todo-week-main{flex:1 1 auto;min-width:0;display:flex;flex-direction:column}',
|
|
379
|
+
'.dsh-todo-week>.dsh-todo-weeknum{flex:0 0 28px;width:28px;min-height:0!important}',
|
|
380
380
|
'.dsh-todo-weeks .dsh-todo-days{flex:0 0 auto;min-height:0;overflow:visible}',
|
|
381
381
|
'.dsh-todo-period-panel .dsh-todo-day{min-height:0;overflow:visible;box-sizing:border-box}',
|
|
382
382
|
'.dsh-todo-period-panel .dsh-todo-month{display:flex;flex-direction:column;min-height:0;overflow:visible;box-sizing:border-box}',
|
|
@@ -422,13 +422,18 @@ window.__ModuleLoader__.load({
|
|
|
422
422
|
'.dsh-todo-note{padding:10px 16px 14px;margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary)}',
|
|
423
423
|
'.dsh-todo-month{padding:0 12px 14px}',
|
|
424
424
|
'.dsh-todo-month-title{padding:10px 4px;font-size:14px;font-weight:700;color:var(--dsw-alias-label-secondary)}',
|
|
425
|
-
'.dsh-todo-month-grid{display:grid;grid-template-columns:repeat(7,minmax(88px,1fr));min-width:
|
|
425
|
+
'.dsh-todo-month-grid{display:grid;grid-template-columns:28px repeat(7,minmax(88px,1fr));min-width:668px;',
|
|
426
426
|
'border-top:1px solid var(--dsw-alias-border-l1);border-left:1px solid var(--dsw-alias-border-l1)}',
|
|
427
427
|
'.dsh-todo-month-grid>div{min-height:84px;padding:6px;border-right:1px solid var(--dsw-alias-border-l1);',
|
|
428
428
|
'border-bottom:1px solid var(--dsw-alias-border-l1)}',
|
|
429
|
+
'.dsh-todo-month-weeknum{min-height:84px!important;display:flex;align-items:center;justify-content:center;',
|
|
430
|
+
'padding-top:0;text-align:center;box-sizing:border-box;font-size:10px;font-weight:600;color:var(--dsw-alias-label-secondary);',
|
|
431
|
+
'background:var(--dsw-alias-bg-layer-2);border-right:1px solid var(--dsw-alias-border-l1);border-bottom:1px solid var(--dsw-alias-border-l1)}',
|
|
429
432
|
'.dsh-todo-month-weekday{min-height:0!important;text-align:center;font-size:11px;font-weight:700;',
|
|
430
433
|
'background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary)}',
|
|
431
|
-
'.dsh-todo-month-
|
|
434
|
+
'.dsh-todo-month-head{align-items:flex-start}',
|
|
435
|
+
'.dsh-todo-month-head .dsh-todo-month-head-title{margin:0;font-size:15px;line-height:24px}',
|
|
436
|
+
'.dsh-todo-month-cell--today{background:var(--dsw-alias-bg-layer-2);border-radius:6px;outline:1px solid var(--dsw-alias-state-success-primary);outline-offset:-1px;position:relative;z-index:2}',
|
|
432
437
|
'.dsh-todo-month-task{display:flex;align-items:center;gap:4px;margin-top:5px;padding:2px 4px;border-left:2px solid var(--dsw-alias-brand-primary);',
|
|
433
438
|
'border-radius:4px;background:var(--dsw-alias-bg-layer-2);font-size:10px;cursor:pointer}',
|
|
434
439
|
'.dsh-todo-month-task-text{flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
|
|
@@ -812,7 +817,15 @@ window.__ModuleLoader__.load({
|
|
|
812
817
|
if (!record.id) record.id = 1;
|
|
813
818
|
}
|
|
814
819
|
}
|
|
815
|
-
|
|
820
|
+
let ui = null;
|
|
821
|
+
if (raw.ui && typeof raw.ui === 'object') {
|
|
822
|
+
const tab = raw.ui.tab === 'category' ? 'category' : raw.ui.tab === 'period' ? 'period' : '';
|
|
823
|
+
const periodMode = raw.ui.periodMode === 'month' ? 'month' : raw.ui.periodMode === 'week' ? 'week' : '';
|
|
824
|
+
if (tab || periodMode) ui = { tab: tab || 'period', periodMode: periodMode || 'week' };
|
|
825
|
+
}
|
|
826
|
+
const normalized = { tasks, projects, importedAt: typeof raw.importedAt === 'string' ? raw.importedAt : '' };
|
|
827
|
+
if (ui) normalized.ui = ui;
|
|
828
|
+
return normalized;
|
|
816
829
|
}
|
|
817
830
|
|
|
818
831
|
function readLocalDocument() {
|
|
@@ -1040,7 +1053,6 @@ window.__ModuleLoader__.load({
|
|
|
1040
1053
|
storageBlocked: false,
|
|
1041
1054
|
syncing: false,
|
|
1042
1055
|
baseRev: '',
|
|
1043
|
-
mergeNotice: '',
|
|
1044
1056
|
nextTaskId: 1,
|
|
1045
1057
|
nextProjectId: 1,
|
|
1046
1058
|
nextRecordId: 1,
|
|
@@ -1064,7 +1076,14 @@ window.__ModuleLoader__.load({
|
|
|
1064
1076
|
};
|
|
1065
1077
|
|
|
1066
1078
|
// ----- persistence ---------------------------------------------------
|
|
1067
|
-
const documentOf = () => ({
|
|
1079
|
+
const documentOf = () => ({
|
|
1080
|
+
version: 1,
|
|
1081
|
+
tasks: model.tasks,
|
|
1082
|
+
projects: model.projects,
|
|
1083
|
+
importedAt: model.importedAt || '',
|
|
1084
|
+
ui: { tab: model.mainView === 'category' ? 'category' : 'period', periodMode: model.showMonth ? 'month' : 'week' },
|
|
1085
|
+
updatedAt: new Date().toISOString(),
|
|
1086
|
+
});
|
|
1068
1087
|
|
|
1069
1088
|
model.recount = () => {
|
|
1070
1089
|
let maxTask = 0;
|
|
@@ -1094,10 +1113,14 @@ window.__ModuleLoader__.load({
|
|
|
1094
1113
|
if (data && typeof data.version === 'string') model.hostVersion = data.version;
|
|
1095
1114
|
if (data && data.merged) {
|
|
1096
1115
|
const conflicts = Array.isArray(data.conflicts) ? data.conflicts : [];
|
|
1097
|
-
|
|
1116
|
+
// Merge logic stays; the notice is no longer surfaced in the UI.
|
|
1117
|
+
try {
|
|
1118
|
+
console.debug('[sidebar-todo] merged from another writer', conflicts);
|
|
1119
|
+
} catch (error) {
|
|
1120
|
+
/* console may be unavailable */
|
|
1121
|
+
}
|
|
1098
1122
|
const normalized = data.document ? normalizeDocument(data.document) : null;
|
|
1099
1123
|
if (normalized) model.adopt(normalized);
|
|
1100
|
-
model.showToast(model.mergeNotice);
|
|
1101
1124
|
}
|
|
1102
1125
|
model.bump();
|
|
1103
1126
|
})
|
|
@@ -1135,6 +1158,16 @@ window.__ModuleLoader__.load({
|
|
|
1135
1158
|
model.tasks = document.tasks;
|
|
1136
1159
|
model.projects = document.projects;
|
|
1137
1160
|
model.importedAt = document.importedAt || '';
|
|
1161
|
+
if (document.ui && typeof document.ui === 'object') {
|
|
1162
|
+
model.mainView = document.ui.tab === 'category' ? 'category' : 'period';
|
|
1163
|
+
model.showMonth = document.ui.periodMode === 'month';
|
|
1164
|
+
model.manualView = true;
|
|
1165
|
+
} else {
|
|
1166
|
+
// Old documents without ui preferences: fall back to period view + week view.
|
|
1167
|
+
model.mainView = 'period';
|
|
1168
|
+
model.showMonth = false;
|
|
1169
|
+
model.manualView = true;
|
|
1170
|
+
}
|
|
1138
1171
|
model.recount();
|
|
1139
1172
|
model.bump();
|
|
1140
1173
|
};
|
|
@@ -1398,7 +1431,7 @@ window.__ModuleLoader__.load({
|
|
|
1398
1431
|
|
|
1399
1432
|
model.currentWeekNumber = () => weekNumber(monday());
|
|
1400
1433
|
model.monthViewDate = () => new Date(today().getFullYear(), today().getMonth() + model.monthOffset, 1);
|
|
1401
|
-
model.monthTitle = () => model.monthViewDate().getFullYear() + '年' + (model.monthViewDate().getMonth() + 1) + '月
|
|
1434
|
+
model.monthTitle = () => model.monthViewDate().getFullYear() + '年' + (model.monthViewDate().getMonth() + 1) + '月';
|
|
1402
1435
|
|
|
1403
1436
|
model.monthCells = () => {
|
|
1404
1437
|
const first = model.monthViewDate();
|
|
@@ -1436,6 +1469,7 @@ window.__ModuleLoader__.load({
|
|
|
1436
1469
|
model.manualView = false;
|
|
1437
1470
|
model.updateViewport();
|
|
1438
1471
|
model.bump();
|
|
1472
|
+
model.schedulePersist();
|
|
1439
1473
|
};
|
|
1440
1474
|
|
|
1441
1475
|
// ----- create / edit tasks ------------------------------------------
|
|
@@ -2761,8 +2795,8 @@ window.__ModuleLoader__.load({
|
|
|
2761
2795
|
model.openEditor(day);
|
|
2762
2796
|
},
|
|
2763
2797
|
},
|
|
2764
|
-
day.weekday + ' ',
|
|
2765
2798
|
h('b', null, String(day.date.getDate())),
|
|
2799
|
+
h('span', null, day.weekday),
|
|
2766
2800
|
),
|
|
2767
2801
|
h(
|
|
2768
2802
|
'div',
|
|
@@ -2845,6 +2879,7 @@ window.__ModuleLoader__.load({
|
|
|
2845
2879
|
model.manualView = true;
|
|
2846
2880
|
model.showMonth = !model.showMonth;
|
|
2847
2881
|
model.bump();
|
|
2882
|
+
model.schedulePersist();
|
|
2848
2883
|
},
|
|
2849
2884
|
},
|
|
2850
2885
|
model.showMonth ? tr('weekView') : tr('monthView'),
|
|
@@ -2868,7 +2903,7 @@ window.__ModuleLoader__.load({
|
|
|
2868
2903
|
className: 'dsh-todo-action',
|
|
2869
2904
|
onClick: () => (model.showMonth ? model.shiftMonth(-1) : model.shiftWeek(-1)),
|
|
2870
2905
|
},
|
|
2871
|
-
tr('prev'),
|
|
2906
|
+
model.showMonth ? tr('prevMonth') : tr('prev'),
|
|
2872
2907
|
),
|
|
2873
2908
|
h(
|
|
2874
2909
|
'button',
|
|
@@ -2878,7 +2913,7 @@ window.__ModuleLoader__.load({
|
|
|
2878
2913
|
className: 'dsh-todo-action',
|
|
2879
2914
|
onClick: () => (model.showMonth ? model.shiftMonth(1) : model.shiftWeek(1)),
|
|
2880
2915
|
},
|
|
2881
|
-
tr('next'),
|
|
2916
|
+
model.showMonth ? tr('nextMonth') : tr('next'),
|
|
2882
2917
|
),
|
|
2883
2918
|
h(
|
|
2884
2919
|
'button',
|
|
@@ -2916,21 +2951,44 @@ window.__ModuleLoader__.load({
|
|
|
2916
2951
|
return name;
|
|
2917
2952
|
};
|
|
2918
2953
|
|
|
2954
|
+
const monthWeekNumbers = (() => {
|
|
2955
|
+
const cells = model.monthCells();
|
|
2956
|
+
const numbers = {};
|
|
2957
|
+
for (let start = 0; start < cells.length; start += 7) {
|
|
2958
|
+
const first = cells.slice(start, start + 7).find(Boolean);
|
|
2959
|
+
numbers[start] = first ? String(weekNumber(first)) : '';
|
|
2960
|
+
}
|
|
2961
|
+
return numbers;
|
|
2962
|
+
})();
|
|
2963
|
+
|
|
2919
2964
|
const monthView = h(
|
|
2920
2965
|
'div',
|
|
2921
2966
|
{ className: 'dsh-todo-month' },
|
|
2922
|
-
h('div', { className: 'dsh-todo-month-title' }, model.monthTitle()),
|
|
2923
2967
|
h(
|
|
2924
2968
|
'div',
|
|
2925
2969
|
{ className: 'dsh-todo-month-grid', style: { gridTemplateRows: 'auto', gridAutoRows: 'minmax(84px, auto)', height: 'auto', overflow: 'visible' } },
|
|
2970
|
+
h('div', { key: 'corner', className: 'dsh-todo-month-weekday' }),
|
|
2926
2971
|
WEEKDAYS.map((name) => h('div', { key: name, className: 'dsh-todo-month-weekday' }, name)),
|
|
2927
2972
|
model.monthCells().map((cell, index) => {
|
|
2928
|
-
|
|
2973
|
+
const rowItems = [];
|
|
2974
|
+
if (index % 7 === 0) {
|
|
2975
|
+
rowItems.push(
|
|
2976
|
+
h(
|
|
2977
|
+
'div',
|
|
2978
|
+
{ key: 'week-' + index, className: 'dsh-todo-month-weeknum', title: tr('weekNumber') + (monthWeekNumbers[index] || '') },
|
|
2979
|
+
monthWeekNumbers[index] || '',
|
|
2980
|
+
),
|
|
2981
|
+
);
|
|
2982
|
+
}
|
|
2983
|
+
if (!cell) {
|
|
2984
|
+
rowItems.push(h('div', { key: index }));
|
|
2985
|
+
return rowItems;
|
|
2986
|
+
}
|
|
2929
2987
|
const cellKey = keyOf(cell);
|
|
2930
2988
|
const editorOpen = model.editorDay === cellKey;
|
|
2931
2989
|
let cellClass = model.isToday(cell) ? 'dsh-todo-month-cell--today' : '';
|
|
2932
2990
|
if (model.dragOverKey === cellKey) cellClass += ' dsh-todo-month-cell--drop';
|
|
2933
|
-
|
|
2991
|
+
const cellNode = h(
|
|
2934
2992
|
'div',
|
|
2935
2993
|
{
|
|
2936
2994
|
key: index,
|
|
@@ -3056,6 +3114,8 @@ window.__ModuleLoader__.load({
|
|
|
3056
3114
|
editorOpen ? renderTodoEditor(monthDay(cell)) : null,
|
|
3057
3115
|
),
|
|
3058
3116
|
);
|
|
3117
|
+
rowItems.push(cellNode);
|
|
3118
|
+
return rowItems;
|
|
3059
3119
|
}),
|
|
3060
3120
|
),
|
|
3061
3121
|
);
|
|
@@ -3067,21 +3127,45 @@ window.__ModuleLoader__.load({
|
|
|
3067
3127
|
h(
|
|
3068
3128
|
'div',
|
|
3069
3129
|
{ key: row.title, className: 'dsh-todo-week' },
|
|
3070
|
-
h(
|
|
3071
|
-
|
|
3130
|
+
h(
|
|
3131
|
+
'div',
|
|
3132
|
+
{
|
|
3133
|
+
className: 'dsh-todo-month-weeknum dsh-todo-weeknum',
|
|
3134
|
+
title: tr('weekNumber') + String(weekNumber(row.days[0].date)),
|
|
3135
|
+
},
|
|
3136
|
+
String(weekNumber(row.days[0].date)),
|
|
3137
|
+
),
|
|
3138
|
+
h(
|
|
3139
|
+
'div',
|
|
3140
|
+
{ className: 'dsh-todo-week-main' },
|
|
3141
|
+
h('div', { className: 'dsh-todo-days' }, row.days.map(renderDay)),
|
|
3142
|
+
),
|
|
3072
3143
|
),
|
|
3073
3144
|
),
|
|
3074
3145
|
);
|
|
3075
3146
|
|
|
3147
|
+
const weekMonthTitle = (() => {
|
|
3148
|
+
const rows = model.weekRows();
|
|
3149
|
+
const first = rows[0] && rows[0].days[0];
|
|
3150
|
+
return first ? first.date.getFullYear() + '年' + (first.date.getMonth() + 1) + '月' : '';
|
|
3151
|
+
})();
|
|
3152
|
+
|
|
3076
3153
|
const periodSection = h(
|
|
3077
3154
|
'section',
|
|
3078
3155
|
{ className: 'dsh-todo-panel dsh-todo-period-panel', ref: periodRef, style: { height: 'auto', maxHeight: 'none', flex: '0 0 auto', overflow: 'visible' } },
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3156
|
+
model.showMonth
|
|
3157
|
+
? h(
|
|
3158
|
+
'div',
|
|
3159
|
+
{ className: 'dsh-todo-section-head dsh-todo-month-head' },
|
|
3160
|
+
h('h2', { className: 'dsh-todo-month-head-title' }, model.monthTitle()),
|
|
3161
|
+
h('div', { className: 'dsh-todo-actions' }, periodActions),
|
|
3162
|
+
)
|
|
3163
|
+
: h(
|
|
3164
|
+
'div',
|
|
3165
|
+
{ className: 'dsh-todo-section-head' },
|
|
3166
|
+
h('div', null, h('h2', null, weekMonthTitle)),
|
|
3167
|
+
h('div', { className: 'dsh-todo-actions' }, periodActions),
|
|
3168
|
+
),
|
|
3085
3169
|
h('div', { className: 'dsh-todo-period-body' }, model.showMonth ? monthView : weeksView),
|
|
3086
3170
|
);
|
|
3087
3171
|
|
|
@@ -3848,7 +3932,6 @@ window.__ModuleLoader__.load({
|
|
|
3848
3932
|
'div',
|
|
3849
3933
|
null,
|
|
3850
3934
|
h('h1', { className: 'dsh-todo-title' }, tr('title')),
|
|
3851
|
-
h('p', { className: 'dsh-todo-desc' }, tr('description')),
|
|
3852
3935
|
),
|
|
3853
3936
|
),
|
|
3854
3937
|
h(
|
|
@@ -3867,7 +3950,6 @@ window.__ModuleLoader__.load({
|
|
|
3867
3950
|
h(
|
|
3868
3951
|
'div',
|
|
3869
3952
|
{ className: 'dsh-todo-toolbar' },
|
|
3870
|
-
h('strong', null, model.weekLabel()),
|
|
3871
3953
|
h(
|
|
3872
3954
|
'div',
|
|
3873
3955
|
{ className: 'dsh-todo-segmented' },
|
|
@@ -3879,6 +3961,7 @@ window.__ModuleLoader__.load({
|
|
|
3879
3961
|
onClick: () => {
|
|
3880
3962
|
model.mainView = 'period';
|
|
3881
3963
|
model.bump();
|
|
3964
|
+
model.schedulePersist();
|
|
3882
3965
|
},
|
|
3883
3966
|
},
|
|
3884
3967
|
tr('periodView'),
|
|
@@ -3891,6 +3974,7 @@ window.__ModuleLoader__.load({
|
|
|
3891
3974
|
onClick: () => {
|
|
3892
3975
|
model.mainView = 'category';
|
|
3893
3976
|
model.bump();
|
|
3977
|
+
model.schedulePersist();
|
|
3894
3978
|
},
|
|
3895
3979
|
},
|
|
3896
3980
|
tr('categoryView'),
|
|
@@ -3900,7 +3984,6 @@ window.__ModuleLoader__.load({
|
|
|
3900
3984
|
),
|
|
3901
3985
|
model.mainView === 'period' ? periodSection : categorySection,
|
|
3902
3986
|
model.storageBlocked ? h('p', { className: 'dsh-todo-warn' }, tr('storageBlocked')) : null,
|
|
3903
|
-
model.mergeNotice ? h('p', { className: 'dsh-todo-warn' }, model.mergeNotice) : null,
|
|
3904
3987
|
model.meetingNotice ? h('p', { className: 'dsh-todo-muted' }, model.meetingNotice) : null,
|
|
3905
3988
|
model.hostError ? h('p', { className: 'dsh-todo-warn' }, tr('hostError')) : null,
|
|
3906
3989
|
),
|
package/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import os from 'node:os'
|
|
|
19
19
|
import path from 'node:path'
|
|
20
20
|
import { createHash } from 'node:crypto'
|
|
21
21
|
|
|
22
|
-
const PLUGIN_VERSION = '1.5.
|
|
22
|
+
const PLUGIN_VERSION = '1.5.8'
|
|
23
23
|
/** Absolute registration paths of the panel API; each carries one operation. */
|
|
24
24
|
const API_BASE = '/api/sidebarTodo'
|
|
25
25
|
/** Panel document version, bumped when the todo shape changes. */
|
|
@@ -138,6 +138,15 @@ function sortProblemRecordsNewestFirst(list) {
|
|
|
138
138
|
})
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
/** Non-destructive UI preferences (last used view). Kept exactly as {tab, periodMode}. */
|
|
142
|
+
function normalizeUi(value) {
|
|
143
|
+
if (!isPlainObject(value)) return null
|
|
144
|
+
const tab = value.tab === 'category' ? 'category' : value.tab === 'period' ? 'period' : ''
|
|
145
|
+
const periodMode = value.periodMode === 'month' ? 'month' : value.periodMode === 'week' ? 'week' : ''
|
|
146
|
+
if (!tab && !periodMode) return null
|
|
147
|
+
return { tab: tab || 'period', periodMode: periodMode || 'week' }
|
|
148
|
+
}
|
|
149
|
+
|
|
141
150
|
function normalizeDocument(value) {
|
|
142
151
|
if (!isPlainObject(value)) return null
|
|
143
152
|
if (!Array.isArray(value.tasks)) return null
|
|
@@ -148,13 +157,16 @@ function normalizeDocument(value) {
|
|
|
148
157
|
if (Array.isArray(records)) project.records.problem = sortProblemRecordsNewestFirst(records)
|
|
149
158
|
}
|
|
150
159
|
const importedAt = typeof value.importedAt === 'string' ? value.importedAt : ''
|
|
151
|
-
|
|
160
|
+
const ui = normalizeUi(value.ui)
|
|
161
|
+
const document = {
|
|
152
162
|
version: DOCUMENT_VERSION,
|
|
153
163
|
tasks,
|
|
154
164
|
projects,
|
|
155
165
|
importedAt,
|
|
156
166
|
updatedAt: Date.now(),
|
|
157
167
|
}
|
|
168
|
+
if (ui) document.ui = ui
|
|
169
|
+
return document
|
|
158
170
|
}
|
|
159
171
|
|
|
160
172
|
let cachedDirectory = null
|
|
@@ -1179,6 +1191,10 @@ const handlers = {
|
|
|
1179
1191
|
conflicts = result.conflicts
|
|
1180
1192
|
mergedFlag = true
|
|
1181
1193
|
}
|
|
1194
|
+
// UI preference: the panel's value wins; keep the stored one when the panel sent none.
|
|
1195
|
+
const ui = normalizeUi(incoming.ui) || normalizeUi(disk.ui)
|
|
1196
|
+
if (ui) merged.ui = ui
|
|
1197
|
+
else delete merged.ui
|
|
1182
1198
|
const serialized = JSON.stringify(merged, null, 2)
|
|
1183
1199
|
if (serialized.length > MAX_DOCUMENT_BYTES) return fail(413, '待办文档过大,已拒绝保存')
|
|
1184
1200
|
const backup = await backupStateFile(directory)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-haitang-todo",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Haitang Todo: a todo panel in the DeepSeek Harness Web UI sidebar with tasks, projects problem logs, monthly goals and a week (period) view.",
|
|
6
6
|
"license": "MIT",
|