dsh-engramory 1.0.8 → 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 -16
- package/README.md +1 -1
- package/client.js +516 -129
- package/index.js +3151 -3112
- package/package.json +1 -1
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.0
|
|
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. */
|
|
@@ -35,6 +38,11 @@ window.__ModuleLoader__.load({
|
|
|
35
38
|
const EMAIL = 'engramory@agent.qq.com'
|
|
36
39
|
/** The how-to's lines, in order. */
|
|
37
40
|
const HOW_TO = ['howToSay', 'howToRecall', 'howToEdit', 'howToMove', 'howToSocial']
|
|
41
|
+
/** A note past this is almost always a timeline under one slug (SKILL.md: "A note has a size
|
|
42
|
+
* too"); the doctor warns at the same size (ENGRAMORY_NOTE_WARN_BYTES). */
|
|
43
|
+
const LARGE_NOTE = 12 * 1024
|
|
44
|
+
/** An `upcoming` note named with its date: `2026-10-31-interview`, `2026-10-31面试` (SKILL.md §2.2). */
|
|
45
|
+
const DATED = /^(\d{4})-(\d{2})-(\d{2})(?!\d)/
|
|
38
46
|
const DEFAULT_LINES = 200
|
|
39
47
|
const DEFAULT_BYTES = 25600
|
|
40
48
|
/** The order the memory page shows note types in (SKILL.md §2, §2.2). */
|
|
@@ -70,8 +78,6 @@ window.__ModuleLoader__.load({
|
|
|
70
78
|
failed: '保存失败:',
|
|
71
79
|
panel: '记忆',
|
|
72
80
|
panelTitle: 'Engramory 记忆',
|
|
73
|
-
memoryIntro: 'AI 自己记下的东西,这里只看不改。点名字用电脑上的默认程序打开。',
|
|
74
|
-
memoryIntroNoOpen: 'AI 自己记下的东西,这里只看不改。',
|
|
75
81
|
refresh: '刷新',
|
|
76
82
|
stripNote: '说明和索引上限在「插件 → Engramory 记忆」。',
|
|
77
83
|
stripReadOnly: '这里改不了,见「插件 → Engramory 记忆」。',
|
|
@@ -82,9 +88,9 @@ window.__ModuleLoader__.load({
|
|
|
82
88
|
pinnedRelative: '配置里固定的索引(indexPath)是相对路径,跟着每个会话的目录走,这里列不出来。改成绝对路径就能在这里看到。',
|
|
83
89
|
storeUser: '全局记忆',
|
|
84
90
|
storePinned: '固定的记忆库',
|
|
85
|
-
usage: '{lines} / {maxLines} 行 · {size} / {maxSize}',
|
|
86
|
-
usageOver: '{size} / {maxSize},超出上限',
|
|
87
|
-
usageSize: '{size} / {maxSize}',
|
|
91
|
+
usage: '索引 {lines} / {maxLines} 行 · {size} / {maxSize}',
|
|
92
|
+
usageOver: '索引 {size} / {maxSize},超出上限',
|
|
93
|
+
usageSize: '索引 {size} / {maxSize}',
|
|
88
94
|
sizeBytes: '{n} B',
|
|
89
95
|
sizeKB: '{n} KB',
|
|
90
96
|
overHint: '超出上限了,AI 只读得到前面一部分,该压缩了。',
|
|
@@ -104,17 +110,15 @@ window.__ModuleLoader__.load({
|
|
|
104
110
|
typeUpcoming: '约定',
|
|
105
111
|
typeSelf: '我自己',
|
|
106
112
|
typeOther: '其他',
|
|
107
|
-
|
|
108
|
-
archive: '归档({count})',
|
|
113
|
+
archive: '归档 {count} 份',
|
|
109
114
|
more: '文件太多,这里只列出了一部分。',
|
|
110
|
-
healthTitle: '体检',
|
|
111
115
|
healthOk: '体检:没发现问题。',
|
|
112
116
|
healthBroken: '索引里指向不存在的文件({count})',
|
|
113
117
|
healthBrokenMore: '索引里指向不存在的文件({count} 个以上)',
|
|
114
118
|
healthBrokenUnlisted: '索引里有指向不存在的文件,太多了,这里没列出。',
|
|
115
119
|
healthUnindexed: '不在索引里({count}):AI 回忆从索引开始,这些它通常找不到,除非别的笔记链到它们。',
|
|
116
120
|
healthUntyped: '没写类型或类型不认识({count}),列在「其他」里。',
|
|
117
|
-
healthFix: '
|
|
121
|
+
healthFix: '完整检查可以用 engramory_doctor.py。',
|
|
118
122
|
healthLarge: '要核对的太多,没做体检。',
|
|
119
123
|
healthUnreadable: '有文件读不了,没做体检。',
|
|
120
124
|
healthPartial: '文件太多没列全,没做体检。',
|
|
@@ -132,6 +136,41 @@ window.__ModuleLoader__.load({
|
|
|
132
136
|
copyFailed: '复制不了,请手动选中上面的地址。',
|
|
133
137
|
feedbackNote: '邮件会由 AI 助手协助整理,issue 是公开的,两处都别把记忆内容原样贴上去。插件版本 {version}。',
|
|
134
138
|
issueBody: '(写下遇到的问题或建议)\n\n---\ndsh-engramory {version}\n打开这个页面的电脑:{os}\ndsh 版本:',
|
|
139
|
+
statNote: '条记忆',
|
|
140
|
+
statNotes: '条记忆',
|
|
141
|
+
statStore: '个记忆库',
|
|
142
|
+
statStores: '个记忆库',
|
|
143
|
+
statArchive: '份归档',
|
|
144
|
+
statsReadAt: '读取于 {time},约定的天数按这时算',
|
|
145
|
+
statsPartial: '列表太长,只列出了一部分,这些数字偏少。',
|
|
146
|
+
statsUnreadable: '有 {count} 处可能存放记忆库的位置没读到(读不了或查不了),没算在内。',
|
|
147
|
+
statsIncomplete: '有的库里有文件读不了,这些数字可能偏少。',
|
|
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 拆成几篇。',
|
|
166
|
+
filterLabel: '筛选笔记',
|
|
167
|
+
filterPlaceholder: '按名字筛选',
|
|
168
|
+
filterCount: '匹配 {count} 条(只在已列出的笔记里找)',
|
|
169
|
+
filterNone: '这个库里没有匹配的笔记。',
|
|
170
|
+
tidyCopy: '复制整理指令',
|
|
171
|
+
tidyCopied: '已复制,粘贴进对话发给 AI',
|
|
172
|
+
tidyFailed: '复制不了,请手动选中下面的指令:',
|
|
173
|
+
tidyPrompt: '请按 Engramory 的记忆规则整理这个记忆库:{dir}\n- 索引里指向不存在文件的链接:找得到对应笔记的就改对,确实没有了的只删这个链接;一行里没有别的有效链接了,才删掉整行。\n- 不在索引里的笔记:以后回忆用得上的补进索引,过时的移进 archive/ 或删掉;不要为了补齐全部加进去。\n- 没写类型的笔记补上 type。\n- 索引超出上限就先压缩:合并重复,细节挪回笔记,索引只留指针。\n- 超过约 12 KB 的笔记,按规则拆成几篇。\n- 日期已过的约定别删,问到结果再改写成经历。\n改完再看一遍索引有没有超出上限,然后告诉我改了什么。',
|
|
135
174
|
}
|
|
136
175
|
const en = {
|
|
137
176
|
summary: 'Companion mode and memory access, and the index cap.',
|
|
@@ -163,8 +202,6 @@ window.__ModuleLoader__.load({
|
|
|
163
202
|
failed: 'Saving failed: ',
|
|
164
203
|
panel: 'Memory',
|
|
165
204
|
panelTitle: 'Engramory memory',
|
|
166
|
-
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.',
|
|
167
|
-
memoryIntroNoOpen: 'What the AI has noted down for itself — to look at, not to edit.',
|
|
168
205
|
refresh: 'Refresh',
|
|
169
206
|
stripNote: 'Explanations and the index cap: Plugins → Engramory memory.',
|
|
170
207
|
stripReadOnly: 'Cannot be changed here; see Plugins → Engramory memory.',
|
|
@@ -175,9 +212,9 @@ window.__ModuleLoader__.load({
|
|
|
175
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.',
|
|
176
213
|
storeUser: 'Global memory',
|
|
177
214
|
storePinned: 'Pinned store',
|
|
178
|
-
usage: '{lines} / {maxLines} lines · {size} / {maxSize}',
|
|
179
|
-
usageOver: '{size} / {maxSize}, over the cap',
|
|
180
|
-
usageSize: '{size} / {maxSize}',
|
|
215
|
+
usage: 'Index {lines} / {maxLines} lines · {size} / {maxSize}',
|
|
216
|
+
usageOver: 'Index {size} / {maxSize}, over the cap',
|
|
217
|
+
usageSize: 'Index {size} / {maxSize}',
|
|
181
218
|
sizeBytes: '{n} B',
|
|
182
219
|
sizeKB: '{n} KB',
|
|
183
220
|
overHint: 'Over the cap: the AI reads only the first part. Time to compact it.',
|
|
@@ -197,17 +234,15 @@ window.__ModuleLoader__.load({
|
|
|
197
234
|
typeUpcoming: 'Coming up',
|
|
198
235
|
typeSelf: 'Myself',
|
|
199
236
|
typeOther: 'Other',
|
|
200
|
-
group: '{type} · {count}',
|
|
201
237
|
archive: 'Archive ({count})',
|
|
202
238
|
more: 'Too many files: only some are listed here.',
|
|
203
|
-
healthTitle: 'Check-up',
|
|
204
239
|
healthOk: 'Check-up: nothing to fix.',
|
|
205
240
|
healthBroken: 'The index points to files that are not there ({count})',
|
|
206
241
|
healthBrokenMore: 'The index points to files that are not there (over {count})',
|
|
207
242
|
healthBrokenUnlisted: 'The index points to files that are not there: too many to list here.',
|
|
208
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.',
|
|
209
244
|
healthUntyped: 'No type, or one it does not know ({count}), listed under Other.',
|
|
210
|
-
healthFix: '
|
|
245
|
+
healthFix: 'For a full check, run engramory_doctor.py.',
|
|
211
246
|
healthLarge: 'Too much to check here, so no check-up.',
|
|
212
247
|
healthUnreadable: 'Some files could not be read, so no check-up.',
|
|
213
248
|
healthPartial: 'Too many files to list them all, so no check-up here.',
|
|
@@ -225,6 +260,41 @@ window.__ModuleLoader__.load({
|
|
|
225
260
|
copyFailed: 'Could not copy; select the address above by hand.',
|
|
226
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}.',
|
|
227
262
|
issueBody: '(What happened, or your idea)\n\n---\ndsh-engramory {version}\nComputer this page was opened on: {os}\ndsh version: ',
|
|
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',
|
|
269
|
+
statsPartial: 'The listing was too long to finish, so these numbers fall short.',
|
|
270
|
+
statsUnreadable: '{count} places that may hold a memory store could not be read and are not counted.',
|
|
271
|
+
statsIncomplete: 'Some files in a store could not be read, so these numbers may fall short.',
|
|
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.',
|
|
290
|
+
filterLabel: 'Filter notes',
|
|
291
|
+
filterPlaceholder: 'Filter by name',
|
|
292
|
+
filterCount: '{count} matching (among the notes listed)',
|
|
293
|
+
filterNone: 'No matching notes in this store.',
|
|
294
|
+
tidyCopy: 'Copy tidy-up instructions',
|
|
295
|
+
tidyCopied: 'Copied; paste it into a conversation',
|
|
296
|
+
tidyFailed: 'Could not copy; select the instructions below by hand:',
|
|
297
|
+
tidyPrompt: 'Tidy up this memory store by the Engramory rules: {dir}\n- Links in the index to files that are not there: fix the ones whose note you can find; where there is none, remove that link alone, and the line only when it has no other live link left.\n- Notes the index does not name: add the ones recall will need, move the outdated ones into archive/ or delete them; do not add them all just to be complete.\n- Notes with no type: give them one.\n- An index over its cap: compact it first by merging duplicates and moving detail back into the notes, so the index holds pointers only.\n- Notes past about 12 KB: split them as the rules say.\n- Plans whose date has passed: do not delete them; rewrite them as what happened once you learn the outcome.\nThen check the index is within its cap, and tell me what you changed.',
|
|
228
298
|
}
|
|
229
299
|
|
|
230
300
|
const CSS = `
|
|
@@ -252,51 +322,122 @@ window.__ModuleLoader__.load({
|
|
|
252
322
|
.eng-cap{display:flex;gap:12px;align-items:center;flex-wrap:wrap;}
|
|
253
323
|
.eng-cap label{display:flex;align-items:center;gap:6px;color:var(--dsw-alias-label-secondary);font-size:12px;}
|
|
254
324
|
.eng-cap input{width:110px;}
|
|
255
|
-
.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;}
|
|
256
326
|
.eng-btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);}
|
|
257
327
|
.eng-btn:disabled{opacity:.5;cursor:default;}
|
|
258
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);}
|
|
259
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;}
|
|
260
332
|
.eng-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;}
|
|
261
|
-
.eng-memory{box-sizing:border-box;height:100%;overflow:auto;display:flex;flex-direction:column;align-items:center;gap:
|
|
262
|
-
.eng-memory
|
|
263
|
-
.eng-memory
|
|
264
|
-
|
|
265
|
-
.eng-
|
|
266
|
-
.eng-
|
|
267
|
-
.eng-
|
|
268
|
-
.eng-
|
|
269
|
-
.eng-
|
|
270
|
-
.eng-
|
|
271
|
-
.eng-
|
|
272
|
-
.eng-
|
|
273
|
-
.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;}
|
|
274
385
|
.eng-usage[data-over="true"]{color:var(--dsw-alias-state-error-primary);}
|
|
275
|
-
.eng-store-actions{margin-left:auto;display:inline-flex;gap:
|
|
276
|
-
.eng-path{margin:-8px 0 0;font-family:var(--ds-font-family-code,ui-monospace,monospace);font-size:
|
|
277
|
-
.eng-
|
|
278
|
-
.eng-
|
|
279
|
-
.eng-
|
|
280
|
-
.eng-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
.eng-
|
|
285
|
-
.eng-
|
|
286
|
-
.eng-
|
|
287
|
-
.eng-
|
|
288
|
-
.eng-
|
|
289
|
-
.eng-
|
|
290
|
-
.eng-
|
|
291
|
-
.eng-
|
|
292
|
-
.eng-
|
|
293
|
-
.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);}
|
|
294
436
|
.eng-link{color:var(--dsw-alias-brand-primary);text-decoration:underline;text-underline-offset:2px;}
|
|
295
437
|
.eng-link:hover{opacity:.8;}
|
|
296
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);}
|
|
297
|
-
.eng-btn-small{padding:1px 8px;font-size:11.5px;}
|
|
298
439
|
.eng-feedback-note{color:var(--dsw-alias-label-tertiary);}
|
|
299
|
-
.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;}
|
|
300
441
|
`
|
|
301
442
|
|
|
302
443
|
/** The settings the page edits, in the order the host computes its revision from. */
|
|
@@ -568,7 +709,7 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
568
709
|
try {
|
|
569
710
|
const response = await request(MEMORY_API)
|
|
570
711
|
next = response.ok && Array.isArray(response.body?.stores)
|
|
571
|
-
? { phase: 'ready', data: response.body }
|
|
712
|
+
? { phase: 'ready', data: response.body, at: Date.now() }
|
|
572
713
|
: { phase: 'error', reason: response.status === 503 ? 'listTimeout' : 'listFailed' }
|
|
573
714
|
} catch {
|
|
574
715
|
next = { phase: 'error', reason: 'listFailed' }
|
|
@@ -588,42 +729,162 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
588
729
|
const typeKey = (type) => `type${type[0].toUpperCase()}${type.slice(1)}`
|
|
589
730
|
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' })
|
|
590
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)
|
|
734
|
+
|
|
735
|
+
/** Put `text` on the clipboard; false where there is none (a page over plain http) or it is refused. */
|
|
736
|
+
async function copyText(text) {
|
|
737
|
+
try {
|
|
738
|
+
await globalThis.navigator.clipboard.writeText(text)
|
|
739
|
+
return true
|
|
740
|
+
} catch {
|
|
741
|
+
return false
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/** The date an `upcoming` note is named with, if it is a real day: `YYYY-MM-DD`, else undefined. */
|
|
746
|
+
function dateOf(file) {
|
|
747
|
+
const m = DATED.exec(nameOf(file))
|
|
748
|
+
if (m === null) return undefined
|
|
749
|
+
const [y, mo, d] = [Number(m[1]), Number(m[2]), Number(m[3])]
|
|
750
|
+
const day = new Date(Date.UTC(y, mo - 1, d))
|
|
751
|
+
return day.getUTCFullYear() === y && day.getUTCMonth() === mo - 1 && day.getUTCDate() === d
|
|
752
|
+
? `${m[1]}-${m[2]}-${m[3]}` : undefined
|
|
753
|
+
}
|
|
754
|
+
/** A `YYYY-MM-DD` day as a number of days, to subtract one from another. */
|
|
755
|
+
const dayNumber = (date) => Date.UTC(Number(date.slice(0, 4)), Number(date.slice(5, 7)) - 1,
|
|
756
|
+
Number(date.slice(8, 10))) / 86400000
|
|
757
|
+
/** Today on this computer's calendar, as `YYYY-MM-DD`. */
|
|
758
|
+
function todayOf(now) {
|
|
759
|
+
const d = new Date(now)
|
|
760
|
+
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`
|
|
761
|
+
}
|
|
591
762
|
|
|
592
763
|
/**
|
|
593
|
-
*
|
|
594
|
-
*
|
|
764
|
+
* Where an `upcoming` note stands against today on this computer: a date passed only says
|
|
765
|
+
* the outcome is yet to be asked about (SKILL.md §2.2 keeps the note until it is known),
|
|
766
|
+
* so nothing here is called late or stale. No date, or no real one, is undated.
|
|
595
767
|
*/
|
|
596
|
-
function
|
|
597
|
-
const
|
|
598
|
-
if (
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
const
|
|
606
|
-
if (
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
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
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
/** How full an index is, the nearer of its two caps; its lines only when they were counted. */
|
|
784
|
+
function fillOf(index, cap) {
|
|
785
|
+
const lines = index.lines === undefined ? 0 : index.lines / cap.maxLines
|
|
786
|
+
return Math.max(lines, index.bytes / cap.maxBytes)
|
|
787
|
+
}
|
|
788
|
+
|
|
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' }]],
|
|
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' })
|
|
835
|
+
|
|
836
|
+
/**
|
|
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.
|
|
841
|
+
*/
|
|
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(' ')))
|
|
623
875
|
}
|
|
624
876
|
|
|
625
|
-
/**
|
|
626
|
-
|
|
877
|
+
/**
|
|
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.
|
|
883
|
+
*/
|
|
884
|
+
function StoreSection({ store, cap, canOpen, open, match, kind, now, t }) {
|
|
885
|
+
const [tidy, setTidy] = useState('idle')
|
|
886
|
+
const alive = useRef(true)
|
|
887
|
+
useEffect(() => () => { alive.current = false }, [])
|
|
627
888
|
const title = store.kind === 'user' ? [t('storeUser'), ...store.titles].join(' · ')
|
|
628
889
|
: store.kind === 'pinned' ? [t('storePinned'), ...store.titles].join(' · ')
|
|
629
890
|
: store.titles.join(' · ')
|
|
@@ -633,33 +894,128 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
633
894
|
const usage = index === null ? t('noIndex')
|
|
634
895
|
: index.lines !== undefined ? t('usage', { lines: index.lines, maxLines: cap.maxLines, ...sizes })
|
|
635
896
|
: t(index.over ? 'usageOver' : 'usageSize', sizes)
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
897
|
+
const fill = index === null ? undefined : fillOf(index, cap)
|
|
898
|
+
const filtering = match !== undefined || kind !== undefined
|
|
899
|
+
const keep = (file) => match === undefined || match(file)
|
|
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
|
+
|
|
930
|
+
const prompt = t('tidyPrompt', { dir: store.dir })
|
|
931
|
+
const copyTidy = async () => {
|
|
932
|
+
const done = await copyText(prompt)
|
|
933
|
+
if (alive.current) setTidy(done ? 'copied' : 'failed')
|
|
934
|
+
}
|
|
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 },
|
|
645
982
|
h('div', { className: 'eng-store-head' },
|
|
646
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 })),
|
|
986
|
+
// the nearer cap, whichever it is; over it, full and marked, not a bar that stops at the edge
|
|
987
|
+
fill === undefined ? null : h('span', { className: 'eng-meter', 'data-over': index.over === true || fill > 1,
|
|
988
|
+
'aria-hidden': true },
|
|
989
|
+
h('span', { className: 'eng-meter-fill', style: { width: `${Math.min(100, Math.floor(fill * 100))}%` } })),
|
|
647
990
|
h('span', { className: 'eng-usage', 'data-over': index?.over === true, title: index?.over ? t('overHint') : undefined }, usage),
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
991
|
+
h('div', { className: 'eng-store-actions' },
|
|
992
|
+
attention ? null : tidyButton('eng-btn eng-btn-ghost'),
|
|
993
|
+
// the folder is shown with its index selected: no index, no folder to show
|
|
994
|
+
...(canOpen && index !== null ? [
|
|
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'))] : []))),
|
|
654
999
|
h('p', { className: 'eng-path' }, store.dir),
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
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,
|
|
1009
|
+
tidy === 'failed' ? h('div', { className: 'eng-tidy', role: 'status' },
|
|
1010
|
+
h('p', null, t('tidyFailed')),
|
|
1011
|
+
h('textarea', { readOnly: true, value: prompt, 'aria-label': t('tidyCopy'),
|
|
1012
|
+
onFocus: (event) => event.target.select() })) : null,
|
|
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
|
|
1018
|
+
? h('p', { className: 'eng-filter-none' }, t('filterNone')) : null,
|
|
663
1019
|
store.more ? h('p', { className: 'eng-note' }, t('more')) : null)
|
|
664
1020
|
}
|
|
665
1021
|
|
|
@@ -668,10 +1024,14 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
668
1024
|
const hasMemory = (store) => (store.index !== null && store.index.bytes > 0) ||
|
|
669
1025
|
store.notes.length > 0 || store.archive.length > 0
|
|
670
1026
|
|
|
1027
|
+
/** A store not read to its end: a listing cut short, or a file or folder it could not read. */
|
|
1028
|
+
const readInPart = (store) => store.more === true ||
|
|
1029
|
+
(store.health?.checked === false && store.health.reason === 'unreadable')
|
|
1030
|
+
|
|
671
1031
|
/** How to use it, in a few lines: open while there is no memory yet, folded once there is. */
|
|
672
1032
|
function HowTo({ open, t }) {
|
|
673
1033
|
return h('details', { className: 'eng-howto', open },
|
|
674
|
-
h('summary', null, t('howTo')),
|
|
1034
|
+
h('summary', null, icon('book', 15), t('howTo')),
|
|
675
1035
|
h('ul', null, HOW_TO.map((key) => h('li', { key }, t(key)))))
|
|
676
1036
|
}
|
|
677
1037
|
|
|
@@ -692,18 +1052,13 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
692
1052
|
const alive = useRef(true)
|
|
693
1053
|
useEffect(() => () => { alive.current = false }, [])
|
|
694
1054
|
const copyAddress = async () => {
|
|
695
|
-
|
|
696
|
-
try {
|
|
697
|
-
await globalThis.navigator.clipboard.writeText(EMAIL)
|
|
698
|
-
done = true
|
|
699
|
-
} catch {
|
|
700
|
-
// no clipboard here (a page served over plain http) or permission refused
|
|
701
|
-
}
|
|
1055
|
+
const done = await copyText(EMAIL)
|
|
702
1056
|
if (alive.current) setCopy(done ? 'copied' : 'copyFailed')
|
|
703
1057
|
}
|
|
704
1058
|
const href = `${ISSUES}?body=${encodeURIComponent(t('issueBody', { version: VERSION, os: osName() }))}`
|
|
705
1059
|
return h('footer', { className: 'eng-feedback' },
|
|
706
1060
|
h('p', null,
|
|
1061
|
+
icon('issue', 14),
|
|
707
1062
|
t('feedbackLead'),
|
|
708
1063
|
h('a', { className: 'eng-link', href, target: '_blank', rel: 'noopener noreferrer' }, t('feedbackIssue')),
|
|
709
1064
|
t('feedbackMail'),
|
|
@@ -714,10 +1069,15 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
714
1069
|
h('p', { className: 'eng-feedback-note' }, t('feedbackNote', { version: VERSION })))
|
|
715
1070
|
}
|
|
716
1071
|
|
|
717
|
-
/**
|
|
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
|
+
*/
|
|
718
1076
|
function MemoryPage({ t }) {
|
|
719
1077
|
const { state, load } = useMemory()
|
|
720
1078
|
const [status, setStatus] = useState(undefined)
|
|
1079
|
+
const [query, setQuery] = useState('')
|
|
1080
|
+
const [kind, setKind] = useState(undefined)
|
|
721
1081
|
const alive = useRef(true)
|
|
722
1082
|
useEffect(() => () => { alive.current = false }, [])
|
|
723
1083
|
|
|
@@ -742,29 +1102,56 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
|
|
|
742
1102
|
|
|
743
1103
|
const data = state.phase === 'ready' ? state.data : undefined
|
|
744
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])
|
|
1109
|
+
// a name filter over what was listed: case- and width-insensitive, the .md left out
|
|
1110
|
+
const needle = query.trim().normalize('NFKC').toLowerCase()
|
|
1111
|
+
const match = needle === '' ? undefined
|
|
1112
|
+
: (file) => nameOf(file).normalize('NFKC').toLowerCase().includes(needle)
|
|
745
1113
|
let body
|
|
746
1114
|
if (state.phase === 'loading') body = h('p', { className: 'eng-note' }, t('listing'))
|
|
747
1115
|
else if (state.phase === 'error') body = h('div', { className: 'eng-banner', 'data-tone': 'error' }, t(state.reason))
|
|
748
1116
|
else {
|
|
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)
|
|
749
1128
|
body = [
|
|
750
1129
|
data.pinned === 'relative' ? h('p', { className: 'eng-note', key: 'pinned' }, t('pinnedRelative')) : null,
|
|
751
|
-
data.stores.length === 0 && data.pinned === undefined
|
|
752
|
-
|
|
1130
|
+
data.stores.length === 0 && data.pinned === undefined && !(data.unreadable > 0) && data.more !== true
|
|
1131
|
+
? h('p', { className: 'eng-note', key: 'empty' }, t('empty')) : null,
|
|
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 })),
|
|
753
1144
|
data.more ? h('p', { className: 'eng-note', key: 'more' }, t('more')) : null,
|
|
754
1145
|
]
|
|
755
1146
|
}
|
|
756
1147
|
return h('div', { className: 'eng-memory' },
|
|
757
|
-
h(
|
|
758
|
-
|
|
759
|
-
h('h1', { className: 'eng-memory-title' }, t('panelTitle')),
|
|
760
|
-
h('p', { className: 'eng-memory-intro' }, t(data !== undefined && !canOpen ? 'memoryIntroNoOpen' : 'memoryIntro'))),
|
|
761
|
-
h('button', { type: 'button', className: 'eng-btn', onClick: () => { setStatus(undefined); load() } }, t('refresh'))),
|
|
762
|
-
h(SettingsStrip, { t }),
|
|
1148
|
+
h(Hero, { data, at: state.at, refresh: () => { setStatus(undefined); load() }, t }),
|
|
1149
|
+
data === undefined ? null : h(Caveats, { data, t }),
|
|
763
1150
|
status ? h('div', { className: 'eng-banner', 'data-tone': status.tone, role: 'status' }, status.text) : null,
|
|
764
1151
|
data !== undefined && !canOpen && data.stores.length > 0 ? h('p', { className: 'eng-note' }, t('openUnavailable')) : null,
|
|
765
|
-
h(HowTo, { open: data !== undefined && data.pinned !== 'relative' && data.more !== true &&
|
|
766
|
-
!data.stores.some(hasMemory), t }),
|
|
767
1152
|
body,
|
|
1153
|
+
h(HowTo, { open: data !== undefined && data.pinned !== 'relative' && data.more !== true &&
|
|
1154
|
+
!(data.unreadable > 0) && !data.stores.some((store) => hasMemory(store) || readInPart(store)), t }),
|
|
768
1155
|
h(Feedback, { t }))
|
|
769
1156
|
}
|
|
770
1157
|
|