外觀一輪「浮、圓、靜」(新分支 design-fresh-look,照 2026 的介面方向,桌面對齊手機):輸入框浮起來、按鈕全是膠囊、空白聊天的建議變輕、工作流的停止不再搶眼;允許卡片最後一行不再被切掉。
三條原則寫在 src/theme.rs 開頭: 1. 浮的東西用影子浮起來(調色盤新增 shade,手機的 --shade),平放的用底色和髮絲線分組。 - 聊天輸入框:1.5px 深灰框 → 髮絲線加柔和陰影,打字時框線變深(跟手機同一張卡)。 - 工作流畫布上浮著的工具列、縮放列、側邊設定、等你確認列:同一層陰影(kit::lift)。 2. 按鈕是膠囊、圓鈕是圓的。 - kit 的主要/次要/紅色按鈕、分段選擇、允許卡片的按鈕、分享、其餘 ui.button 都改成膠囊。 - 輸入框的 +/麥克風/送出:圓角方塊 → 圓(手機的 .cbtn 也是)。 3. 顏色只給意思。 - 新增 kit::danger_text_button(淡底紅字):工作流的「■ 停止」、移除電腦、登出用它,紅底只留給不能回頭的刪除。 - 空白聊天的三個開頭:整排灰色大塊 → 一排細框膠囊,滑過才有底。 修正:允許卡片估高度時沒算「之後都直接操作」那一行,800 高的視窗裡最後一行「輸入框空著時:Enter 允許,Esc 拒絕」被切掉一半(offers_direct、ASK_DIRECT_ROW)。 文件:FEATURES.md 的輸入框外觀、設計規格、共用元件按鈕、新對話;workflow.md 右上按鈕(順便拿掉已經不在的「等你確認」)。 已驗證: cargo test 876 個全過(含 featuremap::、layout_audit::、no_new_literal_sizes_radii_or_colours、the_phone_uses_the_same_design_spec);clippy 跟改之前一樣,沒有新警告;scratch 上用 desktop-shot 截了改前/改後(聊天、空白聊天、設定、工作流、允許卡片 1280×800 和 900×640、深色),允許卡片最後一行完整、沒有多出空白;手機頁面打開聊天、打字,送出鈕是圓的(border-radius 50%)。 未驗證: 沒有在你真的 Mac 上用真的資料看(只用示範資料和 scratch);允許卡片只改了高度估算和按鈕形狀,答案的路徑沒動,但它在審批卡片上,合併前請你看過;手機頁面其他畫面沒有一頁頁截。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
This commit is contained in:
parent
39e00b6e83
commit
550edc9c13
|
|
@ -301,7 +301,7 @@ AnyBot 是一個桌面聊天 App,介面和運作方式照 Grok Bot 重做。
|
|||
|
||||
### 外觀
|
||||
|
||||
- 外框圓角 20 px;正在輸入時框線變深。
|
||||
- 浮在聊天上的一張圓角卡片(圓角 14 px,跟手機同一張):細框線加一層柔和陰影,正在輸入時框線變深;+、麥克風、送出都是圓鈕。
|
||||
- 提示文字「傳訊息給 (Bot 名稱)」。
|
||||
- 從一行開始,跟著內容長高,最高 160 px,再多就在框內捲動。
|
||||
- 每個 Bot 各自保留打到一半的草稿;草稿會跟著存檔,重新啟動或切 Bot 都不会吃掉打到一半的字。
|
||||
|
|
@ -1762,7 +1762,7 @@ computer_use_screenshot、click、mouse_move、mouse_button(按住/放開)
|
|||
- **需要你允許**:不再是蓋住整個視窗的彈出視窗,改成固定在輸入框上方的黃色卡片,上面的聊天照樣看得到,下面的輸入框照樣可以打字告訴它怎麼改。輸入框空著時 Enter 允許、Esc 拒絕(卡片出現 0.6 秒後才算,免得原本要按的 Enter 誤答);游標在輸入框裡也一樣(以前輸入框先把 Enter 當成「送出」拿走,框是空的什麼都沒送出,也沒有允許)。框裡有字時 Enter 照樣是送出。要你親自處理的步驟(接管畫面)還是聊天裡的卡片。
|
||||
- **黃色只代表「需要你」**:允許卡片、臉上的黃點、側邊欄 Bot 上的黃點、設定裡「更新」旁的黃點(有新版)。有新訊息是強調色(黏土橘)小點。
|
||||
- **標題列**:Bot 的名字在左邊(按一下開對話詳細資訊),右邊「分享」和「⋯」不再有圓框;圖示線條粗一點(2.25)。
|
||||
- **新對話**:Bot 的臉放大、依時段的問候(早安/午安/晚上好/夜深了;看的是 設定 › 一般 的時區,不是這台電腦的系統時區)、一句「嗨,我是 …」和它的描述,下面三個可以直接點的開頭(點了把字放進輸入框)。
|
||||
- **新對話**:Bot 的臉放大、依時段的問候(早安/午安/晚上好/夜深了;看的是 設定 › 一般 的時區,不是這台電腦的系統時區)、一句「嗨,我是 …」和它的描述,下面三個可以直接點的開頭(一排細框膠囊,沒有底色、滑過才有;點了把字放進輸入框)。
|
||||
- **設定**:左邊分頁只有文字,選中的淡底粗字;每組設定一張白色細框卡片,一列一件事(左邊名稱、右邊控制項,名稱下最多一行小字,其餘說明在「?」裡);選項是分段按鈕,開關是黑軌白鈕。「一般」的名稱改成白話(聊天的顏色、用意思找記憶、Bot 可以翻的資料夾)。「整合」分成三頁(訊息管道、連接器、技能);訊息管道先列「已連接」(標記、名稱 · 種類、誰回覆、狀態、開關、⋯ 裡移除),「新增管道」是八個方塊,點了才在下面打開那一種的表單。權限頁的「直接操作」「自動審核」也是開關。
|
||||
- **手機**:顏色跟電腦一樣(設定 › 一般 › 外觀 的主題、底色、強調色、對比都照著穿;手機的「外觀」預設「跟著電腦」,也可以選跟著手機、淺色、深色)。你的訊息泡泡照「聊天的顏色」(預設淡灰)、Bot 的回覆不用泡泡、允許卡片是黃色細框、輸入框是底部一張圓角卡片;工作中在對話最後顯示 Bot 的小臉和跟電腦上一樣的那句「正在…」。
|
||||
- **自己進化**:一件事做了 5 步以上(操作電腦、網頁、指令,不算記憶和設定),回答完後在背景回頭看一次:這是在網站或程式上動手操作的事(填表、發文、回留言、上傳下載、改設定),就把這次真的成功的最短做法存成技能(用畫面上的名字,不寫編號和座標;繞路和失敗寫成「注意」;使用者說過的偏好寫進去);已經有同一件事的技能就合併成更好的一版,照著做而且很順就不動。回覆下面會多一行「(學會了新做法「…」)」或「(把做法「…」更新了)」。系統指示要 Bot 開始做事前先看技能清單、有符合的先 use_skill。實測(httpbin 訂 pizza,真的 Grok):第一次 11 步學到技能;第二次先讀技能、10 步 24 秒一次做完,回頭看後判斷不用改。
|
||||
|
|
@ -2160,7 +2160,8 @@ computer_use_screenshot、click、mouse_move、mouse_button(按住/放開)
|
|||
- 字級 7 階:說明 12(時間、標記、圖表軸)、小字 13(說明、次要)、介面 14(按鈕、清單、輸入框、設定列)、閱讀 16(回答、頁面內文、輸入框裡你打的字)、小標 18、中標 22、大標 28。
|
||||
- 行高:閱讀字 1.7 倍(16 px 字 27 px 行),介面字 20,小字 18,標題 26/30/36。
|
||||
- 間距:4、8、12、16、24、32。
|
||||
- 圓角三種:6(標籤、色塊、小控制項)、10(輸入框、按鈕、程式碼、提示框)、14(卡片、對話框、面板);膠囊和圓形全圓。
|
||||
- 圓角三種:6(標籤、色塊、小控制項)、10(輸入框、程式碼、提示框)、14(卡片、對話框、面板);按鈕、分段選擇是膠囊(跟手機、macOS 26 一樣:形狀本身就說「可以按」,不用框)。
|
||||
- 浮在上面的東西(聊天的輸入框、工作流畫布上的工具列和面板、選單)用一層柔和陰影浮起來(調色盤的 `shade`,手機的 `--shade`),不靠粗框線;平放的卡片用細框和底色分組。
|
||||
- 中文和英文用同一套字型(介面思源黑體、閱讀思源宋體),基準線和大小對得齊;缺的字用系統字型(蘋方等)補。程式碼用 **SF Mono**,沒有就用 Menlo。
|
||||
- 「·」分隔號前後不加空格。
|
||||
|
||||
|
|
@ -2173,7 +2174,7 @@ computer_use_screenshot、click、mouse_move、mouse_button(按住/放開)
|
|||
- **設定列**:左邊名稱 14 px(可以多一行 13 px 灰色狀態)和「?」說明,右邊開關、選單或按鈕;名稱太長就「…」,不會擠掉右邊。
|
||||
- **卡片**:一整塊有標題、有欄位的內容(Bot 設定的「Bot 資料」「頭像」等)。**卡片裡不再放卡片**(以前「瀏覽器設定檔」裡的兩個選項各自是一張小卡;「更新」頁每一列都是一張卡)。
|
||||
- **欄位**:上面 13 px 灰色小標,下面輸入框。**說明**:13 px 灰字、一行(長的滑過看全文;以前 12 px 更淡的灰、整段攤開)。設定列名稱旁的「?」只在滑鼠移到那一列時出現。
|
||||
- **按鈕**:實心(一個畫面一顆主要動作)、淡底、紅色;刪除這種不能回頭的按兩次。
|
||||
- **按鈕**:全是膠囊。實心(一個畫面一顆主要動作)、淡底、紅字(停止、移除、登出:能回頭、也不是那個地方的主要動作,所以不搶眼)、紅底(只給不能回頭的刪除);刪除這種不能回頭的按兩次。
|
||||
- 設定左邊的分頁:選中的是淡底加粗字(以前是一整顆黑色膠囊)。
|
||||
- 測試看守:畫面程式裡自己畫的「底色+外框」卡片只准變少(`kit.rs` 以外)。
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
## 子功能
|
||||
|
||||
- `workflow-canvas` 畫布:左上是名稱,按下去是選單(每個工作流和它的步驟數、新建工作流、版本歷史、重新命名、建立副本、刪除工作流);右上「聊天」(聊天放在旁邊或收起來)、「執行紀錄」、「▷ 執行工作流」(跑的時候變「■ 停止」)。點點底的畫布拖曳空白處移動、⌘+滾輪或捏合縮放;下面工具列「選取、拖曳|畫筆、便利貼、形狀、文字|搜尋|+ 新增節點」,左下「- 百分比 +|符合畫面|小地圖」。搜尋卡片和註解的字,Enter 跳到下一個。視窗窄時縮放列移到工具列上面。
|
||||
- `workflow-canvas` 畫布:左上是名稱,按下去是選單(每個工作流和它的步驟數、新建工作流、版本歷史、重新命名、建立副本、刪除工作流);右上「聊天」(聊天放在旁邊或收起來)、「執行紀錄」、「▷ 執行工作流」(跑的時候變淡底紅字的「■ 停止」)。點點底的畫布拖曳空白處移動、⌘+滾輪或捏合縮放;下面工具列「選取、拖曳|畫筆、便利貼、形狀、文字|搜尋|+ 新增節點」,左下「- 百分比 +|符合畫面|小地圖」。搜尋卡片和註解的字,Enter 跳到下一個。視窗窄時縮放列移到工具列上面。
|
||||
- `workflow-nodes` 卡片:觸發器(手動、定時(每天、每週…,寫「下次執行」)、Webhook(給一個呼叫網址和密碼)、GitHub(存放庫和事件:PR 合併、CI 失敗…);Slack、新信這些在聊天裡請 Bot 設,跟例行任務的事件觸發是同一套;事情發生時,發生了什麼交給第一步;都有「立即執行」)。「+ 新增節點」可以搜尋,分三組——輸入:提示詞(一段話交給下一步)、素材(檔案,Bot 收到附件);步驟:LLM(直接問模型,選模型、系統提示詞,不用 Bot)、助手(Bot 用它的工具做)、圖片、影片(請 Bot 做出檔案);流程:條件(成立走「是」、不成立走「否」,兩個點各拉一條線;「否」沒接就停下來說原因)、審批(停下來等你按繼續)、輸出(放進哪個 Bot 的聊天,和/或通知你,「{結果}」換成上一步結果的第一行)。舊的「檢查」就是條件,「交付」「通知你」併成輸出。從卡片底下的點拉到另一張卡就連線;不能連回觸發器、不能繞成一圈。點卡片在右邊改設定,選到的卡片上面有「複製」「刪除」;助手、LLM、圖片、影片、條件有「試跑這一步」(只跑這一步,用前一步上次的結果)。Delete 刪掉選到的卡片或線(觸發器刪不掉)。
|
||||
- `workflow-draw` 畫和註解:畫筆、便利貼(六種顏色,下面寫誰貼的,雙擊改字)、形狀、文字;點選後右邊換顏色、改文字、刪除。只是給人看,不會執行。
|
||||
- `workflow-run` 執行:照線從觸發器往下走(一張接到好幾張時,上面的先,再左邊)。Bot 步驟是那個 Bot 聊天裡的一則訊息「[工作流「名稱」第 k/n 步]…」加上上一步的結果(聊天裡泡泡上面一行小標「工作流「名稱」第 k/n 步」、淡色泡泡,結果只顯示前三行,滑過看全文),它這一輪最後的回答就是這一步的結果;它正忙就排在後面,等它做完手上那一輪。檢查要回「通過」才往下,否則停下並寫原因。等你確認:畫布上方一條「等你確認:…」,「繼續」/「停止」,並發通知(電腦和手機)。交付把結果放進那個 Bot 的聊天(它正在回答時,等這一輪結束才放);通知你發通知。每一步不另外通知「完成」,只有審批和輸出會通知;Bot 的步驟算沒人在看的一輪(卡在等允許 15 分鐘就結束)。一次只跑一個;排程到了自動跑。觸發器後面還沒有步驟時,按「執行工作流」只說「這個工作流還沒有步驟,沒有執行:…」,不記一次執行。停止時,還排在 Bot 後面的那一步問題直接拿掉,不會停掉 Bot 手上別的事。卡片上標完成、進行中、等你確認、失敗;「執行紀錄」留最近 20 次(誰開始的、每一步的結果、為什麼停);日程只放定時和觸發跑的那幾次。
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
- **聊天裡建立**(covers `workflow-chat`、`workflow-nodes`、`workflow-draw`):請 Bot 做一個早報工作流。指令:`$CTL phone send '幫我做早報工作流 [[call workflow {"action":"create","name":"Threads 早報","schedule":{"frequency":"daily","time":"09:00"},"steps":[{"kind":"step","prompt":"找 5 則熱門育兒討論,每則附連結"},{"kind":"check","condition":"每則都有連結"},{"kind":"approve","prompt":"要把早報傳給你嗎?"},{"kind":"notify","text":"早報好了:{結果}"}],"notes":[{"text":"週末改十點?","near":2}]}]]' && $CTL phone wait-text '已建立工作流 #1' --in '#msgs' 60 && $CTL phone shot workflow-create && $CTL state '.workflows[0] | {name, nodes: [.nodes[] | {id, t: .kind.type, x, y}], edges, notes: [.notes[] | {text, author, x, y}]}'`。看到:聊天裡「工作流」那一步完成,回答列出 #1 觸發器 → #2 … #5 和便利貼;state 裡五張卡 x 都是 0、y 每張差 190,線 1→2→3→4→5,便利貼在 #2 左邊、作者「驗證小幫手」。
|
||||
- **聊天裡修改**(covers `workflow-chat`、`workflow-versions`):在「等你確認」後面插一步交付,再貼一張綠色便利貼。指令:`$CTL phone send '確認後也放到聊天 [[call workflow {"action":"edit","steps":[{"kind":"deliver","after":4}],"notes":[{"text":"交付會放進這個聊天","near":4,"color":"green"}]}]]' && $CTL phone wait-text '已修改工作流 #1' --in '#msgs' 60 && $CTL state '.workflows[0] | {order: [.edges[] | [.from, .to]], ys: [.nodes[] | [.id, .y]], versions: (.versions | length)}'`。看到:回答「新增 #7;加了 1 張便利貼」;線 4→7→5,#5 往下移到 950、#7 在 760;versions 是 1(改之前的樣子)。
|
||||
- **聊天裡執行**(covers `workflow-run`、`workflow-chat`):檢查的回答指定成「通過」,請 Bot 跑一次。指令:`$CTL model-reply '步・檢查' '通過' && $CTL phone send '跑一次 [[call workflow {"action":"run"}]]' && $CTL phone wait-text '已開始執行「Threads 早報」' --in '#msgs' 60 && $CTL phone wait-text '[工作流「Threads 早報」第 1/5 步]' --in '#msgs' 60 && $CTL phone wait-text '步・檢查' --in '#msgs' 60 && $CTL wait-api /api/bots/1 '.messages[-1].text == "通過"' 60 && $CTL phone shot workflow-run`。看到:同一個聊天裡先是第 1/5 步的問題和 Bot 的回答,再是第 2/5 步・檢查和最後一則「通過」。
|
||||
- **畫布在聊天旁邊**(covers `workflow-canvas`、`workflow-run`、`workflow-draw`):在電腦上打開畫布。指令:要開視窗——`$CTL phone stop && $CTL stop && $CTL state '.workflows[0].runs[-1] | {state, at, by, steps: [.steps[] | [.node, .state]]}' && ABV_ALLOW_WINDOW=1 $CTL desktop-shot workflow-beside ANYBOT_SHOT_REAL=1 ANYBOT_SHOT_VIEW=workflow ANYBOT_SHOT_SIZE=1400x900 ANYBOT_SHOT_FRAMES=520`。看到:state 的 run 是 waiting、at 3、by「驗證小幫手」,#1–#3 done;左邊畫布「Threads 早報」,上方「等你確認:要把早報傳給你嗎? 繼續 停止」沒有蓋到卡片,觸發器、助手、條件標「完成」,審批是黃框;黃、綠便利貼在卡片左邊;右上「等你確認、執行紀錄、聊天、■ 停止」;右邊是驗證小幫手的聊天,最下面是「通過」。
|
||||
- **畫布在聊天旁邊**(covers `workflow-canvas`、`workflow-run`、`workflow-draw`):在電腦上打開畫布。指令:要開視窗——`$CTL phone stop && $CTL stop && $CTL state '.workflows[0].runs[-1] | {state, at, by, steps: [.steps[] | [.node, .state]]}' && ABV_ALLOW_WINDOW=1 $CTL desktop-shot workflow-beside ANYBOT_SHOT_REAL=1 ANYBOT_SHOT_VIEW=workflow ANYBOT_SHOT_SIZE=1400x900 ANYBOT_SHOT_FRAMES=520`。看到:state 的 run 是 waiting、at 3、by「驗證小幫手」,#1–#3 done;左邊畫布「Threads 早報」,上方「等你確認:要把早報傳給你嗎? 繼續 停止」沒有蓋到卡片,觸發器、助手、條件標「完成」,審批是黃框;黃、綠便利貼在卡片左邊;右上「執行紀錄、聊天、■ 停止」(停止是淡底紅字);右邊是驗證小幫手的聊天,最下面是「通過」。
|
||||
- **在旁邊聊、畫布跟著變**(covers `workflow-chat`、`workflow-canvas`):在旁邊的聊天打字請它加一步。指令:要開視窗——`ABV_ALLOW_WINDOW=1 $CTL desktop-shot workflow-live ANYBOT_SHOT_REAL=1 ANYBOT_SHOT_VIEW=workflow ANYBOT_SHOT_SIZE=1400x900 ANYBOT_SHOT_FRAMES=600 'ANYBOT_SHOT_CLICK=1180,847@525' 'ANYBOT_SHOT_TYPE=通知前先檢查格式 [[call workflow {"action":"edit","steps":[{"kind":"check","condition":"是條列清單","after":7}],"notes":[{"text":"這步是在聊天裡加的","near":7,"color":"blue"}]}]]@530' 'ANYBOT_SHOT_KEYS=Enter@540'`。看到:聊天裡「已修改工作流 #1…新增 #9」;畫布上交付下面多一張「條件 是條列清單」、左邊一張藍色便利貼,兩個都有黃色光圈;通知你往下移,整個縮到看得到。
|
||||
- **自己畫、拉線、搜尋**(covers `workflow-draw`、`workflow-nodes`、`workflow-canvas`):示範資料上貼便利貼打字、從交付底下的點拉線到通知你、搜尋「週末」。指令:要開視窗——`ABV_ALLOW_WINDOW=1 $CTL desktop-shot workflow-sticky ANYBOT_SHOT_VIEW=workflow ANYBOT_SHOT_SIZE=1400x900 ANYBOT_SHOT_FRAMES=44 'ANYBOT_SHOT_CLICK=720,860@20;450,600@26' 'ANYBOT_SHOT_TYPE=記得週末改時間@34' && ABV_ALLOW_WINDOW=1 $CTL desktop-shot workflow-link ANYBOT_SHOT_VIEW=workflow ANYBOT_SHOT_SIZE=1400x900 ANYBOT_SHOT_FRAMES=40 'ANYBOT_SHOT_DRAG=740,747>965,725@24' && ABV_ALLOW_WINDOW=1 $CTL desktop-shot workflow-search ANYBOT_SHOT_VIEW=workflow ANYBOT_SHOT_SIZE=1400x900 ANYBOT_SHOT_FRAMES=48 'ANYBOT_SHOT_CLICK=844,860@20' 'ANYBOT_SHOT_TYPE=週末@26' 'ANYBOT_SHOT_KEYS=Enter@32'`。看到:新的便利貼框著、裡面是「記得週末改時間」、作者 daniel,右邊便利貼的顏色和刪除;交付底下多一條線連到通知你(交付沒被拖走);搜尋框裡「週末」、旁邊「1/1」,畫面移到「週末改成十點」那張並選起來。版本歷史、選單、窄視窗:靠自動測試和版面檢查。
|
||||
- **新的節點和觸發器**(covers `workflow-nodes`):示範資料的第二個工作流。指令:要開視窗——`ABV_ALLOW_WINDOW=1 $CTL desktop-shot workflow-kinds ANYBOT_SHOT_VIEW=workflow ANYBOT_SHOT_TAB=2 ANYBOT_SHOT_SIZE=1400x900 ANYBOT_SHOT_FRAMES=30 && ABV_ALLOW_WINDOW=1 $CTL desktop-shot workflow-palette ANYBOT_SHOT_VIEW=workflow ANYBOT_SHOT_TAB=2 ANYBOT_SHOT_SIZE=1400x900 ANYBOT_SHOT_FRAMES=30 'ANYBOT_SHOT_CLICK=1060,860@18' && ABV_ALLOW_WINDOW=1 $CTL desktop-shot workflow-trigger ANYBOT_SHOT_VIEW=workflow ANYBOT_SHOT_TAB=2 ANYBOT_SHOT_SIZE=1400x900 ANYBOT_SHOT_FRAMES=30 'ANYBOT_SHOT_CLICK=942,135@18'`。看到:「PR 合併後的發布貼文」:觸發器寫「GitHub anybot/app:pr_merged」「事情發生時」,下面提示詞、LLM(主要 Bot 的模型)、條件(下面「是」「否」兩個點),是→圖片→審批→輸出、否→輸出(通知);新增節點是搜尋框和「輸入/步驟/流程」三組;點觸發器右邊是「GitHub」、存放庫、事件(PR 合併亮著)、Token。
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ details.dt>.dt-in{padding-left:var(--sp-4);margin-top:var(--sp-2)}
|
|||
.composer:focus-within{box-shadow:inset 0 0 0 1px var(--text4),0 2px 10px -2px var(--shade)}
|
||||
.composer.tall{border-radius:var(--r-l)}
|
||||
.composer textarea{flex:1;border:0;outline:0;background:none;resize:none;font-size:var(--fs-read);line-height:22px;max-height:140px;min-height:28px;padding:3px 4px}
|
||||
.cbtn{width:36px;height:36px;border-radius:var(--r-m);display:grid;place-items:center;flex:none;color:var(--text2)}
|
||||
.cbtn{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;flex:none;color:var(--text2)}
|
||||
.cbtn.plus{background:none}
|
||||
.cbtn.go{background:var(--bot,var(--primary));color:var(--bot-ink,var(--on-primary))}
|
||||
.cbtn.go:disabled{opacity:.35}
|
||||
|
|
|
|||
83
src/app.rs
83
src/app.rs
|
|
@ -4462,19 +4462,25 @@ impl App {
|
|||
});
|
||||
});
|
||||
ui.add_space(22.0);
|
||||
let fill = if tinted { crate::theme::mist(col, p) } else { p.hover };
|
||||
for words in EMPTY_STARTS {
|
||||
let words = t(words);
|
||||
let (rect, r) = ui.allocate_exact_size(vec2(ui.available_width().min(560.0), 48.0), egui::Sense::click());
|
||||
ui.painter().rect_filled(rect, R_L, if r.hovered() { fill.gamma_multiply(0.92).to_opaque().lerp_to_gamma(p.text, 0.04) } else { fill });
|
||||
ui.painter().text(rect.left_center() + vec2(18.0, 0.0), egui::Align2::LEFT_CENTER, &words, egui::FontId::proportional(FONT_BASE), p.text);
|
||||
if r.on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
|
||||
self.drafts.insert(bot.id, words);
|
||||
ui.memory_mut(|m| m.request_focus(egui::Id::unique(("composer", bot.id))));
|
||||
// The starters are shortcuts, not content: light capsules in a row (a hairline, no
|
||||
// fill — in the bot's colour under 「跟著 Bot」), filled only under the pointer.
|
||||
let (rest, edge) = if tinted { (crate::theme::mist(col, p), Stroke::NONE) } else { (Color32::TRANSPARENT, Stroke::new(1.0, p.border)) };
|
||||
ui.allocate_ui_with_layout(vec2(ui.available_width().min(560.0), 0.0), Layout::left_to_right(Align::Min).with_main_wrap(true), |ui| {
|
||||
ui.spacing_mut().item_spacing = vec2(8.0, 8.0);
|
||||
for words in EMPTY_STARTS {
|
||||
let words = t(words);
|
||||
let galley = ui.painter().layout_no_wrap(words.clone(), egui::FontId::proportional(FONT_BASE), p.text);
|
||||
let (rect, r) = ui.allocate_exact_size(vec2(galley.size().x + 32.0, 36.0), egui::Sense::click());
|
||||
let fill = if r.hovered() { if tinted { rest.lerp_to_gamma(p.text, 0.06) } else { p.hover } } else { rest };
|
||||
ui.painter().rect(rect, R_FULL, fill, edge, egui::StrokeKind::Inside);
|
||||
ui.painter().galley(rect.center() - galley.size() / 2.0, galley, p.text);
|
||||
if r.on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
|
||||
self.drafts.insert(bot.id, words);
|
||||
ui.memory_mut(|m| m.request_focus(egui::Id::unique(("composer", bot.id))));
|
||||
}
|
||||
}
|
||||
ui.add_space(8.0);
|
||||
}
|
||||
ui.add_space(6.0);
|
||||
});
|
||||
ui.add_space(14.0);
|
||||
{
|
||||
let runs = providers::runs_at(bot.provider, &providers::resolve_base(bot.provider, &self.state.provider(bot.provider).base_url));
|
||||
ui.label(RichText::new(format!("{} · {} · {}", bot.provider.label(), bot.model, t(runs.short()))).size(FONT_XS).color(p.text3)).on_hover_text(runs.words(self.brain_for_words().as_deref()));
|
||||
|
|
@ -4487,7 +4493,7 @@ impl App {
|
|||
if !providers::ready(bot.provider, &ps.api_key) {
|
||||
ui.add_space(10.0);
|
||||
let words = if bot.provider == ProviderKind::ChatGpt { t("用 ChatGPT 登入") } else { format!("設定 {} 的 API 金鑰", bot.provider.label()) };
|
||||
if ui.button(words).clicked() {
|
||||
if ui.add(egui::Button::new(words).corner_radius(R_FULL)).clicked() {
|
||||
self.show_settings = true;
|
||||
self.settings_tab = SettingsTab::Providers;
|
||||
self.settings_provider = bot.provider;
|
||||
|
|
@ -4495,6 +4501,12 @@ impl App {
|
|||
}
|
||||
}
|
||||
|
||||
/// Whether a card offers 「之後都直接操作,不再一個個問」: direct mode is off, and the
|
||||
/// managed settings let the person turn it (and this computer) on.
|
||||
fn offers_direct(&self) -> bool {
|
||||
!self.direct_on() && self.managed.direct.allows() && self.managed.local.allows()
|
||||
}
|
||||
|
||||
/// "The bot wants to …": allow once, always allow this kind, or say no.
|
||||
/// The question, the details and the buttons, shared by the chat card and the pop-up.
|
||||
fn approval_body(&self, ui: &mut egui::Ui, bot: &Bot, big: bool) -> Option<ApprovalAnswer> {
|
||||
|
|
@ -4548,13 +4560,13 @@ impl App {
|
|||
ui.spacing_mut().button_padding = vec2(14.0, 7.0);
|
||||
let scope_on = kind == ApprovalKind::Action && !grant.is_empty() && self.smart_flag.load(Ordering::Relaxed);
|
||||
let main = |label: &str, ui: &mut egui::Ui| {
|
||||
ui.add(egui::Button::new(RichText::new(t(label)).strong().family(crate::bold()).color(p.on_primary)).fill(p.primary).corner_radius(R_M).min_size(vec2(0.0, if big { 34.0 } else { 0.0 })))
|
||||
ui.add(egui::Button::new(RichText::new(t(label)).strong().family(crate::bold()).color(p.on_primary)).fill(p.primary).corner_radius(R_FULL).min_size(vec2(0.0, if big { 34.0 } else { 0.0 })))
|
||||
};
|
||||
if scope_on {
|
||||
if main("這輪都准", ui).on_hover_text(format!("這一輪之內{}這類操作都不再問你;下一輪會再問。(智慧模式)", grant_label(&grant))).clicked() {
|
||||
answer = Some(ApprovalAnswer::Scope(grant.clone()));
|
||||
}
|
||||
if ui.button(t("允許一次")).clicked() {
|
||||
if ui.add(egui::Button::new(t("允許一次")).corner_radius(R_FULL)).clicked() {
|
||||
answer = Some(ApprovalAnswer::Once);
|
||||
}
|
||||
} else if main("允許一次", ui).clicked() {
|
||||
|
|
@ -4567,11 +4579,11 @@ impl App {
|
|||
ApprovalKind::Action | ApprovalKind::Handoff | ApprovalKind::Question => None,
|
||||
};
|
||||
if let Some((label, why)) = always {
|
||||
if ui.button(t(&label)).on_hover_text(t(&why)).clicked() {
|
||||
if ui.add(egui::Button::new(t(&label)).corner_radius(R_FULL)).on_hover_text(t(&why)).clicked() {
|
||||
answer = Some(ApprovalAnswer::Always(grant.clone()));
|
||||
}
|
||||
}
|
||||
if ui.button(t("拒絕")).clicked() {
|
||||
if ui.add(egui::Button::new(t("拒絕")).corner_radius(R_FULL)).clicked() {
|
||||
answer = Some(ApprovalAnswer::Reject);
|
||||
}
|
||||
});
|
||||
|
|
@ -4583,7 +4595,7 @@ impl App {
|
|||
.color(p.text3));
|
||||
}
|
||||
// One click to work like the reference assistant: allow this and stop asking from now on.
|
||||
if !self.direct_on() && self.managed.direct.allows() && self.managed.local.allows() {
|
||||
if self.offers_direct() {
|
||||
ui.add_space(8.0);
|
||||
// (A way out of asking, offered quietly: grey, not a second call to action.)
|
||||
let b = crate::icons::label(ui, crate::icons::Icon::Zap, &t("之後都直接操作,不再一個個問"), FONT_SM, p.text2).interact(egui::Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
|
||||
|
|
@ -4632,7 +4644,9 @@ impl App {
|
|||
let reason = self.approvals.get(&bot.id).map(|a| a.reason.clone()).unwrap_or_default();
|
||||
// (And within what the chat column has left for it: room, less the card's edges and the space after.)
|
||||
let cap = (ui.ctx().content_rect().height() * 0.45).max(160.0).min(room - 48.0).max(72.0);
|
||||
let body = ask_dock_height(&reason, ui.available_width(), cap);
|
||||
// (Plus the line 「之後都直接操作」 when the card offers it: left out, the card's last line
|
||||
// was cut off at the bottom.)
|
||||
let body = (ask_dock_height(&reason, ui.available_width(), f32::INFINITY) + if self.offers_direct() { ASK_DIRECT_ROW } else { 0.0 }).min(cap);
|
||||
needs_you_card(ui, p, |ui| {
|
||||
ui.set_width(ui.available_width());
|
||||
egui::ScrollArea::vertical().id_salt(("ask-dock", bot.id)).max_height(body).min_scrolled_height(body).auto_shrink([false, false]).show(ui, |ui| {
|
||||
|
|
@ -4811,13 +4825,13 @@ impl App {
|
|||
ui.spacing_mut().button_padding = vec2(14.0, 7.0);
|
||||
let go = if last { t("送出") } else { t("下一題") };
|
||||
let (fill, ink) = if ready { (p.primary, p.on_primary) } else { (p.active, p.text3) };
|
||||
if ui.add_enabled(ready, egui::Button::new(RichText::new(go).strong().family(crate::bold()).color(ink)).fill(fill).corner_radius(R_M).min_size(vec2(0.0, 34.0))).clicked() {
|
||||
if ui.add_enabled(ready, egui::Button::new(RichText::new(go).strong().family(crate::bold()).color(ink)).fill(fill).corner_radius(R_FULL).min_size(vec2(0.0, 34.0))).clicked() {
|
||||
act = Some(Act::Next);
|
||||
}
|
||||
if step > 0 && ui.button(t("上一題")).clicked() {
|
||||
if step > 0 && ui.add(egui::Button::new(t("上一題")).corner_radius(R_FULL)).clicked() {
|
||||
act = Some(Act::Back);
|
||||
}
|
||||
if ui.button(t("略過")).on_hover_text(t("不回答這張卡片。也可以直接在下面打字跟它說。")).clicked() {
|
||||
if ui.add(egui::Button::new(t("略過")).corner_radius(R_FULL)).on_hover_text(t("不回答這張卡片。也可以直接在下面打字跟它說。")).clicked() {
|
||||
act = Some(Act::Skip);
|
||||
}
|
||||
});
|
||||
|
|
@ -4958,13 +4972,13 @@ impl App {
|
|||
}
|
||||
ui.add_space(10.0);
|
||||
ui.horizontal(|ui| {
|
||||
if ui.button(t("跳過")).on_hover_text(t("取消此要求且不執行該步驟;Bot 會跳過它並繼續")).clicked() {
|
||||
if ui.add(egui::Button::new(t("跳過")).corner_radius(R_FULL)).on_hover_text(t("取消此要求且不執行該步驟;Bot 會跳過它並繼續")).clicked() {
|
||||
act = Some(Act::Skip);
|
||||
}
|
||||
if ui.button(t("我完成了")).clicked() {
|
||||
if ui.add(egui::Button::new(t("我完成了")).corner_radius(R_FULL)).clicked() {
|
||||
act = Some(Act::Done);
|
||||
}
|
||||
if shows && ui.add(egui::Button::new(RichText::new(t("接管")).color(p.on_primary)).fill(p.primary).corner_radius(R_M)).clicked() {
|
||||
if shows && ui.add(egui::Button::new(RichText::new(t("接管")).color(p.on_primary)).fill(p.primary).corner_radius(R_FULL)).clicked() {
|
||||
act = Some(Act::TakeOver);
|
||||
}
|
||||
});
|
||||
|
|
@ -5262,11 +5276,14 @@ impl App {
|
|||
self.face_dock(ui, bot);
|
||||
// What is left for the box: past it, the words scroll inside it.
|
||||
let box_room = cap - (ui.cursor().top() - composer_top) - below - 16.0;
|
||||
// The input: one box with an ink edge — +, the words, the mic, and a button in the
|
||||
// bot's colour (voice chat while empty, send ↑ once there is something to send).
|
||||
// The input: one box floating over the chat — lifted by a soft shadow with a hairline
|
||||
// edge that darkens while you type (as on the phone) — +, the words, the mic, and a
|
||||
// round button in the bot's colour (voice chat while empty, send ↑ once there is
|
||||
// something to send).
|
||||
let input = Frame::new()
|
||||
.fill(p.elevated)
|
||||
.stroke(Stroke::new(1.5, if had_focus { p.text } else { p.text.gamma_multiply(0.45) }))
|
||||
.stroke(Stroke::new(1.0, if had_focus { p.text.gamma_multiply(0.4) } else { p.border }))
|
||||
.shadow(kit::lift(p))
|
||||
.corner_radius(R_L)
|
||||
.inner_margin(Margin { left: 8, right: 8, top: 8, bottom: 8 })
|
||||
.show(ui, |ui| {
|
||||
|
|
@ -6442,7 +6459,7 @@ impl App {
|
|||
}
|
||||
});
|
||||
card_row(ui, p, "外殼顏色重設", "", "底色、強調色、對比回到預設(紙)。", |ui| {
|
||||
if ui.button(t("重設")).clicked() {
|
||||
if ui.add(egui::Button::new(t("重設")).corner_radius(R_FULL)).clicked() {
|
||||
self.state.shell_tone = 1.0;
|
||||
self.state.shell_accent = "clay".into();
|
||||
self.state.shell_contrast = 1.0;
|
||||
|
|
@ -8413,6 +8430,10 @@ fn ask_dock_height(reason: &str, width: f32, cap: f32) -> f32 {
|
|||
(wrapped_lines(detail, (width - 92.0).max(120.0), cw) * 17.0 + 168.0).min(cap)
|
||||
}
|
||||
|
||||
/// What the card's 「之後都直接操作」 line adds past `ask_dock_height`'s guess (measured: the
|
||||
/// guess already leaves a little room under the last line).
|
||||
const ASK_DIRECT_ROW: f32 = 14.0;
|
||||
|
||||
/// Under the words in the composer before it has been measured: the frame's bottom (8 + its
|
||||
/// edge), and the line and space under the box (see composer).
|
||||
const COMPOSER_BELOW: f32 = 8.0 + 1.5 + 4.0 + 20.0 + 10.0;
|
||||
|
|
@ -8454,14 +8475,14 @@ const EMPTY_STARTS: [&str; 3] = ["幫我規劃這個週末的行程", "把這段
|
|||
fn round_tool(ui: &mut egui::Ui, icon: crate::icons::Icon, fill: Color32, ink: Color32) -> egui::Response {
|
||||
let (rect, r) = ui.allocate_exact_size(vec2(28.0, 28.0), egui::Sense::click());
|
||||
let f = if r.hovered() { fill.gamma_multiply(0.82).to_opaque().lerp_to_gamma(fill, 0.3) } else { fill };
|
||||
ui.painter().rect_filled(rect, R_M, f);
|
||||
ui.painter().rect_filled(rect, R_FULL, f);
|
||||
crate::icons::paint(ui.painter(), egui::Rect::from_center_size(rect.center(), vec2(15.0, 15.0)), icon, ink);
|
||||
r.on_hover_cursor(egui::CursorIcon::PointingHand)
|
||||
}
|
||||
|
||||
/// A 36 px rounded button with a hairline border (the original's 分享 / ⋯).
|
||||
fn pill_text(ui: &mut egui::Ui, text: &str, p: Palette) -> egui::Response {
|
||||
ui.add(egui::Button::new(RichText::new(text).size(FONT_BASE).color(p.text)).fill(Color32::TRANSPARENT).stroke(Stroke::NONE).corner_radius(R_M).min_size(vec2(0.0, 36.0)))
|
||||
ui.add(egui::Button::new(RichText::new(text).size(FONT_BASE).color(p.text)).fill(Color32::TRANSPARENT).stroke(Stroke::NONE).corner_radius(R_FULL).min_size(vec2(0.0, 36.0)))
|
||||
}
|
||||
|
||||
fn pill_icon(ui: &mut egui::Ui, icon: crate::icons::Icon, p: Palette) -> egui::Response {
|
||||
|
|
|
|||
|
|
@ -571,7 +571,7 @@ impl App {
|
|||
ui.label(RichText::new(&m.text).size(FONT_SM).color(p.text2));
|
||||
if can_go_on {
|
||||
ui.add_space(6.0);
|
||||
go_on = ui.button(RichText::new(t("繼續")).size(FONT_SM)).clicked();
|
||||
go_on = ui.add(egui::Button::new(RichText::new(t("繼續")).size(FONT_SM)).corner_radius(R_FULL)).clicked();
|
||||
}
|
||||
});
|
||||
ui.add_space(10.0);
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ impl App {
|
|||
for c in &ssh {
|
||||
let mut remove = false;
|
||||
sec_row_s(ui, p, &c.name, &format!("SSH · {}", c.ssh_target), "", |ui| {
|
||||
if ui.add(egui::Button::new(RichText::new(t("移除")).color(p.danger)).corner_radius(R_M)).on_hover_text(format!("{} {}", t("移除"), c.name)).clicked() {
|
||||
if ui.add(danger_text_button("移除", p)).on_hover_text(format!("{} {}", t("移除"), c.name)).clicked() {
|
||||
remove = true;
|
||||
}
|
||||
});
|
||||
|
|
@ -468,7 +468,7 @@ impl App {
|
|||
// 更新 Bot 的電腦: two clicks (the first arms it for 3 s).
|
||||
sec_row(ui, p, "更新 Bot 的電腦", "更新你的 Bot 共用的電腦。你的檔案和登入資訊會保留,但已安裝的應用程式和套件會被移除。所有 Bot 會一起更新。", |ui| {
|
||||
let b = if armed {
|
||||
egui::Button::new(RichText::new(t("再點選一次以確認")).color(p.danger)).fill(p.danger.gamma_multiply(0.14)).corner_radius(R_M).min_size(vec2(64.0, 30.0))
|
||||
danger_text_button("再點選一次以確認", p).fill(p.danger.gamma_multiply(0.14))
|
||||
} else {
|
||||
secondary_button("更新")
|
||||
};
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ impl App {
|
|||
crate::icons::paint(ui.painter(), egui::Rect::from_center_size(rect.center_top() + vec2(0.0, 26.0), vec2(20.0, 20.0)), crate::icons::Icon::Upload, if hovering { p.accent } else { p.text3 });
|
||||
ui.painter().text(rect.center_top() + vec2(0.0, 50.0), egui::Align2::CENTER_CENTER, t(if hovering { "放開就傳送" } else { "把檔案拖到這裡" }), egui::FontId::proportional(FONT_BASE), p.text2);
|
||||
let btn = egui::Rect::from_center_size(rect.center_top() + vec2(0.0, 78.0), vec2(96.0, 26.0));
|
||||
if ui.put(btn, egui::Button::new(RichText::new(t("選擇檔案…")).size(FONT_SM)).corner_radius(R_M)).clicked() {
|
||||
if ui.put(btn, egui::Button::new(RichText::new(t("選擇檔案…")).size(FONT_SM)).corner_radius(R_FULL)).clicked() {
|
||||
if pg.to.is_empty() {
|
||||
pg.note = t("先選要傳到哪一台");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ pub(super) fn card_row(ui: &mut egui::Ui, p: Palette, label: &str, sub: &str, he
|
|||
/// A choice among a few: the one chosen is the raised, bold one. Returns a new choice.
|
||||
pub(super) fn segmented<T: PartialEq + Copy>(ui: &mut egui::Ui, p: Palette, cur: T, options: &[(T, &str)]) -> Option<T> {
|
||||
let mut picked = None;
|
||||
Frame::new().fill(p.active).corner_radius(R_M).inner_margin(Margin::same(3)).show(ui, |ui| {
|
||||
Frame::new().fill(p.active).corner_radius(R_FULL).inner_margin(Margin::same(3)).show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.spacing_mut().item_spacing.x = 2.0;
|
||||
// (In a row laid out from the right, the first choice is still the left one.)
|
||||
|
|
@ -145,7 +145,7 @@ pub(super) fn segmented<T: PartialEq + Copy>(ui: &mut egui::Ui, p: Palette, cur:
|
|||
let on = *v == cur;
|
||||
let text = RichText::new(t(label)).size(FONT_SM).color(if on { p.text } else { p.text2 });
|
||||
let text = if on { text.family(crate::bold()) } else { text };
|
||||
if ui.add(egui::Button::new(text).fill(if on { p.elevated } else { Color32::TRANSPARENT }).stroke(Stroke::NONE).corner_radius(R_M).min_size(vec2(0.0, 26.0))).clicked() && !on {
|
||||
if ui.add(egui::Button::new(text).fill(if on { p.elevated } else { Color32::TRANSPARENT }).stroke(Stroke::NONE).corner_radius(R_FULL).min_size(vec2(0.0, 26.0))).clicked() && !on {
|
||||
picked = Some(*v);
|
||||
}
|
||||
}
|
||||
|
|
@ -300,9 +300,15 @@ pub(super) fn fold_title(ui: &mut egui::Ui, p: Palette, id: impl std::hash::Hash
|
|||
}
|
||||
|
||||
/// Something floating over a canvas (工作流: the toolbar, the zoom, the settings at the right,
|
||||
/// the 等你確認 bar): the raised fill, a thin edge, large corners.
|
||||
/// the 等你確認 bar): the raised fill, a thin edge, large corners, and the soft shadow that
|
||||
/// says it floats (the same lift as the chat's input).
|
||||
pub(super) fn floating<R>(ui: &mut egui::Ui, p: Palette, edge: Color32, margin: Margin, body: impl FnOnce(&mut egui::Ui) -> R) -> egui::InnerResponse<R> {
|
||||
Frame::new().fill(p.elevated).stroke(Stroke::new(1.0, edge)).corner_radius(R_L).inner_margin(margin).show(ui, body)
|
||||
Frame::new().fill(p.elevated).stroke(Stroke::new(1.0, edge)).shadow(lift(p)).corner_radius(R_L).inner_margin(margin).show(ui, body)
|
||||
}
|
||||
|
||||
/// The shadow under what floats over the page: one soft lift for all of it.
|
||||
pub(super) fn lift(p: Palette) -> egui::epaint::Shadow {
|
||||
egui::epaint::Shadow { offset: [0, 2], blur: 14, spread: 0, color: p.shade }
|
||||
}
|
||||
|
||||
/// The card of something waiting for you — an approval, a question, a step handed to you on a
|
||||
|
|
@ -382,16 +388,27 @@ pub(super) fn field_label(ui: &mut egui::Ui, text: &str, p: Palette) {
|
|||
ui.add_space(sp::S1 * 0.5);
|
||||
}
|
||||
|
||||
// Buttons are capsules (as on the phone, and as macOS 26 draws them): the shape alone says
|
||||
// "press me", so a button never needs a border. One filled button per place — the thing to
|
||||
// do; the rest are quiet.
|
||||
|
||||
pub(super) fn primary_button(text: &str, p: Palette) -> egui::Button<'static> {
|
||||
egui::Button::new(RichText::new(t(text)).color(p.on_primary).strong().family(crate::bold())).fill(p.primary).corner_radius(R_M).min_size(vec2(72.0, 30.0))
|
||||
egui::Button::new(RichText::new(t(text)).color(p.on_primary).strong().family(crate::bold())).fill(p.primary).corner_radius(R_FULL).min_size(vec2(72.0, 30.0))
|
||||
}
|
||||
|
||||
pub(super) fn secondary_button(text: &str) -> egui::Button<'static> {
|
||||
egui::Button::new(t(text)).corner_radius(R_M).min_size(vec2(64.0, 30.0))
|
||||
egui::Button::new(t(text)).corner_radius(R_FULL).min_size(vec2(64.0, 30.0))
|
||||
}
|
||||
|
||||
/// Filled red: only where pressing it destroys something and that is the point of the place.
|
||||
pub(super) fn danger_button(text: &str, p: Palette) -> egui::Button<'static> {
|
||||
egui::Button::new(RichText::new(t(text)).color(Color32::WHITE).strong().family(crate::bold())).fill(p.danger).corner_radius(R_M).min_size(vec2(72.0, 30.0))
|
||||
egui::Button::new(RichText::new(t(text)).color(Color32::WHITE).strong().family(crate::bold())).fill(p.danger).corner_radius(R_FULL).min_size(vec2(72.0, 30.0))
|
||||
}
|
||||
|
||||
/// A quiet button in red words (停止, 移除, 登出): it can undo something, but it is not what
|
||||
/// the place is for, so it does not shout.
|
||||
pub(super) fn danger_text_button(text: &str, p: Palette) -> egui::Button<'static> {
|
||||
egui::Button::new(RichText::new(t(text)).color(p.danger)).corner_radius(R_FULL).min_size(vec2(64.0, 30.0))
|
||||
}
|
||||
|
||||
/// The bottom bar of a dialog: a line above, buttons laid out right to left.
|
||||
|
|
|
|||
|
|
@ -912,7 +912,7 @@ impl App {
|
|||
ui.label(RichText::new(t("登出帳號")).size(FONT_SM).strong().family(crate::bold()));
|
||||
help_mark(ui, "這台電腦會從帳號移除:手機從外面連、裝置連結、分享都會斷。這台的 Bot 和聊天還在。", p);
|
||||
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
|
||||
if ui.add(egui::Button::new(RichText::new(t("登出")).color(p.danger)).corner_radius(R_M).min_size(vec2(64.0, 30.0))).clicked() {
|
||||
if ui.add(danger_text_button("登出", p)).clicked() {
|
||||
let keep_name = self.state.remote.host_name.clone();
|
||||
// Say goodbye to the account server: the machine's registration is
|
||||
// removed, so its key dies with the sign-out.
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ impl App {
|
|||
}
|
||||
match live {
|
||||
Some(_) => {
|
||||
if ui.add(danger_button("■ 停止", p)).clicked() {
|
||||
if ui.add(danger_text_button("■ 停止", p)).clicked() {
|
||||
let (ctx, id) = (ui.ctx().clone(), self.wf.current);
|
||||
self.wf_do(&ctx, id, "stop");
|
||||
}
|
||||
|
|
@ -1654,7 +1654,7 @@ impl App {
|
|||
}
|
||||
}
|
||||
});
|
||||
if !self.mir.on && ui.button(t("選檔案…")).clicked() {
|
||||
if !self.mir.on && ui.add(egui::Button::new(t("選檔案…")).corner_radius(R_FULL)).clicked() {
|
||||
for f in crate::attach::pick_files() {
|
||||
let f = f.display().to_string();
|
||||
if !files.contains(&f) {
|
||||
|
|
|
|||
11
src/theme.rs
11
src/theme.rs
|
|
@ -7,6 +7,11 @@ use eframe::egui::Color32;
|
|||
// --fs-* --lh-read --sp-* --r-*;`the_phone_uses_the_same_design_spec` 比對兩邊)。
|
||||
// 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。
|
||||
// 畫面上的字級、圓角只從這裡拿(`no_new_literal_sizes_radii_or_colours` 看守)。
|
||||
// 三條第一性原理(2026-11 這一版的樣子,電腦和手機一樣):
|
||||
// 1. 浮的東西用影子浮起來(輸入框、畫布上的工具列、選單:`shade`),平放的用底色和髮絲線分組,
|
||||
// 不畫粗框。
|
||||
// 2. 按鈕是膠囊、圓鈕是圓的:形狀本身就說「可以按」。一個地方只有一顆實心按鈕。
|
||||
// 3. 顏色只給意思:強調色、要你處理的黃、壞事的紅;能回頭的停止、移除用紅字不用紅底。
|
||||
|
||||
/// 字級(px)。介面用思源黑體,閱讀(回答、頁面)用思源宋體。
|
||||
pub mod fs {
|
||||
|
|
@ -98,6 +103,9 @@ pub struct Palette {
|
|||
pub grid: Color32,
|
||||
/// Up / good (charts, stat tiles). Down and bad is `danger`.
|
||||
pub up: Color32,
|
||||
/// The shadow under what floats over the page (the input, a canvas toolbar): things that
|
||||
/// float are lifted by a soft shadow, not drawn round with a line (手機的 --shade).
|
||||
pub shade: Color32,
|
||||
}
|
||||
|
||||
const fn hexa(r: u8, g: u8, b: u8, a: u8) -> Color32 {
|
||||
|
|
@ -134,6 +142,7 @@ pub const LIGHT: Palette = Palette {
|
|||
],
|
||||
grid: hexa(0x25, 0x22, 0x1f, 0x10),
|
||||
up: hexa(0x2e, 0x7d, 0x3f, 0xff),
|
||||
shade: hexa(0x24, 0x1f, 0x1a, 0x1c),
|
||||
};
|
||||
|
||||
// From the original's renderer (index.eager-common: appearance primitives dark neutral/0..6 and the
|
||||
|
|
@ -172,6 +181,7 @@ pub const DARK: Palette = Palette {
|
|||
],
|
||||
grid: hexa(0xf2, 0xf0, 0xeb, 0x14),
|
||||
up: hexa(0x6f, 0xb9, 0x7d, 0xff),
|
||||
shade: hexa(0x00, 0x00, 0x00, 0x60),
|
||||
};
|
||||
|
||||
/// A bot's colour as a quiet background (its selected tile, its cards): a little of it over the
|
||||
|
|
@ -272,6 +282,7 @@ fn build(ink: Color32, paper: Color32, accent: Color32, danger: Color32, up: Col
|
|||
chart_cat: cat,
|
||||
grid: with(ink, (14.0 * contrast) as u8),
|
||||
up,
|
||||
shade: if dark { with(rgb(0, 0, 0), 0x60) } else { with(mix(ink, rgb(0, 0, 0), 0.4), (28.0 * contrast) as u8) },
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue