dsh-matrix-todo 1.0.0 → 1.0.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 +6 -0
- package/client.js +1926 -1935
- package/package.json +2 -2
package/client.js
CHANGED
|
@@ -11,2064 +11,2055 @@
|
|
|
11
11
|
* Styling only uses `--dsw-alias-*` theme tokens, so light and dark appearance
|
|
12
12
|
* (and any palette layer another plugin stacks) apply without extra work.
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
14
|
+
window.__ModuleLoader__.load({
|
|
15
|
+
id: 'dsh-matrix-todo',
|
|
16
|
+
factory(require) {
|
|
17
|
+
const React = require('react');
|
|
18
|
+
const h = React.createElement;
|
|
19
|
+
const useState = React.useState;
|
|
20
|
+
const useEffect = React.useEffect;
|
|
21
|
+
const useMemo = React.useMemo;
|
|
22
|
+
const useCallback = React.useCallback;
|
|
23
|
+
const useRef = React.useRef;
|
|
24
|
+
const useSyncExternalStore = React.useSyncExternalStore;
|
|
25
|
+
|
|
26
|
+
/** Dictionary namespace owned by this plugin. */
|
|
27
|
+
const NS = 'matrixTodo';
|
|
28
|
+
/** Shared by the sidebar row and the main panel it selects. */
|
|
29
|
+
const PANEL_ID = 'matrix-todo';
|
|
30
|
+
/** Host API route prefix. */
|
|
31
|
+
const API_PREFIX = 'matrix-todo/api/';
|
|
32
|
+
/** Sidebar order: right after the shipped "todo" entry (order 20). */
|
|
33
|
+
const ORDER = 21;
|
|
34
|
+
|
|
35
|
+
/** Layout preferences, mirrored from the Host defaults. */
|
|
36
|
+
const DEFAULT_SETTINGS = {
|
|
37
|
+
urgentSide: 'right',
|
|
38
|
+
frame: 'cross',
|
|
39
|
+
radius: 10,
|
|
40
|
+
tint: 'plain',
|
|
41
|
+
fontSize: 14,
|
|
42
|
+
dueFormat: 'countdown',
|
|
43
|
+
titleStyle: 'wrap',
|
|
44
|
+
colRatio: 0.5,
|
|
45
|
+
rowRatio: 0.5,
|
|
46
|
+
navLabel: '',
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** Author links shown at the foot of the settings panel (external, new tab). */
|
|
50
|
+
const AUTHOR_NAME = 'Zhang-Eli';
|
|
51
|
+
const AUTHOR_URL = 'https://github.com/' + AUTHOR_NAME;
|
|
52
|
+
const REPO_URL = 'https://github.com/Zhang-Eli/dsh-matrix-todo';
|
|
53
|
+
const ISSUES_URL = REPO_URL + '/issues';
|
|
54
|
+
|
|
55
|
+
/** Keep a split ratio inside the range the Host accepts. */
|
|
56
|
+
function clampRatio(value) {
|
|
57
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) return 0.5;
|
|
58
|
+
return Math.min(0.8, Math.max(0.2, Math.round(value * 1000) / 1000));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** English dictionary. */
|
|
62
|
+
const EN = {
|
|
63
|
+
'nav.label': 'Todo matrix',
|
|
64
|
+
'page.title': 'To-do',
|
|
65
|
+
'page.subtitle': 'Important × Urgent',
|
|
66
|
+
'view.matrix': 'Matrix',
|
|
67
|
+
'view.completed': 'Done',
|
|
68
|
+
'flag.important': 'Important',
|
|
69
|
+
'flag.urgent': 'Urgent',
|
|
70
|
+
'quadrant.q1': 'Do now',
|
|
71
|
+
'quadrant.q1.hint': 'Important · Urgent',
|
|
72
|
+
'quadrant.q2': 'Schedule',
|
|
73
|
+
'quadrant.q2.hint': 'Important · Not urgent',
|
|
74
|
+
'quadrant.q3': 'Delegate',
|
|
75
|
+
'quadrant.q3.hint': 'Not important · Urgent',
|
|
76
|
+
'quadrant.q4': 'Eliminate',
|
|
77
|
+
'quadrant.q4.hint': 'Not important · Not urgent',
|
|
78
|
+
'item.complete': 'Mark as done',
|
|
79
|
+
'item.restore': 'Restore',
|
|
80
|
+
'item.delete': 'Delete',
|
|
81
|
+
'item.due.set': 'Set due date',
|
|
82
|
+
'item.due.today': 'Due today',
|
|
83
|
+
'item.due.overdue': 'Overdue',
|
|
84
|
+
'item.drag': 'Drag to reorder or move to another quadrant',
|
|
85
|
+
'item.edit': 'Double-click to edit',
|
|
86
|
+
'quickAdd.due': 'Due date',
|
|
87
|
+
'toast.praise.1': 'Well done! Right on time.',
|
|
88
|
+
'toast.praise.2': 'Nice — done before the deadline.',
|
|
89
|
+
'toast.praise.3': 'On schedule. Great rhythm.',
|
|
90
|
+
'toast.praise.4': 'Delivered on time.',
|
|
91
|
+
'toast.praise.5': 'Well done! Plan kept.',
|
|
92
|
+
'toast.praise.6': 'Right on time — nice work.',
|
|
93
|
+
'toast.praise.7': 'On track and done. Keep it up.',
|
|
94
|
+
'toast.praise.8': 'Great job hitting the date.',
|
|
95
|
+
'toast.cheer.1': 'Done is done — next time a little earlier.',
|
|
96
|
+
'toast.cheer.2': 'Late, but finished. Keep going.',
|
|
97
|
+
'toast.cheer.3': 'You closed it out. No guilt needed.',
|
|
98
|
+
'toast.cheer.4': 'Better late than never. On to the next.',
|
|
99
|
+
'toast.cheer.5': 'One off the list — reset the pace.',
|
|
100
|
+
'toast.cheer.6': 'Finished, and that still counts.',
|
|
101
|
+
'toast.cheer.7': 'Overdue but done. That matters.',
|
|
102
|
+
'toast.cheer.8': 'Cheer up — try one day earlier next time.',
|
|
103
|
+
'empty.completed': 'No completed to-dos yet.',
|
|
104
|
+
'completed.heading': 'Completed',
|
|
105
|
+
'completed.clear': 'Clear completed',
|
|
106
|
+
'completed.confirm': 'Confirm clear',
|
|
107
|
+
'quickAdd': 'Add',
|
|
108
|
+
'quickAdd.placeholder': 'Press Enter to add here',
|
|
109
|
+
'picker.prev': 'Previous month',
|
|
110
|
+
'picker.next': 'Next month',
|
|
111
|
+
'picker.clear': 'Clear',
|
|
112
|
+
'picker.today': 'Today',
|
|
113
|
+
'picker.due': 'Due date',
|
|
114
|
+
'picker.hint': 'Click to preview the day, double-click to set it and add the to-do',
|
|
115
|
+
'settings.toggle': 'Settings',
|
|
116
|
+
'settings.axis': 'Urgent column',
|
|
117
|
+
'settings.axis.left': 'Left',
|
|
118
|
+
'settings.axis.right': 'Right',
|
|
119
|
+
'settings.frame': 'Frame',
|
|
120
|
+
'settings.frame.cards': 'Cards',
|
|
121
|
+
'settings.frame.grid': 'Grid',
|
|
122
|
+
'settings.frame.cross': 'Cross',
|
|
123
|
+
'settings.tint': 'Cell fill',
|
|
124
|
+
'settings.tint.plain': 'Plain',
|
|
125
|
+
'settings.tint.soft': 'Soft',
|
|
126
|
+
'settings.dueFormat': 'Due date as',
|
|
127
|
+
'settings.dueFormat.date': 'Date',
|
|
128
|
+
'settings.dueFormat.countdown': 'Countdown',
|
|
129
|
+
'settings.titleStyle': 'Text',
|
|
130
|
+
'settings.titleStyle.wrap': 'Wrap',
|
|
131
|
+
'settings.titleStyle.truncate': 'Truncate',
|
|
132
|
+
'settings.quadSize': 'Drag the centre handle to resize the quadrants',
|
|
133
|
+
'settings.navLabel': 'Sidebar label',
|
|
134
|
+
'settings.navLabel.placeholder': 'Eisenhower to-do',
|
|
135
|
+
'settings.radius': 'Corner radius',
|
|
136
|
+
'settings.fontSize': 'Font size',
|
|
137
|
+
'settings.reset': 'Reset',
|
|
138
|
+
'settings.about.issues': 'Feedback',
|
|
139
|
+
'settings.about.developed': 'Developed by',
|
|
140
|
+
'loading': 'Loading…',
|
|
141
|
+
'error.request': 'Request failed.',
|
|
142
|
+
'error.retry': 'Retry',
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/** Chinese dictionary. */
|
|
146
|
+
const ZH = {
|
|
147
|
+
'nav.label': '四象限待办',
|
|
148
|
+
'page.title': '待办',
|
|
149
|
+
'page.subtitle': '重要 × 紧急',
|
|
150
|
+
'view.matrix': '四象限',
|
|
151
|
+
'view.completed': '已完成',
|
|
152
|
+
'flag.important': '重要',
|
|
153
|
+
'flag.urgent': '紧急',
|
|
154
|
+
'quadrant.q1': '立即做',
|
|
155
|
+
'quadrant.q1.hint': '重要 · 紧急',
|
|
156
|
+
'quadrant.q2': '计划做',
|
|
157
|
+
'quadrant.q2.hint': '重要 · 不紧急',
|
|
158
|
+
'quadrant.q3': '委托做',
|
|
159
|
+
'quadrant.q3.hint': '不重要 · 紧急',
|
|
160
|
+
'quadrant.q4': '别做',
|
|
161
|
+
'quadrant.q4.hint': '不重要 · 不紧急',
|
|
162
|
+
'item.complete': '标记完成',
|
|
163
|
+
'item.restore': '恢复',
|
|
164
|
+
'item.delete': '删除',
|
|
165
|
+
'item.due.set': '设置截止日期',
|
|
166
|
+
'item.due.today': '今天到期',
|
|
167
|
+
'item.due.overdue': '已逾期',
|
|
168
|
+
'item.drag': '拖动可排序,或移到其他象限',
|
|
169
|
+
'item.edit': '双击编辑',
|
|
170
|
+
'quickAdd.due': '截止日期',
|
|
171
|
+
'toast.praise.1': 'Well done! 按期完成',
|
|
172
|
+
'toast.praise.2': '漂亮,正好赶上',
|
|
173
|
+
'toast.praise.3': '按时搞定,节奏很好',
|
|
174
|
+
'toast.praise.4': '如期完成,稳稳的',
|
|
175
|
+
'toast.praise.5': 'Well done! 计划达成',
|
|
176
|
+
'toast.praise.6': '准时完成,很棒',
|
|
177
|
+
'toast.praise.7': '按计划完成,继续保持',
|
|
178
|
+
'toast.praise.8': '干得漂亮,说到做到',
|
|
179
|
+
'toast.cheer.1': '完成了就好,下次早点开始',
|
|
180
|
+
'toast.cheer.2': '虽然晚了点,但没放弃,加油',
|
|
181
|
+
'toast.cheer.3': '补上了,别自责,继续前进',
|
|
182
|
+
'toast.cheer.4': '迟到总比不到好,下一件会更好',
|
|
183
|
+
'toast.cheer.5': '搞定一件,调整节奏再来',
|
|
184
|
+
'toast.cheer.6': '完成了,给自己一点宽容',
|
|
185
|
+
'toast.cheer.7': '逾期也完成了,值得肯定',
|
|
186
|
+
'toast.cheer.8': '加油,下一次试着提前一天',
|
|
187
|
+
'empty.completed': '还没有已完成的事项。',
|
|
188
|
+
'completed.heading': '已完成',
|
|
189
|
+
'completed.clear': '清空已完成',
|
|
190
|
+
'completed.confirm': '确认清空',
|
|
191
|
+
'quickAdd': '添加',
|
|
192
|
+
'quickAdd.placeholder': '回车添加到本象限',
|
|
193
|
+
'picker.prev': '上个月',
|
|
194
|
+
'picker.next': '下个月',
|
|
195
|
+
'picker.clear': '清除',
|
|
196
|
+
'picker.today': '今天',
|
|
197
|
+
'picker.due': '截止日期',
|
|
198
|
+
'picker.hint': '单击预览日期,双击确定并添加该待办',
|
|
199
|
+
'settings.toggle': '设置',
|
|
200
|
+
'settings.axis': '紧急方向',
|
|
201
|
+
'settings.axis.left': '在左',
|
|
202
|
+
'settings.axis.right': '在右',
|
|
203
|
+
'settings.frame': '边框风格',
|
|
204
|
+
'settings.frame.cards': '卡片',
|
|
205
|
+
'settings.frame.grid': '田字格',
|
|
206
|
+
'settings.frame.cross': '十字线',
|
|
207
|
+
'settings.tint': '象限底色',
|
|
208
|
+
'settings.tint.plain': '纯色',
|
|
209
|
+
'settings.tint.soft': '淡彩',
|
|
210
|
+
'settings.dueFormat': '日期显示',
|
|
211
|
+
'settings.dueFormat.date': '日期',
|
|
212
|
+
'settings.dueFormat.countdown': '倒计时',
|
|
213
|
+
'settings.titleStyle': '文字显示',
|
|
214
|
+
'settings.titleStyle.wrap': '完整换行',
|
|
215
|
+
'settings.titleStyle.truncate': '单行截断',
|
|
216
|
+
'settings.quadSize': '拖动象限中心的圆点可调整四象限大小',
|
|
217
|
+
'settings.navLabel': '侧边栏名称',
|
|
218
|
+
'settings.navLabel.placeholder': '四象限待办',
|
|
219
|
+
'settings.radius': '圆角幅度',
|
|
220
|
+
'settings.fontSize': '字号',
|
|
221
|
+
'settings.reset': '恢复默认',
|
|
222
|
+
'settings.about.issues': '反馈问题',
|
|
223
|
+
'settings.about.developed': 'Developed by',
|
|
224
|
+
'loading': '加载中…',
|
|
225
|
+
'error.request': '请求失败。',
|
|
226
|
+
'error.retry': '重试',
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* The four cells, in reading order for the default layout.
|
|
231
|
+
* `important`/`urgent` are the two data flags; labels are locale keys.
|
|
232
|
+
*/
|
|
233
|
+
const QUADRANTS = [
|
|
234
|
+
{ id: 'q1', important: true, urgent: true },
|
|
235
|
+
{ id: 'q2', important: true, urgent: false },
|
|
236
|
+
{ id: 'q3', important: false, urgent: true },
|
|
237
|
+
{ id: 'q4', important: false, urgent: false },
|
|
238
|
+
];
|
|
239
|
+
|
|
240
|
+
/** Reading order when the urgent column moves to the right edge. */
|
|
241
|
+
const URGENT_RIGHT_ORDER = ['q2', 'q1', 'q4', 'q3'];
|
|
242
|
+
|
|
243
|
+
/** Defensive read of a settings payload from the Host. */
|
|
244
|
+
function sanitizeSettings(value) {
|
|
245
|
+
const source = value !== null && typeof value === 'object' ? value : {};
|
|
246
|
+
return {
|
|
247
|
+
urgentSide: source.urgentSide === 'right' ? 'right' : 'left',
|
|
248
|
+
frame: source.frame === 'grid' || source.frame === 'cross' ? source.frame : 'cards',
|
|
249
|
+
radius:
|
|
250
|
+
Number.isInteger(source.radius) && source.radius >= 0 && source.radius <= 24
|
|
251
|
+
? source.radius
|
|
252
|
+
: DEFAULT_SETTINGS.radius,
|
|
253
|
+
tint: source.tint === 'soft' ? 'soft' : 'plain',
|
|
254
|
+
fontSize:
|
|
255
|
+
Number.isInteger(source.fontSize) && source.fontSize >= 11 && source.fontSize <= 17
|
|
256
|
+
? source.fontSize
|
|
257
|
+
: DEFAULT_SETTINGS.fontSize,
|
|
258
|
+
dueFormat: source.dueFormat === 'countdown' ? 'countdown' : 'date',
|
|
259
|
+
titleStyle: source.titleStyle === 'truncate' ? 'truncate' : 'wrap',
|
|
260
|
+
colRatio: clampRatio(source.colRatio),
|
|
261
|
+
rowRatio: clampRatio(source.rowRatio),
|
|
262
|
+
navLabel: typeof source.navLabel === 'string' ? source.navLabel.trim().slice(0, 24) : '',
|
|
235
263
|
};
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
frame: source.frame === 'grid' || source.frame === 'cross' ? source.frame : 'cards',
|
|
257
|
-
radius:
|
|
258
|
-
Number.isInteger(source.radius) && source.radius >= 0 && source.radius <= 24
|
|
259
|
-
? source.radius
|
|
260
|
-
: DEFAULT_SETTINGS.radius,
|
|
261
|
-
tint: source.tint === 'soft' ? 'soft' : 'plain',
|
|
262
|
-
fontSize:
|
|
263
|
-
Number.isInteger(source.fontSize) && source.fontSize >= 11 && source.fontSize <= 17
|
|
264
|
-
? source.fontSize
|
|
265
|
-
: DEFAULT_SETTINGS.fontSize,
|
|
266
|
-
dueFormat: source.dueFormat === 'countdown' ? 'countdown' : 'date',
|
|
267
|
-
titleStyle: source.titleStyle === 'truncate' ? 'truncate' : 'wrap',
|
|
268
|
-
colRatio: clampRatio(source.colRatio),
|
|
269
|
-
rowRatio: clampRatio(source.rowRatio),
|
|
270
|
-
navLabel: typeof source.navLabel === 'string' ? source.navLabel.trim().slice(0, 24) : '',
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
/** Build the endpoint URL, respecting a document `<base>` like the host does. */
|
|
275
|
-
function apiUrl(method) {
|
|
276
|
-
return new URL(API_PREFIX + method, document.baseURI).href;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* One API round trip. Resolves to the server's `result`; throws a readable
|
|
281
|
-
* Error whose message is already user-facing (the Host writes them).
|
|
282
|
-
*/
|
|
283
|
-
async function fetchApi(method, payload) {
|
|
284
|
-
const res = await fetch(apiUrl(method), {
|
|
285
|
-
method: 'POST',
|
|
286
|
-
headers: { 'content-type': 'application/json' },
|
|
287
|
-
body: JSON.stringify(payload ?? {}),
|
|
288
|
-
});
|
|
289
|
-
const body = await res.json().catch(() => null);
|
|
290
|
-
if (body === null || typeof body !== 'object') {
|
|
291
|
-
throw new Error('Unexpected response from the to-do store.');
|
|
292
|
-
}
|
|
293
|
-
if (!body.ok) {
|
|
294
|
-
const message = body.error && body.error.message;
|
|
295
|
-
throw new Error(typeof message === 'string' && message !== '' ? message : 'The to-do store refused the request.');
|
|
296
|
-
}
|
|
297
|
-
return body.result ?? {};
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/** `MM-DD`, with the year added only when it is not the current one. */
|
|
301
|
-
function formatDay(iso) {
|
|
302
|
-
if (typeof iso !== 'string' || iso === '') return '';
|
|
303
|
-
const date = new Date(iso);
|
|
304
|
-
if (Number.isNaN(date.getTime())) return '';
|
|
305
|
-
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
306
|
-
const day = String(date.getDate()).padStart(2, '0');
|
|
307
|
-
const year = date.getFullYear();
|
|
308
|
-
return year === new Date().getFullYear() ? month + '-' + day : year + '-' + month + '-' + day;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/** Local calendar day key (YYYY-MM-DD), used for due-date comparison. */
|
|
312
|
-
function dayKeyOf(date) {
|
|
313
|
-
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
314
|
-
const day = String(date.getDate()).padStart(2, '0');
|
|
315
|
-
return date.getFullYear() + '-' + month + '-' + day;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/** Today as a local day key; re-read on every render so a stale page still compares correctly. */
|
|
319
|
-
function todayKey() {
|
|
320
|
-
return dayKeyOf(new Date());
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/** Format a stored YYYY-MM-DD key without timezone shifts. */
|
|
324
|
-
function formatDayKey(key) {
|
|
325
|
-
const parts = String(key).split('-');
|
|
326
|
-
if (parts.length !== 3) return key;
|
|
327
|
-
const year = Number(parts[0]);
|
|
328
|
-
return year === new Date().getFullYear() ? parts[1] + '-' + parts[2] : key;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/** `overdue` / `today` / `future` for an open todo's due date. */
|
|
332
|
-
function dueStateOf(dueDate) {
|
|
333
|
-
if (typeof dueDate !== 'string' || dueDate === '') return null;
|
|
334
|
-
const today = todayKey();
|
|
335
|
-
if (dueDate < today) return 'overdue';
|
|
336
|
-
return dueDate === today ? 'today' : 'future';
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
/** Whole days between two `YYYY-MM-DD` keys (positive = `a` is later). UTC math avoids DST drift. */
|
|
340
|
-
function daysBetween(a, b) {
|
|
341
|
-
const left = String(a).split('-').map(Number);
|
|
342
|
-
const right = String(b).split('-').map(Number);
|
|
343
|
-
if (left.length !== 3 || right.length !== 3) return 0;
|
|
344
|
-
const ms = Date.UTC(left[0], left[1] - 1, left[2]) - Date.UTC(right[0], right[1] - 1, right[2]);
|
|
345
|
-
return Math.round(ms / 86400000);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** Build the endpoint URL, respecting a document `<base>` like the host does. */
|
|
267
|
+
function apiUrl(method) {
|
|
268
|
+
return new URL(API_PREFIX + method, document.baseURI).href;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* One API round trip. Resolves to the server's `result`; throws a readable
|
|
273
|
+
* Error whose message is already user-facing (the Host writes them).
|
|
274
|
+
*/
|
|
275
|
+
async function fetchApi(method, payload) {
|
|
276
|
+
const res = await fetch(apiUrl(method), {
|
|
277
|
+
method: 'POST',
|
|
278
|
+
headers: { 'content-type': 'application/json' },
|
|
279
|
+
body: JSON.stringify(payload ?? {}),
|
|
280
|
+
});
|
|
281
|
+
const body = await res.json().catch(() => null);
|
|
282
|
+
if (body === null || typeof body !== 'object') {
|
|
283
|
+
throw new Error('Unexpected response from the to-do store.');
|
|
346
284
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
const diff = daysBetween(dueDate, todayKey());
|
|
351
|
-
return (diff > 0 ? String(diff) : diff === 0 ? '0' : String(diff)) + 'd';
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
/** Local Date from a `YYYY-MM-DD` key. */
|
|
355
|
-
function dateOfKey(key) {
|
|
356
|
-
const parts = String(key).split('-').map(Number);
|
|
357
|
-
return new Date(parts[0], parts[1] - 1, parts[2]);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
/** `YYYY-MM-DD` from a full year, a 0-based month, and a day of month. */
|
|
361
|
-
function keyOfDate(year, monthIndex, day) {
|
|
362
|
-
return year + '-' + String(monthIndex + 1).padStart(2, '0') + '-' + String(day).padStart(2, '0');
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
/** Day cells of one month, Monday first; nulls pad the leading week. */
|
|
366
|
-
function monthCells(year, monthIndex) {
|
|
367
|
-
const offset = (new Date(year, monthIndex, 1).getDay() + 6) % 7;
|
|
368
|
-
const total = new Date(year, monthIndex + 1, 0).getDate();
|
|
369
|
-
const cells = [];
|
|
370
|
-
for (let index = 0; index < offset; index += 1) cells.push(null);
|
|
371
|
-
for (let day = 1; day <= total; day += 1) cells.push(day);
|
|
372
|
-
return cells;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
/** Narrow weekday labels in the user's locale, Monday first (2024-01-01 was a Monday). */
|
|
376
|
-
const WEEKDAY_LABELS = (() => {
|
|
377
|
-
const format = new Intl.DateTimeFormat(undefined, { weekday: 'narrow' });
|
|
378
|
-
return Array.from({ length: 7 }, (_, index) => format.format(new Date(2024, 0, 1 + index)));
|
|
379
|
-
})();
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Fixed-position coordinates for the calendar panel anchored to a control,
|
|
383
|
-
* flipped above it when there is not enough room below.
|
|
384
|
-
*/
|
|
385
|
-
function panelPositionFor(rect) {
|
|
386
|
-
const width = 252;
|
|
387
|
-
const height = 330;
|
|
388
|
-
const left = Math.max(8, Math.min(rect.right - width, window.innerWidth - width - 8));
|
|
389
|
-
const top =
|
|
390
|
-
rect.bottom + 6 + height > window.innerHeight - 8 ? Math.max(8, rect.top - height - 6) : rect.bottom + 6;
|
|
391
|
-
return { left, top };
|
|
285
|
+
if (!body.ok) {
|
|
286
|
+
const message = body.error && body.error.message;
|
|
287
|
+
throw new Error(typeof message === 'string' && message !== '' ? message : 'The to-do store refused the request.');
|
|
392
288
|
}
|
|
289
|
+
return body.result ?? {};
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** `MM-DD`, with the year added only when it is not the current one. */
|
|
293
|
+
function formatDay(iso) {
|
|
294
|
+
if (typeof iso !== 'string' || iso === '') return '';
|
|
295
|
+
const date = new Date(iso);
|
|
296
|
+
if (Number.isNaN(date.getTime())) return '';
|
|
297
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
298
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
299
|
+
const year = date.getFullYear();
|
|
300
|
+
return year === new Date().getFullYear() ? month + '-' + day : year + '-' + month + '-' + day;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** Local calendar day key (YYYY-MM-DD), used for due-date comparison. */
|
|
304
|
+
function dayKeyOf(date) {
|
|
305
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
306
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
307
|
+
return date.getFullYear() + '-' + month + '-' + day;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/** Today as a local day key; re-read on every render so a stale page still compares correctly. */
|
|
311
|
+
function todayKey() {
|
|
312
|
+
return dayKeyOf(new Date());
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/** Format a stored YYYY-MM-DD key without timezone shifts. */
|
|
316
|
+
function formatDayKey(key) {
|
|
317
|
+
const parts = String(key).split('-');
|
|
318
|
+
if (parts.length !== 3) return key;
|
|
319
|
+
const year = Number(parts[0]);
|
|
320
|
+
return year === new Date().getFullYear() ? parts[1] + '-' + parts[2] : key;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/** `overdue` / `today` / `future` for an open todo's due date. */
|
|
324
|
+
function dueStateOf(dueDate) {
|
|
325
|
+
if (typeof dueDate !== 'string' || dueDate === '') return null;
|
|
326
|
+
const today = todayKey();
|
|
327
|
+
if (dueDate < today) return 'overdue';
|
|
328
|
+
return dueDate === today ? 'today' : 'future';
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/** Whole days between two `YYYY-MM-DD` keys (positive = `a` is later). UTC math avoids DST drift. */
|
|
332
|
+
function daysBetween(a, b) {
|
|
333
|
+
const left = String(a).split('-').map(Number);
|
|
334
|
+
const right = String(b).split('-').map(Number);
|
|
335
|
+
if (left.length !== 3 || right.length !== 3) return 0;
|
|
336
|
+
const ms = Date.UTC(left[0], left[1] - 1, left[2]) - Date.UTC(right[0], right[1] - 1, right[2]);
|
|
337
|
+
return Math.round(ms / 86400000);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** `7d` in the future, `0d` today, `-3d` when overdue. */
|
|
341
|
+
function formatCountdown(dueDate) {
|
|
342
|
+
const diff = daysBetween(dueDate, todayKey());
|
|
343
|
+
return (diff > 0 ? String(diff) : diff === 0 ? '0' : String(diff)) + 'd';
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** Local Date from a `YYYY-MM-DD` key. */
|
|
347
|
+
function dateOfKey(key) {
|
|
348
|
+
const parts = String(key).split('-').map(Number);
|
|
349
|
+
return new Date(parts[0], parts[1] - 1, parts[2]);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/** `YYYY-MM-DD` from a full year, a 0-based month, and a day of month. */
|
|
353
|
+
function keyOfDate(year, monthIndex, day) {
|
|
354
|
+
return year + '-' + String(monthIndex + 1).padStart(2, '0') + '-' + String(day).padStart(2, '0');
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** Day cells of one month, Monday first; nulls pad the leading week. */
|
|
358
|
+
function monthCells(year, monthIndex) {
|
|
359
|
+
const offset = (new Date(year, monthIndex, 1).getDay() + 6) % 7;
|
|
360
|
+
const total = new Date(year, monthIndex + 1, 0).getDate();
|
|
361
|
+
const cells = [];
|
|
362
|
+
for (let index = 0; index < offset; index += 1) cells.push(null);
|
|
363
|
+
for (let day = 1; day <= total; day += 1) cells.push(day);
|
|
364
|
+
return cells;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/** Narrow weekday labels in the user's locale, Monday first (2024-01-01 was a Monday). */
|
|
368
|
+
const WEEKDAY_LABELS = (() => {
|
|
369
|
+
const format = new Intl.DateTimeFormat(undefined, { weekday: 'narrow' });
|
|
370
|
+
return Array.from({ length: 7 }, (_, index) => format.format(new Date(2024, 0, 1 + index)));
|
|
371
|
+
})();
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Fixed-position coordinates for the calendar panel anchored to a control,
|
|
375
|
+
* flipped above it when there is not enough room below.
|
|
376
|
+
*/
|
|
377
|
+
function panelPositionFor(rect) {
|
|
378
|
+
const width = 252;
|
|
379
|
+
const height = 330;
|
|
380
|
+
const left = Math.max(8, Math.min(rect.right - width, window.innerWidth - width - 8));
|
|
381
|
+
const top =
|
|
382
|
+
rect.bottom + 6 + height > window.innerHeight - 8 ? Math.max(8, rect.top - height - 6) : rect.bottom + 6;
|
|
383
|
+
return { left, top };
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* A small month calendar. A single click previews a day without closing;
|
|
388
|
+
* a double-click confirms it, closes, and lets the caller add the to-do.
|
|
389
|
+
*/
|
|
390
|
+
function DatePickerPanel(props) {
|
|
391
|
+
const t = props.t;
|
|
392
|
+
const value = props.value;
|
|
393
|
+
const anchor = props.anchor;
|
|
394
|
+
const panelRef = useRef(null);
|
|
395
|
+
const [view, setView] = useState(() => {
|
|
396
|
+
const base = value !== '' ? dateOfKey(value) : new Date();
|
|
397
|
+
return { year: base.getFullYear(), month: base.getMonth() };
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
const dismiss = props.onDismiss;
|
|
401
|
+
|
|
402
|
+
useEffect(() => {
|
|
403
|
+
const onPointerDown = (event) => {
|
|
404
|
+
if (panelRef.current !== null && panelRef.current.contains(event.target)) return;
|
|
405
|
+
const target = event.target;
|
|
406
|
+
if (target instanceof Element) {
|
|
407
|
+
const anchorElement = target.closest('[data-ez-date-anchor]');
|
|
408
|
+
// Its own anchor toggles the panel closed via click, so leave it alone;
|
|
409
|
+
// any other anchor dismisses this panel and opens its own.
|
|
410
|
+
if (anchorElement !== null && anchorElement.getAttribute('data-ez-date-anchor') === anchor) return;
|
|
411
|
+
}
|
|
412
|
+
dismiss();
|
|
413
|
+
};
|
|
414
|
+
const onKeyDown = (event) => {
|
|
415
|
+
if (event.key === 'Escape') dismiss();
|
|
416
|
+
};
|
|
417
|
+
document.addEventListener('mousedown', onPointerDown, true);
|
|
418
|
+
document.addEventListener('keydown', onKeyDown, true);
|
|
419
|
+
return () => {
|
|
420
|
+
document.removeEventListener('mousedown', onPointerDown, true);
|
|
421
|
+
document.removeEventListener('keydown', onKeyDown, true);
|
|
422
|
+
};
|
|
423
|
+
}, [dismiss, anchor]);
|
|
393
424
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
*/
|
|
398
|
-
function DatePickerPanel(props) {
|
|
399
|
-
const t = props.t;
|
|
400
|
-
const value = props.value;
|
|
401
|
-
const anchor = props.anchor;
|
|
402
|
-
const panelRef = useRef(null);
|
|
403
|
-
const [view, setView] = useState(() => {
|
|
404
|
-
const base = value !== '' ? dateOfKey(value) : new Date();
|
|
425
|
+
const shift = (delta) => {
|
|
426
|
+
setView((current) => {
|
|
427
|
+
const base = new Date(current.year, current.month + delta, 1);
|
|
405
428
|
return { year: base.getFullYear(), month: base.getMonth() };
|
|
406
429
|
});
|
|
430
|
+
};
|
|
407
431
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
const target = event.target;
|
|
414
|
-
if (target instanceof Element) {
|
|
415
|
-
const anchorElement = target.closest('[data-ez-date-anchor]');
|
|
416
|
-
// Its own anchor toggles the panel closed via click, so leave it alone;
|
|
417
|
-
// any other anchor dismisses this panel and opens its own.
|
|
418
|
-
if (anchorElement !== null && anchorElement.getAttribute('data-ez-date-anchor') === anchor) return;
|
|
419
|
-
}
|
|
420
|
-
dismiss();
|
|
421
|
-
};
|
|
422
|
-
const onKeyDown = (event) => {
|
|
423
|
-
if (event.key === 'Escape') dismiss();
|
|
424
|
-
};
|
|
425
|
-
document.addEventListener('mousedown', onPointerDown, true);
|
|
426
|
-
document.addEventListener('keydown', onKeyDown, true);
|
|
427
|
-
return () => {
|
|
428
|
-
document.removeEventListener('mousedown', onPointerDown, true);
|
|
429
|
-
document.removeEventListener('keydown', onKeyDown, true);
|
|
430
|
-
};
|
|
431
|
-
}, [dismiss, anchor]);
|
|
432
|
-
|
|
433
|
-
const shift = (delta) => {
|
|
434
|
-
setView((current) => {
|
|
435
|
-
const base = new Date(current.year, current.month + delta, 1);
|
|
436
|
-
return { year: base.getFullYear(), month: base.getMonth() };
|
|
437
|
-
});
|
|
438
|
-
};
|
|
439
|
-
|
|
440
|
-
const today = todayKey();
|
|
441
|
-
const cells = monthCells(view.year, view.month);
|
|
442
|
-
const monthLabel = new Intl.DateTimeFormat(undefined, { year: 'numeric', month: 'long' }).format(
|
|
443
|
-
new Date(view.year, view.month, 1),
|
|
444
|
-
);
|
|
432
|
+
const today = todayKey();
|
|
433
|
+
const cells = monthCells(view.year, view.month);
|
|
434
|
+
const monthLabel = new Intl.DateTimeFormat(undefined, { year: 'numeric', month: 'long' }).format(
|
|
435
|
+
new Date(view.year, view.month, 1),
|
|
436
|
+
);
|
|
445
437
|
|
|
446
|
-
|
|
438
|
+
return h(
|
|
439
|
+
'div',
|
|
440
|
+
{ className: 'ez-picker', ref: panelRef, style: props.style, role: 'dialog', 'aria-label': t('picker.due') },
|
|
441
|
+
h(
|
|
447
442
|
'div',
|
|
448
|
-
{ className: 'ez-picker
|
|
443
|
+
{ className: 'ez-picker-head' },
|
|
449
444
|
h(
|
|
450
|
-
'
|
|
451
|
-
{
|
|
452
|
-
|
|
453
|
-
'
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
445
|
+
'button',
|
|
446
|
+
{
|
|
447
|
+
type: 'button',
|
|
448
|
+
className: 'ez-picker-nav',
|
|
449
|
+
title: t('picker.prev'),
|
|
450
|
+
'aria-label': t('picker.prev'),
|
|
451
|
+
onClick: () => shift(-1),
|
|
452
|
+
},
|
|
453
|
+
'‹',
|
|
454
|
+
),
|
|
455
|
+
h('span', { className: 'ez-picker-title' }, monthLabel),
|
|
456
|
+
h(
|
|
457
|
+
'button',
|
|
458
|
+
{
|
|
459
|
+
type: 'button',
|
|
460
|
+
className: 'ez-picker-nav',
|
|
461
|
+
title: t('picker.next'),
|
|
462
|
+
'aria-label': t('picker.next'),
|
|
463
|
+
onClick: () => shift(1),
|
|
464
|
+
},
|
|
465
|
+
'›',
|
|
466
|
+
),
|
|
467
|
+
),
|
|
468
|
+
h(
|
|
469
|
+
'div',
|
|
470
|
+
{ className: 'ez-picker-grid ez-picker-grid--wd' },
|
|
471
|
+
WEEKDAY_LABELS.map((label, index) => h('span', { key: 'wd-' + index, className: 'ez-picker-wd' }, label)),
|
|
472
|
+
),
|
|
473
|
+
h(
|
|
474
|
+
'div',
|
|
475
|
+
{ className: 'ez-picker-grid' },
|
|
476
|
+
cells.map((day, index) => {
|
|
477
|
+
if (day === null) return h('span', { key: 'pad-' + index, className: 'ez-picker-cell' });
|
|
478
|
+
const key = keyOfDate(view.year, view.month, day);
|
|
479
|
+
const selected = key === value;
|
|
480
|
+
return h(
|
|
465
481
|
'button',
|
|
466
482
|
{
|
|
483
|
+
key,
|
|
467
484
|
type: 'button',
|
|
468
|
-
className:
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
485
|
+
className:
|
|
486
|
+
'ez-picker-day' + (selected ? ' is-selected' : '') + (key === today ? ' is-today' : ''),
|
|
487
|
+
title: t('picker.hint'),
|
|
488
|
+
'aria-label': key,
|
|
489
|
+
'aria-pressed': selected,
|
|
490
|
+
onClick: () => props.onPick(key),
|
|
491
|
+
onDoubleClick: () => props.onCommit(key),
|
|
472
492
|
},
|
|
473
|
-
|
|
474
|
-
)
|
|
475
|
-
),
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
),
|
|
493
|
+
String(day),
|
|
494
|
+
);
|
|
495
|
+
}),
|
|
496
|
+
),
|
|
497
|
+
h(
|
|
498
|
+
'div',
|
|
499
|
+
{ className: 'ez-picker-foot' },
|
|
481
500
|
h(
|
|
482
|
-
'
|
|
483
|
-
{ className: 'ez-picker-
|
|
484
|
-
|
|
485
|
-
if (day === null) return h('span', { key: 'pad-' + index, className: 'ez-picker-cell' });
|
|
486
|
-
const key = keyOfDate(view.year, view.month, day);
|
|
487
|
-
const selected = key === value;
|
|
488
|
-
return h(
|
|
489
|
-
'button',
|
|
490
|
-
{
|
|
491
|
-
key,
|
|
492
|
-
type: 'button',
|
|
493
|
-
className:
|
|
494
|
-
'ez-picker-day' + (selected ? ' is-selected' : '') + (key === today ? ' is-today' : ''),
|
|
495
|
-
title: t('picker.hint'),
|
|
496
|
-
'aria-label': key,
|
|
497
|
-
'aria-pressed': selected,
|
|
498
|
-
onClick: () => props.onPick(key),
|
|
499
|
-
onDoubleClick: () => props.onCommit(key),
|
|
500
|
-
},
|
|
501
|
-
String(day),
|
|
502
|
-
);
|
|
503
|
-
}),
|
|
501
|
+
'button',
|
|
502
|
+
{ type: 'button', className: 'ez-picker-link', disabled: value === '', onClick: props.onClear },
|
|
503
|
+
t('picker.clear'),
|
|
504
504
|
),
|
|
505
505
|
h(
|
|
506
|
-
'
|
|
507
|
-
{
|
|
508
|
-
|
|
509
|
-
'
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
'button',
|
|
515
|
-
{
|
|
516
|
-
type: 'button',
|
|
517
|
-
className: 'ez-picker-link',
|
|
518
|
-
onClick: () => {
|
|
519
|
-
const now = new Date();
|
|
520
|
-
setView({ year: now.getFullYear(), month: now.getMonth() });
|
|
521
|
-
props.onPick(today);
|
|
522
|
-
},
|
|
506
|
+
'button',
|
|
507
|
+
{
|
|
508
|
+
type: 'button',
|
|
509
|
+
className: 'ez-picker-link',
|
|
510
|
+
onClick: () => {
|
|
511
|
+
const now = new Date();
|
|
512
|
+
setView({ year: now.getFullYear(), month: now.getMonth() });
|
|
513
|
+
props.onPick(today);
|
|
523
514
|
},
|
|
524
|
-
|
|
525
|
-
),
|
|
515
|
+
},
|
|
516
|
+
t('picker.today'),
|
|
526
517
|
),
|
|
527
|
-
)
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
},
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
)
|
|
518
|
+
),
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/** Sidebar glyph: a 2×2 matrix with one filled cell. */
|
|
523
|
+
function PanelIcon(props) {
|
|
524
|
+
const edge = typeof props.size === 'number' ? props.size : 16;
|
|
525
|
+
return h(
|
|
526
|
+
'svg',
|
|
527
|
+
{
|
|
528
|
+
width: edge,
|
|
529
|
+
height: edge,
|
|
530
|
+
viewBox: '0 0 16 16',
|
|
531
|
+
fill: 'none',
|
|
532
|
+
'aria-hidden': 'true',
|
|
533
|
+
focusable: 'false',
|
|
534
|
+
style: { display: 'block' },
|
|
535
|
+
},
|
|
536
|
+
h('rect', { x: 2.1, y: 2.1, width: 5, height: 5, rx: 1.2, fill: 'currentColor' }),
|
|
537
|
+
h('rect', { x: 8.9, y: 2.1, width: 5, height: 5, rx: 1.2, stroke: 'currentColor', strokeWidth: 1.1 }),
|
|
538
|
+
h('rect', { x: 2.1, y: 8.9, width: 5, height: 5, rx: 1.2, stroke: 'currentColor', strokeWidth: 1.1 }),
|
|
539
|
+
h('rect', { x: 8.9, y: 8.9, width: 5, height: 5, rx: 1.2, stroke: 'currentColor', strokeWidth: 1.1 }),
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/** Small inline glyph factory: stroked `paths` in `currentColor`. */
|
|
544
|
+
function glyph(paths, size) {
|
|
545
|
+
const edge = size ?? 14;
|
|
546
|
+
return h(
|
|
547
|
+
'svg',
|
|
548
|
+
{
|
|
549
|
+
width: edge,
|
|
550
|
+
height: edge,
|
|
551
|
+
viewBox: '0 0 16 16',
|
|
552
|
+
fill: 'none',
|
|
553
|
+
stroke: 'currentColor',
|
|
554
|
+
strokeWidth: 1.3,
|
|
555
|
+
strokeLinecap: 'round',
|
|
556
|
+
strokeLinejoin: 'round',
|
|
557
|
+
'aria-hidden': 'true',
|
|
558
|
+
focusable: 'false',
|
|
559
|
+
style: { display: 'block' },
|
|
560
|
+
},
|
|
561
|
+
paths.map((d, index) => h('path', { key: String(index), d: d })),
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
const FlagGlyph = () =>
|
|
566
|
+
h(
|
|
567
|
+
'svg',
|
|
568
|
+
{
|
|
569
|
+
width: 14,
|
|
570
|
+
height: 14,
|
|
571
|
+
viewBox: '0 0 16 16',
|
|
572
|
+
fill: 'none',
|
|
573
|
+
stroke: 'currentColor',
|
|
574
|
+
strokeWidth: 1.3,
|
|
575
|
+
strokeLinecap: 'round',
|
|
576
|
+
strokeLinejoin: 'round',
|
|
577
|
+
'aria-hidden': 'true',
|
|
578
|
+
focusable: 'false',
|
|
579
|
+
style: { display: 'block' },
|
|
580
|
+
},
|
|
581
|
+
h('path', { d: 'M4.4 13.6V2.6' }),
|
|
582
|
+
h('path', { d: 'M4.4 3.2h6.1l-1.2 2.2 1.2 2.2H4.4' }),
|
|
583
|
+
);
|
|
584
|
+
|
|
585
|
+
const BoltGlyph = () =>
|
|
586
|
+
h(
|
|
587
|
+
'svg',
|
|
588
|
+
{
|
|
589
|
+
width: 14,
|
|
590
|
+
height: 14,
|
|
591
|
+
viewBox: '0 0 16 16',
|
|
592
|
+
fill: 'none',
|
|
593
|
+
stroke: 'currentColor',
|
|
594
|
+
strokeWidth: 1.3,
|
|
595
|
+
strokeLinecap: 'round',
|
|
596
|
+
strokeLinejoin: 'round',
|
|
597
|
+
'aria-hidden': 'true',
|
|
598
|
+
focusable: 'false',
|
|
599
|
+
style: { display: 'block' },
|
|
600
|
+
},
|
|
601
|
+
h('path', { d: 'M8.9 1.8 3.6 9h3.6l-1 5.2L11.4 7H7.8Z' }),
|
|
602
|
+
);
|
|
603
|
+
|
|
604
|
+
const CloseGlyph = () => glyph(['M4.2 4.2l7.6 7.6', 'M11.8 4.2l-7.6 7.6'], 13);
|
|
605
|
+
|
|
606
|
+
const RestoreGlyph = () => glyph(['M3.2 6.2h4V2.6', 'M3.4 10.6a5.2 5.2 0 1 0 .6-6.2'], 13);
|
|
607
|
+
|
|
608
|
+
const CalendarGlyph = ({ size = 13 } = {}) =>
|
|
609
|
+
h(
|
|
610
|
+
'svg',
|
|
611
|
+
{
|
|
612
|
+
width: size,
|
|
613
|
+
height: size,
|
|
614
|
+
viewBox: '0 0 16 16',
|
|
615
|
+
fill: 'none',
|
|
616
|
+
stroke: 'currentColor',
|
|
617
|
+
strokeWidth: 1.3,
|
|
618
|
+
strokeLinecap: 'round',
|
|
619
|
+
'aria-hidden': 'true',
|
|
620
|
+
focusable: 'false',
|
|
621
|
+
style: { display: 'block' },
|
|
622
|
+
},
|
|
623
|
+
h('rect', { x: 2.4, y: 3.4, width: 11.2, height: 10.2, rx: 1.8 }),
|
|
624
|
+
h('path', { d: 'M2.4 6.6h11.2M5.6 1.9v3M10.4 1.9v3' }),
|
|
625
|
+
);
|
|
626
|
+
|
|
627
|
+
const GearGlyph = () =>
|
|
628
|
+
h(
|
|
629
|
+
'svg',
|
|
630
|
+
{
|
|
631
|
+
width: 15,
|
|
632
|
+
height: 15,
|
|
633
|
+
viewBox: '0 0 16 16',
|
|
634
|
+
fill: 'none',
|
|
635
|
+
stroke: 'currentColor',
|
|
636
|
+
strokeWidth: 1.25,
|
|
637
|
+
strokeLinecap: 'round',
|
|
638
|
+
'aria-hidden': 'true',
|
|
639
|
+
focusable: 'false',
|
|
640
|
+
style: { display: 'block' },
|
|
641
|
+
},
|
|
642
|
+
h('circle', { cx: 8, cy: 8, r: 2.1 }),
|
|
643
|
+
h('path', { d: 'M8 1.9v1.5M8 12.6v1.5M1.9 8h1.5M12.6 8h1.5M3.7 3.7l1.1 1.1M11.2 11.2l1.1 1.1M12.3 3.7l-1.1 1.1M4.8 11.2l-1.1 1.1' }),
|
|
644
|
+
);
|
|
645
|
+
|
|
646
|
+
/** Feedback glyph for the settings footer. */
|
|
647
|
+
const ChatGlyph = () =>
|
|
648
|
+
glyph(['M13.2 8c0 2.5-2.3 4.5-5.2 4.5-.7 0-1.3-.1-1.9-.3l-2.9 1 .9-2.4c-.7-.7-1.2-1.7-1.2-2.8 0-2.5 2.3-4.5 5.1-4.5s5.2 2 5.2 4.5Z'], 13);
|
|
649
|
+
|
|
650
|
+
/** A small icon button used for per-row and header actions. */
|
|
651
|
+
function MiniButton(props) {
|
|
652
|
+
const attrs = {
|
|
653
|
+
type: 'button',
|
|
654
|
+
className: props.active ? 'ez-mini is-on' : 'ez-mini',
|
|
655
|
+
title: props.label,
|
|
656
|
+
'aria-label': props.label,
|
|
657
|
+
onClick: props.onClick,
|
|
658
|
+
};
|
|
659
|
+
// Opening the shared calendar reports itself so the panel can tell a click
|
|
660
|
+
// on its own anchor from a click elsewhere.
|
|
661
|
+
if (props.anchor !== undefined) {
|
|
662
|
+
attrs['data-ez-date-anchor'] = props.anchor;
|
|
663
|
+
attrs['aria-haspopup'] = 'dialog';
|
|
664
|
+
attrs['aria-expanded'] = props.expanded === true;
|
|
549
665
|
}
|
|
666
|
+
return h('button', attrs, props.children);
|
|
667
|
+
}
|
|
550
668
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
'svg',
|
|
556
|
-
{
|
|
557
|
-
width: edge,
|
|
558
|
-
height: edge,
|
|
559
|
-
viewBox: '0 0 16 16',
|
|
560
|
-
fill: 'none',
|
|
561
|
-
stroke: 'currentColor',
|
|
562
|
-
strokeWidth: 1.3,
|
|
563
|
-
strokeLinecap: 'round',
|
|
564
|
-
strokeLinejoin: 'round',
|
|
565
|
-
'aria-hidden': 'true',
|
|
566
|
-
focusable: 'false',
|
|
567
|
-
style: { display: 'block' },
|
|
568
|
-
},
|
|
569
|
-
paths.map((d, index) => h('path', { key: String(index), d: d })),
|
|
570
|
-
);
|
|
571
|
-
}
|
|
669
|
+
/** The settings panel: axis side, frame style, cell fill, radius, font size. */
|
|
670
|
+
function SettingsPanel(props) {
|
|
671
|
+
const t = props.t;
|
|
672
|
+
const settings = props.settings;
|
|
572
673
|
|
|
573
|
-
const
|
|
674
|
+
const row = (label, control, trailing) =>
|
|
574
675
|
h(
|
|
575
|
-
'
|
|
576
|
-
{
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
fill: 'none',
|
|
581
|
-
stroke: 'currentColor',
|
|
582
|
-
strokeWidth: 1.3,
|
|
583
|
-
strokeLinecap: 'round',
|
|
584
|
-
strokeLinejoin: 'round',
|
|
585
|
-
'aria-hidden': 'true',
|
|
586
|
-
focusable: 'false',
|
|
587
|
-
style: { display: 'block' },
|
|
588
|
-
},
|
|
589
|
-
h('path', { d: 'M4.4 13.6V2.6' }),
|
|
590
|
-
h('path', { d: 'M4.4 3.2h6.1l-1.2 2.2 1.2 2.2H4.4' }),
|
|
676
|
+
'div',
|
|
677
|
+
{ className: 'ez-set-row' },
|
|
678
|
+
h('span', { className: 'ez-set-label' }, label),
|
|
679
|
+
control,
|
|
680
|
+
trailing === undefined ? null : trailing,
|
|
591
681
|
);
|
|
592
682
|
|
|
593
|
-
const
|
|
683
|
+
const seg = (options, current, onPick) =>
|
|
594
684
|
h(
|
|
595
|
-
'
|
|
596
|
-
{
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
685
|
+
'div',
|
|
686
|
+
{ className: 'ez-seg ez-seg--sm', role: 'group' },
|
|
687
|
+
options.map((option) =>
|
|
688
|
+
h(
|
|
689
|
+
'button',
|
|
690
|
+
{
|
|
691
|
+
key: option[0],
|
|
692
|
+
type: 'button',
|
|
693
|
+
className: option[0] === current ? 'ez-seg-btn is-active' : 'ez-seg-btn',
|
|
694
|
+
'aria-pressed': option[0] === current,
|
|
695
|
+
onClick: () => onPick(option[0]),
|
|
696
|
+
},
|
|
697
|
+
option[1],
|
|
698
|
+
),
|
|
699
|
+
),
|
|
610
700
|
);
|
|
611
701
|
|
|
612
|
-
const
|
|
613
|
-
|
|
614
|
-
const RestoreGlyph = () => glyph(['M3.2 6.2h4V2.6', 'M3.4 10.6a5.2 5.2 0 1 0 .6-6.2'], 13);
|
|
615
|
-
|
|
616
|
-
const CalendarGlyph = ({ size = 13 } = {}) =>
|
|
702
|
+
const slider = (label, value, min, max, step, onInput) =>
|
|
617
703
|
h(
|
|
618
|
-
'
|
|
619
|
-
{
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
'aria-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
},
|
|
631
|
-
h('rect', { x: 2.4, y: 3.4, width: 11.2, height: 10.2, rx: 1.8 }),
|
|
632
|
-
h('path', { d: 'M2.4 6.6h11.2M5.6 1.9v3M10.4 1.9v3' }),
|
|
704
|
+
'div',
|
|
705
|
+
{ className: 'ez-set-slider' },
|
|
706
|
+
h('input', {
|
|
707
|
+
className: 'ez-range',
|
|
708
|
+
type: 'range',
|
|
709
|
+
min,
|
|
710
|
+
max,
|
|
711
|
+
step,
|
|
712
|
+
value,
|
|
713
|
+
'aria-label': label,
|
|
714
|
+
onChange: (event) => onInput(Number(event.target.value)),
|
|
715
|
+
}),
|
|
716
|
+
h('span', { className: 'ez-set-value' }, value + ' px'),
|
|
633
717
|
);
|
|
634
718
|
|
|
635
|
-
|
|
719
|
+
/**
|
|
720
|
+
* An external link with a glyph. The desktop shell turns a target="_blank"
|
|
721
|
+
* https link into a browser open, so the page itself never navigates away.
|
|
722
|
+
*/
|
|
723
|
+
const aboutLink = (href, Glyph, label, extraClass) =>
|
|
636
724
|
h(
|
|
637
|
-
'
|
|
725
|
+
'a',
|
|
638
726
|
{
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
strokeLinecap: 'round',
|
|
646
|
-
'aria-hidden': 'true',
|
|
647
|
-
focusable: 'false',
|
|
648
|
-
style: { display: 'block' },
|
|
727
|
+
className: extraClass ? 'ez-about-link ' + extraClass : 'ez-about-link',
|
|
728
|
+
href,
|
|
729
|
+
target: '_blank',
|
|
730
|
+
rel: 'noreferrer noopener',
|
|
731
|
+
title: label + ' · ' + href,
|
|
732
|
+
'aria-label': label + ' · ' + href,
|
|
649
733
|
},
|
|
650
|
-
h(
|
|
651
|
-
|
|
734
|
+
h(Glyph),
|
|
735
|
+
label,
|
|
652
736
|
);
|
|
653
737
|
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
};
|
|
667
|
-
// Opening the shared calendar reports itself so the panel can tell a click
|
|
668
|
-
// on its own anchor from a click elsewhere.
|
|
669
|
-
if (props.anchor !== undefined) {
|
|
670
|
-
attrs['data-ez-date-anchor'] = props.anchor;
|
|
671
|
-
attrs['aria-haspopup'] = 'dialog';
|
|
672
|
-
attrs['aria-expanded'] = props.expanded === true;
|
|
673
|
-
}
|
|
674
|
-
return h('button', attrs, props.children);
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
/** The settings panel: axis side, frame style, cell fill, radius, font size. */
|
|
678
|
-
function SettingsPanel(props) {
|
|
679
|
-
const t = props.t;
|
|
680
|
-
const settings = props.settings;
|
|
681
|
-
|
|
682
|
-
const row = (label, control, trailing) =>
|
|
683
|
-
h(
|
|
684
|
-
'div',
|
|
685
|
-
{ className: 'ez-set-row' },
|
|
686
|
-
h('span', { className: 'ez-set-label' }, label),
|
|
687
|
-
control,
|
|
688
|
-
trailing === undefined ? null : trailing,
|
|
689
|
-
);
|
|
690
|
-
|
|
691
|
-
const seg = (options, current, onPick) =>
|
|
692
|
-
h(
|
|
693
|
-
'div',
|
|
694
|
-
{ className: 'ez-seg ez-seg--sm', role: 'group' },
|
|
695
|
-
options.map((option) =>
|
|
696
|
-
h(
|
|
697
|
-
'button',
|
|
698
|
-
{
|
|
699
|
-
key: option[0],
|
|
700
|
-
type: 'button',
|
|
701
|
-
className: option[0] === current ? 'ez-seg-btn is-active' : 'ez-seg-btn',
|
|
702
|
-
'aria-pressed': option[0] === current,
|
|
703
|
-
onClick: () => onPick(option[0]),
|
|
704
|
-
},
|
|
705
|
-
option[1],
|
|
706
|
-
),
|
|
707
|
-
),
|
|
708
|
-
);
|
|
709
|
-
|
|
710
|
-
const slider = (label, value, min, max, step, onInput) =>
|
|
711
|
-
h(
|
|
712
|
-
'div',
|
|
713
|
-
{ className: 'ez-set-slider' },
|
|
714
|
-
h('input', {
|
|
715
|
-
className: 'ez-range',
|
|
716
|
-
type: 'range',
|
|
717
|
-
min,
|
|
718
|
-
max,
|
|
719
|
-
step,
|
|
720
|
-
value,
|
|
721
|
-
'aria-label': label,
|
|
722
|
-
onChange: (event) => onInput(Number(event.target.value)),
|
|
723
|
-
}),
|
|
724
|
-
h('span', { className: 'ez-set-value' }, value + ' px'),
|
|
725
|
-
);
|
|
726
|
-
|
|
727
|
-
/**
|
|
728
|
-
* An external link with a glyph. The desktop shell turns a target="_blank"
|
|
729
|
-
* https link into a browser open, so the page itself never navigates away.
|
|
730
|
-
*/
|
|
731
|
-
const aboutLink = (href, Glyph, label, extraClass) =>
|
|
732
|
-
h(
|
|
733
|
-
'a',
|
|
734
|
-
{
|
|
735
|
-
className: extraClass ? 'ez-about-link ' + extraClass : 'ez-about-link',
|
|
736
|
-
href,
|
|
737
|
-
target: '_blank',
|
|
738
|
-
rel: 'noreferrer noopener',
|
|
739
|
-
title: label + ' · ' + href,
|
|
740
|
-
'aria-label': label + ' · ' + href,
|
|
741
|
-
},
|
|
742
|
-
h(Glyph),
|
|
743
|
-
label,
|
|
744
|
-
);
|
|
745
|
-
|
|
746
|
-
return h(
|
|
747
|
-
'div',
|
|
748
|
-
{ className: 'ez-settings', id: 'ez-settings-panel' },
|
|
749
|
-
row(
|
|
750
|
-
t('settings.axis'),
|
|
751
|
-
seg(
|
|
752
|
-
[
|
|
753
|
-
['left', t('settings.axis.left')],
|
|
754
|
-
['right', t('settings.axis.right')],
|
|
755
|
-
],
|
|
756
|
-
settings.urgentSide,
|
|
757
|
-
(value) => props.onPatch({ urgentSide: value }),
|
|
758
|
-
),
|
|
759
|
-
),
|
|
760
|
-
row(
|
|
761
|
-
t('settings.frame'),
|
|
762
|
-
seg(
|
|
763
|
-
[
|
|
764
|
-
['cards', t('settings.frame.cards')],
|
|
765
|
-
['grid', t('settings.frame.grid')],
|
|
766
|
-
['cross', t('settings.frame.cross')],
|
|
767
|
-
],
|
|
768
|
-
settings.frame,
|
|
769
|
-
(value) => props.onPatch({ frame: value }),
|
|
770
|
-
),
|
|
771
|
-
),
|
|
772
|
-
row(
|
|
773
|
-
t('settings.tint'),
|
|
774
|
-
seg(
|
|
775
|
-
[
|
|
776
|
-
['plain', t('settings.tint.plain')],
|
|
777
|
-
['soft', t('settings.tint.soft')],
|
|
778
|
-
],
|
|
779
|
-
settings.tint,
|
|
780
|
-
(value) => props.onPatch({ tint: value }),
|
|
781
|
-
),
|
|
738
|
+
return h(
|
|
739
|
+
'div',
|
|
740
|
+
{ className: 'ez-settings', id: 'ez-settings-panel' },
|
|
741
|
+
row(
|
|
742
|
+
t('settings.axis'),
|
|
743
|
+
seg(
|
|
744
|
+
[
|
|
745
|
+
['left', t('settings.axis.left')],
|
|
746
|
+
['right', t('settings.axis.right')],
|
|
747
|
+
],
|
|
748
|
+
settings.urgentSide,
|
|
749
|
+
(value) => props.onPatch({ urgentSide: value }),
|
|
782
750
|
),
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
],
|
|
790
|
-
settings.
|
|
791
|
-
|
|
792
|
-
|
|
751
|
+
),
|
|
752
|
+
row(
|
|
753
|
+
t('settings.frame'),
|
|
754
|
+
seg(
|
|
755
|
+
[
|
|
756
|
+
['cards', t('settings.frame.cards')],
|
|
757
|
+
['grid', t('settings.frame.grid')],
|
|
758
|
+
['cross', t('settings.frame.cross')],
|
|
759
|
+
],
|
|
760
|
+
settings.frame,
|
|
761
|
+
(value) => props.onPatch({ frame: value }),
|
|
793
762
|
),
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
],
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
),
|
|
763
|
+
),
|
|
764
|
+
row(
|
|
765
|
+
t('settings.tint'),
|
|
766
|
+
seg(
|
|
767
|
+
[
|
|
768
|
+
['plain', t('settings.tint.plain')],
|
|
769
|
+
['soft', t('settings.tint.soft')],
|
|
770
|
+
],
|
|
771
|
+
settings.tint,
|
|
772
|
+
(value) => props.onPatch({ tint: value }),
|
|
804
773
|
),
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
}),
|
|
774
|
+
),
|
|
775
|
+
row(
|
|
776
|
+
t('settings.dueFormat'),
|
|
777
|
+
seg(
|
|
778
|
+
[
|
|
779
|
+
['date', t('settings.dueFormat.date')],
|
|
780
|
+
['countdown', t('settings.dueFormat.countdown')],
|
|
781
|
+
],
|
|
782
|
+
settings.dueFormat,
|
|
783
|
+
(value) => props.onPatch({ dueFormat: value }),
|
|
816
784
|
),
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
785
|
+
),
|
|
786
|
+
row(
|
|
787
|
+
t('settings.titleStyle'),
|
|
788
|
+
seg(
|
|
789
|
+
[
|
|
790
|
+
['wrap', t('settings.titleStyle.wrap')],
|
|
791
|
+
['truncate', t('settings.titleStyle.truncate')],
|
|
792
|
+
],
|
|
793
|
+
settings.titleStyle,
|
|
794
|
+
(value) => props.onPatch({ titleStyle: value }),
|
|
820
795
|
),
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
796
|
+
),
|
|
797
|
+
row(
|
|
798
|
+
t('settings.navLabel'),
|
|
799
|
+
h('input', {
|
|
800
|
+
className: 'ez-text-field',
|
|
801
|
+
type: 'text',
|
|
802
|
+
value: settings.navLabel,
|
|
803
|
+
maxLength: 24,
|
|
804
|
+
placeholder: t('settings.navLabel.placeholder'),
|
|
805
|
+
'aria-label': t('settings.navLabel'),
|
|
806
|
+
onChange: (event) => props.onPatch({ navLabel: event.target.value }),
|
|
807
|
+
}),
|
|
808
|
+
),
|
|
809
|
+
row(
|
|
810
|
+
t('settings.radius'),
|
|
811
|
+
slider(t('settings.radius'), settings.radius, 0, 24, 2, (value) => props.onPatch({ radius: value })),
|
|
812
|
+
),
|
|
813
|
+
row(
|
|
814
|
+
t('settings.fontSize'),
|
|
815
|
+
slider(t('settings.fontSize'), settings.fontSize, 11, 17, 1, (value) => props.onPatch({ fontSize: value })),
|
|
816
|
+
h(
|
|
817
|
+
'button',
|
|
818
|
+
{ type: 'button', className: 'ez-reset ez-reset--inline', onClick: props.onReset },
|
|
819
|
+
t('settings.reset'),
|
|
829
820
|
),
|
|
821
|
+
),
|
|
822
|
+
h(
|
|
823
|
+
'footer',
|
|
824
|
+
{ className: 'ez-set-about' },
|
|
825
|
+
aboutLink(ISSUES_URL, ChatGlyph, t('settings.about.issues')),
|
|
830
826
|
h(
|
|
831
|
-
'
|
|
832
|
-
{ className: 'ez-
|
|
833
|
-
|
|
827
|
+
'span',
|
|
828
|
+
{ className: 'ez-about-dev' },
|
|
829
|
+
h('span', { className: 'ez-about-dev-label' }, t('settings.about.developed')),
|
|
830
|
+
h('img', {
|
|
831
|
+
className: 'ez-about-avatar',
|
|
832
|
+
src: 'https://github.com/' + AUTHOR_NAME + '.png?size=32',
|
|
833
|
+
alt: '',
|
|
834
|
+
width: 16,
|
|
835
|
+
height: 16,
|
|
836
|
+
loading: 'lazy',
|
|
837
|
+
draggable: false,
|
|
838
|
+
onError: (event) => {
|
|
839
|
+
event.currentTarget.style.display = 'none';
|
|
840
|
+
},
|
|
841
|
+
}),
|
|
834
842
|
h(
|
|
835
|
-
'
|
|
836
|
-
{
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
draggable: false,
|
|
846
|
-
onError: (event) => {
|
|
847
|
-
event.currentTarget.style.display = 'none';
|
|
848
|
-
},
|
|
849
|
-
}),
|
|
850
|
-
h(
|
|
851
|
-
'a',
|
|
852
|
-
{
|
|
853
|
-
className: 'ez-about-link ez-about-dev-name',
|
|
854
|
-
href: AUTHOR_URL,
|
|
855
|
-
target: '_blank',
|
|
856
|
-
rel: 'noreferrer noopener',
|
|
857
|
-
title: AUTHOR_NAME + ' · ' + AUTHOR_URL,
|
|
858
|
-
'aria-label': AUTHOR_NAME + ' · ' + AUTHOR_URL,
|
|
859
|
-
},
|
|
860
|
-
AUTHOR_NAME,
|
|
861
|
-
),
|
|
843
|
+
'a',
|
|
844
|
+
{
|
|
845
|
+
className: 'ez-about-link ez-about-dev-name',
|
|
846
|
+
href: AUTHOR_URL,
|
|
847
|
+
target: '_blank',
|
|
848
|
+
rel: 'noreferrer noopener',
|
|
849
|
+
title: AUTHOR_NAME + ' · ' + AUTHOR_URL,
|
|
850
|
+
'aria-label': AUTHOR_NAME + ' · ' + AUTHOR_URL,
|
|
851
|
+
},
|
|
852
|
+
AUTHOR_NAME,
|
|
862
853
|
),
|
|
863
854
|
),
|
|
864
|
-
)
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
/** Leave edit mode; `save` false means the gesture was cancelled. */
|
|
896
|
-
const settleEdit = (save) => {
|
|
897
|
-
if (editSettledRef.current) return;
|
|
898
|
-
editSettledRef.current = true;
|
|
899
|
-
setEditing(false);
|
|
900
|
-
const value = draftTitle.trim();
|
|
901
|
-
if (!save || value === '' || value === todo.title) return;
|
|
902
|
-
props.onPatch(todo.id, { title: value });
|
|
903
|
-
};
|
|
904
|
-
// Tooltip lead: the date state when it is meaningful, otherwise the date
|
|
905
|
-
// itself. Falling back to "set due date" here duplicated the action text.
|
|
906
|
-
const dueLabel =
|
|
907
|
-
dueState === 'overdue'
|
|
908
|
-
? t('item.due.overdue')
|
|
909
|
-
: dueState === 'today'
|
|
910
|
-
? t('item.due.today')
|
|
911
|
-
: formatDayKey(todo.dueDate);
|
|
912
|
-
const anchor = 'row-' + todo.id;
|
|
913
|
-
const hasDue = todo.dueDate !== null && todo.dueDate !== undefined;
|
|
914
|
-
|
|
915
|
-
const dismissPicker = useCallback(() => setPickerOpen(false), []);
|
|
916
|
-
|
|
917
|
-
/** Open the shared calendar under the clicked control; a second click closes it. */
|
|
918
|
-
const togglePicker = (event) => {
|
|
919
|
-
if (pickerOpen) {
|
|
920
|
-
setPickerOpen(false);
|
|
921
|
-
return;
|
|
922
|
-
}
|
|
923
|
-
setDraftDue(hasDue ? todo.dueDate : '');
|
|
924
|
-
setPickerPos(panelPositionFor(event.currentTarget.getBoundingClientRect()));
|
|
925
|
-
setPickerOpen(true);
|
|
926
|
-
};
|
|
855
|
+
),
|
|
856
|
+
);
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
/** One open todo row: checkbox, title, due-date mark, hover actions, drag handle. */
|
|
860
|
+
function TodoRow(props) {
|
|
861
|
+
const todo = props.todo;
|
|
862
|
+
const t = props.t;
|
|
863
|
+
const [pickerOpen, setPickerOpen] = useState(false);
|
|
864
|
+
const [pickerPos, setPickerPos] = useState(null);
|
|
865
|
+
const [draftDue, setDraftDue] = useState('');
|
|
866
|
+
const [editing, setEditing] = useState(false);
|
|
867
|
+
const [draftTitle, setDraftTitle] = useState(todo.title);
|
|
868
|
+
const editInputRef = useRef(null);
|
|
869
|
+
// Enter, Escape and blur can all fire for one gesture; settle only once.
|
|
870
|
+
const editSettledRef = useRef(false);
|
|
871
|
+
const dueState = dueStateOf(todo.dueDate);
|
|
872
|
+
|
|
873
|
+
useEffect(() => {
|
|
874
|
+
const input = editInputRef.current;
|
|
875
|
+
if (!editing || input === null) return;
|
|
876
|
+
input.focus();
|
|
877
|
+
const end = input.value.length;
|
|
878
|
+
input.setSelectionRange(end, end);
|
|
879
|
+
}, [editing]);
|
|
880
|
+
|
|
881
|
+
const startEdit = () => {
|
|
882
|
+
editSettledRef.current = false;
|
|
883
|
+
setDraftTitle(todo.title);
|
|
884
|
+
setEditing(true);
|
|
885
|
+
};
|
|
927
886
|
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
887
|
+
/** Leave edit mode; `save` false means the gesture was cancelled. */
|
|
888
|
+
const settleEdit = (save) => {
|
|
889
|
+
if (editSettledRef.current) return;
|
|
890
|
+
editSettledRef.current = true;
|
|
891
|
+
setEditing(false);
|
|
892
|
+
const value = draftTitle.trim();
|
|
893
|
+
if (!save || value === '' || value === todo.title) return;
|
|
894
|
+
props.onPatch(todo.id, { title: value });
|
|
895
|
+
};
|
|
896
|
+
// Tooltip lead: the date state when it is meaningful, otherwise the date
|
|
897
|
+
// itself. Falling back to "set due date" here duplicated the action text.
|
|
898
|
+
const dueLabel =
|
|
899
|
+
dueState === 'overdue'
|
|
900
|
+
? t('item.due.overdue')
|
|
901
|
+
: dueState === 'today'
|
|
902
|
+
? t('item.due.today')
|
|
903
|
+
: formatDayKey(todo.dueDate);
|
|
904
|
+
const anchor = 'row-' + todo.id;
|
|
905
|
+
const hasDue = todo.dueDate !== null && todo.dueDate !== undefined;
|
|
906
|
+
|
|
907
|
+
const dismissPicker = useCallback(() => setPickerOpen(false), []);
|
|
908
|
+
|
|
909
|
+
/** Open the shared calendar under the clicked control; a second click closes it. */
|
|
910
|
+
const togglePicker = (event) => {
|
|
911
|
+
if (pickerOpen) {
|
|
912
|
+
setPickerOpen(false);
|
|
913
|
+
return;
|
|
914
|
+
}
|
|
915
|
+
setDraftDue(hasDue ? todo.dueDate : '');
|
|
916
|
+
setPickerPos(panelPositionFor(event.currentTarget.getBoundingClientRect()));
|
|
917
|
+
setPickerOpen(true);
|
|
918
|
+
};
|
|
933
919
|
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
920
|
+
const className =
|
|
921
|
+
'ez-row' +
|
|
922
|
+
(props.dragging ? ' is-dragging' : '') +
|
|
923
|
+
(props.dropBefore ? ' is-drop-before' : '') +
|
|
924
|
+
(dueState === 'overdue' ? ' is-overdue' : '');
|
|
925
|
+
|
|
926
|
+
return h(
|
|
927
|
+
'li',
|
|
928
|
+
{
|
|
929
|
+
className,
|
|
930
|
+
draggable: !editing,
|
|
931
|
+
'data-todo-id': todo.id,
|
|
932
|
+
title: t('item.drag'),
|
|
933
|
+
onDragStart: (event) => {
|
|
934
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
935
|
+
event.dataTransfer.setData('text/plain', todo.id);
|
|
936
|
+
props.onDragStart(todo.id);
|
|
947
937
|
},
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
onDragStart: (event) => event.preventDefault(),
|
|
978
|
-
})
|
|
979
|
-
: h(
|
|
980
|
-
'span',
|
|
981
|
-
{ className: 'ez-title', title: todo.title + ' · ' + t('item.edit'), onDoubleClick: startEdit },
|
|
982
|
-
todo.title,
|
|
983
|
-
),
|
|
984
|
-
h(
|
|
985
|
-
'div',
|
|
986
|
-
{ className: 'ez-actions' },
|
|
987
|
-
// A due date that exists is edited through its own mark, so the
|
|
988
|
-
// calendar button only appears as the entry point when there is none.
|
|
989
|
-
hasDue
|
|
990
|
-
? null
|
|
991
|
-
: h(
|
|
992
|
-
MiniButton,
|
|
993
|
-
{
|
|
994
|
-
label: t('item.due.set'),
|
|
995
|
-
anchor,
|
|
996
|
-
expanded: pickerOpen,
|
|
997
|
-
onClick: togglePicker,
|
|
998
|
-
},
|
|
999
|
-
h(CalendarGlyph),
|
|
1000
|
-
),
|
|
1001
|
-
h(
|
|
1002
|
-
MiniButton,
|
|
1003
|
-
{
|
|
1004
|
-
active: todo.important === true,
|
|
1005
|
-
label: t('flag.important'),
|
|
1006
|
-
onClick: () => props.onPatch(todo.id, { important: !todo.important }),
|
|
1007
|
-
},
|
|
1008
|
-
h(FlagGlyph),
|
|
1009
|
-
),
|
|
1010
|
-
h(
|
|
1011
|
-
MiniButton,
|
|
1012
|
-
{
|
|
1013
|
-
active: todo.urgent === true,
|
|
1014
|
-
label: t('flag.urgent'),
|
|
1015
|
-
onClick: () => props.onPatch(todo.id, { urgent: !todo.urgent }),
|
|
938
|
+
onDragEnd: () => props.onDragEnd(),
|
|
939
|
+
},
|
|
940
|
+
h('input', {
|
|
941
|
+
className: 'ez-check',
|
|
942
|
+
type: 'checkbox',
|
|
943
|
+
checked: false,
|
|
944
|
+
title: t('item.complete'),
|
|
945
|
+
'aria-label': t('item.complete'),
|
|
946
|
+
onChange: () => props.onToggle(todo.id),
|
|
947
|
+
}),
|
|
948
|
+
editing
|
|
949
|
+
? h('input', {
|
|
950
|
+
className: 'ez-title-input',
|
|
951
|
+
ref: editInputRef,
|
|
952
|
+
type: 'text',
|
|
953
|
+
value: draftTitle,
|
|
954
|
+
maxLength: 200,
|
|
955
|
+
title: t('item.edit'),
|
|
956
|
+
'aria-label': t('item.edit'),
|
|
957
|
+
onChange: (event) => setDraftTitle(event.target.value),
|
|
958
|
+
onKeyDown: (event) => {
|
|
959
|
+
event.stopPropagation();
|
|
960
|
+
if (event.key === 'Enter') {
|
|
961
|
+
event.preventDefault();
|
|
962
|
+
settleEdit(true);
|
|
963
|
+
} else if (event.key === 'Escape') {
|
|
964
|
+
event.preventDefault();
|
|
965
|
+
settleEdit(false);
|
|
966
|
+
}
|
|
1016
967
|
},
|
|
1017
|
-
|
|
968
|
+
onBlur: () => settleEdit(true),
|
|
969
|
+
onDragStart: (event) => event.preventDefault(),
|
|
970
|
+
})
|
|
971
|
+
: h(
|
|
972
|
+
'span',
|
|
973
|
+
{ className: 'ez-title', title: todo.title + ' · ' + t('item.edit'), onDoubleClick: startEdit },
|
|
974
|
+
todo.title,
|
|
1018
975
|
),
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
//
|
|
976
|
+
h(
|
|
977
|
+
'div',
|
|
978
|
+
{ className: 'ez-actions' },
|
|
979
|
+
// A due date that exists is edited through its own mark, so the
|
|
980
|
+
// calendar button only appears as the entry point when there is none.
|
|
1023
981
|
hasDue
|
|
1024
|
-
?
|
|
1025
|
-
|
|
982
|
+
? null
|
|
983
|
+
: h(
|
|
984
|
+
MiniButton,
|
|
1026
985
|
{
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
'aria-label': dueLabel + ' · ' + t('item.due.set'),
|
|
1031
|
-
'data-ez-date-anchor': anchor,
|
|
1032
|
-
'aria-haspopup': 'dialog',
|
|
1033
|
-
'aria-expanded': pickerOpen,
|
|
986
|
+
label: t('item.due.set'),
|
|
987
|
+
anchor,
|
|
988
|
+
expanded: pickerOpen,
|
|
1034
989
|
onClick: togglePicker,
|
|
1035
|
-
onDoubleClick: () => setPickerOpen(false),
|
|
1036
|
-
},
|
|
1037
|
-
props.dueFormat === 'countdown' ? formatCountdown(todo.dueDate) : formatDayKey(todo.dueDate),
|
|
1038
|
-
)
|
|
1039
|
-
: null,
|
|
1040
|
-
pickerOpen && pickerPos !== null
|
|
1041
|
-
? h(DatePickerPanel, {
|
|
1042
|
-
t,
|
|
1043
|
-
value: draftDue,
|
|
1044
|
-
anchor,
|
|
1045
|
-
style: { left: pickerPos.left + 'px', top: pickerPos.top + 'px' },
|
|
1046
|
-
onPick: setDraftDue,
|
|
1047
|
-
onCommit: (key) => {
|
|
1048
|
-
setPickerOpen(false);
|
|
1049
|
-
props.onDue(todo.id, key);
|
|
1050
|
-
},
|
|
1051
|
-
onClear: () => {
|
|
1052
|
-
setPickerOpen(false);
|
|
1053
|
-
props.onDue(todo.id, null);
|
|
1054
990
|
},
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
: null,
|
|
1058
|
-
);
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
/** One completed todo row: checked box, struck title, completion day, restore/delete. */
|
|
1062
|
-
function CompletedRow(props) {
|
|
1063
|
-
const todo = props.todo;
|
|
1064
|
-
const t = props.t;
|
|
1065
|
-
return h(
|
|
1066
|
-
'li',
|
|
1067
|
-
{ className: 'ez-row ez-row--done' },
|
|
1068
|
-
h('input', {
|
|
1069
|
-
className: 'ez-check',
|
|
1070
|
-
type: 'checkbox',
|
|
1071
|
-
checked: true,
|
|
1072
|
-
title: t('item.restore'),
|
|
1073
|
-
'aria-label': t('item.restore'),
|
|
1074
|
-
onChange: () => props.onToggle(todo.id),
|
|
1075
|
-
}),
|
|
1076
|
-
h('span', { className: 'ez-title ez-title--done', title: todo.title }, todo.title),
|
|
1077
|
-
h('span', { className: 'ez-date' }, formatDay(todo.completedAt ?? todo.updatedAt)),
|
|
991
|
+
h(CalendarGlyph),
|
|
992
|
+
),
|
|
1078
993
|
h(
|
|
1079
|
-
|
|
1080
|
-
{
|
|
1081
|
-
|
|
1082
|
-
|
|
994
|
+
MiniButton,
|
|
995
|
+
{
|
|
996
|
+
active: todo.important === true,
|
|
997
|
+
label: t('flag.important'),
|
|
998
|
+
onClick: () => props.onPatch(todo.id, { important: !todo.important }),
|
|
999
|
+
},
|
|
1000
|
+
h(FlagGlyph),
|
|
1083
1001
|
),
|
|
1084
|
-
|
|
1085
|
-
|
|
1002
|
+
h(
|
|
1003
|
+
MiniButton,
|
|
1004
|
+
{
|
|
1005
|
+
active: todo.urgent === true,
|
|
1006
|
+
label: t('flag.urgent'),
|
|
1007
|
+
onClick: () => props.onPatch(todo.id, { urgent: !todo.urgent }),
|
|
1008
|
+
},
|
|
1009
|
+
h(BoltGlyph),
|
|
1010
|
+
),
|
|
1011
|
+
h(MiniButton, { label: t('item.delete'), onClick: () => props.onRemove(todo.id) }, h(CloseGlyph)),
|
|
1012
|
+
),
|
|
1013
|
+
// The due mark is the last child so it always sits flush with the row's
|
|
1014
|
+
// right edge, whether or not the hover actions are occupying space.
|
|
1015
|
+
hasDue
|
|
1016
|
+
? h(
|
|
1017
|
+
'button',
|
|
1018
|
+
{
|
|
1019
|
+
type: 'button',
|
|
1020
|
+
className: 'ez-due ez-due--' + dueState,
|
|
1021
|
+
title: dueLabel + ' · ' + t('item.due.set'),
|
|
1022
|
+
'aria-label': dueLabel + ' · ' + t('item.due.set'),
|
|
1023
|
+
'data-ez-date-anchor': anchor,
|
|
1024
|
+
'aria-haspopup': 'dialog',
|
|
1025
|
+
'aria-expanded': pickerOpen,
|
|
1026
|
+
onClick: togglePicker,
|
|
1027
|
+
onDoubleClick: () => setPickerOpen(false),
|
|
1028
|
+
},
|
|
1029
|
+
props.dueFormat === 'countdown' ? formatCountdown(todo.dueDate) : formatDayKey(todo.dueDate),
|
|
1030
|
+
)
|
|
1031
|
+
: null,
|
|
1032
|
+
pickerOpen && pickerPos !== null
|
|
1033
|
+
? h(DatePickerPanel, {
|
|
1034
|
+
t,
|
|
1035
|
+
value: draftDue,
|
|
1036
|
+
anchor,
|
|
1037
|
+
style: { left: pickerPos.left + 'px', top: pickerPos.top + 'px' },
|
|
1038
|
+
onPick: setDraftDue,
|
|
1039
|
+
onCommit: (key) => {
|
|
1040
|
+
setPickerOpen(false);
|
|
1041
|
+
props.onDue(todo.id, key);
|
|
1042
|
+
},
|
|
1043
|
+
onClear: () => {
|
|
1044
|
+
setPickerOpen(false);
|
|
1045
|
+
props.onDue(todo.id, null);
|
|
1046
|
+
},
|
|
1047
|
+
onDismiss: dismissPicker,
|
|
1048
|
+
})
|
|
1049
|
+
: null,
|
|
1050
|
+
);
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
/** One completed todo row: checked box, struck title, completion day, restore/delete. */
|
|
1054
|
+
function CompletedRow(props) {
|
|
1055
|
+
const todo = props.todo;
|
|
1056
|
+
const t = props.t;
|
|
1057
|
+
return h(
|
|
1058
|
+
'li',
|
|
1059
|
+
{ className: 'ez-row ez-row--done' },
|
|
1060
|
+
h('input', {
|
|
1061
|
+
className: 'ez-check',
|
|
1062
|
+
type: 'checkbox',
|
|
1063
|
+
checked: true,
|
|
1064
|
+
title: t('item.restore'),
|
|
1065
|
+
'aria-label': t('item.restore'),
|
|
1066
|
+
onChange: () => props.onToggle(todo.id),
|
|
1067
|
+
}),
|
|
1068
|
+
h('span', { className: 'ez-title ez-title--done', title: todo.title }, todo.title),
|
|
1069
|
+
h('span', { className: 'ez-date' }, formatDay(todo.completedAt ?? todo.updatedAt)),
|
|
1070
|
+
h(
|
|
1071
|
+
'div',
|
|
1072
|
+
{ className: 'ez-actions' },
|
|
1073
|
+
h(MiniButton, { label: t('item.restore'), onClick: () => props.onToggle(todo.id) }, h(RestoreGlyph)),
|
|
1074
|
+
h(MiniButton, { label: t('item.delete'), onClick: () => props.onRemove(todo.id) }, h(CloseGlyph)),
|
|
1075
|
+
),
|
|
1076
|
+
);
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/** One matrix cell: header, scrollable item list with drop support, and inline add. */
|
|
1080
|
+
function QuadrantCard(props) {
|
|
1081
|
+
const quadrant = props.quadrant;
|
|
1082
|
+
const t = props.t;
|
|
1083
|
+
const items = props.items;
|
|
1084
|
+
const [adding, setAdding] = useState(false);
|
|
1085
|
+
const [draft, setDraft] = useState('');
|
|
1086
|
+
const [draftDue, setDraftDue] = useState('');
|
|
1087
|
+
const [pickerOpen, setPickerOpen] = useState(false);
|
|
1088
|
+
const [pickerPos, setPickerPos] = useState(null);
|
|
1089
|
+
const inputRef = useRef(null);
|
|
1090
|
+
const dateButtonRef = useRef(null);
|
|
1091
|
+
const pendingRef = useRef(false);
|
|
1092
|
+
const pickerOpenRef = useRef(false);
|
|
1093
|
+
|
|
1094
|
+
const name = t('quadrant.' + quadrant.id);
|
|
1095
|
+
|
|
1096
|
+
useEffect(() => {
|
|
1097
|
+
pickerOpenRef.current = pickerOpen;
|
|
1098
|
+
}, [pickerOpen]);
|
|
1099
|
+
|
|
1100
|
+
useEffect(() => {
|
|
1101
|
+
if (adding && inputRef.current !== null) inputRef.current.focus();
|
|
1102
|
+
}, [adding]);
|
|
1103
|
+
|
|
1104
|
+
const start = () => {
|
|
1105
|
+
setDraft('');
|
|
1106
|
+
setDraftDue('');
|
|
1107
|
+
setPickerOpen(false);
|
|
1108
|
+
setAdding(true);
|
|
1109
|
+
};
|
|
1086
1110
|
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
const [draft, setDraft] = useState('');
|
|
1094
|
-
const [draftDue, setDraftDue] = useState('');
|
|
1095
|
-
const [pickerOpen, setPickerOpen] = useState(false);
|
|
1096
|
-
const [pickerPos, setPickerPos] = useState(null);
|
|
1097
|
-
const inputRef = useRef(null);
|
|
1098
|
-
const dateButtonRef = useRef(null);
|
|
1099
|
-
const pendingRef = useRef(false);
|
|
1100
|
-
const pickerOpenRef = useRef(false);
|
|
1101
|
-
|
|
1102
|
-
const name = t('quadrant.' + quadrant.id);
|
|
1103
|
-
|
|
1104
|
-
useEffect(() => {
|
|
1105
|
-
pickerOpenRef.current = pickerOpen;
|
|
1106
|
-
}, [pickerOpen]);
|
|
1107
|
-
|
|
1108
|
-
useEffect(() => {
|
|
1109
|
-
if (adding && inputRef.current !== null) inputRef.current.focus();
|
|
1110
|
-
}, [adding]);
|
|
1111
|
-
|
|
1112
|
-
const start = () => {
|
|
1113
|
-
setDraft('');
|
|
1114
|
-
setDraftDue('');
|
|
1115
|
-
setPickerOpen(false);
|
|
1116
|
-
setAdding(true);
|
|
1117
|
-
};
|
|
1111
|
+
const stop = () => {
|
|
1112
|
+
setAdding(false);
|
|
1113
|
+
setDraft('');
|
|
1114
|
+
setDraftDue('');
|
|
1115
|
+
setPickerOpen(false);
|
|
1116
|
+
};
|
|
1118
1117
|
|
|
1119
|
-
|
|
1120
|
-
|
|
1118
|
+
/**
|
|
1119
|
+
* Create the to-do with an explicit due date (empty string means none).
|
|
1120
|
+
* Guarded by a ref so a fast double Enter or a double-click cannot create
|
|
1121
|
+
* two rows from one draft.
|
|
1122
|
+
*/
|
|
1123
|
+
const submitWithDate = async (dueValue) => {
|
|
1124
|
+
const value = draft.trim();
|
|
1125
|
+
if (value === '' || pendingRef.current) return false;
|
|
1126
|
+
pendingRef.current = true;
|
|
1127
|
+
const ok = await props.onAdd(quadrant, value, dueValue === '' ? null : dueValue);
|
|
1128
|
+
pendingRef.current = false;
|
|
1129
|
+
if (ok) {
|
|
1121
1130
|
setDraft('');
|
|
1122
1131
|
setDraftDue('');
|
|
1123
1132
|
setPickerOpen(false);
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
* Guarded by a ref so a fast double Enter or a double-click cannot create
|
|
1129
|
-
* two rows from one draft.
|
|
1130
|
-
*/
|
|
1131
|
-
const submitWithDate = async (dueValue) => {
|
|
1132
|
-
const value = draft.trim();
|
|
1133
|
-
if (value === '' || pendingRef.current) return false;
|
|
1134
|
-
pendingRef.current = true;
|
|
1135
|
-
const ok = await props.onAdd(quadrant, value, dueValue === '' ? null : dueValue);
|
|
1136
|
-
pendingRef.current = false;
|
|
1137
|
-
if (ok) {
|
|
1138
|
-
setDraft('');
|
|
1139
|
-
setDraftDue('');
|
|
1140
|
-
setPickerOpen(false);
|
|
1141
|
-
if (inputRef.current !== null) inputRef.current.focus();
|
|
1142
|
-
}
|
|
1143
|
-
return ok;
|
|
1144
|
-
};
|
|
1133
|
+
if (inputRef.current !== null) inputRef.current.focus();
|
|
1134
|
+
}
|
|
1135
|
+
return ok;
|
|
1136
|
+
};
|
|
1145
1137
|
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1138
|
+
const submit = (event) => {
|
|
1139
|
+
if (event !== undefined) event.preventDefault();
|
|
1140
|
+
void submitWithDate(draftDue);
|
|
1141
|
+
};
|
|
1150
1142
|
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1143
|
+
/** Toggle the calendar: anchored to the button, flipped up when space runs out. */
|
|
1144
|
+
const togglePicker = (event) => {
|
|
1145
|
+
if (pickerOpen) {
|
|
1146
|
+
setPickerOpen(false);
|
|
1147
|
+
return;
|
|
1148
|
+
}
|
|
1149
|
+
setPickerPos(panelPositionFor(event.currentTarget.getBoundingClientRect()));
|
|
1150
|
+
setPickerOpen(true);
|
|
1151
|
+
};
|
|
1160
1152
|
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1153
|
+
/** Single click previews; double-click confirms, closes, and adds the to-do. */
|
|
1154
|
+
const commitDate = (key) => {
|
|
1155
|
+
setDraftDue(key);
|
|
1156
|
+
if (draft.trim() === '') {
|
|
1157
|
+
setPickerOpen(false);
|
|
1158
|
+
return;
|
|
1159
|
+
}
|
|
1160
|
+
void submitWithDate(key);
|
|
1161
|
+
};
|
|
1170
1162
|
|
|
1171
|
-
|
|
1172
|
-
|
|
1163
|
+
/** Stable dismiss so the panel's document listeners are not rebound each render. */
|
|
1164
|
+
const dismissPicker = useCallback(() => setPickerOpen(false), []);
|
|
1173
1165
|
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1166
|
+
/** Clicking empty space in the cell opens (or refocuses) the inline input. */
|
|
1167
|
+
const onListClick = (event) => {
|
|
1168
|
+
if (event.target !== event.currentTarget) return;
|
|
1169
|
+
if (adding) {
|
|
1170
|
+
if (inputRef.current !== null) inputRef.current.focus();
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
start();
|
|
1174
|
+
};
|
|
1183
1175
|
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1176
|
+
/**
|
|
1177
|
+
* The row the dragged item should be inserted above, decided by comparing
|
|
1178
|
+
* the pointer against each row's vertical midpoint. Null means "at the end".
|
|
1179
|
+
*/
|
|
1180
|
+
const beforeIdAt = (list, clientY) => {
|
|
1181
|
+
const rows = list.querySelectorAll('[data-todo-id]');
|
|
1182
|
+
for (const row of rows) {
|
|
1183
|
+
const rect = row.getBoundingClientRect();
|
|
1184
|
+
if (clientY < rect.top + rect.height / 2) return row.dataset.todoId;
|
|
1185
|
+
}
|
|
1186
|
+
return null;
|
|
1187
|
+
};
|
|
1196
1188
|
|
|
1197
|
-
|
|
1189
|
+
const dropActive = props.dropTarget !== null && props.dropTarget.quadrantId === quadrant.id;
|
|
1198
1190
|
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
},
|
|
1222
|
-
onDrop: (event) => {
|
|
1223
|
-
if (props.dragId === null) return;
|
|
1224
|
-
event.preventDefault();
|
|
1225
|
-
props.onMove(quadrant, beforeIdAt(event.currentTarget, event.clientY));
|
|
1226
|
-
},
|
|
1191
|
+
return h(
|
|
1192
|
+
'section',
|
|
1193
|
+
{ className: dropActive ? 'ez-quad ez-quad--' + quadrant.id + ' is-drop-target' : 'ez-quad ez-quad--' + quadrant.id, 'aria-label': name },
|
|
1194
|
+
h(
|
|
1195
|
+
'header',
|
|
1196
|
+
{ className: 'ez-quad-head' },
|
|
1197
|
+
h('span', { className: 'ez-dot', 'aria-hidden': 'true' }),
|
|
1198
|
+
h('h2', { className: 'ez-quad-name' }, name),
|
|
1199
|
+
h('span', { className: 'ez-quad-hint' }, t('quadrant.' + quadrant.id + '.hint')),
|
|
1200
|
+
h('span', { className: 'ez-quad-count' }, String(items.length)),
|
|
1201
|
+
),
|
|
1202
|
+
h(
|
|
1203
|
+
'ul',
|
|
1204
|
+
{
|
|
1205
|
+
className:
|
|
1206
|
+
'ez-list' + (dropActive && props.dropTarget.beforeId === null && items.length > 0 ? ' is-drop-end' : ''),
|
|
1207
|
+
onClick: onListClick,
|
|
1208
|
+
onDragOver: (event) => {
|
|
1209
|
+
if (props.dragId === null) return;
|
|
1210
|
+
event.preventDefault();
|
|
1211
|
+
event.dataTransfer.dropEffect = 'move';
|
|
1212
|
+
props.onDragOver(quadrant.id, beforeIdAt(event.currentTarget, event.clientY));
|
|
1227
1213
|
},
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1214
|
+
onDrop: (event) => {
|
|
1215
|
+
if (props.dragId === null) return;
|
|
1216
|
+
event.preventDefault();
|
|
1217
|
+
props.onMove(quadrant, beforeIdAt(event.currentTarget, event.clientY));
|
|
1218
|
+
},
|
|
1219
|
+
},
|
|
1220
|
+
items.map((todo) =>
|
|
1221
|
+
h(TodoRow, {
|
|
1222
|
+
key: todo.id,
|
|
1223
|
+
todo,
|
|
1224
|
+
t,
|
|
1225
|
+
onToggle: props.onToggle,
|
|
1226
|
+
onPatch: props.onPatch,
|
|
1227
|
+
onRemove: props.onRemove,
|
|
1228
|
+
onDue: props.onDue,
|
|
1229
|
+
dueFormat: props.dueFormat,
|
|
1230
|
+
dragging: props.dragId === todo.id,
|
|
1231
|
+
dropBefore: dropActive && props.dropTarget.beforeId === todo.id,
|
|
1232
|
+
onDragStart: props.onDragStart,
|
|
1233
|
+
onDragEnd: props.onDragEnd,
|
|
1234
|
+
}),
|
|
1244
1235
|
),
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
{
|
|
1275
|
-
key: 'due',
|
|
1276
|
-
ref: dateButtonRef,
|
|
1277
|
-
type: 'button',
|
|
1278
|
-
className:
|
|
1279
|
-
draftDue === '' ? 'ez-date-field ez-date-field--empty' : 'ez-date-field ez-date-field--set',
|
|
1280
|
-
title: draftDue === '' ? t('quickAdd.due') : formatDayKey(draftDue),
|
|
1281
|
-
'aria-label': t('quickAdd.due'),
|
|
1282
|
-
'aria-expanded': pickerOpen,
|
|
1283
|
-
'aria-haspopup': 'dialog',
|
|
1284
|
-
'data-ez-date-anchor': 'add-' + quadrant.id,
|
|
1285
|
-
onClick: togglePicker,
|
|
1286
|
-
},
|
|
1287
|
-
h(CalendarGlyph, { size: draftDue === '' ? 18 : 14 }),
|
|
1288
|
-
draftDue === '' ? null : h('span', { className: 'ez-date-field-text' }, formatDayKey(draftDue)),
|
|
1289
|
-
),
|
|
1290
|
-
]
|
|
1291
|
-
: h(
|
|
1236
|
+
),
|
|
1237
|
+
h(
|
|
1238
|
+
'form',
|
|
1239
|
+
{ className: 'ez-add-area', onSubmit: submit },
|
|
1240
|
+
adding
|
|
1241
|
+
? [
|
|
1242
|
+
h('input', {
|
|
1243
|
+
key: 'title',
|
|
1244
|
+
ref: inputRef,
|
|
1245
|
+
className: 'ez-add-input',
|
|
1246
|
+
type: 'text',
|
|
1247
|
+
value: draft,
|
|
1248
|
+
maxLength: 200,
|
|
1249
|
+
placeholder: t('quickAdd.placeholder'),
|
|
1250
|
+
'aria-label': t('quickAdd.placeholder'),
|
|
1251
|
+
onChange: (event) => setDraft(event.target.value),
|
|
1252
|
+
onKeyDown: (event) => {
|
|
1253
|
+
if (event.key === 'Escape') stop();
|
|
1254
|
+
},
|
|
1255
|
+
onBlur: (event) => {
|
|
1256
|
+
if (pickerOpenRef.current) return;
|
|
1257
|
+
const next = event.relatedTarget;
|
|
1258
|
+
if (next !== null && dateButtonRef.current !== null && dateButtonRef.current.contains(next)) {
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
if (draft.trim() === '' && draftDue === '') stop();
|
|
1262
|
+
},
|
|
1263
|
+
}),
|
|
1264
|
+
h(
|
|
1292
1265
|
'button',
|
|
1293
1266
|
{
|
|
1267
|
+
key: 'due',
|
|
1268
|
+
ref: dateButtonRef,
|
|
1294
1269
|
type: 'button',
|
|
1295
|
-
className:
|
|
1296
|
-
|
|
1297
|
-
|
|
1270
|
+
className:
|
|
1271
|
+
draftDue === '' ? 'ez-date-field ez-date-field--empty' : 'ez-date-field ez-date-field--set',
|
|
1272
|
+
title: draftDue === '' ? t('quickAdd.due') : formatDayKey(draftDue),
|
|
1273
|
+
'aria-label': t('quickAdd.due'),
|
|
1274
|
+
'aria-expanded': pickerOpen,
|
|
1275
|
+
'aria-haspopup': 'dialog',
|
|
1276
|
+
'data-ez-date-anchor': 'add-' + quadrant.id,
|
|
1277
|
+
onClick: togglePicker,
|
|
1298
1278
|
},
|
|
1299
|
-
h(
|
|
1300
|
-
|
|
1279
|
+
h(CalendarGlyph, { size: draftDue === '' ? 18 : 14 }),
|
|
1280
|
+
draftDue === '' ? null : h('span', { className: 'ez-date-field-text' }, formatDayKey(draftDue)),
|
|
1301
1281
|
),
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1282
|
+
]
|
|
1283
|
+
: h(
|
|
1284
|
+
'button',
|
|
1285
|
+
{
|
|
1286
|
+
type: 'button',
|
|
1287
|
+
className: 'ez-quick-add',
|
|
1288
|
+
title: t('quickAdd'),
|
|
1289
|
+
onClick: start,
|
|
1290
|
+
},
|
|
1291
|
+
h('span', { className: 'ez-quick-plus', 'aria-hidden': 'true' }, '+'),
|
|
1292
|
+
t('quickAdd'),
|
|
1293
|
+
),
|
|
1294
|
+
),
|
|
1295
|
+
pickerOpen && pickerPos !== null
|
|
1296
|
+
? h(DatePickerPanel, {
|
|
1297
|
+
t,
|
|
1298
|
+
value: draftDue,
|
|
1299
|
+
anchor: 'add-' + quadrant.id,
|
|
1300
|
+
style: { left: pickerPos.left + 'px', top: pickerPos.top + 'px' },
|
|
1301
|
+
onPick: setDraftDue,
|
|
1302
|
+
onCommit: commitDate,
|
|
1303
|
+
onClear: () => setDraftDue(''),
|
|
1304
|
+
onDismiss: dismissPicker,
|
|
1305
|
+
})
|
|
1306
|
+
: null,
|
|
1307
|
+
);
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
/** The completed list plus its guarded "clear" control. */
|
|
1311
|
+
function CompletedList(props) {
|
|
1312
|
+
const t = props.t;
|
|
1313
|
+
const items = props.items;
|
|
1314
|
+
const [confirming, setConfirming] = useState(false);
|
|
1315
|
+
|
|
1316
|
+
useEffect(() => {
|
|
1317
|
+
if (!confirming) return undefined;
|
|
1318
|
+
const timer = window.setTimeout(() => setConfirming(false), 3200);
|
|
1319
|
+
return () => window.clearTimeout(timer);
|
|
1320
|
+
}, [confirming]);
|
|
1321
|
+
|
|
1322
|
+
const clear = () => {
|
|
1323
|
+
if (!confirming) {
|
|
1324
|
+
setConfirming(true);
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
setConfirming(false);
|
|
1328
|
+
props.onClear();
|
|
1329
|
+
};
|
|
1338
1330
|
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
? h(
|
|
1349
|
-
'button',
|
|
1350
|
-
{ type: 'button', className: confirming ? 'ez-clear is-confirming' : 'ez-clear', onClick: clear },
|
|
1351
|
-
t(confirming ? 'completed.confirm' : 'completed.clear'),
|
|
1352
|
-
)
|
|
1353
|
-
: null,
|
|
1354
|
-
),
|
|
1355
|
-
items.length === 0
|
|
1331
|
+
return h(
|
|
1332
|
+
'section',
|
|
1333
|
+
{ className: 'ez-completed', 'aria-label': t('completed.heading') },
|
|
1334
|
+
h(
|
|
1335
|
+
'header',
|
|
1336
|
+
{ className: 'ez-completed-head' },
|
|
1337
|
+
h('h2', { className: 'ez-completed-title' }, t('completed.heading')),
|
|
1338
|
+
h('span', { className: 'ez-completed-count' }, String(items.length)),
|
|
1339
|
+
items.length > 0
|
|
1356
1340
|
? h(
|
|
1357
|
-
'
|
|
1358
|
-
{ className: 'ez-
|
|
1359
|
-
|
|
1341
|
+
'button',
|
|
1342
|
+
{ type: 'button', className: confirming ? 'ez-clear is-confirming' : 'ez-clear', onClick: clear },
|
|
1343
|
+
t(confirming ? 'completed.confirm' : 'completed.clear'),
|
|
1360
1344
|
)
|
|
1361
|
-
:
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1345
|
+
: null,
|
|
1346
|
+
),
|
|
1347
|
+
items.length === 0
|
|
1348
|
+
? h(
|
|
1349
|
+
'div',
|
|
1350
|
+
{ className: 'ez-completed-body' },
|
|
1351
|
+
h('p', { className: 'ez-blank' }, t('empty.completed')),
|
|
1352
|
+
)
|
|
1353
|
+
: h(
|
|
1354
|
+
'ul',
|
|
1355
|
+
{ className: 'ez-list' },
|
|
1356
|
+
items.map((todo) =>
|
|
1357
|
+
h(CompletedRow, { key: todo.id, todo, t, onToggle: props.onToggle, onRemove: props.onRemove }),
|
|
1367
1358
|
),
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1359
|
+
),
|
|
1360
|
+
);
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
/** The main panel: header, settings, and the selected view. */
|
|
1364
|
+
function TodoPage(props) {
|
|
1365
|
+
const t = props.t;
|
|
1366
|
+
const localeSource = props.localeSource;
|
|
1367
|
+
const [todos, setTodos] = useState(null);
|
|
1368
|
+
const [settings, setSettings] = useState(DEFAULT_SETTINGS);
|
|
1369
|
+
const [settingsOpen, setSettingsOpen] = useState(false);
|
|
1370
|
+
const [loaded, setLoaded] = useState(false);
|
|
1371
|
+
const [error, setError] = useState(null);
|
|
1372
|
+
const [view, setView] = useState('matrix');
|
|
1373
|
+
const [dragId, setDragId] = useState(null);
|
|
1374
|
+
const [dropTarget, setDropTarget] = useState(null);
|
|
1375
|
+
const [toast, setToast] = useState(null);
|
|
1376
|
+
const [splitDragging, setSplitDragging] = useState(false);
|
|
1377
|
+
const [splitHot, setSplitHot] = useState(false);
|
|
1378
|
+
const matrixRef = useRef(null);
|
|
1379
|
+
const pageRef = useRef(null);
|
|
1380
|
+
const dropTargetRef = useRef(null);
|
|
1381
|
+
const toastTimer = useRef(null);
|
|
1382
|
+
const lastPraise = useRef({ praise: -1, cheer: -1 });
|
|
1383
|
+
|
|
1384
|
+
useSyncExternalStore(localeSource.subscribe, localeSource.getSnapshot);
|
|
1385
|
+
|
|
1386
|
+
/** Read a user-facing message off a thrown error, localizing transport failures. */
|
|
1387
|
+
const messageOf = useCallback(
|
|
1388
|
+
(err) => {
|
|
1389
|
+
const text = err && typeof err.message === 'string' ? err.message : '';
|
|
1390
|
+
if (text === '' || (err && err.name === 'TypeError')) return t('error.request');
|
|
1391
|
+
return text;
|
|
1392
|
+
},
|
|
1393
|
+
[t],
|
|
1394
|
+
);
|
|
1395
|
+
|
|
1396
|
+
// Layout preferences: local state updates immediately and the Host write is
|
|
1397
|
+
// debounced. `settingsDirty` guards against a concurrent todo response
|
|
1398
|
+
// (which also carries settings) overwriting an unsaved local change.
|
|
1399
|
+
const latestSettings = useRef(DEFAULT_SETTINGS);
|
|
1400
|
+
latestSettings.current = settings;
|
|
1401
|
+
const settingsDirty = useRef(false);
|
|
1402
|
+
const saveTimer = useRef(null);
|
|
1403
|
+
|
|
1404
|
+
const applyResult = useCallback((result) => {
|
|
1405
|
+
setTodos(Array.isArray(result.todos) ? result.todos : []);
|
|
1406
|
+
if (result.settings !== undefined && settingsDirty.current !== true) {
|
|
1407
|
+
const next = sanitizeSettings(result.settings);
|
|
1408
|
+
setSettings(next);
|
|
1409
|
+
if (typeof props.setNavLabel === 'function') props.setNavLabel(next.navLabel);
|
|
1410
|
+
}
|
|
1411
|
+
setError(null);
|
|
1412
|
+
}, [props.setNavLabel]);
|
|
1413
|
+
|
|
1414
|
+
const load = useCallback(async () => {
|
|
1415
|
+
try {
|
|
1416
|
+
applyResult(await fetchApi('list'));
|
|
1417
|
+
} catch (err) {
|
|
1418
|
+
setError(messageOf(err));
|
|
1419
|
+
setTodos((current) => (current === null ? [] : current));
|
|
1420
|
+
} finally {
|
|
1421
|
+
setLoaded(true);
|
|
1422
|
+
}
|
|
1423
|
+
}, [applyResult, messageOf]);
|
|
1403
1424
|
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
const latestSettings = useRef(DEFAULT_SETTINGS);
|
|
1408
|
-
latestSettings.current = settings;
|
|
1409
|
-
const settingsDirty = useRef(false);
|
|
1410
|
-
const saveTimer = useRef(null);
|
|
1411
|
-
|
|
1412
|
-
const applyResult = useCallback((result) => {
|
|
1413
|
-
setTodos(Array.isArray(result.todos) ? result.todos : []);
|
|
1414
|
-
if (result.settings !== undefined && settingsDirty.current !== true) {
|
|
1415
|
-
const next = sanitizeSettings(result.settings);
|
|
1416
|
-
setSettings(next);
|
|
1417
|
-
if (typeof props.setNavLabel === 'function') props.setNavLabel(next.navLabel);
|
|
1418
|
-
}
|
|
1419
|
-
setError(null);
|
|
1420
|
-
}, [props.setNavLabel]);
|
|
1425
|
+
useEffect(() => {
|
|
1426
|
+
void load();
|
|
1427
|
+
}, [load]);
|
|
1421
1428
|
|
|
1422
|
-
|
|
1429
|
+
const mutate = useCallback(
|
|
1430
|
+
async (method, payload) => {
|
|
1423
1431
|
try {
|
|
1424
|
-
applyResult(await fetchApi(
|
|
1432
|
+
applyResult(await fetchApi(method, payload));
|
|
1433
|
+
return true;
|
|
1425
1434
|
} catch (err) {
|
|
1426
1435
|
setError(messageOf(err));
|
|
1427
|
-
|
|
1428
|
-
} finally {
|
|
1429
|
-
setLoaded(true);
|
|
1436
|
+
return false;
|
|
1430
1437
|
}
|
|
1431
|
-
},
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1438
|
+
},
|
|
1439
|
+
[applyResult, messageOf],
|
|
1440
|
+
);
|
|
1441
|
+
|
|
1442
|
+
// Settings save: local state updates immediately, the Host is written once
|
|
1443
|
+
// after a short pause; a pending write is flushed when the panel closes.
|
|
1444
|
+
const commitSettings = useCallback(
|
|
1445
|
+
(patch) => {
|
|
1446
|
+
settingsDirty.current = true;
|
|
1447
|
+
setSettings((current) => ({ ...current, ...patch }));
|
|
1448
|
+
// The sidebar label is page chrome, so apply it without waiting for the
|
|
1449
|
+
// debounced save round trip.
|
|
1450
|
+
if (patch.navLabel !== undefined && typeof props.setNavLabel === 'function') {
|
|
1451
|
+
props.setNavLabel(patch.navLabel);
|
|
1452
|
+
}
|
|
1453
|
+
},
|
|
1454
|
+
[props.setNavLabel],
|
|
1455
|
+
);
|
|
1456
|
+
|
|
1457
|
+
useEffect(() => {
|
|
1458
|
+
if (!loaded || !settingsDirty.current) return undefined;
|
|
1459
|
+
if (saveTimer.current !== null) window.clearTimeout(saveTimer.current);
|
|
1460
|
+
saveTimer.current = window.setTimeout(() => {
|
|
1461
|
+
saveTimer.current = null;
|
|
1462
|
+
settingsDirty.current = false;
|
|
1463
|
+
void mutate('saveSettings', latestSettings.current);
|
|
1464
|
+
}, 350);
|
|
1465
|
+
return () => {
|
|
1466
|
+
if (saveTimer.current !== null) {
|
|
1467
|
+
window.clearTimeout(saveTimer.current);
|
|
1468
|
+
saveTimer.current = null;
|
|
1469
|
+
}
|
|
1470
|
+
};
|
|
1471
|
+
}, [settings, loaded, mutate]);
|
|
1464
1472
|
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
if (saveTimer.current !== null
|
|
1468
|
-
|
|
1473
|
+
useEffect(
|
|
1474
|
+
() => () => {
|
|
1475
|
+
if (saveTimer.current !== null && settingsDirty.current) {
|
|
1476
|
+
window.clearTimeout(saveTimer.current);
|
|
1469
1477
|
saveTimer.current = null;
|
|
1470
1478
|
settingsDirty.current = false;
|
|
1471
1479
|
void mutate('saveSettings', latestSettings.current);
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
void mutate('saveSettings', latestSettings.current);
|
|
1488
|
-
}
|
|
1489
|
-
},
|
|
1490
|
-
[mutate],
|
|
1491
|
-
);
|
|
1480
|
+
}
|
|
1481
|
+
},
|
|
1482
|
+
[mutate],
|
|
1483
|
+
);
|
|
1484
|
+
|
|
1485
|
+
const onAddToQuadrant = useCallback(
|
|
1486
|
+
(quadrant, title, dueDate) =>
|
|
1487
|
+
mutate('create', { title, important: quadrant.important, urgent: quadrant.urgent, dueDate }),
|
|
1488
|
+
[mutate],
|
|
1489
|
+
);
|
|
1490
|
+
const onDue = useCallback((id, dueDate) => mutate('update', { id, dueDate }), [mutate]);
|
|
1491
|
+
const onRemove = useCallback((id) => mutate('remove', { id }), [mutate]);
|
|
1492
|
+
const onPatch = useCallback((id, patch) => mutate('update', { id, ...patch }), [mutate]);
|
|
1493
|
+
const onClear = useCallback(() => mutate('clearCompleted', {}), [mutate]);
|
|
1494
|
+
const onResetSettings = useCallback(() => commitSettings({ ...DEFAULT_SETTINGS }), [commitSettings]);
|
|
1492
1495
|
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
const
|
|
1500
|
-
const
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
const
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
const top = rect === null ? window.innerHeight / 2 : rect.top + rect.height / 2;
|
|
1522
|
-
setToast({ id: Date.now(), mood: group, text: t('toast.' + group + '.' + (index + 1)), left, top });
|
|
1496
|
+
/**
|
|
1497
|
+
* Short feedback after an item is completed. `mood` is `praise` when the due
|
|
1498
|
+
* date was met (or there was none) and `cheer` when the item was overdue, so
|
|
1499
|
+
* the two cases never share wording.
|
|
1500
|
+
*/
|
|
1501
|
+
const showFeedback = useCallback((mood) => {
|
|
1502
|
+
const group = mood === 'cheer' ? 'cheer' : 'praise';
|
|
1503
|
+
const count = 8;
|
|
1504
|
+
const previous = lastPraise.current[group];
|
|
1505
|
+
let index = Math.floor(Math.random() * count);
|
|
1506
|
+
// Avoid repeating the same line twice in a row inside one group.
|
|
1507
|
+
if (index === previous) index = (index + 1 + Math.floor(Math.random() * (count - 1))) % count;
|
|
1508
|
+
lastPraise.current[group] = index;
|
|
1509
|
+
// Centre on the plugin panel, not on the whole window: the panel sits to
|
|
1510
|
+
// the right of the app sidebar, so a viewport centre reads as up-left.
|
|
1511
|
+
const rect = pageRef.current === null ? null : pageRef.current.getBoundingClientRect();
|
|
1512
|
+
const left = rect === null ? window.innerWidth / 2 : rect.left + rect.width / 2;
|
|
1513
|
+
const top = rect === null ? window.innerHeight / 2 : rect.top + rect.height / 2;
|
|
1514
|
+
setToast({ id: Date.now(), mood: group, text: t('toast.' + group + '.' + (index + 1)), left, top });
|
|
1515
|
+
if (toastTimer.current !== null) window.clearTimeout(toastTimer.current);
|
|
1516
|
+
toastTimer.current = window.setTimeout(() => {
|
|
1517
|
+
toastTimer.current = null;
|
|
1518
|
+
setToast(null);
|
|
1519
|
+
}, 2600);
|
|
1520
|
+
}, [t]);
|
|
1521
|
+
|
|
1522
|
+
useEffect(
|
|
1523
|
+
() => () => {
|
|
1523
1524
|
if (toastTimer.current !== null) window.clearTimeout(toastTimer.current);
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
)
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
/** Live grid template from the draggable split ratios. */
|
|
1627
|
-
const matrixStyle = {
|
|
1628
|
-
'--ez-radius': String(settings.radius) + 'px',
|
|
1629
|
-
'--ez-col-ratio': String(settings.colRatio),
|
|
1630
|
-
'--ez-row-ratio': String(settings.rowRatio),
|
|
1631
|
-
gridTemplateColumns: settings.colRatio + 'fr ' + String(1 - settings.colRatio) + 'fr',
|
|
1632
|
-
gridTemplateRows: settings.rowRatio + 'fr ' + String(1 - settings.rowRatio) + 'fr',
|
|
1633
|
-
};
|
|
1525
|
+
},
|
|
1526
|
+
[],
|
|
1527
|
+
);
|
|
1528
|
+
|
|
1529
|
+
const onToggle = useCallback(
|
|
1530
|
+
async (id) => {
|
|
1531
|
+
const target = todos === null ? undefined : todos.find((todo) => todo.id === id);
|
|
1532
|
+
const completing = target !== undefined && target.done !== true;
|
|
1533
|
+
const ok = await mutate('toggle', { id });
|
|
1534
|
+
if (ok && completing) {
|
|
1535
|
+
// Completed today: the deadline is met while it is today or later.
|
|
1536
|
+
const deadlineMissed =
|
|
1537
|
+
typeof target.dueDate === 'string' && target.dueDate !== '' && target.dueDate < todayKey();
|
|
1538
|
+
showFeedback(deadlineMissed ? 'cheer' : 'praise');
|
|
1539
|
+
}
|
|
1540
|
+
},
|
|
1541
|
+
[todos, mutate, showFeedback],
|
|
1542
|
+
);
|
|
1543
|
+
|
|
1544
|
+
/** Remember the drop line, re-rendering only when the target actually changes. */
|
|
1545
|
+
const reportDropTarget = useCallback((quadrantId, beforeId) => {
|
|
1546
|
+
const previous = dropTargetRef.current;
|
|
1547
|
+
if (previous !== null && previous.quadrantId === quadrantId && previous.beforeId === beforeId) return;
|
|
1548
|
+
dropTargetRef.current = { quadrantId, beforeId };
|
|
1549
|
+
setDropTarget(dropTargetRef.current);
|
|
1550
|
+
}, []);
|
|
1551
|
+
|
|
1552
|
+
const endDrag = useCallback(() => {
|
|
1553
|
+
dropTargetRef.current = null;
|
|
1554
|
+
setDragId(null);
|
|
1555
|
+
setDropTarget(null);
|
|
1556
|
+
}, []);
|
|
1557
|
+
|
|
1558
|
+
const onMove = useCallback(
|
|
1559
|
+
async (quadrant, beforeId) => {
|
|
1560
|
+
if (dragId === null) return;
|
|
1561
|
+
const id = dragId;
|
|
1562
|
+
endDrag();
|
|
1563
|
+
// Dropping onto itself is a no-op; the Host would otherwise report a
|
|
1564
|
+
// missing insertion anchor (the row is detached before the lookup).
|
|
1565
|
+
if (beforeId === id) return;
|
|
1566
|
+
await mutate('reorder', {
|
|
1567
|
+
id,
|
|
1568
|
+
important: quadrant.important,
|
|
1569
|
+
urgent: quadrant.urgent,
|
|
1570
|
+
beforeId,
|
|
1571
|
+
});
|
|
1572
|
+
},
|
|
1573
|
+
[dragId, endDrag, mutate],
|
|
1574
|
+
);
|
|
1575
|
+
|
|
1576
|
+
const open = useMemo(() => (todos === null ? [] : todos.filter((todo) => todo.done !== true)), [todos]);
|
|
1577
|
+
const completed = useMemo(
|
|
1578
|
+
() =>
|
|
1579
|
+
todos === null
|
|
1580
|
+
? []
|
|
1581
|
+
: todos
|
|
1582
|
+
.filter((todo) => todo.done === true)
|
|
1583
|
+
.slice()
|
|
1584
|
+
.sort((a, b) => String(b.completedAt ?? '').localeCompare(String(a.completedAt ?? ''))),
|
|
1585
|
+
[todos],
|
|
1586
|
+
);
|
|
1587
|
+
|
|
1588
|
+
const cellOrder = useMemo(() => {
|
|
1589
|
+
const byId = new Map(QUADRANTS.map((quadrant) => [quadrant.id, quadrant]));
|
|
1590
|
+
const order =
|
|
1591
|
+
settings.urgentSide === 'right' ? URGENT_RIGHT_ORDER : QUADRANTS.map((quadrant) => quadrant.id);
|
|
1592
|
+
return order.map((id) => byId.get(id));
|
|
1593
|
+
}, [settings.urgentSide]);
|
|
1594
|
+
|
|
1595
|
+
const cells = useMemo(
|
|
1596
|
+
() =>
|
|
1597
|
+
cellOrder.map((quadrant) => ({
|
|
1598
|
+
quadrant,
|
|
1599
|
+
items: open.filter(
|
|
1600
|
+
(todo) =>
|
|
1601
|
+
(todo.important === true) === quadrant.important &&
|
|
1602
|
+
(todo.urgent === true) === quadrant.urgent,
|
|
1603
|
+
),
|
|
1604
|
+
})),
|
|
1605
|
+
[cellOrder, open],
|
|
1606
|
+
);
|
|
1607
|
+
|
|
1608
|
+
const errorText = error === null ? null : error;
|
|
1609
|
+
|
|
1610
|
+
// Frame classes: `cards` | `grid` (田字格) | `cross` (no outer border),
|
|
1611
|
+
// plus the optional soft cell fill.
|
|
1612
|
+
const matrixClass =
|
|
1613
|
+
'ez-matrix ez-matrix--' +
|
|
1614
|
+
settings.frame +
|
|
1615
|
+
(settings.tint === 'soft' ? ' ez-matrix--tint' : '') +
|
|
1616
|
+
(settings.titleStyle === 'truncate' ? ' ez-matrix--truncate' : ' ez-matrix--wrap');
|
|
1617
|
+
|
|
1618
|
+
/** Live grid template from the draggable split ratios. */
|
|
1619
|
+
const matrixStyle = {
|
|
1620
|
+
'--ez-radius': String(settings.radius) + 'px',
|
|
1621
|
+
'--ez-col-ratio': String(settings.colRatio),
|
|
1622
|
+
'--ez-row-ratio': String(settings.rowRatio),
|
|
1623
|
+
gridTemplateColumns: settings.colRatio + 'fr ' + String(1 - settings.colRatio) + 'fr',
|
|
1624
|
+
gridTemplateRows: settings.rowRatio + 'fr ' + String(1 - settings.rowRatio) + 'fr',
|
|
1625
|
+
};
|
|
1634
1626
|
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1627
|
+
/** True while the drag sits inside the snap zone around the even split. */
|
|
1628
|
+
const snapActive =
|
|
1629
|
+
Math.abs(settings.colRatio - 0.5) <= 0.025 && Math.abs(settings.rowRatio - 0.5) <= 0.025;
|
|
1638
1630
|
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1631
|
+
/** Resize the quadrants by dragging the handle at the cross centre. */
|
|
1632
|
+
const onSplitPointerDown = (event) => {
|
|
1633
|
+
event.preventDefault();
|
|
1634
|
+
event.stopPropagation();
|
|
1635
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
1636
|
+
setSplitDragging(true);
|
|
1637
|
+
};
|
|
1646
1638
|
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1639
|
+
/** Reveal the handle only while the pointer is near the current centre. */
|
|
1640
|
+
const onMatrixPointerMove = (event) => {
|
|
1641
|
+
if (splitDragging) return;
|
|
1642
|
+
const rect = matrixRef.current === null ? null : matrixRef.current.getBoundingClientRect();
|
|
1643
|
+
if (rect === null || rect.width === 0 || rect.height === 0) return;
|
|
1644
|
+
const centerX = rect.left + rect.width * settings.colRatio;
|
|
1645
|
+
const centerY = rect.top + rect.height * settings.rowRatio;
|
|
1646
|
+
const near = Math.hypot(event.clientX - centerX, event.clientY - centerY) <= 56;
|
|
1647
|
+
setSplitHot(near);
|
|
1648
|
+
};
|
|
1657
1649
|
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1650
|
+
const onMatrixPointerLeave = () => {
|
|
1651
|
+
if (!splitDragging) setSplitHot(false);
|
|
1652
|
+
};
|
|
1661
1653
|
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1654
|
+
/** Gentle snap so the default even split is easy to hit again. */
|
|
1655
|
+
const snapRatio = (value) => (Math.abs(value - 0.5) <= 0.025 ? 0.5 : clampRatio(value));
|
|
1656
|
+
|
|
1657
|
+
const onSplitPointerMove = (event) => {
|
|
1658
|
+
if (!splitDragging) return;
|
|
1659
|
+
const rect = matrixRef.current === null ? null : matrixRef.current.getBoundingClientRect();
|
|
1660
|
+
if (rect === null || rect.width === 0 || rect.height === 0) return;
|
|
1661
|
+
event.preventDefault();
|
|
1662
|
+
commitSettings({
|
|
1663
|
+
colRatio: snapRatio((event.clientX - rect.left) / rect.width),
|
|
1664
|
+
rowRatio: snapRatio((event.clientY - rect.top) / rect.height),
|
|
1665
|
+
});
|
|
1666
|
+
};
|
|
1675
1667
|
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1668
|
+
const onSplitPointerUp = (event) => {
|
|
1669
|
+
if (!splitDragging) return;
|
|
1670
|
+
setSplitDragging(false);
|
|
1671
|
+
if (typeof event.currentTarget.releasePointerCapture === 'function') {
|
|
1672
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
1673
|
+
}
|
|
1674
|
+
};
|
|
1683
1675
|
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1676
|
+
const tab = (id, label, count) =>
|
|
1677
|
+
h(
|
|
1678
|
+
'button',
|
|
1679
|
+
{
|
|
1680
|
+
type: 'button',
|
|
1681
|
+
className: view === id ? 'ez-seg-btn is-active' : 'ez-seg-btn',
|
|
1682
|
+
'aria-pressed': view === id,
|
|
1683
|
+
onClick: () => setView(id),
|
|
1684
|
+
},
|
|
1685
|
+
label,
|
|
1686
|
+
count > 0 ? h('span', { className: 'ez-count' }, String(count)) : null,
|
|
1687
|
+
);
|
|
1696
1688
|
|
|
1697
|
-
|
|
1689
|
+
return h(
|
|
1690
|
+
'div',
|
|
1691
|
+
{ className: 'ez-page', ref: pageRef, style: { '--ez-font-size': String(settings.fontSize) + 'px' } },
|
|
1692
|
+
h('style', { dangerouslySetInnerHTML: { __html: CSS } }),
|
|
1693
|
+
h(
|
|
1698
1694
|
'div',
|
|
1699
|
-
{ className: 'ez-
|
|
1700
|
-
h('style', { dangerouslySetInnerHTML: { __html: CSS } }),
|
|
1695
|
+
{ className: 'ez-inner' },
|
|
1701
1696
|
h(
|
|
1702
|
-
'
|
|
1703
|
-
{ className: 'ez-
|
|
1697
|
+
'header',
|
|
1698
|
+
{ className: 'ez-head' },
|
|
1699
|
+
h(
|
|
1700
|
+
'div',
|
|
1701
|
+
{ className: 'ez-heading' },
|
|
1702
|
+
h('h1', { className: 'ez-page-title' }, t('page.title')),
|
|
1703
|
+
h('p', { className: 'ez-sub' }, t('page.subtitle')),
|
|
1704
|
+
),
|
|
1704
1705
|
h(
|
|
1705
|
-
'
|
|
1706
|
-
{ className: 'ez-head' },
|
|
1706
|
+
'div',
|
|
1707
|
+
{ className: 'ez-head-actions' },
|
|
1707
1708
|
h(
|
|
1708
1709
|
'div',
|
|
1709
|
-
{ className: 'ez-
|
|
1710
|
-
|
|
1711
|
-
|
|
1710
|
+
{ className: 'ez-seg', role: 'group', 'aria-label': t('page.subtitle') },
|
|
1711
|
+
tab('matrix', t('view.matrix'), open.length),
|
|
1712
|
+
tab('completed', t('view.completed'), completed.length),
|
|
1712
1713
|
),
|
|
1713
1714
|
h(
|
|
1715
|
+
'button',
|
|
1716
|
+
{
|
|
1717
|
+
type: 'button',
|
|
1718
|
+
className: settingsOpen ? 'ez-icon-btn is-on' : 'ez-icon-btn',
|
|
1719
|
+
title: t('settings.toggle'),
|
|
1720
|
+
'aria-label': t('settings.toggle'),
|
|
1721
|
+
'aria-expanded': settingsOpen,
|
|
1722
|
+
'aria-controls': 'ez-settings-panel',
|
|
1723
|
+
onClick: () => setSettingsOpen((value) => !value),
|
|
1724
|
+
},
|
|
1725
|
+
h(GearGlyph),
|
|
1726
|
+
),
|
|
1727
|
+
),
|
|
1728
|
+
),
|
|
1729
|
+
settingsOpen
|
|
1730
|
+
? h(SettingsPanel, {
|
|
1731
|
+
t,
|
|
1732
|
+
settings,
|
|
1733
|
+
onPatch: commitSettings,
|
|
1734
|
+
onReset: onResetSettings,
|
|
1735
|
+
})
|
|
1736
|
+
: null,
|
|
1737
|
+
errorText === null
|
|
1738
|
+
? null
|
|
1739
|
+
: h(
|
|
1714
1740
|
'div',
|
|
1715
|
-
{ className: 'ez-
|
|
1716
|
-
h(
|
|
1741
|
+
{ className: 'ez-error', role: 'alert' },
|
|
1742
|
+
h('span', null, errorText),
|
|
1743
|
+
h('button', { type: 'button', className: 'ez-retry', onClick: () => void load() }, t('error.retry')),
|
|
1744
|
+
),
|
|
1745
|
+
!loaded
|
|
1746
|
+
? h('div', { className: 'ez-body' }, h('p', { className: 'ez-blank' }, t('loading')))
|
|
1747
|
+
: view === 'matrix'
|
|
1748
|
+
? h(
|
|
1717
1749
|
'div',
|
|
1718
|
-
{ className: 'ez-seg', role: 'group', 'aria-label': t('page.subtitle') },
|
|
1719
|
-
tab('matrix', t('view.matrix'), open.length),
|
|
1720
|
-
tab('completed', t('view.completed'), completed.length),
|
|
1721
|
-
),
|
|
1722
|
-
h(
|
|
1723
|
-
'button',
|
|
1724
1750
|
{
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
'aria-controls': 'ez-settings-panel',
|
|
1731
|
-
onClick: () => setSettingsOpen((value) => !value),
|
|
1751
|
+
className: matrixClass,
|
|
1752
|
+
ref: matrixRef,
|
|
1753
|
+
style: matrixStyle,
|
|
1754
|
+
onPointerMove: onMatrixPointerMove,
|
|
1755
|
+
onPointerLeave: onMatrixPointerLeave,
|
|
1732
1756
|
},
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
: view === 'matrix'
|
|
1756
|
-
? h(
|
|
1757
|
-
'div',
|
|
1757
|
+
cells.map((cell) =>
|
|
1758
|
+
h(QuadrantCard, {
|
|
1759
|
+
key: cell.quadrant.id,
|
|
1760
|
+
quadrant: cell.quadrant,
|
|
1761
|
+
items: cell.items,
|
|
1762
|
+
t,
|
|
1763
|
+
onAdd: onAddToQuadrant,
|
|
1764
|
+
onToggle,
|
|
1765
|
+
onPatch,
|
|
1766
|
+
onRemove,
|
|
1767
|
+
onDue,
|
|
1768
|
+
dueFormat: settings.dueFormat,
|
|
1769
|
+
dragId,
|
|
1770
|
+
dropTarget,
|
|
1771
|
+
onDragStart: setDragId,
|
|
1772
|
+
onDragEnd: endDrag,
|
|
1773
|
+
onDragOver: reportDropTarget,
|
|
1774
|
+
onMove,
|
|
1775
|
+
}),
|
|
1776
|
+
),
|
|
1777
|
+
h(
|
|
1778
|
+
'button',
|
|
1758
1779
|
{
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1780
|
+
type: 'button',
|
|
1781
|
+
className:
|
|
1782
|
+
'ez-split' +
|
|
1783
|
+
(splitHot || splitDragging ? ' is-visible' : '') +
|
|
1784
|
+
(splitDragging ? ' is-dragging' : '') +
|
|
1785
|
+
(splitDragging && snapActive ? ' is-snap' : ''),
|
|
1786
|
+
title: t('settings.quadSize'),
|
|
1787
|
+
'aria-label': t('settings.quadSize'),
|
|
1788
|
+
onPointerDown: onSplitPointerDown,
|
|
1789
|
+
onPointerMove: onSplitPointerMove,
|
|
1790
|
+
onPointerUp: onSplitPointerUp,
|
|
1791
|
+
onPointerCancel: onSplitPointerUp,
|
|
1792
|
+
onDoubleClick: () => commitSettings({ colRatio: 0.5, rowRatio: 0.5 }),
|
|
1764
1793
|
},
|
|
1765
|
-
|
|
1766
|
-
h(QuadrantCard, {
|
|
1767
|
-
key: cell.quadrant.id,
|
|
1768
|
-
quadrant: cell.quadrant,
|
|
1769
|
-
items: cell.items,
|
|
1770
|
-
t,
|
|
1771
|
-
onAdd: onAddToQuadrant,
|
|
1772
|
-
onToggle,
|
|
1773
|
-
onPatch,
|
|
1774
|
-
onRemove,
|
|
1775
|
-
onDue,
|
|
1776
|
-
dueFormat: settings.dueFormat,
|
|
1777
|
-
dragId,
|
|
1778
|
-
dropTarget,
|
|
1779
|
-
onDragStart: setDragId,
|
|
1780
|
-
onDragEnd: endDrag,
|
|
1781
|
-
onDragOver: reportDropTarget,
|
|
1782
|
-
onMove,
|
|
1783
|
-
}),
|
|
1784
|
-
),
|
|
1785
|
-
h(
|
|
1786
|
-
'button',
|
|
1787
|
-
{
|
|
1788
|
-
type: 'button',
|
|
1789
|
-
className:
|
|
1790
|
-
'ez-split' +
|
|
1791
|
-
(splitHot || splitDragging ? ' is-visible' : '') +
|
|
1792
|
-
(splitDragging ? ' is-dragging' : '') +
|
|
1793
|
-
(splitDragging && snapActive ? ' is-snap' : ''),
|
|
1794
|
-
title: t('settings.quadSize'),
|
|
1795
|
-
'aria-label': t('settings.quadSize'),
|
|
1796
|
-
onPointerDown: onSplitPointerDown,
|
|
1797
|
-
onPointerMove: onSplitPointerMove,
|
|
1798
|
-
onPointerUp: onSplitPointerUp,
|
|
1799
|
-
onPointerCancel: onSplitPointerUp,
|
|
1800
|
-
onDoubleClick: () => commitSettings({ colRatio: 0.5, rowRatio: 0.5 }),
|
|
1801
|
-
},
|
|
1802
|
-
h('span', { className: 'ez-split-dot', 'aria-hidden': 'true' }),
|
|
1803
|
-
),
|
|
1804
|
-
splitDragging
|
|
1805
|
-
? h(
|
|
1806
|
-
'div',
|
|
1807
|
-
{
|
|
1808
|
-
className: snapActive ? 'ez-split-center is-active' : 'ez-split-center',
|
|
1809
|
-
'aria-hidden': 'true',
|
|
1810
|
-
},
|
|
1811
|
-
h('span', { className: 'ez-split-center-h' }),
|
|
1812
|
-
h('span', { className: 'ez-split-center-v' }),
|
|
1813
|
-
h('span', { className: 'ez-split-center-dot' }),
|
|
1814
|
-
)
|
|
1815
|
-
: null,
|
|
1816
|
-
)
|
|
1817
|
-
: h(CompletedList, { t, items: completed, onToggle, onRemove, onClear }),
|
|
1818
|
-
toast === null
|
|
1819
|
-
? null
|
|
1820
|
-
: h(
|
|
1821
|
-
'div',
|
|
1822
|
-
{
|
|
1823
|
-
className: toast.mood === 'cheer' ? 'ez-toast ez-toast--cheer' : 'ez-toast ez-toast--praise',
|
|
1824
|
-
key: toast.id,
|
|
1825
|
-
style: { left: toast.left + 'px', top: toast.top + 'px' },
|
|
1826
|
-
role: 'status',
|
|
1827
|
-
'aria-live': 'polite',
|
|
1828
|
-
},
|
|
1829
|
-
h(
|
|
1830
|
-
'span',
|
|
1831
|
-
{ className: 'ez-toast-mark', 'aria-hidden': 'true' },
|
|
1832
|
-
toast.mood === 'cheer' ? '↗' : '✓',
|
|
1794
|
+
h('span', { className: 'ez-split-dot', 'aria-hidden': 'true' }),
|
|
1833
1795
|
),
|
|
1834
|
-
|
|
1796
|
+
splitDragging
|
|
1797
|
+
? h(
|
|
1798
|
+
'div',
|
|
1799
|
+
{
|
|
1800
|
+
className: snapActive ? 'ez-split-center is-active' : 'ez-split-center',
|
|
1801
|
+
'aria-hidden': 'true',
|
|
1802
|
+
},
|
|
1803
|
+
h('span', { className: 'ez-split-center-h' }),
|
|
1804
|
+
h('span', { className: 'ez-split-center-v' }),
|
|
1805
|
+
h('span', { className: 'ez-split-center-dot' }),
|
|
1806
|
+
)
|
|
1807
|
+
: null,
|
|
1808
|
+
)
|
|
1809
|
+
: h(CompletedList, { t, items: completed, onToggle, onRemove, onClear }),
|
|
1810
|
+
toast === null
|
|
1811
|
+
? null
|
|
1812
|
+
: h(
|
|
1813
|
+
'div',
|
|
1814
|
+
{
|
|
1815
|
+
className: toast.mood === 'cheer' ? 'ez-toast ez-toast--cheer' : 'ez-toast ez-toast--praise',
|
|
1816
|
+
key: toast.id,
|
|
1817
|
+
style: { left: toast.left + 'px', top: toast.top + 'px' },
|
|
1818
|
+
role: 'status',
|
|
1819
|
+
'aria-live': 'polite',
|
|
1820
|
+
},
|
|
1821
|
+
h(
|
|
1822
|
+
'span',
|
|
1823
|
+
{ className: 'ez-toast-mark', 'aria-hidden': 'true' },
|
|
1824
|
+
toast.mood === 'cheer' ? '↗' : '✓',
|
|
1835
1825
|
),
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1826
|
+
h('span', null, toast.text),
|
|
1827
|
+
),
|
|
1828
|
+
),
|
|
1829
|
+
);
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
/** Page-scoped stylesheet; every color is a theme token. */
|
|
1833
|
+
const CSS = [
|
|
1834
|
+
'.ez-page{box-sizing:border-box;display:flex;flex-direction:column;flex:1 1 auto;height:100%;min-height:0;overflow-y:auto;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary)}',
|
|
1835
|
+
'.ez-inner{box-sizing:border-box;display:flex;flex-direction:column;flex:1 1 auto;width:100%;max-width:1100px;min-height:0;margin:0 auto;padding:22px 24px 20px}',
|
|
1836
|
+
'html[data-platform=darwin] .ez-inner{padding-top:calc(22px + var(--dsh-frame-top-clearance,48px))}',
|
|
1837
|
+
'.ez-head{display:flex;flex:none;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap}',
|
|
1838
|
+
'.ez-heading{display:flex;flex-direction:column;gap:4px;min-width:0}',
|
|
1839
|
+
'.ez-head-actions{display:flex;flex:none;align-items:center;gap:10px}',
|
|
1840
|
+
'.ez-page-title{margin:0;font-size:20px;line-height:28px;font-weight:600;letter-spacing:-.01em}',
|
|
1841
|
+
'.ez-sub{margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);letter-spacing:.02em}',
|
|
1842
|
+
'.ez-seg{display:inline-flex;flex:none;gap:2px;padding:2px;border:.5px solid var(--dsw-alias-border-l2);border-radius:9px;background:var(--dsw-alias-bg-layer-1)}',
|
|
1843
|
+
'.ez-seg-btn{box-sizing:border-box;display:inline-flex;align-items:center;gap:6px;height:26px;margin:0;padding:0 11px;border:0;border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12.5px;line-height:1;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1844
|
+
'.ez-seg-btn:hover{color:var(--dsw-alias-label-primary)}',
|
|
1845
|
+
'.ez-seg-btn.is-active{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}',
|
|
1846
|
+
'.ez-seg-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1847
|
+
'.ez-seg--sm .ez-seg-btn{height:24px;padding:0 9px;font-size:11.5px}',
|
|
1848
|
+
'.ez-count{font-size:11px;line-height:1;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}',
|
|
1849
|
+
'.ez-icon-btn{box-sizing:border-box;display:grid;place-items:center;width:28px;height:28px;margin:0;padding:0;border:.5px solid var(--dsw-alias-border-l2);border-radius:8px;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1850
|
+
'.ez-icon-btn:hover{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}',
|
|
1851
|
+
'.ez-icon-btn.is-on{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}',
|
|
1852
|
+
'.ez-icon-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1853
|
+
'.ez-settings{display:flex;flex:none;flex-direction:column;gap:10px;margin-top:14px;padding:12px 14px;border:.5px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-1)}',
|
|
1854
|
+
'.ez-set-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}',
|
|
1855
|
+
'.ez-set-about{display:flex;align-items:center;flex-wrap:wrap;gap:6px 14px;margin-top:4px;padding-top:10px;border-top:.5px solid var(--dsw-alias-border-l1)}',
|
|
1856
|
+
'.ez-about-dev{display:inline-flex;align-items:center;gap:5px;margin-left:auto;font-size:12px;line-height:1;color:var(--dsw-alias-label-secondary)}',
|
|
1857
|
+
'.ez-about-dev-label{font-style:italic}',
|
|
1858
|
+
'.ez-about-avatar{width:16px;height:16px;flex:0 0 auto;border-radius:50%;object-fit:cover;background:var(--dsw-alias-bg-layer-2)}',
|
|
1859
|
+
'.ez-about-link{display:inline-flex;align-items:center;gap:5px;padding:1px 0;border-radius:5px;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1;text-decoration:none;cursor:pointer;transition:color .16s ease}',
|
|
1860
|
+
'.ez-about-link:hover,.ez-about-link:focus-visible{color:var(--dsw-alias-brand-primary);text-decoration:underline;text-underline-offset:3px;outline:none}',
|
|
1861
|
+
'.ez-set-label{flex:none;width:68px;font-size:12px;line-height:1;color:var(--dsw-alias-label-secondary)}',
|
|
1862
|
+
'.ez-set-slider{display:flex;flex:1 1 auto;align-items:center;gap:10px;min-width:0}',
|
|
1863
|
+
'.ez-range{flex:1 1 120px;max-width:240px;height:18px;margin:0;accent-color:var(--dsw-alias-brand-primary);background:transparent}',
|
|
1864
|
+
'.ez-set-value{flex:none;width:44px;text-align:right;font-size:11px;line-height:1;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}',
|
|
1865
|
+
'.ez-text-field{box-sizing:border-box;flex:0 1 260px;min-width:0;height:28px;margin:0;padding:0 9px;border:.5px solid var(--dsw-alias-border-l2);border-radius:7px;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;outline:none}',
|
|
1866
|
+
'.ez-text-field::placeholder{color:var(--dsw-alias-state-idle-primary)}',
|
|
1867
|
+
'.ez-text-field:focus{border-color:var(--dsw-alias-brand-primary)}',
|
|
1868
|
+
'.ez-reset--inline{margin-left:auto}',
|
|
1869
|
+
'.ez-reset{box-sizing:border-box;margin:0;padding:4px 9px;border:.5px solid var(--dsw-alias-border-l2);border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11.5px;line-height:1;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1870
|
+
'.ez-reset:hover{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}',
|
|
1871
|
+
'.ez-reset:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1872
|
+
'.ez-error{display:flex;flex:none;align-items:center;gap:10px;margin-top:10px;font-size:12px;line-height:18px;color:var(--dsw-alias-state-error-primary)}',
|
|
1873
|
+
'.ez-retry{box-sizing:border-box;margin:0;padding:0;border:0;background:transparent;color:inherit;font:inherit;font-size:12px;text-decoration:underline;text-underline-offset:2px;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1874
|
+
'.ez-retry:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}',
|
|
1875
|
+
'.ez-body{display:flex;flex:1 1 auto;min-height:0}',
|
|
1876
|
+
'.ez-matrix{position:relative;display:grid;flex:1 1 auto;min-height:340px;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;margin-top:16px}',
|
|
1877
|
+
'.ez-matrix--cards{gap:14px}',
|
|
1878
|
+
'.ez-matrix--grid{gap:1px;border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--ez-radius,10px);background:var(--dsw-alias-border-l1);overflow:hidden}',
|
|
1879
|
+
'.ez-matrix--cross{gap:0;border:0;border-radius:var(--ez-radius,10px);overflow:hidden}',
|
|
1880
|
+
'.ez-matrix--cross::before{content:"";position:absolute;top:0;bottom:0;left:calc(var(--ez-col-ratio,.5) * 100%);width:1px;margin-left:-.5px;background:var(--dsw-alias-border-l1);z-index:1;pointer-events:none}',
|
|
1881
|
+
'.ez-matrix--cross::after{content:"";position:absolute;left:0;right:0;top:calc(var(--ez-row-ratio,.5) * 100%);height:1px;margin-top:-.5px;background:var(--dsw-alias-border-l1);z-index:1;pointer-events:none}',
|
|
1882
|
+
'.ez-split{position:absolute;left:calc(var(--ez-col-ratio,.5) * 100%);top:calc(var(--ez-row-ratio,.5) * 100%);z-index:6;box-sizing:border-box;display:grid;place-items:center;width:20px;height:20px;margin:-10px 0 0 -10px;padding:0;border:.5px solid var(--dsw-alias-border-l2);border-radius:50%;background:var(--dsw-alias-bg-overlay);color:var(--dsw-alias-label-secondary);cursor:move;opacity:0;transition:opacity .12s ease,border-color .12s ease,color .12s ease;appearance:none;-webkit-appearance:none}',
|
|
1883
|
+
'.ez-split.is-visible,.ez-split:focus-visible{opacity:1}',
|
|
1884
|
+
'.ez-split-dot{display:block;width:6px;height:6px;border-radius:50%;background:currentColor}',
|
|
1885
|
+
'.ez-split:hover{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}',
|
|
1886
|
+
'.ez-split:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1887
|
+
'.ez-split.is-dragging{opacity:1;border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}',
|
|
1888
|
+
'.ez-split.is-snap{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary);box-shadow:0 0 0 4px color-mix(in srgb,var(--dsw-alias-brand-primary) 20%,transparent)}',
|
|
1889
|
+
'.ez-split-center{position:absolute;left:50%;top:50%;z-index:5;width:0;height:0;pointer-events:none;color:var(--dsw-alias-brand-primary);opacity:.85;transition:opacity .12s ease}',
|
|
1890
|
+
'.ez-split-center-h{position:absolute;left:-28px;top:-.5px;width:56px;height:1px;background:linear-gradient(to right,transparent,currentColor 22%,currentColor 78%,transparent);opacity:.55;transition:opacity .12s ease}',
|
|
1891
|
+
'.ez-split-center-v{position:absolute;top:-28px;left:-.5px;height:56px;width:1px;background:linear-gradient(to bottom,transparent,currentColor 22%,currentColor 78%,transparent);opacity:.55;transition:opacity .12s ease}',
|
|
1892
|
+
'.ez-split-center-dot{position:absolute;left:-3px;top:-3px;width:6px;height:6px;border-radius:50%;background:currentColor;opacity:.9;transition:transform .12s ease,box-shadow .12s ease,opacity .12s ease}',
|
|
1893
|
+
'.ez-split-center.is-active{opacity:1}',
|
|
1894
|
+
'.ez-split-center.is-active .ez-split-center-h,.ez-split-center.is-active .ez-split-center-v{opacity:.95}',
|
|
1895
|
+
'.ez-split-center.is-active .ez-split-center-dot{opacity:1;transform:scale(1.35);box-shadow:0 0 0 4px color-mix(in srgb,var(--dsw-alias-brand-primary) 22%,transparent)}',
|
|
1896
|
+
'@media (hover:none){.ez-split{opacity:1}}',
|
|
1897
|
+
'.ez-matrix--truncate .ez-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;overflow-wrap:normal;word-break:normal}',
|
|
1898
|
+
'.ez-quad{box-sizing:border-box;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden}',
|
|
1899
|
+
'.ez-matrix--cards .ez-quad{padding:12px 13px 9px;border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--ez-radius,10px);background:var(--dsw-alias-bg-layer-1)}',
|
|
1900
|
+
'.ez-matrix--grid .ez-quad{padding:12px 13px 9px;border:0;border-radius:0;background:var(--dsw-alias-bg-layer-1)}',
|
|
1901
|
+
'.ez-matrix--cross .ez-quad{padding:12px 13px 9px;border:0;border-radius:0;background:transparent}',
|
|
1902
|
+
'.ez-matrix--tint .ez-quad--q1{background:var(--dsw-alias-bg-layer-1);background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 8%,var(--dsw-alias-bg-layer-1))}',
|
|
1903
|
+
'.ez-matrix--tint .ez-quad--q2{background:var(--dsw-alias-bg-layer-1);background:color-mix(in srgb,var(--dsw-alias-brand-primary) 7%,var(--dsw-alias-bg-layer-1))}',
|
|
1904
|
+
'.ez-matrix--tint .ez-quad--q3{background:var(--dsw-alias-bg-layer-1);background:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 9%,var(--dsw-alias-bg-layer-1))}',
|
|
1905
|
+
'.ez-matrix--tint .ez-quad--q4{background:var(--dsw-alias-bg-layer-1);background:color-mix(in srgb,var(--dsw-alias-state-idle-primary) 9%,var(--dsw-alias-bg-layer-1))}',
|
|
1906
|
+
'.ez-quad-head{display:flex;flex:none;align-items:center;gap:7px;height:24px}',
|
|
1907
|
+
'.ez-dot{flex:none;width:6px;height:6px;border-radius:50%}',
|
|
1908
|
+
'.ez-quad--q1 .ez-dot{background:var(--dsw-alias-state-error-primary)}',
|
|
1909
|
+
'.ez-quad--q2 .ez-dot{background:var(--dsw-alias-brand-primary)}',
|
|
1910
|
+
'.ez-quad--q3 .ez-dot{background:var(--dsw-alias-state-warn-primary)}',
|
|
1911
|
+
'.ez-quad--q4 .ez-dot{background:var(--dsw-alias-state-idle-primary)}',
|
|
1912
|
+
'.ez-quad-name{margin:0;font-size:13px;line-height:1;font-weight:600;letter-spacing:.01em;white-space:nowrap}',
|
|
1913
|
+
'.ez-quad-hint{min-width:0;font-size:11px;line-height:1;color:var(--dsw-alias-label-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
|
|
1914
|
+
'.ez-quad-count{margin-left:auto;font-size:11px;line-height:1;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}',
|
|
1915
|
+
'.ez-list{display:flex;flex:1 1 auto;flex-direction:column;gap:1px;min-height:0;margin:6px 0 0;padding:0;list-style:none;overflow-y:auto}',
|
|
1916
|
+
'.ez-row{display:flex;flex:none;align-items:flex-start;gap:8px;min-height:30px;padding:4px 2px 4px 3px;border-radius:7px}',
|
|
1917
|
+
'.ez-row:hover{background:var(--dsw-alias-bg-layer-2)}',
|
|
1918
|
+
'.ez-check{box-sizing:border-box;flex:none;width:15px;height:15px;margin:calc((var(--ez-font-size,13px) * 1.55 - 15px) / 2) 0 0 0;padding:0;accent-color:var(--dsw-alias-brand-primary);cursor:pointer}',
|
|
1919
|
+
'.ez-check:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}',
|
|
1920
|
+
'.ez-title{flex:1 1 auto;min-width:0;font-size:var(--ez-font-size,13px);line-height:1.55;white-space:normal;overflow-wrap:anywhere;word-break:break-word;cursor:text}',
|
|
1921
|
+
'.ez-title-input{flex:1 1 auto;min-width:0;margin:0;padding:0 0 1px;border:0;border-bottom:1px solid var(--dsw-alias-brand-primary,currentColor);border-radius:0;background:transparent;color:inherit;font:inherit;font-size:var(--ez-font-size,13px);line-height:1.55;outline:none;white-space:normal;overflow-wrap:anywhere;word-break:break-word}',
|
|
1922
|
+
'.ez-title--done{color:var(--dsw-alias-label-secondary);text-decoration:line-through;text-decoration-thickness:.5px}',
|
|
1923
|
+
'.ez-date{flex:none;margin-top:calc((var(--ez-font-size,13px) * 1.55 - 22px) / 2);font-size:calc(var(--ez-font-size,13px) * .82);line-height:22px;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}',
|
|
1924
|
+
'.ez-actions{display:flex;flex:none;align-items:center;justify-content:flex-end;gap:2px;width:0;overflow:hidden;margin-top:calc((var(--ez-font-size,13px) * 1.55 - 22px) / 2);opacity:0;transition:width .13s ease,opacity .13s ease}',
|
|
1925
|
+
'.ez-row:hover .ez-actions,.ez-row:focus-within .ez-actions{width:96px;opacity:1}',
|
|
1926
|
+
'@media (hover:none){.ez-actions{width:96px;opacity:1}}',
|
|
1927
|
+
'.ez-mini{box-sizing:border-box;display:grid;place-items:center;width:22px;height:22px;margin:0;padding:0;border:0;border-radius:5px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1928
|
+
'.ez-mini:hover{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}',
|
|
1929
|
+
'.ez-mini.is-on{color:var(--dsw-alias-brand-primary)}',
|
|
1930
|
+
'.ez-mini:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1931
|
+
'.ez-add-area{display:flex;flex:none;align-items:center;flex-wrap:wrap;gap:6px;margin-top:6px}',
|
|
1932
|
+
'.ez-date-field{box-sizing:border-box;flex:none;display:inline-flex;align-items:center;justify-content:center;gap:5px;height:30px;margin:0;padding:0 8px;border:.5px solid var(--dsw-alias-border-l2);border-radius:7px;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary);font:inherit;font-size:11.5px;line-height:1;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1933
|
+
'.ez-date-field--empty{flex:0 0 40px;width:40px;padding:0}',
|
|
1934
|
+
'.ez-date-field--set{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums}',
|
|
1935
|
+
'.ez-date-field:hover{border-color:var(--dsw-alias-border-l3);color:var(--dsw-alias-label-primary)}',
|
|
1936
|
+
'.ez-date-field:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1937
|
+
'.ez-picker{position:fixed;z-index:70;box-sizing:border-box;width:252px;padding:10px;border:.5px solid var(--dsw-alias-border-l2);border-radius:12px;background:var(--dsw-alias-bg-overlay);box-shadow:0 16px 44px color-mix(in srgb,var(--dsw-alias-label-primary) 16%,transparent);user-select:none}',
|
|
1938
|
+
'.ez-picker-head{display:flex;align-items:center;justify-content:space-between;gap:4px;height:28px;margin-bottom:6px}',
|
|
1939
|
+
'.ez-picker-title{font-size:12.5px;line-height:1;font-weight:600;color:var(--dsw-alias-label-primary)}',
|
|
1940
|
+
'.ez-picker-nav{box-sizing:border-box;display:grid;place-items:center;width:24px;height:24px;margin:0;padding:0;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:15px;line-height:1;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1941
|
+
'.ez-picker-nav:hover{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}',
|
|
1942
|
+
'.ez-picker-nav:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1943
|
+
'.ez-picker-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}',
|
|
1944
|
+
'.ez-picker-grid--wd{margin-bottom:2px}',
|
|
1945
|
+
'.ez-picker-wd{display:grid;place-items:center;height:22px;font-size:10.5px;line-height:1;color:var(--dsw-alias-label-secondary)}',
|
|
1946
|
+
'.ez-picker-cell{display:block;height:28px}',
|
|
1947
|
+
'.ez-picker-day{box-sizing:border-box;display:grid;place-items:center;width:100%;height:28px;margin:0;padding:0;border:0;border-radius:7px;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:11.5px;line-height:1;cursor:pointer;appearance:none;-webkit-appearance:none;font-variant-numeric:tabular-nums}',
|
|
1948
|
+
'.ez-picker-day:hover{background:var(--dsw-alias-bg-layer-2)}',
|
|
1949
|
+
'.ez-picker-day:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-1px}',
|
|
1950
|
+
'.ez-picker-day.is-today{color:var(--dsw-alias-brand-primary);font-weight:600}',
|
|
1951
|
+
'.ez-picker-day.is-selected{background:var(--dsw-alias-brand-primary);color:var(--dsw-alias-bg-base);font-weight:600}',
|
|
1952
|
+
'.ez-picker-day.is-selected:hover{opacity:.9}',
|
|
1953
|
+
'.ez-picker-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:8px;padding-top:8px;border-top:.5px solid var(--dsw-alias-border-l1)}',
|
|
1954
|
+
'.ez-picker-link{box-sizing:border-box;margin:0;padding:3px 5px;border:0;border-radius:5px;background:transparent;color:var(--dsw-alias-brand-primary);font:inherit;font-size:11.5px;line-height:1;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1955
|
+
'.ez-picker-link:hover:not(:disabled){background:var(--dsw-alias-bg-layer-2)}',
|
|
1956
|
+
'.ez-picker-link:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1957
|
+
'.ez-picker-link:disabled{color:var(--dsw-alias-state-idle-primary);cursor:default}',
|
|
1958
|
+
'.ez-due{box-sizing:border-box;flex:none;display:inline-flex;align-items:center;height:22px;line-height:22px;margin:calc((var(--ez-font-size,13px) * 1.55 - 22px) / 2) 0 0 6px;padding:0 1px;border:0;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:calc(var(--ez-font-size,13px) * .82);cursor:pointer;appearance:none;-webkit-appearance:none;font-variant-numeric:tabular-nums;white-space:nowrap}',
|
|
1959
|
+
'.ez-due:hover{color:var(--dsw-alias-label-primary)}',
|
|
1960
|
+
'.ez-due:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px;border-radius:4px}',
|
|
1961
|
+
'.ez-due--today{color:var(--dsw-alias-state-warn-primary);font-weight:600}',
|
|
1962
|
+
'.ez-due--overdue{color:var(--dsw-alias-state-error-primary);font-weight:600}',
|
|
1963
|
+
'.ez-row[draggable=true]{cursor:grab}',
|
|
1964
|
+
'.ez-row[draggable=true]:active{cursor:grabbing}',
|
|
1965
|
+
'.ez-row.is-overdue .ez-title{color:var(--dsw-alias-state-error-primary)}',
|
|
1966
|
+
'.ez-row.is-dragging{opacity:.35}',
|
|
1967
|
+
'.ez-row.is-drop-before{box-shadow:inset 0 2px 0 var(--dsw-alias-brand-primary)}',
|
|
1968
|
+
'.ez-list.is-drop-end::after{content:"";display:block;flex:none;height:2px;margin:1px 2px 0;border-radius:2px;background:var(--dsw-alias-brand-primary)}',
|
|
1969
|
+
'.ez-quad.is-drop-target{outline:1px dashed var(--dsw-alias-brand-primary);outline-offset:-3px}',
|
|
1970
|
+
'.ez-toast{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);z-index:60;pointer-events:none;display:flex;align-items:center;gap:10px;max-width:min(360px,calc(100vw - 64px));padding:16px 24px;border:.5px solid var(--dsw-alias-border-l2);border-radius:14px;background:var(--dsw-alias-bg-overlay);color:var(--dsw-alias-label-primary);font-size:14.5px;line-height:1.5;box-shadow:0 16px 44px color-mix(in srgb,var(--dsw-alias-label-primary) 18%,transparent);animation:ez-toast-in .24s ease-out}',
|
|
1971
|
+
'.ez-toast-mark{display:grid;place-items:center;flex:none;width:22px;height:22px;border-radius:50%;background:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-bg-overlay);font-size:12px;font-weight:700;line-height:1}',
|
|
1972
|
+
'.ez-toast--cheer{border-color:color-mix(in srgb,var(--dsw-alias-brand-primary) 42%,var(--dsw-alias-border-l2))}',
|
|
1973
|
+
'.ez-toast--cheer .ez-toast-mark{background:var(--dsw-alias-brand-primary);font-size:13px}',
|
|
1974
|
+
'@keyframes ez-toast-in{from{opacity:0;transform:translate(-50%,-50%) scale(.95)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}',
|
|
1975
|
+
'.ez-add-input::placeholder{color:var(--dsw-alias-state-idle-primary)}',
|
|
1976
|
+
'.ez-quick-add{box-sizing:border-box;display:flex;align-items:center;gap:6px;height:26px;margin:0;padding:0 6px;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;line-height:1;cursor:pointer;opacity:.78;appearance:none;-webkit-appearance:none}',
|
|
1977
|
+
'.ez-quick-add:hover{opacity:1;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}',
|
|
1978
|
+
'.ez-quick-add:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1979
|
+
'.ez-quick-plus{font-size:14px;line-height:1}',
|
|
1980
|
+
'.ez-add-input{box-sizing:border-box;flex:1 1 auto;min-width:0;width:auto;height:30px;margin:0;padding:0 9px;border:.5px solid var(--dsw-alias-brand-primary);border-radius:7px;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font:inherit;font-size:var(--ez-font-size,13px);outline:none}',
|
|
1981
|
+
'.ez-add-input::placeholder{color:var(--dsw-alias-state-idle-primary)}',
|
|
1982
|
+
'.ez-completed{box-sizing:border-box;display:flex;flex:1 1 auto;flex-direction:column;min-height:0;margin-top:16px;border:.5px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-1)}',
|
|
1983
|
+
'.ez-completed-head{display:flex;flex:none;align-items:center;gap:8px;padding:12px 13px 6px}',
|
|
1984
|
+
'.ez-completed-title{margin:0;font-size:13px;line-height:1;font-weight:600}',
|
|
1985
|
+
'.ez-completed-count{font-size:11px;line-height:1;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}',
|
|
1986
|
+
'.ez-clear{box-sizing:border-box;margin:0 0 0 auto;padding:4px 9px;border:.5px solid var(--dsw-alias-border-l2);border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11.5px;line-height:1;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1987
|
+
'.ez-clear:hover{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}',
|
|
1988
|
+
'.ez-clear.is-confirming{border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}',
|
|
1989
|
+
'.ez-clear:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1990
|
+
'.ez-completed .ez-list{padding:0 11px 9px}',
|
|
1991
|
+
'.ez-completed-body{display:flex;flex:1 1 auto;min-height:0}',
|
|
1992
|
+
'.ez-blank{margin:0;padding:20px;font-size:12.5px;line-height:20px;text-align:center;color:var(--dsw-alias-label-secondary)}',
|
|
1993
|
+
'.ez-completed-body .ez-blank{margin:auto}',
|
|
1994
|
+
'@media (max-width:640px){.ez-inner{padding:16px 14px}.ez-matrix{min-height:420px;margin-top:12px}.ez-matrix--cards{gap:9px}.ez-matrix--cards .ez-quad,.ez-matrix--grid .ez-quad,.ez-matrix--cross .ez-quad{padding:10px 10px 7px}.ez-quad-hint{display:none}.ez-head-actions{width:100%;justify-content:space-between}.ez-set-label{width:100%}}',
|
|
1995
|
+
'@media (prefers-reduced-motion:reduce){.ez-actions{transition:none}}',
|
|
1996
|
+
].join('\n');
|
|
1997
|
+
|
|
1998
|
+
return {
|
|
1999
|
+
inject: ['slots', 'locale'],
|
|
2000
|
+
apply(ctx) {
|
|
2001
|
+
ctx.effect(() => ctx.locale.register(NS, { en: EN, zh: ZH }), 'matrix-todo: dictionaries');
|
|
2002
|
+
const t = ctx.locale.bind(NS);
|
|
2003
|
+
// Detached service methods lose their receiver, so the page binds
|
|
2004
|
+
// through stable wrappers instead of passing `locale.subscribe` directly.
|
|
2005
|
+
const localeSource = Object.freeze({
|
|
2006
|
+
subscribe: (listener) => ctx.locale.subscribe(listener),
|
|
2007
|
+
getSnapshot: () => ctx.locale.getSnapshot(),
|
|
2008
|
+
});
|
|
1839
2009
|
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
'.ez-head{display:flex;flex:none;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap}',
|
|
1846
|
-
'.ez-heading{display:flex;flex-direction:column;gap:4px;min-width:0}',
|
|
1847
|
-
'.ez-head-actions{display:flex;flex:none;align-items:center;gap:10px}',
|
|
1848
|
-
'.ez-page-title{margin:0;font-size:20px;line-height:28px;font-weight:600;letter-spacing:-.01em}',
|
|
1849
|
-
'.ez-sub{margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);letter-spacing:.02em}',
|
|
1850
|
-
'.ez-seg{display:inline-flex;flex:none;gap:2px;padding:2px;border:.5px solid var(--dsw-alias-border-l2);border-radius:9px;background:var(--dsw-alias-bg-layer-1)}',
|
|
1851
|
-
'.ez-seg-btn{box-sizing:border-box;display:inline-flex;align-items:center;gap:6px;height:26px;margin:0;padding:0 11px;border:0;border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12.5px;line-height:1;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1852
|
-
'.ez-seg-btn:hover{color:var(--dsw-alias-label-primary)}',
|
|
1853
|
-
'.ez-seg-btn.is-active{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}',
|
|
1854
|
-
'.ez-seg-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1855
|
-
'.ez-seg--sm .ez-seg-btn{height:24px;padding:0 9px;font-size:11.5px}',
|
|
1856
|
-
'.ez-count{font-size:11px;line-height:1;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}',
|
|
1857
|
-
'.ez-icon-btn{box-sizing:border-box;display:grid;place-items:center;width:28px;height:28px;margin:0;padding:0;border:.5px solid var(--dsw-alias-border-l2);border-radius:8px;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1858
|
-
'.ez-icon-btn:hover{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}',
|
|
1859
|
-
'.ez-icon-btn.is-on{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}',
|
|
1860
|
-
'.ez-icon-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1861
|
-
'.ez-settings{display:flex;flex:none;flex-direction:column;gap:10px;margin-top:14px;padding:12px 14px;border:.5px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-1)}',
|
|
1862
|
-
'.ez-set-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}',
|
|
1863
|
-
'.ez-set-about{display:flex;align-items:center;flex-wrap:wrap;gap:6px 14px;margin-top:4px;padding-top:10px;border-top:.5px solid var(--dsw-alias-border-l1)}',
|
|
1864
|
-
'.ez-about-dev{display:inline-flex;align-items:center;gap:5px;margin-left:auto;font-size:12px;line-height:1;color:var(--dsw-alias-label-secondary)}',
|
|
1865
|
-
'.ez-about-dev-label{font-style:italic}',
|
|
1866
|
-
'.ez-about-avatar{width:16px;height:16px;flex:0 0 auto;border-radius:50%;object-fit:cover;background:var(--dsw-alias-bg-layer-2)}',
|
|
1867
|
-
'.ez-about-link{display:inline-flex;align-items:center;gap:5px;padding:1px 0;border-radius:5px;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1;text-decoration:none;cursor:pointer;transition:color .16s ease}',
|
|
1868
|
-
'.ez-about-link:hover,.ez-about-link:focus-visible{color:var(--dsw-alias-brand-primary);text-decoration:underline;text-underline-offset:3px;outline:none}',
|
|
1869
|
-
'.ez-set-label{flex:none;width:68px;font-size:12px;line-height:1;color:var(--dsw-alias-label-secondary)}',
|
|
1870
|
-
'.ez-set-slider{display:flex;flex:1 1 auto;align-items:center;gap:10px;min-width:0}',
|
|
1871
|
-
'.ez-range{flex:1 1 120px;max-width:240px;height:18px;margin:0;accent-color:var(--dsw-alias-brand-primary);background:transparent}',
|
|
1872
|
-
'.ez-set-value{flex:none;width:44px;text-align:right;font-size:11px;line-height:1;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}',
|
|
1873
|
-
'.ez-text-field{box-sizing:border-box;flex:0 1 260px;min-width:0;height:28px;margin:0;padding:0 9px;border:.5px solid var(--dsw-alias-border-l2);border-radius:7px;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;outline:none}',
|
|
1874
|
-
'.ez-text-field::placeholder{color:var(--dsw-alias-state-idle-primary)}',
|
|
1875
|
-
'.ez-text-field:focus{border-color:var(--dsw-alias-brand-primary)}',
|
|
1876
|
-
'.ez-reset--inline{margin-left:auto}',
|
|
1877
|
-
'.ez-reset{box-sizing:border-box;margin:0;padding:4px 9px;border:.5px solid var(--dsw-alias-border-l2);border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11.5px;line-height:1;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1878
|
-
'.ez-reset:hover{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}',
|
|
1879
|
-
'.ez-reset:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1880
|
-
'.ez-error{display:flex;flex:none;align-items:center;gap:10px;margin-top:10px;font-size:12px;line-height:18px;color:var(--dsw-alias-state-error-primary)}',
|
|
1881
|
-
'.ez-retry{box-sizing:border-box;margin:0;padding:0;border:0;background:transparent;color:inherit;font:inherit;font-size:12px;text-decoration:underline;text-underline-offset:2px;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1882
|
-
'.ez-retry:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}',
|
|
1883
|
-
'.ez-body{display:flex;flex:1 1 auto;min-height:0}',
|
|
1884
|
-
'.ez-matrix{position:relative;display:grid;flex:1 1 auto;min-height:340px;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;margin-top:16px}',
|
|
1885
|
-
'.ez-matrix--cards{gap:14px}',
|
|
1886
|
-
'.ez-matrix--grid{gap:1px;border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--ez-radius,10px);background:var(--dsw-alias-border-l1);overflow:hidden}',
|
|
1887
|
-
'.ez-matrix--cross{gap:0;border:0;border-radius:var(--ez-radius,10px);overflow:hidden}',
|
|
1888
|
-
'.ez-matrix--cross::before{content:"";position:absolute;top:0;bottom:0;left:calc(var(--ez-col-ratio,.5) * 100%);width:1px;margin-left:-.5px;background:var(--dsw-alias-border-l1);z-index:1;pointer-events:none}',
|
|
1889
|
-
'.ez-matrix--cross::after{content:"";position:absolute;left:0;right:0;top:calc(var(--ez-row-ratio,.5) * 100%);height:1px;margin-top:-.5px;background:var(--dsw-alias-border-l1);z-index:1;pointer-events:none}',
|
|
1890
|
-
'.ez-split{position:absolute;left:calc(var(--ez-col-ratio,.5) * 100%);top:calc(var(--ez-row-ratio,.5) * 100%);z-index:6;box-sizing:border-box;display:grid;place-items:center;width:20px;height:20px;margin:-10px 0 0 -10px;padding:0;border:.5px solid var(--dsw-alias-border-l2);border-radius:50%;background:var(--dsw-alias-bg-overlay);color:var(--dsw-alias-label-secondary);cursor:move;opacity:0;transition:opacity .12s ease,border-color .12s ease,color .12s ease;appearance:none;-webkit-appearance:none}',
|
|
1891
|
-
'.ez-split.is-visible,.ez-split:focus-visible{opacity:1}',
|
|
1892
|
-
'.ez-split-dot{display:block;width:6px;height:6px;border-radius:50%;background:currentColor}',
|
|
1893
|
-
'.ez-split:hover{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}',
|
|
1894
|
-
'.ez-split:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1895
|
-
'.ez-split.is-dragging{opacity:1;border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}',
|
|
1896
|
-
'.ez-split.is-snap{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary);box-shadow:0 0 0 4px color-mix(in srgb,var(--dsw-alias-brand-primary) 20%,transparent)}',
|
|
1897
|
-
'.ez-split-center{position:absolute;left:50%;top:50%;z-index:5;width:0;height:0;pointer-events:none;color:var(--dsw-alias-brand-primary);opacity:.85;transition:opacity .12s ease}',
|
|
1898
|
-
'.ez-split-center-h{position:absolute;left:-28px;top:-.5px;width:56px;height:1px;background:linear-gradient(to right,transparent,currentColor 22%,currentColor 78%,transparent);opacity:.55;transition:opacity .12s ease}',
|
|
1899
|
-
'.ez-split-center-v{position:absolute;top:-28px;left:-.5px;height:56px;width:1px;background:linear-gradient(to bottom,transparent,currentColor 22%,currentColor 78%,transparent);opacity:.55;transition:opacity .12s ease}',
|
|
1900
|
-
'.ez-split-center-dot{position:absolute;left:-3px;top:-3px;width:6px;height:6px;border-radius:50%;background:currentColor;opacity:.9;transition:transform .12s ease,box-shadow .12s ease,opacity .12s ease}',
|
|
1901
|
-
'.ez-split-center.is-active{opacity:1}',
|
|
1902
|
-
'.ez-split-center.is-active .ez-split-center-h,.ez-split-center.is-active .ez-split-center-v{opacity:.95}',
|
|
1903
|
-
'.ez-split-center.is-active .ez-split-center-dot{opacity:1;transform:scale(1.35);box-shadow:0 0 0 4px color-mix(in srgb,var(--dsw-alias-brand-primary) 22%,transparent)}',
|
|
1904
|
-
'@media (hover:none){.ez-split{opacity:1}}',
|
|
1905
|
-
'.ez-matrix--truncate .ez-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;overflow-wrap:normal;word-break:normal}',
|
|
1906
|
-
'.ez-quad{box-sizing:border-box;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden}',
|
|
1907
|
-
'.ez-matrix--cards .ez-quad{padding:12px 13px 9px;border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--ez-radius,10px);background:var(--dsw-alias-bg-layer-1)}',
|
|
1908
|
-
'.ez-matrix--grid .ez-quad{padding:12px 13px 9px;border:0;border-radius:0;background:var(--dsw-alias-bg-layer-1)}',
|
|
1909
|
-
'.ez-matrix--cross .ez-quad{padding:12px 13px 9px;border:0;border-radius:0;background:transparent}',
|
|
1910
|
-
'.ez-matrix--tint .ez-quad--q1{background:var(--dsw-alias-bg-layer-1);background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 8%,var(--dsw-alias-bg-layer-1))}',
|
|
1911
|
-
'.ez-matrix--tint .ez-quad--q2{background:var(--dsw-alias-bg-layer-1);background:color-mix(in srgb,var(--dsw-alias-brand-primary) 7%,var(--dsw-alias-bg-layer-1))}',
|
|
1912
|
-
'.ez-matrix--tint .ez-quad--q3{background:var(--dsw-alias-bg-layer-1);background:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 9%,var(--dsw-alias-bg-layer-1))}',
|
|
1913
|
-
'.ez-matrix--tint .ez-quad--q4{background:var(--dsw-alias-bg-layer-1);background:color-mix(in srgb,var(--dsw-alias-state-idle-primary) 9%,var(--dsw-alias-bg-layer-1))}',
|
|
1914
|
-
'.ez-quad-head{display:flex;flex:none;align-items:center;gap:7px;height:24px}',
|
|
1915
|
-
'.ez-dot{flex:none;width:6px;height:6px;border-radius:50%}',
|
|
1916
|
-
'.ez-quad--q1 .ez-dot{background:var(--dsw-alias-state-error-primary)}',
|
|
1917
|
-
'.ez-quad--q2 .ez-dot{background:var(--dsw-alias-brand-primary)}',
|
|
1918
|
-
'.ez-quad--q3 .ez-dot{background:var(--dsw-alias-state-warn-primary)}',
|
|
1919
|
-
'.ez-quad--q4 .ez-dot{background:var(--dsw-alias-state-idle-primary)}',
|
|
1920
|
-
'.ez-quad-name{margin:0;font-size:13px;line-height:1;font-weight:600;letter-spacing:.01em;white-space:nowrap}',
|
|
1921
|
-
'.ez-quad-hint{min-width:0;font-size:11px;line-height:1;color:var(--dsw-alias-label-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
|
|
1922
|
-
'.ez-quad-count{margin-left:auto;font-size:11px;line-height:1;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}',
|
|
1923
|
-
'.ez-list{display:flex;flex:1 1 auto;flex-direction:column;gap:1px;min-height:0;margin:6px 0 0;padding:0;list-style:none;overflow-y:auto}',
|
|
1924
|
-
'.ez-row{display:flex;flex:none;align-items:flex-start;gap:8px;min-height:30px;padding:4px 2px 4px 3px;border-radius:7px}',
|
|
1925
|
-
'.ez-row:hover{background:var(--dsw-alias-bg-layer-2)}',
|
|
1926
|
-
'.ez-check{box-sizing:border-box;flex:none;width:15px;height:15px;margin:calc((var(--ez-font-size,13px) * 1.55 - 15px) / 2) 0 0 0;padding:0;accent-color:var(--dsw-alias-brand-primary);cursor:pointer}',
|
|
1927
|
-
'.ez-check:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}',
|
|
1928
|
-
'.ez-title{flex:1 1 auto;min-width:0;font-size:var(--ez-font-size,13px);line-height:1.55;white-space:normal;overflow-wrap:anywhere;word-break:break-word;cursor:text}',
|
|
1929
|
-
'.ez-title-input{flex:1 1 auto;min-width:0;margin:0;padding:0 0 1px;border:0;border-bottom:1px solid var(--dsw-alias-brand-primary,currentColor);border-radius:0;background:transparent;color:inherit;font:inherit;font-size:var(--ez-font-size,13px);line-height:1.55;outline:none;white-space:normal;overflow-wrap:anywhere;word-break:break-word}',
|
|
1930
|
-
'.ez-title--done{color:var(--dsw-alias-label-secondary);text-decoration:line-through;text-decoration-thickness:.5px}',
|
|
1931
|
-
'.ez-date{flex:none;margin-top:calc((var(--ez-font-size,13px) * 1.55 - 22px) / 2);font-size:calc(var(--ez-font-size,13px) * .82);line-height:22px;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}',
|
|
1932
|
-
'.ez-actions{display:flex;flex:none;align-items:center;justify-content:flex-end;gap:2px;width:0;overflow:hidden;margin-top:calc((var(--ez-font-size,13px) * 1.55 - 22px) / 2);opacity:0;transition:width .13s ease,opacity .13s ease}',
|
|
1933
|
-
'.ez-row:hover .ez-actions,.ez-row:focus-within .ez-actions{width:96px;opacity:1}',
|
|
1934
|
-
'@media (hover:none){.ez-actions{width:96px;opacity:1}}',
|
|
1935
|
-
'.ez-mini{box-sizing:border-box;display:grid;place-items:center;width:22px;height:22px;margin:0;padding:0;border:0;border-radius:5px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1936
|
-
'.ez-mini:hover{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}',
|
|
1937
|
-
'.ez-mini.is-on{color:var(--dsw-alias-brand-primary)}',
|
|
1938
|
-
'.ez-mini:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1939
|
-
'.ez-add-area{display:flex;flex:none;align-items:center;flex-wrap:wrap;gap:6px;margin-top:6px}',
|
|
1940
|
-
'.ez-date-field{box-sizing:border-box;flex:none;display:inline-flex;align-items:center;justify-content:center;gap:5px;height:30px;margin:0;padding:0 8px;border:.5px solid var(--dsw-alias-border-l2);border-radius:7px;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary);font:inherit;font-size:11.5px;line-height:1;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1941
|
-
'.ez-date-field--empty{flex:0 0 40px;width:40px;padding:0}',
|
|
1942
|
-
'.ez-date-field--set{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums}',
|
|
1943
|
-
'.ez-date-field:hover{border-color:var(--dsw-alias-border-l3);color:var(--dsw-alias-label-primary)}',
|
|
1944
|
-
'.ez-date-field:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1945
|
-
'.ez-picker{position:fixed;z-index:70;box-sizing:border-box;width:252px;padding:10px;border:.5px solid var(--dsw-alias-border-l2);border-radius:12px;background:var(--dsw-alias-bg-overlay);box-shadow:0 16px 44px color-mix(in srgb,var(--dsw-alias-label-primary) 16%,transparent);user-select:none}',
|
|
1946
|
-
'.ez-picker-head{display:flex;align-items:center;justify-content:space-between;gap:4px;height:28px;margin-bottom:6px}',
|
|
1947
|
-
'.ez-picker-title{font-size:12.5px;line-height:1;font-weight:600;color:var(--dsw-alias-label-primary)}',
|
|
1948
|
-
'.ez-picker-nav{box-sizing:border-box;display:grid;place-items:center;width:24px;height:24px;margin:0;padding:0;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:15px;line-height:1;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1949
|
-
'.ez-picker-nav:hover{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}',
|
|
1950
|
-
'.ez-picker-nav:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1951
|
-
'.ez-picker-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}',
|
|
1952
|
-
'.ez-picker-grid--wd{margin-bottom:2px}',
|
|
1953
|
-
'.ez-picker-wd{display:grid;place-items:center;height:22px;font-size:10.5px;line-height:1;color:var(--dsw-alias-label-secondary)}',
|
|
1954
|
-
'.ez-picker-cell{display:block;height:28px}',
|
|
1955
|
-
'.ez-picker-day{box-sizing:border-box;display:grid;place-items:center;width:100%;height:28px;margin:0;padding:0;border:0;border-radius:7px;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:11.5px;line-height:1;cursor:pointer;appearance:none;-webkit-appearance:none;font-variant-numeric:tabular-nums}',
|
|
1956
|
-
'.ez-picker-day:hover{background:var(--dsw-alias-bg-layer-2)}',
|
|
1957
|
-
'.ez-picker-day:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-1px}',
|
|
1958
|
-
'.ez-picker-day.is-today{color:var(--dsw-alias-brand-primary);font-weight:600}',
|
|
1959
|
-
'.ez-picker-day.is-selected{background:var(--dsw-alias-brand-primary);color:var(--dsw-alias-bg-base);font-weight:600}',
|
|
1960
|
-
'.ez-picker-day.is-selected:hover{opacity:.9}',
|
|
1961
|
-
'.ez-picker-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:8px;padding-top:8px;border-top:.5px solid var(--dsw-alias-border-l1)}',
|
|
1962
|
-
'.ez-picker-link{box-sizing:border-box;margin:0;padding:3px 5px;border:0;border-radius:5px;background:transparent;color:var(--dsw-alias-brand-primary);font:inherit;font-size:11.5px;line-height:1;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1963
|
-
'.ez-picker-link:hover:not(:disabled){background:var(--dsw-alias-bg-layer-2)}',
|
|
1964
|
-
'.ez-picker-link:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1965
|
-
'.ez-picker-link:disabled{color:var(--dsw-alias-state-idle-primary);cursor:default}',
|
|
1966
|
-
'.ez-due{box-sizing:border-box;flex:none;display:inline-flex;align-items:center;height:22px;line-height:22px;margin:calc((var(--ez-font-size,13px) * 1.55 - 22px) / 2) 0 0 6px;padding:0 1px;border:0;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:calc(var(--ez-font-size,13px) * .82);cursor:pointer;appearance:none;-webkit-appearance:none;font-variant-numeric:tabular-nums;white-space:nowrap}',
|
|
1967
|
-
'.ez-due:hover{color:var(--dsw-alias-label-primary)}',
|
|
1968
|
-
'.ez-due:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px;border-radius:4px}',
|
|
1969
|
-
'.ez-due--today{color:var(--dsw-alias-state-warn-primary);font-weight:600}',
|
|
1970
|
-
'.ez-due--overdue{color:var(--dsw-alias-state-error-primary);font-weight:600}',
|
|
1971
|
-
'.ez-row[draggable=true]{cursor:grab}',
|
|
1972
|
-
'.ez-row[draggable=true]:active{cursor:grabbing}',
|
|
1973
|
-
'.ez-row.is-overdue .ez-title{color:var(--dsw-alias-state-error-primary)}',
|
|
1974
|
-
'.ez-row.is-dragging{opacity:.35}',
|
|
1975
|
-
'.ez-row.is-drop-before{box-shadow:inset 0 2px 0 var(--dsw-alias-brand-primary)}',
|
|
1976
|
-
'.ez-list.is-drop-end::after{content:"";display:block;flex:none;height:2px;margin:1px 2px 0;border-radius:2px;background:var(--dsw-alias-brand-primary)}',
|
|
1977
|
-
'.ez-quad.is-drop-target{outline:1px dashed var(--dsw-alias-brand-primary);outline-offset:-3px}',
|
|
1978
|
-
'.ez-toast{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);z-index:60;pointer-events:none;display:flex;align-items:center;gap:10px;max-width:min(360px,calc(100vw - 64px));padding:16px 24px;border:.5px solid var(--dsw-alias-border-l2);border-radius:14px;background:var(--dsw-alias-bg-overlay);color:var(--dsw-alias-label-primary);font-size:14.5px;line-height:1.5;box-shadow:0 16px 44px color-mix(in srgb,var(--dsw-alias-label-primary) 18%,transparent);animation:ez-toast-in .24s ease-out}',
|
|
1979
|
-
'.ez-toast-mark{display:grid;place-items:center;flex:none;width:22px;height:22px;border-radius:50%;background:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-bg-overlay);font-size:12px;font-weight:700;line-height:1}',
|
|
1980
|
-
'.ez-toast--cheer{border-color:color-mix(in srgb,var(--dsw-alias-brand-primary) 42%,var(--dsw-alias-border-l2))}',
|
|
1981
|
-
'.ez-toast--cheer .ez-toast-mark{background:var(--dsw-alias-brand-primary);font-size:13px}',
|
|
1982
|
-
'@keyframes ez-toast-in{from{opacity:0;transform:translate(-50%,-50%) scale(.95)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}',
|
|
1983
|
-
'.ez-add-input::placeholder{color:var(--dsw-alias-state-idle-primary)}',
|
|
1984
|
-
'.ez-quick-add{box-sizing:border-box;display:flex;align-items:center;gap:6px;height:26px;margin:0;padding:0 6px;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;line-height:1;cursor:pointer;opacity:.78;appearance:none;-webkit-appearance:none}',
|
|
1985
|
-
'.ez-quick-add:hover{opacity:1;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}',
|
|
1986
|
-
'.ez-quick-add:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1987
|
-
'.ez-quick-plus{font-size:14px;line-height:1}',
|
|
1988
|
-
'.ez-add-input{box-sizing:border-box;flex:1 1 auto;min-width:0;width:auto;height:30px;margin:0;padding:0 9px;border:.5px solid var(--dsw-alias-brand-primary);border-radius:7px;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font:inherit;font-size:var(--ez-font-size,13px);outline:none}',
|
|
1989
|
-
'.ez-add-input::placeholder{color:var(--dsw-alias-state-idle-primary)}',
|
|
1990
|
-
'.ez-completed{box-sizing:border-box;display:flex;flex:1 1 auto;flex-direction:column;min-height:0;margin-top:16px;border:.5px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-1)}',
|
|
1991
|
-
'.ez-completed-head{display:flex;flex:none;align-items:center;gap:8px;padding:12px 13px 6px}',
|
|
1992
|
-
'.ez-completed-title{margin:0;font-size:13px;line-height:1;font-weight:600}',
|
|
1993
|
-
'.ez-completed-count{font-size:11px;line-height:1;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}',
|
|
1994
|
-
'.ez-clear{box-sizing:border-box;margin:0 0 0 auto;padding:4px 9px;border:.5px solid var(--dsw-alias-border-l2);border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11.5px;line-height:1;cursor:pointer;appearance:none;-webkit-appearance:none}',
|
|
1995
|
-
'.ez-clear:hover{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}',
|
|
1996
|
-
'.ez-clear.is-confirming{border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}',
|
|
1997
|
-
'.ez-clear:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}',
|
|
1998
|
-
'.ez-completed .ez-list{padding:0 11px 9px}',
|
|
1999
|
-
'.ez-completed-body{display:flex;flex:1 1 auto;min-height:0}',
|
|
2000
|
-
'.ez-blank{margin:0;padding:20px;font-size:12.5px;line-height:20px;text-align:center;color:var(--dsw-alias-label-secondary)}',
|
|
2001
|
-
'.ez-completed-body .ez-blank{margin:auto}',
|
|
2002
|
-
'@media (max-width:640px){.ez-inner{padding:16px 14px}.ez-matrix{min-height:420px;margin-top:12px}.ez-matrix--cards{gap:9px}.ez-matrix--cards .ez-quad,.ez-matrix--grid .ez-quad,.ez-matrix--cross .ez-quad{padding:10px 10px 7px}.ez-quad-hint{display:none}.ez-head-actions{width:100%;justify-content:space-between}.ez-set-label{width:100%}}',
|
|
2003
|
-
'@media (prefers-reduced-motion:reduce){.ez-actions{transition:none}}',
|
|
2004
|
-
].join('\n');
|
|
2010
|
+
// The sidebar row text can be renamed from the settings panel. The slot
|
|
2011
|
+
// label is a thunk read on projection, so renaming re-registers the row
|
|
2012
|
+
// to make the sidebar show the new text immediately.
|
|
2013
|
+
let navOverride = '';
|
|
2014
|
+
let sidebarDisposer = null;
|
|
2005
2015
|
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2016
|
+
const mountSidebarRow = () => {
|
|
2017
|
+
if (sidebarDisposer !== null) {
|
|
2018
|
+
sidebarDisposer();
|
|
2019
|
+
sidebarDisposer = null;
|
|
2020
|
+
}
|
|
2021
|
+
const disposer = ctx.slots.register(
|
|
2022
|
+
{
|
|
2023
|
+
name: 'sidebar.panellist',
|
|
2024
|
+
id: PANEL_ID,
|
|
2025
|
+
order: ORDER,
|
|
2026
|
+
label: () => (navOverride !== '' ? navOverride : t('nav.label')),
|
|
2027
|
+
locale: NS,
|
|
2028
|
+
},
|
|
2029
|
+
PanelIcon,
|
|
2030
|
+
);
|
|
2031
|
+
sidebarDisposer = typeof disposer === 'function' ? disposer : null;
|
|
2032
|
+
};
|
|
2017
2033
|
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2034
|
+
const setNavLabel = (value) => {
|
|
2035
|
+
const next = typeof value === 'string' ? value.trim() : '';
|
|
2036
|
+
if (next === navOverride) return;
|
|
2037
|
+
navOverride = next;
|
|
2038
|
+
mountSidebarRow();
|
|
2039
|
+
};
|
|
2023
2040
|
|
|
2024
|
-
|
|
2041
|
+
ctx.slots.inject('sidebar.panellist', () => {
|
|
2042
|
+
mountSidebarRow();
|
|
2043
|
+
return () => {
|
|
2025
2044
|
if (sidebarDisposer !== null) {
|
|
2026
2045
|
sidebarDisposer();
|
|
2027
2046
|
sidebarDisposer = null;
|
|
2028
2047
|
}
|
|
2029
|
-
const disposer = ctx.slots.register(
|
|
2030
|
-
{
|
|
2031
|
-
name: 'sidebar.panellist',
|
|
2032
|
-
id: PANEL_ID,
|
|
2033
|
-
order: ORDER,
|
|
2034
|
-
label: () => (navOverride !== '' ? navOverride : t('nav.label')),
|
|
2035
|
-
locale: NS,
|
|
2036
|
-
},
|
|
2037
|
-
PanelIcon,
|
|
2038
|
-
);
|
|
2039
|
-
sidebarDisposer = typeof disposer === 'function' ? disposer : null;
|
|
2040
|
-
};
|
|
2041
|
-
|
|
2042
|
-
const setNavLabel = (value) => {
|
|
2043
|
-
const next = typeof value === 'string' ? value.trim() : '';
|
|
2044
|
-
if (next === navOverride) return;
|
|
2045
|
-
navOverride = next;
|
|
2046
|
-
mountSidebarRow();
|
|
2047
2048
|
};
|
|
2049
|
+
});
|
|
2048
2050
|
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
locale: NS,
|
|
2065
|
-
inject: () => ({ t, localeSource, setNavLabel }),
|
|
2066
|
-
},
|
|
2067
|
-
TodoPage,
|
|
2068
|
-
),
|
|
2069
|
-
);
|
|
2070
|
-
},
|
|
2071
|
-
};
|
|
2072
|
-
},
|
|
2073
|
-
});
|
|
2074
|
-
}
|
|
2051
|
+
ctx.slots.inject('main', () =>
|
|
2052
|
+
ctx.slots.register(
|
|
2053
|
+
{
|
|
2054
|
+
name: 'main',
|
|
2055
|
+
key: PANEL_ID,
|
|
2056
|
+
locale: NS,
|
|
2057
|
+
inject: () => ({ t, localeSource, setNavLabel }),
|
|
2058
|
+
},
|
|
2059
|
+
TodoPage,
|
|
2060
|
+
),
|
|
2061
|
+
);
|
|
2062
|
+
},
|
|
2063
|
+
};
|
|
2064
|
+
},
|
|
2065
|
+
});
|