diff --git a/ACCEPTANCE.md b/ACCEPTANCE.md index 1d2561c..388b52b 100644 --- a/ACCEPTANCE.md +++ b/ACCEPTANCE.md @@ -22,15 +22,18 @@ Run on macOS 14+ with the released `Howler.dmg` (or `Howler.zip`). Mark each ite ## 2. 全局快捷键与面板 / Hotkey & panel -- [ ] 在任意应用(Finder、Safari、全屏应用)中按 ⌥H 呼出信纸,位于当前屏幕上方居中,带纸张落下的动画与火漆印“盖章”动画 +- [ ] 在任意应用(Finder、Safari、全屏应用)中按 ⌥H 呼出信纸,位于当前屏幕上方居中。纸面和火漆首帧就完整可见,背景文字不透进纸面。 - [ ] 信纸已聚焦时再按 ⌥H:暂时收起;再次呼出恢复原对话、草稿及排队问题 -- [ ] 等长回答完全显示后收起再呼出:信纸保持展开高度;烧掉后再呼出恢复空白小信纸。移动到较小屏幕时高度不超出可用区域 +- [ ] 在长回答生成期间观察信纸:顶部和左右位置不变,纸面随内容向下展开到 560 点上限(或屏幕底边)后停止,超出内容在纸内滚动;收起再打开保持展开后的高度。用户手动调整高度后,再发长问题不再自动改高。 +- [ ] 把信纸拖到屏幕四边,允许阴影或部分纸面超出屏幕;松手不回弹,后续收到回答也不把窗口拉回屏幕内。内容不变时,收起重开、截图成功或取消后,仍保持相同位置和尺寸。拔掉显示器导致信纸离开可用屏幕时,信纸回到可见区域。按 Esc 关闭后打开新信,恢复默认位置和大小。 +- [ ] 从纸面顶部、侧边留白、页脚和空信纸中部可拖动窗口。拖动输入框或正文中的文字仍选中文字;滚动正文、点击火漆和附件仍有效。 +- [ ] 从纸面四边或四角拖动可调整宽高,方向光标与拖动方向一致,对边保持原位。只改宽度时,回答重新换行并在自动上限内按需展开高度;手动改高后保持所选高度。 +- [ ] 在有长回答的信纸上,从任意边或角向内拖到最小。聊天纸面不小于 480 × 300 点(可用屏幕本身更小时除外)。手动缩短信纸后,再展开附件或积累几条排队问题,窗口不变高,输入框和页脚仍可用,附件、排队问题和正文可以在纸内滚动。 - [ ] 信纸出现时输入框自动获得焦点,可直接输入;前台应用不会被切走(菜单栏仍显示原应用名) - [ ] 中文输入法:可正常输入拼音选词;选词过程中按 Esc 只取消组字,不关闭信纸 - [ ] ⌘V / ⌘C / ⌘A / ⌘Z 在输入框中可用 -- [ ] Esc 或右下角火焰烧掉信纸并立即清空;火焰不遮挡页脚或正文;点击纸外或阴影只交出焦点,回答继续;其他应用中的 Esc 不影响信纸 -- [ ] 连续呼出信纸并按 Esc 至少三次。每次燃烧开始时,纸边、火漆印和正文都留在原位。 -- [ ] 燃烧中再按 ⌥H:立即出现一张新的空白信纸 +- [ ] 信纸右下角没有火苗按钮。按 Esc 立即关闭并清空对话,不播放动画。点击纸外或阴影只交出焦点,回答继续;其他应用中的 Esc 不影响信纸。 +- [ ] 在羽毛笔思考或书写时按 Esc,再立即按 ⌥H,显示空白新信,不出现旧回复。 - [ ] 从菜单或火漆印打开 Settings:信纸直接收起并保留会话;从菜单打开信纸只唤回,不反向收起 - [ ] 多显示器:在鼠标所在屏幕上弹出 - [ ] 未配置时,信纸显示 “This parchment has no ink yet.” 与 “Open Settings” 按钮,点击打开设置 @@ -56,13 +59,14 @@ Run on macOS 14+ with the released `Howler.dmg` (or `Howler.zip`). Mark each ite - [ ] DeepSeek 下带图片发送:请求照常发出;模型能读图则回答图片内容,不能则显示 DeepSeek 返回的错误(Howler 不预先拦截) - [ ] 不主动粘贴或截屏时,Howler 从不读取剪贴板(macOS 15.4+ 不会弹出“允许粘贴”提示) - [ ] 点左上角火漆印:菜单显示 “Written by <模型>”(悬停显示完整配置)与 Settings…;页脚显示 “模型 · 主机” -- [ ] 发送后先出现悬停的羽毛笔与 “The quill is thinking…”,2 秒后显示秒数 +- [ ] 发送后立即出现问题和思考行,慢首包也一样。羽毛笔轻微悬停,2 秒后显示秒数,数字增加时思考文字不移动。 +- [ ] 快速替换附件,再收起和重开。火漆只在附件变化时轻压一次,附着状态和按钮始终可见。 - [ ] 回答逐字显现、新字带金色微光;macOS 15+ 羽毛笔停在最后一个字之后;macOS 14 停在段落末尾 -- [ ] 最新一轮问题和回答紧贴输入框下方,旧轮次依次向下排列;纸张随回答向下变长,达到 A4 比例或屏幕可用高度后顶部保持不动,超出内容在底部渐隐,可向下滚动阅读 -- [ ] 书写中向下滚动阅读旧轮次:上方回答变长时所读位置保持不动;主动按回车发送后回到顶部,减少动态效果开启时不带滚动动画 +- [ ] 最新一轮问题和回答排在旧对话之前,超出纸面的内容在底部渐隐,可向下滚动阅读 +- [ ] 书写中向下滚动阅读旧轮次:上方回答变长时所读位置保持不动;主动按回车发送后直接回到顶部 - [ ] 回答写完后出现 ❧ Copy;点击或按 ⌘C(未选中文字时)复制整条回答,显示 ✓ Copied;在输入框或回答里选中一段文字后按 ⌘C,只复制选中的部分 - [ ] 多轮对话之间有 ❦ 花饰分隔;停在顶部时排队任务开始仍显示最新一轮,向下阅读旧轮次时自动开始下一轮不打断阅读 -- [ ] 系统设置开启“减少动态效果”:无落纸、盖章、火漆光晕、燃烧和逐字动画,文字随到随显,关闭时直接消失 +- [ ] 系统设置开启“减少动态效果”:火漆不轻压、羽毛笔不摆动、文字随到随显。思考文字和计时仍可读。 ## 2b. 截图介绍与排队 / Screenshot introductions and queued replies @@ -80,8 +84,8 @@ Run on macOS 14+ with the released `Howler.dmg` (or `Howler.zip`). Mark each ite - [ ] 再截图不改变已有草稿/排队项的图片关联;可显式切换,发送后仍可预览原图 - [ ] 停止或网络错误后暂停队列;Retry 不重复用户轮且替换旧的部分答案;Skip 保留“不完整”标记并继续 - [ ] 模型服务、模型或 Key 改动暂停队列;仅语言和系统指令变动不取消当前项,作用于后续提交任务 -- [ ] 焚烧后立即再开、旧流/截图/动画晚到时,新会话没有旧内容;退出后不恢复 -- [ ] 火焰入口深浅色可见、可键盘聚焦、读屏能识别;预览中的 Esc 先关闭预览,第二次才焚烧 +- [ ] 按 Esc 关闭后立即再开。旧请求或截图晚到时,新会话没有旧内容;退出后不恢复。 +- [ ] 预览中的 Esc 只关闭预览。再次按 Esc 才关闭信纸并清空对话。 - [ ] 截图快捷键可独立录制/重置;与普通/设置快捷键冲突时拒绝或明确提示,保留旧快捷键迁移 - [ ] 普通粘贴、选择复制、输入法组字和 Reduce Motion 不回归 @@ -173,7 +177,7 @@ Run on macOS 14+ with the released `Howler.dmg` (or `Howler.zip`). Mark each ite ## 4. 各服务真实流式 / Per-service real streaming -- [ ] 在设置选择本机 Magpie 图片模型,用合成截图提问。回答途中点焚信,再开新信。检查取消记录、新信内容、用量日志及图片缓存。切回原服务后确认原配置可用。 +- [ ] 在设置选择本机 Magpie 图片模型,用合成截图提问。回答途中按 Esc 关闭,再开新信。检查取消记录、新信内容、用量日志及图片缓存。切回原服务后确认原配置可用。 对每个预设:用 `config set preset=…` 写入并保存 Key、`check` 通过后,呼出面板,发送下列提示词。 For each preset: `config set preset=…`, save a key, pass `check`, open the panel, send the prompts below. diff --git a/AGENTS.md b/AGENTS.md index 04486c5..2775cbf 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -13,7 +13,7 @@ Howler is a macOS 14+ menu bar app (Swift 5.10, SwiftPM). `HowlerCore` holds the ## Engineering boundaries - Keep protocol, request and parsing logic in `HowlerCore`, with focused tests. Keep AppKit, SwiftUI, Keychain and other macOS integrations in `Howler`. -- Conversations stay in memory and are cleared when the letter burns or the app quits; conceal and focus loss retain them. Stop cancelled streams from writing into a later conversation. Screen capture uses a temporary file: keep its cleanup and describe that exception accurately. +- Conversations stay in memory. Esc closes the letter immediately and clears the conversation; quitting also clears it. Conceal and focus loss retain the conversation. Stop cancelled streams from writing into a later conversation. Screen capture uses a temporary file: keep its cleanup and describe that exception accurately. - API keys belong in Keychain, never command arguments, logs, fixtures or documentation. Read the clipboard and screen only after a user action; use an ephemeral session for chat requests. - Preserve input-method composition, selection-aware copy, Reduce Motion, and legacy configuration/shortcut migration. Add manual checks when behavior changes. - The Settings footer shows either the current version or one Update button. A click authorizes only the offered update, including restart; cancellation, failure or session end clears that consent. Keep download validation and installation in Sparkle, with its progress and error UI. Informational and major-upgrade offers retain Sparkle's standard confirmation. diff --git a/README.md b/README.md index 5246d5a..be93c94 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@

A sealed letter for your quick questions on macOS.
- Write on the parchment, a quill writes the answer back, and the letter burns when you're done. + Write on the parchment, and a quill writes back. Press Esc when you're done.

@@ -36,23 +36,16 @@ Press **⌥H** anywhere. A letter settles at the top of the screen, already sealed in wax. -- **Parchment, not a text box.** The paper has deckled edges, fibers and a fold crease. The newest question and its answer sit just below the writing line, with earlier exchanges beneath them. The sheet grows downward up to an A4 page or the available screen height, then stays in place as the answer continues below the fold. Scroll down to read more; sending a question returns to the top. +- **Parchment, not a text box.** The paper has deckled edges, fibers and a fold crease. The newest exchange appears first. The sheet grows downward with the reply up to a compact height limit (or the screen bottom), then stays in place while longer replies, the queue, and open attachments scroll inside. Resizing the height manually locks it until you close the letter. Sending a question returns to the top. - **A quill that writes.** Answers stream in at a hand's pace. Fresh ink glows gold before it settles to sepia, and the quill rests after the last word. While the model thinks, the quill hovers and counts the seconds. - **Wax seals.** The crimson seal names the model writing to you. Paste a long text or a picture, or capture a region of the screen, and it is sealed into an amber seal cut with runes instead of filling your question. -- **Burn after reading.** Press Esc or click the flame in the bottom-right corner, and the letter catches fire at its bottom edge. Scorch, embers and sparks climb to the seal, and the conversation goes with them. Nothing is saved. +- **Burn after reading.** Press Esc to close the letter and clear the conversation immediately. Press ⌥H instead if you want to set it aside and come back to it later. - - - - - - - - - -
The letter burning from its bottom edgeThe letter on candlelit paper in Dark Mode
Esc, and it burnsCandlelit paper in Dark Mode
+

+ The letter on candlelit paper in Dark Mode +

-Reduce Motion turns off the falling paper, the stamping, the ink shimmer and the fire. The text simply appears. +Reduce Motion turns off movement in the wax seal and quill. Replies appear as text arrives. ## Install @@ -73,7 +66,7 @@ Releases before v0.1.4 were ad-hoc signed. If Gatekeeper stops one of those, rig ## Set up a model -When Howler detects models in a running local Magpie app, Settings → General offers **Subscription**. Pick a model marked **Images** for screenshots. You can switch to **API Key** to use your own provider key. Howler remembers both setups. Burning clears the letter in Howler. Magpie and its model provider manage their own records. +When Howler detects models in a running local Magpie app, Settings → General offers **Subscription**. Pick a model marked **Images** for screenshots. You can switch to **API Key** to use your own provider key. Howler remembers both setups. Esc closes the letter and clears the conversation in Howler. Magpie and its model provider manage their own records. Howler writes with one model service. The setup is short enough to hand to an AI assistant. @@ -135,7 +128,9 @@ The model can't search the web: it answers from what it was trained on, and the | **⌘C** | Copy the latest answer (or click ❧ Copy). With text selected, it copies the selection. | | **+ Attach** | Paste from the clipboard, or capture a screen region | | **⌘V** | Short text goes into the question. Text of 280+ characters or 3+ lines, or a picture, is sealed as an attachment, including an image copied in a browser or an image file copied in Finder. | -| **Esc** / bottom-right flame | Burn and clear the letter. Esc first cancels composition, capture or an open preview. | +| **Esc** | Close the letter and clear the conversation. Esc first cancels composition, capture or an open preview. | +| **Drag blank paper** | Move the letter without selecting text or disturbing the conversation. | +| **Drag any edge or corner** | Resize the letter. Concealing it preserves the size and position; closing it with Esc resets both. | | **Click outside** | Return focus to the other app; keep the letter and replies. | Capture and Explain sends your selected region to the configured model immediately and starts an introduction. Pasted text and pictures still wait for you to send. While the model thinks or writes, type follow-ups and press Return to queue them: the introduction appears first, then each answer in order. Use Edit on a waiting question when the input is empty to restore it; sending it again places it at the end. ⏹ stops the current reply and pauses the queue, keeping partial text. Retry reply replaces that attempt; Skip and continue keeps it as incomplete context. Network errors pause the queue too. @@ -148,14 +143,14 @@ The Shortcuts app can start the same capture without a keyboard shortcut. Add th Settings › General › Reply language follows your macOS preferred language by default, regardless of the screenshot language, or lets you choose a language. An explicit language request in a question overrides the default for that turn. Custom system instructions may affect how well the model follows it. -Concealing the letter, clicking outside or opening Settings keeps the conversation in memory. Burning it or quitting clears it; restarting does not restore it. A model setup or key change pauses the queue until you explicitly continue. Leave out passwords and other secrets. Screen capture asks for Screen & System Audio Recording permission the first time. Howler only takes a still image of the region you drag and never records audio; macOS simply grants screen and audio access together. +Concealing the letter, clicking outside or opening Settings keeps the conversation in memory. Closing it with Esc or quitting clears it; restarting does not restore it. A model setup or key change pauses the queue until you explicitly continue. Leave out passwords and other secrets. Screen capture asks for Screen & System Audio Recording permission the first time. Howler only takes a still image of the region you drag and never records audio; macOS simply grants screen and audio access together. ## Privacy -- No chat history, ever. Messages and parsed-answer caches are cleared when the letter burns or the app quits. A concealed letter stays in memory. A screen capture uses a temporary PNG that Howler attempts to delete after reading it. +- No chat history, ever. Messages and parsed-answer caches are cleared when you close the letter with Esc or quit the app. A concealed letter stays in memory. A screen capture uses a temporary PNG that Howler attempts to delete after reading it. - Stored: the model setup, its last check, your system prompt instructions, three optional shortcuts and reply language preference (UserDefaults), plus the API key (Keychain). - The system prompt carries the date in UTC; tasks add the necessary reply language instruction. They send no full system language list, name, region, time zone or location. -- The clipboard and the screen are read only when you paste or capture. Capture and Explain sends the selected region immediately. Burning local content does not delete data retained by your model service. +- The clipboard and the screen are read only when you paste or capture. Capture and Explain sends the selected region immediately. Clearing the local conversation does not delete data retained by your model service. - No logs, no telemetry. Network requests use an ephemeral `URLSession`. - Update checks fetch `appcast.xml` from Howler's latest GitHub Release, at most once a day, and only after you allow it. They send no system profile; GitHub sees only the request, with the app and Sparkle versions in its User-Agent. Turn them off in Settings › General. - The command line never prints the key. @@ -179,7 +174,7 @@ Debug builds include a demo mode that needs no key and no network: ```bash swift build -HOWLER_DEMO=1 .build/debug/Howler # also: long, multi, burn, image, setup, settings +HOWLER_DEMO=1 .build/debug/Howler # also: long, multi, dismiss, reopen, image, setup, settings HOWLER_DEMO_DARK=1 HOWLER_DEMO=1 .build/debug/Howler ``` diff --git a/README.zh-CN.md b/README.zh-CN.md index 2d4e21e..a397a3c 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -10,7 +10,7 @@

macOS 上一封用火漆封着的信,专门用来问小问题。
- 在羊皮纸上写下问题,羽毛笔把回答写在下面;读完,信就烧掉。 + 在羊皮纸上写下问题,羽毛笔把回答写在下面。读完按 Esc 关闭。

@@ -34,25 +34,18 @@ ## 一封信 -在任何应用里按 **⌥H**,一封封好火漆的信就落在屏幕上方。 +在任何应用里按 **⌥H**,一封封好火漆的信就出现在屏幕上方。 -- **一张纸,不是输入框**:毛边、纤维纹理、中间一道折痕。最新一轮问题和回答紧贴输入框下方,旧对话依次排在下面。纸随回答向下展开,达到 A4 比例或屏幕可用高度后保持不动,继续写出的内容留在下方。向下滚动可继续阅读,发送问题时回到顶部。 +- **一张纸,不是输入框**:毛边、纤维纹理、中间一道折痕。最新一轮对话在最上面。纸面随回答适当向下展开,达到自动高度上限(或屏幕底边)后保持不动,超出内容、排队问题和展开的附件都在纸内滚动。手动调整高度后,关闭这封信前都保持该高度。发送问题时回到顶部。 - **羽毛笔书写**:回答按手写的节奏逐字出现,新墨先泛起金光,再沉为墨色,羽毛笔停在最后一个字后面。模型思考时,羽毛笔悬在纸上,并显示已经思考了几秒。 - **火漆印**:左上角的深红火漆印标明是哪个模型在回信。粘贴长文本或图片,或者截取屏幕区域,内容会封进右上角刻着符文的琥珀色火漆印,不会塞进问题里。 -- **阅后即焚**:按 Esc 或点击右下角的火焰,信纸从底边起火,焦痕、火光和火星一路烧到火漆印,这次对话也随之烧掉,什么都不保存。 +- **阅后即焚**:按 Esc 立即关闭信纸并清空对话。想稍后继续,按 ⌥H 暂时收起。 - - - - - - - - - -
信纸从底边燃起深色模式下的烛光纸张
按下 Esc,信纸燃起深色模式下的烛光纸张
+

+ 深色模式下的烛光纸张 +

-开启“减少动态效果”后,落纸、盖章、墨光和燃烧都不再播放,文字随到随显。 +开启“减少动态效果”后,火漆不轻压,羽毛笔不摆动。回复文字随到随显。 ## 安装 @@ -73,7 +66,7 @@ v0.1.4 之前的版本是 ad-hoc 签名,如果被 Gatekeeper 拦截,可以 ## 配置模型 -Howler 检测到本机 Magpie 正在运行且有可用模型时,设置 → 通用会出现 **Subscription**。截图提问可选标有 **Images** 的模型。选 **API Key** 可使用自己的接口密钥。Howler 会记住两边的设置。焚信会清空 Howler 中的会话。Magpie 和模型服务商各自管理调用记录。 +Howler 检测到本机 Magpie 正在运行且有可用模型时,设置 → 通用会出现 **Subscription**。截图提问可选标有 **Images** 的模型。选 **API Key** 可使用自己的接口密钥。Howler 会记住两边的设置。按 Esc 关闭信纸会清空 Howler 中的会话。Magpie 和模型服务商各自管理调用记录。 Howler 只连接一个模型服务。配置步骤很少,可以直接交给 AI 助手完成。 @@ -135,7 +128,9 @@ $H config show | **⌘C** | 复制最新一条回答(也可点 ❧ Copy);选中了文字时只复制选中的部分 | | **+ Attach** | 从剪贴板粘贴,或截取屏幕区域 | | **⌘V** | 短文字进入问题;280 字以上或 3 行以上的文字、图片封成附件,浏览器里拷贝的图片、访达里拷贝的图片文件也一样 | -| **Esc** / 右下角火焰 | 烧掉信纸并清空;输入法选字、截图框选或预览中的 Esc 先取消当前操作 | +| **Esc** | 立即关闭信纸并清空对话;输入法选字、截图框选或预览中的 Esc 先取消当前操作 | +| **拖动纸面留白** | 移动信纸,不影响选中文字或当前对话 | +| **拖动任一边缘或角** | 调整信纸大小。暂时收起会保留位置和大小;按 Esc 关闭后恢复默认 | | **点击纸外** | 交出焦点,信纸和生成中的回答保留 | 截图完成后会自动发送到已配置的模型并开始介绍;粘贴文字或图片仍需手动发送。思考和书写期间可以继续输入并按回车提交追问,回答依次呈现:先介绍,再逐个答疑。等待中的问题可在输入框为空时点 Edit 撤回修改,重新发送后排到队尾。点 ⏹ 停止当前回答并暂停队列,保留已有内容;可以 Retry reply 重试或 Skip and continue 跳过继续。网络错误同样暂停队列。 @@ -148,14 +143,14 @@ $H config show 「快捷指令」可以不按键盘就启动同一次截图。添加「打开 URL」操作,地址只写 `howler://capture`,再从菜单栏、控制中心或程序坞运行这条快捷指令。Howler 会请你拖出区域,拖之前不读取屏幕。地址里如果带问题、图片或其他参数,则不会触发。Howler 没在运行时,快捷指令会先打开它,再开始框选。 -暂时收起、点击纸外或打开设置都保留内存会话;烧掉或退出应用才清空,重启不恢复。模型配置或 Key 改动会暂停已有队列,需手动继续。请不要粘贴或截取密码、密钥等敏感信息。首次截屏需要授予“录屏与系统录音”权限。Howler 只截取你框选区域的一张静态图片,从不录音;只是 macOS 把录屏和录音放在同一个权限里一起授予。 +暂时收起、点击纸外或打开设置都保留内存会话;按 Esc 关闭信纸或退出应用才清空,重启不恢复。模型配置或 Key 改动会暂停已有队列,需手动继续。请不要粘贴或截取密码、密钥等敏感信息。首次截屏需要授予“录屏与系统录音”权限。Howler 只截取你框选区域的一张静态图片,从不录音;只是 macOS 把录屏和录音放在同一个权限里一起授予。 ## 隐私 -- 从不保存聊天历史:焚烧信纸或退出应用会清空消息和回答解析缓存;暂时收起仍保留在内存。截屏会使用临时 PNG 文件,Howler 读取后会尝试删除。 +- 从不保存聊天历史:按 Esc 关闭信纸或退出应用会清空消息和回答解析缓存;暂时收起仍保留在内存。截屏会使用临时 PNG 文件,Howler 读取后会尝试删除。 - 只持久化这些:模型配置、最近一次检查结果、系统提示词的指令、三个可留空的快捷键和回答语言偏好(UserDefaults),以及 API Key(钥匙串)。 - 系统提示词带 UTC 日期;每次任务另带必要的回答语言指令,不发送完整系统语言列表、名字、地区、时区或所在地。 -- 只在你粘贴或截屏时读取剪贴板和屏幕。截图并解释会在框选完成后立即发送到你配置的服务;本地焚烧不代表删除服务端保留的数据。 +- 只在你粘贴或截屏时读取剪贴板和屏幕。截图并解释会在框选完成后立即发送到你配置的服务;清空本地对话不会删除服务端保留的数据。 - 不记录日志,没有统计或遥测;网络请求使用 ephemeral `URLSession`。 - 检查更新时,从 Howler 最新的 GitHub Release 读取 `appcast.xml`,最多每天一次,且要先经过你同意;不发送任何系统信息,GitHub 只能看到这次请求,以及 User-Agent 里的应用和 Sparkle 版本号。可以在 Settings › General 关闭。 - 命令行从不打印 Key。 @@ -179,7 +174,7 @@ make icon # 由 Sources/Howler/AppIconArt.swift 重新渲染 Resources/AppIcon ```bash swift build -HOWLER_DEMO=1 .build/debug/Howler # 其他变体:long、multi、burn、image、setup、settings +HOWLER_DEMO=1 .build/debug/Howler # 其他变体:long、multi、dismiss、reopen、image、setup、settings HOWLER_DEMO_DARK=1 HOWLER_DEMO=1 .build/debug/Howler ``` diff --git a/Sources/Howler/AppDelegate.swift b/Sources/Howler/AppDelegate.swift index e9c6a46..8b32527 100644 --- a/Sources/Howler/AppDelegate.swift +++ b/Sources/Howler/AppDelegate.swift @@ -236,12 +236,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate { } @objc private func sendFeedback() { - panelController?.hide(burning: false) + panelController?.conceal() Feedback.open() } @objc private func checkForUpdates() { - panelController?.hide(burning: false) + panelController?.conceal() if updater.available != nil { updater.installAvailableUpdate() } else { @@ -250,7 +250,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate { } @objc private func openSettings() { - panelController?.hide(burning: false) + panelController?.conceal() settingsController?.show() } } diff --git a/Sources/Howler/Burn.swift b/Sources/Howler/Burn.swift index 7edb143..328d12c 100644 --- a/Sources/Howler/Burn.swift +++ b/Sources/Howler/Burn.swift @@ -5,8 +5,6 @@ import SwiftUI /// it. Fire is lit at two points below the bottom edge and climbs, with a ragged front /// from layered noise, so the seal and the first line are the last to go. struct BurnField { - /// Seconds from the first flame to ash. Longer reads as dragging once you're done. - static let duration: TimeInterval = 0.6 /// Points per cell; the images are scaled up smoothly, which softens the front. private static let cell: CGFloat = 3 @@ -71,12 +69,6 @@ struct BurnField { self.embers = embers } - /// Burn progress for a moment of the animation: a brief catch, then the fire takes hold. - static func progress(elapsed: TimeInterval) -> Double { - let t = min(max(elapsed / duration, 0), 1) - return -0.04 + 1.12 * pow(t, 1.1) - } - struct Frame { /// Opaque where paper remains. let mask: CGImage @@ -177,80 +169,3 @@ private struct ValueNoise { Float((SeededRandom.jitter(x &* 7919 &+ y &* 104_729, seed: seed) + 1) / 2) } } - -/// Draws a burning letter over `content`: the paper is eaten from the bottom up, with a -/// charred, glowing edge and sparks flying off it. With no burn in progress it changes -/// nothing — and keeps the same view structure, so scroll positions and focus survive -/// the moment the fire starts. -struct BurningLetter: ViewModifier { - let field: BurnField? - let progress: Double? - - func body(content: Content) -> some View { - let frame = field.flatMap { field in progress.flatMap { field.frame(at: $0) } } - content - .overlay { - if let frame { - Image(decorative: frame.scorch, scale: 1) - .resizable() - .interpolation(.high) - .blur(radius: 1.6) - .mask(DeckledSheet()) - } - } - .mask { - if let frame { - Image(decorative: frame.mask, scale: 1).resizable().interpolation(.high).blur(radius: 1.2) - } else { - Rectangle() - } - } - .overlay { - if let frame { - Image(decorative: frame.glow, scale: 1) - .resizable() - .interpolation(.high) - .blur(radius: 7) - .blendMode(.plusLighter) - } - } - .overlay { - if let field, let progress { - Sparks(field: field, progress: progress) - } - } - .allowsHitTesting(frame == nil) - } -} - -private struct Sparks: View { - let field: BurnField - let progress: Double - /// How long a spark lives, in burn progress. - private let life = 0.22 - - var body: some View { - Canvas { context, size in - let scaleX = size.width / max(field.size.width, 1) - let scaleY = size.height / max(field.size.height, 1) - for ember in field.embers where progress > ember.lit && progress < ember.lit + life { - let age = (progress - ember.lit) / life - let x = ember.origin.x * scaleX + ember.drift * CGFloat(age) + sin(ember.phase + age * 9) * 3 - let y = ember.origin.y * scaleY - ember.rise * CGFloat(age) - let radius = ember.radius * CGFloat(1 - age * 0.5) - let warmth = 1 - age - context.fill( - Path(ellipseIn: CGRect(x: x - radius * 2, y: y - radius * 2, width: radius * 4, height: radius * 4)), - with: .radialGradient( - Gradient(colors: [ - Color(red: 1, green: 0.85, blue: 0.5).opacity(warmth), - Color(red: 1, green: 0.4, blue: 0.1).opacity(warmth * 0.6), - Color(red: 0.8, green: 0.15, blue: 0).opacity(0), - ]), - center: CGPoint(x: x, y: y), startRadius: 0, endRadius: radius * 2 - ) - ) - } - } - } -} diff --git a/Sources/Howler/ChatViewModel.swift b/Sources/Howler/ChatViewModel.swift index 4b1b771..0aaf684 100644 --- a/Sources/Howler/ChatViewModel.swift +++ b/Sources/Howler/ChatViewModel.swift @@ -108,9 +108,7 @@ final class ChatViewModel: ObservableObject { if !value, queue.active?.state == .revealing { quill.snapToEnd() } } - /// The controller retains only a rendered snapshot while the business state is cleared. - func burn() { reset() } - + /// Cancels active work and clears the in-memory conversation. func reset() { conversationID = UUID() streamTask?.cancel() diff --git a/Sources/Howler/DemoMode.swift b/Sources/Howler/DemoMode.swift index 422d4d9..52c28ba 100644 --- a/Sources/Howler/DemoMode.swift +++ b/Sources/Howler/DemoMode.swift @@ -6,12 +6,13 @@ import SwiftUI /// `HOWLER_DEMO=1 swift run Howler` opens the letter with an attachment and writes a /// scripted answer, without any network or API key. Used to check the look and motion. /// -/// Variants: `HOWLER_DEMO=setup` (no model yet), `empty` (configured blank letter), `long` (overflows an A4 page), -/// `multi` (a follow-up question), `reread` (`long` with a long follow-up, for scrolling down while it is written), `queue` (screenshot with two waiting questions), `burn` (dismissed once written), `image` (a captured screen region), +/// Variants: `HOWLER_DEMO=setup` (no model yet), `empty` (configured blank letter), `long` (overflows the letter), +/// `multi` (a follow-up question), `reread` (`long` with a long follow-up, for scrolling down while it is written), `queue` (screenshot with two waiting questions), `image` (a captured screen region), /// `settings` (the Settings window with a synthetic setup; `HOWLER_DEMO_PROVIDER=anthropic` shows a demo one, /// `HOWLER_DEMO_TAB=general|prompt|shortcut` opens that tab, `cycle` switches tabs every 1.5 s; without a /// model Settings always opens on General; `HOWLER_DEMO_UPDATE=1` shows the update row, `=0.1.9` a /// waiting update, `HOWLER_DEMO_SNAPSHOT=out.png` saves the window as a PNG and quits), +/// `dismiss` (press Escape while thinking), `reopen` (press Escape, then open a fresh letter). For both, `HOWLER_DEMO_SIZE=min|tall` overrides the paper size. /// `appicon` (renders the app icon into the folder `HOWLER_DEMO_OUT`; see scripts/icon.sh); /// `menu` opens the status menu, captures only its window to `HOWLER_DEMO_SNAPSHOT`, then quits; /// `HOWLER_DEMO_DARK=1` forces Dark Mode. @@ -55,9 +56,9 @@ enum MenuDemo { extension PanelController { func runDemo() { let variant = ProcessInfo.processInfo.environment["HOWLER_DEMO"] ?? "1" - panel.dismissesOnResignKey = false if variant == "setup" { show() + scheduleLetterSnapshot() return } if variant == "appicon" { @@ -66,6 +67,10 @@ extension PanelController { return } settings.useDemoService(.anthropic) + if variant == "dismiss" || variant == "reopen" { + runDismissDemo(reopens: variant == "reopen") + return + } if variant == "empty" { show() scheduleLetterSnapshot() @@ -113,9 +118,6 @@ extension PanelController { self?.viewModel.input = question self?.viewModel.send() } - if variant == "burn" { - DispatchQueue.main.asyncAfter(deadline: .now() + 8.5) { [weak self] in self?.hide() } - } scheduleLetterSnapshot() if variant == "multi" || variant == "reread" { DispatchQueue.main.asyncAfter(deadline: .now() + 9) { [weak self] in @@ -125,11 +127,45 @@ extension PanelController { } } + private func runDismissDemo(reopens: Bool) { + viewModel.demoStream = { Self.demoStream(repeats: 1) } + show() + let paper: CGSize? = switch ProcessInfo.processInfo.environment["HOWLER_DEMO_SIZE"] { + case "min": CGSize(width: LetterGeometry.minPaperWidth, height: LetterGeometry.minPaperHeight) + case "tall": CGSize(width: 720, height: 580) + default: nil + } + if let paper { + let size = LetterGeometry.windowSize(paperWidth: paper.width, paperHeight: paper.height) + panel.setFrame(CGRect(x: panel.frame.midX - size.width / 2, y: panel.frame.maxY - size.height, + width: size.width, height: size.height), display: true) + } + DispatchQueue.main.asyncAfter(deadline: .now() + 0.35) { [weak self] in + self?.viewModel.input = "How does an ink pen work?" + self?.viewModel.send() + } + DispatchQueue.main.asyncAfter(deadline: .now() + 0.9) { [weak self] in + guard let self, let escape = NSEvent.keyEvent( + with: .keyDown, location: .zero, modifierFlags: [], timestamp: ProcessInfo.processInfo.systemUptime, + windowNumber: self.panel.windowNumber, context: nil, characters: "\u{1B}", + charactersIgnoringModifiers: "\u{1B}", isARepeat: false, keyCode: 53 + ) else { return } + NSApp.sendEvent(escape) + if reopens, !self.isVisible { self.show() } + } + scheduleLetterSnapshot() + } + private func scheduleLetterSnapshot() { guard let path = ProcessInfo.processInfo.environment["HOWLER_DEMO_SNAPSHOT"] else { return } let delay = Double(ProcessInfo.processInfo.environment["HOWLER_DEMO_DELAY"] ?? "2.5") ?? 2.5 DispatchQueue.main.asyncAfter(deadline: .now() + delay) { [weak self] in - if let view = self?.panel.contentView, + guard let panel = self?.panel, panel.isVisible else { + fputs("No visible letter at the requested snapshot time.\n", stderr) + NSApp.terminate(nil) + return + } + if let view = panel.contentView, let bitmap = view.bitmapImageRepForCachingDisplay(in: view.bounds) { view.cacheDisplay(in: view.bounds, to: bitmap) if let png = bitmap.representation(using: .png, properties: [:]) { diff --git a/Sources/Howler/FloatingPanel.swift b/Sources/Howler/FloatingPanel.swift new file mode 100644 index 0000000..64f1a13 --- /dev/null +++ b/Sources/Howler/FloatingPanel.swift @@ -0,0 +1,174 @@ +import AppKit +import SwiftUI + +/// 无边框的浮动信纸可以接收键盘输入,但不会激活 Howler 或把前台应用切走。 +final class FloatingPanel: NSPanel { + var onDismiss: (() -> Void)? + var onFrameEdit: ((CGRect, CGRect) -> Void)? + var isDraggingFrame: Bool { drag != nil } + var minimumFrameSize = LetterGeometry.minimumWindowSize(configured: false) + fileprivate let controlRegions = NSHashTable.weakObjects() + private var drag: FrameDrag? + + /// 选择与信纸重叠最多的屏幕;没有重叠时使用鼠标所在屏幕。 + static func visibleFrame(for frame: CGRect? = nil) -> CGRect? { + if let frame, let screen = NSScreen.screens.max(by: { + intersectionArea(frame, $0.frame) < intersectionArea(frame, $1.frame) + }), intersectionArea(frame, screen.frame) > 0 { + return screen.visibleFrame + } + let mouse = NSEvent.mouseLocation + return (NSScreen.screens.first { $0.frame.contains(mouse) } ?? NSScreen.main)?.visibleFrame + } + + private static func intersectionArea(_ a: CGRect, _ b: CGRect) -> CGFloat { + let overlap = a.intersection(b) + return overlap.isNull ? 0 : overlap.width * overlap.height + } + + init(contentRect: NSRect) { + super.init(contentRect: contentRect, styleMask: [.borderless, .nonactivatingPanel, .fullSizeContentView], + backing: .buffered, defer: false) + isFloatingPanel = true + level = .floating + collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary, .transient] + hidesOnDeactivate = false + isReleasedWhenClosed = false + backgroundColor = .clear + isOpaque = false + hasShadow = false + // 深色模式只调暗纸面,不改输入框的光标、占位文字和选中文字的颜色。 + appearance = NSAppearance(named: .aqua) + animationBehavior = .none + } + + override var canBecomeKey: Bool { true } + override var canBecomeMain: Bool { false } + + // 屏幕切换后的找回由控制器处理,不让系统重新摆放贴边的无边框窗口。 + override func constrainFrameRect(_ frameRect: NSRect, to screen: NSScreen?) -> NSRect { frameRect } + + override func cancelOperation(_ sender: Any?) { + onDismiss?() + } + + override func sendEvent(_ event: NSEvent) { + switch event.type { + case .leftMouseDown where beginFrameGesture(event): return + case .leftMouseDragged where drag != nil: + updateFrameGesture(event) + case .leftMouseUp where drag != nil: + finishFrameGesture() + default: + super.sendEvent(event) + } + } + + private func beginFrameGesture(_ event: NSEvent) -> Bool { + guard let contentView, let visible = Self.visibleFrame(for: frame) else { return false } + let point = event.locationInWindow + let paper = LetterGeometry.paper(in: contentView.convert(contentView.bounds, to: nil)) + let overControl = controlRegions.allObjects.contains { view in + view.window === self && !view.isHiddenOrHasHiddenAncestor && view.convert(view.bounds, to: nil).contains(point) + } + guard let gesture = LetterGeometry.gesture(at: point, in: paper, overChatOrControl: overControl) else { return false } + drag = FrameDrag(gesture: gesture, initialFrame: frame, initialPoint: convertPoint(toScreen: point), visible: visible) + if !isKeyWindow { makeKey() } + return true + } + + private func updateFrameGesture(_ event: NSEvent) { + guard let drag else { return } + let point = convertPoint(toScreen: event.locationInWindow) + let delta = CGPoint(x: point.x - drag.initialPoint.x, y: point.y - drag.initialPoint.y) + let newFrame: CGRect + switch drag.gesture { + case .move: + newFrame = drag.initialFrame.offsetBy(dx: delta.x, dy: delta.y) + case let .resize(edges): + edges.cursor.set() + newFrame = LetterGeometry.resized(drag.initialFrame, edges: edges, by: delta, in: drag.visible, minimum: minimumFrameSize) + } + if frame != newFrame { setFrame(newFrame, display: true) } + } + + func finishFrameGesture() { + guard let drag else { return } + self.drag = nil + if frame != drag.initialFrame { onFrameEdit?(drag.initialFrame, frame) } + } + + private struct FrameDrag { + let gesture: LetterFrameGesture + let initialFrame: CGRect + let initialPoint: CGPoint + let visible: CGRect + } +} + +final class LetterHostingView: NSHostingView { + override func resetCursorRects() { + super.resetCursorRects() + let paper = LetterGeometry.paper(in: convert(bounds, to: nil)) + for (edges, rect) in LetterGeometry.resizeRegions(in: paper) { + addCursorRect(convert(rect, from: nil), cursor: edges.cursor) + } + } +} + +extension View { + /// 给窗口记录实际控件占据的区域,不改变原控件的鼠标或辅助功能行为。 + func keepsLetterMouseEvents(horizontalInset: CGFloat = 0) -> some View { + background(LetterControlRegion().padding(.horizontal, horizontalInset) + .allowsHitTesting(false).accessibilityHidden(true)) + } +} + +private struct LetterControlRegion: NSViewRepresentable { + func makeNSView(context: Context) -> RegionView { RegionView() } + func updateNSView(_ nsView: RegionView, context: Context) {} + + final class RegionView: NSView { + override func viewDidMoveToWindow() { + super.viewDidMoveToWindow() + (window as? FloatingPanel)?.controlRegions.add(self) + } + } +} + +private extension LetterEdges { + @MainActor var cursor: NSCursor { + if #available(macOS 15, *) { + let position: NSCursor.FrameResizePosition + switch self { + case [.top, .left]: position = .topLeft + case [.top, .right]: position = .topRight + case [.bottom, .left]: position = .bottomLeft + case [.bottom, .right]: position = .bottomRight + case .top: position = .top + case .bottom: position = .bottom + case .left: position = .left + default: position = .right + } + return .frameResize(position: position, directions: .all) + } + switch self { + case .top, .bottom: return .resizeUpDown + case .left, .right: return .resizeLeftRight + case [.top, .left], [.bottom, .right]: return LegacyCornerCursor.descending + default: return LegacyCornerCursor.ascending + } + } +} + +/// macOS 14 提供水平和垂直系统光标,但没有公开的斜向调整光标。 +@MainActor +private enum LegacyCornerCursor { + static let descending = make("arrow.up.left.and.arrow.down.right") + static let ascending = make("arrow.up.right.and.arrow.down.left") + + private static func make(_ symbol: String) -> NSCursor { + guard let image = NSImage(systemSymbolName: symbol, accessibilityDescription: nil) else { return .crosshair } + return NSCursor(image: image, hotSpot: NSPoint(x: image.size.width / 2, y: image.size.height / 2)) + } +} diff --git a/Sources/Howler/HowlerView.swift b/Sources/Howler/HowlerView.swift index cf14774..62a5e76 100644 --- a/Sources/Howler/HowlerView.swift +++ b/Sources/Howler/HowlerView.swift @@ -4,8 +4,7 @@ import SwiftUI /// The Howler: a sheet of enchanted parchment. You write on the line at the top, next to the /// provider's wax seal; pasted text or a captured screen region shows up as a second seal -/// in the corner instead of text in the field; the answer is written below by a quill, and -/// the sheet grows to fit it. +/// in the corner instead of text in the field; the answer is written below by a quill. struct HowlerView: View { @ObservedObject var viewModel: ChatViewModel @ObservedObject var settings: AppSettings @@ -14,9 +13,8 @@ struct HowlerView: View { let showProviderMenu: () -> Void /// Offers "Paste from Clipboard" and "Capture Screen Region". let showAttachMenu: () -> Void - var burnLetter: () -> Void = {} var registerDismiss: (@escaping () -> Bool) -> Void = { _ in } - /// Reports the sheet height the content would like (the controller clamps it). + /// 报告内容理想纸面高度,由控制器在自动上限内按需展开。 let onDesiredHeight: (CGFloat) -> Void @Environment(\.accessibilityReduceMotion) private var reduceMotion @@ -24,43 +22,20 @@ struct HowlerView: View { @State private var headerHeight: CGFloat = 0 @State private var transcriptHeight: CGFloat = 0 @State private var footerHeight: CGFloat = 0 - @State private var unfolded = true @State private var showingContext = false - @State private var hoveringBurn = false var body: some View { let parchment = Parchment.forScheme(viewModel.candlelit ? .dark : .light) ZStack(alignment: .top) { SheetShadow() - ZStack(alignment: .top) { - sheet(parchment) - if settings.isConfigured { - letter(parchment) - } else { - SetupPage(pressKey: viewModel.openCount, openSettings: openSettings) - } - } - .overlay(alignment: .bottomTrailing) { - Button(action: burnLetter) { - Image(systemName: "flame") - .font(.system(size: 16, weight: .medium)) - .foregroundStyle(parchment.seal) - .frame(width: 40, height: 40) - .background(parchment.seal.opacity(hoveringBurn ? 0.10 : 0), in: Circle()) - .contentShape(Rectangle()) - } - .buttonStyle(.plain) - .onHover { hoveringBurn = $0 } - .help("Burn this letter · Esc") - .accessibilityLabel("Close and clear conversation") - .padding(.bottom, 8).padding(.trailing, 8) + sheet(parchment) + if settings.isConfigured { + letter(parchment) + } else { + SetupPage(openSettings: openSettings) } } - // 让展开动画的图层包含透明留白,保证燃烧快照沿用窗口原点。 .padding(margins) - .scaleEffect(unfolded ? 1 : 0.97, anchor: .top) - .rotation3DEffect(.degrees(unfolded ? 0 : 10), axis: (x: 1, y: 0, z: 0), anchor: .top, perspective: 0.5) - .opacity(unfolded ? 1 : 0) .environment(\.parchment, parchment) .environment(\.copyText, viewModel.copyText) .onAppear { @@ -73,12 +48,9 @@ struct HowlerView: View { .onChange(of: reduceMotion, initial: true) { _, reduced in viewModel.updateReduceMotion(reduced) } - .onChange(of: viewModel.openCount) { _, _ in - unfold() - focusInput() - } + .onChange(of: viewModel.openCount) { _, _ in focusInput() } .onChange(of: viewModel.focusTick) { _, _ in focusInput() } - .onChange(of: desiredHeight, initial: true) { _, height in onDesiredHeight(height) } + .onChange(of: desiredPaperHeight, initial: true) { _, height in onDesiredHeight(height) } .onChange(of: viewModel.previewAttachment == nil) { _, isEmpty in if isEmpty { showingContext = false } } @@ -88,8 +60,13 @@ struct HowlerView: View { !viewModel.messages.isEmpty || viewModel.errorText != nil } - private var desiredHeight: CGFloat { - headerHeight + (hasTranscript ? transcriptHeight + footerHeight : 0) + private var hasChatContent: Bool { + hasTranscript || showingContext || !viewModel.images.isEmpty + || viewModel.queue.isPaused || !viewModel.queue.waiting.isEmpty + } + + private var desiredPaperHeight: CGFloat { + headerHeight + (hasChatContent ? transcriptHeight : 0) + (hasTranscript ? footerHeight : 0) } // MARK: Sheet @@ -102,22 +79,22 @@ struct HowlerView: View { private func letter(_ parchment: Parchment) -> some View { VStack(alignment: .leading, spacing: 0) { - VStack(spacing: 0) { - header(parchment) - taskControls(parchment) - if showingContext, let attachment = viewModel.previewAttachment { - ContextCard(attachment: attachment) { - withAnimation(.easeOut(duration: 0.2)) { viewModel.removeAttachment() } + header(parchment) + .onGeometryChange(for: CGFloat.self) { $0.size.height } action: { headerHeight = $0 } + if hasChatContent { + Transcript(viewModel: viewModel, contentHeight: $transcriptHeight, revealsAttachment: showingContext) { + taskControls(parchment) + if showingContext, let attachment = viewModel.previewAttachment { + ContextCard(attachment: attachment, remove: viewModel.removeAttachment) + .padding(.horizontal, 24) + .padding(.bottom, 12) } - .transition(.opacity.combined(with: .move(edge: .top))) } - } - .onGeometryChange(for: CGFloat.self) { $0.size.height } action: { headerHeight = $0 } - - if hasTranscript { - Transcript(viewModel: viewModel, contentHeight: $transcriptHeight) - footer(parchment) - .onGeometryChange(for: CGFloat.self) { $0.size.height } action: { footerHeight = $0 } + .keepsLetterMouseEvents(horizontalInset: 16) + if hasTranscript { + footer(parchment) + .onGeometryChange(for: CGFloat.self) { $0.size.height } action: { footerHeight = $0 } + } } else { EmptyPage(hasAttachment: viewModel.attachment != nil) } @@ -129,10 +106,11 @@ struct HowlerView: View { private func header(_ parchment: Parchment) -> some View { HStack(alignment: .top, spacing: 16) { Button(action: showProviderMenu) { - ProviderStamp(glyph: settings.service?.glyph, pressKey: viewModel.openCount) + ProviderStamp(glyph: settings.service?.glyph) } .buttonStyle(.plain) .help(stampHelp) + .keepsLetterMouseEvents() VStack(alignment: .leading, spacing: 3) { TextField("Question", text: $viewModel.input, prompt: Text(placeholder), axis: .vertical) @@ -148,6 +126,7 @@ struct HowlerView: View { .stroke(parchment.rule, lineWidth: 0.9) .frame(height: 5) } + .keepsLetterMouseEvents() .padding(.top, 9) if viewModel.queue.active != nil && !viewModel.queue.isPaused { @@ -158,10 +137,11 @@ struct HowlerView: View { } .buttonStyle(.plain) .help("Lift the quill (stop)") + .keepsLetterMouseEvents() .padding(.top, 12) } - sigil + sigil.keepsLetterMouseEvents() } .padding(.leading, 24) .padding(.trailing, 48) @@ -169,29 +149,21 @@ struct HowlerView: View { .padding(.bottom, 14) } - @ViewBuilder private var sigil: some View { - if let attachment = viewModel.previewAttachment { - Button { - withAnimation(.easeOut(duration: 0.2)) { showingContext.toggle() } - } label: { - AttachmentSigil( - mode: .sealed(symbol: attachment.image == nil ? "doc.text" : "photo"), - caption: "\(attachment.title)\n\(attachment.sizeLabel)", - appearKey: viewModel.attachmentStamp - ) - } - .buttonStyle(.plain) - .help("\(attachment.summary) — sealed into your next question. Click to read or remove it.") - .accessibilityLabel("Attached context: \(attachment.summary)") - } else { - Button(action: showAttachMenu) { - AttachmentSigil(mode: .empty, caption: "Attach", appearKey: viewModel.openCount) - } - .buttonStyle(.plain) - .help("Seal in pasted text, a picture, or a region of the screen") - .accessibilityLabel("Attach context") + let attachment = viewModel.previewAttachment + return Button { + if attachment != nil { showingContext.toggle() } else { showAttachMenu() } + } label: { + AttachmentSigil( + mode: attachment.map { .sealed(symbol: $0.image == nil ? "doc.text" : "photo") } ?? .empty, + caption: attachment.map { "\($0.title)\n\($0.sizeLabel)" } ?? "Attach", + appearKey: viewModel.attachmentStamp + ) } + .buttonStyle(.plain) + .help(attachment.map { "\($0.summary) · Click to read or remove it." } + ?? "Seal in pasted text, a picture, or a region of the screen") + .accessibilityLabel(attachment.map { "Attached context: \($0.summary)" } ?? "Attach context") } private var placeholder: String { @@ -278,13 +250,12 @@ struct HowlerView: View { .truncationMode(.middle) } Spacer(minLength: 16) - Text("↩ write · ⌘C copy · esc burn") + Text("↩ write · ⌘C copy · Esc close") } .font(Lettering.marginalia(11.5)) .foregroundStyle(parchment.fadedInk) } - .padding(.leading, 26) - .padding(.trailing, 60) + .padding(.horizontal, 26) .padding(.top, 2) .padding(.bottom, 14) } @@ -298,16 +269,6 @@ struct HowlerView: View { DispatchQueue.main.async { inputFocused = true } } - /// The sheet drops into place like paper laid on a desk. - private func unfold() { - guard !reduceMotion else { return } - var reset = Transaction() - reset.disablesAnimations = true - withTransaction(reset) { unfolded = false } - DispatchQueue.main.async { - withAnimation(.spring(response: 0.42, dampingFraction: 0.78)) { unfolded = true } - } - } } /// What's sealed in, unfolded below the writing line when the sigil is clicked. @@ -351,8 +312,6 @@ private struct ContextCard: View { RoundedRectangle(cornerRadius: 5, style: .continuous) .strokeBorder(parchment.magic.opacity(0.55), style: StrokeStyle(lineWidth: 0.7, dash: [3, 2])) ) - .padding(.horizontal, 24) - .padding(.bottom, 12) } } @@ -368,7 +327,7 @@ private struct EmptyPage: View { .font(Lettering.script(23)) .foregroundStyle(parchment.fadedInk.opacity(0.8)) .contentTransition(.opacity) - Text("↩ send · ⌥↩ new line · esc burn") + Text("↩ send · ⌥↩ new line · Esc close") .font(Lettering.marginalia(11.5)) .foregroundStyle(parchment.fadedInk.opacity(0.6)) Spacer(minLength: 0) @@ -381,14 +340,13 @@ private struct EmptyPage: View { /// Shown until a model service and its key are set up. private struct SetupPage: View { - let pressKey: Int let openSettings: () -> Void @Environment(\.parchment) private var parchment var body: some View { VStack(alignment: .leading, spacing: 0) { HStack(alignment: .top, spacing: 16) { - ProviderStamp(glyph: nil, pressKey: pressKey) + ProviderStamp(glyph: nil) VStack(alignment: .leading, spacing: 6) { Text("This parchment has no ink yet.") .font(Lettering.script(27)) @@ -412,14 +370,14 @@ private struct SetupPage: View { } .buttonStyle(.plain) .keyboardShortcut(.defaultAction) + .keepsLetterMouseEvents() } } .padding(24) } } -/// Cast separately from the sheet so it can fade while the paper burns. The sheet's -/// own area is cut out, so holes burned in the paper show the desktop, not a backing. +/// 纸面的投影不接收鼠标事件。 struct SheetShadow: View { var body: some View { ZStack { diff --git a/Sources/Howler/LetterGeometry.swift b/Sources/Howler/LetterGeometry.swift new file mode 100644 index 0000000..62a157a --- /dev/null +++ b/Sources/Howler/LetterGeometry.swift @@ -0,0 +1,149 @@ +import AppKit + +struct LetterEdges: OptionSet { + let rawValue: Int + + static let left = Self(rawValue: 1 << 0) + static let right = Self(rawValue: 1 << 1) + static let bottom = Self(rawValue: 1 << 2) + static let top = Self(rawValue: 1 << 3) +} + +enum LetterFrameGesture: Equatable { + case move + case resize(LetterEdges) +} + +/// 以下尺寸以窗口为准,窗口比纸面多出阴影与火漆印所需的透明留白。 +enum LetterGeometry { + static let margins = NSEdgeInsets(top: 24, left: 36, bottom: 48, right: 36) + static let defaultPaperWidth: CGFloat = 640 + // 保留输入框和两侧控件的空间,同时让正文在窄窗口里可读。 + static let minPaperWidth: CGFloat = 480 + static let minPaperHeight: CGFloat = 300 + // 聊天内容自动向下展开的纸面高度上限,超出后在纸内滚动。 + static let maxAutoPaperHeight: CGFloat = 560 + static let setupPaperHeight: CGFloat = 230 + static let sizeTolerance: CGFloat = 0.5 + private static let edgeWidth: CGFloat = 7 + private static let cornerSize: CGFloat = 22 + private static let reachablePaperSize: CGFloat = 24 + + static func windowSize(paperWidth: CGFloat = defaultPaperWidth, paperHeight: CGFloat) -> CGSize { + CGSize(width: paperWidth + margins.left + margins.right, + height: paperHeight + margins.top + margins.bottom) + } + + static func minimumWindowSize(configured: Bool) -> CGSize { + windowSize(paperWidth: minPaperWidth, paperHeight: configured ? minPaperHeight : setupPaperHeight) + } + + static func paper(in bounds: CGRect) -> CGRect { + CGRect(x: bounds.minX + margins.left, y: bounds.minY + margins.bottom, + width: bounds.width - margins.left - margins.right, + height: bounds.height - margins.top - margins.bottom) + } + + static func resizeRegions(in paper: CGRect) -> [(edges: LetterEdges, rect: CGRect)] { + let edge = edgeWidth, corner = cornerSize + guard paper.width >= 2 * corner, paper.height >= 2 * corner else { return [] } + // 四角用相交的两段细边,不遮住角落里内缩的按钮。 + let columns: [(LetterEdges, CGFloat, CGFloat)] = [ + (.left, paper.minX, corner), ([], paper.minX + corner, paper.width - 2 * corner), + (.right, paper.maxX - corner, corner) + ] + let rows: [(LetterEdges, CGFloat, CGFloat)] = [ + (.bottom, paper.minY, corner), ([], paper.minY + corner, paper.height - 2 * corner), + (.top, paper.maxY - corner, corner) + ] + let horizontal = columns.flatMap { side, x, width in + [(side.union(.bottom), CGRect(x: x, y: paper.minY, width: width, height: edge)), + (side.union(.top), CGRect(x: x, y: paper.maxY - edge, width: width, height: edge))] + } + let vertical = rows.flatMap { side, y, height in + [(side.union(.left), CGRect(x: paper.minX, y: y, width: edge, height: height)), + (side.union(.right), CGRect(x: paper.maxX - edge, y: y, width: edge, height: height))] + } + return horizontal + vertical + } + + static func gesture(at point: CGPoint, in paper: CGRect, overChatOrControl: Bool) -> LetterFrameGesture? { + if let edges = resizeRegions(in: paper).first(where: { $0.rect.contains(point) })?.edges { + return .resize(edges) + } + return paper.contains(point) && !overChatOrControl ? .move : nil + } + + static func defaultFrame(in visible: CGRect, paperHeight: CGFloat) -> CGRect { + let size = windowSize(paperHeight: paperHeight) + let top = visible.maxY - visible.height * 0.16 + margins.top + return fitted(CGRect(x: visible.midX - size.width / 2, y: top - size.height, + width: size.width, height: size.height), in: visible) + } + + static func fitted(_ frame: CGRect, in visible: CGRect) -> CGRect { + let width = min(frame.width, visible.width) + let height = min(frame.height, visible.height) + return CGRect(x: min(max(frame.minX, visible.minX), visible.maxX - width), + y: min(max(frame.maxY - height, visible.minY), visible.maxY - height), + width: width, height: height) + } + + /// 纸面仍可抓取时,恢复用户摆放的位置;只有纸面几乎完全离开所有屏幕才移回。 + static func restored(_ frame: CGRect, on screens: [CGRect], fallback: CGRect) -> CGRect { + let paper = paper(in: frame) + let reachable = screens.contains { screen in + let overlap = screen.intersection(paper) + return !overlap.isNull && overlap.width >= reachablePaperSize && overlap.height >= reachablePaperSize + } + return reachable ? frame : fitted(frame, in: fallback) + } + + /// 随聊天内容向下扩展高度,不超过自动上限和当前屏幕底边;不改变水平位置、宽度和顶部。 + static func autoSized(_ frame: CGRect, in visible: CGRect, desiredPaperHeight: CGFloat, configured: Bool) -> CGRect { + guard configured else { return frame } + let minHeight = windowSize(paperHeight: minPaperHeight).height + let maxAutoHeight = windowSize(paperHeight: maxAutoPaperHeight).height + let targetHeight = min(max(windowSize(paperHeight: desiredPaperHeight).height, minHeight), maxAutoHeight) + // 纸面底边不超过屏幕可用区底边;若窗口已被拖得更低,保持现有高度不回弹。 + let screenCap = min(visible.height, frame.maxY - visible.minY + margins.bottom) + let height = max(frame.height, min(targetHeight, screenCap)) + return CGRect(x: frame.minX, y: frame.maxY - height, width: frame.width, height: height) + } + + static func resized(_ frame: CGRect, edges: LetterEdges, by delta: CGPoint, + in visible: CGRect, minimum: CGSize) -> CGRect { + let x = resizedSpan(frame.minX...frame.maxX, lowerEdge: .left, upperEdge: .right, + edges: edges, delta: delta.x, minimum: min(minimum.width, visible.width)) + let y = resizedSpan(frame.minY...frame.maxY, lowerEdge: .bottom, upperEdge: .top, + edges: edges, delta: delta.y, minimum: min(minimum.height, visible.height)) + return CGRect(x: x.lowerBound, y: y.lowerBound, width: x.upperBound - x.lowerBound, height: y.upperBound - y.lowerBound) + } + + private static func resizedSpan(_ span: ClosedRange, lowerEdge: LetterEdges, upperEdge: LetterEdges, + edges: LetterEdges, delta: CGFloat, minimum: CGFloat) -> ClosedRange { + let movesLower = edges.contains(lowerEdge) + guard movesLower || edges.contains(upperEdge) else { return span } + let anchor = movesLower ? span.upperBound : span.lowerBound + let length = max(minimum, span.upperBound - span.lowerBound + (movesLower ? -delta : delta)) + return movesLower ? (anchor - length)...anchor : anchor...(anchor + length) + } +} + +/// 保存同一封信的位置和大小;只有手动改高才停止自动展开。 +struct LetterPlacement { + private(set) var savedFrame: CGRect? + private(set) var hasManualHeight = false + + mutating func recordEdit(from before: CGRect, to after: CGRect) { + guard before != after else { return } + saveFrame(after) + if abs(before.height - after.height) > LetterGeometry.sizeTolerance { + hasManualHeight = true + } + } + + mutating func saveFrame(_ frame: CGRect) { + savedFrame = frame + } +} diff --git a/Sources/Howler/PanelController.swift b/Sources/Howler/PanelController.swift index 972b154..64caacc 100644 --- a/Sources/Howler/PanelController.swift +++ b/Sources/Howler/PanelController.swift @@ -3,73 +3,18 @@ import Combine import HowlerCore import SwiftUI -/// Borderless, non-activating floating panel (Spotlight-style). It can become key so the -/// text field receives typing without pulling the previously active app to the back. -final class FloatingPanel: NSPanel { - var onDismiss: (() -> Void)? - /// Demo mode keeps the letter up while automation tools take focus. - var dismissesOnResignKey = false - - init(contentRect: NSRect) { - super.init( - contentRect: contentRect, - styleMask: [.borderless, .nonactivatingPanel, .fullSizeContentView], - backing: .buffered, - defer: false - ) - isFloatingPanel = true - level = .floating - collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary, .transient] - hidesOnDeactivate = false - isReleasedWhenClosed = false - isMovableByWindowBackground = true - backgroundColor = .clear - isOpaque = false - hasShadow = false // the letter casts its own, softer shadow - // Paper is light in every appearance; keep caret, placeholder and selection colors - // from following a dark desktop (the sheet itself is dimmed instead, see Parchment). - appearance = NSAppearance(named: .aqua) - animationBehavior = .none - } - - override var canBecomeKey: Bool { true } - override var canBecomeMain: Bool { false } - - override func cancelOperation(_ sender: Any?) { - onDismiss?() - } - - /// Losing focus never ends a letter. - override func resignKey() { - super.resignKey() - - } -} - -/// Hosts the letter. The window is the sheet plus a transparent margin for its shadow and -/// the seals that overhang its edges; the sheet's height follows its content, from a -/// note-sized card up to an A4 page (or the screen, if smaller). +/// Hosts the letter. The window includes transparent margins for the paper's shadow. @MainActor final class PanelController { - static let paperWidth: CGFloat = 640 - static let minPaperHeight: CGFloat = 250 - static let setupPaperHeight: CGFloat = 230 - /// A4 is 1 : √2. - static let a4Height = paperWidth * 1.414 - static let margins = NSEdgeInsets(top: 24, left: 36, bottom: 48, right: 36) let viewModel: ChatViewModel let settings: AppSettings let panel: FloatingPanel private let openSettings: () -> Void - private var desiredPaperHeight = minPaperHeight - private var maxPaperHeight = a4Height + private var desiredPaperHeight: CGFloat = 0 + private var placement = LetterPlacement() private var keyMonitor: Any? - private var mouseMonitor: Any? var dismissLocalInteraction: (() -> Bool)? - private var isHiding = false - private var burnCompletion: DispatchWorkItem? - private var letterContent: NSView? private var captureInProgress = false private var cancellables: Set = [] @@ -77,10 +22,11 @@ final class PanelController { self.settings = settings self.openSettings = openSettings viewModel = ChatViewModel(settings: settings) - panel = FloatingPanel(contentRect: NSRect(origin: .zero, size: Self.windowSize(paperHeight: Self.minPaperHeight))) + let size = LetterGeometry.windowSize(paperHeight: LetterGeometry.minPaperHeight) + panel = FloatingPanel(contentRect: NSRect(origin: .zero, size: size)) - let margins = Self.margins - let hosting = NSHostingView( + let margins = LetterGeometry.margins + let hosting = LetterHostingView( rootView: HowlerView( viewModel: viewModel, settings: settings, @@ -88,13 +34,11 @@ final class PanelController { openSettings: openSettings, showProviderMenu: { [weak self] in self?.showServiceMenu() }, showAttachMenu: { [weak self] in self?.showAttachMenu() }, - burnLetter: { [weak self] in self?.hide() }, registerDismiss: { [weak self] dismiss in self?.dismissLocalInteraction = dismiss }, onDesiredHeight: { [weak self] height in self?.setDesiredPaperHeight(height) } ) ) hosting.sizingOptions = [] - letterContent = hosting panel.contentView = hosting viewModel.captureScreenRegion = { [weak self] completion in guard let self else { return completion(nil) } @@ -102,151 +46,120 @@ final class PanelController { } viewModel.keepingOpen = { [weak self] work in guard let self else { return work() } - let dismisses = self.panel.dismissesOnResignKey - self.panel.dismissesOnResignKey = false work() - self.panel.dismissesOnResignKey = dismisses self.panel.makeKeyAndOrderFront(nil) } - panel.onDismiss = { [weak self] in - MainActor.assumeIsolated { self?.hide() } - } + panel.onDismiss = { [weak self] in self?.closeLetter() } + panel.onFrameEdit = { [weak self] before, after in self?.recordFrameEdit(from: before, to: after) } settings.objectWillChange .receive(on: RunLoop.main) - .sink { [weak self] _ in MainActor.assumeIsolated { self?.applyHeight() } } + .sink { [weak self] _ in MainActor.assumeIsolated { self?.handleSettingsChange() } } + .store(in: &cancellables) + NotificationCenter.default.publisher(for: NSApplication.didChangeScreenParametersNotification) + .receive(on: RunLoop.main) + .sink { [weak self] _ in MainActor.assumeIsolated { self?.recoverVisibleFrame() } } .store(in: &cancellables) } var isVisible: Bool { panel.isVisible } func toggle() { - if panel.isVisible && panel.isKeyWindow && !isHiding { conceal() } else { show() } + if panel.isVisible && panel.isKeyWindow { conceal() } else { show() } } - func show() { - if isHiding { finishHiding() } // summoned again mid-burn: a fresh letter + func show() { show(restoring: nil) } + + private func show(restoring previousFrame: CGRect?) { settings.reload() - if !panel.isVisible { positionOnActiveScreen() } - panel.alphaValue = 0 - panel.makeKeyAndOrderFront(nil) + updateResizeMinimum() + if !panel.isVisible { restoreFrame(previousFrame) } viewModel.panelDidOpen( reduceMotion: NSWorkspace.shared.accessibilityDisplayShouldReduceMotion, candlelit: NSApp.effectiveAppearance.bestMatch(from: [.aqua, .darkAqua]) == .darkAqua ) - NSAnimationContext.runAnimationGroup { context in - context.duration = 0.16 - panel.animator().alphaValue = 1 - } + panel.makeKeyAndOrderFront(nil) installMonitors() } /// Temporarily put the letter aside without changing its conversation or queue. func conceal() { - guard !isHiding else { return } + panel.finishFrameGesture() + if panel.isVisible { placement.saveFrame(panel.frame) } removeMonitors() panel.orderOut(nil) viewModel.setVisible(false) } - /// Compatibility entry for existing settings, feedback and updater callers. - func hide(burning: Bool = true) { - if !burning { conceal(); return } - guard panel.isVisible, !isHiding else { return } - isHiding = true + /// 立即关闭并清空对话。先取消请求,再将视图标为不可见,避免推进排队任务。 + func closeLetter() { + guard panel.isVisible else { return } removeMonitors() - let reduced = NSWorkspace.shared.accessibilityDisplayShouldReduceMotion - var snapshot: NSImage? - if !reduced, let content = panel.contentView, - let bitmap = content.bitmapImageRepForCachingDisplay(in: content.bounds) { - content.cacheDisplay(in: content.bounds, to: bitmap) - let image = NSImage(size: content.bounds.size) - image.addRepresentation(bitmap) - snapshot = image - } - viewModel.burn() // invalidate requests and clear content before the animation - viewModel.setVisible(false) - guard let snapshot else { finishHiding(); return } - let margins = EdgeInsets( - top: Self.margins.top, - leading: Self.margins.left, - bottom: Self.margins.bottom, - trailing: Self.margins.right - ) - panel.contentView = NSHostingView(rootView: BurningSnapshot(image: snapshot, margins: margins, start: Date())) - let completion = DispatchWorkItem { [weak self] in self?.finishHiding() } - burnCompletion = completion - DispatchQueue.main.asyncAfter(deadline: .now() + BurnField.duration, execute: completion) - } - - private func finishHiding() { - burnCompletion?.cancel() - burnCompletion = nil panel.orderOut(nil) - panel.contentView = letterContent - desiredPaperHeight = Self.minPaperHeight - isHiding = false + panel.finishFrameGesture() + viewModel.reset() + viewModel.setVisible(false) + desiredPaperHeight = 0 + placement = LetterPlacement() } // MARK: Layout - private static func windowSize(paperHeight: CGFloat) -> NSSize { - NSSize( - width: paperWidth + margins.left + margins.right, - height: paperHeight + margins.top + margins.bottom - ) + private func handleSettingsChange() { + updateResizeMinimum() + applyAutoHeight() } - private var paperHeight: CGFloat { - if !settings.isConfigured { return Self.setupPaperHeight } - return min(max(desiredPaperHeight, Self.minPaperHeight), maxPaperHeight) + private func updateResizeMinimum() { + panel.minimumFrameSize = LetterGeometry.minimumWindowSize(configured: settings.isConfigured) } private func setDesiredPaperHeight(_ height: CGFloat) { - guard abs(height - desiredPaperHeight) > 0.5 else { return } + guard abs(height - desiredPaperHeight) > LetterGeometry.sizeTolerance else { return } desiredPaperHeight = height - applyHeight() + applyAutoHeight() } - /// Grows or shrinks the sheet downward, keeping its top edge where it is. Not animated: - /// the quill writes a line at a time, so the sheet already grows in small steps, and a - /// window animation would trail the ink and push the top of the page out of view. - private func applyHeight() { - let size = Self.windowSize(paperHeight: paperHeight) - var frame = panel.frame - guard abs(frame.height - size.height) > 0.5 else { return } - frame.origin.y += frame.height - size.height - frame.size = size - panel.setFrame(frame, display: true) + private func recordFrameEdit(from before: CGRect, to after: CGRect) { + placement.recordEdit(from: before, to: after) + if abs(before.width - after.width) > LetterGeometry.sizeTolerance { applyAutoHeight() } } - private func positionOnActiveScreen() { - let mouse = NSEvent.mouseLocation - let screen = NSScreen.screens.first { NSMouseInRect(mouse, $0.frame, false) } ?? NSScreen.main - guard let visible = screen?.visibleFrame else { return } - let paperTop = visible.maxY - visible.height * 0.16 - maxPaperHeight = max(Self.minPaperHeight, min(Self.a4Height, paperTop - visible.minY - 16)) - let size = Self.windowSize(paperHeight: paperHeight) - panel.setFrame( - NSRect( - x: visible.midX - size.width / 2, - y: paperTop + Self.margins.top - size.height, - width: size.width, - height: size.height - ), - display: false - ) + /// 未手动改高时,随聊天内容向下展开到自动上限,不移动左右和顶部。 + private func applyAutoHeight() { + guard panel.isVisible, !panel.isDraggingFrame, !placement.hasManualHeight, + let visible = FloatingPanel.visibleFrame(for: panel.frame) else { return } + let newFrame = LetterGeometry.autoSized(panel.frame, in: visible, + desiredPaperHeight: desiredPaperHeight, + configured: settings.isConfigured) + if newFrame != panel.frame { panel.setFrame(newFrame, display: true) } } - /// The sheet's rectangle in window coordinates. - private var paperRect: NSRect { - let bounds = panel.contentView?.bounds ?? .zero - return NSRect( - x: Self.margins.left, - y: Self.margins.bottom, - width: bounds.width - Self.margins.left - Self.margins.right, - height: bounds.height - Self.margins.top - Self.margins.bottom - ) + private func restoreFrame(_ previousFrame: CGRect?) { + let anchor = previousFrame ?? placement.savedFrame + guard let visible = FloatingPanel.visibleFrame(for: anchor) else { return } + let paperHeight = settings.isConfigured ? LetterGeometry.minPaperHeight : LetterGeometry.setupPaperHeight + let base = anchor.map { recoveredFrame($0, fallback: visible) } + ?? LetterGeometry.defaultFrame(in: visible, paperHeight: paperHeight) + let frame = placement.hasManualHeight + ? base + : LetterGeometry.autoSized(base, in: visible, desiredPaperHeight: desiredPaperHeight, + configured: settings.isConfigured) + panel.setFrame(frame, display: false) + } + + private func recoveredFrame(_ frame: CGRect, fallback: CGRect) -> CGRect { + let recovered = LetterGeometry.restored(frame, on: NSScreen.screens.map(\.visibleFrame), fallback: fallback) + placement.saveFrame(recovered) + return recovered + } + + /// 只响应屏幕变化,不在拖动结束时把贴边窗口拉回屏幕内。 + private func recoverVisibleFrame() { + guard panel.isVisible, !panel.isDraggingFrame, + let visible = FloatingPanel.visibleFrame(for: panel.frame) else { return } + let recovered = recoveredFrame(panel.frame, fallback: visible) + if recovered != panel.frame { panel.setFrame(recovered, display: true) } } // MARK: Service menu @@ -288,20 +201,21 @@ final class PanelController { completion(.failure(ScreenCaptureError.permissionNeeded)) return } - if isHiding { finishHiding() } captureInProgress = true let wasVisible = panel.isVisible let wasKey = panel.isKeyWindow let session = viewModel.conversationID conceal() + let previousFrame = wasVisible ? panel.frame : nil ScreenCapture.captureRegion { [weak self] result in guard let self else { return } self.captureInProgress = false guard self.viewModel.conversationID == session else { return } if result != nil { - self.show() + self.show(restoring: previousFrame) } else if wasVisible { self.panel.orderFront(nil) + self.recoverVisibleFrame() self.viewModel.setVisible(true) self.installMonitors() if wasKey { self.panel.makeKey() } @@ -341,7 +255,7 @@ final class PanelController { return false } if dismissLocalInteraction?() == true { return true } - hide() + closeLetter() return true } @@ -381,9 +295,7 @@ final class PanelController { private func removeMonitors() { if let keyMonitor { NSEvent.removeMonitor(keyMonitor) } - if let mouseMonitor { NSEvent.removeMonitor(mouseMonitor) } keyMonitor = nil - mouseMonitor = nil } } @@ -402,49 +314,3 @@ final class ClosureMenuItem: NSMenuItem { @objc private func fire() { handler() } } - -/// A short-lived rendered image, never a live conversation model or a file on disk. -struct BurningSnapshot: View { - let image: NSImage - let margins: EdgeInsets - let start: Date - private let field: BurnField - private let paperSize: CGSize - - init(image: NSImage, margins: EdgeInsets, start: Date) { - self.image = image - self.margins = margins - self.start = start - let paperSize = CGSize( - width: max(1, image.size.width - margins.leading - margins.trailing), - height: max(1, image.size.height - margins.top - margins.bottom) - ) - self.paperSize = paperSize - self.field = BurnField(size: paperSize) - } - - var body: some View { - TimelineView(.animation) { timeline in - let progress = BurnField.progress(elapsed: timeline.date.timeIntervalSince(start)) - ZStack(alignment: .top) { - // Fade the shadow out as the first flames catch so no outline lingers in the margins. - SheetShadow() - .opacity(1 - min(max(progress * 3, 0), 1)) - Color.clear - .frame(width: paperSize.width, height: paperSize.height) - .overlay(alignment: .topLeading) { - Image(nsImage: image) - .resizable() - .frame(width: image.size.width, height: image.size.height) - .offset(x: -margins.leading, y: -margins.top) - } - .clipShape(DeckledSheet()) - .modifier(BurningLetter(field: field, progress: progress)) - } - .frame(width: paperSize.width, height: paperSize.height) - } - .padding(margins) - .frame(width: image.size.width, height: image.size.height) - .accessibilityHidden(true) - } -} diff --git a/Sources/Howler/Quill.swift b/Sources/Howler/Quill.swift index b683104..163c0a2 100644 --- a/Sources/Howler/Quill.swift +++ b/Sources/Howler/Quill.swift @@ -123,8 +123,8 @@ enum QuillArt { ) case .thinking: return ( - .degrees(sin(time * 1.7) * 6 - 4), - CGSize(width: sin(time * 1.1) * 1.5, height: -6 + sin(time * 2.4) * 3.5) + .degrees(sin(time * 1.4) * 2.5 - 4), + CGSize(width: sin(time) * 0.6, height: -5 + sin(time * 1.8) * 1.4) ) } } @@ -236,7 +236,7 @@ struct QuillView: View { height: height, angle: pose.angle, inks: parchment.quillInks, - glow: motion == .writing ? 1 : 0.5 + 0.5 * sin(clock * 3) + glow: motion == .writing ? 1 : 0.16 ) } .frame(width: height + 12, height: height + 12) @@ -250,20 +250,16 @@ struct ThinkingLine: View { @Environment(\.parchment) private var parchment var body: some View { - HStack(alignment: .bottom, spacing: 6) { - QuillView(motion: .thinking, time: time) - Text(label) - .font(Lettering.marginalia(14)) - .foregroundStyle(parchment.fadedInk) - .padding(.bottom, 6) - .contentTransition(.numericText()) + HStack(alignment: .center, spacing: 6) { + QuillView(motion: .thinking, time: time, height: 29) + Text("The quill is thinking…") + if time >= 2 { + Text("\(Int(time))s").monospacedDigit() + } } + .font(Lettering.marginalia(14)) + .foregroundStyle(parchment.fadedInk) .accessibilityElement(children: .ignore) .accessibilityLabel("Thinking") } - - private var label: String { - let seconds = Int(time) - return seconds >= 2 ? "The quill is thinking… \(seconds)s" : "The quill is thinking…" - } } diff --git a/Sources/Howler/Seals.swift b/Sources/Howler/Seals.swift index 141d30a..9c95e31 100644 --- a/Sources/Howler/Seals.swift +++ b/Sources/Howler/Seals.swift @@ -101,28 +101,16 @@ struct WaxPuddle: Shape { } } -/// The model service's mark as a crimson wax seal (a monochrome letter or symbol — never a -/// trademarked logo). It is pressed again each time the letter opens or the service -/// changes. +/// The model service's mark as a crimson wax seal (a monochrome letter or symbol). struct ProviderStamp: View { let glyph: ProviderGlyph? - /// Changes whenever the seal should be pressed again. - let pressKey: Int var size: CGFloat = 48 - @Environment(\.accessibilityReduceMotion) private var reduceMotion - @State private var pressed = true - var body: some View { WaxSeal(wax: .crimson, size: size, seed: seed) { mark } .rotationEffect(.degrees(-8)) - .scaleEffect(pressed ? 1 : 1.6) - .opacity(pressed ? 1 : 0) - .onAppear(perform: press) - .onChange(of: pressKey) { _, _ in press() } - .onChange(of: glyph) { _, _ in press() } } private var seed: UInt64 { @@ -143,16 +131,6 @@ struct ProviderStamp: View { Text("?").font(Lettering.proseBold(size * 0.38)) } } - - private func press() { - guard !reduceMotion else { return } - var reset = Transaction() - reset.disablesAnimations = true - withTransaction(reset) { pressed = false } - DispatchQueue.main.asyncAfter(deadline: .now() + 0.08) { - withAnimation(.spring(response: 0.28, dampingFraction: 0.55)) { pressed = true } - } - } } /// The amber seal in the letter's corner that stands for attached context. Sealed: the @@ -171,20 +149,18 @@ struct AttachmentSigil: View { @Environment(\.parchment) private var parchment @Environment(\.accessibilityReduceMotion) private var reduceMotion - @State private var appeared = true + private static let pressContact: TimeInterval = 0.045 + private static let pressSettle: TimeInterval = 0.115 var body: some View { - VStack(spacing: 4) { + let animates = !reduceMotion && mode != .empty + return VStack(spacing: 4) { switch mode { case .sealed(let symbol): - TimelineView(.animation(minimumInterval: 1.0 / 30, paused: reduceMotion)) { timeline in - let time = reduceMotion ? 0 : timeline.date.timeIntervalSinceReferenceDate - WaxSeal(wax: .amber, size: 44, seed: 31, engraved: true) { - Image(systemName: symbol).font(.system(size: 12, weight: .bold)) - } - // A faint enchantment: the seal glows as if warm. - .shadow(color: parchment.magic.opacity(0.25 + 0.2 * sin(time * 2.2)), radius: 8) + WaxSeal(wax: .amber, size: 44, seed: 31, engraved: true) { + Image(systemName: symbol).font(.system(size: 12, weight: .bold)) } + .shadow(color: parchment.magic.opacity(0.25), radius: 4) .frame(width: 44, height: 44) .rotationEffect(.degrees(7)) case .empty: @@ -206,20 +182,11 @@ struct AttachmentSigil: View { .fixedSize() } .opacity(mode == .empty ? 0.6 : 1) - .scaleEffect(appeared ? 1 : 1.7) - .opacity(appeared ? 1 : 0) - .onAppear(perform: pressIn) - .onChange(of: appearKey) { _, _ in pressIn() } - .onChange(of: mode) { _, _ in pressIn() } - } - - private func pressIn() { - guard !reduceMotion else { return } - var reset = Transaction() - reset.disablesAnimations = true - withTransaction(reset) { appeared = false } - DispatchQueue.main.asyncAfter(deadline: .now() + 0.18) { - withAnimation(.spring(response: 0.38, dampingFraction: 0.58)) { appeared = true } + .keyframeAnimator(initialValue: CGFloat(1), trigger: appearKey) { seal, scale in + seal.scaleEffect(animates ? scale : 1) + } keyframes: { _ in + LinearKeyframe(0.96, duration: Self.pressContact) + CubicKeyframe(1, duration: Self.pressSettle) } } } diff --git a/Sources/Howler/Transcript.swift b/Sources/Howler/Transcript.swift index 209ed7a..87b390f 100644 --- a/Sources/Howler/Transcript.swift +++ b/Sources/Howler/Transcript.swift @@ -2,19 +2,19 @@ import AppKit import HowlerCore import SwiftUI -/// Everything written on the letter so far, newest exchange first, right under the writing -/// line. The page grows downward; once the sheet is full, older exchanges continue below -/// the fold. The page never scrolls on its own to follow the quill. +/// 聊天内容可随回答向下展开到自动上限,超出后在纸内滚动;用户手动调整高度后保持所选高度。 +/// The page never scrolls on its own to follow the quill. /// /// A reader at the top stays there and watches the newest answer grow below the line. /// A reader who has scrolled down keeps their place: when the newest answer grows above /// the view, or the next queued exchange begins, the page moves down by the same amount. /// Asking a question returns to the top. -struct Transcript: View { +struct Transcript: View { @ObservedObject var viewModel: ChatViewModel @Binding var contentHeight: CGFloat + let revealsAttachment: Bool + @ViewBuilder let leadingContent: () -> LeadingContent @Environment(\.parchment) private var parchment - @Environment(\.accessibilityReduceMotion) private var reduceMotion @State private var scroller = PageScroller() @State private var scrollOffset: CGFloat = 0 @@ -22,8 +22,8 @@ struct Transcript: View { @State private var layout: TranscriptLayout? /// How close to the top still counts as reading the newest exchange. - private static let topSlack: CGFloat = 40 - private static let topID = "top" + private static var topSlack: CGFloat { 40 } + private static var topID: String { "top" } var body: some View { let turns = viewModel.turns @@ -32,6 +32,7 @@ struct Transcript: View { ScrollView(.vertical) { VStack(alignment: .leading, spacing: 0) { Color.clear.frame(height: 0).id(Self.topID) + leadingContent() VStack(alignment: .leading, spacing: 14) { if let error = viewModel.errorText { ErrorLine(text: error) @@ -75,6 +76,9 @@ struct Transcript: View { .coordinateSpace(name: "transcript") .scrollIndicators(.never) .mask(PageFade()) + .onChange(of: revealsAttachment) { _, isOpen in + if isOpen { scrollToTop(proxy) } + } } } @@ -89,11 +93,7 @@ struct Transcript: View { } private func scrollToTop(_ proxy: ScrollViewProxy) { - DispatchQueue.main.async { - withAnimation(reduceMotion ? nil : .easeOut(duration: 0.25)) { - proxy.scrollTo(Self.topID, anchor: .top) - } - } + DispatchQueue.main.async { proxy.scrollTo(Self.topID, anchor: .top) } } @ViewBuilder diff --git a/Tests/HowlerAppTests/ConversationExecutionTests.swift b/Tests/HowlerAppTests/ConversationExecutionTests.swift index 5ecb2d5..e448e25 100644 --- a/Tests/HowlerAppTests/ConversationExecutionTests.swift +++ b/Tests/HowlerAppTests/ConversationExecutionTests.swift @@ -111,7 +111,7 @@ final class ConversationExecutionTests: XCTestCase { model.reset() } - func testFailurePausesRetryReplacesAndBurnRejectsLateResults() async { + func testFailurePausesRetryReplacesAndResetRejectsLateResults() async { let model = model() model.input = "Question" model.send() @@ -128,7 +128,7 @@ final class ConversationExecutionTests: XCTestCase { streams[1].finish() await waitUntil { self.requests.count == 3 } XCTAssertEqual(model.queue.tasks[0].answer, "Replacement") - model.burn() + model.reset() streams[2].yield("Stale") streams[2].finish() for _ in 0..<20 { await Task.yield() } @@ -200,11 +200,11 @@ final class ConversationExecutionTests: XCTestCase { model.reset() } - func testDeferredLongPasteCannotRestoreContentAfterBurn() async { + func testDeferredLongPasteCannotRestoreContentAfterReset() async { let model = model() model.input = "Old draft" model.input += String(repeating: " paste", count: 100) - model.burn() + model.reset() model.input = "New letter" for _ in 0..<20 { await Task.yield() } XCTAssertEqual(model.input, "New letter") diff --git a/Tests/HowlerAppTests/LetterGeometryTests.swift b/Tests/HowlerAppTests/LetterGeometryTests.swift new file mode 100644 index 0000000..83c6d5e --- /dev/null +++ b/Tests/HowlerAppTests/LetterGeometryTests.swift @@ -0,0 +1,176 @@ +import CoreGraphics +import XCTest +@testable import Howler + +final class LetterGeometryTests: XCTestCase { + private let screen = CGRect(x: -1440, y: -120, width: 1440, height: 900) + private let frame = CGRect(x: -1100, y: 100, width: 712, height: 400) + private let minimum = LetterGeometry.minimumWindowSize(configured: true) + + func testPaperEdgesAndCornersResizeEvenBesideTheChat() { + let paper = LetterGeometry.paper(in: CGRect(origin: .zero, size: frame.size)) + let positions: [(CGPoint, LetterEdges)] = [ + (CGPoint(x: paper.minX + 1, y: paper.midY), .left), + (CGPoint(x: paper.maxX - 1, y: paper.midY), .right), + (CGPoint(x: paper.midX, y: paper.minY + 1), .bottom), + (CGPoint(x: paper.midX, y: paper.maxY - 1), .top), + (CGPoint(x: paper.minX + 1, y: paper.minY + 12), [.left, .bottom]), + (CGPoint(x: paper.maxX - 12, y: paper.minY + 1), [.right, .bottom]), + (CGPoint(x: paper.minX + 12, y: paper.maxY - 1), [.left, .top]), + (CGPoint(x: paper.maxX - 1, y: paper.maxY - 12), [.right, .top]) + ] + for (point, edges) in positions { + XCTAssertEqual(LetterGeometry.gesture(at: point, in: paper, overChatOrControl: true), .resize(edges)) + } + } + + func testOnlyNonChatPaperCanMoveTheWindow() { + let paper = LetterGeometry.paper(in: CGRect(origin: .zero, size: frame.size)) + for point in [CGPoint(x: paper.midX, y: paper.midY), + CGPoint(x: paper.minX + 12, y: paper.midY), + CGPoint(x: paper.maxX - 10, y: paper.minY + 10), + CGPoint(x: paper.midX, y: paper.minY + 18)] { + XCTAssertEqual(LetterGeometry.gesture(at: point, in: paper, overChatOrControl: false), .move) + XCTAssertNil(LetterGeometry.gesture(at: point, in: paper, overChatOrControl: true)) + } + let shadow = CGPoint(x: paper.minX - 2, y: paper.midY) + XCTAssertNil(LetterGeometry.gesture(at: shadow, in: paper, overChatOrControl: false)) + } + + func testLeftAndTopResizeAnchorTheOppositeEdges() { + let result = LetterGeometry.resized(frame, edges: [.left, .top], by: CGPoint(x: -42, y: 30), + in: screen, minimum: minimum) + XCTAssertEqual(result, CGRect(x: frame.minX - 42, y: frame.minY, width: frame.width + 42, height: frame.height + 30)) + } + + func testRightAndBottomResizeAnchorTheOppositeEdges() { + let result = LetterGeometry.resized(frame, edges: [.right, .bottom], by: CGPoint(x: 42, y: -30), + in: screen, minimum: minimum) + XCTAssertEqual(result, CGRect(x: frame.minX, y: frame.minY - 30, width: frame.width + 42, height: frame.height + 30)) + } + + func testResizingInwardFromEitherCornerStopsAtAUsablePaperSize() { + let fromTopRight = LetterGeometry.resized(frame, edges: [.right, .top], by: CGPoint(x: -2000, y: -2000), + in: screen, minimum: minimum) + let fromBottomLeft = LetterGeometry.resized(frame, edges: [.left, .bottom], by: CGPoint(x: 2000, y: 2000), + in: screen, minimum: minimum) + for resized in [fromTopRight, fromBottomLeft] { + let paper = LetterGeometry.paper(in: resized) + XCTAssertEqual(paper.width, 480) + XCTAssertEqual(paper.height, 300) + } + XCTAssertEqual(fromTopRight.origin, frame.origin) + XCTAssertEqual(fromBottomLeft.maxX, frame.maxX) + XCTAssertEqual(fromBottomLeft.maxY, frame.maxY) + } + + func testResizeNearTheEdgeDoesNotSnapTheShadowBackOnScreen() { + let dropped = CGRect(x: -676, y: -168, width: 712, height: 400) + let larger = LetterGeometry.resized(dropped, edges: .right, by: CGPoint(x: 12, y: 0), + in: screen, minimum: minimum) + XCTAssertEqual(larger.origin, dropped.origin) + XCTAssertEqual(larger.size, CGSize(width: 724, height: 400)) + } + + func testVisiblePaperStaysAtTheReleasedPositionEvenWhenItsShadowCrossesAnEdge() { + let dropped = CGRect(x: -676, y: -168, width: 712, height: 400) + XCTAssertEqual(LetterGeometry.restored(dropped, on: [screen], fallback: screen), dropped) + } + + func testTallLetterCanKeepItsExactFrameAcrossTwoDisplays() { + let other = CGRect(x: 0, y: 0, width: 1280, height: 660) + let spanning = CGRect(x: -300, y: 90, width: 712, height: 580) + XCTAssertEqual(LetterGeometry.restored(spanning, on: [screen, other], fallback: screen), spanning) + } + + func testOffscreenLetterIsRecoveredAfterItsDisplayIsRemoved() { + let missingDisplay = CGRect(x: 200, y: 180, width: 712, height: 400) + let recovered = LetterGeometry.restored(missingDisplay, on: [screen], fallback: screen) + XCTAssertTrue(screen.contains(recovered)) + XCTAssertEqual(recovered.size, missingDisplay.size) + } + + func testAMinimumSizedLetterStillFitsOnASmallerDisplay() { + let small = CGRect(x: 400, y: -900, width: 500, height: 350) + let initial = LetterGeometry.defaultFrame(in: small, paperHeight: 300) + XCTAssertEqual(initial, small) + XCTAssertEqual(LetterGeometry.restored(initial, on: [small], fallback: small), small) + } + + func testDefaultSetupFrameFitsOnANarrowDisplay() { + let small = CGRect(x: 400, y: -900, width: 500, height: 480) + let new = LetterGeometry.defaultFrame(in: small, paperHeight: 230) + XCTAssertTrue(small.contains(new)) + XCTAssertEqual(new.width, small.width) + XCTAssertEqual(new.height, 302) + } + + func testAutoHeightExpandsWithContentUpToTheAutoLimit() { + let base = CGRect(x: -1100, y: 300, width: 712, height: 372) + let medium = LetterGeometry.autoSized(base, in: screen, desiredPaperHeight: 440, configured: true) + XCTAssertEqual(LetterGeometry.paper(in: medium).height, 440) + XCTAssertEqual(medium.minX, base.minX) + XCTAssertEqual(medium.width, base.width) + XCTAssertEqual(medium.maxY, base.maxY) + + let long = LetterGeometry.autoSized(medium, in: screen, desiredPaperHeight: 1600, configured: true) + XCTAssertEqual(LetterGeometry.paper(in: long).height, LetterGeometry.maxAutoPaperHeight) + XCTAssertEqual(long.minX, base.minX) + XCTAssertEqual(long.width, base.width) + XCTAssertEqual(long.maxY, base.maxY) + } + + func testAutoHeightKeepsEdgePlacementWithoutSnappingBack() { + let edge = CGRect(x: -676, y: 200, width: 712, height: 372) + let expanded = LetterGeometry.autoSized(edge, in: screen, desiredPaperHeight: 1600, configured: true) + XCTAssertEqual(expanded.minX, edge.minX) + XCTAssertEqual(expanded.width, edge.width) + XCTAssertEqual(expanded.maxY, edge.maxY) + XCTAssertEqual(LetterGeometry.paper(in: expanded).height, LetterGeometry.maxAutoPaperHeight) + } + + func testAutoHeightStopsAtScreenBottomAndDoesNotJumpWhenAlreadyLower() { + let nearBottom = CGRect(x: -1100, y: -72, width: 712, height: 372) + let expanded = LetterGeometry.autoSized(nearBottom, in: screen, desiredPaperHeight: 1600, configured: true) + XCTAssertEqual(expanded.maxY, nearBottom.maxY) + XCTAssertEqual(LetterGeometry.paper(in: expanded).minY, screen.minY) + + let lower = CGRect(x: -1100, y: -172, width: 712, height: 372) + XCTAssertEqual(LetterGeometry.autoSized(lower, in: screen, desiredPaperHeight: 1600, configured: true), lower) + } + + func testAlreadyExpandedLetterDoesNotShrinkWithContentOrAfterMovingToAnEdge() { + let expanded = CGRect(x: -676, y: -168, width: 712, height: 620) + XCTAssertEqual(LetterGeometry.autoSized(expanded, in: screen, desiredPaperHeight: 380, configured: true), expanded) + let taller = CGRect(x: -676, y: -168, width: 712, height: 700) + XCTAssertEqual(LetterGeometry.autoSized(taller, in: screen, desiredPaperHeight: 1600, configured: true), taller) + } + + func testOnlyHeightEditsLockManualHeightUntilReset() { + var placement = LetterPlacement() + let moved = frame.offsetBy(dx: -16, dy: 12) + placement.recordEdit(from: frame, to: moved) + XCTAssertEqual(placement.savedFrame, moved) + XCTAssertFalse(placement.hasManualHeight) + + let wider = CGRect(origin: moved.origin, size: CGSize(width: 760, height: moved.height)) + placement.recordEdit(from: moved, to: wider) + XCTAssertFalse(placement.hasManualHeight) + + let expanded = LetterGeometry.autoSized(wider, in: screen, desiredPaperHeight: 480, configured: true) + placement.saveFrame(expanded) + XCTAssertEqual(placement.savedFrame, expanded) + XCTAssertFalse(placement.hasManualHeight) + + let taller = CGRect(origin: expanded.origin, size: CGSize(width: 760, height: 600)) + placement.recordEdit(from: expanded, to: taller) + XCTAssertTrue(placement.hasManualHeight) + + placement.recordEdit(from: taller, to: taller.offsetBy(dx: 10, dy: 0)) + XCTAssertTrue(placement.hasManualHeight) + + placement = LetterPlacement() + XCTAssertNil(placement.savedFrame) + XCTAssertFalse(placement.hasManualHeight) + } +} diff --git a/app.config b/app.config index 17efc55..9a18715 100644 --- a/app.config +++ b/app.config @@ -3,8 +3,8 @@ # The running app reads its display name back from Info.plist (CFBundleName). APP_NAME="Howler" BUNDLE_ID="com.hiarieszhou.howler" -VERSION="0.1.17" -BUILD_NUMBER="18" +VERSION="0.1.18" +BUILD_NUMBER="19" MIN_MACOS="14.0" # SwiftPM executable product that gets copied into the bundle (see Package.swift). EXECUTABLE_PRODUCT="Howler" diff --git a/docs/images/burning.png b/docs/images/burning.png deleted file mode 100644 index ffdafa0..0000000 Binary files a/docs/images/burning.png and /dev/null differ diff --git a/docs/images/letter-dark.png b/docs/images/letter-dark.png index ffc78e6..d3b0d1e 100644 Binary files a/docs/images/letter-dark.png and b/docs/images/letter-dark.png differ diff --git a/docs/images/letter.png b/docs/images/letter.png index 0cbd7a1..fadca02 100644 Binary files a/docs/images/letter.png and b/docs/images/letter.png differ diff --git a/docs/releases/0.1.18.md b/docs/releases/0.1.18.md new file mode 100644 index 0000000..3a2679f --- /dev/null +++ b/docs/releases/0.1.18.md @@ -0,0 +1,8 @@ +## What's Changed + +* Drag the blank paper to move the letter, or drag any edge or corner to resize it. +* Long replies can grow the letter downward to 560 points or the bottom of the screen, whichever comes first; changing the height yourself keeps it fixed. +* Esc closes the letter and clears the conversation immediately, without a burn animation; ⌥H still sets it aside without clearing it. +* The letter opens without a fade or flip, and the quill moves less while the model thinks. + +**Full Changelog**: https://github.com/HiAriesZhou/Howler/compare/v0.1.17...v0.1.18 diff --git a/site/assets/letter-dark.webp b/site/assets/letter-dark.webp index 266e647..d53effc 100644 Binary files a/site/assets/letter-dark.webp and b/site/assets/letter-dark.webp differ diff --git a/site/assets/letter.webp b/site/assets/letter.webp index d9f6c89..f4fc040 100644 Binary files a/site/assets/letter.webp and b/site/assets/letter.webp differ diff --git a/site/index.html b/site/index.html index 86e22ab..8727f71 100644 --- a/site/index.html +++ b/site/index.html @@ -4,7 +4,7 @@ Howler — Burn after reading - + @@ -19,7 +19,7 @@ - + @@ -28,7 +28,7 @@ - +