Peach: Local-first video metadata scraper and media manager.
feat(web): 换统称前先过 Geist 确认弹层,写入失败留在原位
longmeidaod0f2b6794593
diff --git a/.claude/skills/peach-web-ui/SKILL.md b/.claude/skills/peach-web-ui/SKILL.mdindex b81c9a0ea..d958b6a6e 100644--- a/.claude/skills/peach-web-ui/SKILL.md+++ b/.claude/skills/peach-web-ui/SKILL.md@@ -21,7 +21,7 @@ description: 在新增、修改或复核 Peach 页面、控件、提示、错误| 字段、卡片、分区旁的持久反馈 | Note | Toast、空状态 || 页面/系统级问题与恢复动作 | Banner | Note || 短暂操作回执 | Toast | 持久 Note |-| 销毁确认 | Modal/现有 confirm | Toast |+| 写操作前的确认 | `confirmModal()` | 原生 `confirm()`、Toast || 已知总量的进行状态 | Progress | 装饰性蓝条 || 用户触发动作等待结果 | Spinner | 旋转原操作图标、Loading Dots || 后台任务仍在推进 | Loading Dots | Spinner、假百分比 |@@ -51,6 +51,10 @@ description: 在新增、修改或复核 Peach 页面、控件、提示、错误- 菜单每项包含与入口相同的图标和文字,菜单内部滚动、`overscroll-behavior:contain`,不得把浏览器页面撑出滚动条。锚定菜单一律走 `wireAnchoredMenu`:高度压到触发钮那一侧真正剩下的空间(上沿是 `--topH` 顶栏下缘),装不下就在菜单内滚,不横跨触发钮;页面滚动关掉菜单,菜单自身的滚动不关。- 只读查询(搜索、筛选)不配提交按钮:回车即执行,忙态落在表单自己身上(`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。+- 确认弹层一律走 `confirmModal()`:原生 `<dialog>` 承载,标题是陈述句,正文先说后果并点名+ 涉及的两个值,主按钮是与标题同一动词的「动词+名词」,取消键就写「取消」,成功 Toast 与主+ 按钮的动词一一对应。写入交给 `onConfirm`,忙态落在主按钮上,失败时弹层不关、原因留在正文+ 下方等重试。形状与文案判据见 `docs/reference-snapshots/vercel-geist-modal-measured.md`。- 用户写操作只在服务端终态成功后调用共享 `actionReceipt()` 发一条过去时 Toast;可由安全逆操作完整恢复的状态提供 8 秒“撤销”,永久删除、凭据、保存到账本等不伪造撤销。仅打开面板/菜单/Dialog 不算操作完成,不发 Toast;失败除短 Toast 外仍在原位置保留原因与重试入口。- 同一次页面进入只呈现一段等待态;深链启动与页面取数复用同一个 Skeleton,禁止 Spinner 再切换成 Loading Dots 或 Skeleton。- Skeleton 只覆盖真正等待的内容区;静态标题、导航和能同步得到的筛选控件立即显示。骨架必须复用最终容器的宽度、列数与对齐方式:卡片网格横向铺满,居中面板仍居中,不得用一列通用占位替代不同页面结构。diff --git a/docs/HANDOFF.md b/docs/HANDOFF.mdindex 90fc0d87e..6408a3757 100644--- a/docs/HANDOFF.md+++ b/docs/HANDOFF.md@@ -80,7 +80,7 @@ React 渲染的规格页、用户截图这类给不出可重抓字节的实测- 统计与口味两页的层级,Note/Progress/Switch/Fieldset/Scroller/Empty State 的语义,按钮的尺寸档与三态:`vercel-geist-semantics-measured`、`vercel-geist-note-progress-switch-analytics`、`vercel-geist-fieldset-scroller-empty-state`。- 分类切换条属于 Tabs 的 secondary 变体而不是分段器:`vercel-geist-tabs-secondary-measured`。- 表格、排行与面包屑:`vercel-geist-table-ranking`、`vercel-geist-breadcrumbs`;同形可比较数据才用语义 `table` 并保持 tabular numerals,内容标签是固定 Top 排行和直接筛选,不伪装成可排序数据表。-- 设置 Dialog 动效、搜索期 Spinner、后台 Loading Dots 与 busy 按钮:`vercel-geist-command-search-loading`;中性说明 Note:`vercel-notifications-note`;具名动作 Toast:`vercel-geist-toast`。用户直接触发的动作用 Spinner,后台扫描用 Loading Dots,等待按钮经共享 busy 状态变灰但不用原生 `disabled`。+- 设置 Dialog 动效、搜索期 Spinner、后台 Loading Dots 与 busy 按钮:`vercel-geist-command-search-loading`;中性说明 Note:`vercel-notifications-note`;具名动作 Toast:`vercel-geist-toast`;写操作前的确认弹层:`vercel-geist-modal-measured`。- 资料页阅读顺序与照片入口:`beeg-profile-layout`;JAV 标题显示语义:`jav-title-user-screenshot`;卡片悬停的快退/快进控件:`hover-seek-controls-user-screenshot`(beeg 现网没有这个控件,只依据用户截图)。- 播放器控制栏、设置浮层、影院与全屏几何:`youtube-player-controls-user-screenshot`;沉浸页版式:`youtube-shorts-immersive-user-screenshot`;播放统计滚动历史:`youtube-stats-buffer-measured`。Peach 不复制没有实际能力的字幕、睡眠定时或自动播放按钮。- 追更与文件站的凭据与解析边界:`f95-masked-gofile-media`、`follow-fanbox-gofile-paheal`、`fanbox-browser-transport`、`rule34-follow-tags-and-collections`;厂牌 Logo 候选发现:`fiu758-studio-logo-discovery`,只作发现来源不作真相源。diff --git a/docs/reference-snapshots/vercel-geist-modal-measured.md b/docs/reference-snapshots/vercel-geist-modal-measured.mdnew file mode 100644index 000000000..e4ca324a0--- /dev/null+++ b/docs/reference-snapshots/vercel-geist-modal-measured.md@@ -0,0 +1,59 @@+# Geist Modal 实测记录++- 取证日期:2026-09-04+- URL:<https://vercel.com/geist/modal>+- 取证方式:在浏览器里打开 Default 示例的 Modal,对 `[data-geist-modal]` 及其子节点读+ `getComputedStyle`,不是读源码或截图量取+- **不在 `docs/reference-sources.json` 里登记**:那张表的契约是「每个来源都有可哈希的+ 上游快照」,这里记的是渲染结果,随上游发布变化且没有可锁定的文件哈希。要复核就按上面+ 的方式重测一次。++## 实测值++| 项 | 值 |+| --- | --- |+| 容器角色 | `role="dialog"`、`aria-modal="true"`、`aria-labelledby` 指向标题 |+| 容器宽 | 540 px,`max-[540px]:max-w-[calc(100vw-20px)]` |+| 容器圆角 | 12 px |+| 容器最大高 | `min(800px, 80vh)` |+| 容器阴影 | `0 0 0 1px rgba(255,255,255,.14)` 加三层 `rgba(0,0,0,.06/.08/.12)` 的下投影 |+| 正文内边距 | 20 px |+| 正文字号/行高 | 14 px/20 px,色 `--ds-gray-900` |+| 标题元素 | `h3`,20 px/26 px,字重 600,左对齐 |+| 副标题 | 14 px/20 px,外边距 `8px 0 4px` |+| 操作条 | `sticky bottom-0`、内边距 12 px、`display:flex`、`justify-content:space-between`,两侧各是一个 `display:flex;gap:16px` 的分组 |+| 操作条高 | 约 54 px |+| 按钮高/圆角/字 | 30.7 px(Geist small 档 32 px)/6 px/14 px 500 字重 |+| 取消键 | 透明底加 `0 0 0 1px rgb(46,46,46)` 一圈线 |+| 主按钮 | `rgb(237,237,237)` 实底、`rgb(10,10,10)` 字 |+| 遮罩 | `.geist-overlay-backdrop`,纯黑 `rgb(0,0,0)`,**没有** blur |+| 出入场 | 透明度与 transform 都过渡 `.3s cubic-bezier(.175,.885,.32,1.1)`;transform 的起始值**未取得** |++## 文案判据(页面 Best Practices 一节)++- 标题是 Title Case 的**陈述句**,绝不写成问句。+- 正文 1~3 句,先说后果。+- 主按钮是「动词 + 名词」,动词与标题里那个一致;不写 Confirm、OK 或光秃秃一个动词。+- 取消键的字面就是 Cancel,不换花样。+- 销毁类弹层默认焦点落在取消键上,回车不得触发销毁动作;可撤销的弹层允许 Escape 和点+ 遮罩关掉。+- 打开时锁焦点在弹层内,关掉后把焦点还给触发钮。+- 成功后的 Toast 与主按钮的动词一一对应(`Delete Project` → `Project deleted`)。++## Peach 复用了什么++`web/js/ui-components.js` 的 `confirmModal()` 与 `web/css/01-base.css` 的 `.geist-modal`+据此实现:540 px 宽、窄屏两侧各留 10 px、12 px 圆角、正文 20 px 内边距、标题 20 px/26 px+的 600 字重 `h3`、操作条粘底两端对齐、遮罩纯黑不带模糊、淡入用实测的时长与缓动。文案按上面+那一节写:资料页换统称的弹层标题是「更改统称」,主按钮同为「更改统称」,成功 Toast 是+「已把统称更改为 X」,取消键就写「取消」。++## Peach 有意不同的地方++| 项 | Peach | 原因 |+| --- | --- | --- |+| 承载元素 | 原生 `<dialog>` + `showModal()` | 焦点陷阱、Escape、背景 inert 和归还焦点都由浏览器给;Geist 那套 div 覆盖层要自己补齐这四样 |+| 按钮高 | 32 px(`--control-h` 档) | 全站控件已统一在这一档,见 `vercel-geist-controls-measured.md` |+| 手机上的按钮 | `min-height:44px` | 本项目的触控命中区门槛,Geist 未区分 |+| 出入场的 transform | 只做透明度 | 起始值未取得,不拿猜的值当复刻 |+| 阴影颜色 | `--border-15` 一圈线加 `#0009` 投影 | 暗色底下 Geist 的 `rgba(0,0,0,.06)` 几乎看不见,改用本项目已有的浮层阴影配方 |diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 7045821d3..9c10b69e8 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -3924,12 +3924,75 @@ class WebUiSourceTests(unittest.TestCase):self.assertCode("const rename=(from,to)=>api('/api/entity-name',")self.assertCode("{method:'POST',body:JSON.stringify({kind,name:from,canonical:to})});")- self.assertPageContains("setActionBusy(item);")- self.assertCode("const result=await rename(current,chosen);")- self.assertCode("if(!result.changed)return;")+ self.assertCode("onConfirm:()=>rename(current,chosen)});")+ self.assertCode("if(!confirmed||!result?.changed)return;")# 撤销是一次真实写回,不在本地把标题改回去。self.assertCode("await rename(result.canonical_name,result.previous_name);")- self.assertPageContains("actionFailure('修改统称',error)")++ def test_entity_name_picker_confirms_and_names_both_writings_first(self):+ # 换统称会重写整条实体的扁平投影,写之前必须让用户看见换成什么、旧写法去哪。+ self.assertCode("const {confirmed,result}=await confirmModal({")+ self.assertCode("title:'更改统称',")+ self.assertCode(+ "body:`「${chosen}」将成为这条实体的规范名,「${current}」留作别名。`")+ self.assertCode("+'作品上的署名、搜索和标签都会跟着改写。',")+ # Geist 的判据:主按钮是与标题同一个动词的「动词+名词」,成功回执共用那个动词。+ self.assertCode("confirmLabel:'更改统称',")+ self.assertCode("actionReceipt(`已把统称更改为 ${result.canonical_name}`,{undo:async()=>{")+ # 弹层顶上来之前先把菜单收掉,否则它固定在视口里会浮在遮罩上。+ self.assertCode("anchored.setOpen(false);")++ def test_confirm_modal_is_one_shared_component_on_a_native_dialog(self):+ # 焦点陷阱、Escape、背景 inert 和关掉后归还焦点都由原生 <dialog> 给。+ self.assertCode("export function confirmModal({title,body,confirmLabel,")+ self.assertPageContains("dialog.showModal();")+ self.assertPageContains('dialog.className=\'geist-modal\';')+ self.assertPageContains("dialog.setAttribute('aria-labelledby',titleId);")+ # 标题与正文是数据,走 textContent,不进 innerHTML。+ self.assertPageContains("dialog.querySelector('h3').textContent=title;")+ self.assertPageContains(+ "dialog.querySelector('.geist-modal-body p').textContent=body;")+ # 遮罩上的点击落在 <dialog> 自己身上;这个动作可撤销,允许点外面关掉。+ self.assertCode(+ "dialog.addEventListener('click',event=>{if(event.target===dialog)dialog.close()});")++ def test_confirm_modal_keeps_a_failed_write_in_place_with_its_reason(self):+ # 忙态落在主按钮上,不落在已经收起来的菜单项上。+ self.assertPageContains("setActionBusy(accept);")+ self.assertCode("settled={confirmed:true,result:await onConfirm()};")+ self.assertCode(+ "failure.innerHTML=noteHtml(error.message||'操作未完成',{variant:'error'});")+ self.assertPageContains("setActionBusy(accept,false);")+ # 取消、Escape 和点遮罩都走同一条出口,一律回 confirmed:false。+ self.assertCode("resolve(settled||{confirmed:false});")++ def test_confirm_modal_matches_the_measured_geist_modal(self):+ # 实测 https://vercel.com/geist/modal(2026-09-04),见+ # docs/reference-snapshots/vercel-geist-modal-measured.md。+ self.assertPageContains(+ ".geist-modal{box-sizing:border-box;width:min(540px,calc(100vw - 20px));"+ "max-height:min(800px,80vh);")+ self.assertPageContains("border-radius:var(--floating-radius);")+ # 遮罩纯黑不带模糊:Geist 的 backdrop 没有 blur。+ self.assertPageContains(".geist-modal::backdrop{background:#0009;opacity:0;")+ self.assertPageLacks(".geist-modal::backdrop{background:#000a;backdrop-filter")+ self.assertPageContains(+ ".geist-modal-body{padding:20px;font-size:var(--fs-md);line-height:20px;")+ self.assertPageContains(+ ".geist-modal-body h3{margin:0;font-size:var(--fs-xl);line-height:26px;"+ "font-weight:600;color:var(--ink)}")+ # 操作条粘在底、两端对齐;取消在左,主动作在右。+ self.assertPageContains(+ ".geist-modal-footer{position:sticky;bottom:0;display:flex;"+ "justify-content:space-between;gap:16px;")+ self.assertPageContains(".geist-modal-footer>div{display:flex;gap:16px}")+ # 两个键都走全站唯一那份 Geist Button,不另起一套尺寸。+ self.assertCode('<div><button type="button" class="geist-button" data-modal-cancel>')+ self.assertCode(+ '<div><button type="button" class="geist-button primary" data-modal-confirm>')+ # 手机上按本项目的 44px 命中区放大。+ self.assertPageContains(+ ".geist-modal-footer .geist-button{min-height:44px;padding:0 14px}")def test_entity_name_picker_marks_the_current_name_with_fill_and_a_check(self):self.assertPageContains(diff --git a/web/app.js b/web/app.jsindex 4550c76b3..3ccc93b77 100644--- a/web/app.js+++ b/web/app.js@@ -5,7 +5,7 @@ import { matchRoute, routeLabel } from './js/routes.js';import { initMiddleTruncate } from './js/middle-truncate.js';import { tagLabel } from './js/tags.js';import {- breadcrumbHtml, checkboxHtml, closeAnchoredMenu, emptyStateHtml, fieldsetTitle,+ breadcrumbHtml, checkboxHtml, closeAnchoredMenu, confirmModal, emptyStateHtml, fieldsetTitle,fillSkeletonTier, fitSkeleton, iconSwitchHtml, loadingDotsHtml,mediaViewButtonsHtml, noteHtml, progressHtml, scrollerHtml, searchInputHtml, setActionBusy,skeletonHtml, spinnerHtml, wireAnchoredMenu, wireBusyActions, wireCollapse, wireIconSwitch,@@ -5724,17 +5724,21 @@ function wireNamePicker(kind,current){{method:'POST',body:JSON.stringify({kind,name:from,canonical:to})});menu.querySelectorAll('[data-namepick-name]').forEach(item=>item.onclick=async()=>{const chosen=item.dataset.namepickName;- if(chosen===current){anchored.setOpen(false);return}- setActionBusy(item);- try{- const result=await rename(current,chosen);- anchored.setOpen(false);- if(!result.changed)return;- actionReceipt(`已把统称改为 ${result.canonical_name}`,{undo:async()=>{- await rename(result.canonical_name,result.previous_name);- await openEntity(kind,result.previous_name)}});- await openEntity(kind,result.canonical_name);- }catch(error){actionFailure('修改统称',error);setActionBusy(item,false)}+ anchored.setOpen(false);+ if(chosen===current)return;+ /* 换统称要重写整条实体的扁平投影,先把代价说清再问。确认键、标题和成功回执共用+ 「更改统称」这一个动词;写入失败时弹层留在原地,原因写在正文下方等重试。 */+ const {confirmed,result}=await confirmModal({+ title:'更改统称',+ body:`「${chosen}」将成为这条实体的规范名,「${current}」留作别名。`+ +'作品上的署名、搜索和标签都会跟着改写。',+ confirmLabel:'更改统称',+ onConfirm:()=>rename(current,chosen)});+ if(!confirmed||!result?.changed)return;+ actionReceipt(`已把统称更改为 ${result.canonical_name}`,{undo:async()=>{+ await rename(result.canonical_name,result.previous_name);+ await openEntity(kind,result.previous_name)}});+ await openEntity(kind,result.canonical_name);});}diff --git a/web/css/01-base.css b/web/css/01-base.cssindex dc32a2306..48ac6bfeb 100644--- a/web/css/01-base.css+++ b/web/css/01-base.css@@ -181,3 +181,26 @@ button[aria-busy="true"],[role="button"][aria-busy="true"]{background:var(--surface);box-shadow:0 12px 40px #0006;display:grid;gap:2px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain}.popmenu[hidden]{display:none}++/* Geist Modal:确认一次写操作。实测 https://vercel.com/geist/modal(2026-09-04):+ 540px 宽、12px 圆角、窄屏两侧各留 10px,正文 20px 内边距,操作条粘在底、12px 内边距、+ 两端对齐,遮罩纯黑不带模糊。淡入用它给出的 .3s cubic-bezier(.175,.885,.32,1.1);+ 它同时过渡 transform,起始值未取得,所以这里只做透明度。 */+.geist-modal{box-sizing:border-box;width:min(540px,calc(100vw - 20px));max-height:min(800px,80vh);+ padding:0;border:0;border-radius:var(--floating-radius);+ background:var(--surface);color:var(--ink);overflow:hidden auto;overscroll-behavior:contain;+ box-shadow:0 0 0 1px var(--border-15),0 32px 72px -12px #0009,0 8px 32px -12px #0009;+ opacity:0;transition:opacity .3s cubic-bezier(.175,.885,.32,1.1),+ overlay .3s allow-discrete,display .3s allow-discrete}+.geist-modal::backdrop{background:#0009;opacity:0;+ transition:opacity .3s cubic-bezier(.175,.885,.32,1.1),+ overlay .3s allow-discrete,display .3s allow-discrete}+.geist-modal[open],.geist-modal[open]::backdrop{opacity:1}+@starting-style{.geist-modal[open],.geist-modal[open]::backdrop{opacity:0}}+.geist-modal-body{padding:20px;font-size:var(--fs-md);line-height:20px;color:var(--ink-2)}+.geist-modal-body h3{margin:0;font-size:var(--fs-xl);line-height:26px;font-weight:600;color:var(--ink)}+.geist-modal-body p{margin:8px 0 0;line-height:20px;overflow-wrap:anywhere}+.geist-modal-body [data-modal-error]:not(:empty){margin-top:12px}+.geist-modal-footer{position:sticky;bottom:0;display:flex;justify-content:space-between;gap:16px;+ padding:12px;background:var(--surface)}+.geist-modal-footer>div{display:flex;gap:16px}diff --git a/web/css/19-immersive.css b/web/css/19-immersive.cssindex 665c5d9a2..c13ed6676 100644--- a/web/css/19-immersive.css+++ b/web/css/19-immersive.css@@ -97,6 +97,8 @@@media (max-width:760px){.readout{display:none} .brand .sub{display:none}:root{--tile:168px;--topH:52px;--sortH:60px}+ /* 确认弹层的两个键是本项目 44px 命中区的对象,桌面的 32px 是 Geist 控件高度。 */+ .geist-modal-footer .geist-button{min-height:44px;padding:0 14px}/* 管理入口在手机上先收成一行,按需展开为两列。当前页仍有明确上下文,但不会让八个入口挤成三四行、把正文推到屏幕下方。 */.managebar{display:block;width:100%;margin-bottom:14px;padding:0;border:0;background:transparent}diff --git a/web/js/ui-components.js b/web/js/ui-components.jsindex 3aa94192a..193c26cfd 100644--- a/web/js/ui-components.js+++ b/web/js/ui-components.js@@ -383,3 +383,62 @@ export function wireAnchoredMenu(mount,toggle,menu){if(event.key==='Escape'&&!menu.hidden){setOpen(false);toggle.focus()}});return {setOpen,isOpen:()=>!menu.hidden};}++/* Geist Modal:一次写操作落库前的确认。++ 实测 https://vercel.com/geist/modal(2026-09-04):卡片 540px 宽、12px 圆角、窄屏两侧+ 各留 10px,正文 20px 内边距、14px/20px,标题是 20px/26px 的 600 字重 h3,底部操作条+ 12px 内边距、粘在底、两端对齐,按钮 32px 高、6px 圆角、14px/500,遮罩纯黑不带模糊。+ 标题写成陈述句而不是问句;主按钮是与标题同一个动词的「动词+名词」,取消键就写「取消」;+ 成功后的 Toast 与主按钮共用那个动词。++ 用原生 <dialog> 承载:焦点陷阱、Escape、背景 inert 和关掉后把焦点还给触发钮都由它给,+ 自己搭一遍只会少掉其中一两样。onConfirm 失败时弹层不关,原因留在原位等重试。 */+let modalSeq=0;+export function confirmModal({title,body,confirmLabel,cancelLabel='取消',onConfirm=null}={}){+ const trigger=document.activeElement;+ const dialog=document.createElement('dialog');+ dialog.className='geist-modal';+ const titleId=`geist-modal-title-${++modalSeq}`;+ dialog.setAttribute('aria-labelledby',titleId);+ dialog.innerHTML=`<div class="geist-modal-body">+ <h3 id="${titleId}"></h3><p></p><div data-modal-error></div></div>+ <footer class="geist-modal-footer">+ <div><button type="button" class="geist-button" data-modal-cancel></button></div>+ <div><button type="button" class="geist-button primary" data-modal-confirm></button></div>+ </footer>`;+ dialog.querySelector('h3').textContent=title;+ dialog.querySelector('.geist-modal-body p').textContent=body;+ const cancel=dialog.querySelector('[data-modal-cancel]');+ const accept=dialog.querySelector('[data-modal-confirm]');+ const failure=dialog.querySelector('[data-modal-error]');+ cancel.textContent=cancelLabel;+ accept.textContent=confirmLabel;+ document.body.append(dialog);+ return new Promise(resolve=>{+ let settled=null;+ dialog.addEventListener('close',()=>{+ dialog.remove();+ if(trigger instanceof HTMLElement&&trigger.isConnected)trigger.focus();+ resolve(settled||{confirmed:false});+ },{once:true});+ cancel.onclick=()=>dialog.close();+ /* 遮罩上的点击落在 <dialog> 自己身上,卡片里的落在子元素上。这个动作可撤销,+ 按 Geist 的判据允许点外面关掉。 */+ dialog.addEventListener('click',event=>{if(event.target===dialog)dialog.close()});+ accept.onclick=async()=>{+ if(!onConfirm){settled={confirmed:true};dialog.close();return}+ failure.innerHTML='';+ setActionBusy(accept);+ try{+ settled={confirmed:true,result:await onConfirm()};+ dialog.close();+ }catch(error){+ failure.innerHTML=noteHtml(error.message||'操作未完成',{variant:'error'});+ setActionBusy(accept,false);+ }+ };+ dialog.showModal();+ accept.focus();+ });+}