Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

feat(web): 添加关注回车即查,关注管理收成一列窄栏

longmeidao59eec90546db
diff --git a/.claude/skills/peach-web-ui/SKILL.md b/.claude/skills/peach-web-ui/SKILL.md
index da9169118..4a10587d5 100644
--- a/.claude/skills/peach-web-ui/SKILL.md
+++ b/.claude/skills/peach-web-ui/SKILL.md
@@ -49,6 +49,7 @@ description: 在新增、修改或复核 Peach 页面、控件、提示、错误
- Progress 必须有真实 `value/max`、可见单位与 `aria-valuemin/max/now`;分隔线放在完整指标(含进度条)之后。
- Switch 必须共享 radio `name`、初始一个 `checked`、键盘可用;布尔状态继续使用 Toggle。
- 菜单每项包含与入口相同的图标和文字,菜单内部滚动、`overscroll-behavior:contain`,不得把浏览器页面撑出滚动条。
+- 只读查询(搜索、筛选)不配提交按钮:回车即执行,忙态落在表单自己身上(`form[aria-busy]` 加前缀原位换 Spinner)。有副作用的提交必须有按钮,且回车同样要能提交。表单里除这个输入框外还有别的字段时浏览器不做隐式提交,回车要自己接管 `requestSubmit()` 并跳过 `isComposing`。判据与实测见 `docs/reference-snapshots/vercel-forms-submit-affordance.md`。
- Spinner 只反馈用户直接触发的动作,触发器统一调用 `setActionBusy()`:写入 `aria-busy=true` 与 `aria-disabled=true`、视觉变灰、拦截重复触发,同时保持可聚焦;请求等待期不得再用原生 `disabled`,它只留给缺输入、无权限等动作确实不可执行的状态。未知时长的后台抓取使用 Loading Dots。整页或大区块首次取数使用 Skeleton 预留最终结构。Spinner/Loading Dots 保留可见状态文字;Skeleton 只保留给辅助技术的状态名,不另画「正在读取」文案。三者都尊重 reduced motion。
- 用户写操作只在服务端终态成功后调用共享 `actionReceipt()` 发一条过去时 Toast;可由安全逆操作完整恢复的状态提供 8 秒“撤销”,永久删除、凭据、保存到账本等不伪造撤销。仅打开面板/菜单/Dialog 不算操作完成,不发 Toast;失败除短 Toast 外仍在原位置保留原因与重试入口。
- 同一次页面进入只呈现一段等待态;深链启动与页面取数复用同一个 Skeleton,禁止 Spinner 再切换成 Loading Dots 或 Skeleton。
diff --git a/docs/reference-snapshots/vercel-forms-submit-affordance.md b/docs/reference-snapshots/vercel-forms-submit-affordance.md
new file mode 100644
index 000000000..cbb112457
--- /dev/null
+++ b/docs/reference-snapshots/vercel-forms-submit-affordance.md
@@ -0,0 +1,42 @@
+# Vercel Forms:什么时候配提交按钮,什么时候回车就够
+
+- 取证日期:2026-09-03
+- URL:<https://vercel.com/design/guidelines>(Forms 一节)
+- 取证方式:浏览器加载页面后读正文
+- **不在 `docs/reference-sources.json` 里登记**:这一页是 React 渲染的,抓下来的 HTML
+ 没有可哈希的上游快照。仓库里已登记的 `vercel-web-interface-guidelines` 取自
+ GitHub 上那份 `command.md`,是同一套规范的精简版,Forms 一节缺下面这几条。
+
+## 规范里的四条(本次取到的原文要点)
+
+| 条目 | 规范怎么说 |
+| --- | --- |
+| 回车提交 | 文本输入获得焦点时,**若它是表单里唯一的控件,回车即提交**;控件多时把这条落在最后一个控件上 |
+| textarea | `<textarea>` 里 ⌘/⌃+Enter 提交,回车插入换行 |
+| 提交按钮的状态 | 提交发起前保持可用,发起后禁用并显示 Spinner,带幂等键 |
+| 不要预禁用 | 不许因为表单没填完就禁用提交;允许提交以便暴露校验反馈 |
+
+## 由此得到的判据
+
+规范没有「搜索不配按钮」这一条,它给的是更一般的分界:
+
+- **只读、没有副作用的查询**(搜索、筛选)——控件本来就只有一个输入框,回车即执行,
+ 按钮是多余的第二个入口。配套模式是 Search Input:搜索图标前缀,查询中原位换 Spinner。
+- **有副作用的提交**(写入、删除、付款)——按钮必须在,它同时是「这一步会改东西」的
+ 声明和一个可以进入忙态、可以显示 Spinner 的落点;回车仍然要能提交,两者并存。
+
+## Peach 对应(2026-09-03)
+
+- 关注管理「添加关注」的查找是只读的:字段从 `<textarea name="lines">` 收成
+ `<input type="search" name="line">`,去掉「查找」按钮。原来非配按钮不可,正是因为
+ 字段是 textarea——那里回车按规范要换行。
+- 多行批量一并去掉:一个作者就要几十秒,一次粘五行等于把这个等待乘五,中途还看不出
+ 走到哪一行。真正的写入动作仍然有按钮(候选列表下的「添加选中」)。
+- 忙态没有按钮可以变灰,就落在表单自己身上:`form[aria-busy="true"]`,前缀图标原位
+ 换 Spinner,重复提交由 `form.dataset.busy` 挡。
+- **隐式提交在这个表单上不成立**:浏览器只在「表单里仅有一个文本字段」时才替你提交,
+ 而来源筛选的那串复选框和输入框住在同一个 `<form>` 里。实测按下回车什么也不发生
+ (`submit` 事件计数为 0),所以回车由 `keydown` 自己接管调 `form.requestSubmit()`,
+ 并跳过 `isComposing`——中文输入法选字那一下的回车不是提交。
+- 占位文字按规范以省略号收尾并给出示例样式(`粘贴来源链接,或输入作者名、id…`)。
+ 它只说格式,不许由数据拼出具体创作者名——推荐要能点,那是「猜你喜欢」的活。
diff --git a/tests/test_follow_web.py b/tests/test_follow_web.py
index 56846745f..2e9600e09 100644
--- a/tests/test_follow_web.py
+++ b/tests/test_follow_web.py
@@ -1435,16 +1435,45 @@ class FollowWebSourceTests(unittest.TestCase):
def test_sources_are_added_by_pasting_not_by_a_command(self):
self.assertPageContains('id="followAdd"')
- self.assertPageContains('name="lines"')
+ self.assertPageContains('name="line"')
self.assertPageContains("'/api/follow/source'")
self.assertPageContains("data-follow-remove")
+ def test_the_lookup_is_one_line_submitted_by_enter_without_a_button(self):
+ """查找不改任何东西,按 Vercel 表单规范就不该配提交按钮。
+
+ 规范原话是「输入框获得焦点时,若它是唯一控件,回车即提交」。原来非配按钮
+ 不可,是因为字段是 textarea——那里回车按规范要插入换行,回车提交就没法用。
+ 多行批量本身也不成立:一个作者就要几十秒,一次粘五行等于把这个等待乘五,
+ 中途还看不出走到哪一行。所以字段收成单行 search input,回车原生提交。
+ """
+ page = self.page
+ form = page[page.index('<form class="faddform" id="followAdd">'):]
+ form = form[:form.index("</form>")]
+ self.assertIn('<input type="search" name="line" required', form)
+ self.assertNotIn("textarea", form)
+ self.assertNotIn('type="submit"', form)
+ # 忙态没有按钮可以变灰,就落在表单自己身上:前缀图标原位换 Spinner。
+ handler = page[page.index("if(form)form.onsubmit=async event=>{"):]
+ handler = handler[:handler.index("\n };")]
+ self.assertIn("form.dataset.busy='true';form.setAttribute('aria-busy','true')", handler)
+ self.assertIn("if(prefix)prefix.innerHTML=spinnerHtml('查找中')", handler)
+ self.assertIn("form.removeAttribute('aria-busy')", handler)
+ self.assertNotIn("setActionBusy", handler)
+ # 隐式提交在这个表单上不成立:来源筛选的复选框和输入框住在同一个 <form> 里,
+ # 浏览器只在「仅有一个文本字段」时才替你提交。回车必须自己接管。
+ self.assertPageContains("if(event.key!=='Enter'||event.isComposing)return;")
+ self.assertPageContains("event.preventDefault();form.requestSubmit();")
+ # 单行以后不再有拆行与自增高。
+ self.assertNotIn("box.style.height", page)
+ self.assertIn("const lines=[line];", handler)
+
def test_reader_management_is_locked_and_points_to_the_writer(self):
# 读请求带上表面的 signal(surfaceApi),切页时会被取消。
self.assertPageContains("surfaceApi(surface,'/healthz')")
self.assertPageContains("followRuntime?.ledger_read_only")
self.assertPageContains("前往写入端管理关注")
- self.assertPageContains("#followAdd textarea,#followAdd button")
+ self.assertPageContains("#followAdd input,#followAdd button")
def test_failed_source_adds_stay_visible_instead_of_being_erased_by_reload(self):
block = self.page[self.page.index("if(addButton)addButton.onclick=async()=>"):
@@ -1533,6 +1562,21 @@ class FollowWebSourceTests(unittest.TestCase):
self.assertPageContains("followAliasManager(followData.author_aliases,followData.alias_suggestions)")
self.assertPageContains("'/api/follow/author-alias'")
+ def test_a_multi_source_author_head_shows_only_favicons(self):
+ """图标已经说清是哪几个来源,再补一句「N 个来源」就要和它们抢同一行。
+
+ 窄卡片里那句话先把图标挤到贴脸,再把作者名压没。数量本来就能数出来,
+ 真要确认就读 title。
+ """
+ page = self.page
+ block = page[page.index('return `<div class="fauthor${bad?\' bad\':\'\'}">'):]
+ block = block[:block.index("${sources}")]
+ self.assertIn("? group.map(source=>sourceIcon(source.provider)).join('')", block)
+ self.assertNotIn("个来源`", block)
+ self.assertIn('title="${group.length} 个来源"', block)
+ rule = page[page.index(".fauthorhead .fmeta{"):]
+ self.assertIn("flex:0 1 auto;min-width:0", rule[:rule.index("}")])
+
def test_already_followed_candidates_are_shown_but_not_selectable(self):
# 灰掉但仍显示,免得人以为没查到。
self.assertPageContains("c.known?' known':''")
@@ -1542,18 +1586,16 @@ class FollowWebSourceTests(unittest.TestCase):
self.assertPageContains("首次按名字查要下载创作者索引,可能几十秒")
def test_the_input_and_its_button_are_the_same_height(self):
- # 静止时输入框就该和按钮齐平;固定多行的话按钮只有它一小截高。
+ # 输入框和旁边的来源筛选按钮齐平;单行以后没有 min-height 与 resize。
page = self.page
- self.assertEqual(page.count(".faddform textarea{"), 1,
+ self.assertEqual(page.count('.faddform input[type="search"]{'), 1,
"旧规则留在后面会覆盖新输入框样式")
- rule = page[page.index(".faddform textarea{"):]
+ rule = page[page.index('.faddform input[type="search"]{'):]
rule = rule[:rule.index("}")]
self.assertIn("height:38px", rule)
- self.assertIn("min-height:38px", rule)
- # 38px - 2px 边框 - 16px 内边距 = 20px 行高;textarea 会从内容区
- # 顶部排第一行,留下额外内容高度就会让文字视觉上偏上。
- self.assertIn("padding:8px 12px 8px 38px", rule)
+ self.assertIn("padding:0 12px 0 38px", rule)
self.assertIn("line-height:20px", rule)
+ self.assertNotIn("resize:", rule)
button = page[page.index("\n.fbtn{"):]
self.assertIn("height:32px", button[:button.index("}")])
# faddform 里的按钮随输入栏同高(Geist 输入 32px 基线之上的一档)。
@@ -1564,7 +1606,7 @@ class FollowWebSourceTests(unittest.TestCase):
# Vercel Projects:搜索占剩余宽度,筛选带明确标签,主操作在右;
# 菜单没有展开动画,并在自己的视口内滚动。
self.assertPageContains(
- ".faddform{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px")
+ ".faddform{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px")
self.assertPageContains(
".faddform .fsrcfilter .fbtn{width:auto;height:38px;min-height:38px;padding:0 11px}")
self.assertPageContains('aria-expanded="false" aria-haspopup="menu"')
@@ -1603,12 +1645,30 @@ class FollowWebSourceTests(unittest.TestCase):
self.assertNotIn("<h3>内容", body)
self.assertIn("条未看", body)
- def test_the_page_uses_two_columns_so_the_width_is_not_wasted(self):
+ def test_the_page_is_one_narrow_column_with_credentials_inline(self):
+ """侧栏在哪个宽度上都不对:宽屏把凭据推出视线,窄屏又整个塌到最底下。
+
+ 三块内容本来就有先后——先添加、再看列表、要配凭据时才往下翻——那就按顺序
+ 排成一列,宽度跟数据管理页同样收到 812px,别让一行横跨整个显示器。
+ """
page = self.page
rule = page[page.index(".followmanage{"):]
rule = rule[:rule.index("}")]
- self.assertIn("grid-template-columns:minmax(0,1fr)", rule)
- self.assertPageContains(".followmanage>.runtimegate{grid-column:1/-1")
+ self.assertIn("width:min(812px,100%)", rule)
+ self.assertIn("margin-left:auto;margin-right:auto", rule)
+ self.assertNotIn("grid-template-columns", rule)
+ self.assertNotIn("faside", page)
+ self.assertNotIn("@media (max-width:1080px){.followmanage{", page)
+ # 标题与说明跟内容列同宽,否则标题悬空在更宽的位置上。
+ self.assertPageContains(
+ ".follow-manage-layout .managetitle,.follow-manage-layout .pagelede{width:min(812px,100%)")
+ self.assertPageContains(
+ "document.body.classList.toggle('follow-manage-layout',"
+ "decodeURIComponent(location.pathname)==='/follow-manage')")
+ # 凭据现在是主列里的第三块,不再是 aside。
+ body = page[page.index("function renderFollowManage("):
+ page.index("function wireFollowManage(")]
+ self.assertLess(body.index("<h3>关注列表</h3>"), body.index("<h3>凭据</h3>"))
def test_sections_have_a_frame_but_their_rows_do_not(self):
"""反模式是卡片**套**卡片,不是「不要任何容器」。
@@ -1657,7 +1717,8 @@ class FollowWebSourceTests(unittest.TestCase):
def test_suggestions_come_from_the_real_library_and_are_clickable(self):
"""「猜你喜欢」取账本里真实存在的创作者,点一下直接拿去查。
- 不用 placeholder:占位文字点不了,还占着输入框的语义。
+ 推荐不能退化成 placeholder:占位文字点不了。占位文字只负责说清该输入什么
+ 格式(Vercel Forms:以省略号收尾、给出示例样式),不许塞进具体创作者名。
"""
self.assertPageContains("function followSuggestionChips(")
self.assertPageContains("followData.suggestions")
@@ -1673,7 +1734,11 @@ class FollowWebSourceTests(unittest.TestCase):
page = self.page
body = page[page.index("function renderFollowManage("):
page.index("function wireFollowItems(")]
- self.assertNotIn("placeholder=", body, "输入框不再放占位文字")
+ form = body[body.index('<form class="faddform"'):body.index("</form>")]
+ hint = form[form.index("placeholder="):form.index("aria-label=")]
+ self.assertIn("粘贴来源链接,或输入作者名、id…", hint)
+ self.assertNotIn("${", hint, "占位文字不许由数据拼出来——那就是把推荐塞进去了")
+ self.assertEqual(body.count("placeholder="), 1)
def test_every_credential_state_sits_in_the_same_column(self):
"""summary 是 .frow 的 flex 子项,默认不撑满整行——于是有折叠体的那几行
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 04a50c461..30aef70c2 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -2884,12 +2884,12 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains(".cleanup-skeleton>div{grid-template-columns:minmax(0,1fr);gap:16px}")
self.assertPageContains(".cleanup-skeleton .skeletoncard em{width:100%;height:var(--fieldset-bar-h)")
- def test_follow_manage_skeleton_matches_its_two_column_sections(self):
+ def test_follow_manage_skeleton_matches_its_single_column_sections(self):
"""关注管理的骨架是三个大区,不是六张 16:9 卡片。
六张卡的网格说的是 feed 那种一屏同质内容(关注更新流、回收站);关注管理
- 是「添加关注 + 关注列表 + 凭据」两栏三块,六张卡加载完整屏换掉,等于先给
- 了一个假的结构预告。块数因此要可配,并跟着 .followmanage 的断点塌成一列。
+ 是「添加关注 + 关注列表 + 凭据」一列三块,六张卡加载完整屏换掉,等于先给
+ 了一个假的结构预告。块数因此要可配,宽度也跟着 .followmanage 收到 812px。
"""
self.assertCode(
"'/follow-manage':()=>`<div class=\"follow\">${pageSkeletonHtml('正在读取关注管理',")
@@ -2900,13 +2900,13 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains(
"export function skeletonHtml(label='正在读取内容',{className='',variant='panel',count=6}={})")
self.assertPageContains("?Array.from({length:Math.max(1,count)},")
- # 版式:两栏对上 .followmanage 的 `minmax(0,1fr) 320px`,同一个断点塌成一列。
+ # 版式:一列对上 .followmanage,宽度也跟它一样是 812px 居中。
self.assertPageContains(
- ".followmanage-skeleton>div{grid-template-columns:minmax(0,1fr) 320px;gap:16px;align-items:start}")
- self.assertPageContains(".followmanage-skeleton .skeletoncard:nth-child(3){grid-area:1/2}")
- self.assertPageContains(
- "@media (max-width:1080px){.followmanage-skeleton>div{grid-template-columns:minmax(0,1fr)}")
- self.assertPageContains(".followmanage-skeleton .skeletoncard:nth-child(n){grid-area:auto}")
+ ".followmanage-skeleton>div{grid-template-columns:minmax(0,1fr);gap:16px;width:min(812px,100%)")
+ self.assertNotIn("grid-area", self.page[self.page.index(".followmanage-skeleton>div{"):
+ self.page.index(".followmanage-skeleton .skeletoncard em{")])
+ # 第一块是那一行输入,不是原来带按钮的两行。
+ self.assertPageContains(".followmanage-skeleton .skeletoncard:nth-child(1) b{height:38px}")
# 头部条是框体不是待填内容:跟 .fsechead 一样 56px,不参与呼吸。
self.assertPageContains(".followmanage-skeleton .skeletoncard i{aspect-ratio:auto;height:56px")
self.assertPageContains("border-bottom:1px solid var(--border-10);animation:none}")
diff --git a/web/app.css b/web/app.css
index da0561079..1bdf0f49d 100644
--- a/web/app.css
+++ b/web/app.css
@@ -580,21 +580,19 @@ body.photolight-open{overflow:hidden}
.cleanup-skeleton .skeletoncard b{width:26%;height:16px;margin:12px 20px 20px}
.cleanup-skeleton .skeletoncard em{width:100%;height:var(--fieldset-bar-h);margin:0;
border-radius:0;border-top:1px solid var(--border-10);background:var(--overlay-5);animation:none}
-/* 关注管理是「左栏两块 + 右栏凭据」的两栏行政界面:骨架照 .fsec 的轮廓画,
- 一块对一块、断点跟着 .followmanage 一起塌成一列。头部条是框体不是待填内容,
+/* 关注管理是一列三块(添加关注、关注列表、凭据)的行政界面:骨架照 .fsec 的轮廓画,
+ 一块对一块、宽度跟着 .followmanage 一起限到 812px。头部条是框体不是待填内容,
跟 .fsechead 同高同底色,不参与呼吸。 */
-.followmanage-skeleton>div{grid-template-columns:minmax(0,1fr) 320px;gap:16px;align-items:start}
+.followmanage-skeleton>div{grid-template-columns:minmax(0,1fr);gap:16px;width:min(812px,100%);
+ margin-left:auto;margin-right:auto;align-items:start}
.followmanage-skeleton .skeletoncard{gap:0;overflow:hidden;border:1px solid var(--border-10);
border-radius:var(--surface-radius);background:var(--surface)}
.followmanage-skeleton .skeletoncard i{aspect-ratio:auto;height:56px;border-radius:0;
background:var(--overlay-5);border-bottom:1px solid var(--border-10);animation:none}
.followmanage-skeleton .skeletoncard b{width:auto;margin:16px 16px 0}
.followmanage-skeleton .skeletoncard em{width:42%;height:14px;margin:12px 16px 16px}
-.followmanage-skeleton .skeletoncard:nth-child(1){grid-area:1/1}
-.followmanage-skeleton .skeletoncard:nth-child(1) b{height:76px}
-.followmanage-skeleton .skeletoncard:nth-child(2){grid-area:2/1}
+.followmanage-skeleton .skeletoncard:nth-child(1) b{height:38px}
.followmanage-skeleton .skeletoncard:nth-child(2) b{height:300px}
-.followmanage-skeleton .skeletoncard:nth-child(3){grid-area:1/2}
.followmanage-skeleton .skeletoncard:nth-child(3) b{height:180px}
/* 塌成一列时要压掉上面那三条显式定位,特异性必须与它们持平,所以仍写 nth-child。 */
@media (max-width:1080px){.followmanage-skeleton>div{grid-template-columns:minmax(0,1fr)}
@@ -801,7 +799,8 @@ main{position:relative;z-index:1;padding:14px 16px 90px}
.managebar button[aria-pressed="true"]{background:var(--hover);color:var(--ink)}
.managebar{margin-left:auto;margin-right:auto}
.insight-layout .managetitle,.insight-layout .pagelede{width:min(1100px,100%);margin-left:auto;margin-right:auto}
-.cleanup-layout .geist-breadcrumb,.cleanup-layout .managetitle,.cleanup-layout .pagelede{width:min(812px,100%);margin-left:auto;margin-right:auto}
+.cleanup-layout .geist-breadcrumb,.cleanup-layout .managetitle,.cleanup-layout .pagelede,
+.follow-manage-layout .managetitle,.follow-manage-layout .pagelede{width:min(812px,100%);margin-left:auto;margin-right:auto}
/* Geist Breadcrumbs(vercel.com/geist/breadcrumbs 实测):nav > ol > li,
上一级与分隔符 --muted、当前页 --ink 且带 aria-current,hover 同样升亮;
分隔符是 16px chevron、钉在 --muted 上不随当前项提亮,最后一项隐藏;
@@ -2078,11 +2077,10 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位
1px `rgb(41,41,41)` 发丝边 + `rgb(10,10,10)` 比页面亮一档的表面,没有阴影。
所以容器要有框;不要的是**框里再套框**——卡片内部的行只用分隔线。
控件仍按实测 Geist:32px 高、14px 字、6px 圆角。 */
-.followmanage{padding:2px 0 48px;display:grid;grid-template-columns:minmax(0,1fr) 320px;
- gap:16px;align-items:start;font-size:var(--fs-md)}
-.followmanage>.runtimegate{grid-column:1/-1;margin-bottom:0}
+.followmanage{padding:2px 0 48px;display:grid;gap:16px;width:min(812px,100%);
+ margin-left:auto;margin-right:auto;align-items:start;font-size:var(--fs-md)}
+.followmanage>.runtimegate{margin-bottom:0}
.fmain{display:grid;gap:16px;min-width:0}
-.faside{display:grid;gap:16px;min-width:0}
/* 容器:发丝边 + 比页面亮一档的表面。内部的行不再各自套框。 */
.fsec{min-width:0;border:1px solid var(--border-10);border-radius:var(--surface-radius);
background:var(--surface);padding:14px 16px 16px}
@@ -2201,18 +2199,21 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位
.fbtn.fquiet:hover{border-color:var(--drop);color:var(--drop)}
.fbtn svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:1.8}
-.faddform{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px;align-items:start}
+.faddform{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:start}
.fsearchinput{position:relative;min-width:0}.fsearchprefix{position:absolute;z-index:1;left:12px;top:11px;
display:grid;place-items:center;width:16px;height:16px;color:var(--muted);pointer-events:none}
.fsearchprefix>svg{width:16px;height:16px;stroke:currentColor;fill:none}
-.faddform textarea{width:100%;flex:1 1 auto;min-width:0;height:38px;min-height:38px;max-height:220px;
+.faddform input[type="search"]{width:100%;min-width:0;height:38px;
box-sizing:border-box;border:1px solid var(--border-15);border-radius:var(--control-radius);
- background:var(--ground);color:var(--ink);padding:8px 12px 8px 38px;font-size:var(--fs-md);font-family:inherit;
- line-height:20px;resize:none;overflow-y:auto;overflow-x:hidden;transition:border-color .12s ease}
+ background:var(--ground);color:var(--ink);padding:0 12px 0 38px;font-size:var(--fs-md);font-family:inherit;
+ line-height:20px;transition:border-color .12s ease}
+.faddform input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none;appearance:none}
.faddform .fbtn{height:38px;min-height:38px}
-.faddform textarea::placeholder{color:var(--muted)}
-.faddform textarea:focus-visible{outline:2px solid var(--tungsten);outline-offset:1px;
+.faddform input[type="search"]::placeholder{color:var(--muted)}
+.faddform input[type="search"]:focus-visible{outline:2px solid var(--tungsten);outline-offset:1px;
border-color:var(--tungsten)}
+/* 没有按钮可以变灰,查找中的唯一凭据就是前缀位上的 Spinner——输入框自己必须还能改。 */
+.faddform[aria-busy="true"] input[type="search"]{color:var(--muted)}
/* 卡片内部的行:只用分隔线,不套框——框里再套框正是要避开的那条。 */
/* grid 项默认 min-width:auto,最宽的一行会把整列撑出容器——窄的那一栏尤其明显。
@@ -2243,7 +2244,7 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位
.fauthorhead{display:flex;align-items:center;gap:9px;padding:10px 0 6px}
.fauthorhead b{font-size:var(--fs-md);min-width:0;overflow:hidden;
text-overflow:ellipsis;white-space:nowrap}
-.fauthorhead .fmeta{margin-left:auto;flex:none}
+.fauthorhead .fmeta{margin-left:auto;flex:0 1 auto;min-width:0;white-space:nowrap}
.fauthorhead .fmeta.warn{margin-left:0}
.fauthorsources{min-height:0}
.fauthorsources .geist-scroller-container{padding-right:12px;scrollbar-width:thin}
@@ -2355,7 +2356,6 @@ details.fcred{display:block}
.fcredactions button.fquiet:hover{border-color:var(--drop);color:var(--drop)}
.fcredactions [data-cred-state]{font-size:var(--fs-xs);color:var(--muted)}
-@media (max-width:1080px){.followmanage{grid-template-columns:minmax(0,1fr)}}
@media (max-width:640px){
.fsec{padding:12px 13px 14px}
.fsechead{margin:-12px -13px 12px;padding:12px 13px}
@@ -2363,9 +2363,8 @@ details.fcred{display:block}
.faliasmanager{margin-left:-13px;margin-right:-13px;margin-bottom:-14px}
.faliasmanager>summary{padding:2px 13px}
.faliasmanager .fcollapsebody{padding:4px 13px 14px}
- .faddform{grid-template-columns:minmax(0,1fr) auto}
.faddform>.fsearchinput{grid-column:1/-1}
- .faddform>.fbtn.primary{width:100%}
+ .faddform>.fsrcfilter{justify-self:start}
.frow{gap:8px}
.fsources{grid-template-columns:1fr}
.frow .fmeta:nth-of-type(2){display:none}
diff --git a/web/app.js b/web/app.js
index 312c4b641..092c910f5 100644
--- a/web/app.js
+++ b/web/app.js
@@ -3882,8 +3882,8 @@ function followAuthorBlock(group){
return `<div class="fauthor${bad?' bad':''}">
<div class="fauthorhead">${followAuthorAvatar(group)}
<b>${esc(name)}</b>
- <span class="fmeta">${group.length>1
- ? group.map(source=>sourceIcon(source.provider)).join('')+`${group.length} 个来源`
+ <span class="fmeta"${group.length>1?` title="${group.length} 个来源"`:''}>${group.length>1
+ ? group.map(source=>sourceIcon(source.provider)).join('')
: sourceIcon(group[0].provider)+esc(group[0].provider_label)}</span>
${bad?`<span class="fmeta warn">${bad} 个失败</span>`:''}
</div>
@@ -4014,10 +4014,10 @@ function renderFollowManage(credentials){
<form class="faddform" id="followAdd">
<div class="fsearchinput" data-follow-search-input>
<span class="fsearchprefix" data-follow-search-prefix>${icon('search')}</span>
- <textarea name="lines" rows="1" required spellcheck="false"
- aria-label="来源链接、名字或 id"></textarea></div>
+ <input type="search" name="line" required spellcheck="false" autocomplete="off"
+ placeholder="粘贴来源链接,或输入作者名、id…"
+ aria-label="来源链接、名字或 id"></div>
<div class="fsrcfilter" id="followSrcFilter"></div>
- <button class="fbtn primary" type="submit">查找</button>
</form>
<p class="fnote" data-follow-add-state aria-live="polite"></p>
<div id="followPicks"></div>
@@ -4049,8 +4049,6 @@ function renderFollowManage(credentials){
<button class="fbtn" data-follow-bulk="ignored">全部忽略</button></span></p></div>`:''}`
:emptyState('rss','还没有关注来源','关注来源及其检查状态会显示在这里。',{className:'compact'})}
</section>
- </div>
- <aside class="faside">
<section class="fsec">
<div class="fsechead"><h3>凭据</h3>
${needCred.length?`<span class="fmeta warn">${needCred.length} 个待配置</span>`:''}</div>
@@ -4061,10 +4059,10 @@ function renderFollowManage(credentials){
<span>Windows 上不收紧文件权限</span>
<span class="fdescpop" id="follow-credential-tooltip" role="tooltip" hidden>存放在<b>运行 Peach 的那台机器</b>上,不是浏览器所在机器;不进 Git、URL、日志或 ledger。NTFS 的访问控制走 ACL,<code>chmod</code> 在那里没有效果;POSIX 上建成 0600。</span></p>
</section>
- </aside></div>`;
+ </div></div>`;
wireFollowManage();
if(locked)$('#stats').querySelectorAll(
- '#followAdd textarea,#followAdd button,[data-follow-remove],[data-follow-check],'+
+ '#followAdd input,#followAdd button,[data-follow-remove],[data-follow-check],'+
'[data-follow-enabled],'+
'[data-follow-bulk],[data-follow-guess],[data-follow-alias-add],'+
'[data-follow-alias-remove],#followAliasAdd input,#followAliasAdd button,[data-cred-form] input,'+
@@ -4205,39 +4203,38 @@ function wireFollowManage(){
}
});
});
- const box=form&&form.querySelector('textarea');
- /* 常见情况是粘一条,多行是例外——所以静止时就一行高,和按钮齐平;
- 真粘了多行才往下长。原来固定三行,按钮只有它 1/3 高,看着就是没对齐。 */
- if(box){
- const grow=()=>{box.style.height='auto';
- box.style.height=Math.min(box.scrollHeight,240)+'px'};
- box.addEventListener('input',grow);
- box.addEventListener('paste',()=>setTimeout(grow,0));
- grow();
- }
+ const box=form&&form.querySelector('input[name="line"]');
+ /* 回车自己接管,不靠隐式提交:没有提交按钮时浏览器只在「表单里仅有一个文本字段」
+ 才替你提交,而来源筛选的那串复选框就住在同一个 <form> 里。实测按下去什么也不发生。
+ isComposing 是给中文输入法的——选字那一下的回车不是提交。 */
+ if(box)box.addEventListener('keydown',event=>{
+ if(event.key!=='Enter'||event.isComposing)return;
+ event.preventDefault();form.requestSubmit();
+ });
if(form)form.onsubmit=async event=>{
event.preventDefault();
if(form.dataset.busy==='true')return;
/* 状态提示在表单外面的说明行里,不能在 form 里找——找不到就是 null,
第一次赋值直接抛 TypeError,整个提交静默失败。 */
const state=root.querySelector('[data-follow-add-state]');
- const button=form.querySelector('button[type="submit"]');
const prefix=form.querySelector('[data-follow-search-prefix]');
- const lines=String(new FormData(form).get('lines')||'').split('\n')
- .map(line=>line.trim()).filter(Boolean);
- if(!lines.length)return;
- const byName=lines.some(line=>!line.includes('/'));
- form.dataset.busy='true';setActionBusy(button);
+ const line=String(new FormData(form).get('line')||'').trim();
+ if(!line)return;
+ const lines=[line];
+ const byName=!line.includes('/');
+ /* 没有提交按钮可以变灰,忙态就落在输入框自己身上:前缀图标原位换 Spinner,
+ aria-busy 播报给辅助技术,重复回车由 dataset.busy 挡住。 */
+ form.dataset.busy='true';form.setAttribute('aria-busy','true');
if(prefix)prefix.innerHTML=spinnerHtml('查找中');
// 索引下载的提醒只在真按名字查时出现;常驻成一句说明就是噪音。
state.textContent=byName?'查找中…(首次按名字查要下载创作者索引,可能几十秒)':'识别中…';
try{
const result=await api('/api/follow/resolve',{method:'POST',
body:JSON.stringify({lines})});
- state.textContent='';if(box){box.value='';box.style.height='auto'}
+ state.textContent='';if(box)box.value='';
renderFollowPicks(result.results||[]);
}catch(error){state.textContent=error.message||'查找失败'}
- finally{form.dataset.busy='false';setActionBusy(button,false);
+ finally{form.dataset.busy='false';form.removeAttribute('aria-busy');
if(prefix)prefix.innerHTML=icon('search')}
};
root.querySelectorAll('[data-follow-remove]').forEach(button=>button.onclick=async()=>{
@@ -5467,6 +5464,7 @@ function paintManageTitle(){
/* 812px 居中是数据管理 hub 自己的窄列宽度(.cleanuppage)。它下面的垃圾文件、
重复文件正文都是全宽网格,跟着居中就是标题在宽屏上凭空左缩一截、跟内容对不齐。 */
document.body.classList.toggle('cleanup-layout',current==='cleanup'&&decodeURIComponent(location.pathname)==='/data-cleanup');
+ document.body.classList.toggle('follow-manage-layout',decodeURIComponent(location.pathname)==='/follow-manage');
const entry=MANAGE_SECTIONS.find(([k])=>k===current);
el.hidden=!entry;
// 数据管理之下按路径再分一层(MANAGE_CRUMB_PAGES):垃圾文件/重复文件的