diff --git a/Sources/WeiBei/Resources/Brand/weibei-mark-reversed.png b/Sources/WeiBei/Resources/Brand/weibei-mark-reversed.png new file mode 100644 index 000000000..f6890c92d Binary files /dev/null and b/Sources/WeiBei/Resources/Brand/weibei-mark-reversed.png differ diff --git a/Sources/WeiBei/Resources/Brand/weibei-mark.png b/Sources/WeiBei/Resources/Brand/weibei-mark.png new file mode 100644 index 000000000..ab91fbc5f Binary files /dev/null and b/Sources/WeiBei/Resources/Brand/weibei-mark.png differ diff --git a/Sources/WeiBei/Resources/Editor/editor.js b/Sources/WeiBei/Resources/Editor/editor.js index f3daa3b6a..2e8b41c31 100644 --- a/Sources/WeiBei/Resources/Editor/editor.js +++ b/Sources/WeiBei/Resources/Editor/editor.js @@ -3849,7 +3849,7 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, `).replace(/\n{2,}/g,` `).trim(),fur=e=>((e.textBetween?e.textBetween(0,e.content.size,` `):e.textContent||"").split(` -`)[0]||"").trimStart(),dur=e=>{let t="";return e.descendants(r=>{if(t)return!1;if(r.type?.name!=="paragraph")return!0;let n=(r.textContent||"").trimStart();return n?(t=n,!1):!0}),t},pur=e=>fur(e).match(foe)||dur(e).match(foe),tit=e=>e==="blockquote"||e==="block_quote",mur=(e,t,r)=>{let n=t.textBetween?t.textBetween(0,t.content.size,""):t.textContent||"",i=n.match(cur);if(!i)return;let a=r+1,s=a+i[0].length;Zi(e,a,s,"weibei-callout-marker");let o=n.match(uur);if(!o)return;let l=a+o[0].length;l>s&&Zi(e,s,l,"weibei-callout-heading-source")},gur=(e,t,r)=>{for(let n of t.matchAll(mit)){let i=n[1]?.length||0,a=r+(n.index||0)+i,s=r+(n.index||0)+n[0].length;Zi(e,a,s,"weibei-callout-marker")}},yit=e=>e==="inkstone"?"inkstone":"paper",U2=yit(window.weiBeiTheme),yur=()=>U2==="inkstone"?{background:"#151515",primaryColor:"#1c1c1c",primaryTextColor:"#d7cbb0",primaryBorderColor:"#3a3328",lineColor:"#8b5e3c",secondaryColor:"#222222",tertiaryColor:"#171717",fontFamily:'-apple-system, BlinkMacSystemFont, "Songti SC", serif'}:{background:"#fbf5e8",primaryColor:"#f6eddc",primaryTextColor:"#2e261f",primaryBorderColor:"#cbb79b",lineColor:"#7a6250",secondaryColor:"#efe4d2",tertiaryColor:"#f8f0e1",fontFamily:'-apple-system, BlinkMacSystemFont, "Songti SC", serif'},vur=()=>{loe.initialize({startOnLoad:!1,securityLevel:"strict",theme:"base",themeVariables:yur()})},vit=e=>{U2=yit(e),document.documentElement.dataset.weibeiTheme=U2,document.body&&(document.body.dataset.weibeiTheme=U2),vur()};vit(U2);var Cp=e=>{if(window.WeiBeiEditorBootFailed){window.WeiBeiEditorBootFailed(e);return}let t=document.querySelector("#editor");t&&(t.innerHTML=`
${xc("bootFailed")}
+`)[0]||"").trimStart(),dur=e=>{let t="";return e.descendants(r=>{if(t)return!1;if(r.type?.name!=="paragraph")return!0;let n=(r.textContent||"").trimStart();return n?(t=n,!1):!0}),t},pur=e=>fur(e).match(foe)||dur(e).match(foe),tit=e=>e==="blockquote"||e==="block_quote",mur=(e,t,r)=>{let n=t.textBetween?t.textBetween(0,t.content.size,""):t.textContent||"",i=n.match(cur);if(!i)return;let a=r+1,s=a+i[0].length;Zi(e,a,s,"weibei-callout-marker");let o=n.match(uur);if(!o)return;let l=a+o[0].length;l>s&&Zi(e,s,l,"weibei-callout-heading-source")},gur=(e,t,r)=>{for(let n of t.matchAll(mit)){let i=n[1]?.length||0,a=r+(n.index||0)+i,s=r+(n.index||0)+n[0].length;Zi(e,a,s,"weibei-callout-marker")}},yit=e=>(e==="inkstone"||e==="stele")?"inkstone":"paper",U2=yit(window.weiBeiTheme),yur=()=>U2==="inkstone"?{background:"#151515",primaryColor:"#1c1c1c",primaryTextColor:"#d7cbb0",primaryBorderColor:"#3a3328",lineColor:"#8b5e3c",secondaryColor:"#222222",tertiaryColor:"#171717",fontFamily:'-apple-system, BlinkMacSystemFont, "Songti SC", serif'}:{background:"#fbf5e8",primaryColor:"#f6eddc",primaryTextColor:"#2e261f",primaryBorderColor:"#cbb79b",lineColor:"#7a6250",secondaryColor:"#efe4d2",tertiaryColor:"#f8f0e1",fontFamily:'-apple-system, BlinkMacSystemFont, "Songti SC", serif'},vur=()=>{loe.initialize({startOnLoad:!1,securityLevel:"strict",theme:"base",themeVariables:yur()})},vit=e=>{U2=yit(e),document.documentElement.dataset.weibeiTheme=U2,document.body&&(document.body.dataset.weibeiTheme=U2),vur()};vit(U2);var Cp=e=>{if(window.WeiBeiEditorBootFailed){window.WeiBeiEditorBootFailed(e);return}let t=document.querySelector("#editor");t&&(t.innerHTML=`${xc("bootFailed")}
${String(e?.stack||e)}`)};window.addEventListener("error",e=>Cp(e.error||e.message));window.addEventListener("unhandledrejection",e=>Cp(e.reason));var Qo=(e,t={})=>{hit?.[e]?.postMessage({...t,documentID:fit})};document.documentElement.dataset.weibeiCompactPreview=aE?"true":"false";var rit=0,doe=0,lP=new Set,xit=()=>[document.querySelector("#editor"),document.querySelector(".milkdown"),document.querySelector(".ProseMirror")].filter(Boolean),xur=e=>{let t=e.getBoundingClientRect?.();return Math.max(0,e.scrollHeight||0,e.offsetHeight||0,e.clientHeight||0,t?.height||0)},Lk=()=>{aE&&(window.cancelAnimationFrame(rit),rit=window.requestAnimationFrame(()=>{let e=xit(),t=Math.ceil(Math.max(1,...e.map(xur)));window.WeiBeiCompactPreviewHeight=t,window.WeiBeiCompactPreviewMeasuredAt=Date.now(),!(Math.abs(t-doe)<1)&&(doe=t,Qo("contentHeightChanged",{height:t}))}))},fP=()=>{if(aE){for(let e of lP)window.clearTimeout(e);lP.clear(),doe=0,Lk(),window.requestAnimationFrame(()=>{Lk(),window.requestAnimationFrame(Lk)});for(let e of[40,120,240,480]){let t=window.setTimeout(()=>{lP.delete(t),Lk()},e);lP.add(t)}document.fonts?.ready?.then(()=>{aE&&Lk()}).catch(()=>{})}},bur=()=>{if(aE){if(window.ResizeObserver){let e=new ResizeObserver(Lk);xit().forEach(t=>e.observe(t))}fP()}},bit=()=>{let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.getRangeAt(0).getBoundingClientRect();return!t||t.width+t.height===0?null:{x:t.left+t.width/2,y:t.bottom,width:t.width,height:t.height}},wur=(e,t)=>{let r=0;for(let n=t-1;n>=0&&e[n]==="\\";n-=1)r+=1;return r%2===1},nit=(e,t,r)=>{let n=e.indexOf(t,r);for(;n>=0&&wur(e,n);)n=e.indexOf(t,n+t.length);return n},kur=(e,t)=>{let r=String(e||""),n="",i=0;for(;iString(e||"").replace(/\\\[\\\[/g,"[[").replace(/\\\]\\\]/g,"]]").replace(/\\=\\=([^=\n]+?)\\=\\=/g,"==$1==").replace(/\^\\\[/g,"^[").replace(/(^|\s)\\#(?=[\p{L}\p{N}_/-])/gu,"$1#").replace(/\\\$(?=\d)/g,"$").replace(new RegExp(`^(\\s*(?:>\\s*)*)\\\\(\\[!(?:${sE})\\])`,"gim"),"$1$2"),wit=(e,t)=>{let r=String(e||"").split(/(\r?\n)/),n=!1,i="",a=0,s="";for(let o=0;o\s*)*(`{3,}|~{3,})/);if(h){n?h[1][0]===i&&h[1].length>=a&&(n=!1,a=0):(n=!0,i=h[1][0],a=h[1].length),s+=l+u;continue}if(n){s+=l+u;continue}let f=kur(l,t);s+=f,f.endsWith(`
`)&&u||(s+=u)}return s},Cur=e=>wit(e,Tur),Sur=e=>String(e||"").replace(/
[ \t]*/gi,`
`),pP=e=>wit(e,Sur),kit=e=>{let t=e||"",r=t.match(/^(---\n[\s\S]*?\n---)(?:\n+|$)/);return r?{frontmatter:r[1],body:t.slice(r[0].length)}:{frontmatter:"",body:t}},boe=e=>{let t=Cur(e),r=Ik?t.replace(/^\n+/,""):t;return Ik?`${Ik}
diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift
index 8e3a17127..53cc2675b 100644
--- a/Sources/WeiBei/Stores/WorkspaceStore.swift
+++ b/Sources/WeiBei/Stores/WorkspaceStore.swift
@@ -477,6 +477,7 @@ final class WorkspaceStore: ObservableObject {
)
try? FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true)
load()
+ WeiBeiThemeRuntime.mode = appearanceMode
loadSelectionAskThreadsIfNeeded()
let recoveredPendingNotebookRename = recoverPendingNotebookRenameIfNeeded()
let resolvedImportedFileBookmarks = resolvePersistedImportedFileBookmarks()
@@ -2921,13 +2922,16 @@ final class WorkspaceStore: ObservableObject {
func toggleAppearanceMode() {
- appearanceMode = appearanceMode.toggled
- save()
+ setAppearanceMode(appearanceMode.toggled)
}
func setAppearanceMode(_ mode: WeiBeiAppearanceMode) {
- guard appearanceMode != mode else { return }
+ guard appearanceMode != mode else {
+ WeiBeiThemeRuntime.mode = mode
+ return
+ }
appearanceMode = mode
+ WeiBeiThemeRuntime.mode = mode
save()
}
@@ -7792,6 +7796,7 @@ final class WorkspaceStore: ObservableObject {
if let appearanceModeRaw = snapshot.appearanceModeRaw,
let appearanceMode = WeiBeiAppearanceMode(rawValue: appearanceModeRaw) {
self.appearanceMode = appearanceMode
+ WeiBeiThemeRuntime.mode = appearanceMode
}
adaptImportedDocumentColors = snapshot.adaptImportedDocumentColors ?? true
if let interfaceLanguageRaw = snapshot.interfaceLanguageRaw,
diff --git a/Sources/WeiBei/Support/Theme.swift b/Sources/WeiBei/Support/Theme.swift
index 0cdf66bff..0cbf6915c 100644
--- a/Sources/WeiBei/Support/Theme.swift
+++ b/Sources/WeiBei/Support/Theme.swift
@@ -3,74 +3,99 @@ import CoreText
import SwiftUI
import WeiBeiCore
+/// Four surface themes. Light pair: 纸面 (warm product paper) + 宣纸 (cooler fibrous xuan).
+/// Dark pair: 墨石 (near-black warm ink) + 石碑 (cool carved stele grey).
enum WeiBeiAppearanceMode: String, CaseIterable, Identifiable {
case paper
+ case xuan
case inkstone
+ case stele
var id: String { rawValue }
+ /// True for both dark surfaces (墨石 / 石碑). Prefer this over `== .inkstone`.
+ var isDark: Bool {
+ switch self {
+ case .paper, .xuan: return false
+ case .inkstone, .stele: return true
+ }
+ }
+
func label(language: WeiBeiInterfaceLanguage) -> String {
switch self {
case .paper:
return language.text("纸面", "Paper")
+ case .xuan:
+ return language.text("宣纸", "Xuan")
case .inkstone:
return language.text("墨石", "Inkstone")
+ case .stele:
+ return language.text("石碑", "Stele")
}
}
- func actionLabel(language: WeiBeiInterfaceLanguage) -> String {
+ func detail(language: WeiBeiInterfaceLanguage) -> String {
switch self {
case .paper:
- return language.text("切到墨石暗色", "Switch to Inkstone")
+ return language.text("暖色产品纸面", "Warm product paper")
+ case .xuan:
+ return language.text("素净宣纸白", "Cool fibrous xuan white")
case .inkstone:
- return language.text("切到纸面亮色", "Switch to Paper")
+ return language.text("暖黑墨石", "Warm near-black ink")
+ case .stele:
+ return language.text("冷灰碑面", "Cool carved stone")
}
}
+ func actionLabel(language: WeiBeiInterfaceLanguage) -> String {
+ language.text("切换外观主题", "Switch appearance theme")
+ }
+
var systemImage: String {
switch self {
case .paper:
return "sun.max"
+ case .xuan:
+ return "doc.plaintext"
case .inkstone:
return "moon.stars"
+ case .stele:
+ return "rectangle.split.3x1"
}
}
var colorScheme: ColorScheme {
- switch self {
- case .paper:
- return .light
- case .inkstone:
- return .dark
- }
+ isDark ? .dark : .light
}
var webThemeName: String {
- switch self {
- case .paper:
- return "paper"
- case .inkstone:
- return "inkstone"
- }
+ rawValue
}
var windowBackground: NSColor {
- switch self {
- case .paper:
- return NSColor(calibratedRed: 0.985, green: 0.960, blue: 0.905, alpha: 1.0)
- case .inkstone:
- return NSColor(calibratedRed: 0.059, green: 0.059, blue: 0.059, alpha: 1.0)
- }
+ WeiBeiNativePalette.paper(for: self)
}
+ /// Cycles all four themes (used by legacy toggle API / shortcuts).
var toggled: WeiBeiAppearanceMode {
switch self {
- case .paper:
- return .inkstone
- case .inkstone:
- return .paper
+ case .paper: return .xuan
+ case .xuan: return .inkstone
+ case .inkstone: return .stele
+ case .stele: return .paper
}
}
+
+ /// Next theme in the light↔dark pair, or full cycle when no pair preference.
+ var oppositeFamily: WeiBeiAppearanceMode {
+ isDark ? .paper : .inkstone
+ }
+}
+
+/// Live appearance used by dynamic `WeiBeiTheme` colors. Updated when the store
+/// changes mode so SwiftUI redraws pick the correct palette.
+enum WeiBeiThemeRuntime {
+ static var mode: WeiBeiAppearanceMode = .paper
}
enum WeiBeiTypography {
@@ -142,82 +167,132 @@ private struct WeiBeiTone {
}
private extension Color {
- static func weiBei(light: WeiBeiTone, dark: WeiBeiTone) -> Color {
- Color(nsColor: NSColor(name: nil) { appearance in
- let isDark = appearance.bestMatch(from: [.darkAqua, .aqua]) == .darkAqua
- return (isDark ? dark : light).nsColor
+ /// Resolve a four-mode palette from `WeiBeiThemeRuntime.mode` (not system appearance alone).
+ static func weiBei(
+ paper: WeiBeiTone,
+ xuan: WeiBeiTone,
+ inkstone: WeiBeiTone,
+ stele: WeiBeiTone
+ ) -> Color {
+ Color(nsColor: NSColor(name: nil) { _ in
+ switch WeiBeiThemeRuntime.mode {
+ case .paper: return paper.nsColor
+ case .xuan: return xuan.nsColor
+ case .inkstone: return inkstone.nsColor
+ case .stele: return stele.nsColor
+ }
})
}
+
+ /// Convenience when light-pair / dark-pair share tones.
+ static func weiBei(light: WeiBeiTone, dark: WeiBeiTone) -> Color {
+ weiBei(paper: light, xuan: light, inkstone: dark, stele: dark)
+ }
}
enum WeiBeiTheme {
+ // 纸面 = warm product paper; 宣纸 = cooler fibrous white; 墨石 = warm black; 石碑 = cool stele grey.
static let paper = Color.weiBei(
- light: WeiBeiTone(red: 0.955, green: 0.918, blue: 0.835),
- dark: WeiBeiTone(hex: 0x0F0F0F)
+ paper: WeiBeiTone(red: 0.955, green: 0.918, blue: 0.835),
+ xuan: WeiBeiTone(red: 0.972, green: 0.962, blue: 0.942),
+ inkstone: WeiBeiTone(hex: 0x0F0F0F),
+ stele: WeiBeiTone(hex: 0x16181C)
)
static let paperRaised = Color.weiBei(
- light: WeiBeiTone(red: 0.976, green: 0.944, blue: 0.872),
- dark: WeiBeiTone(hex: 0x151515)
+ paper: WeiBeiTone(red: 0.976, green: 0.944, blue: 0.872),
+ xuan: WeiBeiTone(red: 0.992, green: 0.988, blue: 0.978),
+ inkstone: WeiBeiTone(hex: 0x151515),
+ stele: WeiBeiTone(hex: 0x1E2228)
)
static let paperInset = Color.weiBei(
- light: WeiBeiTone(red: 0.908, green: 0.858, blue: 0.748),
- dark: WeiBeiTone(hex: 0x1C1C1C)
+ paper: WeiBeiTone(red: 0.908, green: 0.858, blue: 0.748),
+ xuan: WeiBeiTone(red: 0.930, green: 0.918, blue: 0.892),
+ inkstone: WeiBeiTone(hex: 0x1C1C1C),
+ stele: WeiBeiTone(hex: 0x252A32)
)
static let chrome = Color.weiBei(
- light: WeiBeiTone(red: 0.155, green: 0.145, blue: 0.130),
- dark: WeiBeiTone(hex: 0x0B0B0B)
+ paper: WeiBeiTone(red: 0.155, green: 0.145, blue: 0.130),
+ xuan: WeiBeiTone(red: 0.140, green: 0.138, blue: 0.132),
+ inkstone: WeiBeiTone(hex: 0x0B0B0B),
+ stele: WeiBeiTone(hex: 0x101217)
)
static let ink = Color.weiBei(
- light: WeiBeiTone(red: 0.115, green: 0.095, blue: 0.080),
- dark: WeiBeiTone(hex: 0xD7CBB0)
+ paper: WeiBeiTone(red: 0.115, green: 0.095, blue: 0.080),
+ xuan: WeiBeiTone(red: 0.145, green: 0.140, blue: 0.128),
+ inkstone: WeiBeiTone(hex: 0xD7CBB0),
+ stele: WeiBeiTone(hex: 0xD2D6DC)
)
static let secondaryInk = Color.weiBei(
- light: WeiBeiTone(red: 0.335, green: 0.285, blue: 0.245),
- dark: WeiBeiTone(hex: 0x9B9178)
+ paper: WeiBeiTone(red: 0.335, green: 0.285, blue: 0.245),
+ xuan: WeiBeiTone(red: 0.360, green: 0.345, blue: 0.320),
+ inkstone: WeiBeiTone(hex: 0x9B9178),
+ stele: WeiBeiTone(hex: 0x9AA1AB)
)
static let tertiaryInk = Color.weiBei(
- light: WeiBeiTone(red: 0.490, green: 0.430, blue: 0.365),
- dark: WeiBeiTone(hex: 0x6F6655)
+ paper: WeiBeiTone(red: 0.490, green: 0.430, blue: 0.365),
+ xuan: WeiBeiTone(red: 0.500, green: 0.480, blue: 0.450),
+ inkstone: WeiBeiTone(hex: 0x6F6655),
+ stele: WeiBeiTone(hex: 0x6E7682)
)
static let placeholderInk = Color.weiBei(
- light: WeiBeiTone(red: 0.405, green: 0.345, blue: 0.290),
- dark: WeiBeiTone(hex: 0xAFA48C)
+ paper: WeiBeiTone(red: 0.405, green: 0.345, blue: 0.290),
+ xuan: WeiBeiTone(red: 0.430, green: 0.410, blue: 0.380),
+ inkstone: WeiBeiTone(hex: 0xAFA48C),
+ stele: WeiBeiTone(hex: 0xA8AFB8)
)
static let hairline = Color.weiBei(
- light: WeiBeiTone(red: 0.500, green: 0.380, blue: 0.260, alpha: 0.24),
- dark: WeiBeiTone(hex: 0x3A3328, alpha: 0.72)
+ paper: WeiBeiTone(red: 0.500, green: 0.380, blue: 0.260, alpha: 0.24),
+ xuan: WeiBeiTone(red: 0.420, green: 0.400, blue: 0.360, alpha: 0.22),
+ inkstone: WeiBeiTone(hex: 0x3A3328, alpha: 0.72),
+ stele: WeiBeiTone(hex: 0x3A414C, alpha: 0.78)
)
static let cinnabar = Color.weiBei(
- light: WeiBeiTone(red: 0.570, green: 0.150, blue: 0.105),
- dark: WeiBeiTone(hex: 0xA6362B)
+ paper: WeiBeiTone(red: 0.570, green: 0.150, blue: 0.105),
+ xuan: WeiBeiTone(red: 0.540, green: 0.145, blue: 0.110),
+ inkstone: WeiBeiTone(hex: 0xA6362B),
+ stele: WeiBeiTone(hex: 0xB04034)
)
static let cinnabarSoft = Color.weiBei(
- light: WeiBeiTone(red: 0.570, green: 0.150, blue: 0.105, alpha: 0.10),
- dark: WeiBeiTone(hex: 0x5C2621, alpha: 0.62)
+ paper: WeiBeiTone(red: 0.570, green: 0.150, blue: 0.105, alpha: 0.10),
+ xuan: WeiBeiTone(red: 0.540, green: 0.145, blue: 0.110, alpha: 0.09),
+ inkstone: WeiBeiTone(hex: 0x5C2621, alpha: 0.62),
+ stele: WeiBeiTone(hex: 0x5A2A28, alpha: 0.58)
)
static let onCinnabar = Color.weiBei(
- light: WeiBeiTone(hex: 0xF8EAD4),
- dark: WeiBeiTone(hex: 0xF3DEC2)
+ paper: WeiBeiTone(hex: 0xF8EAD4),
+ xuan: WeiBeiTone(hex: 0xF7F2EA),
+ inkstone: WeiBeiTone(hex: 0xF3DEC2),
+ stele: WeiBeiTone(hex: 0xE8ECF0)
)
static let link = Color.weiBei(
- light: WeiBeiTone(red: 0.190, green: 0.330, blue: 0.410),
- dark: WeiBeiTone(hex: 0xC8B98A)
+ paper: WeiBeiTone(red: 0.190, green: 0.330, blue: 0.410),
+ xuan: WeiBeiTone(red: 0.200, green: 0.320, blue: 0.390),
+ inkstone: WeiBeiTone(hex: 0xC8B98A),
+ stele: WeiBeiTone(hex: 0xB8C4D0)
)
static let moss = Color.weiBei(
- light: WeiBeiTone(red: 0.230, green: 0.385, blue: 0.300),
- dark: WeiBeiTone(hex: 0xB88A42)
+ paper: WeiBeiTone(red: 0.230, green: 0.385, blue: 0.300),
+ xuan: WeiBeiTone(red: 0.250, green: 0.380, blue: 0.310),
+ inkstone: WeiBeiTone(hex: 0xB88A42),
+ stele: WeiBeiTone(hex: 0x8FA06A)
)
static let codePaper = Color.weiBei(
- light: WeiBeiTone(red: 0.180, green: 0.145, blue: 0.115, alpha: 0.055),
- dark: WeiBeiTone(hex: 0x171717, alpha: 0.92)
+ paper: WeiBeiTone(red: 0.180, green: 0.145, blue: 0.115, alpha: 0.055),
+ xuan: WeiBeiTone(red: 0.160, green: 0.150, blue: 0.130, alpha: 0.050),
+ inkstone: WeiBeiTone(hex: 0x171717, alpha: 0.92),
+ stele: WeiBeiTone(hex: 0x1A1E24, alpha: 0.94)
)
static let glassTint = Color.weiBei(
- light: WeiBeiTone(red: 0.982, green: 0.948, blue: 0.875),
- dark: WeiBeiTone(hex: 0x1A1814)
+ paper: WeiBeiTone(red: 0.982, green: 0.948, blue: 0.875),
+ xuan: WeiBeiTone(red: 0.988, green: 0.984, blue: 0.974),
+ inkstone: WeiBeiTone(hex: 0x1A1814),
+ stele: WeiBeiTone(hex: 0x1C2026)
)
static let glassHighlight = Color.weiBei(
- light: WeiBeiTone(red: 0.992, green: 0.970, blue: 0.918),
- dark: WeiBeiTone(hex: 0x3A3328)
+ paper: WeiBeiTone(red: 0.992, green: 0.970, blue: 0.918),
+ xuan: WeiBeiTone(red: 0.995, green: 0.992, blue: 0.986),
+ inkstone: WeiBeiTone(hex: 0x3A3328),
+ stele: WeiBeiTone(hex: 0x3E4652)
)
static let stone = secondaryInk
}
@@ -227,8 +302,12 @@ enum WeiBeiNativePalette {
switch mode {
case .paper:
return NSColor(calibratedRed: 0.955, green: 0.918, blue: 0.835, alpha: 1.0)
+ case .xuan:
+ return NSColor(calibratedRed: 0.972, green: 0.962, blue: 0.942, alpha: 1.0)
case .inkstone:
return NSColor(calibratedRed: 0.059, green: 0.059, blue: 0.059, alpha: 1.0)
+ case .stele:
+ return NSColor(calibratedRed: 0.086, green: 0.094, blue: 0.110, alpha: 1.0)
}
}
@@ -236,26 +315,34 @@ enum WeiBeiNativePalette {
switch mode {
case .paper:
return NSColor(calibratedRed: 0.115, green: 0.095, blue: 0.080, alpha: 1.0)
+ case .xuan:
+ return NSColor(calibratedRed: 0.145, green: 0.140, blue: 0.128, alpha: 1.0)
case .inkstone:
return NSColor(calibratedRed: 0.843, green: 0.796, blue: 0.690, alpha: 1.0)
+ case .stele:
+ return NSColor(calibratedRed: 0.824, green: 0.839, blue: 0.863, alpha: 1.0)
}
}
static func selectedText(for mode: WeiBeiAppearanceMode) -> NSColor {
switch mode {
- case .paper:
+ case .paper, .xuan:
return ink(for: mode)
case .inkstone:
return NSColor(calibratedRed: 0.961, green: 0.906, blue: 0.784, alpha: 1.0)
+ case .stele:
+ return NSColor(calibratedRed: 0.930, green: 0.940, blue: 0.955, alpha: 1.0)
}
}
static func selectionFill(for mode: WeiBeiAppearanceMode) -> NSColor {
switch mode {
- case .paper:
+ case .paper, .xuan:
return NSColor(calibratedRed: 0.570, green: 0.150, blue: 0.105, alpha: 0.20)
case .inkstone:
return NSColor(calibratedRed: 0.651, green: 0.212, blue: 0.169, alpha: 0.35)
+ case .stele:
+ return NSColor(calibratedRed: 0.690, green: 0.250, blue: 0.200, alpha: 0.32)
}
}
}
@@ -267,6 +354,21 @@ enum WeiBeiMetric {
static let topBarHeight: CGFloat = 38
}
+/// Top-bar brand mark (DesignSystem logo exports bundled under Resources/Brand).
+enum WeiBeiBrandMark {
+ static func image(for mode: WeiBeiAppearanceMode) -> NSImage {
+ let name = mode.isDark ? "weibei-mark-reversed" : "weibei-mark"
+ if let url = WeiBeiResources.bundle.url(forResource: name, withExtension: "png", subdirectory: "Brand")
+ ?? WeiBeiResources.bundle.url(forResource: name, withExtension: "png"),
+ let image = NSImage(contentsOf: url) {
+ image.isTemplate = false
+ return image
+ }
+ // Fallback: empty 1×1 so layout never crashes if resources are missing.
+ return NSImage(size: NSSize(width: 1, height: 1))
+ }
+}
+
enum WeiBeiMotion {
static let press = Animation.interactiveSpring(response: 0.18, dampingFraction: 0.82)
static let micro = Animation.easeOut(duration: 0.14)
diff --git a/Sources/WeiBei/Views/ContentRailView.swift b/Sources/WeiBei/Views/ContentRailView.swift
index 39beac351..642a7181f 100644
--- a/Sources/WeiBei/Views/ContentRailView.swift
+++ b/Sources/WeiBei/Views/ContentRailView.swift
@@ -354,7 +354,7 @@ struct ContentRailView: View {
if item.id == highlightedID {
return WeiBeiTheme.cinnabar
}
- return WeiBeiTheme.secondaryInk.opacity(appearanceMode == .inkstone ? 0.78 : 0.58)
+ return WeiBeiTheme.secondaryInk.opacity(appearanceMode.isDark ? 0.78 : 0.58)
}
private func railSpacing(count: Int, height: CGFloat) -> CGFloat {
@@ -511,7 +511,7 @@ private struct ContentRailPreviewCard: View {
.stroke(WeiBeiTheme.hairline.opacity(0.82), lineWidth: 1)
}
.clipShape(RoundedRectangle(cornerRadius: 6, style: .continuous))
- .shadow(color: WeiBeiTheme.ink.opacity(appearanceMode == .inkstone ? 0.22 : 0.08), radius: 8, y: 4)
+ .shadow(color: WeiBeiTheme.ink.opacity(appearanceMode.isDark ? 0.22 : 0.08), radius: 8, y: 4)
.accessibilityHidden(true)
}
}
diff --git a/Sources/WeiBei/Views/ContentView.swift b/Sources/WeiBei/Views/ContentView.swift
index a8fad2a49..f6de0f7db 100644
--- a/Sources/WeiBei/Views/ContentView.swift
+++ b/Sources/WeiBei/Views/ContentView.swift
@@ -422,11 +422,23 @@ private struct UnifiedTopBarView: View {
@ViewBuilder
private var brandBlock: some View {
- Text(store.brandLatinName)
- .font(WeiBeiTypography.englishBrandFont(size: 15.5, weight: .semibold))
- .tracking(0.15)
- .foregroundStyle(primaryText)
- .frame(width: 62, alignment: .leading)
+ // Logo mark + Latin wordmark — DesignSystem brand lockup for the top bar.
+ HStack(spacing: 7) {
+ Image(nsImage: WeiBeiBrandMark.image(for: store.appearanceMode))
+ .resizable()
+ .interpolation(.high)
+ .aspectRatio(contentMode: .fit)
+ .frame(width: 18, height: 18)
+ .accessibilityHidden(true)
+ Text(store.brandLatinName)
+ .font(WeiBeiTypography.englishBrandFont(size: 15.5, weight: .semibold))
+ .tracking(0.15)
+ .foregroundStyle(primaryText)
+ .lineLimit(1)
+ }
+ .frame(minWidth: 86, alignment: .leading)
+ .accessibilityElement(children: .ignore)
+ .accessibilityLabel(Text(store.brandLatinName))
}
@ViewBuilder
@@ -515,11 +527,31 @@ private struct UnifiedTopBarView: View {
@ViewBuilder
private var appearanceToggleButton: some View {
- topIconButton(store.appearanceMode.toggled.systemImage, help: store.appearanceMode.actionLabel(language: store.interfaceLanguage)) {
- withAnimation(WeiBeiMotion.appearance) {
- store.toggleAppearanceMode()
+ // Four themes: menu in the top bar (fast), full grid also in Settings → Appearance.
+ Menu {
+ ForEach(WeiBeiAppearanceMode.allCases) { mode in
+ Button {
+ withAnimation(WeiBeiMotion.appearance) {
+ store.setAppearanceMode(mode)
+ }
+ } label: {
+ if mode == store.appearanceMode {
+ Label(mode.label(language: store.interfaceLanguage), systemImage: "checkmark")
+ } else {
+ Label(mode.label(language: store.interfaceLanguage), systemImage: mode.systemImage)
+ }
+ }
}
+ } label: {
+ Image(systemName: store.appearanceMode.systemImage)
+ .contentShape(Rectangle())
}
+ .menuStyle(.borderlessButton)
+ .menuIndicator(.hidden)
+ .buttonStyle(WeiBeiIconButtonStyle(size: 24))
+ .accessibilityLabel(Text(store.appearanceMode.actionLabel(language: store.interfaceLanguage)))
+ .help(store.appearanceMode.actionLabel(language: store.interfaceLanguage))
+ .keyboardShortcut("t", modifiers: [.option, .command])
}
private func toggleReaderSearch() {
@@ -606,7 +638,7 @@ private struct ThreePaneWorkspaceChrome: View {
y: sourceFrame.midY
)
.shadow(
- color: WeiBeiTheme.ink.opacity(store.appearanceMode == .inkstone ? 0.38 : 0.14),
+ color: WeiBeiTheme.ink.opacity(store.appearanceMode.isDark ? 0.38 : 0.14),
radius: 22,
y: 12
)
@@ -988,7 +1020,7 @@ struct EmptyWorkspaceView: View {
VStack(spacing: 14) {
Image(systemName: "seal")
.font(.system(size: 34, weight: .regular))
- .foregroundStyle(WeiBeiTheme.cinnabar.opacity(store.appearanceMode == .inkstone ? 0.12 : 0.08))
+ .foregroundStyle(WeiBeiTheme.cinnabar.opacity(store.appearanceMode.isDark ? 0.12 : 0.08))
Text(store.ui("在顶栏点亮一个板块开始", "Light up a pane above to begin"))
.font(.system(size: 13, weight: .medium))
.foregroundStyle(WeiBeiTheme.secondaryInk)
@@ -1004,7 +1036,7 @@ private struct PaneDropTargetView: View {
var body: some View {
RoundedRectangle(cornerRadius: 10)
- .fill(WeiBeiTheme.cinnabarSoft.opacity(store.appearanceMode == .inkstone ? 0.16 : 0.12))
+ .fill(WeiBeiTheme.cinnabarSoft.opacity(store.appearanceMode.isDark ? 0.16 : 0.12))
.overlay {
RoundedRectangle(cornerRadius: 10)
.stroke(WeiBeiTheme.cinnabar.opacity(0.30), lineWidth: 1)
diff --git a/Sources/WeiBei/Views/CourseDrawerHost.swift b/Sources/WeiBei/Views/CourseDrawerHost.swift
index dbe2c7677..aa598b68c 100644
--- a/Sources/WeiBei/Views/CourseDrawerHost.swift
+++ b/Sources/WeiBei/Views/CourseDrawerHost.swift
@@ -134,8 +134,12 @@ final class CourseDrawerContainerView: NSView {
switch mode {
case .paper:
return NSColor(calibratedRed: 0.976, green: 0.944, blue: 0.872, alpha: 1)
+ case .xuan:
+ return NSColor(calibratedRed: 0.992, green: 0.988, blue: 0.978, alpha: 1)
case .inkstone:
return NSColor(calibratedRed: 0.082, green: 0.082, blue: 0.082, alpha: 1)
+ case .stele:
+ return NSColor(calibratedRed: 0.118, green: 0.133, blue: 0.157, alpha: 1)
}
}
@@ -143,8 +147,12 @@ final class CourseDrawerContainerView: NSView {
switch mode {
case .paper:
return NSColor(calibratedRed: 0.115, green: 0.095, blue: 0.080, alpha: 0.035)
+ case .xuan:
+ return NSColor(calibratedRed: 0.140, green: 0.135, blue: 0.120, alpha: 0.030)
case .inkstone:
return NSColor(calibratedRed: 0, green: 0, blue: 0, alpha: 0.18)
+ case .stele:
+ return NSColor(calibratedRed: 0, green: 0, blue: 0, alpha: 0.22)
}
}
diff --git a/Sources/WeiBei/Views/NotesAgentView.swift b/Sources/WeiBei/Views/NotesAgentView.swift
index 96e0f35b4..cff740ac3 100644
--- a/Sources/WeiBei/Views/NotesAgentView.swift
+++ b/Sources/WeiBei/Views/NotesAgentView.swift
@@ -256,6 +256,8 @@ private struct AgentComposerField: View {
var sendBottom: CGFloat
var horizontalPadding: CGFloat = 10
var verticalPadding: CGFloat = 0
+ /// Codex-style footer: model chip on the left, send on the right inside the card.
+ var showsModelFooter: Bool = false
var submit: () -> Void
private var canSend: Bool {
@@ -269,56 +271,73 @@ private struct AgentComposerField: View {
var body: some View {
// Tall Codex-like composer uses a fixed outer height; short fields still hug content.
let locksHeight = height >= 72
- ZStack(alignment: .bottomTrailing) {
- TextField(
- "",
- text: $store.agentDraft,
- prompt: Text(prompt)
- .font(promptFont)
- .foregroundStyle(WeiBeiTheme.placeholderInk),
- axis: .vertical
- )
- .textFieldStyle(.plain)
- .lineLimit(lineLimit)
- .fixedSize(horizontal: false, vertical: !locksHeight)
- .font(font)
- .foregroundColor(WeiBeiTheme.ink)
- .focused(focused)
- .onSubmit(submit)
- .padding(.vertical, verticalPadding)
- .padding(.trailing, showsControl ? trailingPadding : 0)
- .frame(maxWidth: .infinity, maxHeight: locksHeight ? .infinity : nil, alignment: .topLeading)
- .padding(.horizontal, horizontalPadding)
- .frame(maxWidth: .infinity, minHeight: height, maxHeight: locksHeight ? height : nil, alignment: .topLeading)
- .background {
- RoundedRectangle(cornerRadius: locksHeight ? 14 : WeiBeiMetric.controlRadius)
- .fill(WeiBeiTheme.paperRaised.opacity(focused.wrappedValue ? 0.72 : 0.62))
- }
- .clipShape(RoundedRectangle(cornerRadius: locksHeight ? 14 : WeiBeiMetric.controlRadius))
- .overlay {
- RoundedRectangle(cornerRadius: locksHeight ? 14 : WeiBeiMetric.controlRadius)
- .stroke(
- focused.wrappedValue ? WeiBeiTheme.link.opacity(0.36) : WeiBeiTheme.hairline.opacity(0.54),
- lineWidth: 1
- )
+ let corner: CGFloat = locksHeight ? 16 : WeiBeiMetric.controlRadius
+ VStack(alignment: .leading, spacing: 0) {
+ ZStack(alignment: .topLeading) {
+ TextField(
+ "",
+ text: $store.agentDraft,
+ prompt: Text(prompt)
+ .font(promptFont)
+ .foregroundStyle(WeiBeiTheme.placeholderInk),
+ axis: .vertical
+ )
+ .textFieldStyle(.plain)
+ .lineLimit(lineLimit)
+ .fixedSize(horizontal: false, vertical: !locksHeight)
+ .font(font)
+ .foregroundColor(WeiBeiTheme.ink)
+ .focused(focused)
+ .onSubmit(submit)
+ .padding(.top, verticalPadding)
+ .padding(.bottom, showsModelFooter ? 8 : verticalPadding)
+ .padding(.trailing, showsModelFooter ? 0 : (showsControl ? trailingPadding : 0))
+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
+ .padding(.horizontal, horizontalPadding)
+
+ if showsControl && !showsModelFooter {
+ VStack {
+ Spacer(minLength: 0)
+ HStack {
+ Spacer(minLength: 0)
+ sendButton
+ .padding(.trailing, sendTrailing)
+ .padding(.bottom, sendBottom)
+ }
+ }
+ }
}
+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
- if showsControl {
- Button {
- store.isAskingAgent ? store.cancelAgentRequest() : submit()
- } label: {
- Image(systemName: store.isAskingAgent ? "stop.fill" : "paperplane.fill")
+ if showsModelFooter {
+ HStack(spacing: 10) {
+ Text(store.modelName.isEmpty ? store.ui("模型", "Model") : store.modelName)
+ .font(.system(size: 12, weight: .medium))
+ .foregroundStyle(WeiBeiTheme.tertiaryInk)
+ .lineLimit(1)
+ Spacer(minLength: 8)
+ if showsControl {
+ sendButton
+ }
}
- .buttonStyle(WeiBeiIconButtonStyle(size: sendButtonSize, prominence: store.isAskingAgent ? .neutral : .primary))
- .accessibilityLabel(Text(store.isAskingAgent ? store.ui("停止回答", "Stop response") : store.ui("发送", "Send")))
- .help(store.isAskingAgent ? store.ui("停止回答", "Stop response") : store.ui("发送", "Send"))
- .keyboardShortcut(.return, modifiers: [.command])
- .padding(.trailing, sendTrailing)
- .padding(.bottom, sendBottom)
- .transition(WeiBeiTransition.floating)
- .animation(WeiBeiMotion.micro, value: showsControl)
+ .padding(.horizontal, horizontalPadding)
+ .padding(.bottom, 12)
+ .padding(.top, 2)
}
}
+ .frame(maxWidth: .infinity, minHeight: height, maxHeight: locksHeight ? height : nil, alignment: .topLeading)
+ .background {
+ RoundedRectangle(cornerRadius: corner)
+ .fill(WeiBeiTheme.paperRaised.opacity(focused.wrappedValue ? 0.78 : 0.64))
+ }
+ .clipShape(RoundedRectangle(cornerRadius: corner))
+ .overlay {
+ RoundedRectangle(cornerRadius: corner)
+ .stroke(
+ focused.wrappedValue ? WeiBeiTheme.link.opacity(0.36) : WeiBeiTheme.hairline.opacity(0.54),
+ lineWidth: 1
+ )
+ }
.frame(height: locksHeight ? height : nil, alignment: .bottom)
.contentShape(Rectangle())
.onTapGesture {
@@ -327,6 +346,20 @@ private struct AgentComposerField: View {
.animation(WeiBeiMotion.micro, value: showsControl)
.accessibilityIdentifier(locksHeight ? "agent-composer-codex" : "agent-composer-compact")
}
+
+ private var sendButton: some View {
+ Button {
+ store.isAskingAgent ? store.cancelAgentRequest() : submit()
+ } label: {
+ Image(systemName: store.isAskingAgent ? "stop.fill" : "paperplane.fill")
+ }
+ .buttonStyle(WeiBeiIconButtonStyle(size: sendButtonSize, prominence: store.isAskingAgent ? .neutral : .primary))
+ .accessibilityLabel(Text(store.isAskingAgent ? store.ui("停止回答", "Stop response") : store.ui("发送", "Send")))
+ .help(store.isAskingAgent ? store.ui("停止回答", "Stop response") : store.ui("发送", "Send"))
+ .keyboardShortcut(.return, modifiers: [.command])
+ .transition(WeiBeiTransition.floating)
+ .animation(WeiBeiMotion.micro, value: showsControl)
+ }
}
private struct AccessibilityFrameProbe: NSViewRepresentable {
@@ -702,20 +735,20 @@ struct NotePaneView: View {
private func noteModeButtonFill(selected: Bool, hovering: Bool) -> Color {
if selected {
- return WeiBeiTheme.cinnabarSoft.opacity(store.appearanceMode == .inkstone ? 0.44 : 0.62)
+ return WeiBeiTheme.cinnabarSoft.opacity(store.appearanceMode.isDark ? 0.44 : 0.62)
}
if hovering {
- return WeiBeiTheme.paperRaised.opacity(store.appearanceMode == .inkstone ? 0.16 : 0.20)
+ return WeiBeiTheme.paperRaised.opacity(store.appearanceMode.isDark ? 0.16 : 0.20)
}
return Color.clear
}
private func noteModeButtonStroke(selected: Bool, hovering: Bool) -> Color {
if selected {
- return WeiBeiTheme.cinnabar.opacity(store.appearanceMode == .inkstone ? 0.34 : 0.24)
+ return WeiBeiTheme.cinnabar.opacity(store.appearanceMode.isDark ? 0.34 : 0.24)
}
if hovering {
- return WeiBeiTheme.hairline.opacity(store.appearanceMode == .inkstone ? 0.30 : 0.18)
+ return WeiBeiTheme.hairline.opacity(store.appearanceMode.isDark ? 0.30 : 0.18)
}
return Color.clear
}
@@ -1229,7 +1262,7 @@ struct MarkdownSourceEditor: NSViewRepresentable {
guard let textStorage = textView.textStorage, textStorage.length > 0 else { return }
let fullRange = NSRange(location: 0, length: textStorage.length)
let ink = WeiBeiNativePalette.ink(for: appearanceMode)
- let quotePrefixColor = ink.withAlphaComponent(appearanceMode == .inkstone ? 0.30 : 0.36)
+ let quotePrefixColor = ink.withAlphaComponent(appearanceMode.isDark ? 0.30 : 0.36)
let markerColor = NSColor.clear
let markerFont = NSFont.monospacedSystemFont(ofSize: 0.1, weight: .regular)
let quotePrefixRegex = try? NSRegularExpression(pattern: #"(?m)^\s*(?:>\s*)+"#)
@@ -1576,16 +1609,17 @@ private struct AgentRailTurn {
/// than `availableWidth`, or multi-pane text centers as if the strip were full-window wide.
private enum AgentChatLayoutMetrics {
static let compactMaxWidth: CGFloat = 560
- /// Immersive conversation: nearly full pane (not a skinny centered strip).
- static let wideMaxWidth: CGFloat = 1600
+ /// Immersive conversation: Codex-like centered column that still scales with the window.
+ /// Cap keeps line length readable on ultra-wide; floor is handled by usable width.
+ static let wideMaxWidth: CGFloat = 920
static let compactSideGutter: CGFloat = 12
- /// Tight gutters so the reading column owns the immersive canvas.
- static let wideSideGutter: CGFloat = 48
+ /// Codex-style: modest side margin; column grows/shrinks with the window.
+ static let wideSideGutter: CGFloat = 28
static let compactComposerHeight: CGFloat = 52
- /// Tall real composer — empty state must still read as a writing surface, not a search field.
- static let wideComposerHeight: CGFloat = 148
+ /// Tall Codex-style writing surface (multi-line + bottom control band).
+ static let wideComposerHeight: CGFloat = 188
static let compactFontSize: CGFloat = 14.5
- static let wideFontSize: CGFloat = 17
+ static let wideFontSize: CGFloat = 16
static func isWide(layout: WorkspaceLayout) -> Bool {
// Immersive conversation only — document multi-pane keeps compact strip metrics.
@@ -1595,7 +1629,7 @@ private enum AgentChatLayoutMetrics {
static func contentWidth(availableWidth: CGFloat, wide: Bool) -> CGFloat {
let gutter = (wide ? wideSideGutter : compactSideGutter) * 2
let usable = max(availableWidth - gutter, 1)
- // Wide: use nearly the whole measured pane (gutter only). Cap only for ultra-wide displays.
+ // Wide: track the window, capped for readability (Codex ~720–920pt column).
if wide {
return min(usable, wideMaxWidth)
}
@@ -1680,7 +1714,7 @@ struct AgentPaneView: View {
ScrollView(showsIndicators: true) {
// No scrollTargetLayout / scrollPosition / minHeight:viewport /
// GeometryReader parent — all thrash sizeThatFits on LazyVStack.
- LazyVStack(alignment: .leading, spacing: wide ? 16 : 12) {
+ LazyVStack(alignment: .leading, spacing: wide ? 22 : 12) {
ForEach(store.messages) { message in
agentMessageRow(
message: message,
@@ -1722,8 +1756,8 @@ struct AgentPaneView: View {
.frame(height: agentScrollBottomInset)
.id(agentBottomAnchorID)
}
- .padding(.horizontal, wide ? 16 : 10)
- .padding(.vertical, wide ? 10 : 10)
+ .padding(.horizontal, wide ? 8 : 10)
+ .padding(.vertical, wide ? 14 : 10)
.environment(\.agentChatLayoutWidth, contentWidth)
.padding(.top, store.messages.isEmpty ? 22 : 0)
.frame(maxWidth: .infinity, alignment: .topLeading)
@@ -1997,20 +2031,22 @@ struct AgentPaneView: View {
private func agentInputTray(wide: Bool, contentWidth: CGFloat) -> some View {
let fieldHeight = AgentChatLayoutMetrics.composerHeight(wide: wide)
let fontSize = AgentChatLayoutMetrics.composerFontSize(wide: wide)
+ // Codex: composer owns a fixed tall card; message scroll gets the rest of the pane.
+ // Width tracks `contentWidth` so resize keeps messages + input on one axis.
return VStack(spacing: 0) {
LinearGradient(
colors: [
.clear,
- WeiBeiTheme.paper.opacity(0.18),
- WeiBeiTheme.glassTint.opacity(0.34)
+ WeiBeiTheme.paper.opacity(0.22),
+ WeiBeiTheme.glassTint.opacity(0.40)
],
startPoint: .top,
endPoint: .bottom
)
- .frame(height: wide ? 16 : 22)
+ .frame(height: wide ? 20 : 22)
.allowsHitTesting(false)
- VStack(alignment: .leading, spacing: 8) {
+ VStack(alignment: .leading, spacing: wide ? 10 : 8) {
if store.hasSelectionAttachments {
AgentSelectionAttachmentPill()
.transition(WeiBeiTransition.floating)
@@ -2021,23 +2057,24 @@ struct AgentPaneView: View {
focused: $draftFocused,
font: .system(size: fontSize),
promptFont: .system(size: fontSize),
- lineLimit: wide ? 1...12 : 1...6,
+ lineLimit: wide ? 1...16 : 1...6,
height: fieldHeight,
- sendButtonSize: wide ? 38 : 28,
- trailingPadding: wide ? 56 : 40,
- sendTrailing: wide ? 18 : 10,
- sendBottom: wide ? 24 : 8,
- horizontalPadding: wide ? 22 : 12,
- verticalPadding: wide ? 20 : 8
+ sendButtonSize: wide ? 36 : 28,
+ trailingPadding: wide ? 52 : 40,
+ sendTrailing: wide ? 14 : 10,
+ sendBottom: wide ? 14 : 8,
+ horizontalPadding: wide ? 18 : 12,
+ verticalPadding: wide ? 16 : 8,
+ showsModelFooter: wide
) {
store.askAgent()
}
}
.font(.system(size: fontSize))
- // Fixed width = reading column. Fixed height = real composer block.
- .frame(width: contentWidth, height: fieldHeight, alignment: .bottom)
- .padding(.top, wide ? 12 : 4)
- .padding(.bottom, wide ? 28 : 12)
+ .frame(width: contentWidth, alignment: .bottom)
+ .frame(minHeight: fieldHeight, alignment: .bottom)
+ .padding(.top, wide ? 8 : 4)
+ .padding(.bottom, wide ? 22 : 12)
.frame(maxWidth: .infinity)
.background(WeiBeiTheme.paper)
.animation(WeiBeiMotion.reveal, value: store.agentDraft)
@@ -3109,7 +3146,7 @@ private struct AgentBubble: View {
.strokeBorder(userBubbleStroke, lineWidth: 1)
}
.shadow(
- color: WeiBeiTheme.ink.opacity(store.appearanceMode == .inkstone ? 0.0 : (hovering ? 0.06 : 0.04)),
+ color: WeiBeiTheme.ink.opacity(store.appearanceMode.isDark ? 0.0 : (hovering ? 0.06 : 0.04)),
radius: hovering ? 6 : 4,
y: hovering ? 2 : 1.2
)
@@ -3122,13 +3159,13 @@ private struct AgentBubble: View {
private var userBubbleFill: Color {
// Same paper family as chips/panels: a slightly raised slip of paper, not a tinted chat blob.
- store.appearanceMode == .inkstone
+ store.appearanceMode.isDark
? WeiBeiTheme.paperRaised.opacity(hovering ? 0.58 : 0.46)
: WeiBeiTheme.paperRaised.opacity(hovering ? 1.0 : 0.96)
}
private var userBubbleStroke: Color {
- store.appearanceMode == .inkstone
+ store.appearanceMode.isDark
? WeiBeiTheme.hairline.opacity(hovering ? 0.58 : 0.42)
: WeiBeiTheme.hairline.opacity(hovering ? 0.52 : 0.38)
}
@@ -4275,6 +4312,14 @@ final class AgentThinkingOrbitNSView: NSView {
ink = NSColor(calibratedRed: 0.843, green: 0.796, blue: 0.690, alpha: 0.93)
dim = NSColor(calibratedRed: 0.435, green: 0.400, blue: 0.333, alpha: 0.70)
cinnabar = NSColor(calibratedRed: 0.651, green: 0.212, blue: 0.169, alpha: 0.82)
+ case .stele:
+ ink = NSColor(calibratedRed: 0.824, green: 0.839, blue: 0.863, alpha: 0.93)
+ dim = NSColor(calibratedRed: 0.430, green: 0.460, blue: 0.510, alpha: 0.70)
+ cinnabar = NSColor(calibratedRed: 0.690, green: 0.250, blue: 0.200, alpha: 0.82)
+ case .xuan:
+ ink = NSColor(calibratedRed: 0.145, green: 0.140, blue: 0.128, alpha: 0.93)
+ dim = NSColor(calibratedRed: 0.500, green: 0.480, blue: 0.450, alpha: 0.70)
+ cinnabar = NSColor(calibratedRed: 0.540, green: 0.145, blue: 0.110, alpha: 0.82)
case .paper:
ink = NSColor(calibratedRed: 0.115, green: 0.095, blue: 0.080, alpha: 0.93)
dim = NSColor(calibratedRed: 0.490, green: 0.430, blue: 0.365, alpha: 0.70)
diff --git a/Sources/WeiBei/Views/ReaderView.swift b/Sources/WeiBei/Views/ReaderView.swift
index 926d44bf0..16b0642b7 100644
--- a/Sources/WeiBei/Views/ReaderView.swift
+++ b/Sources/WeiBei/Views/ReaderView.swift
@@ -72,13 +72,13 @@ struct ImmersiveHoverTitleView: View {
.frame(minHeight: 30)
.background {
RoundedRectangle(cornerRadius: 7)
- .fill(WeiBeiTheme.paperRaised.opacity(appearanceMode == .inkstone ? 0.34 : 0.72))
+ .fill(WeiBeiTheme.paperRaised.opacity(appearanceMode.isDark ? 0.34 : 0.72))
.overlay {
RoundedRectangle(cornerRadius: 7)
- .stroke(WeiBeiTheme.hairline.opacity(appearanceMode == .inkstone ? 0.30 : 0.42), lineWidth: 1)
+ .stroke(WeiBeiTheme.hairline.opacity(appearanceMode.isDark ? 0.30 : 0.42), lineWidth: 1)
}
}
- .shadow(color: WeiBeiTheme.ink.opacity(appearanceMode == .inkstone ? 0.24 : 0.07), radius: 9, y: 4)
+ .shadow(color: WeiBeiTheme.ink.opacity(appearanceMode.isDark ? 0.24 : 0.07), radius: 9, y: 4)
.padding(.horizontal, actionsAlignedTrailing ? 14 : 0)
.padding(.top, 7)
.modifier(PaneHeaderReorderModifier(role: reorderRole))
@@ -1765,8 +1765,12 @@ private final class ReaderPDFView: PDFView {
switch documentAppearanceMode {
case .paper:
return WeiBeiNativePalette.paper(for: .paper)
+ case .xuan:
+ return WeiBeiNativePalette.paper(for: .xuan)
case .inkstone:
return NSColor(calibratedRed: 0.66, green: 0.61, blue: 0.50, alpha: 1.0)
+ case .stele:
+ return NSColor(calibratedRed: 0.58, green: 0.60, blue: 0.64, alpha: 1.0)
}
}
@@ -2493,9 +2497,10 @@ struct WebReaderRepresentable: NSViewRepresentable {
static func readerStyleScript(for mode: WeiBeiAppearanceMode, adaptsDocumentColors: Bool = true) -> String {
let selectionCSS: String
switch mode {
- case .paper:
+ case .paper, .xuan:
+ let text = mode == .xuan ? "#25231f" : "#1d1814"
selectionCSS = """
- ::selection { background: rgba(145, 38, 27, 0.20); color: #1d1814; }
+ ::selection { background: rgba(145, 38, 27, 0.20); color: \(text); }
.weibei-selection-ask-mark {
text-decoration-line: underline;
text-decoration-color: rgba(145, 38, 27, 0.72);
@@ -2509,9 +2514,10 @@ struct WebReaderRepresentable: NSViewRepresentable {
background: rgba(145, 38, 27, 0.12);
}
"""
- case .inkstone:
+ case .inkstone, .stele:
+ let text = mode == .stele ? "#E8ECF0" : "#F5E7C8"
selectionCSS = """
- ::selection { background: rgba(166, 54, 43, 0.35); color: #F5E7C8; }
+ ::selection { background: rgba(166, 54, 43, 0.35); color: \(text); }
.weibei-selection-ask-mark {
text-decoration-line: underline;
text-decoration-color: rgba(200, 120, 100, 0.85);
@@ -2532,27 +2538,30 @@ struct WebReaderRepresentable: NSViewRepresentable {
adaptiveCSS = ""
} else {
switch mode {
- case .paper:
+ case .paper, .xuan:
+ let body = mode == .xuan ? "#25231f" : "#1d1814"
adaptiveCSS = """
html, body { max-width: 100%; overflow-x: hidden; color-scheme: light; background: transparent !important; }
- body, main, article, section, div, p, li, blockquote, td, th, span { color: #1d1814 !important; }
+ body, main, article, section, div, p, li, blockquote, td, th, span { color: \(body) !important; }
[data-weibei-paper-surface] { background-color: transparent !important; }
a { color: #31566b !important; }
code { background: rgba(29, 24, 20, .06) !important; color: #5d4b33 !important; }
pre { background: rgba(29, 24, 20, .052) !important; border-color: rgba(92, 70, 46, .28) !important; }
table, th, td { border-color: rgba(92, 70, 46, .28) !important; }
"""
- case .inkstone:
+ case .inkstone, .stele:
+ let body = mode == .stele ? "#D2D6DC" : "#D7CBB0"
+ let link = mode == .stele ? "#B8C4D0" : "#C8B98A"
adaptiveCSS = """
html, body { max-width: 100%; overflow-x: hidden; color-scheme: dark; background: transparent !important; }
- body, main, article, section, div, p, li, blockquote, td, th, span { color: #D7CBB0 !important; background-color: transparent !important; }
- a { color: #C8B98A !important; text-decoration-color: rgba(200, 185, 138, .55) !important; }
- h1, h2, h3 { color: #C8B98A !important; }
- blockquote { border-left: 3px solid rgba(166, 54, 43, .62) !important; background: rgba(166, 54, 43, .08) !important; color: #C9BFA5 !important; }
+ body, main, article, section, div, p, li, blockquote, td, th, span { color: \(body) !important; background-color: transparent !important; }
+ a { color: \(link) !important; text-decoration-color: rgba(200, 185, 138, .55) !important; }
+ h1, h2, h3 { color: \(link) !important; }
+ blockquote { border-left: 3px solid rgba(166, 54, 43, .62) !important; background: rgba(166, 54, 43, .08) !important; color: \(body) !important; }
code { background: rgba(255, 255, 255, .05) !important; color: #D8B47A !important; }
- pre { background: #171717 !important; border: 1px solid #2D2D2D !important; color: #D7CBB0 !important; }
+ pre { background: #171717 !important; border: 1px solid #2D2D2D !important; color: \(body) !important; }
table { background: rgba(255, 255, 255, .02) !important; }
- th { color: #C8B98A !important; background: rgba(200, 185, 138, .08) !important; }
+ th { color: \(link) !important; background: rgba(200, 185, 138, .08) !important; }
table, th, td { border-color: #2D2D2D !important; }
"""
}
diff --git a/Sources/WeiBei/Views/RichMarkdownEditorView.swift b/Sources/WeiBei/Views/RichMarkdownEditorView.swift
index 2d85a1f1e..3d99c7f65 100644
--- a/Sources/WeiBei/Views/RichMarkdownEditorView.swift
+++ b/Sources/WeiBei/Views/RichMarkdownEditorView.swift
@@ -101,8 +101,12 @@ fileprivate final class MarkdownImageSchemeHandler: NSObject, WKURLSchemeHandler
switch appearanceMode {
case .paper:
return ("#efe6d8", "#9f3b2f", "#6b5148")
+ case .xuan:
+ return ("#f2eee6", "#9a3a2e", "#5f5a52")
case .inkstone:
return ("#151515", "#a6362b", "#d7cbb0")
+ case .stele:
+ return ("#1e2228", "#b04034", "#d2d6dc")
}
}
@@ -565,7 +569,7 @@ struct RichMarkdownEditorView: NSViewRepresentable {
private static func applyWebAppearance(to view: WKWebView, appearanceMode: WeiBeiAppearanceMode) {
view.underPageBackgroundColor = WeiBeiNativePalette.paper(for: appearanceMode)
- view.appearance = NSAppearance(named: appearanceMode == .inkstone ? .darkAqua : .aqua)
+ view.appearance = NSAppearance(named: appearanceMode.isDark ? .darkAqua : .aqua)
}
private static func json(_ value: String) -> String {
diff --git a/Sources/WeiBei/Views/Settings/SettingsView.swift b/Sources/WeiBei/Views/Settings/SettingsView.swift
index 0024e25a6..0bd2f109d 100644
--- a/Sources/WeiBei/Views/Settings/SettingsView.swift
+++ b/Sources/WeiBei/Views/Settings/SettingsView.swift
@@ -157,10 +157,10 @@ struct SettingsView: View {
.frame(width: 218)
.background {
ZStack(alignment: .top) {
- WeiBeiTheme.paperInset.opacity(store.appearanceMode == .inkstone ? 0.62 : 0.80)
+ WeiBeiTheme.paperInset.opacity(store.appearanceMode.isDark ? 0.62 : 0.80)
LinearGradient(
colors: [
- WeiBeiTheme.glassHighlight.opacity(store.appearanceMode == .inkstone ? 0.09 : 0.20),
+ WeiBeiTheme.glassHighlight.opacity(store.appearanceMode.isDark ? 0.09 : 0.20),
.clear
],
startPoint: .top,
@@ -222,13 +222,26 @@ struct SettingsView: View {
}
private var settingsAppearanceToggleButton: some View {
- Button {
- withAnimation(WeiBeiMotion.appearance) {
- store.toggleAppearanceMode()
+ // Same four-theme menu as the main top bar (cycles via ⌥⌘T elsewhere).
+ Menu {
+ ForEach(WeiBeiAppearanceMode.allCases) { mode in
+ Button {
+ withAnimation(WeiBeiMotion.appearance) {
+ store.setAppearanceMode(mode)
+ }
+ } label: {
+ if mode == store.appearanceMode {
+ Label(mode.label(language: store.interfaceLanguage), systemImage: "checkmark")
+ } else {
+ Text(mode.label(language: store.interfaceLanguage))
+ }
+ }
}
} label: {
- Image(systemName: store.appearanceMode.toggled.systemImage)
+ Image(systemName: store.appearanceMode.systemImage)
}
+ .menuStyle(.borderlessButton)
+ .menuIndicator(.hidden)
.buttonStyle(WeiBeiIconButtonStyle(size: 30))
.accessibilityLabel(Text(store.appearanceMode.actionLabel(language: store.interfaceLanguage)))
.help(store.appearanceMode.actionLabel(language: store.interfaceLanguage))
@@ -249,14 +262,47 @@ struct SettingsView: View {
}
settingsGroup(store.ui("外观", "Appearance")) {
- settingsRow(title: store.ui("明暗模式", "Theme Mode")) {
- segmented(WeiBeiAppearanceMode.allCases, active: store.appearanceMode) { mode in
- mode.label(language: store.interfaceLanguage)
- } action: { mode in
- withAnimation(WeiBeiMotion.appearance) {
- store.setAppearanceMode(mode)
+ settingsRow(title: store.ui("主题", "Theme")) {
+ // Four themes — 2×2 chips. Top bar menu is the fast path; this is the full chooser.
+ LazyVGrid(columns: [GridItem(.adaptive(minimum: 92), spacing: 6)], alignment: .trailing, spacing: 6) {
+ ForEach(WeiBeiAppearanceMode.allCases) { mode in
+ Button {
+ withAnimation(WeiBeiMotion.appearance) {
+ store.setAppearanceMode(mode)
+ }
+ } label: {
+ HStack(spacing: 6) {
+ Image(systemName: mode.systemImage)
+ .font(.system(size: 11, weight: .semibold))
+ Text(mode.label(language: store.interfaceLanguage))
+ .font(.system(size: 12, weight: .semibold))
+ .lineLimit(1)
+ }
+ .padding(.horizontal, 10)
+ .frame(height: 30)
+ .frame(maxWidth: .infinity)
+ .foregroundStyle(mode == store.appearanceMode ? WeiBeiTheme.ink : WeiBeiTheme.secondaryInk)
+ .background(
+ RoundedRectangle(cornerRadius: 7)
+ .fill(mode == store.appearanceMode
+ ? WeiBeiTheme.paperRaised.opacity(0.72)
+ : WeiBeiTheme.paperInset.opacity(0.40))
+ )
+ .overlay {
+ RoundedRectangle(cornerRadius: 7)
+ .stroke(
+ mode == store.appearanceMode
+ ? WeiBeiTheme.cinnabar.opacity(0.55)
+ : WeiBeiTheme.hairline.opacity(0.36),
+ lineWidth: 1
+ )
+ }
+ }
+ .buttonStyle(.plain)
+ .help(mode.detail(language: store.interfaceLanguage))
}
}
+ .frame(width: 280)
}
}
@@ -472,7 +518,7 @@ struct SettingsView: View {
/// Shared Settings card primitive (also used by `AgentSettingsView` extension).
func settingsGroup(_ title: String, @ViewBuilder content: () -> Content) -> some View {
- let cardFill = WeiBeiTheme.paperRaised.opacity(store.appearanceMode == .inkstone ? 0.20 : 0.36)
+ let cardFill = WeiBeiTheme.paperRaised.opacity(store.appearanceMode.isDark ? 0.20 : 0.36)
return VStack(alignment: .leading, spacing: 0) {
sectionTitle(title)
.padding(.horizontal, 14)
diff --git a/Sources/WeiBei/WebEditor/src/editor.js b/Sources/WeiBei/WebEditor/src/editor.js
index 9034b6131..a2ba28c4f 100644
--- a/Sources/WeiBei/WebEditor/src/editor.js
+++ b/Sources/WeiBei/WebEditor/src/editor.js
@@ -219,7 +219,12 @@ const decorateLeakedCalloutControls = (decorations, text, pos) => {
}
};
-const normalizeTheme = (theme) => (theme === 'inkstone' ? 'inkstone' : 'paper');
+// Web CSS currently defines paper / inkstone. Map the four product themes onto those:
+// 宣纸 → paper (cool light still uses light stylesheet), 石碑 → inkstone (dark stylesheet).
+const normalizeTheme = (theme) => {
+ if (theme === 'inkstone' || theme === 'stele') return 'inkstone';
+ return 'paper';
+};
let currentTheme = normalizeTheme(window.weiBeiTheme);
const mermaidThemeVariables = () => {
diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift
index d64f84ad1..3311fe133 100644
--- a/Sources/WeiBeiSelfCheck/main.swift
+++ b/Sources/WeiBeiSelfCheck/main.swift
@@ -733,8 +733,10 @@ expect(runScript.contains("WEIBEI_VERIFY_CAPTURE_PATH")
&& runScript.contains("[[ -s \"$VERIFY_CAPTURE_PATH\" ]] && break")
&& runScript.contains("app-owned capture and macOS window capture failed")
&& runScript.contains("Grant Screen Recording permission"), "visual verification prefers an app-owned capture and reports when both capture paths fail")
-expect(runScript.contains("open_app() {\n /usr/bin/open \"$APP_BUNDLE\"\n}")
- && !runScript.contains("open_app() {\n /usr/bin/open -n \"$APP_BUNDLE\"\n}"), "regular run opens WeiBei without forcing a second app instance")
+expect(runScript.contains("open_app()")
+ && runScript.contains("/usr/bin/open \"$APP_BUNDLE\"")
+ && !runScript.contains("open -n \"$APP_BUNDLE\"")
+ && runScript.contains("codesign --verify --deep --strict \"$APP_BUNDLE\""), "regular run opens the staged signed WeiBei without forcing a second app instance")
expect(runScript.contains("RUN_VISUAL_VERIFY=false")
&& runScript.contains("if [[ \"${2:-}\" == \"--visual-verify\"")
&& runScript.contains("finish_verify_window()")
@@ -1908,10 +1910,12 @@ let themeSourceURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPa
let themeSource = (try? String(contentsOf: themeSourceURL, encoding: .utf8)) ?? ""
expect(themeSource.contains(".fill(.regularMaterial)") && themeSource.contains("paperWashOpacity"), "header glass uses one shared paper material wash")
expect(themeSource.contains("WeiBeiTheme.glassTint.opacity(0.16 * opacity)") && !themeSource.contains("WeiBeiTheme.paperInset.opacity(0.10 * opacity)"), "header handoff fade avoids a hard paper edge")
-expect(themeSource.contains("dark: WeiBeiTone(hex: 0x1A1814)")
- && themeSource.contains("dark: WeiBeiTone(hex: 0x3A3328)")
+expect(themeSource.contains("inkstone: WeiBeiTone(hex: 0x1A1814)")
+ && themeSource.contains("inkstone: WeiBeiTone(hex: 0x3A3328)")
+ && themeSource.contains("stele: WeiBeiTone(hex: 0x1C2026)")
+ && themeSource.contains("stele: WeiBeiTone(hex: 0x3E4652)")
&& themeSource.contains("colorScheme == .dark ? 0.12 : 0.20")
- && themeSource.contains("colorScheme == .dark ? 0.16 : 0.24"), "dark glass headers use warm inkstone wash instead of hard black blocks")
+ && themeSource.contains("colorScheme == .dark ? 0.16 : 0.24"), "dark glass headers use warm inkstone / cool stele washes instead of hard black blocks")
expect(themeSource.contains("paperRaised.opacity(0.985)")
&& themeSource.contains(".opacity(0.015)")
&& !themeSource.contains("paperRaised.opacity(0.92)"), "floating panels stay readable without losing the light glass surface")
@@ -1937,9 +1941,14 @@ expect(themeSource.contains("func weibeiInputSurface")
&& themeSource.contains(".stroke(active ? WeiBeiTheme.link.opacity(0.34) : WeiBeiTheme.hairline.opacity(0.54), lineWidth: 1)")
&& !themeSource.contains("secondaryInk.opacity(0.84)"), "input surfaces use semantic ink without forcing the old light color scheme")
expect(themeSource.contains("enum WeiBeiAppearanceMode")
+ && themeSource.contains("case paper")
+ && themeSource.contains("case xuan")
&& themeSource.contains("case inkstone")
+ && themeSource.contains("case stele")
+ && themeSource.contains("var isDark: Bool")
&& themeSource.contains("WeiBeiNativePalette")
- && themeSource.contains("static func weiBei(light:"), "theme exposes a persisted paper/inkstone appearance mode and native AppKit palette")
+ && themeSource.contains("WeiBeiThemeRuntime")
+ && themeSource.contains("static func weiBei(light:"), "theme exposes four appearance modes (纸面/宣纸/墨石/石碑) with runtime palette resolution")
expect(!themeSource.contains("var label: String")
&& !themeSource.contains("var actionLabel: String"), "theme-facing labels require an interface language instead of Chinese-only fallback properties")
expect(themeSource.contains("static let appearance = Animation.easeInOut(duration: 0.42)"), "appearance changes use a dedicated smooth theme transition")
@@ -2054,8 +2063,9 @@ expect(contentViewSource.contains("private var controlHeight: CGFloat {\n
expect(contentViewSource.contains("private var leftPrimaryControls: some View")
&& contentViewSource.contains("libraryButton\n\n navigationButtons\n\n appearanceToggleButton")
&& contentViewSource.contains("private var appearanceToggleButton: some View")
- && contentViewSource.contains("topIconButton(store.appearanceMode.toggled.systemImage, help: store.appearanceMode.actionLabel(language: store.interfaceLanguage))")
- && contentViewSource.contains("store.toggleAppearanceMode()")
+ && contentViewSource.contains("ForEach(WeiBeiAppearanceMode.allCases)")
+ && contentViewSource.contains("store.setAppearanceMode(mode)")
+ && contentViewSource.contains("WeiBeiBrandMark.image(for: store.appearanceMode)")
&& contentViewSource.contains("openSettings")
&& contentViewSource.contains("openSettings()")
&& contentViewSource.contains("slider.horizontal.3")
@@ -2063,7 +2073,7 @@ expect(contentViewSource.contains("private var leftPrimaryControls: some View")
&& contentViewSource.contains("WeiBeiIconButtonStyle(active: active, size: 24)")
&& !contentViewSource.contains("WeiBeiIconButtonStyle(active: store.appearanceMode == .inkstone")
&& !contentViewSource.contains("private var settingsMenu: some View")
- && !contentViewSource.contains("Image(systemName: \"gearshape\")"), "top bar opens full Settings from the trailing cluster instead of a mini gear menu")
+ && !contentViewSource.contains("Image(systemName: \"gearshape\")"), "top bar has brand logo, four-theme menu, and full Settings entry")
expect(themeSource.contains("enum WeiBeiIconButtonProminence")
&& themeSource.contains("@Environment(\\.colorScheme)")
&& themeSource.contains("prominence == .primary")
@@ -2299,10 +2309,13 @@ expect(!readerViewSource.contains("Bundle.module.url(forResource: \"WeiBeiStele\
&& readerViewSource.contains("readerStyleScript"), "html reader keeps imported document fonts instead of injecting bundled WeiBei display fonts into file headings")
expect(readerViewSource.contains("color-scheme: light")
&& readerViewSource.contains("color-scheme: dark")
- && readerViewSource.contains("color: #1d1814 !important")
- && readerViewSource.contains("color: #D7CBB0 !important")
- && readerViewSource.contains("a { color: #C8B98A !important;"), "html reader injects readable light and inkstone dark styles over imported documents")
-expect(readerViewSource.contains("::selection { background: rgba(145, 38, 27, 0.20); color: #1d1814; }"), "html reader uses the WeiBei cinnabar selection color instead of the default blue highlight")
+ && readerViewSource.contains("#1d1814")
+ && readerViewSource.contains("#D7CBB0")
+ && readerViewSource.contains("#C8B98A")
+ && readerViewSource.contains("case .paper, .xuan:")
+ && readerViewSource.contains("case .inkstone, .stele:"), "html reader injects readable light (纸面/宣纸) and dark (墨石/石碑) styles over imported documents")
+expect(readerViewSource.contains("::selection { background: rgba(145, 38, 27, 0.20); color: \\(text); }")
+ || readerViewSource.contains("::selection { background: rgba(145, 38, 27, 0.20);"), "html reader uses the WeiBei cinnabar selection color instead of the default blue highlight")
expect(readerViewSource.contains("document.addEventListener(\"selectionchange\", reportSelection)")
&& readerViewSource.contains("document.addEventListener(\"pointerdown\", () => {")
&& readerViewSource.contains("lastPayload = { text: \"\", x: null, y: null }")
@@ -2599,9 +2612,11 @@ expect(richEditorSource.contains("var appearanceMode: WeiBeiAppearanceMode = .pa
&& richEditorSource.components(separatedBy: "appearanceMode: appearanceMode").count >= 4
&& richEditorSource.contains("private static func applyWebAppearance(to view: WKWebView, appearanceMode: WeiBeiAppearanceMode)")
&& richEditorSource.contains("view.underPageBackgroundColor = WeiBeiNativePalette.paper(for: appearanceMode)")
- && richEditorSource.contains("view.appearance = NSAppearance(named: appearanceMode == .inkstone ? .darkAqua : .aqua)")
+ && richEditorSource.contains("view.appearance = NSAppearance(named: appearanceMode.isDark ? .darkAqua : .aqua)")
&& richEditorSource.contains("private var missingImageColors: (background: String, accent: String, text: String)")
&& richEditorSource.contains("case .inkstone:")
+ && richEditorSource.contains("case .xuan:")
+ && richEditorSource.contains("case .stele:")
&& richEditorSource.contains("return (\"#151515\", \"#a6362b\", \"#d7cbb0\")"), "native missing-image placeholders follow the current editor theme instead of always using a pale SVG")
expect(richEditorSource.contains("selection?.removeAllRanges();")
&& richEditorSource.contains("messageHandlers?.selectionChanged?.postMessage")
@@ -2830,7 +2845,8 @@ expect(!agentSettingsSource.contains("Form {")
&& agentSettingsSource.contains(".weibeiInputSurface(active: focusedField == .apiKey, height: 38)")
&& agentSettingsSource.contains("private var settingsAppearanceToggleButton: some View")
&& agentSettingsSource.contains("Spacer()\n settingsAppearanceToggleButton")
- && agentSettingsSource.contains("Image(systemName: store.appearanceMode.toggled.systemImage)")
+ && agentSettingsSource.contains("Image(systemName: store.appearanceMode.systemImage)")
+ && agentSettingsSource.contains("ForEach(WeiBeiAppearanceMode.allCases)")
&& agentSettingsSource.contains(".buttonStyle(WeiBeiIconButtonStyle(size: 30))")
&& !agentSettingsSource.contains("WeiBeiIconButtonStyle(active: store.appearanceMode == .inkstone")
&& !agentSettingsSource.contains("TopBarVariant")
@@ -3108,11 +3124,11 @@ expect(workspaceStoreSource.contains("var brandLatinName: String")
&& workspaceStoreSource.contains("\"WeiBei\"")
&& contentViewSource.contains("Text(store.brandLatinName)")
&& contentViewSource.contains("WeiBeiTypography.englishBrandFont(size: 15.5, weight: .semibold)")
- && contentViewSource.contains(".frame(width: 62, alignment: .leading)")
+ && contentViewSource.contains("WeiBeiBrandMark.image(for: store.appearanceMode)")
// Settings sidebar keeps a single localized title only — no second "WeiBei SETTINGS" line.
&& !agentSettingsSource.contains("Text(\"SETTINGS\")")
&& notesAgentSource.contains("latinMark: store.interfaceLanguage == .chinese ? \"NOTES\" : nil")
- && notesAgentSource.contains("latinMark: store.interfaceLanguage == .chinese ? \"CHAT\" : nil"), "custom English font has visible Latin brand marks in the top bar and pane headers; settings title is not duplicated")
+ && notesAgentSource.contains("latinMark: store.interfaceLanguage == .chinese ? \"CHAT\" : nil"), "top bar shows logo + Latin brand; pane headers keep CHAT/NOTES marks; settings title is not duplicated")
expect(notesAgentSource.contains("ForEach(NoteRenderMode.visibleCases)")
&& notesAgentSource.contains("switch store.noteRenderMode.visibleMode")
&& !notesAgentSource.contains("ForEach(NoteRenderMode.allCases)")
@@ -3886,8 +3902,8 @@ expect(noteModeControlSource.contains("NoteRenderMode.visibleCases")
&& !noteModeControlSource.contains("Capsule()")
&& noteModeControlSource.contains("noteModeButtonFill(selected: selected, hovering: hovering)")
&& noteModeControlSource.contains("noteModeButtonStroke(selected: selected, hovering: hovering)")
- && noteModeControlSource.contains("WeiBeiTheme.cinnabarSoft.opacity(store.appearanceMode == .inkstone ? 0.44 : 0.62)")
- && noteModeControlSource.contains("WeiBeiTheme.paperRaised.opacity(store.appearanceMode == .inkstone ? 0.16 : 0.20)")
+ && noteModeControlSource.contains("WeiBeiTheme.cinnabarSoft.opacity(store.appearanceMode.isDark ? 0.44 : 0.62)")
+ && noteModeControlSource.contains("WeiBeiTheme.paperRaised.opacity(store.appearanceMode.isDark ? 0.16 : 0.20)")
&& noteModeControlSource.contains(".weibeiHeaderAccessoryGroup()")
&& noteModeControlSource.contains(".scaleEffect(hovering && !selected ? 1.012 : 1)")
&& !noteModeControlSource.contains(".stroke(WeiBeiTheme.hairline.opacity(0.14), lineWidth: 1)"), "note mode control is icon-only so narrow panes never collapse labels into ellipses")
@@ -4087,7 +4103,7 @@ expect(notesAgentSource.contains("if store.hasSelectedMaterial")
&& !notesAgentSource.contains("starterChip(\"出复习题\""), "agent starter chips hide material actions without a selected material and avoid clipped long labels")
expect(notesAgentSource.contains("let availableWidth = max(agentPaneWidth, 1)")
&& notesAgentSource.contains("private enum AgentChatLayoutMetrics")
- && notesAgentSource.contains("static let wideMaxWidth: CGFloat = 1600")
+ && notesAgentSource.contains("static let wideMaxWidth: CGFloat = 920")
&& notesAgentSource.contains("static let compactMaxWidth: CGFloat = 560")
&& notesAgentSource.contains("AgentChatLayoutMetrics.contentWidth(")
&& notesAgentSource.contains("isImmersiveConversation")
@@ -4275,7 +4291,7 @@ if let selectionStart = notesAgentSource.range(of: "struct FloatingSelectionAgen
expect(notesAgentSource.contains("private func agentInputTray(wide: Bool, contentWidth: CGFloat)"), "agent pane uses a dedicated input tray")
expect(notesAgentSource.contains("private var agentContentMaxWidth: CGFloat?")
&& notesAgentSource.contains("private enum AgentChatLayoutMetrics")
- && notesAgentSource.contains("static let wideComposerHeight: CGFloat = 148")
+ && notesAgentSource.contains("static let wideComposerHeight: CGFloat = 188")
&& notesAgentSource.contains("static let compactComposerHeight: CGFloat = 52")
&& notesAgentSource.contains("layout == .immersiveConversation")
&& notesAgentSource.contains("let isUser = message.role == .user")
@@ -4297,7 +4313,7 @@ expect(notesAgentSource.contains("private var agentContentMaxWidth: CGFloat?")
&& workspaceStoreSource.contains("func openAgentCitation")
&& workspaceStoreSource.contains("resolveStudyItem(matchingCitationTitle:")
&& workspaceStoreSource.contains("keepFloatingSelectionForAnswer")
- && workspaceStoreSource.contains("SelectionAskThread"), "agent uses one standard centered reading column; immersive chat is 1600×148, three-pane is 560×52, selection-ask float keeps answers")
+ && workspaceStoreSource.contains("SelectionAskThread"), "agent uses one centered reading column; immersive Codex-like chat is 920×188, three-pane is 560×52")
expect(notesAgentSource.contains("private let agentBottomAnchorID = \"agentConversationBottom\"")
&& notesAgentSource.contains(".id(agentBottomAnchorID)")
&& notesAgentSource.contains("proxy.scrollTo(agentBottomAnchorID, anchor: .bottom)")
@@ -4311,9 +4327,10 @@ expect(notesAgentSource.contains("// No scrollTargetLayout / scrollPosition / mi
expect(notesAgentSource.contains("private var agentInputMaxWidth: CGFloat?")
&& notesAgentSource.contains("AgentChatLayoutMetrics.contentWidth(")
&& notesAgentSource.contains("composerFieldHeight")
- && notesAgentSource.contains("static let wideComposerHeight: CGFloat = 148")
- && notesAgentSource.contains(".frame(width: contentWidth, height: fieldHeight, alignment: .bottom)")
- && notesAgentSource.contains("agent-input-tray-wide"), "agent composer matches reading column width with a fixed immersive height")
+ && notesAgentSource.contains("static let wideComposerHeight: CGFloat = 188")
+ && notesAgentSource.contains("showsModelFooter: wide")
+ && notesAgentSource.contains(".frame(width: contentWidth, alignment: .bottom)")
+ && notesAgentSource.contains("agent-input-tray-wide"), "agent composer matches reading column width with Codex-like immersive height and model footer")
expect(notesAgentSource.contains(".contentShape(Rectangle())")
&& notesAgentSource.contains("focused.wrappedValue = true")
&& notesAgentSource.components(separatedBy: "AgentComposerField(").count >= 3
@@ -4328,18 +4345,18 @@ expect(notesAgentSource.contains("ScrollView(showsIndicators: true)")
&& notesAgentSource.contains("AgentPaneWidthKey")
&& !notesAgentSource.contains("GeometryReader { paneGeometry in")
&& !notesAgentSource.contains("onMarkdownHeightChange: message.id == store.messages.last?.id"), "agent conversation keeps a light scroll affordance and follows the latest turn without WebView height thrash")
-expect(notesAgentSource.contains("WeiBeiGlassHeaderBackground(") && notesAgentSource.contains("WeiBeiTheme.glassTint.opacity(0.34)"), "agent input tray uses paper glass fade instead of a hard white strip")
+expect(notesAgentSource.contains("WeiBeiGlassHeaderBackground(") && notesAgentSource.contains("WeiBeiTheme.glassTint.opacity(0.40)"), "agent input tray uses paper glass fade instead of a hard white strip")
expect(notesAgentSource.contains("WeiBeiTheme.ink.opacity(0.42), WeiBeiTheme.ink.opacity(0.78)")
&& !notesAgentSource.contains(".black.opacity(0.72), .black"), "agent input tray fade mask uses semantic ink instead of a fixed black ramp")
-expect(notesAgentSource.contains("lineLimit: wide ? 1...12 : 1...6")
- && notesAgentSource.contains(".padding(.trailing, showsControl ? trailingPadding : 0)")
- && notesAgentSource.contains(".frame(width: contentWidth, height: fieldHeight, alignment: .bottom)")
+expect(notesAgentSource.contains("lineLimit: wide ? 1...16 : 1...6")
+ && notesAgentSource.contains("showsModelFooter: wide")
+ && notesAgentSource.contains(".frame(width: contentWidth, alignment: .bottom)")
&& notesAgentSource.contains("height: fieldHeight")
&& notesAgentSource.contains("prompt: agentPrompt")
&& notesAgentSource.contains("WeiBeiIconButtonStyle(size: sendButtonSize, prominence: store.isAskingAgent ? .neutral : .primary)")
- && notesAgentSource.contains("sendButtonSize: wide ? 38 : 28")
- && notesAgentSource.contains("sendBottom: wide ? 24 : 8")
- && notesAgentSource.contains("let locksHeight = height >= 72"), "main agent input uses a fixed-height composer in wide chat and keeps send inside the field edge")
+ && notesAgentSource.contains("sendButtonSize: wide ? 36 : 28")
+ && notesAgentSource.contains("sendBottom: wide ? 14 : 8")
+ && notesAgentSource.contains("let locksHeight = height >= 72"), "main agent input uses a fixed-height Codex-like composer in wide chat with model footer and send control")
expect(notesAgentSource.contains("Image(systemName: store.isAskingAgent ? \"stop.fill\" : \"paperplane.fill\")")
&& notesAgentSource.contains("store.isAskingAgent ? store.cancelAgentRequest() : submit()")
&& !notesAgentSource.contains("Image(systemName: \"arrow.up\")")