dsh-engramory 1.1.0 → 1.2.0
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/README.en.md +24 -23
- package/README.md +1 -1
- package/client.js +411 -255
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -140,29 +140,30 @@ owner, so a program forwarding other people's messages must leave it out.
|
|
|
140
140
|
mode, memory access and the index cap. Saving goes through dsh's own profile editor,
|
|
141
141
|
which writes your profile's `cordis.patch.yml` and reloads the plugin. Only you, signed
|
|
142
142
|
in, can call it, so an agent cannot use it to switch social mode off.
|
|
143
|
-
- **Memory page:** *Memory* in the sidebar.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
by type
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
143
|
+
- **Memory page:** *Memory* in the sidebar. A banner at the top says how many notes,
|
|
144
|
+
stores and archived files are listed and when they were read, with the switches
|
|
145
|
+
(companion mode, and memory access once it is on) that save as you flip them. Below it,
|
|
146
|
+
tabs by note type and a filter by name, over the global store and each workspace's
|
|
147
|
+
project store (with an absolute `indexPath`, that store alone; with a relative one,
|
|
148
|
+
none). Each note is a row: a mark for its type, its name, its type and size; a plan's
|
|
149
|
+
row gives its day and how far off it is (a passed date is an outcome to confirm, as a
|
|
150
|
+
reminder: nothing is archived), and a note past 12 KB or one the index leaves out is
|
|
151
|
+
marked. Beside each store's name: its index fill as a bar (to the nearer of its two
|
|
152
|
+
caps), *Open the index* and *Open the folder*. What its check-up finds is listed under
|
|
153
|
+
it: the index's links to files that are not there, the notes not in the index (recall
|
|
154
|
+
starts from the index, so the AI will not find them unless another note links to
|
|
155
|
+
them), notes with no type, notes past 12 KB, an index over the cap; *Copy tidy-up
|
|
156
|
+
instructions* copies a request for the AI to paste into a conversation, and the plugin
|
|
157
|
+
itself changes no file. The check-up goes by file names and the index's links alone,
|
|
158
|
+
never through a symbolic link, and is skipped when the index is over the cap, there is
|
|
159
|
+
too much to check, or a file cannot be read; `engramory_doctor.py` still does the full
|
|
160
|
+
check. Where the listing was cut short or a store could not be read, the page says so,
|
|
161
|
+
rather than counting that as nothing. Read-only, never a note's text; a name, *Open
|
|
162
|
+
the index* and *Open the folder* open on the machine dsh runs on; a machine with no
|
|
163
|
+
desktop (a headless server, a session over SSH) shows none of them. A short *How to use
|
|
164
|
+
it* follows, open while there is no memory yet. At the foot, where to send feedback: a
|
|
165
|
+
new GitHub issue (its body pre-filled with the plugin's version and the OS family, no
|
|
166
|
+
path and no note), or an email, with a button that copies the address.
|
|
166
167
|
|
|
167
168
|
## Configuration
|
|
168
169
|
|
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ agent.followup(createUserMessage({
|
|
|
77
77
|

|
|
78
78
|
|
|
79
79
|
- **设置页**:dsh 的「插件」页里点开「Engramory 记忆」,能改大肥鱼模式、记忆权限和索引上限。保存走 dsh 自己的配置服务,写进你 profile 的 `cordis.patch.yml` 并重新加载插件。这个接口只有登录了的你能调,AI 没法调用它关掉社交模式。
|
|
80
|
-
-
|
|
80
|
+
- **记忆页**:左侧栏「记忆」。最上面一条横幅:列出了多少笔记、几个记忆库、多少归档,什么时候读的,还有两个开关(大肥鱼模式,打开后还有记忆权限),拨了就保存。下面按笔记类型分标签、可按名字筛选,列出全局库和各工作区的项目库(设了绝对路径的 `indexPath` 时只列那一个,相对路径则列不出)。每条笔记一行:类型图标、名字、类型和大小;约定那一行标出日期和还有几天(日期已过的写「待确认」,只是提醒,不会自动归档),超过 12 KB 的标「偏大,建议拆分」,不在索引里的也会标出。每个库名旁边是索引用量(进度条按两项上限里离得近的那个画)和「打开索引」「打开文件夹」。体检发现的问题集中列在库下面:索引里指向不存在的文件、不在索引里的笔记(AI 回忆从索引开始,除非别的笔记链到它们,否则通常找不到)、没写类型的笔记、超过 12 KB 的笔记、索引超上限;旁边的「复制整理指令」复制一段给 AI 的整理要求,粘贴进对话即可,插件本身不改任何文件。体检只按文件名和索引里的链接判断,不顺着符号链接走;索引超上限、要核对的太多或有文件读不了时不做,完整检查仍用 `engramory_doctor.py`。列表被截断或有库读不了时会注明,不把没列到的算成零。只读,不显示正文;点名字、「打开索引」「打开文件夹」都在运行 dsh 的那台机器上打开;没有桌面的机器(无界面服务器、SSH 连过去的)不显示这些按钮。下面有一段「怎么用」,还没有记忆时自动展开。页底是反馈入口:到 GitHub 提 issue(正文预先写好插件版本和系统类型,不带路径和笔记),或发邮件,地址可以一键复制。
|
|
81
81
|
|
|
82
82
|
## 配置
|
|
83
83
|
|
package/client.js
CHANGED
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Plain script, no build step, like index.js: React comes from the page's module table,
|
|
10
10
|
* no Harness client package is loaded as a module (dsh's guidance — they change without
|
|
11
|
-
* notice), and
|
|
12
|
-
* follow
|
|
11
|
+
* notice), and the colours are the host's theme tokens, so light, dark and third-party themes
|
|
12
|
+
* follow — but for the memory page's banner, in the project's own navy and mint on any theme,
|
|
13
|
+
* that mint again in an index's fill bar and a clean check-up's tick, and the note types'
|
|
14
|
+
* marks, each a muted colour of its own leaned toward the theme's text.
|
|
15
|
+
* Visible text goes through the locale service.
|
|
13
16
|
*/
|
|
14
17
|
window.__ModuleLoader__.load({
|
|
15
18
|
id: 'dsh-engramory',
|
|
@@ -27,7 +30,7 @@ window.__ModuleLoader__.load({
|
|
|
27
30
|
const SETTINGS_API = 'api/engramory/settings'
|
|
28
31
|
const MEMORY_API = 'api/engramory/memory'
|
|
29
32
|
/** This plugin's version, for the feedback footer; a test keeps it equal to package.json's. */
|
|
30
|
-
const VERSION = '1.
|
|
33
|
+
const VERSION = '1.2.0'
|
|
31
34
|
/** Where feedback goes: a new issue on the repository, or the project's mailbox. Opening
|
|
32
35
|
* the link is the browser's (the desktop app hands it to the system's); the footer submits
|
|
33
36
|
* nothing by itself. */
|
|
@@ -75,8 +78,6 @@ window.__ModuleLoader__.load({
|
|
|
75
78
|
failed: '保存失败:',
|
|
76
79
|
panel: '记忆',
|
|
77
80
|
panelTitle: 'Engramory 记忆',
|
|
78
|
-
memoryIntro: 'AI 自己记下的东西,这里只看不改。点名字用电脑上的默认程序打开。',
|
|
79
|
-
memoryIntroNoOpen: 'AI 自己记下的东西,这里只看不改。',
|
|
80
81
|
refresh: '刷新',
|
|
81
82
|
stripNote: '说明和索引上限在「插件 → Engramory 记忆」。',
|
|
82
83
|
stripReadOnly: '这里改不了,见「插件 → Engramory 记忆」。',
|
|
@@ -87,9 +88,9 @@ window.__ModuleLoader__.load({
|
|
|
87
88
|
pinnedRelative: '配置里固定的索引(indexPath)是相对路径,跟着每个会话的目录走,这里列不出来。改成绝对路径就能在这里看到。',
|
|
88
89
|
storeUser: '全局记忆',
|
|
89
90
|
storePinned: '固定的记忆库',
|
|
90
|
-
usage: '{lines} / {maxLines} 行 · {size} / {maxSize}',
|
|
91
|
-
usageOver: '{size} / {maxSize},超出上限',
|
|
92
|
-
usageSize: '{size} / {maxSize}',
|
|
91
|
+
usage: '索引 {lines} / {maxLines} 行 · {size} / {maxSize}',
|
|
92
|
+
usageOver: '索引 {size} / {maxSize},超出上限',
|
|
93
|
+
usageSize: '索引 {size} / {maxSize}',
|
|
93
94
|
sizeBytes: '{n} B',
|
|
94
95
|
sizeKB: '{n} KB',
|
|
95
96
|
overHint: '超出上限了,AI 只读得到前面一部分,该压缩了。',
|
|
@@ -109,17 +110,15 @@ window.__ModuleLoader__.load({
|
|
|
109
110
|
typeUpcoming: '约定',
|
|
110
111
|
typeSelf: '我自己',
|
|
111
112
|
typeOther: '其他',
|
|
112
|
-
|
|
113
|
-
archive: '归档({count})',
|
|
113
|
+
archive: '归档 {count} 份',
|
|
114
114
|
more: '文件太多,这里只列出了一部分。',
|
|
115
|
-
healthTitle: '体检',
|
|
116
115
|
healthOk: '体检:没发现问题。',
|
|
117
116
|
healthBroken: '索引里指向不存在的文件({count})',
|
|
118
117
|
healthBrokenMore: '索引里指向不存在的文件({count} 个以上)',
|
|
119
118
|
healthBrokenUnlisted: '索引里有指向不存在的文件,太多了,这里没列出。',
|
|
120
119
|
healthUnindexed: '不在索引里({count}):AI 回忆从索引开始,这些它通常找不到,除非别的笔记链到它们。',
|
|
121
120
|
healthUntyped: '没写类型或类型不认识({count}),列在「其他」里。',
|
|
122
|
-
healthFix: '
|
|
121
|
+
healthFix: '完整检查可以用 engramory_doctor.py。',
|
|
123
122
|
healthLarge: '要核对的太多,没做体检。',
|
|
124
123
|
healthUnreadable: '有文件读不了,没做体检。',
|
|
125
124
|
healthPartial: '文件太多没列全,没做体检。',
|
|
@@ -137,26 +136,37 @@ window.__ModuleLoader__.load({
|
|
|
137
136
|
copyFailed: '复制不了,请手动选中上面的地址。',
|
|
138
137
|
feedbackNote: '邮件会由 AI 助手协助整理,issue 是公开的,两处都别把记忆内容原样贴上去。插件版本 {version}。',
|
|
139
138
|
issueBody: '(写下遇到的问题或建议)\n\n---\ndsh-engramory {version}\n打开这个页面的电脑:{os}\ndsh 版本:',
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
statsReadAt: '读取于 {time}
|
|
139
|
+
statNote: '条记忆',
|
|
140
|
+
statNotes: '条记忆',
|
|
141
|
+
statStore: '个记忆库',
|
|
142
|
+
statStores: '个记忆库',
|
|
143
|
+
statArchive: '份归档',
|
|
144
|
+
statsReadAt: '读取于 {time},约定的天数按这时算',
|
|
146
145
|
statsPartial: '列表太长,只列出了一部分,这些数字偏少。',
|
|
147
146
|
statsUnreadable: '有 {count} 处可能存放记忆库的位置没读到(读不了或查不了),没算在内。',
|
|
148
147
|
statsIncomplete: '有的库里有文件读不了,这些数字可能偏少。',
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
148
|
+
typeAll: '全部',
|
|
149
|
+
typeLabel: '按类型筛选',
|
|
150
|
+
storeCount: '{count} 条',
|
|
151
|
+
storeCountOne: '{count} 条',
|
|
152
|
+
noteMeta: '{type} · {size}',
|
|
153
|
+
noteUnread: '读不了',
|
|
154
|
+
archived: '已归档',
|
|
155
|
+
monthDay: '{m}月{d}日',
|
|
156
|
+
yearMonthDay: '{y}年{m}月{d}日',
|
|
157
|
+
badgePast: '{date} · 日期已过,待确认',
|
|
158
|
+
badgeToday: '就是今天',
|
|
159
|
+
badgeTomorrow: '{date} · 明天',
|
|
160
|
+
badgeSoon: '{date} · 还有 {days} 天',
|
|
161
|
+
badgeUndated: '未定日期',
|
|
162
|
+
badgeLarge: '偏大,建议拆分',
|
|
163
|
+
badgeUnindexed: '不在索引里',
|
|
164
|
+
attnTitle: '可以整理一下',
|
|
165
|
+
attnLarge: '超过 12 KB 的笔记 {count} 篇:一条笔记该只记一件事,可以让 AI 拆成几篇。',
|
|
155
166
|
filterLabel: '筛选笔记',
|
|
156
167
|
filterPlaceholder: '按名字筛选',
|
|
157
168
|
filterCount: '匹配 {count} 条(只在已列出的笔记里找)',
|
|
158
169
|
filterNone: '这个库里没有匹配的笔记。',
|
|
159
|
-
largeNotes: '超过 12 KB 的笔记({count}):一条笔记该只记一件事,可以让 AI 拆成几篇。',
|
|
160
170
|
tidyCopy: '复制整理指令',
|
|
161
171
|
tidyCopied: '已复制,粘贴进对话发给 AI',
|
|
162
172
|
tidyFailed: '复制不了,请手动选中下面的指令:',
|
|
@@ -192,8 +202,6 @@ window.__ModuleLoader__.load({
|
|
|
192
202
|
failed: 'Saving failed: ',
|
|
193
203
|
panel: 'Memory',
|
|
194
204
|
panelTitle: 'Engramory memory',
|
|
195
|
-
memoryIntro: 'What the AI has noted down for itself — to look at, not to edit. Click a name to open it in your computer\'s default app.',
|
|
196
|
-
memoryIntroNoOpen: 'What the AI has noted down for itself — to look at, not to edit.',
|
|
197
205
|
refresh: 'Refresh',
|
|
198
206
|
stripNote: 'Explanations and the index cap: Plugins → Engramory memory.',
|
|
199
207
|
stripReadOnly: 'Cannot be changed here; see Plugins → Engramory memory.',
|
|
@@ -204,9 +212,9 @@ window.__ModuleLoader__.load({
|
|
|
204
212
|
pinnedRelative: 'The pinned index (indexPath) is a relative path, which follows each conversation\'s directory, so it cannot be listed here. Pin an absolute path to see it here.',
|
|
205
213
|
storeUser: 'Global memory',
|
|
206
214
|
storePinned: 'Pinned store',
|
|
207
|
-
usage: '{lines} / {maxLines} lines · {size} / {maxSize}',
|
|
208
|
-
usageOver: '{size} / {maxSize}, over the cap',
|
|
209
|
-
usageSize: '{size} / {maxSize}',
|
|
215
|
+
usage: 'Index {lines} / {maxLines} lines · {size} / {maxSize}',
|
|
216
|
+
usageOver: 'Index {size} / {maxSize}, over the cap',
|
|
217
|
+
usageSize: 'Index {size} / {maxSize}',
|
|
210
218
|
sizeBytes: '{n} B',
|
|
211
219
|
sizeKB: '{n} KB',
|
|
212
220
|
overHint: 'Over the cap: the AI reads only the first part. Time to compact it.',
|
|
@@ -226,17 +234,15 @@ window.__ModuleLoader__.load({
|
|
|
226
234
|
typeUpcoming: 'Coming up',
|
|
227
235
|
typeSelf: 'Myself',
|
|
228
236
|
typeOther: 'Other',
|
|
229
|
-
group: '{type} · {count}',
|
|
230
237
|
archive: 'Archive ({count})',
|
|
231
238
|
more: 'Too many files: only some are listed here.',
|
|
232
|
-
healthTitle: 'Check-up',
|
|
233
239
|
healthOk: 'Check-up: nothing to fix.',
|
|
234
240
|
healthBroken: 'The index points to files that are not there ({count})',
|
|
235
241
|
healthBrokenMore: 'The index points to files that are not there (over {count})',
|
|
236
242
|
healthBrokenUnlisted: 'The index points to files that are not there: too many to list here.',
|
|
237
243
|
healthUnindexed: 'Not in the index ({count}): recall starts from the index, so the AI will not find these unless another note links to them.',
|
|
238
244
|
healthUntyped: 'No type, or one it does not know ({count}), listed under Other.',
|
|
239
|
-
healthFix: '
|
|
245
|
+
healthFix: 'For a full check, run engramory_doctor.py.',
|
|
240
246
|
healthLarge: 'Too much to check here, so no check-up.',
|
|
241
247
|
healthUnreadable: 'Some files could not be read, so no check-up.',
|
|
242
248
|
healthPartial: 'Too many files to list them all, so no check-up here.',
|
|
@@ -254,26 +260,37 @@ window.__ModuleLoader__.load({
|
|
|
254
260
|
copyFailed: 'Could not copy; select the address above by hand.',
|
|
255
261
|
feedbackNote: 'Emails are sorted with the help of an AI assistant, and issues are public: do not paste your memory notes into either. Plugin version {version}.',
|
|
256
262
|
issueBody: '(What happened, or your idea)\n\n---\ndsh-engramory {version}\nComputer this page was opened on: {os}\ndsh version: ',
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
statsReadAt: 'Read at {time};
|
|
263
|
+
statNote: 'note',
|
|
264
|
+
statNotes: 'notes',
|
|
265
|
+
statStore: 'store',
|
|
266
|
+
statStores: 'stores',
|
|
267
|
+
statArchive: 'archived',
|
|
268
|
+
statsReadAt: 'Read at {time}; days to a plan count from then',
|
|
263
269
|
statsPartial: 'The listing was too long to finish, so these numbers fall short.',
|
|
264
270
|
statsUnreadable: '{count} places that may hold a memory store could not be read and are not counted.',
|
|
265
271
|
statsIncomplete: 'Some files in a store could not be read, so these numbers may fall short.',
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
+
typeAll: 'All',
|
|
273
|
+
typeLabel: 'Filter by type',
|
|
274
|
+
storeCount: '{count} notes',
|
|
275
|
+
storeCountOne: '{count} note',
|
|
276
|
+
noteMeta: '{type} · {size}',
|
|
277
|
+
noteUnread: 'Could not be read',
|
|
278
|
+
archived: 'Archived',
|
|
279
|
+
monthDay: '{m}/{d}',
|
|
280
|
+
yearMonthDay: '{y}/{m}/{d}',
|
|
281
|
+
badgePast: '{date} · passed, outcome to confirm',
|
|
282
|
+
badgeToday: 'Today',
|
|
283
|
+
badgeTomorrow: '{date} · tomorrow',
|
|
284
|
+
badgeSoon: '{date} · in {days} days',
|
|
285
|
+
badgeUndated: 'No date yet',
|
|
286
|
+
badgeLarge: 'Large: worth splitting',
|
|
287
|
+
badgeUnindexed: 'Not in the index',
|
|
288
|
+
attnTitle: 'Worth tidying up',
|
|
289
|
+
attnLarge: 'Notes past 12 KB: {count}. A note should hold one fact, and the AI can split these.',
|
|
272
290
|
filterLabel: 'Filter notes',
|
|
273
291
|
filterPlaceholder: 'Filter by name',
|
|
274
292
|
filterCount: '{count} matching (among the notes listed)',
|
|
275
293
|
filterNone: 'No matching notes in this store.',
|
|
276
|
-
largeNotes: 'Notes past 12 KB ({count}): a note should hold one fact; the AI can split these.',
|
|
277
294
|
tidyCopy: 'Copy tidy-up instructions',
|
|
278
295
|
tidyCopied: 'Copied; paste it into a conversation',
|
|
279
296
|
tidyFailed: 'Could not copy; select the instructions below by hand:',
|
|
@@ -305,67 +322,122 @@ window.__ModuleLoader__.load({
|
|
|
305
322
|
.eng-cap{display:flex;gap:12px;align-items:center;flex-wrap:wrap;}
|
|
306
323
|
.eng-cap label{display:flex;align-items:center;gap:6px;color:var(--dsw-alias-label-secondary);font-size:12px;}
|
|
307
324
|
.eng-cap input{width:110px;}
|
|
308
|
-
.eng-btn{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:8px;padding:5px 14px;font:inherit;font-size:12px;cursor:pointer;white-space:nowrap;}
|
|
325
|
+
.eng-btn{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:8px;padding:5px 14px;font:inherit;font-size:12px;line-height:18px;cursor:pointer;white-space:nowrap;}
|
|
309
326
|
.eng-btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);}
|
|
310
327
|
.eng-btn:disabled{opacity:.5;cursor:default;}
|
|
311
328
|
.eng-btn-primary{background:var(--dsw-alias-button-primary-fill,var(--dsw-alias-brand-primary));border-color:transparent;color:var(--dsw-alias-label-primary-foreground,#fff);}
|
|
312
329
|
.eng-btn-primary:hover:not(:disabled){background:var(--dsw-alias-button-primary-fill,var(--dsw-alias-brand-primary));opacity:.9;}
|
|
330
|
+
.eng-btn-ghost{border-color:transparent;background:transparent;color:var(--dsw-alias-label-secondary);padding:4px 8px;}
|
|
331
|
+
.eng-btn-small{padding:1px 8px;font-size:11.5px;}
|
|
313
332
|
.eng-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;}
|
|
314
|
-
.eng-memory{box-sizing:border-box;height:100%;overflow:auto;display:flex;flex-direction:column;align-items:center;gap:
|
|
315
|
-
.eng-memory
|
|
316
|
-
.eng-memory
|
|
317
|
-
|
|
318
|
-
.eng-
|
|
319
|
-
.eng-
|
|
320
|
-
.eng-
|
|
321
|
-
.eng-
|
|
322
|
-
.eng-
|
|
323
|
-
.eng-
|
|
324
|
-
.eng-
|
|
325
|
-
.eng-
|
|
326
|
-
.eng-
|
|
333
|
+
.eng-memory{box-sizing:border-box;height:100%;overflow:auto;display:flex;flex-direction:column;align-items:center;gap:20px;padding:28px clamp(24px,4vw,48px) 48px;color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px;}
|
|
334
|
+
[data-platform=darwin] .eng-memory{padding-top:calc(28px + var(--dsh-frame-top-clearance,0px));}
|
|
335
|
+
.eng-memory>*{box-sizing:border-box;width:100%;max-width:960px;flex:none;}
|
|
336
|
+
.eng-memory svg{display:block;flex:none;}
|
|
337
|
+
.eng-hero{display:flex;justify-content:space-between;align-items:flex-start;flex-wrap:wrap;gap:24px 40px;padding:30px 32px;border-radius:24px;color:#e8f3f0;background:radial-gradient(120% 140% at 100% 0%,#1f4a5a 0%,rgba(31,74,90,0) 55%),linear-gradient(135deg,#0f1b2d 0%,#14263f 100%);box-shadow:0 12px 32px rgba(15,27,45,.18);}
|
|
338
|
+
.eng-hero-main{display:flex;flex-direction:column;gap:24px;flex:1 1 340px;min-width:0;}
|
|
339
|
+
.eng-brand{display:flex;align-items:center;gap:14px;}
|
|
340
|
+
.eng-logo{border-radius:12px;box-shadow:0 0 0 1px rgba(110,231,200,.35);}
|
|
341
|
+
.eng-hero-title{margin:0;font-size:21px;font-weight:600;line-height:28px;letter-spacing:.01em;}
|
|
342
|
+
.eng-stats{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px 0;}
|
|
343
|
+
.eng-stat{display:inline-flex;align-items:baseline;gap:6px;}
|
|
344
|
+
.eng-stat+.eng-stat{margin-left:18px;padding-left:18px;border-left:1px solid rgba(232,243,240,.18);}
|
|
345
|
+
.eng-stat b{font-size:40px;line-height:44px;font-weight:600;color:#6ee7c8;font-variant-numeric:tabular-nums;letter-spacing:-.02em;}
|
|
346
|
+
.eng-stat span{font-size:13px;color:rgba(232,243,240,.75);}
|
|
347
|
+
.eng-hero-foot{display:flex;align-items:center;flex-wrap:wrap;gap:8px 10px;}
|
|
348
|
+
.eng-hero-read{display:inline-flex;align-items:center;gap:6px;margin:0;padding:3px 10px;border-radius:999px;background:rgba(255,255,255,.06);font-size:12px;line-height:18px;color:rgba(232,243,240,.62);}
|
|
349
|
+
.eng-hero-side{display:flex;flex-direction:column;flex:0 1 300px;min-width:260px;}
|
|
350
|
+
.eng-hero .eng-strip{display:flex;flex-direction:column;gap:14px;padding:18px 20px;border-radius:18px;background:rgba(255,255,255,.06);box-shadow:inset 0 0 0 1px rgba(255,255,255,.08);}
|
|
351
|
+
.eng-hero .eng-strip-item{display:flex;align-items:center;justify-content:space-between;gap:20px;min-height:30px;font-size:13px;color:rgba(232,243,240,.8);}
|
|
352
|
+
.eng-hero .eng-strip-item:first-child{font-weight:600;color:#e8f3f0;}
|
|
353
|
+
.eng-hero .eng-strip-note{margin:0;font-size:11.5px;line-height:17px;color:rgba(232,243,240,.74);}
|
|
354
|
+
.eng-hero .eng-switch{width:46px;height:26px;background:rgba(255,255,255,.24);}
|
|
355
|
+
.eng-hero .eng-switch::after{top:3px;left:3px;width:20px;height:20px;}
|
|
356
|
+
.eng-hero .eng-switch[aria-checked="true"]::after{transform:translateX(20px);}
|
|
357
|
+
.eng-hero .eng-switch[aria-checked="true"]{background:#6ee7c8;}
|
|
358
|
+
.eng-hero .eng-switch[aria-checked="true"]::after{background:#0f1b2d;}
|
|
359
|
+
.eng-hero .eng-segment{border:0;border-radius:999px;background:rgba(0,0,0,.25);}
|
|
360
|
+
.eng-hero .eng-segment button{border-radius:999px;padding:3px 14px;font-size:12.5px;line-height:18px;color:rgba(232,243,240,.62);}
|
|
361
|
+
.eng-hero .eng-segment button[aria-pressed="true"]{background:#6ee7c8;color:#0f1b2d;box-shadow:none;}
|
|
362
|
+
.eng-hero .eng-btn,.eng-hero-btn{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px;border:1px solid rgba(232,243,240,.22);border-radius:999px;background:transparent;color:#e8f3f0;font:inherit;font-size:12px;cursor:pointer;white-space:nowrap;}
|
|
363
|
+
.eng-hero .eng-btn:hover:not(:disabled),.eng-hero-btn:hover{background:rgba(255,255,255,.08);}
|
|
364
|
+
.eng-hero :focus-visible{outline:2px solid #6ee7c8;outline-offset:2px;}
|
|
365
|
+
.eng-caveat{display:flex;align-items:flex-start;gap:8px;margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);}
|
|
366
|
+
.eng-caveat svg{margin-top:2px;color:var(--dsw-alias-state-warn-label);}
|
|
367
|
+
.eng-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;margin-top:6px;}
|
|
368
|
+
.eng-tabs{display:flex;flex-wrap:wrap;gap:2px;flex:1 1 auto;min-width:0;}
|
|
369
|
+
.eng-tab{display:inline-flex;align-items:center;gap:5px;height:30px;padding:0 10px;border:0;border-radius:9px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:13px;cursor:pointer;}
|
|
370
|
+
.eng-tab:hover{background:var(--dsw-alias-interactive-bg-hover);}
|
|
371
|
+
.eng-tab[aria-pressed="true"]{background:var(--dsw-alias-interactive-bg-active);color:var(--dsw-alias-label-primary);font-weight:500;}
|
|
372
|
+
.eng-tab-count{font-size:11.5px;font-weight:400;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;}
|
|
373
|
+
.eng-search{position:relative;display:flex;align-items:center;flex:0 1 240px;min-width:160px;color:var(--dsw-alias-label-caption);}
|
|
374
|
+
.eng-search svg{position:absolute;left:10px;pointer-events:none;}
|
|
375
|
+
.eng-search .eng-input{width:100%;height:34px;padding-left:32px;border-radius:10px;font-size:13px;}
|
|
376
|
+
.eng-filter-count,.eng-filter-none{margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);}
|
|
377
|
+
.eng-store{display:flex;flex-direction:column;gap:10px;margin-top:10px;}
|
|
378
|
+
.eng-store-head{display:flex;align-items:center;flex-wrap:wrap;gap:6px 10px;}
|
|
379
|
+
.eng-store-title{margin:0;font-size:15px;font-weight:600;line-height:22px;}
|
|
380
|
+
.eng-store-count{font-size:12px;color:var(--dsw-alias-label-tertiary);}
|
|
381
|
+
.eng-meter{display:inline-block;width:56px;height:4px;margin-left:4px;border-radius:999px;background:var(--dsw-alias-border-l2);overflow:hidden;}
|
|
382
|
+
.eng-meter-fill{display:block;height:100%;border-radius:999px;background:#2bb894;background:color-mix(in srgb,#2bb894 76%,var(--dsw-alias-label-primary));}
|
|
383
|
+
.eng-meter[data-over="true"] .eng-meter-fill{background:var(--dsw-alias-state-error-primary);}
|
|
384
|
+
.eng-usage{font-size:11.5px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;}
|
|
327
385
|
.eng-usage[data-over="true"]{color:var(--dsw-alias-state-error-primary);}
|
|
328
|
-
.eng-store-actions{margin-left:auto;display:inline-flex;flex-wrap:wrap;gap:
|
|
329
|
-
.eng-path{margin:-8px 0 0;font-family:var(--ds-font-family-code,ui-monospace,monospace);font-size:
|
|
330
|
-
.eng-
|
|
331
|
-
.eng-
|
|
332
|
-
.eng-
|
|
333
|
-
.eng-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
.eng-
|
|
338
|
-
.eng-
|
|
339
|
-
.eng-
|
|
340
|
-
.eng-
|
|
341
|
-
.eng-
|
|
342
|
-
.eng-
|
|
343
|
-
.eng-
|
|
344
|
-
.eng-
|
|
345
|
-
.eng-
|
|
346
|
-
.eng-
|
|
386
|
+
.eng-store-actions{margin-left:auto;display:inline-flex;flex-wrap:wrap;gap:2px;}
|
|
387
|
+
.eng-path{margin:-8px 0 0;font-family:var(--ds-font-family-code,ui-monospace,monospace);font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;}
|
|
388
|
+
.eng-store-ok{display:flex;align-items:center;gap:6px;margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);}
|
|
389
|
+
.eng-store-ok svg{color:#2bb894;color:color-mix(in srgb,#2bb894 76%,var(--dsw-alias-label-primary));}
|
|
390
|
+
.eng-attn{display:flex;align-items:flex-start;gap:10px;padding:10px 10px 10px 14px;border-radius:14px;background:var(--dsw-alias-state-warn-tertiary);background:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 11%,transparent);}
|
|
391
|
+
.eng-attn>svg{margin-top:2px;color:var(--dsw-alias-state-warn-label);}
|
|
392
|
+
.eng-attn-body{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0;}
|
|
393
|
+
.eng-attn-title{margin:0;font-size:12.5px;font-weight:600;line-height:20px;color:var(--dsw-alias-state-warn-label);}
|
|
394
|
+
.eng-attn-item{margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);}
|
|
395
|
+
.eng-broken{display:flex;flex-wrap:wrap;gap:4px;margin:4px 0 0;padding:0;list-style:none;}
|
|
396
|
+
.eng-broken code{padding:0 6px;border-radius:6px;background:var(--dsw-alias-interactive-bg-hover);font-family:var(--ds-font-family-code,ui-monospace,monospace);font-size:11px;line-height:18px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;}
|
|
397
|
+
.eng-attn>.eng-btn{flex:none;}
|
|
398
|
+
.eng-tidy{display:flex;flex-direction:column;gap:6px;}
|
|
399
|
+
.eng-tidy p{margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);}
|
|
400
|
+
.eng-tidy textarea{box-sizing:border-box;width:100%;min-height:150px;resize:vertical;font:inherit;font-size:12px;line-height:18px;}
|
|
401
|
+
.eng-list{display:flex;flex-direction:column;padding:4px;border:.5px solid var(--dsw-alias-border-l3);border-radius:16px;}
|
|
402
|
+
.eng-rows{display:flex;flex-direction:column;margin:0;padding:0;list-style:none;}
|
|
403
|
+
.eng-row{box-sizing:border-box;display:flex;align-items:center;gap:12px;width:100%;min-height:52px;padding:6px 10px;border:0;border-radius:12px;background:transparent;color:inherit;font:inherit;text-align:left;}
|
|
404
|
+
button.eng-row{cursor:pointer;}
|
|
405
|
+
button.eng-row:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);}
|
|
406
|
+
.eng-row[data-type="user"]{--eng-type:#6f86c6;}
|
|
407
|
+
.eng-row[data-type="feedback"]{--eng-type:#b39a45;}
|
|
408
|
+
.eng-row[data-type="project"]{--eng-type:#4e9a78;}
|
|
409
|
+
.eng-row[data-type="reference"]{--eng-type:#8b78c4;}
|
|
410
|
+
.eng-row[data-type="moment"]{--eng-type:#c07193;}
|
|
411
|
+
.eng-row[data-type="upcoming"]{--eng-type:#c9735c;}
|
|
412
|
+
.eng-row[data-type="self"]{--eng-type:#3f9aa6;}
|
|
413
|
+
.eng-mark{display:grid;place-items:center;width:32px;height:32px;flex:none;border-radius:10px;box-shadow:inset 0 0 0 .5px var(--dsw-alias-border-l4);color:var(--eng-type,var(--dsw-alias-label-tertiary));color:color-mix(in srgb,var(--eng-type,var(--dsw-alias-label-tertiary)) 80%,var(--dsw-alias-label-primary));}
|
|
414
|
+
.eng-row-text{display:flex;flex-direction:column;flex:1;min-width:0;}
|
|
415
|
+
.eng-name{font-size:13.5px;font-weight:500;line-height:19px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
|
|
416
|
+
.eng-row-meta{font-size:11.5px;line-height:16px;color:var(--dsw-alias-label-tertiary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
|
|
417
|
+
.eng-badges{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px;max-width:55%;}
|
|
418
|
+
.eng-badge{padding:0 8px;border-radius:999px;background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary);font-size:11.5px;line-height:20px;white-space:nowrap;}
|
|
419
|
+
.eng-badge[data-tone="warn"]{background:var(--dsw-alias-state-warn-tertiary);background:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 14%,transparent);color:var(--dsw-alias-state-warn-label);}
|
|
420
|
+
.eng-badge[data-tone="quiet"]{background:transparent;box-shadow:inset 0 0 0 .5px var(--dsw-alias-border-l3);color:var(--dsw-alias-label-tertiary);}
|
|
421
|
+
.eng-row-go{color:var(--dsw-alias-label-caption);}
|
|
422
|
+
.eng-archive{border-top:.5px dashed var(--dsw-alias-border-l2);margin-top:4px;padding-top:4px;}
|
|
423
|
+
.eng-list>.eng-archive:first-child{border-top:0;margin-top:0;padding-top:0;}
|
|
424
|
+
.eng-archive>summary{display:flex;align-items:center;gap:12px;min-height:44px;padding:4px 14px 4px 18px;border-radius:12px;cursor:pointer;font-size:12.5px;color:var(--dsw-alias-label-secondary);list-style:none;}
|
|
425
|
+
.eng-archive>summary::-webkit-details-marker{display:none;}
|
|
426
|
+
.eng-archive>summary::after,.eng-howto>summary::after{content:"";margin-left:auto;width:6px;height:6px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(-45deg);opacity:.55;}
|
|
427
|
+
.eng-archive[open]>summary::after,.eng-howto[open]>summary::after{transform:rotate(45deg);}
|
|
428
|
+
.eng-archive>summary:hover{background:var(--dsw-alias-interactive-bg-hover);}
|
|
429
|
+
.eng-howto{box-sizing:border-box;padding:12px 14px;border:.5px solid var(--dsw-alias-border-l3);border-radius:14px;}
|
|
430
|
+
.eng-howto>summary{display:flex;align-items:center;gap:8px;cursor:pointer;font-size:13px;font-weight:500;line-height:20px;list-style:none;}
|
|
431
|
+
.eng-howto>summary::-webkit-details-marker{display:none;}
|
|
432
|
+
.eng-howto ul{display:flex;flex-direction:column;gap:4px;margin:10px 0 2px;padding-left:18px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);}
|
|
433
|
+
.eng-feedback{display:flex;flex-direction:column;gap:2px;padding-top:14px;border-top:.5px solid var(--dsw-alias-border-l2);font-size:12px;line-height:22px;color:var(--dsw-alias-label-secondary);}
|
|
434
|
+
.eng-feedback p{display:flex;align-items:center;flex-wrap:wrap;margin:0;}
|
|
435
|
+
.eng-feedback p svg{margin-right:6px;color:var(--dsw-alias-label-tertiary);}
|
|
347
436
|
.eng-link{color:var(--dsw-alias-brand-primary);text-decoration:underline;text-underline-offset:2px;}
|
|
348
437
|
.eng-link:hover{opacity:.8;}
|
|
349
438
|
.eng-email{margin:0 8px 0 2px;font-family:var(--ds-font-family-code,ui-monospace,monospace);user-select:all;color:var(--dsw-alias-label-primary);}
|
|
350
|
-
.eng-btn-small{padding:1px 8px;font-size:11.5px;}
|
|
351
439
|
.eng-feedback-note{color:var(--dsw-alias-label-tertiary);}
|
|
352
|
-
.eng-
|
|
353
|
-
.eng-overview-line{margin:0;font-size:13px;line-height:20px;}
|
|
354
|
-
.eng-overview-note{margin:2px 0 0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);}
|
|
355
|
-
.eng-upcoming-list{display:flex;flex-direction:column;gap:0;margin:4px -8px 0;padding:0;list-style:none;}
|
|
356
|
-
.eng-upcoming-list li{display:flex;align-items:center;gap:12px;}
|
|
357
|
-
.eng-upcoming-list .eng-name{width:auto;max-width:60%;}
|
|
358
|
-
.eng-upcoming-status{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);white-space:nowrap;}
|
|
359
|
-
.eng-upcoming-list li[data-status="past"] .eng-upcoming-status{color:var(--dsw-alias-label-primary);font-weight:600;}
|
|
360
|
-
.eng-filter{display:flex;align-items:center;gap:12px;flex-wrap:wrap;}
|
|
361
|
-
.eng-filter input{width:240px;}
|
|
362
|
-
.eng-filter-count,.eng-filter-none{margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);}
|
|
363
|
-
.eng-meter{display:inline-block;width:96px;height:6px;border-radius:999px;background:var(--dsw-alias-border-l2);overflow:hidden;}
|
|
364
|
-
.eng-meter-fill{display:block;height:100%;border-radius:999px;background:var(--dsw-alias-label-secondary);}
|
|
365
|
-
.eng-meter[data-over="true"] .eng-meter-fill{background:var(--dsw-alias-state-error-primary);}
|
|
366
|
-
.eng-tidy{display:flex;flex-direction:column;gap:6px;}
|
|
367
|
-
.eng-tidy textarea{box-sizing:border-box;width:100%;min-height:150px;resize:vertical;font:inherit;font-size:12px;line-height:18px;}
|
|
368
|
-
.eng-link:focus-visible,.eng-howto>summary:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-brand-primary));outline-offset:1px;}
|
|
440
|
+
.eng-name:focus-visible,.eng-row:focus-visible,.eng-btn:focus-visible,.eng-tab:focus-visible,.eng-link:focus-visible,.eng-howto>summary:focus-visible,.eng-archive>summary:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-brand-primary));outline-offset:1px;}
|
|
369
441
|
`
|
|
370
442
|
|
|
371
443
|
/** The settings the page edits, in the order the host computes its revision from. */
|
|
@@ -657,6 +729,8 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
657
729
|
const typeKey = (type) => `type${type[0].toUpperCase()}${type.slice(1)}`
|
|
658
730
|
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' })
|
|
659
731
|
const byName = (a, b) => collator.compare(a, b)
|
|
732
|
+
/** Notes in the protocol's order of types, then by name. */
|
|
733
|
+
const byTypeThenName = (a, b) => TYPES.indexOf(a.type) - TYPES.indexOf(b.type) || byName(a.name, b.name)
|
|
660
734
|
|
|
661
735
|
/** Put `text` on the clipboard; false where there is none (a page over plain http) or it is refused. */
|
|
662
736
|
async function copyText(text) {
|
|
@@ -687,25 +761,23 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
687
761
|
}
|
|
688
762
|
|
|
689
763
|
/**
|
|
690
|
-
*
|
|
764
|
+
* Where an `upcoming` note stands against today on this computer: a date passed only says
|
|
691
765
|
* the outcome is yet to be asked about (SKILL.md §2.2 keeps the note until it is known),
|
|
692
|
-
* so nothing here is called late or stale.
|
|
766
|
+
* so nothing here is called late or stale. No date, or no real one, is undated.
|
|
693
767
|
*/
|
|
694
|
-
function
|
|
695
|
-
const
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
return items.sort((a, b) => rank[a.status] - rank[b.status] || (a.days ?? 0) - (b.days ?? 0) ||
|
|
708
|
-
byName(a.name, b.name))
|
|
768
|
+
function planOf(file, now) {
|
|
769
|
+
const date = dateOf(file)
|
|
770
|
+
if (date === undefined) return { status: 'undated' }
|
|
771
|
+
const days = dayNumber(date) - dayNumber(todayOf(now))
|
|
772
|
+
return { status: days < 0 ? 'past' : days === 0 ? 'today' : 'ahead', days, date }
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
/** A note's name as listed: a plan's date is in its badge, so it is not said again before the name. */
|
|
776
|
+
function shownName(file, plan) {
|
|
777
|
+
const name = nameOf(file)
|
|
778
|
+
if (plan?.date === undefined) return name
|
|
779
|
+
const rest = name.slice(10).replace(/^[\s_-]+/, '')
|
|
780
|
+
return rest === '' ? name : rest
|
|
709
781
|
}
|
|
710
782
|
|
|
711
783
|
/** How full an index is, the nearer of its two caps; its lines only when they were counted. */
|
|
@@ -714,54 +786,102 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
714
786
|
return Math.max(lines, index.bytes / cap.maxBytes)
|
|
715
787
|
}
|
|
716
788
|
|
|
717
|
-
/**
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
789
|
+
/** Line icons on a 24-unit grid, in the current colour: [element, attributes] each. One per
|
|
790
|
+
* note type (TYPES), drawn alike, so the type's colour tells them apart before the shape does. */
|
|
791
|
+
const ICONS = {
|
|
792
|
+
refresh: [['path', { d: 'M20 11a8 8 0 1 0-2.3 5.7' }], ['path', { d: 'M20 4v7h-7' }]],
|
|
793
|
+
search: [['circle', { cx: 11, cy: 11, r: 7 }], ['path', { d: 'm20 20-3.5-3.5' }]],
|
|
794
|
+
copy: [['rect', { x: 9, y: 9, width: 11, height: 11, rx: 2 }], ['path', { d: 'M5 15V5a2 2 0 0 1 2-2h8' }]],
|
|
795
|
+
folder: [['path', { d: 'M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z' }]],
|
|
796
|
+
index: [['path', { d: 'M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01' }]],
|
|
797
|
+
tidy: [['path', { d: 'm4 20 11-11M14 4l1 2 2 1-2 1-1 2-1-2-2-1 2-1zM19 11l.7 1.3L21 13l-1.3.7L19 15l-.7-1.3L17 13l1.3-.7z' }]],
|
|
798
|
+
archive: [['rect', { x: 3, y: 4, width: 18, height: 5, rx: 1 }], ['path', { d: 'M5 9v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9M10 13h4' }]],
|
|
799
|
+
alert: [['path', { d: 'M12 4 2.5 20h19z' }], ['path', { d: 'M12 10v4M12 17h.01' }]],
|
|
800
|
+
clock: [['circle', { cx: 12, cy: 12, r: 8.5 }], ['path', { d: 'M12 7.5V12l3 2' }]],
|
|
801
|
+
check: [['path', { d: 'm5 12 5 5 9-10' }]],
|
|
802
|
+
chevron: [['path', { d: 'm9 6 6 6-6 6' }]],
|
|
803
|
+
book: [['path', { d: 'M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2z' }], ['path', { d: 'M4 19V5' }]],
|
|
804
|
+
issue: [['path', { d: 'M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z' }]],
|
|
805
|
+
mail: [['rect', { x: 3, y: 5, width: 18, height: 14, rx: 2 }], ['path', { d: 'm3 7 9 6 9-6' }]],
|
|
806
|
+
user: [['circle', { cx: 12, cy: 8.6, r: 3.6 }], ['path', { d: 'M5 19.5c1.2-3.3 3.9-5 7-5s5.8 1.7 7 5z' }]],
|
|
807
|
+
feedback: [['path', { d: 'M4.5 6.5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H11l-4 3v-3h-.5a2 2 0 0 1-2-2z' }],
|
|
808
|
+
['path', { d: 'm9 10.3 2 2 4-4' }]],
|
|
809
|
+
project: [['path', { d: 'M12 4 3.5 8.5 12 13l8.5-4.5z' }], ['path', { d: 'm3.5 12.5 8.5 4.5 8.5-4.5M3.5 16.3 12 20.8l8.5-4.5' }]],
|
|
810
|
+
reference: [['path', { d: 'M7 3.5h10a1 1 0 0 1 1 1v16l-6-3.8-6 3.8v-16a1 1 0 0 1 1-1z' }]],
|
|
811
|
+
moment: [['path', { d: 'M10 3.5l1.6 4.4L16 9.5l-4.4 1.6L10 15.5l-1.6-4.4L4 9.5l4.4-1.6z' }],
|
|
812
|
+
['path', { d: 'M17.5 14v5.5M14.75 16.75h5.5' }]],
|
|
813
|
+
upcoming: [['rect', { x: 4, y: 5.5, width: 16, height: 14.5, rx: 2.5 }], ['path', { d: 'M4 10h16M8.5 3.5v4M15.5 3.5v4' }],
|
|
814
|
+
['circle', { cx: 15.3, cy: 15, r: 1.3, fill: 'currentColor', stroke: 'none' }]],
|
|
815
|
+
self: [['path', { d: 'M12 19.5s-7-4.3-7-9.6A3.9 3.9 0 0 1 12 7.6a3.9 3.9 0 0 1 7 2.3c0 5.3-7 9.6-7 9.6z' }]],
|
|
816
|
+
other: [['path', { d: 'M13.5 3.5H7a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9z' }], ['path', { d: 'M13.5 3.5V9H19' }]],
|
|
723
817
|
}
|
|
818
|
+
const icon = (name, size = 16, weight = 1.8) => h('svg', {
|
|
819
|
+
width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: weight,
|
|
820
|
+
strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true, focusable: 'false',
|
|
821
|
+
}, ...ICONS[name].map(([tag, attributes], i) => h(tag, { key: i, ...attributes })))
|
|
822
|
+
|
|
823
|
+
/** The project's mark, [[▮]] in mint on its dark tile, as in its icon. */
|
|
824
|
+
function Logo() {
|
|
825
|
+
return h('svg', { className: 'eng-logo', width: 44, height: 44, viewBox: '0 0 64 64', 'aria-hidden': true, focusable: 'false' },
|
|
826
|
+
h('rect', { width: 64, height: 64, rx: 14, fill: '#0F1B2D' }),
|
|
827
|
+
h('path', { d: 'M13 17.5H9v29h4M22 17.5h-4v29h4M42 17.5h4v29h-4M51 17.5h4v29h-4', fill: 'none', stroke: '#6EE7C8',
|
|
828
|
+
strokeWidth: 4, strokeLinecap: 'round', strokeLinejoin: 'round' }),
|
|
829
|
+
h('rect', { x: 27.5, y: 23, width: 9, height: 18, rx: 2.4, fill: '#6EE7C8' }))
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
/** When a listing was read, its day with its time, as this computer shows them. */
|
|
833
|
+
const timeOf = (at) => new Date(at).toLocaleString([], { month: '2-digit', day: '2-digit', hour: '2-digit',
|
|
834
|
+
minute: '2-digit' })
|
|
724
835
|
|
|
725
836
|
/**
|
|
726
|
-
*
|
|
727
|
-
*
|
|
837
|
+
* The banner atop the memory page, in the project's own colours on any theme: its name, the
|
|
838
|
+
* listing in three numbers as read at `at` with a refresh beside the time, and the two
|
|
839
|
+
* settings that matter most in a panel of their own. Numbers only once there is a listing
|
|
840
|
+
* with something to count.
|
|
728
841
|
*/
|
|
729
|
-
function
|
|
730
|
-
const
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
842
|
+
function Hero({ data, at, refresh, t }) {
|
|
843
|
+
const counted = data !== undefined && (data.stores.length > 0 || data.unreadable > 0)
|
|
844
|
+
const sum = (of) => data.stores.reduce((total, store) => total + of(store), 0)
|
|
845
|
+
const notes = counted ? sum((store) => store.notes.length) : 0
|
|
846
|
+
const stat = (n, label) => h('div', { className: 'eng-stat', key: label }, h('b', null, String(n)), h('span', null, label))
|
|
847
|
+
return h('header', { className: 'eng-hero' },
|
|
848
|
+
h('div', { className: 'eng-hero-main' },
|
|
849
|
+
h('div', { className: 'eng-brand' }, h(Logo), h('h1', { className: 'eng-hero-title' }, t('panelTitle'))),
|
|
850
|
+
counted ? h('div', { className: 'eng-stats' },
|
|
851
|
+
stat(notes, t(notes === 1 ? 'statNote' : 'statNotes')),
|
|
852
|
+
stat(data.stores.length, t(data.stores.length === 1 ? 'statStore' : 'statStores')),
|
|
853
|
+
stat(sum((store) => store.archive.length), t('statArchive'))) : null,
|
|
854
|
+
h('div', { className: 'eng-hero-foot' },
|
|
855
|
+
data === undefined ? null : h('p', { className: 'eng-hero-read' },
|
|
856
|
+
icon('clock', 13), t('statsReadAt', { time: timeOf(at) })),
|
|
857
|
+
h('button', { type: 'button', className: 'eng-hero-btn', onClick: refresh }, icon('refresh', 14), t('refresh')))),
|
|
858
|
+
h('div', { className: 'eng-hero-side' }, h(SettingsStrip, { t })))
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/** What the numbers leave out — a listing cut short, files or stores it could not read — since
|
|
862
|
+
* what was not listed is not counted as nothing. */
|
|
863
|
+
function Caveats({ data, t }) {
|
|
864
|
+
const partial = data.more === true || data.stores.some((store) => store.more)
|
|
865
|
+
// a note or a folder it could not read: the store's check-up says so too
|
|
866
|
+
const incomplete = data.stores.some((store) => store.health?.checked === false &&
|
|
867
|
+
store.health.reason === 'unreadable')
|
|
868
|
+
const lines = [
|
|
869
|
+
partial ? t('statsPartial') : null,
|
|
870
|
+
incomplete ? t('statsIncomplete') : null,
|
|
871
|
+
data.unreadable > 0 ? t('statsUnreadable', { count: data.unreadable }) : null,
|
|
872
|
+
].filter((line) => line !== null)
|
|
873
|
+
return lines.length === 0 ? null
|
|
874
|
+
: h('p', { className: 'eng-caveat' }, icon('alert', 14), h('span', null, lines.join(' ')))
|
|
756
875
|
}
|
|
757
876
|
|
|
758
877
|
/**
|
|
759
|
-
* One store: where it is, how full its index is (
|
|
760
|
-
* check-up
|
|
761
|
-
*
|
|
762
|
-
*
|
|
878
|
+
* One store: where it is, how full its index is (a bar to the nearer of its two caps), what
|
|
879
|
+
* its check-up (index.js checkUp) found for the AI to tidy up — with the tidy-up instructions
|
|
880
|
+
* to copy, or to select where there is no clipboard — and its notes, a row each: the type's
|
|
881
|
+
* mark, the name, the type and size, and what stands out (a plan's day, a note grown past one
|
|
882
|
+
* fact, one the index leaves out). While the page filters, the rows that match and no more.
|
|
763
883
|
*/
|
|
764
|
-
function StoreSection({ store, cap, canOpen, open, match, t }) {
|
|
884
|
+
function StoreSection({ store, cap, canOpen, open, match, kind, now, t }) {
|
|
765
885
|
const [tidy, setTidy] = useState('idle')
|
|
766
886
|
const alive = useRef(true)
|
|
767
887
|
useEffect(() => () => { alive.current = false }, [])
|
|
@@ -775,108 +895,130 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
775
895
|
: index.lines !== undefined ? t('usage', { lines: index.lines, maxLines: cap.maxLines, ...sizes })
|
|
776
896
|
: t(index.over ? 'usageOver' : 'usageSize', sizes)
|
|
777
897
|
const fill = index === null ? undefined : fillOf(index, cap)
|
|
778
|
-
const
|
|
779
|
-
[...list].sort(byName).map((file) => h('li', { key: file }, noteName(store, file, archive, canOpen, open))))
|
|
898
|
+
const filtering = match !== undefined || kind !== undefined
|
|
780
899
|
const keep = (file) => match === undefined || match(file)
|
|
781
|
-
const
|
|
782
|
-
.
|
|
783
|
-
const archived = store.archive.filter(keep)
|
|
784
|
-
|
|
900
|
+
const notes = store.notes.filter((note) => (kind === undefined || note.type === kind) && keep(note.name))
|
|
901
|
+
.sort(byTypeThenName)
|
|
902
|
+
const archived = kind === undefined ? store.archive.filter(keep).sort(byName) : []
|
|
903
|
+
|
|
904
|
+
const check = store.health ?? undefined
|
|
905
|
+
const checked = check?.checked === true
|
|
906
|
+
const unindexed = new Set(checked ? check.unindexed : [])
|
|
907
|
+
const untyped = store.notes.filter((note) => note.type === 'other').length
|
|
908
|
+
const large = store.notes.filter((note) => note.bytes > LARGE_NOTE).length
|
|
909
|
+
// pointers to nothing past what the page is told of are still pointers to nothing
|
|
910
|
+
const broken = checked && (check.broken.length > 0 || check.brokenMore)
|
|
911
|
+
const findings = [
|
|
912
|
+
index?.over ? h('p', { className: 'eng-attn-item', key: 'over' }, t('overHint')) : null,
|
|
913
|
+
broken ? h('div', { className: 'eng-attn-item', key: 'broken' },
|
|
914
|
+
check.broken.length === 0 ? t('healthBrokenUnlisted')
|
|
915
|
+
: t(check.brokenMore ? 'healthBrokenMore' : 'healthBroken', { count: check.broken.length }),
|
|
916
|
+
// what the index says, as it says it: there is no file to open
|
|
917
|
+
check.broken.length > 0 ? h('ul', { className: 'eng-broken' },
|
|
918
|
+
check.broken.map((target) => h('li', { key: target }, h('code', null, target)))) : null) : null,
|
|
919
|
+
checked && check.unindexed.length > 0
|
|
920
|
+
? h('p', { className: 'eng-attn-item', key: 'unindexed' }, t('healthUnindexed', { count: check.unindexed.length })) : null,
|
|
921
|
+
checked && untyped > 0 ? h('p', { className: 'eng-attn-item', key: 'untyped' }, t('healthUntyped', { count: untyped })) : null,
|
|
922
|
+
large > 0 ? h('p', { className: 'eng-attn-item', key: 'large' }, t('attnLarge', { count: large })) : null,
|
|
923
|
+
].filter((finding) => finding !== null)
|
|
924
|
+
// while filtering, the names that match and nothing else: the findings come back after
|
|
925
|
+
const attention = !filtering && findings.length > 0
|
|
926
|
+
// a check-up that did not run says why, except past the cap, which the findings say already
|
|
927
|
+
const unchecked = check === undefined || check === null || check.checked ? undefined
|
|
928
|
+
: { large: 'healthLarge', partial: 'healthPartial', unreadable: 'healthUnreadable' }[check.reason]
|
|
929
|
+
|
|
785
930
|
const prompt = t('tidyPrompt', { dir: store.dir })
|
|
786
931
|
const copyTidy = async () => {
|
|
787
932
|
const done = await copyText(prompt)
|
|
788
933
|
if (alive.current) setTidy(done ? 'copied' : 'failed')
|
|
789
934
|
}
|
|
790
|
-
|
|
935
|
+
// one per store: in the findings where there are any, else among the store's own actions
|
|
936
|
+
const tidyButton = (className) => h('button', { type: 'button', className, onClick: copyTidy },
|
|
937
|
+
icon('tidy', 14), t(tidy === 'copied' ? 'tidyCopied' : 'tidyCopy'))
|
|
938
|
+
|
|
939
|
+
const planText = (plan) => {
|
|
940
|
+
if (plan.status === 'undated') return t('badgeUndated')
|
|
941
|
+
if (plan.status === 'today') return t('badgeToday')
|
|
942
|
+
// the year where it is not this one, so last year's plan is not taken for this year's
|
|
943
|
+
const year = Number(plan.date.slice(0, 4))
|
|
944
|
+
const day = { m: Number(plan.date.slice(5, 7)), d: Number(plan.date.slice(8, 10)) }
|
|
945
|
+
const date = year === new Date(now).getFullYear() ? t('monthDay', day) : t('yearMonthDay', { y: year, ...day })
|
|
946
|
+
return plan.status === 'past' ? t('badgePast', { date })
|
|
947
|
+
: plan.days === 1 ? t('badgeTomorrow', { date }) : t('badgeSoon', { date, days: plan.days })
|
|
948
|
+
}
|
|
949
|
+
/** A note's row, or an archived file's (no note given): to open where dsh can, else text. */
|
|
950
|
+
const row = (file, note) => {
|
|
951
|
+
const type = note === undefined ? 'archive' : note.type
|
|
952
|
+
const plan = type === 'upcoming' ? planOf(file, now) : undefined
|
|
953
|
+
const meta = note === undefined ? t('archived')
|
|
954
|
+
: note.unread ? t('noteUnread')
|
|
955
|
+
: note.bytes === undefined ? t(typeKey(type))
|
|
956
|
+
: t('noteMeta', { type: t(typeKey(type)), size: sizeOf(t, note.bytes) })
|
|
957
|
+
const badges = [
|
|
958
|
+
plan === undefined ? null : h('span', { className: 'eng-badge', key: 'plan',
|
|
959
|
+
'data-tone': plan.status === 'past' ? 'warn' : plan.status === 'undated' ? 'quiet' : undefined }, planText(plan)),
|
|
960
|
+
note?.bytes > LARGE_NOTE ? h('span', { className: 'eng-badge', 'data-tone': 'warn', key: 'large' }, t('badgeLarge')) : null,
|
|
961
|
+
note !== undefined && unindexed.has(file) ? h('span', { className: 'eng-badge', key: 'unindexed' }, t('badgeUnindexed')) : null,
|
|
962
|
+
].filter((badge) => badge !== null)
|
|
963
|
+
const parts = [
|
|
964
|
+
h('span', { className: 'eng-mark', key: 'mark' }, icon(Object.hasOwn(ICONS, type) ? type : 'other', 18, 1.6)),
|
|
965
|
+
h('span', { className: 'eng-row-text', key: 'text' },
|
|
966
|
+
h('span', { className: 'eng-name' }, shownName(file, plan)),
|
|
967
|
+
h('span', { className: 'eng-row-meta' }, meta)),
|
|
968
|
+
badges.length > 0 ? h('span', { className: 'eng-badges', key: 'badges' }, badges) : null,
|
|
969
|
+
canOpen ? h('span', { className: 'eng-row-go', key: 'go' }, icon('chevron', 14)) : null,
|
|
970
|
+
]
|
|
971
|
+
const props = { className: 'eng-row', 'data-type': type, title: file }
|
|
972
|
+
return h('li', { key: file }, canOpen
|
|
973
|
+
? h('button', { type: 'button', ...props, onClick: () => open(store, file, note === undefined) }, ...parts)
|
|
974
|
+
: h('div', props, ...parts))
|
|
975
|
+
}
|
|
976
|
+
const archive = archived.length === 0 ? null
|
|
977
|
+
: h('details', { className: 'eng-archive', open: match === undefined ? undefined : true },
|
|
978
|
+
h('summary', null, icon('archive', 16), h('span', null, t('archive', { count: archived.length }))),
|
|
979
|
+
h('ul', { className: 'eng-rows' }, archived.map((file) => row(file, undefined))))
|
|
980
|
+
|
|
981
|
+
return h('section', { className: 'eng-store', 'aria-label': title },
|
|
791
982
|
h('div', { className: 'eng-store-head' },
|
|
792
983
|
h('h2', { className: 'eng-store-title' }, title),
|
|
984
|
+
h('span', { className: 'eng-store-count' },
|
|
985
|
+
t(store.notes.length === 1 ? 'storeCountOne' : 'storeCount', { count: store.notes.length })),
|
|
793
986
|
// the nearer cap, whichever it is; over it, full and marked, not a bar that stops at the edge
|
|
794
987
|
fill === undefined ? null : h('span', { className: 'eng-meter', 'data-over': index.over === true || fill > 1,
|
|
795
988
|
'aria-hidden': true },
|
|
796
989
|
h('span', { className: 'eng-meter-fill', style: { width: `${Math.min(100, Math.floor(fill * 100))}%` } })),
|
|
797
990
|
h('span', { className: 'eng-usage', 'data-over': index?.over === true, title: index?.over ? t('overHint') : undefined }, usage),
|
|
798
991
|
h('div', { className: 'eng-store-actions' },
|
|
799
|
-
|
|
800
|
-
t(tidy === 'copied' ? 'tidyCopied' : 'tidyCopy')),
|
|
992
|
+
attention ? null : tidyButton('eng-btn eng-btn-ghost'),
|
|
801
993
|
// the folder is shown with its index selected: no index, no folder to show
|
|
802
994
|
...(canOpen && index !== null ? [
|
|
803
|
-
h('button', { type: 'button', className: 'eng-btn', key: 'index',
|
|
804
|
-
onClick: () => open(store, index.name, false) }, t('openIndex')),
|
|
805
|
-
h('button', { type: 'button', className: 'eng-btn', key: 'folder',
|
|
806
|
-
onClick: () => open(store, undefined, false) }, t('openFolder'))] : []))),
|
|
995
|
+
h('button', { type: 'button', className: 'eng-btn eng-btn-ghost', key: 'index',
|
|
996
|
+
onClick: () => open(store, index.name, false) }, icon('index', 14), t('openIndex')),
|
|
997
|
+
h('button', { type: 'button', className: 'eng-btn eng-btn-ghost', key: 'folder',
|
|
998
|
+
onClick: () => open(store, undefined, false) }, icon('folder', 14), t('openFolder'))] : []))),
|
|
807
999
|
h('p', { className: 'eng-path' }, store.dir),
|
|
1000
|
+
!filtering && checked && findings.length === 0
|
|
1001
|
+
? h('p', { className: 'eng-store-ok' }, icon('check', 13), t('healthOk')) : null,
|
|
1002
|
+
attention ? h('div', { className: 'eng-attn', role: 'note' },
|
|
1003
|
+
icon('alert', 16),
|
|
1004
|
+
h('div', { className: 'eng-attn-body' },
|
|
1005
|
+
h('h3', { className: 'eng-attn-title' }, t('attnTitle')),
|
|
1006
|
+
...findings,
|
|
1007
|
+
h('p', { className: 'eng-attn-item', key: 'doctor' }, t('healthFix'))),
|
|
1008
|
+
tidyButton('eng-btn')) : null,
|
|
808
1009
|
tidy === 'failed' ? h('div', { className: 'eng-tidy', role: 'status' },
|
|
809
|
-
h('p',
|
|
1010
|
+
h('p', null, t('tidyFailed')),
|
|
810
1011
|
h('textarea', { readOnly: true, value: prompt, 'aria-label': t('tidyCopy'),
|
|
811
1012
|
onFocus: (event) => event.target.select() })) : null,
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
names(large, false)) : null,
|
|
818
|
-
...groups.map(([type, list]) => h('div', { className: 'eng-group', key: type },
|
|
819
|
-
h('h3', { className: 'eng-group-title' }, t('group', { type: t(typeKey(type)), count: list.length })),
|
|
820
|
-
names(list, false))),
|
|
821
|
-
archived.length > 0 ? h('details', { className: 'eng-archive', open: match === undefined ? undefined : true },
|
|
822
|
-
h('summary', null, t('archive', { count: archived.length })),
|
|
823
|
-
names(archived, true)) : null,
|
|
824
|
-
match !== undefined && groups.length === 0 && archived.length === 0
|
|
1013
|
+
!filtering && unchecked !== undefined ? h('p', { className: 'eng-note' }, t(unchecked)) : null,
|
|
1014
|
+
notes.length > 0 || archive !== null ? h('div', { className: 'eng-list' },
|
|
1015
|
+
notes.length > 0 ? h('ul', { className: 'eng-rows' }, notes.map((note) => row(note.name, note))) : null,
|
|
1016
|
+
archive) : null,
|
|
1017
|
+
filtering && notes.length === 0 && archived.length === 0
|
|
825
1018
|
? h('p', { className: 'eng-filter-none' }, t('filterNone')) : null,
|
|
826
1019
|
store.more ? h('p', { className: 'eng-note' }, t('more')) : null)
|
|
827
1020
|
}
|
|
828
1021
|
|
|
829
|
-
/** When a listing was read, its day with its time, as this computer shows them. */
|
|
830
|
-
const timeOf = (at) => new Date(at).toLocaleString([], { month: '2-digit', day: '2-digit', hour: '2-digit',
|
|
831
|
-
minute: '2-digit' })
|
|
832
|
-
|
|
833
|
-
/**
|
|
834
|
-
* The listing in numbers, as read at `at`: notes by type, archived files, plans, notes past
|
|
835
|
-
* the size one fact needs — and whether that is all there is (a listing cut short, stores
|
|
836
|
-
* that could not be read), since what was not listed is not counted as nothing.
|
|
837
|
-
*/
|
|
838
|
-
function Overview({ data, at, upcoming, t }) {
|
|
839
|
-
const notes = data.stores.flatMap((store) => store.notes)
|
|
840
|
-
const archive = data.stores.reduce((sum, store) => sum + store.archive.length, 0)
|
|
841
|
-
// a note it could not read has no type to count: the counts say the store was read in part
|
|
842
|
-
const types = TYPES.map((type) => [type, notes.filter((note) => note.type === type && !note.unread).length])
|
|
843
|
-
.filter(([, count]) => count > 0)
|
|
844
|
-
const large = notes.filter((note) => note.bytes > LARGE_NOTE).length
|
|
845
|
-
const partial = data.more === true || data.stores.some((store) => store.more)
|
|
846
|
-
// a note or a folder it could not read: the check-up says so, and the counts may fall short
|
|
847
|
-
const incomplete = data.stores.some((store) => store.health?.checked === false &&
|
|
848
|
-
store.health.reason === 'unreadable')
|
|
849
|
-
const count = (...statuses) => upcoming.filter((item) => statuses.includes(item.status)).length
|
|
850
|
-
return h('section', { className: 'eng-overview', 'aria-label': t('overview') },
|
|
851
|
-
h('h2', { className: 'eng-store-title' }, t('overview')),
|
|
852
|
-
h('p', { className: 'eng-overview-line' }, t('statsNotes', { notes: notes.length, archive })),
|
|
853
|
-
types.length > 0 ? h('p', { className: 'eng-overview-line' },
|
|
854
|
-
types.map(([type, n]) => t('group', { type: t(typeKey(type)), count: n })).join(t('listSep'))) : null,
|
|
855
|
-
upcoming.length > 0 ? h('p', { className: 'eng-overview-line' },
|
|
856
|
-
t('statsUpcoming', { past: count('past'), ahead: count('today', 'ahead'), undated: count('undated') })) : null,
|
|
857
|
-
large > 0 ? h('p', { className: 'eng-overview-line' }, t('statsLarge', { count: large })) : null,
|
|
858
|
-
h('p', { className: 'eng-overview-note' }, [
|
|
859
|
-
t('statsReadAt', { time: timeOf(at) }),
|
|
860
|
-
partial ? t('statsPartial') : null,
|
|
861
|
-
incomplete ? t('statsIncomplete') : null,
|
|
862
|
-
data.unreadable > 0 ? t('statsUnreadable', { count: data.unreadable }) : null,
|
|
863
|
-
].filter((text) => text !== null).join(' ')))
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
/** The plans listed, by where they stand against today, names to open as everywhere else. */
|
|
867
|
-
function UpcomingBoard({ items, canOpen, open, t }) {
|
|
868
|
-
const status = (item) => (item.status === 'past' ? t('upcomingPast')
|
|
869
|
-
: item.status === 'today' ? t('upcomingToday')
|
|
870
|
-
: item.status === 'undated' ? t('upcomingUndated')
|
|
871
|
-
: item.days === 1 ? t('upcomingTomorrow') : t('upcomingSoon', { days: item.days }))
|
|
872
|
-
return h('section', { className: 'eng-upcoming', 'aria-label': t('upcomingTitle') },
|
|
873
|
-
h('h2', { className: 'eng-store-title' }, t('upcomingTitle')),
|
|
874
|
-
h('ul', { className: 'eng-upcoming-list' }, items.map((item) => h('li', { key: `${item.store.id}/${item.name}`,
|
|
875
|
-
'data-status': item.status },
|
|
876
|
-
noteName(item.store, item.name, false, canOpen, open),
|
|
877
|
-
h('span', { className: 'eng-upcoming-status' }, status(item))))))
|
|
878
|
-
}
|
|
879
|
-
|
|
880
1022
|
/** A store with anything in it: an index with text, a note, an archived note. A folder or an
|
|
881
1023
|
* empty index alone is not memory yet. */
|
|
882
1024
|
const hasMemory = (store) => (store.index !== null && store.index.bytes > 0) ||
|
|
@@ -889,7 +1031,7 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
889
1031
|
/** How to use it, in a few lines: open while there is no memory yet, folded once there is. */
|
|
890
1032
|
function HowTo({ open, t }) {
|
|
891
1033
|
return h('details', { className: 'eng-howto', open },
|
|
892
|
-
h('summary', null, t('howTo')),
|
|
1034
|
+
h('summary', null, icon('book', 15), t('howTo')),
|
|
893
1035
|
h('ul', null, HOW_TO.map((key) => h('li', { key }, t(key)))))
|
|
894
1036
|
}
|
|
895
1037
|
|
|
@@ -916,6 +1058,7 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
916
1058
|
const href = `${ISSUES}?body=${encodeURIComponent(t('issueBody', { version: VERSION, os: osName() }))}`
|
|
917
1059
|
return h('footer', { className: 'eng-feedback' },
|
|
918
1060
|
h('p', null,
|
|
1061
|
+
icon('issue', 14),
|
|
919
1062
|
t('feedbackLead'),
|
|
920
1063
|
h('a', { className: 'eng-link', href, target: '_blank', rel: 'noopener noreferrer' }, t('feedbackIssue')),
|
|
921
1064
|
t('feedbackMail'),
|
|
@@ -926,11 +1069,15 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
926
1069
|
h('p', { className: 'eng-feedback-note' }, t('feedbackNote', { version: VERSION })))
|
|
927
1070
|
}
|
|
928
1071
|
|
|
929
|
-
/**
|
|
1072
|
+
/**
|
|
1073
|
+
* The sidebar's Memory page: a banner with the listing's numbers and two settings, then the
|
|
1074
|
+
* stores recall can use, their notes a row each, by type and by name as the user filters.
|
|
1075
|
+
*/
|
|
930
1076
|
function MemoryPage({ t }) {
|
|
931
1077
|
const { state, load } = useMemory()
|
|
932
1078
|
const [status, setStatus] = useState(undefined)
|
|
933
1079
|
const [query, setQuery] = useState('')
|
|
1080
|
+
const [kind, setKind] = useState(undefined)
|
|
934
1081
|
const alive = useRef(true)
|
|
935
1082
|
useEffect(() => () => { alive.current = false }, [])
|
|
936
1083
|
|
|
@@ -955,6 +1102,10 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
955
1102
|
|
|
956
1103
|
const data = state.phase === 'ready' ? state.data : undefined
|
|
957
1104
|
const canOpen = data?.canOpen === true
|
|
1105
|
+
// a type a refresh left with nothing is no longer a filter, nor one again when it returns
|
|
1106
|
+
const present = data === undefined || kind === undefined ||
|
|
1107
|
+
data.stores.some((store) => store.notes.some((note) => note.type === kind))
|
|
1108
|
+
useEffect(() => { if (!present) setKind(undefined) }, [present])
|
|
958
1109
|
// a name filter over what was listed: case- and width-insensitive, the .md left out
|
|
959
1110
|
const needle = query.trim().normalize('NFKC').toLowerCase()
|
|
960
1111
|
const match = needle === '' ? undefined
|
|
@@ -963,39 +1114,44 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
963
1114
|
if (state.phase === 'loading') body = h('p', { className: 'eng-note' }, t('listing'))
|
|
964
1115
|
else if (state.phase === 'error') body = h('div', { className: 'eng-banner', 'data-tone': 'error' }, t(state.reason))
|
|
965
1116
|
else {
|
|
966
|
-
const
|
|
967
|
-
const
|
|
968
|
-
const
|
|
969
|
-
|
|
1117
|
+
const notes = data.stores.flatMap((store) => store.notes)
|
|
1118
|
+
const archived = data.stores.reduce((sum, store) => sum + store.archive.length, 0)
|
|
1119
|
+
const counts = TYPES.map((type) => [type, notes.filter((note) => note.type === type).length])
|
|
1120
|
+
.filter(([, count]) => count > 0)
|
|
1121
|
+
const shown = present ? kind : undefined
|
|
1122
|
+
const tab = (type, label, count) => h('button', { type: 'button', className: 'eng-tab', key: type ?? 'all',
|
|
1123
|
+
'data-type': type ?? 'all', 'aria-pressed': shown === type, onClick: () => setKind(type) },
|
|
1124
|
+
label, h('span', { className: 'eng-tab-count' }, String(count)))
|
|
1125
|
+
const matched = match === undefined ? 0 : data.stores.reduce((sum, store) => sum +
|
|
1126
|
+
store.notes.filter((note) => (shown === undefined || note.type === shown) && match(note.name)).length +
|
|
1127
|
+
(shown === undefined ? store.archive.filter(match).length : 0), 0)
|
|
970
1128
|
body = [
|
|
971
1129
|
data.pinned === 'relative' ? h('p', { className: 'eng-note', key: 'pinned' }, t('pinnedRelative')) : null,
|
|
972
1130
|
data.stores.length === 0 && data.pinned === undefined && !(data.unreadable > 0) && data.more !== true
|
|
973
1131
|
? h('p', { className: 'eng-note', key: 'empty' }, t('empty')) : null,
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
h('
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1132
|
+
notes.length + archived > 0 ? h('div', { className: 'eng-toolbar', key: 'toolbar' },
|
|
1133
|
+
h('div', { className: 'eng-tabs', role: 'group', 'aria-label': t('typeLabel') },
|
|
1134
|
+
tab(undefined, t('typeAll'), notes.length),
|
|
1135
|
+
...counts.map(([type, count]) => tab(type, t(typeKey(type)), count))),
|
|
1136
|
+
h('label', { className: 'eng-search' },
|
|
1137
|
+
icon('search', 15),
|
|
1138
|
+
h('input', { type: 'search', className: 'eng-input', value: query, placeholder: t('filterPlaceholder'),
|
|
1139
|
+
'aria-label': t('filterLabel'), onChange: (event) => setQuery(event.target.value) }))) : null,
|
|
1140
|
+
match === undefined ? null : h('p', { className: 'eng-filter-count', key: 'count', role: 'status',
|
|
1141
|
+
'aria-live': 'polite' }, t('filterCount', { count: matched })),
|
|
1142
|
+
...data.stores.map((store) => h(StoreSection, { key: store.id, store, cap: data.cap, canOpen, open, match,
|
|
1143
|
+
kind: shown, now: state.at, t })),
|
|
984
1144
|
data.more ? h('p', { className: 'eng-note', key: 'more' }, t('more')) : null,
|
|
985
1145
|
]
|
|
986
1146
|
}
|
|
987
1147
|
return h('div', { className: 'eng-memory' },
|
|
988
|
-
h(
|
|
989
|
-
|
|
990
|
-
h('h1', { className: 'eng-memory-title' }, t('panelTitle')),
|
|
991
|
-
h('p', { className: 'eng-memory-intro' }, t(data !== undefined && !canOpen ? 'memoryIntroNoOpen' : 'memoryIntro'))),
|
|
992
|
-
h('button', { type: 'button', className: 'eng-btn', onClick: () => { setStatus(undefined); load() } }, t('refresh'))),
|
|
993
|
-
h(SettingsStrip, { t }),
|
|
1148
|
+
h(Hero, { data, at: state.at, refresh: () => { setStatus(undefined); load() }, t }),
|
|
1149
|
+
data === undefined ? null : h(Caveats, { data, t }),
|
|
994
1150
|
status ? h('div', { className: 'eng-banner', 'data-tone': status.tone, role: 'status' }, status.text) : null,
|
|
995
1151
|
data !== undefined && !canOpen && data.stores.length > 0 ? h('p', { className: 'eng-note' }, t('openUnavailable')) : null,
|
|
1152
|
+
body,
|
|
996
1153
|
h(HowTo, { open: data !== undefined && data.pinned !== 'relative' && data.more !== true &&
|
|
997
1154
|
!(data.unreadable > 0) && !data.stores.some((store) => hasMemory(store) || readInPart(store)), t }),
|
|
998
|
-
body,
|
|
999
1155
|
h(Feedback, { t }))
|
|
1000
1156
|
}
|
|
1001
1157
|
|