Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

feat(macos): scale text throughout the app

Sean Fergusona7d9331d043a
diff --git a/apps/macos/App/CodyncMacApp.swift b/apps/macos/App/CodyncMacApp.swift
index 32993b4b..e7365910 100644
--- a/apps/macos/App/CodyncMacApp.swift
+++ b/apps/macos/App/CodyncMacApp.swift
@@ -34,6 +34,8 @@ struct CodyncMacApp: App {
.environment(\.conversationTypography, ConversationTypography(pointSize: conversationFontSize))
.task { launch() }
.modalHost()
+ .appFont(.body)
+ .environment(\.appFontScale, ConversationTypography(pointSize: conversationFontSize).scale)
.environment(host)
.environment(account)
.environment(updates)
@@ -73,6 +75,8 @@ struct CodyncMacApp: App {
}
}
.frame(width: 340)
+ .appFont(.body)
+ .environment(\.appFontScale, ConversationTypography(pointSize: conversationFontSize).scale)
.environment(host)
}
.windowResizability(.contentSize)
@@ -385,7 +389,7 @@ struct PairingPanel: View {
.accessibilityLabel("Pairing code for \(store.hostName)")
}
Text("Scan with the Codync app or the iPhone Camera. No Tailscale or open ports needed: your iPhone connects directly on the same Wi-Fi, and through the encrypted relay anywhere else.")
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.secondary)
.multilineTextAlignment(.center)
.fixedSize(horizontal: false, vertical: true)
@@ -393,7 +397,7 @@ struct PairingPanel: View {
Text(info.urls.isEmpty
? "No network address found and “Reach from anywhere” is off. Connect to Wi-Fi or turn it on."
: "“Reach from anywhere” is off, so the iPhone only reaches \(store.hostName) on the same network.")
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.warning)
.multilineTextAlignment(.center)
.fixedSize(horizontal: false, vertical: true)
@@ -401,7 +405,7 @@ struct PairingPanel: View {
HStack(spacing: 4) {
if let expires = info.expiresAt {
Text("Works once, until \(Date(milliseconds: expires).formatted(date: .omitted, time: .shortened))")
- .font(.caption2).foregroundStyle(Palette.tertiary)
+ .appFont(.caption2).foregroundStyle(Palette.tertiary)
}
IconButton("New code", systemImage: "arrow.clockwise") { Task { await load() } }
IconButton("Copy pairing link", systemImage: "doc.on.doc") {
@@ -410,7 +414,7 @@ struct PairingPanel: View {
}
}
} else if let error {
- Text(error).font(.caption).foregroundStyle(Palette.danger).multilineTextAlignment(.center)
+ Text(error).appFont(.caption).foregroundStyle(Palette.danger).multilineTextAlignment(.center)
IconButton("Try again", systemImage: "arrow.clockwise") { Task { await load() } }
} else {
Spinner(size: 20)
diff --git a/apps/macos/Views/ChatWindow.swift b/apps/macos/Views/ChatWindow.swift
index 98a3c235..f744337e 100644
--- a/apps/macos/Views/ChatWindow.swift
+++ b/apps/macos/Views/ChatWindow.swift
@@ -76,7 +76,7 @@ private struct AccountRestoreView: View {
VStack(spacing: 14) {
Spinner(size: 24)
Text("Checking for a saved account…")
- .font(.callout)
+ .appFont(.callout)
.foregroundStyle(Palette.secondary)
Button("Continue on this Mac", action: onContinue)
.buttonStyle(.plain)
@@ -130,12 +130,12 @@ private struct AccountWelcomeView: View {
VStack(alignment: .leading, spacing: 10) {
Text("Your coding agents,\nas teammates.")
- .font(.system(size: 34, weight: .semibold))
+ .appFont(.system(size: 34, weight: .semibold))
.tracking(-0.6)
.foregroundStyle(Palette.text)
.fixedSize(horizontal: false, vertical: true)
Text("Give each one a name and a project. They work on your computer while you're away.")
- .font(.body)
+ .appFont(.body)
.foregroundStyle(Palette.secondary)
}
.opacity(beat >= 3 ? 1 : 0)
@@ -146,7 +146,7 @@ private struct AccountWelcomeView: View {
VStack(spacing: 10) {
Button(action: onContinue) {
Text("Continue on this Mac")
- .font(.headline)
+ .appFont(.headline)
.frame(maxWidth: .infinity, minHeight: 50)
}
.buttonStyle(.primary)
@@ -154,13 +154,13 @@ private struct AccountWelcomeView: View {
Button { onSignIn(.apple) } label: {
ZStack {
HStack(spacing: 10) {
- Image(systemName: "apple.logo").font(.system(size: 20))
+ Image(systemName: "apple.logo").appFont(.system(size: 20))
Text("Continue with Apple")
}
.opacity(isBusy ? 0 : 1)
if isBusy { Spinner(size: 18) }
}
- .font(.headline)
+ .appFont(.headline)
.frame(maxWidth: .infinity, minHeight: 50)
}
.buttonStyle(.primary)
@@ -178,7 +178,7 @@ private struct AccountWelcomeView: View {
.opacity(isBusy ? 0 : 1)
if isBusy { Spinner(size: 18) }
}
- .font(.headline)
+ .appFont(.headline)
.frame(maxWidth: .infinity, minHeight: 50)
}
.buttonStyle(.secondary)
@@ -186,13 +186,13 @@ private struct AccountWelcomeView: View {
if !isConfigured {
Text("Sign-in isn't configured in this build. You can still use Codync on this Mac.")
- .font(.footnote)
+ .appFont(.footnote)
.foregroundStyle(Palette.tertiary)
.fixedSize(horizontal: false, vertical: true)
}
if let errorMessage {
Text(errorMessage)
- .font(.footnote)
+ .appFont(.footnote)
.foregroundStyle(Palette.warning)
.fixedSize(horizontal: false, vertical: true)
}
@@ -246,7 +246,7 @@ private struct WelcomeChatGlimpse: View {
var body: some View {
VStack(alignment: .leading, spacing: 10) {
Text("Fix the flaky login test")
- .font(.subheadline)
+ .appFont(.subheadline)
.foregroundStyle(Palette.text)
.padding(.horizontal, 14)
.padding(.vertical, 9)
@@ -259,7 +259,7 @@ private struct WelcomeChatGlimpse: View {
CharacterAvatar(shape: "blob", color: "blue", size: 28, mood: replied ? .idle : .working)
if replied {
Text("Done. It raced the session refresh; tests pass on fix/login.")
- .font(.subheadline)
+ .appFont(.subheadline)
.foregroundStyle(Palette.text)
.padding(.horizontal, 14)
.padding(.vertical, 9)
@@ -267,7 +267,7 @@ private struct WelcomeChatGlimpse: View {
.transition(.opacity.combined(with: .scale(scale: 0.92, anchor: .bottomLeading)))
} else {
Text("Working…")
- .font(.subheadline)
+ .appFont(.subheadline)
.foregroundStyle(Palette.tertiary)
.transition(.opacity)
}
@@ -341,12 +341,12 @@ struct EmptyState: View {
var body: some View {
VStack(spacing: 10) {
Image(systemName: icon)
- .font(.system(size: 36, weight: .light))
+ .appFont(.system(size: 36, weight: .light))
.foregroundStyle(Palette.tertiary)
.accessibilityHidden(true)
- Text(title).font(.title3.weight(.semibold)).foregroundStyle(Palette.text)
+ Text(title).appFont(.title3.weight(.semibold)).foregroundStyle(Palette.text)
Text(message)
- .font(.callout)
+ .appFont(.callout)
.foregroundStyle(Palette.secondary)
.multilineTextAlignment(.center)
.frame(maxWidth: 360)
@@ -500,9 +500,9 @@ private struct ChatSplitView: View {
&& !stores.contains(where: { shownIDs.contains($0.computer.id) && $0.mismatch != nil }) {
VStack(spacing: 8) {
Text(search.isEmpty ? "No bots yet" : "No matching bots")
- .font(.system(size: 13, weight: .medium))
+ .appFont(.system(size: 13, weight: .medium))
Text(search.isEmpty ? "Use + to start a new chat." : "Try another name or message.")
- .font(.system(size: 12)).foregroundStyle(Palette.secondary)
+ .appFont(.system(size: 12)).foregroundStyle(Palette.secondary)
}
.allowsHitTesting(false)
}
@@ -553,7 +553,7 @@ private struct ChatSplitView: View {
CharacterAvatar(shape: "squircle", color: "orange", size: 60)
CharacterAvatar(shape: "teardrop", color: "violet", size: 60, mood: .working)
}
- Text("Your coding agents, as teammates.").font(.title2.weight(.semibold))
+ Text("Your coding agents, as teammates.").appFont(.title2.weight(.semibold))
Text("Pick a bot, or create one for each kind of work and point it at a project.")
.foregroundStyle(Palette.secondary)
.multilineTextAlignment(.center)
@@ -792,7 +792,7 @@ extension ChatSplitView {
}
}
.animation(Motion.reduced(Motion.fade, reduceMotion), value: search.isEmpty)
- .font(.system(size: 13))
+ .appFont(.system(size: 13))
.padding(.horizontal, 9)
.frame(height: 28)
.background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 8))
@@ -848,7 +848,7 @@ extension ChatSplitView {
options: onlineStores.map { ($0.computer.id, $0.hostName) })
Spacer()
}
- .font(.callout)
+ .appFont(.callout)
.padding(.horizontal, 22)
.padding(.top, 12)
}
@@ -877,7 +877,7 @@ extension ChatSplitView {
private var profilePlaceholder: some View {
Image(systemName: "person.fill")
- .font(.system(size: 15, weight: .medium))
+ .appFont(.system(size: 15, weight: .medium))
.foregroundStyle(Palette.secondary)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
@@ -889,7 +889,7 @@ extension ChatSplitView {
} label: {
HStack(spacing: 10) {
Image(systemName: "square.grid.2x2")
- .font(.system(size: 14, weight: .regular))
+ .appFont(.system(size: 14, weight: .regular))
.frame(width: 30, height: 30)
.background(Palette.text.opacity(0.025), in: Circle())
Text("Marketplace")
@@ -926,7 +926,7 @@ extension ChatSplitView {
.focused($profileFocused)
}
.buttonStyle(.plain)
- .font(.system(size: 13, weight: .medium))
+ .appFont(.system(size: 13, weight: .medium))
.foregroundStyle(Palette.text)
.padding(.horizontal, 12)
.padding(.top, 6)
@@ -1031,7 +1031,7 @@ private struct UsageSheet: View {
ForEach(withUsage, id: \.computer.id) { store in
if stores.count > 1 {
Label { Text(store.hostName) } icon: { ComputerBadge(store.computer, size: 16) }
- .font(.headline)
+ .appFont(.headline)
}
UsageLimits(usage: store.usage)
}
@@ -1154,7 +1154,7 @@ private struct SidebarAccountPanel: View {
menuRow(items[index], index: index)
}
if let errorMessage, page == "main" {
- Text(errorMessage).font(.system(size: 12)).foregroundStyle(Palette.warning)
+ Text(errorMessage).appFont(.system(size: 12)).foregroundStyle(Palette.warning)
.fixedSize(horizontal: false, vertical: true)
.padding(.horizontal, 10).padding(.vertical, 8)
}
@@ -1172,10 +1172,10 @@ private struct SidebarAccountPanel: View {
private var accountIdentity: some View {
HStack(spacing: 8) {
- Image(systemName: "person.crop.circle").font(.system(size: 15))
- Text(email ?? name).font(.system(size: 12)).lineLimit(1)
+ Image(systemName: "person.crop.circle").appFont(.system(size: 15))
+ Text(email ?? name).appFont(.system(size: 12)).lineLimit(1)
Spacer()
- if !signedIn { Text("Not signed in").font(.system(size: 11)) }
+ if !signedIn { Text("Not signed in").appFont(.system(size: 11)) }
}
.foregroundStyle(Palette.secondary)
.padding(.horizontal, 10)
@@ -1228,12 +1228,12 @@ private struct AccountPanelRow: View {
if let assetIcon {
Image(assetIcon).resizable().scaledToFit().frame(width: 16, height: 16).frame(width: 20)
} else {
- Image(systemName: icon).font(.system(size: 14, weight: .regular)).frame(width: 20)
+ Image(systemName: icon).appFont(.system(size: 14, weight: .regular)).frame(width: 20)
}
- Text(title).font(.system(size: 12)).lineLimit(1)
+ Text(title).appFont(.system(size: 12)).lineLimit(1)
Spacer(minLength: 8)
- if let detail { Text(detail).font(.system(size: 13)).foregroundStyle(Palette.secondary) }
- if chevron { Image(systemName: "chevron.right").font(.system(size: 11)).foregroundStyle(Palette.secondary) }
+ if let detail { Text(detail).appFont(.system(size: 13)).foregroundStyle(Palette.secondary) }
+ if chevron { Image(systemName: "chevron.right").appFont(.system(size: 11)).foregroundStyle(Palette.secondary) }
}
.foregroundStyle(destructive ? Palette.danger : Palette.text)
.padding(.horizontal, 10)
diff --git a/apps/macos/Views/ComputersView.swift b/apps/macos/Views/ComputersView.swift
index 5e6f049c..9e70ef47 100644
--- a/apps/macos/Views/ComputersView.swift
+++ b/apps/macos/Views/ComputersView.swift
@@ -45,36 +45,36 @@ struct ApprovalSheet: View {
private var content: some View {
VStack(spacing: 16) {
Image(systemName: request.platform == "macos" ? "laptopcomputer" : "iphone")
- .font(.system(size: 40, weight: .light))
+ .appFont(.system(size: 40, weight: .light))
.foregroundStyle(Palette.secondary)
.accessibilityHidden(true)
VStack(spacing: 4) {
Text("\(request.deviceName) wants to use \(approval.store.hostName)")
- .font(.title3.weight(.semibold))
+ .appFont(.title3.weight(.semibold))
.multilineTextAlignment(.center)
if let email = request.email {
- Text("Signed in as \(email)").font(.callout).foregroundStyle(Palette.secondary)
+ Text("Signed in as \(email)").appFont(.callout).foregroundStyle(Palette.secondary)
}
}
if let code = request.code {
Text(Self.spaced(code))
- .font(.system(size: 48, weight: .semibold, design: .monospaced))
+ .appFont(.system(size: 48, weight: .semibold, design: .monospaced))
.foregroundStyle(Palette.text)
.textSelection(.enabled)
.accessibilityLabel("Code \(code.map(String.init).joined(separator: " "))")
Text("Approve only if \(request.deviceName) shows exactly this code. If it doesn't, deny: someone may be trying to get in.")
- .font(.callout)
+ .appFont(.callout)
.foregroundStyle(Palette.secondary)
.multilineTextAlignment(.center)
.fixedSize(horizontal: false, vertical: true)
} else {
Spinner()
Text("Waiting for \(request.deviceName) to show its code…")
- .font(.callout)
+ .appFont(.callout)
.foregroundStyle(Palette.secondary)
}
if let error {
- Text(error).font(.caption).foregroundStyle(Palette.danger).multilineTextAlignment(.center)
+ Text(error).appFont(.caption).foregroundStyle(Palette.danger).multilineTextAlignment(.center)
.transition(.opacity.combined(with: .move(edge: .top)))
}
HStack(spacing: 12) {
@@ -155,7 +155,7 @@ struct ComputersView: View {
}
if host.ssh.profiles.isEmpty {
Text("Run bots on another computer you reach with SSH. It needs codync-host installed; your SSH keys stay on this Mac.")
- .font(.callout)
+ .appFont(.callout)
.foregroundStyle(Palette.secondary)
.fixedSize(horizontal: false, vertical: true)
}
@@ -179,17 +179,17 @@ struct ComputersView: View {
}
if !account.isSignedIn {
Text("Sign in to reach the other computers in your account from this Mac.")
- .font(.callout).foregroundStyle(Palette.secondary)
+ .appFont(.callout).foregroundStyle(Palette.secondary)
} else if reached.isEmpty && others.isEmpty {
- Text("No other computers in your account yet.").font(.callout).foregroundStyle(Palette.secondary)
+ Text("No other computers in your account yet.").appFont(.callout).foregroundStyle(Palette.secondary)
}
ForEach(reached) { computer in
if let store = host.accounts.store(for: computer.id) {
HStack(spacing: 10) {
ComputerBadge(store.computer, size: 22)
VStack(alignment: .leading, spacing: 1) {
- Text(store.hostName).font(.callout.weight(.medium))
- Text(host.accounts.statusText(store)).font(.caption)
+ Text(store.hostName).appFont(.callout.weight(.medium))
+ Text(host.accounts.statusText(store)).appFont(.caption)
.foregroundStyle(host.accounts.isStale(computer.id) ? Palette.warning : Palette.secondary)
}
RouteLabel(store: store, ssh: false).foregroundStyle(Palette.tertiary)
@@ -210,7 +210,7 @@ private struct SectionTitle: View {
let title: String
init(_ title: String) { self.title = title }
var body: some View {
- Text(title).font(.headline).foregroundStyle(Palette.text).accessibilityAddTraits(.isHeader)
+ Text(title).appFont(.headline).foregroundStyle(Palette.text).accessibilityAddTraits(.isHeader)
}
}
@@ -227,8 +227,8 @@ private struct AccountComputerRow: View {
HStack(spacing: 10) {
ComputerBadge(Computer(id: computer.id, name: computer.name, signKey: computer.signKey, device: computer.device), size: 22)
VStack(alignment: .leading, spacing: 1) {
- Text(computer.name).font(.callout.weight(.medium))
- Text(computer.isOnline ? "Online" : "Offline").font(.caption).foregroundStyle(Palette.secondary)
+ Text(computer.name).appFont(.callout.weight(.medium))
+ Text(computer.isOnline ? "Online" : "Offline").appFont(.caption).foregroundStyle(Palette.secondary)
}
Spacer()
if ticket == nil {
@@ -249,10 +249,10 @@ private struct AccountComputerRow: View {
if let ticket {
HStack(spacing: 12) {
Text(ticket.code.count == 6 ? "\(ticket.code.prefix(3)) \(ticket.code.suffix(3))" : ticket.code)
- .font(.system(size: 26, weight: .semibold, design: .monospaced))
+ .appFont(.system(size: 26, weight: .semibold, design: .monospaced))
.accessibilityLabel("Code \(ticket.code.map(String.init).joined(separator: " "))")
Text("Approve on \(computer.name) only if it shows this code.")
- .font(.callout).foregroundStyle(Palette.secondary)
+ .appFont(.callout).foregroundStyle(Palette.secondary)
.fixedSize(horizontal: false, vertical: true)
Spacer()
IconButton("Cancel request", systemImage: "xmark.circle") {
@@ -289,9 +289,9 @@ private struct ManagedComputerCard: View {
HStack(spacing: 10) {
ComputerBadge(store.computer, size: 26)
VStack(alignment: .leading, spacing: 1) {
- Text(store.hostName).font(.headline)
+ Text(store.hostName).appFont(.headline)
Text(ssh ? "Over SSH · \(store.statusText)" : "This Mac · \(store.statusText)")
- .font(.caption).foregroundStyle(Palette.secondary)
+ .appFont(.caption).foregroundStyle(Palette.secondary)
}
Spacer()
IconButton("Pair iPhone", systemImage: "qrcode", selected: showPairing) { showPairing.toggle() }
@@ -308,7 +308,7 @@ private struct ManagedComputerCard: View {
Toggle(isOn: Binding(get: { cloud?.enabled ?? false }, set: { on in run { await host.setCloud(store, enabled: on) } })) {
VStack(alignment: .leading, spacing: 1) {
Text("Reach from anywhere")
- Text(cloudLine).font(.caption).foregroundStyle(cloud?.lastError == nil ? Palette.secondary : Palette.warning)
+ Text(cloudLine).appFont(.caption).foregroundStyle(cloud?.lastError == nil ? Palette.secondary : Palette.warning)
}
}
.toggleStyle(.codync)
@@ -323,7 +323,7 @@ private struct ManagedComputerCard: View {
VStack(alignment: .leading, spacing: 1) {
Text("Skip the 6-digit check")
Text(autoApproval ? "Devices on your account get in on their own." : "Each new device shows a code you approve here.")
- .font(.caption).foregroundStyle(autoApproval ? Palette.warning : Palette.secondary)
+ .appFont(.caption).foregroundStyle(autoApproval ? Palette.warning : Palette.secondary)
}
}
.toggleStyle(.codync)
@@ -332,10 +332,10 @@ private struct ManagedComputerCard: View {
}
VStack(alignment: .leading, spacing: 6) {
- Text("Devices that can use \(store.hostName)").font(.subheadline.weight(.semibold))
+ Text("Devices that can use \(store.hostName)").appFont(.subheadline.weight(.semibold))
if let devices {
if devices.isEmpty {
- Text("None yet. Pair an iPhone, or approve one from your account.").font(.caption).foregroundStyle(Palette.secondary)
+ Text("None yet. Pair an iPhone, or approve one from your account.").appFont(.caption).foregroundStyle(Palette.secondary)
}
ForEach(devices) { device in deviceRow(device).transition(.opacity.combined(with: .move(edge: .top))) }
} else {
@@ -385,14 +385,14 @@ private struct ManagedComputerCard: View {
if let owner = cloud?.owner {
Image(systemName: "person.crop.circle.badge.checkmark").foregroundStyle(Palette.secondary).accessibilityHidden(true)
Text(owner.userId == account.userID ? "In your account" : "In \(owner.email ?? "another") account")
- .font(.callout)
+ .appFont(.callout)
Spacer()
Button("Remove from account") { confirmUnclaim = true }
.buttonStyle(.secondary)
.disabled(busy || store.connection != .online)
} else {
Image(systemName: "person.crop.circle.badge.plus").foregroundStyle(Palette.secondary).accessibilityHidden(true)
- Text(account.isSignedIn ? "Not in your account" : "Sign in to add it to your account").font(.callout)
+ Text(account.isSignedIn ? "Not in your account" : "Sign in to add it to your account").appFont(.callout)
Spacer()
if account.isSignedIn {
Button(busy ? "Adding…" : "Add to account") { run { await host.claim(store) } }
@@ -410,8 +410,8 @@ private struct ManagedComputerCard: View {
.foregroundStyle(Palette.secondary)
.accessibilityHidden(true)
VStack(alignment: .leading, spacing: 1) {
- Text(device.name).font(.callout)
- Text(detail(device)).font(.caption).foregroundStyle(Palette.tertiary)
+ Text(device.name).appFont(.callout)
+ Text(detail(device)).appFont(.caption).foregroundStyle(Palette.tertiary)
}
Spacer()
IconButton("Revoke access", systemImage: "xmark.circle") { confirmRevoke = device }
@@ -457,8 +457,8 @@ private struct SSHRow: View {
HStack(spacing: 10) {
Image(systemName: "terminal").frame(width: 22).foregroundStyle(Palette.secondary).accessibilityHidden(true)
VStack(alignment: .leading, spacing: 1) {
- Text(profile.name.isEmpty ? profile.host : profile.name).font(.callout.weight(.medium))
- Text(line(status)).font(.caption).foregroundStyle(isProblem(status) ? Palette.warning : Palette.secondary)
+ Text(profile.name.isEmpty ? profile.host : profile.name).appFont(.callout.weight(.medium))
+ Text(line(status)).appFont(.caption).foregroundStyle(isProblem(status) ? Palette.warning : Palette.secondary)
.fixedSize(horizontal: false, vertical: true)
}
Spacer()
@@ -474,9 +474,9 @@ private struct SSHRow: View {
if case let .confirmHostKey(name, fingerprints, _) = status {
VStack(alignment: .leading, spacing: 6) {
Text("First connection to \(name). Check that its host key fingerprint matches what the computer's owner sees (`ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub`).")
- .font(.caption).foregroundStyle(Palette.secondary)
+ .appFont(.caption).foregroundStyle(Palette.secondary)
.fixedSize(horizontal: false, vertical: true)
- ForEach(fingerprints, id: \.self) { Text($0).font(.caption.monospaced()).textSelection(.enabled) }
+ ForEach(fingerprints, id: \.self) { Text($0).appFont(.caption.monospaced()).textSelection(.enabled) }
HStack {
Button("Trust and connect") { host.ssh.trustHostKey(profile.id) }.buttonStyle(.primary)
Button("Cancel") { host.ssh.disconnect(profile.id) }.buttonStyle(.secondary)
@@ -487,7 +487,7 @@ private struct SSHRow: View {
if status == .notInstalled {
HStack(spacing: 6) {
Text(SSH.installCommand)
- .font(.caption.monospaced())
+ .appFont(.caption.monospaced())
.textSelection(.enabled)
.padding(6)
.frame(maxWidth: .infinity, alignment: .leading)
@@ -583,10 +583,10 @@ private struct SSHProfileEditor: View {
SSHField("Codync port", text: $remotePort, prompt: "")
}
Text("Codync opens an SSH tunnel to codync-host on that computer's loopback. It uses your SSH config and ssh-agent; agent forwarding stays off.")
- .font(.caption).foregroundStyle(Palette.secondary)
+ .appFont(.caption).foregroundStyle(Palette.secondary)
.fixedSize(horizontal: false, vertical: true)
if let problem {
- Text(problem).font(.caption).foregroundStyle(Palette.danger)
+ Text(problem).appFont(.caption).foregroundStyle(Palette.danger)
.transition(.opacity.combined(with: .move(edge: .top)))
}
}
diff --git a/kit/Sources/CodyncKit/Design/AppFont.swift b/kit/Sources/CodyncKit/Design/AppFont.swift
new file mode 100644
index 00000000..f389dc14
--- /dev/null
+++ b/kit/Sources/CodyncKit/Design/AppFont.swift
@@ -0,0 +1,165 @@
+import SwiftUI
+#if os(macOS)
+import AppKit
+#endif
+
+/// Keeps each font's hierarchy and styling while applying the Mac text preference.
+public struct AppFont: Sendable {
+ private var original: Font
+ private var pointSize: CGFloat
+ private var fontWeight: Font.Weight
+ private var design: Font.Design
+ private var automaticBoldWeight: Font.Weight = .bold
+ private var hasMonospacedDigits = false
+
+ private init(_ original: Font, size: CGFloat, weight: Font.Weight = .regular, design: Font.Design = .default) {
+ self.original = original
+ pointSize = size
+ fontWeight = weight
+ self.design = design
+ }
+
+ public static var largeTitle: Self { semantic(.largeTitle) }
+ public static var title: Self { semantic(.title) }
+ public static var title2: Self { semantic(.title2) }
+ public static var title3: Self { semantic(.title3) }
+ public static var headline: Self { semantic(.headline) }
+ public static var subheadline: Self { semantic(.subheadline) }
+ public static var body: Self { semantic(.body) }
+ public static var callout: Self { semantic(.callout) }
+ public static var footnote: Self { semantic(.footnote) }
+ public static var caption: Self { semantic(.caption) }
+ public static var caption2: Self { semantic(.caption2) }
+
+ /// Codync's existing compact desktop fonts; phones retain their semantic fonts.
+ public static var compactBody: Self {
+ #if os(macOS)
+ system(size: 12)
+ #else
+ body
+ #endif
+ }
+
+ public static var compactSecondary: Self {
+ #if os(macOS)
+ system(size: 11)
+ #else
+ subheadline
+ #endif
+ }
+
+ public static func system(size: CGFloat, weight: Font.Weight? = nil, design: Font.Design? = nil) -> Self {
+ Self(.system(size: size, weight: weight, design: design), size: size, weight: weight ?? .regular, design: design ?? .default)
+ }
+
+ public static func system(_ style: Font.TextStyle, design: Font.Design? = nil) -> Self {
+ var font = semantic(style)
+ font.original = .system(style, design: design)
+ font.design = design ?? .default
+ return font
+ }
+
+ public func weight(_ weight: Font.Weight) -> Self {
+ var font = self
+ font.original = original.weight(weight)
+ font.fontWeight = weight
+ return font
+ }
+
+ public func bold() -> Self {
+ var font = self
+ font.original = original.bold()
+ font.fontWeight = automaticBoldWeight
+ return font
+ }
+
+ public func monospaced() -> Self {
+ var font = self
+ font.original = original.monospaced()
+ font.design = .monospaced
+ return font
+ }
+
+ public func monospacedDigit() -> Self {
+ var font = self
+ font.original = original.monospacedDigit()
+ font.hasMonospacedDigits = true
+ return font
+ }
+
+ func scaled(by scale: CGFloat) -> Font {
+ #if os(macOS)
+ guard scale != 1 else { return original }
+ if #available(macOS 26, *) {
+ // Semantic scaling rounds to quarter points; the preference also
+ // scales explicit point fonts, so retain their exact relative size.
+ return original.scaled(by: scale).pointSize(pointSize * scale)
+ }
+ return fallbackScaled(by: scale)
+ #else
+ return original
+ #endif
+ }
+
+ /// macOS 14–15 lack Font.scaled(by:); recreate the native font with its traits.
+ func fallbackScaled(by scale: CGFloat) -> Font {
+ let font = Font.system(size: pointSize * scale, weight: fontWeight, design: design)
+ return hasMonospacedDigits ? font.monospacedDigit() : font
+ }
+
+ private static func semantic(_ style: Font.TextStyle) -> Self {
+ #if os(macOS)
+ let nativeStyle: NSFont.TextStyle
+ switch style {
+ case .largeTitle: nativeStyle = .largeTitle
+ case .title: nativeStyle = .title1
+ case .title2: nativeStyle = .title2
+ case .title3: nativeStyle = .title3
+ case .headline: nativeStyle = .headline
+ case .subheadline: nativeStyle = .subheadline
+ case .callout: nativeStyle = .callout
+ case .footnote: nativeStyle = .footnote
+ case .caption: nativeStyle = .caption1
+ case .caption2: nativeStyle = .caption2
+ default: nativeStyle = .body
+ }
+ let size = NSFont.preferredFont(forTextStyle: nativeStyle, options: [:]).pointSize
+ #else
+ let size: CGFloat = 0 // Only used by the Mac fallback.
+ #endif
+ var font = Self(.system(style), size: size, weight: style == .headline ? .bold : .regular)
+ // Native .bold() uses semibold for small semantic text and bold for
+ // titles/headlines. An explicit .weight(.bold) remains explicit bold.
+ switch style {
+ case .largeTitle, .title, .title2, .title3, .headline: font.automaticBoldWeight = .bold
+ default: font.automaticBoldWeight = .semibold
+ }
+ return font
+ }
+}
+
+private struct AppFontScaleKey: EnvironmentKey {
+ static let defaultValue: CGFloat = 1
+}
+
+public extension EnvironmentValues {
+ var appFontScale: CGFloat {
+ get { self[AppFontScaleKey.self] }
+ set { self[AppFontScaleKey.self] = newValue }
+ }
+}
+
+private struct AppFontModifier: ViewModifier {
+ let font: AppFont
+ @Environment(\.appFontScale) private var scale
+
+ func body(content: Content) -> some View {
+ content.font(font.scaled(by: scale))
+ }
+}
+
+public extension View {
+ func appFont(_ font: AppFont) -> some View {
+ modifier(AppFontModifier(font: font))
+ }
+}
diff --git a/kit/Sources/CodyncKit/Design/CharacterAvatar.swift b/kit/Sources/CodyncKit/Design/CharacterAvatar.swift
index 373a7664..adf40f39 100644
--- a/kit/Sources/CodyncKit/Design/CharacterAvatar.swift
+++ b/kit/Sources/CodyncKit/Design/CharacterAvatar.swift
@@ -193,7 +193,7 @@ public struct GroupAvatar: View {
switch members.count {
case 0:
Image(systemName: "person.2")
- .font(.system(size: size * 0.4))
+ .appFont(.system(size: size * 0.4))
.foregroundStyle(.secondary)
case 1:
CharacterAvatar(bot: members[0], size: size, animated: animated)
@@ -212,7 +212,7 @@ public struct GroupAvatar: View {
place(members[3], size * 0.5, .bottomTrailing)
} else {
Text("+\(members.count - 3)")
- .font(.system(size: size * 0.24, weight: .bold, design: .rounded))
+ .appFont(.system(size: size * 0.24, weight: .bold, design: .rounded))
.foregroundStyle(.secondary)
.frame(width: size * 0.5, height: size * 0.5)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomTrailing)
@@ -249,7 +249,7 @@ public struct AvatarWithStatus: View {
.overlay(alignment: .bottomTrailing) {
if bot.needsInput {
Image(systemName: "exclamationmark")
- .font(.system(size: size * 0.2, weight: .black))
+ .appFont(.system(size: size * 0.2, weight: .black))
.foregroundStyle(.white)
.frame(width: size * 0.36, height: size * 0.36)
.background(Palette.warning, in: Circle())
diff --git a/kit/Sources/CodyncKit/Design/UsageBar.swift b/kit/Sources/CodyncKit/Design/UsageBar.swift
index 0b92e039..d42e11f8 100644
--- a/kit/Sources/CodyncKit/Design/UsageBar.swift
+++ b/kit/Sources/CodyncKit/Design/UsageBar.swift
@@ -111,7 +111,7 @@ public struct ProviderMascot: View {
.overlay(alignment: .topTrailing) {
if full {
Image(systemName: "exclamationmark.circle.fill")
- .font(.system(size: size * 0.34, weight: .bold))
+ .appFont(.system(size: size * 0.34, weight: .bold))
.symbolRenderingMode(.palette)
.foregroundStyle(.white, Palette.danger)
.offset(x: size * 0.12, y: -size * 0.12)
diff --git a/kit/Sources/CodyncUI/Bots/AgentModelPicker.swift b/kit/Sources/CodyncUI/Bots/AgentModelPicker.swift
index d5ff5649..3afa9288 100644
--- a/kit/Sources/CodyncUI/Bots/AgentModelPicker.swift
+++ b/kit/Sources/CodyncUI/Bots/AgentModelPicker.swift
@@ -66,16 +66,16 @@ struct AgentModelPicker: View {
if backend != "custom", !loading {
if let failure {
Text(failure)
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.warning)
} else if catalog?.models.isEmpty == true {
Text("This agent doesn't advertise a model list. Leave Default or enter a model ID.")
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.secondary)
}
}
Text("Changing the model starts a new agent session. Chat history is kept.")
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.secondary)
}
.onChange(of: backend) { _, _ in selection = nil }
diff --git a/kit/Sources/CodyncUI/Bots/BotEditorView.swift b/kit/Sources/CodyncUI/Bots/BotEditorView.swift
index ea20f01c..5909fada 100644
--- a/kit/Sources/CodyncUI/Bots/BotEditorView.swift
+++ b/kit/Sources/CodyncUI/Bots/BotEditorView.swift
@@ -156,7 +156,7 @@ struct BotSettingsForm: View {
.lineLimit(3...8)
.fieldBox()
Text("Rules that always apply. Put task-specific requests in the chat instead.")
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.tertiary)
}
@@ -175,7 +175,7 @@ struct BotSettingsForm: View {
}
if computer != nil, model.connection != .online {
Text("Connect this computer to create the bot, or choose another computer.")
- .font(.caption).foregroundStyle(Palette.warning)
+ .appFont(.caption).foregroundStyle(Palette.warning)
}
OptionRow("Agent") {
ChoicePicker(selection: $draft.backend,
@@ -183,12 +183,12 @@ struct BotSettingsForm: View {
fill: Palette.background)
}
if let b = model.hello?.backends.first(where: { $0.id == draft.backend }), !b.available {
- Text(b.installHint).font(.caption).foregroundStyle(Palette.warning)
+ Text(b.installHint).appFont(.caption).foregroundStyle(Palette.warning)
.frame(maxWidth: .infinity, alignment: .leading)
}
if draft.backend == "custom" {
TextField("ACP command, e.g. my-agent --acp", text: Binding(get: { draft.command ?? "" }, set: { draft.command = $0.isEmpty ? nil : $0 }))
- .font(.callout.monospaced())
+ .appFont(.callout.monospaced())
.plainTextInput()
.fieldBox()
}
@@ -206,7 +206,7 @@ struct BotSettingsForm: View {
} label: {
HStack(spacing: 6) {
Text(draft.cwd.isEmpty ? "Personal" : (draft.cwd as NSString).lastPathComponent).lineLimit(1)
- Image(systemName: "chevron.down").font(.caption2.weight(.semibold))
+ Image(systemName: "chevron.down").appFont(.caption2.weight(.semibold))
}
.pill()
}
@@ -215,7 +215,7 @@ struct BotSettingsForm: View {
Text(draft.cwd.isEmpty
? "This bot has its own space for files. It can work in other folders when you ask."
: "This project is the default starting folder. The bot can work elsewhere when you ask.")
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.secondary)
OptionRow("Permissions") {
ChoicePicker(selection: $draft.permission, options: [("ask", "Ask me"), ("auto", "Approve automatically")],
@@ -224,7 +224,7 @@ struct BotSettingsForm: View {
Toggle(isOn: Binding(get: { draft.notify ?? true }, set: { draft.notify = $0 })) {
VStack(alignment: .leading, spacing: 3) {
Text("Notifications").foregroundStyle(Palette.text)
- Text("Get notified when this bot finishes or needs you").font(InterfaceMetrics.secondary).foregroundStyle(Palette.secondary)
+ Text("Get notified when this bot finishes or needs you").appFont(AppFont.compactSecondary).foregroundStyle(Palette.secondary)
}
}
.toggleStyle(.codync)
@@ -235,7 +235,7 @@ struct BotSettingsForm: View {
Text(model.screen?.enabled == true
? "Let this bot see the screen and use the mouse and keyboard. You can watch and take over from your phone."
: "Let this bot see the screen and use the mouse and keyboard. Turn on Remote screen in Codync's menu on the computer first.")
- .font(InterfaceMetrics.secondary).foregroundStyle(Palette.secondary)
+ .appFont(AppFont.compactSecondary).foregroundStyle(Palette.secondary)
}
}
.toggleStyle(.codync)
@@ -264,16 +264,16 @@ struct BotSettingsForm: View {
Text(draft.permission == "auto"
? "Tool requests are approved automatically. Your agent's own settings (like Claude Code's permission rules) still apply."
: "You'll get an approval card and a notification whenever the agent asks.")
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.tertiary)
if let error {
- Text(error).font(.footnote).foregroundStyle(Palette.danger)
+ Text(error).appFont(.footnote).foregroundStyle(Palette.danger)
}
}
.padding(InterfaceMetrics.value(mac: 14, mobile: 20))
}
- .font(InterfaceMetrics.body)
+ .appFont(AppFont.compactBody)
#if os(macOS)
.controlSize(.small)
#endif
@@ -303,7 +303,7 @@ struct Field<Content: View>: View {
var body: some View {
VStack(alignment: .leading, spacing: 6) {
- Text(label).font(InterfaceMetrics.secondary).foregroundStyle(Palette.secondary).padding(.leading, 4)
+ Text(label).appFont(AppFont.compactSecondary).foregroundStyle(Palette.secondary).padding(.leading, 4)
content
}
}
@@ -336,10 +336,10 @@ private struct PluginToggles: View {
var body: some View {
VStack(alignment: .leading, spacing: 6) {
- Text(title).font(InterfaceMetrics.secondary).foregroundStyle(Palette.secondary).padding(.leading, 4)
+ Text(title).appFont(AppFont.compactSecondary).foregroundStyle(Palette.secondary).padding(.leading, 4)
VStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 12, mobile: 16)) {
if items.isEmpty {
- Text(empty).font(InterfaceMetrics.secondary).foregroundStyle(Palette.secondary)
+ Text(empty).appFont(AppFont.compactSecondary).foregroundStyle(Palette.secondary)
}
ForEach(items, id: \.id) { item in
Toggle(isOn: Binding(
@@ -352,7 +352,7 @@ private struct PluginToggles: View {
VStack(alignment: .leading, spacing: 2) {
Text(item.name).foregroundStyle(Palette.text)
if !item.detail.isEmpty {
- Text(item.detail).font(.caption).foregroundStyle(Palette.secondary).lineLimit(2)
+ Text(item.detail).appFont(.caption).foregroundStyle(Palette.secondary).lineLimit(2)
}
}
}
@@ -518,7 +518,7 @@ private struct FolderLevel: View {
onPick(listing.path)
} label: {
Label("Use “\((listing.path as NSString).lastPathComponent)”", systemImage: "checkmark.circle.fill")
- .font(.headline)
+ .appFont(.headline)
.foregroundStyle(Palette.accent)
.frame(maxWidth: .infinity, alignment: .leading)
.contentShape(Rectangle())
@@ -539,7 +539,7 @@ private struct FolderLevel: View {
Text(dir.name).foregroundStyle(Palette.text).lineLimit(1)
Spacer(minLength: 8)
Image(systemName: "chevron.right")
- .font(.caption2.weight(.semibold))
+ .appFont(.caption2.weight(.semibold))
.foregroundStyle(Palette.tertiary)
}
.contentShape(Rectangle())
@@ -554,7 +554,7 @@ private struct FolderLevel: View {
Spinner(size: 20).frame(maxWidth: .infinity)
}
}
- .font(InterfaceMetrics.body)
+ .appFont(AppFont.compactBody)
.padding(InterfaceMetrics.value(mac: 14, mobile: 20))
}
.scrollDismissesKeyboard(.interactively)
diff --git a/kit/Sources/CodyncUI/Bots/BotRow.swift b/kit/Sources/CodyncUI/Bots/BotRow.swift
index e0bdcfc0..1dc3fbaf 100644
--- a/kit/Sources/CodyncUI/Bots/BotRow.swift
+++ b/kit/Sources/CodyncUI/Bots/BotRow.swift
@@ -28,22 +28,22 @@ public struct BotRow: View {
VStack(alignment: .leading, spacing: lineSpacing) {
HStack(alignment: .firstTextBaseline) {
if bot.pinned {
- Image(systemName: "pin.fill").font(.caption2).foregroundStyle(Palette.tertiary)
+ Image(systemName: "pin.fill").appFont(.caption2).foregroundStyle(Palette.tertiary)
}
Text(bot.name)
- .font(InterfaceMetrics.body.weight(.semibold))
+ .appFont(AppFont.compactBody.weight(.semibold))
.foregroundStyle(Palette.text)
.lineLimit(1)
if model.screen?.agentBot == bot.id {
Image(systemName: "cursorarrow.motionlines")
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.accent)
.accessibilityLabel("Using the computer")
}
Spacer(minLength: 8)
#if os(iOS)
Text(RelativeTime.day(Date(milliseconds: bot.lastAt)))
- .font(InterfaceMetrics.secondary)
+ .appFont(AppFont.compactSecondary)
.foregroundStyle(bot.unread > 0 ? Palette.text : Palette.tertiary)
#endif
}
@@ -52,7 +52,7 @@ public struct BotRow: View {
Spacer(minLength: 4)
if bot.unread > 0 {
Text("\(bot.unread)")
- .font(.caption2.bold())
+ .appFont(.caption2.bold())
.foregroundStyle(Palette.onAccent)
.padding(.horizontal, 6)
.frame(minWidth: 18, minHeight: 18)
@@ -79,7 +79,7 @@ public struct BotRow: View {
} icon: {
ThinkingOrb(state: .listening, size: 16, color: Palette.warning)
}
- .font(InterfaceMetrics.secondary)
+ .appFont(AppFont.compactSecondary)
.foregroundStyle(Palette.warning)
.lineLimit(1)
} else if bot.isWorking {
@@ -88,16 +88,16 @@ public struct BotRow: View {
Text(bot.activity.isEmpty ? "Working…" : bot.activity)
.lineLimit(1)
}
- .font(InterfaceMetrics.secondary)
+ .appFont(AppFont.compactSecondary)
.foregroundStyle(Palette.secondary)
} else if bot.status == "error" {
Text(bot.lastMessage ?? "Something went wrong")
- .font(InterfaceMetrics.secondary)
+ .appFont(AppFont.compactSecondary)
.foregroundStyle(Palette.danger)
.lineLimit(1)
} else {
Text(bot.lastMessage ?? "\(model.backendName(bot.backend)) · \(bot.folderName)")
- .font(InterfaceMetrics.secondary)
+ .appFont(AppFont.compactSecondary)
.foregroundStyle(Palette.secondary)
.lineLimit(1)
}
diff --git a/kit/Sources/CodyncUI/Bots/BotTemplateView.swift b/kit/Sources/CodyncUI/Bots/BotTemplateView.swift
index d1679c6a..95cdad3d 100644
--- a/kit/Sources/CodyncUI/Bots/BotTemplateView.swift
+++ b/kit/Sources/CodyncUI/Bots/BotTemplateView.swift
@@ -23,13 +23,13 @@ struct BotTemplateView: View {
VStack(spacing: 0) {
ModalHeader("Create template")
VStack(alignment: .leading, spacing: 20) {
- Text(template.name).font(.subheadline).foregroundStyle(Palette.secondary)
+ Text(template.name).appFont(.subheadline).foregroundStyle(Palette.secondary)
Text("Copy this bot’s settings to reuse as a template. Conversation history and conversation ID are excluded.")
- .font(.callout)
+ .appFont(.callout)
.foregroundStyle(Palette.secondary)
ScrollView {
Text(encoded ?? "Unable to create this template.")
- .font(.system(size: 12, design: .monospaced))
+ .appFont(.system(size: 12, design: .monospaced))
.textSelection(.enabled)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(16)
@@ -37,14 +37,14 @@ struct BotTemplateView: View {
.background(Palette.surface, in: RoundedRectangle(cornerRadius: 12))
HStack {
Text("Includes workspace preferences and agent configuration.")
- .font(.caption).foregroundStyle(Palette.secondary)
+ .appFont(.caption).foregroundStyle(Palette.secondary)
Spacer()
Button {
Pasteboard.copy(encoded)
withAnimation(Motion.reduced(Motion.morph, reduceMotion)) { copied = true }
} label: {
Label(copied ? "Copied" : "Copy template", systemImage: copied ? "checkmark" : "square.on.square")
- .font(.system(size: 13, weight: .semibold))
+ .appFont(.system(size: 13, weight: .semibold))
.padding(.horizontal, 14).padding(.vertical, 9)
.foregroundStyle(Palette.onAccent)
.background(Palette.accentFill, in: RoundedRectangle(cornerRadius: 9))
diff --git a/kit/Sources/CodyncUI/Bots/ComputerFilterHeader.swift b/kit/Sources/CodyncUI/Bots/ComputerFilterHeader.swift
index f5e392f1..c9b19e05 100644
--- a/kit/Sources/CodyncUI/Bots/ComputerFilterHeader.swift
+++ b/kit/Sources/CodyncUI/Bots/ComputerFilterHeader.swift
@@ -78,9 +78,9 @@ public struct ComputerFilterHeader: View {
} else {
Text(summary).lineLimit(1).contentTransition(.opacity)
}
- Image(systemName: "chevron.down").font(.system(size: 8, weight: .semibold))
+ Image(systemName: "chevron.down").appFont(.system(size: 8, weight: .semibold))
}
- .font(.system(size: 12, weight: .medium))
+ .appFont(.system(size: 12, weight: .medium))
.foregroundStyle(Palette.secondary)
.help(summary)
.padding(.vertical, 6)
diff --git a/kit/Sources/CodyncUI/Bots/GroupEditorView.swift b/kit/Sources/CodyncUI/Bots/GroupEditorView.swift
index c7891459..af0d07e5 100644
--- a/kit/Sources/CodyncUI/Bots/GroupEditorView.swift
+++ b/kit/Sources/CodyncUI/Bots/GroupEditorView.swift
@@ -68,7 +68,7 @@ public struct GroupEditorView: View {
}
.animation(Motion.layout, value: members)
Text("Everyone answers in turn unless you @mention someone. Each bot works in its own folder with its own tools.")
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.tertiary)
}
Field("Name") {
@@ -80,7 +80,7 @@ public struct GroupEditorView: View {
.fieldBox()
}
if let error {
- Text(error).font(.footnote).foregroundStyle(Palette.danger).transition(.opacity)
+ Text(error).appFont(.footnote).foregroundStyle(Palette.danger).transition(.opacity)
}
if let group = groupId.flatMap({ model.bots[$0] }) {
Button("Delete group chat", role: .destructive) { confirmDelete = group }
@@ -115,11 +115,11 @@ public struct GroupEditorView: View {
CharacterAvatar(bot: bot, size: InterfaceMetrics.value(mac: 26, mobile: 34), animated: false)
VStack(alignment: .leading, spacing: 1) {
Text(bot.name).foregroundStyle(Palette.text).lineLimit(1)
- Text(bot.folderName).font(.caption).foregroundStyle(Palette.tertiary).lineLimit(1)
+ Text(bot.folderName).appFont(.caption).foregroundStyle(Palette.tertiary).lineLimit(1)
}
Spacer()
Image(systemName: "plus.circle")
- .font(.system(size: 20))
+ .appFont(.system(size: 20))
.foregroundStyle(Palette.tertiary)
}
.padding(.horizontal, 12)
@@ -164,14 +164,14 @@ struct BotChip: View {
HStack(spacing: 6) {
CharacterAvatar(bot: bot, size: 20, animated: false)
Text(bot.name)
- .font(.body)
+ .appFont(.body)
.foregroundStyle(Palette.text)
.lineLimit(1)
.frame(maxWidth: 220, alignment: .leading)
.fixedSize(horizontal: true, vertical: false)
Button(action: remove) {
Image(systemName: "xmark")
- .font(.system(size: 10, weight: .semibold))
+ .appFont(.system(size: 10, weight: .semibold))
.foregroundStyle(Palette.secondary)
.frame(width: 18, height: 18)
.contentShape(Rectangle())
diff --git a/kit/Sources/CodyncUI/Bots/MemoryView.swift b/kit/Sources/CodyncUI/Bots/MemoryView.swift
index e456dcda..3c97a736 100644
--- a/kit/Sources/CodyncUI/Bots/MemoryView.swift
+++ b/kit/Sources/CodyncUI/Bots/MemoryView.swift
@@ -44,7 +44,7 @@ struct MemoryCard: View {
var body: some View {
VStack(alignment: .leading, spacing: 6) {
HStack {
- Text("Memory").font(InterfaceMetrics.secondary).foregroundStyle(Palette.secondary).padding(.leading, 4)
+ Text("Memory").appFont(AppFont.compactSecondary).foregroundStyle(Palette.secondary).padding(.leading, 4)
Spacer()
if !facts.isEmpty {
Button("Forget everything", systemImage: "trash") { confirmClear = true }
@@ -59,13 +59,13 @@ struct MemoryCard: View {
Text(loaded
? "Nothing yet. The bot remembers who you are and what you work on as you chat."
: "Loading…")
- .font(InterfaceMetrics.secondary)
+ .appFont(AppFont.compactSecondary)
.foregroundStyle(Palette.secondary)
}
ForEach(facts) { fact in
HStack(alignment: .firstTextBaseline, spacing: 10) {
Image(systemName: fact.kind == "profile" ? "person" : "clock")
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.tertiary)
.help(fact.kind == "profile" ? "About you" : "History")
Text(fact.content)
@@ -74,7 +74,7 @@ struct MemoryCard: View {
Button("Forget", systemImage: "xmark") { forget(fact) }
.labelStyle(.iconOnly)
.buttonStyle(.plain)
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.tertiary)
.help("Forget")
}
diff --git a/kit/Sources/CodyncUI/Bots/NewChatView.swift b/kit/Sources/CodyncUI/Bots/NewChatView.swift
index 552ab308..3d630542 100644
--- a/kit/Sources/CodyncUI/Bots/NewChatView.swift
+++ b/kit/Sources/CodyncUI/Bots/NewChatView.swift
@@ -66,7 +66,7 @@ public struct NewChatView: View {
IconButton("Close", systemImage: "xmark", action: close)
.keyboardShortcut(.cancelAction)
}
- .font(.title3)
+ .appFont(.title3)
.padding(.horizontal, 22)
.padding(.vertical, 12)
Rectangle().fill(Palette.border).frame(height: 0.5)
@@ -75,7 +75,7 @@ public struct NewChatView: View {
VStack(spacing: 2) {
PickRow(shortcut: 1, action: create) {
Image(systemName: creating ? "hourglass" : "plus")
- .font(.system(size: 13, weight: .medium))
+ .appFont(.system(size: 13, weight: .medium))
.frame(width: 26, height: 26)
.background(Palette.bubbleAgent, in: Circle())
} label: {
@@ -266,7 +266,7 @@ private struct KeyCap: View {
var body: some View {
Text(text)
- .font(.caption.monospaced())
+ .appFont(.caption.monospaced())
.foregroundStyle(Palette.secondary)
.frame(minWidth: 18, minHeight: 18)
.background(Palette.background, in: RoundedRectangle(cornerRadius: 4))
diff --git a/kit/Sources/CodyncUI/Chrome.swift b/kit/Sources/CodyncUI/Chrome.swift
index 3585c1bd..943e53e9 100644
--- a/kit/Sources/CodyncUI/Chrome.swift
+++ b/kit/Sources/CodyncUI/Chrome.swift
@@ -55,7 +55,7 @@ public struct IconButtonStyle: ButtonStyle {
var body: some View {
configuration.label
- .font(.system(size: size / 2, weight: .medium))
+ .appFont(.system(size: size / 2, weight: .medium))
.foregroundStyle(selected ? Palette.onAccent : hovering ? Palette.text : Palette.secondary)
.frame(width: size, height: size)
.background(
@@ -89,7 +89,7 @@ public struct ModalHeader<Trailing: View>: View {
public var body: some View {
HStack(spacing: 8) {
Text(title)
- .font(InterfaceMetrics.body.weight(.semibold))
+ .appFont(AppFont.compactBody.weight(.semibold))
.foregroundStyle(Palette.text)
.lineLimit(1)
Spacer(minLength: 8)
@@ -572,8 +572,8 @@ public struct TabBar<ID: Hashable>: View {
withAnimation(Motion.reduced(Motion.morph, reduceMotion)) { selection = tab.id }
} label: {
VStack(spacing: 3) {
- Image(systemName: tab.icon).font(.system(size: 18, weight: .medium))
- Text(tab.title).font(.caption2.weight(.medium))
+ Image(systemName: tab.icon).appFont(.system(size: 18, weight: .medium))
+ Text(tab.title).appFont(.caption2.weight(.medium))
}
.foregroundStyle(on ? Palette.text : Palette.secondary)
.frame(width: 76, height: 50)
diff --git a/kit/Sources/CodyncUI/ComputerBadge.swift b/kit/Sources/CodyncUI/ComputerBadge.swift
index e73b68b8..3e3d20c6 100644
--- a/kit/Sources/CodyncUI/ComputerBadge.swift
+++ b/kit/Sources/CodyncUI/ComputerBadge.swift
@@ -23,7 +23,7 @@ public struct ComputerBadge: View {
switch computer?.device {
// SF Symbols has no penguin.
case "linux": Image("computer-linux", bundle: .module).resizable().scaledToFit().frame(width: size * 0.55)
- case let device: Image(systemName: Self.symbol(device)).font(.system(size: size * 0.5, weight: .medium))
+ case let device: Image(systemName: Self.symbol(device)).appFont(.system(size: size * 0.5, weight: .medium))
}
}
diff --git a/kit/Sources/CodyncUI/Controls.swift b/kit/Sources/CodyncUI/Controls.swift
index 32a2ef70..933a20b6 100644
--- a/kit/Sources/CodyncUI/Controls.swift
+++ b/kit/Sources/CodyncUI/Controls.swift
@@ -86,7 +86,7 @@ private struct StyledButton: View {
var body: some View {
configuration.label
- .font(InterfaceMetrics.body.weight(.medium))
+ .appFont(AppFont.compactBody.weight(.medium))
.foregroundStyle(foreground)
.padding(.horizontal, InterfaceMetrics.value(mac: 12, mobile: 18))
.padding(.vertical, InterfaceMetrics.value(mac: 6, mobile: 11))
@@ -247,7 +247,7 @@ struct ReactionStrip: View {
dismiss()
pick.toggle(emoji)
} label: {
- Text(emoji).font(.system(size: InterfaceMetrics.value(mac: 14, mobile: 24)))
+ Text(emoji).appFont(.system(size: InterfaceMetrics.value(mac: 14, mobile: 24)))
}
.buttonStyle(ReactionButtonStyle(chosen: chosen))
.help(chosen ? "Remove \(emoji)" : "React \(emoji)")
@@ -302,10 +302,10 @@ private struct MenuRow: View {
Text(item.title).fixedSize(horizontal: false, vertical: true)
Spacer(minLength: 16)
if let selected = item.selected {
- Image(systemName: "checkmark").font(.caption.weight(.semibold)).opacity(selected ? 1 : 0)
+ Image(systemName: "checkmark").appFont(.caption.weight(.semibold)).opacity(selected ? 1 : 0)
}
}
- .font(InterfaceMetrics.body)
+ .appFont(AppFont.compactBody)
.foregroundStyle(item.destructive ? Palette.danger : Palette.text)
.padding(.horizontal, 10)
.padding(.vertical, InterfaceMetrics.value(mac: 6, mobile: 11))
@@ -505,9 +505,9 @@ public struct ChoicePicker<ID: Hashable>: View {
} label: {
HStack(spacing: 6) {
Text(options.first { $0.id == selection }?.label ?? "Choose").lineLimit(1)
- Image(systemName: "chevron.down").font(.caption2.weight(.semibold)).foregroundStyle(Palette.secondary)
+ Image(systemName: "chevron.down").appFont(.caption2.weight(.semibold)).foregroundStyle(Palette.secondary)
}
- .font(InterfaceMetrics.body)
+ .appFont(AppFont.compactBody)
.foregroundStyle(Palette.text)
.pill(fill: fill)
}
@@ -536,7 +536,7 @@ public struct SegmentedChoice<ID: Hashable>: View {
withAnimation(Motion.reduced(Motion.morph, reduceMotion)) { selection = option.id }
} label: {
Text(option.label)
- .font(InterfaceMetrics.secondary.weight(.medium))
+ .appFont(AppFont.compactSecondary.weight(.medium))
.foregroundStyle(on ? Palette.text : Palette.secondary)
.lineLimit(1)
.frame(maxWidth: .infinity)
@@ -575,12 +575,12 @@ public struct ChoiceList<ID: Hashable>: View {
VStack(alignment: .leading, spacing: 2) {
Text(option.label).foregroundStyle(Palette.text)
if let detail = option.detail, !detail.isEmpty {
- Text(detail).font(InterfaceMetrics.secondary).foregroundStyle(Palette.secondary)
+ Text(detail).appFont(AppFont.compactSecondary).foregroundStyle(Palette.secondary)
}
}
Spacer(minLength: 8)
Image(systemName: "checkmark")
- .font(.caption.weight(.semibold))
+ .appFont(.caption.weight(.semibold))
.foregroundStyle(Palette.text)
.opacity(option.id == selection ? 1 : 0)
}
@@ -606,7 +606,7 @@ public struct CardForm<Content: View>: View {
VStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 14, mobile: 22)) {
content
}
- .font(InterfaceMetrics.body)
+ .appFont(AppFont.compactBody)
.padding(InterfaceMetrics.value(mac: 14, mobile: 20))
.frame(maxWidth: .infinity, alignment: .leading)
}
@@ -630,7 +630,7 @@ public struct CardSection<Content: View>: View {
public var body: some View {
VStack(alignment: .leading, spacing: 6) {
if let title {
- Text(title).font(InterfaceMetrics.secondary).foregroundStyle(Palette.secondary).padding(.leading, 4)
+ Text(title).appFont(AppFont.compactSecondary).foregroundStyle(Palette.secondary).padding(.leading, 4)
}
VStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 12, mobile: 16)) {
content
@@ -640,7 +640,7 @@ public struct CardSection<Content: View>: View {
.frame(maxWidth: .infinity, alignment: .leading)
.background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 18, style: .continuous))
if let footer {
- Text(footer).font(.caption).foregroundStyle(Palette.tertiary).padding(.horizontal, 4)
+ Text(footer).appFont(.caption).foregroundStyle(Palette.tertiary).padding(.horizontal, 4)
}
}
}
@@ -692,7 +692,7 @@ public struct SearchField: View {
.accessibilityLabel("Clear search")
}
}
- .font(InterfaceMetrics.body)
+ .appFont(AppFont.compactBody)
.padding(.horizontal, InterfaceMetrics.value(mac: 10, mobile: 14))
.padding(.vertical, InterfaceMetrics.value(mac: 7, mobile: 10))
.background(Palette.bubbleAgent, in: Capsule())
@@ -721,7 +721,7 @@ public struct Disclosure<Label: View, Content: View>: View {
label
Spacer(minLength: 8)
Image(systemName: "chevron.right")
- .font(.caption2.weight(.semibold))
+ .appFont(.caption2.weight(.semibold))
.foregroundStyle(Palette.secondary)
.rotationEffect(.degrees(isExpanded ? 90 : 0))
}
@@ -813,9 +813,9 @@ private struct DialogCard: View {
.onTapGesture { if cancel != nil { dismiss() } }
VStack(spacing: 14) {
VStack(spacing: 6) {
- Text(title).font(.headline).foregroundStyle(Palette.text)
+ Text(title).appFont(.headline).foregroundStyle(Palette.text)
if let message, !message.isEmpty {
- Text(message).font(InterfaceMetrics.secondary).foregroundStyle(Palette.secondary)
+ Text(message).appFont(AppFont.compactSecondary).foregroundStyle(Palette.secondary)
}
}
.multilineTextAlignment(.center)
@@ -852,7 +852,7 @@ private struct DialogButtonStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label
- .font(InterfaceMetrics.body.weight(.medium))
+ .appFont(AppFont.compactBody.weight(.medium))
.foregroundStyle(destructive ? Color.white : (prominent ? Palette.onAccent : Palette.text))
.padding(.vertical, InterfaceMetrics.value(mac: 8, mobile: 12))
.background(destructive ? Palette.danger : (prominent ? Palette.accentFill : Palette.bubbleUser), in: Capsule())
diff --git a/kit/Sources/CodyncUI/Marketplace/ComposioViews.swift b/kit/Sources/CodyncUI/Marketplace/ComposioViews.swift
index 9f3f53e2..ccf97327 100644
--- a/kit/Sources/CodyncUI/Marketplace/ComposioViews.swift
+++ b/kit/Sources/CodyncUI/Marketplace/ComposioViews.swift
@@ -65,13 +65,13 @@ struct ComposioSection: View {
.frame(maxWidth: .infinity)
}
if let error {
- Text(error).font(.footnote).foregroundStyle(Palette.danger)
+ Text(error).appFont(.footnote).foregroundStyle(Palette.danger)
}
if status?.configured == true {
Button("Composio settings", systemImage: "key") { withAnimation(Motion.layout) { settingUp = true } }
.labelStyle(.titleAndIcon)
.buttonStyle(.plain)
- .font(.footnote)
+ .appFont(.footnote)
.foregroundStyle(Palette.tertiary)
}
}
@@ -121,7 +121,7 @@ struct AppLogo: View {
image.resizable().scaledToFit().padding(size * 0.18)
} placeholder: {
Text(name.prefix(1).uppercased())
- .font(.system(size: size * 0.4, weight: .semibold))
+ .appFont(.system(size: size * 0.4, weight: .semibold))
.foregroundStyle(Palette.secondary)
}
.frame(width: size, height: size)
@@ -163,7 +163,7 @@ struct ComposioKeySheet: View {
SecureField("API key", text: $key, prompt: Text(status?.configured == true ? "Saved (paste to replace)" : "ak_…"))
.plainTextInput()
if let url = URL(string: status?.keyUrl ?? "https://platform.composio.dev") {
- WebLink("Get a key from Composio", url: url).font(.footnote)
+ WebLink("Get a key from Composio", url: url).appFont(.footnote)
}
}
if status?.configured == true {
@@ -236,9 +236,9 @@ struct ComposioConnectSheet: View {
HStack(spacing: 14) {
AppLogo(url: app.logo, name: app.name, size: 52)
VStack(alignment: .leading, spacing: 2) {
- Text(app.name).font(.title3.weight(.semibold))
+ Text(app.name).appFont(.title3.weight(.semibold))
if let d = app.description {
- Text(d).font(.subheadline).foregroundStyle(Palette.secondary).lineLimit(3)
+ Text(d).appFont(.subheadline).foregroundStyle(Palette.secondary).lineLimit(3)
}
}
}
@@ -261,7 +261,7 @@ struct ComposioConnectSheet: View {
}
.plainTextInput()
if let d = f.description {
- Text(d + (f.required ? "" : " (optional)")).font(.caption).foregroundStyle(Palette.secondary)
+ Text(d + (f.required ? "" : " (optional)")).appFont(.caption).foregroundStyle(Palette.secondary)
}
}
}
diff --git a/kit/Sources/CodyncUI/Marketplace/ConnectionRequestCard.swift b/kit/Sources/CodyncUI/Marketplace/ConnectionRequestCard.swift
index e0ecf9a3..1ac71524 100644
--- a/kit/Sources/CodyncUI/Marketplace/ConnectionRequestCard.swift
+++ b/kit/Sources/CodyncUI/Marketplace/ConnectionRequestCard.swift
@@ -18,7 +18,7 @@ struct ConnectionRequestCard: View {
var body: some View {
VStack(alignment: .leading, spacing: 12) {
Label(request.title, systemImage: "lock.shield")
- .font(.headline)
+ .appFont(.headline)
if let text = entry.data.text { Text(text).foregroundStyle(Palette.secondary) }
if request.status == "pending" {
if request.kind == "login" {
@@ -27,14 +27,14 @@ struct ConnectionRequestCard: View {
SecureField("Password or op:// reference", text: $value)
.plainTextInput()
Text("Saved securely on this computer. The bot types it into the sign-in page but never sees it.")
- .font(.caption).foregroundStyle(Palette.secondary)
+ .appFont(.caption).foregroundStyle(Palette.secondary)
} else if request.kind == "secret" {
Text("\(request.field ?? "Credential") · \(request.location ?? "")")
- .font(.caption).foregroundStyle(Palette.secondary)
+ .appFont(.caption).foregroundStyle(Palette.secondary)
SecureField("Credential or op:// reference", text: $value)
.plainTextInput()
Text("Saved securely on this computer. Never added to the conversation.")
- .font(.caption).foregroundStyle(Palette.secondary)
+ .appFont(.caption).foregroundStyle(Palette.secondary)
}
HStack {
Button(request.kind == "login" ? "Save login" : request.kind == "secret" ? "Save and connect" : "Connect") { connect() }
@@ -46,7 +46,7 @@ struct ConnectionRequestCard: View {
} else {
Text(request.status == "ready" ? (request.kind == "login" ? "Saved" : "Connected") : "Cancelled").foregroundStyle(Palette.secondary)
}
- if let error { Text(error).font(.footnote).foregroundStyle(Palette.danger) }
+ if let error { Text(error).appFont(.footnote).foregroundStyle(Palette.danger) }
}
.padding(16)
.background(Palette.surface, in: RoundedRectangle(cornerRadius: 18))
@@ -125,7 +125,7 @@ struct CredentialsView: View {
.buttonStyle(.plain)
}
Text("Values stay hidden. Select a connection to replace its credentials.")
- .font(.caption).foregroundStyle(Palette.secondary)
+ .appFont(.caption).foregroundStyle(Palette.secondary)
}
LoginsSection()
CardSection("1Password", footer: "Use a service account with read access only to a dedicated shared vault. The 1Password CLI must be installed on the computer.") {
@@ -136,7 +136,7 @@ struct CredentialsView: View {
Button("Disconnect") { save("") }.buttonStyle(SecondaryButtonStyle()).disabled(busy)
}
Text("Use op://vault/item/field in a connector's credential field. Codync retrieves the value when the connector runs.")
- .font(.footnote).foregroundStyle(Palette.secondary)
+ .appFont(.footnote).foregroundStyle(Palette.secondary)
}
if busy { Spinner() }
if let error { Text(error).foregroundStyle(Palette.danger) }
@@ -181,7 +181,7 @@ private struct LoginsSection: View {
HStack {
VStack(alignment: .leading, spacing: 2) {
Text(login.site)
- if !login.username.isEmpty { Text(login.username).font(.caption).foregroundStyle(Palette.secondary) }
+ if !login.username.isEmpty { Text(login.username).appFont(.caption).foregroundStyle(Palette.secondary) }
}
Spacer()
IconButton("Remove", systemImage: "trash") { remove(login) }
@@ -193,7 +193,7 @@ private struct LoginsSection: View {
Button("Save sign-in") { save() }
.buttonStyle(PrimaryButtonStyle())
.disabled(busy || site.isEmpty || password.isEmpty)
- if let error { Text(error).font(.footnote).foregroundStyle(Palette.danger) }
+ if let error { Text(error).appFont(.footnote).foregroundStyle(Palette.danger) }
}
.task { await load() }
.onDisappear { password = "" }
diff --git a/kit/Sources/CodyncUI/Marketplace/MarketplaceView.swift b/kit/Sources/CodyncUI/Marketplace/MarketplaceView.swift
index ceee396d..1dfe5653 100644
--- a/kit/Sources/CodyncUI/Marketplace/MarketplaceView.swift
+++ b/kit/Sources/CodyncUI/Marketplace/MarketplaceView.swift
@@ -172,10 +172,10 @@ public struct MarketplaceView: View {
}
}
if let error {
- Text(error).font(.footnote).foregroundStyle(Palette.danger)
+ Text(error).appFont(.footnote).foregroundStyle(Palette.danger)
}
Text("Connectors come from the official MCP Registry, apps through Composio, skills from Anthropic, agents from the ACP registry. Everything installs on \(model.hostName).")
- .font(.footnote)
+ .appFont(.footnote)
.foregroundStyle(Palette.tertiary)
}
.padding(.horizontal, 44)
@@ -199,7 +199,7 @@ public struct MarketplaceView: View {
ComputerBadge(model.computer, size: 32)
VStack(alignment: .leading, spacing: 0) {
Text("Marketplace")
- .font(.title2.weight(.semibold))
+ .appFont(.title2.weight(.semibold))
.foregroundStyle(Palette.text)
if let computer, computers.count > 1 {
DropdownMenu {
@@ -209,9 +209,9 @@ public struct MarketplaceView: View {
} label: {
HStack(spacing: 4) {
Text(model.hostName)
- Image(systemName: "chevron.down").font(.caption2.weight(.semibold))
+ Image(systemName: "chevron.down").appFont(.caption2.weight(.semibold))
}
- .font(.subheadline)
+ .appFont(.subheadline)
.foregroundStyle(Palette.secondary)
.contentShape(Rectangle())
}
@@ -219,7 +219,7 @@ public struct MarketplaceView: View {
.help("Switch computer")
} else {
Text(model.hostName)
- .font(.subheadline)
+ .appFont(.subheadline)
.foregroundStyle(Palette.secondary)
}
}
@@ -237,7 +237,7 @@ public struct MarketplaceView: View {
}
}
Text("\(installedCount) installed").foregroundStyle(Palette.secondary).lineLimit(1).fixedSize()
- Image(systemName: "chevron.right").font(.caption.weight(.semibold)).foregroundStyle(Palette.tertiary)
+ Image(systemName: "chevron.right").appFont(.caption.weight(.semibold)).foregroundStyle(Palette.tertiary)
}
.contentShape(Rectangle())
}
@@ -340,7 +340,7 @@ private struct InstalledView: View {
ScreenHeader {
BackButton(action: back).keyboardShortcut(.cancelAction)
} title: {
- Text("Installed").font(InterfaceMetrics.body.weight(.semibold)).foregroundStyle(Palette.text)
+ Text("Installed").appFont(AppFont.compactBody.weight(.semibold)).foregroundStyle(Palette.text)
} trailing: {
EmptyView()
}
@@ -450,9 +450,9 @@ private struct EmptyState: View {
var body: some View {
VStack(spacing: 8) {
- Image(systemName: icon).font(.system(size: 28)).foregroundStyle(Palette.tertiary).accessibilityHidden(true)
- Text(title).font(InterfaceMetrics.body.weight(.semibold)).foregroundStyle(Palette.text)
- Text(detail).font(InterfaceMetrics.secondary).foregroundStyle(Palette.secondary).multilineTextAlignment(.center)
+ Image(systemName: icon).appFont(.system(size: 28)).foregroundStyle(Palette.tertiary).accessibilityHidden(true)
+ Text(title).appFont(AppFont.compactBody.weight(.semibold)).foregroundStyle(Palette.text)
+ Text(detail).appFont(AppFont.compactSecondary).foregroundStyle(Palette.secondary).multilineTextAlignment(.center)
}
.frame(maxWidth: .infinity)
.padding(.vertical, 40)
@@ -471,7 +471,7 @@ private struct InstalledRow<Icon: View, Accessory: View>: View {
icon
VStack(alignment: .leading, spacing: 2) {
Text(title).foregroundStyle(Palette.text).lineLimit(1)
- Text(subtitle).font(.caption).foregroundStyle(Palette.secondary).lineLimit(1)
+ Text(subtitle).appFont(.caption).foregroundStyle(Palette.secondary).lineLimit(1)
}
Spacer(minLength: 12)
accessory
@@ -495,7 +495,7 @@ struct MarketSection<Content: View>: View {
var body: some View {
VStack(alignment: .leading, spacing: 12) {
- Text(title).font(.headline).foregroundStyle(Palette.text).padding(.leading, 4)
+ Text(title).appFont(.headline).foregroundStyle(Palette.text).padding(.leading, 4)
content
}
}
@@ -530,9 +530,9 @@ private struct AgentCard: View {
.frame(width: 64, height: 64)
.background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 18, style: .continuous))
VStack(spacing: 2) {
- Text(backend.name).font(.subheadline.weight(.semibold)).foregroundStyle(Palette.text).lineLimit(1)
+ Text(backend.name).appFont(.subheadline.weight(.semibold)).foregroundStyle(Palette.text).lineLimit(1)
Text(status)
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.secondary)
.lineLimit(1)
}
@@ -609,9 +609,9 @@ private struct AgentSheet: View {
.frame(width: 52, height: 52)
.background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 14, style: .continuous))
VStack(alignment: .leading, spacing: 2) {
- Text(backend.name).font(.title3.weight(.semibold))
+ Text(backend.name).appFont(.title3.weight(.semibold))
if let d = backend.description, !d.isEmpty {
- Text(d).font(.subheadline).foregroundStyle(Palette.secondary).lineLimit(3)
+ Text(d).appFont(.subheadline).foregroundStyle(Palette.secondary).lineLimit(3)
}
}
}
@@ -654,7 +654,7 @@ private struct AgentSheet: View {
}
}
if signedIn != true, let detail = auth?.detail, !detail.isEmpty {
- Text(detail).font(.footnote).foregroundStyle(Palette.secondary).textSelection(.enabled)
+ Text(detail).appFont(.footnote).foregroundStyle(Palette.secondary).textSelection(.enabled)
}
// Some CLIs drop the current sign-in the moment a new one starts: no options once signed in.
if signedIn != true, !checking {
@@ -703,19 +703,19 @@ private struct AgentSheet: View {
Button(action: action) {
HStack(spacing: 12) {
Image(systemName: icon)
- .font(.body)
+ .appFont(.body)
.foregroundStyle(Palette.secondary)
.frame(width: 26)
.accessibilityHidden(true)
VStack(alignment: .leading, spacing: 2) {
- Text(title).font(.body.weight(.medium)).foregroundStyle(Palette.text)
- Text(detail).font(.subheadline).foregroundStyle(Palette.secondary).lineLimit(3)
+ Text(title).appFont(.body.weight(.medium)).foregroundStyle(Palette.text)
+ Text(detail).appFont(.subheadline).foregroundStyle(Palette.secondary).lineLimit(3)
}
Spacer(minLength: 8)
if busy {
ThinkingOrb(size: 16, color: Palette.secondary)
} else {
- Image(systemName: "chevron.right").font(.caption.weight(.semibold)).foregroundStyle(Palette.tertiary)
+ Image(systemName: "chevron.right").appFont(.caption.weight(.semibold)).foregroundStyle(Palette.tertiary)
}
}
.contentShape(Rectangle())
@@ -776,7 +776,7 @@ private struct AgentKeysForm: View {
ScreenHeader {
BackButton(action: back).keyboardShortcut(.cancelAction)
} title: {
- Text(method.name).font(InterfaceMetrics.body.weight(.semibold)).foregroundStyle(Palette.text).lineLimit(1)
+ Text(method.name).appFont(AppFont.compactBody.weight(.semibold)).foregroundStyle(Palette.text).lineLimit(1)
} trailing: {
if saving {
Spinner()
@@ -805,7 +805,7 @@ private struct AgentKeysForm: View {
}
}
.plainTextInput()
- Text(v.label + (v.optional ? " (optional)" : "")).font(.caption).foregroundStyle(Palette.secondary)
+ Text(v.label + (v.optional ? " (optional)" : "")).appFont(.caption).foregroundStyle(Palette.secondary)
}
}
}
@@ -816,7 +816,7 @@ private struct AgentKeysForm: View {
WebLink("Get a key", url: url)
}
}
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.tertiary)
.padding(.horizontal, 4)
}
@@ -867,22 +867,22 @@ private struct SetupStepRow: View {
ZStack {
Circle().fill(done ? Palette.accentFill : Palette.bubbleAgent)
if done {
- Image(systemName: "checkmark").font(.caption.weight(.bold)).foregroundStyle(Palette.onAccent)
+ Image(systemName: "checkmark").appFont(.caption.weight(.bold)).foregroundStyle(Palette.onAccent)
} else {
- Text("\(number)").font(.caption.weight(.semibold)).foregroundStyle(Palette.secondary)
+ Text("\(number)").appFont(.caption.weight(.semibold)).foregroundStyle(Palette.secondary)
}
}
.frame(width: 26, height: 26)
.accessibilityHidden(true)
VStack(alignment: .leading, spacing: 2) {
- Text(title).font(.body.weight(.medium)).foregroundStyle(Palette.text)
- Text(detail).font(.subheadline).foregroundStyle(Palette.secondary).textSelection(.enabled)
+ Text(title).appFont(.body.weight(.medium)).foregroundStyle(Palette.text)
+ Text(detail).appFont(.subheadline).foregroundStyle(Palette.secondary).textSelection(.enabled)
}
Spacer(minLength: 8)
if let action {
Button(action.label, action: action.run)
.buttonStyle(.plain)
- .font(.subheadline.weight(.semibold))
+ .appFont(.subheadline.weight(.semibold))
.foregroundStyle(Palette.text)
.padding(.horizontal, 14)
.padding(.vertical, 7)
@@ -910,8 +910,8 @@ struct MarketRow<Icon: View>: View {
HStack(spacing: 14) {
icon.frame(width: 46, height: 46)
VStack(alignment: .leading, spacing: 2) {
- Text(title).font(.body.weight(.medium)).foregroundStyle(Palette.text).lineLimit(1)
- Text(subtitle).font(.subheadline).foregroundStyle(Palette.secondary).lineLimit(1)
+ Text(title).appFont(.body.weight(.medium)).foregroundStyle(Palette.text).lineLimit(1)
+ Text(subtitle).appFont(.subheadline).foregroundStyle(Palette.secondary).lineLimit(1)
}
Spacer(minLength: 8)
if busy {
@@ -919,14 +919,14 @@ struct MarketRow<Icon: View>: View {
} else if added {
Label("Added", systemImage: "checkmark")
.labelStyle(.iconOnly)
- .font(.subheadline.weight(.semibold))
+ .appFont(.subheadline.weight(.semibold))
.foregroundStyle(Palette.secondary)
.frame(width: 60)
.accessibilityLabel("Added")
} else {
Button(addLabel, action: add)
.buttonStyle(.plain)
- .font(.subheadline.weight(.semibold))
+ .appFont(.subheadline.weight(.semibold))
.foregroundStyle(Palette.text)
.padding(.horizontal, 16)
.padding(.vertical, 7)
@@ -994,7 +994,7 @@ private struct ServiceLogo: View {
ZStack {
shape.fill(Palette.bubbleAgent)
Text(name.first.map { String($0).uppercased() } ?? "?")
- .font(.system(size: size * 0.4, weight: .semibold, design: .rounded))
+ .appFont(.system(size: size * 0.4, weight: .semibold, design: .rounded))
.foregroundStyle(Palette.text)
if let faviconURL {
AsyncImage(url: faviconURL) { phase in
@@ -1018,7 +1018,7 @@ struct TileIcon: View {
var body: some View {
RoundedRectangle(cornerRadius: 12, style: .continuous)
.fill(Palette.bubbleAgent)
- .overlay(Image(systemName: systemName).font(.system(size: 18, weight: .medium)).foregroundStyle(Palette.text))
+ .overlay(Image(systemName: systemName).appFont(.system(size: 18, weight: .medium)).foregroundStyle(Palette.text))
}
}
@@ -1066,10 +1066,10 @@ struct InstallConnectorSheet: View {
CardForm {
CardSection {
VStack(alignment: .leading, spacing: 6) {
- Text(item.title).font(.title3.weight(.semibold))
+ Text(item.title).appFont(.title3.weight(.semibold))
if let d = item.description { Text(d).foregroundStyle(Palette.secondary) }
if let w = item.website, let url = URL(string: w) {
- WebLink(w, url: url).font(.footnote).lineLimit(1)
+ WebLink(w, url: url).appFont(.footnote).lineLimit(1)
}
}
.padding(.vertical, 4)
@@ -1100,7 +1100,7 @@ struct InstallConnectorSheet: View {
}
.plainTextInput()
if let d = input.description {
- Text(d + (input.required ? "" : " (optional)")).font(.caption).foregroundStyle(Palette.secondary)
+ Text(d + (input.required ? "" : " (optional)")).appFont(.caption).foregroundStyle(Palette.secondary)
}
}
}
@@ -1202,12 +1202,12 @@ private struct CustomConnectorSheet: View {
if mode == .config {
TextField("{ \"mcpServers\": { … } }", text: $config, axis: .vertical)
.lineLimit(6...16)
- .font(.callout.monospaced())
+ .appFont(.callout.monospaced())
.plainTextInput()
} else {
TextField("Name", text: $name)
TextField(mode == .url ? "https://example.com/mcp" : "npx -y @scope/server", text: $target)
- .font(.callout.monospaced())
+ .appFont(.callout.monospaced())
.plainTextInput()
}
}
@@ -1215,14 +1215,14 @@ private struct CustomConnectorSheet: View {
CardSection("Headers", footer: "Optional, one Name: value per line. Leave empty if the service has you sign in. Saved on \(model.hostName) only.") {
TextField("Authorization: Bearer …", text: $envText, axis: .vertical)
.lineLimit(2...6)
- .font(.callout.monospaced())
+ .appFont(.callout.monospaced())
.plainTextInput()
}
} else if mode == .command {
CardSection("Environment", footer: "One KEY=value per line. Saved on \(model.hostName) only.") {
TextField("API_KEY=…", text: $envText, axis: .vertical)
.lineLimit(2...6)
- .font(.callout.monospaced())
+ .appFont(.callout.monospaced())
.plainTextInput()
}
}
diff --git a/kit/Sources/CodyncUI/Marketplace/SetupTerminal.swift b/kit/Sources/CodyncUI/Marketplace/SetupTerminal.swift
index a02d0e00..207350ee 100644
--- a/kit/Sources/CodyncUI/Marketplace/SetupTerminal.swift
+++ b/kit/Sources/CodyncUI/Marketplace/SetupTerminal.swift
@@ -26,7 +26,7 @@ struct SetupTerminalView: View {
BackButton(action: back).keyboardShortcut(.cancelAction)
} title: {
Text(step == .install ? "Install \(backend.name)" : method?.name ?? "Sign in to \(backend.name)")
- .font(InterfaceMetrics.body.weight(.semibold))
+ .appFont(AppFont.compactBody.weight(.semibold))
.foregroundStyle(Palette.text)
.lineLimit(1)
} trailing: {
@@ -65,7 +65,7 @@ struct SetupTerminalView: View {
Button("Done", action: back).buttonStyle(.primary)
}
}
- .font(.footnote)
+ .appFont(.footnote)
.lineLimit(2)
.padding(.horizontal, 16)
.padding(.vertical, 10)
@@ -232,15 +232,21 @@ private struct TerminalSurface: UIViewRepresentable {
private struct TerminalSurface: NSViewRepresentable {
let session: TermSession
let open: (URL) -> Void
+ @Environment(\.appFontScale) private var fontScale
func makeCoordinator() -> TerminalBridge { TerminalBridge(session: session, open: open) }
func makeNSView(context: Context) -> TerminalView {
let view = context.coordinator.make()
+ view.font = .monospacedSystemFont(ofSize: 12 * fontScale, weight: .regular)
Task { @MainActor in context.coordinator.focus(view) }
return view
}
- func updateNSView(_ view: TerminalView, context: Context) {}
+ func updateNSView(_ view: TerminalView, context: Context) {
+ let size = 12 * fontScale
+ guard view.font.pointSize != size else { return }
+ view.font = .monospacedSystemFont(ofSize: size, weight: .regular)
+ }
}
#endif
diff --git a/kit/Sources/CodyncUI/Routines/RoutineEditorView.swift b/kit/Sources/CodyncUI/Routines/RoutineEditorView.swift
index 4c21625b..c819650d 100644
--- a/kit/Sources/CodyncUI/Routines/RoutineEditorView.swift
+++ b/kit/Sources/CodyncUI/Routines/RoutineEditorView.swift
@@ -59,7 +59,7 @@ struct RoutineEditorView: View {
.disabled(busy || !loaded)
footer
}
- .font(.system(size: InterfaceMetrics.value(mac: 13, mobile: 16)))
+ .appFont(.system(size: InterfaceMetrics.value(mac: 13, mobile: 16)))
.foregroundStyle(Palette.text)
.background(Palette.background)
.codyncDialog("Delete routine?", isPresented: $confirmDelete, message: "This deletes the routine and stops its future runs. This can't be undone.") {
@@ -113,12 +113,12 @@ struct RoutineEditorView: View {
} label: {
HStack(spacing: 6) {
Text("Run settings")
- Image(systemName: "chevron.down").font(.caption2.weight(.semibold))
+ Image(systemName: "chevron.down").appFont(.caption2.weight(.semibold))
.rotationEffect(.degrees(advanced ? 180 : 0))
Spacer()
if !advanced { Text("Timeout \(timeout)s").foregroundStyle(Palette.tertiary) }
}
- .font(InterfaceMetrics.secondary)
+ .appFont(AppFont.compactSecondary)
.foregroundStyle(Palette.secondary)
.padding(.leading, 4)
.contentShape(Rectangle())
@@ -128,7 +128,7 @@ struct RoutineEditorView: View {
if advanced {
Field("Timeout (seconds)") { TextField("3600", text: $timeout).routineInput().focused($typing) }
Text("A run is stopped after this long. 1 second to 24 hours.")
- .font(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
+ .appFont(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
}
}
}
@@ -177,12 +177,12 @@ struct RoutineEditorView: View {
RoutineWebhookPanel(botId: botId, routineId: routine.id)
} else {
Text("Runs each time something is posted to its URL. Save to get the URL and key.")
- .font(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
+ .appFont(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
.fixedSize(horizontal: false, vertical: true)
}
default:
Text("Set up by the bot. Pick Schedule or Webhook to replace it.")
- .font(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
+ .appFont(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
}
}
@@ -200,7 +200,7 @@ struct RoutineEditorView: View {
private var expressionField: some View {
Field("Cron") {
TextField("Cron", text: $schedule.expression, prompt: Text("0 9 * * 1-5").foregroundStyle(Palette.secondary))
- .font(.body.monospaced()).autocorrectionDisabled().routineInput().focused($typing)
+ .appFont(.body.monospaced()).autocorrectionDisabled().routineInput().focused($typing)
.frame(minWidth: 220)
}
}
@@ -216,21 +216,21 @@ struct RoutineEditorView: View {
@ViewBuilder private var schedulePreview: some View {
let preview = checkedSchedule == schedule ? preview : nil
if let previewError {
- Text(previewError).font(.caption).foregroundStyle(Palette.danger)
+ Text(previewError).appFont(.caption).foregroundStyle(Palette.danger)
.fixedSize(horizontal: false, vertical: true)
} else if let preview {
VStack(alignment: .leading, spacing: 2) {
- Text(preview.summary).font(.caption.weight(.medium))
+ Text(preview.summary).appFont(.caption.weight(.medium))
if let next = preview.nextRunAt {
Text("Next \(Date(milliseconds: next).formatted(date: .abbreviated, time: .shortened))")
- .font(.caption).foregroundStyle(Palette.secondary)
+ .appFont(.caption).foregroundStyle(Palette.secondary)
}
if let warning = preview.warning {
- Text(warning).font(.caption).foregroundStyle(Palette.secondary)
+ Text(warning).appFont(.caption).foregroundStyle(Palette.secondary)
}
}
} else {
- Text("minute hour day month weekday").font(.caption.monospaced()).foregroundStyle(Palette.tertiary)
+ Text("minute hour day month weekday").appFont(.caption.monospaced()).foregroundStyle(Palette.tertiary)
}
}
@@ -244,22 +244,22 @@ struct RoutineEditorView: View {
Button("Retry loading schedule") { Task { await loadSchedule() } }.buttonStyle(.plain)
}
if schedule.kind != "cron", let previewError {
- Text(previewError).font(.caption).foregroundStyle(Palette.danger)
+ Text(previewError).appFont(.caption).foregroundStyle(Palette.danger)
}
if let error {
Label(error, systemImage: "exclamationmark.circle")
- .font(.callout).foregroundStyle(Palette.danger).textSelection(.enabled)
+ .appFont(.callout).foregroundStyle(Palette.danger).textSelection(.enabled)
}
if model.isOffline {
Label("Connect to this computer to save your routine.", systemImage: "wifi.slash")
- .font(.caption).foregroundStyle(Palette.danger)
+ .appFont(.caption).foregroundStyle(Palette.danger)
}
#if os(iOS)
if loaded, !model.isOffline,
name.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty ||
instruction.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
Text("Enter a name and instruction above to save.")
- .font(.caption).foregroundStyle(Palette.secondary)
+ .appFont(.caption).foregroundStyle(Palette.secondary)
}
HStack(spacing: 16) { routineActions; saveButton }
#else
diff --git a/kit/Sources/CodyncUI/Routines/RoutineWebhookPanel.swift b/kit/Sources/CodyncUI/Routines/RoutineWebhookPanel.swift
index 81005686..831659bc 100644
--- a/kit/Sources/CodyncUI/Routines/RoutineWebhookPanel.swift
+++ b/kit/Sources/CodyncUI/Routines/RoutineWebhookPanel.swift
@@ -30,12 +30,12 @@ struct RoutineWebhookPanel: View {
}
}
Text(note(webhook))
- .font(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
+ .appFont(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
.fixedSize(horizontal: false, vertical: true)
} else if let error {
- Text(error).font(.caption).foregroundStyle(Palette.danger).padding(.leading, 4)
+ Text(error).appFont(.caption).foregroundStyle(Palette.danger).padding(.leading, 4)
} else {
- Text("Loading webhook…").font(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
+ Text("Loading webhook…").appFont(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
}
}
.task(id: routineId) { await load(rotate: false) }
@@ -57,7 +57,7 @@ struct RoutineWebhookPanel: View {
private func value(_ text: String, copy: String, @ViewBuilder extra: () -> some View = { EmptyView() }) -> some View {
HStack(alignment: .center, spacing: 8) {
Text(text)
- .font(.callout.monospaced())
+ .appFont(.callout.monospaced())
.lineLimit(2)
.truncationMode(.middle)
.textSelection(.enabled)
diff --git a/kit/Sources/CodyncUI/Routines/RoutinesView.swift b/kit/Sources/CodyncUI/Routines/RoutinesView.swift
index 8d9fccf3..2d4bed73 100644
--- a/kit/Sources/CodyncUI/Routines/RoutinesView.swift
+++ b/kit/Sources/CodyncUI/Routines/RoutinesView.swift
@@ -20,19 +20,19 @@ struct RoutinesView: View {
var body: some View {
VStack(alignment: .leading, spacing: 16) {
HStack {
- Text("Routines").font(.system(size: 13, weight: .semibold))
+ Text("Routines").appFont(.system(size: 13, weight: .semibold))
Spacer(minLength: 0)
askInChat
IconButton("Set up a routine", systemImage: "plus") { open(nil) }
.disabled(model.isOffline)
if let close { IconButton("Close routines", systemImage: "xmark", action: close) }
}
- if let loadError { Text(loadError).font(.caption).foregroundStyle(Palette.danger) }
- if let error { Text(error).font(.caption).foregroundStyle(.red).textSelection(.enabled) }
+ if let loadError { Text(loadError).appFont(.caption).foregroundStyle(Palette.danger) }
+ if let error { Text(error).appFont(.caption).foregroundStyle(.red).textSelection(.enabled) }
listing
}
.foregroundStyle(Palette.text)
- .font(.system(size: 13))
+ .appFont(.system(size: 13))
.onChange(of: initialId) { _, id in
if let id { open(id) }
}
@@ -66,7 +66,7 @@ struct RoutinesView: View {
VStack(alignment: .leading, spacing: 0) {
if routines.isEmpty {
Text(loaded ? "No routines yet. Ask the bot for one, or set it up yourself with +." : "Loading routines…")
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.secondary)
.fixedSize(horizontal: false, vertical: true)
} else {
@@ -88,7 +88,7 @@ struct RoutinesView: View {
VStack(alignment: .leading, spacing: 3) {
Text(routine.name).foregroundStyle(Palette.text)
Text(summary(routine))
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(routine.lastError == nil ? Palette.secondary : Palette.danger)
}
.padding(.vertical, 10)
diff --git a/kit/Sources/CodyncUI/Thread/Attachments.swift b/kit/Sources/CodyncUI/Thread/Attachments.swift
index 54e0dc7e..576a1d56 100644
--- a/kit/Sources/CodyncUI/Thread/Attachments.swift
+++ b/kit/Sources/CodyncUI/Thread/Attachments.swift
@@ -129,16 +129,16 @@ struct AttachmentList: View {
private func card(_ file: Attachment) -> some View {
HStack(spacing: 8) {
Image(systemName: AttachmentIcon.symbol(file.name))
- .font(.system(size: 16))
+ .appFont(.system(size: 16))
.foregroundStyle(Palette.secondary)
VStack(alignment: .leading, spacing: 1) {
Text(file.name)
- .font(.subheadline)
+ .appFont(.subheadline)
.foregroundStyle(Palette.text)
.lineLimit(1)
.truncationMode(.middle)
Text(ByteCountFormatter.string(fromByteCount: file.size, countStyle: .file))
- .font(.caption2)
+ .appFont(.caption2)
.foregroundStyle(Palette.tertiary)
}
}
diff --git a/kit/Sources/CodyncUI/Thread/ChatRows.swift b/kit/Sources/CodyncUI/Thread/ChatRows.swift
index aaae419d..5149adc5 100644
--- a/kit/Sources/CodyncUI/Thread/ChatRows.swift
+++ b/kit/Sources/CodyncUI/Thread/ChatRows.swift
@@ -72,7 +72,7 @@ struct AuthorLabel: View {
HStack(spacing: 8) {
if let bot { CharacterAvatar(bot: bot, size: 26, animated: false) }
Text(model.authorName(botId))
- .font(.subheadline.weight(.medium))
+ .appFont(.subheadline.weight(.medium))
.foregroundStyle(bot.map { AvatarPalette.color($0.avatarColor) } ?? Palette.secondary)
}
}
@@ -94,19 +94,19 @@ struct ThreadChip: View {
}
}
Text(summary.count == 1 ? "1 reply" : "\(summary.count) replies")
- .font(.footnote.weight(.semibold))
+ .appFont(.footnote.weight(.semibold))
.foregroundStyle(Palette.accent)
if let unread = summary.unread, unread > 0 {
Text("\(unread) new")
- .font(.footnote.weight(.semibold))
+ .appFont(.footnote.weight(.semibold))
.foregroundStyle(Palette.text)
.transition(.opacity)
} else {
Text(RelativeTime.day(Date(milliseconds: summary.lastAt)))
- .font(.footnote)
+ .appFont(.footnote)
.foregroundStyle(Palette.tertiary)
}
- Image(systemName: "chevron.right").font(.caption2).foregroundStyle(Palette.tertiary)
+ Image(systemName: "chevron.right").appFont(.caption2).foregroundStyle(Palette.tertiary)
}
.padding(.horizontal, 10)
.padding(.vertical, 5)
@@ -172,10 +172,10 @@ struct UserBubble: View {
@ViewBuilder private var status: some View {
switch entry.data.status {
case "sending":
- Text("Sending…").font(.caption2).foregroundStyle(Palette.tertiary)
+ Text("Sending…").appFont(.caption2).foregroundStyle(Palette.tertiary)
case "queued":
Text(botWorking ? "Queued until this response finishes" : "Queued")
- .font(.caption2)
+ .appFont(.caption2)
.foregroundStyle(Palette.tertiary)
case "failed":
HStack(spacing: 10) {
@@ -184,9 +184,9 @@ struct UserBubble: View {
Button("Delete", systemImage: "trash") { model.discard(entry) }.labelStyle(.iconOnly).help("Delete")
}
.buttonStyle(.plain)
- .font(.caption2.bold())
+ .appFont(.caption2.bold())
case "cancelled":
- Text("Not sent — stopped").font(.caption2).foregroundStyle(Palette.tertiary)
+ Text("Not sent — stopped").appFont(.caption2).foregroundStyle(Palette.tertiary)
case "waiting":
HStack(spacing: 10) {
Text("Waiting for the computer to come online").foregroundStyle(Palette.tertiary)
@@ -196,12 +196,12 @@ struct UserBubble: View {
.accessibilityLabel("Don't send")
}
.buttonStyle(.plain)
- .font(.caption2)
+ .appFont(.caption2)
case "delivering":
- Text("Delivered to the computer").font(.caption2).foregroundStyle(Palette.tertiary)
+ Text("Delivered to the computer").appFont(.caption2).foregroundStyle(Palette.tertiary)
default:
#if os(macOS)
- Text(entry.date, style: .time).font(.system(size: 10)).foregroundStyle(Palette.tertiary)
+ Text(entry.date, style: .time).appFont(.system(size: 10)).foregroundStyle(Palette.tertiary)
#else
EmptyView()
#endif
@@ -233,7 +233,7 @@ struct AgentBubble: View {
#if os(macOS)
HStack(spacing: 6) {
Text(entry.date, style: .time)
- .font(.system(size: 10))
+ .appFont(.system(size: 10))
.foregroundStyle(Palette.tertiary)
if hovering {
MessageActions(reactions: model.reactionPick(entry), reply: reply, trace: openTrace) {
@@ -261,7 +261,7 @@ struct NoticeRow: View {
let text = entry.data.text ?? ""
if let seconds = entry.data.callSeconds {
Label("\(text) · \(String(format: "%02d:%02d", seconds / 60, seconds % 60))", systemImage: "waveform")
- .font(.footnote.monospacedDigit())
+ .appFont(.footnote.monospacedDigit())
.foregroundStyle(Palette.secondary)
.frame(maxWidth: .infinity)
} else {
@@ -275,7 +275,7 @@ struct NoticeRow: View {
HStack(spacing: 10) {
Rectangle().fill(Palette.border).frame(height: 1)
Text(text)
- .font(.caption2)
+ .appFont(.caption2)
.foregroundStyle(Palette.tertiary)
.multilineTextAlignment(.center)
.fixedSize(horizontal: false, vertical: true)
@@ -286,7 +286,7 @@ struct NoticeRow: View {
.padding(.vertical, 6)
case "error":
Label {
- Text(text).font(.footnote).foregroundStyle(Palette.text).textSelection(.enabled)
+ Text(text).appFont(.footnote).foregroundStyle(Palette.text).textSelection(.enabled)
} icon: {
Image(systemName: "exclamationmark.triangle.fill").foregroundStyle(Palette.danger)
}
@@ -295,7 +295,7 @@ struct NoticeRow: View {
.background(Palette.danger.opacity(0.12), in: RoundedRectangle(cornerRadius: 12))
default:
Text(text)
- .font(.footnote)
+ .appFont(.footnote)
.foregroundStyle(Palette.secondary)
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
@@ -321,17 +321,17 @@ struct WorkingIndicator: View {
HStack(spacing: 8) {
ThinkingOrb(state: bot.needsInput ? .listening : .working, size: 16, color: bot.needsInput ? Palette.warning : Palette.secondary)
Text(bot.activity.isEmpty ? "Working…" : bot.activity)
- .font(.subheadline)
+ .appFont(.subheadline)
.foregroundStyle(bot.needsInput ? Palette.warning : Palette.secondary)
.lineLimit(1)
if let started = bot.startedAt {
Text(Date(milliseconds: started), style: .timer)
- .font(.footnote.monospacedDigit())
+ .appFont(.footnote.monospacedDigit())
.foregroundStyle(Palette.tertiary)
}
if thinking != nil {
Image(systemName: "chevron.down")
- .font(.caption2.weight(.semibold))
+ .appFont(.caption2.weight(.semibold))
.foregroundStyle(Palette.tertiary)
.rotationEffect(.degrees(expanded ? 180 : 0))
}
@@ -339,7 +339,7 @@ struct WorkingIndicator: View {
if expanded, let thinking {
ScrollView {
Text(thinking)
- .font(.footnote)
+ .appFont(.footnote)
.foregroundStyle(Palette.secondary)
.textSelection(.enabled)
.frame(maxWidth: .infinity, alignment: .leading)
@@ -392,7 +392,7 @@ struct ReactionsRow: View {
ForEach(reactions, id: \.self) { emoji in
Button { model.react(entry, emoji) } label: {
Text(emoji)
- .font(.system(size: InterfaceMetrics.value(mac: 13, mobile: 15)))
+ .appFont(.system(size: InterfaceMetrics.value(mac: 13, mobile: 15)))
.padding(.horizontal, 8)
.padding(.vertical, 3)
.background(Palette.surface, in: Capsule())
diff --git a/kit/Sources/CodyncUI/Thread/Composer.swift b/kit/Sources/CodyncUI/Thread/Composer.swift
index f5a268e0..4182eb79 100644
--- a/kit/Sources/CodyncUI/Thread/Composer.swift
+++ b/kit/Sources/CodyncUI/Thread/Composer.swift
@@ -77,7 +77,7 @@ struct Composer: View {
Button { mention(member) } label: {
HStack(spacing: 6) {
CharacterAvatar(bot: member, size: 18, animated: false)
- Text(member.name).font(.subheadline).foregroundStyle(Palette.text)
+ Text(member.name).appFont(.subheadline).foregroundStyle(Palette.text)
}
.padding(.horizontal, 10)
.padding(.vertical, 6)
@@ -171,7 +171,7 @@ struct Composer: View {
if let onInterrupt, draft.isEmpty, files.isEmpty {
Button(action: onInterrupt) {
Image(systemName: "stop.fill")
- .font(.system(size: 12, weight: .bold))
+ .appFont(.system(size: 12, weight: .bold))
.frame(width: InterfaceMetrics.value(mac: 28, mobile: 34), height: InterfaceMetrics.value(mac: 28, mobile: 34))
.background(Palette.danger, in: Circle())
.foregroundStyle(.white)
@@ -185,7 +185,7 @@ struct Composer: View {
model.stop(botId)
} label: {
Image(systemName: "stop.fill")
- .font(.system(size: 12, weight: .bold))
+ .appFont(.system(size: 12, weight: .bold))
.frame(width: InterfaceMetrics.value(mac: 28, mobile: 34), height: InterfaceMetrics.value(mac: 28, mobile: 34))
.background(Palette.accentFill, in: Circle())
.foregroundStyle(Palette.onAccent)
@@ -196,7 +196,7 @@ struct Composer: View {
} else if let onCall, draft.isEmpty, files.isEmpty {
Button(action: onCall) {
Image(systemName: "waveform")
- .font(.system(size: 15, weight: .bold))
+ .appFont(.system(size: 15, weight: .bold))
.frame(width: buttonSize * 1.35, height: buttonSize)
.background(Palette.accentFill, in: Capsule())
.foregroundStyle(Palette.onAccent)
@@ -208,7 +208,7 @@ struct Composer: View {
} else {
Button(action: submit) {
Image(systemName: "arrow.up")
- .font(.system(size: 14, weight: .bold))
+ .appFont(.system(size: 14, weight: .bold))
.frame(width: InterfaceMetrics.value(mac: 28, mobile: 34), height: InterfaceMetrics.value(mac: 28, mobile: 34))
.background(canSend ? Palette.accentFill : Palette.accentDim, in: Circle())
.foregroundStyle(canSend ? Palette.onAccent : Palette.tertiary)
@@ -256,7 +256,7 @@ struct Composer: View {
private var addLabel: some View {
Image(systemName: "plus")
- .font(.system(size: InterfaceMetrics.value(mac: 13, mobile: 18), weight: .medium))
+ .appFont(.system(size: InterfaceMetrics.value(mac: 13, mobile: 18), weight: .medium))
.foregroundStyle(Palette.text)
.frame(width: buttonSize + 2 * InterfaceMetrics.value(mac: 4, mobile: 6),
height: buttonSize + 2 * InterfaceMetrics.value(mac: 4, mobile: 6))
@@ -269,7 +269,7 @@ struct Composer: View {
HStack(spacing: 6) {
Button(action: pasteFiles) {
Label("Paste image", systemImage: "doc.on.clipboard")
- .font(.footnote.weight(.medium))
+ .appFont(.footnote.weight(.medium))
.foregroundStyle(Palette.text)
.padding(.horizontal, 10)
.padding(.vertical, 6)
@@ -277,7 +277,7 @@ struct Composer: View {
}
.buttonStyle(PressScale())
Button { pasteCount = UIPasteboard.general.changeCount } label: {
- Image(systemName: "xmark").font(.system(size: 10, weight: .bold)).foregroundStyle(Palette.secondary)
+ Image(systemName: "xmark").appFont(.system(size: 10, weight: .bold)).foregroundStyle(Palette.secondary)
}
.buttonStyle(.plain)
.accessibilityLabel("Don't paste")
@@ -295,7 +295,7 @@ struct Composer: View {
Image(systemName: AttachmentIcon.symbol(file.name))
.foregroundStyle(Palette.secondary)
Text(file.name)
- .font(.footnote)
+ .appFont(.footnote)
.foregroundStyle(Palette.text)
.lineLimit(1)
.truncationMode(.middle)
@@ -303,7 +303,7 @@ struct Composer: View {
Button {
files.removeAll { $0.id == file.id }
} label: {
- Image(systemName: "xmark").font(.system(size: 10, weight: .bold)).foregroundStyle(Palette.secondary)
+ Image(systemName: "xmark").appFont(.system(size: 10, weight: .bold)).foregroundStyle(Palette.secondary)
}
.buttonStyle(.plain)
.accessibilityLabel("Remove \(file.name)")
diff --git a/kit/Sources/CodyncUI/Thread/ConversationTypography.swift b/kit/Sources/CodyncUI/Thread/ConversationTypography.swift
index e333baf3..df231dc8 100644
--- a/kit/Sources/CodyncUI/Thread/ConversationTypography.swift
+++ b/kit/Sources/CodyncUI/Thread/ConversationTypography.swift
@@ -1,6 +1,6 @@
import SwiftUI
-/// Conversation text can grow on the Mac without resizing the app's controls.
+/// The Mac preference supplies one scale for conversation text and app chrome.
public struct ConversationTypography: Sendable {
public static let preferenceKey = "conversationFontSize"
public static let defaultSize = 12.0
@@ -12,6 +12,14 @@ public struct ConversationTypography: Sendable {
self.pointSize = pointSize.isFinite ? min(max(pointSize, 11), 18) : Self.defaultSize
}
+ public var scale: CGFloat {
+ #if os(macOS)
+ pointSize / Self.defaultSize
+ #else
+ 1
+ #endif
+ }
+
var body: Font {
#if os(macOS)
.system(size: pointSize)
@@ -22,7 +30,7 @@ public struct ConversationTypography: Sendable {
func heading(level: Int) -> Font {
#if os(macOS)
- .system(size: level == 1 ? pointSize + 3 : level == 2 ? pointSize + 1 : pointSize - 1,
+ .system(size: (level == 1 ? 15 : level == 2 ? 13 : 11) * scale,
weight: level == 2 ? .semibold : .bold)
#else
level == 1 ? .title3.bold() : level == 2 ? .headline : .subheadline.bold()
@@ -31,7 +39,7 @@ public struct ConversationTypography: Sendable {
var code: Font {
#if os(macOS)
- .system(size: pointSize - 2, design: .monospaced)
+ .system(size: 10 * scale, design: .monospaced)
#else
.system(.footnote, design: .monospaced)
#endif
diff --git a/kit/Sources/CodyncUI/Thread/PermissionCard.swift b/kit/Sources/CodyncUI/Thread/PermissionCard.swift
index b2f02e6c..63714098 100644
--- a/kit/Sources/CodyncUI/Thread/PermissionCard.swift
+++ b/kit/Sources/CodyncUI/Thread/PermissionCard.swift
@@ -27,17 +27,17 @@ struct PermissionCard: View {
var body: some View {
VStack(alignment: .leading, spacing: 10) {
HStack(spacing: 8) {
- Text(headline).font(.headline).foregroundStyle(Palette.text)
+ Text(headline).appFont(.headline).foregroundStyle(Palette.text)
if pending {
Circle().fill(Palette.warning).frame(width: 7, height: 7)
}
}
Text(d.title ?? "")
- .font(.subheadline.monospaced())
+ .appFont(.subheadline.monospaced())
.foregroundStyle(Palette.secondary)
.lineLimit(expanded ? nil : 3)
Label("Runs on \(hostName)\(d.cwd.map { " · \(($0 as NSString).lastPathComponent)" } ?? "")", systemImage: "desktopcomputer")
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.tertiary)
if hasDetail {
@@ -53,7 +53,7 @@ struct PermissionCard: View {
}
.padding(.top, 6)
} label: {
- Text("Details").font(.caption.weight(.medium)).foregroundStyle(Palette.secondary)
+ Text("Details").appFont(.caption.weight(.medium)).foregroundStyle(Palette.secondary)
}
}
@@ -61,7 +61,7 @@ struct PermissionCard: View {
buttons
} else {
Text(outcome)
- .font(.caption.weight(.medium))
+ .appFont(.caption.weight(.medium))
.foregroundStyle(Palette.secondary)
}
}
@@ -98,7 +98,7 @@ struct PermissionCard: View {
Button { respond(o.optionId) } label: {
HStack(spacing: 8) {
Text(label(o))
- .font(.body.weight(o.kind == "allow_once" ? .semibold : .regular))
+ .appFont(.body.weight(o.kind == "allow_once" ? .semibold : .regular))
.foregroundStyle(o.kind.hasPrefix("allow") ? Palette.text : Palette.danger)
Spacer(minLength: 0)
if answering == o.optionId { Spinner(size: 14) }
@@ -139,7 +139,7 @@ struct CodeBox: View {
var body: some View {
ScrollView(.horizontal, showsIndicators: false) {
Text(text)
- .font(.system(.caption, design: .monospaced))
+ .appFont(.system(.caption, design: .monospaced))
.foregroundStyle(Palette.text)
.textSelection(.enabled)
.padding(8)
@@ -161,7 +161,7 @@ struct DiffView: View {
Text("+\(diff.added)").foregroundStyle(Palette.added)
Text("−\(diff.removed)").foregroundStyle(Palette.removed)
}
- .font(.caption.monospaced())
+ .appFont(.caption.monospaced())
.foregroundStyle(Palette.secondary)
ScrollView(.horizontal, showsIndicators: false) {
VStack(alignment: .leading, spacing: 0) {
@@ -170,7 +170,7 @@ struct DiffView: View {
.foregroundStyle(line.hasPrefix("+") ? Palette.added : line.hasPrefix("-") ? Palette.removed : Palette.secondary)
}
}
- .font(.system(.caption2, design: .monospaced))
+ .appFont(.system(.caption2, design: .monospaced))
.padding(8)
}
.frame(maxHeight: 260)
diff --git a/kit/Sources/CodyncUI/Thread/RepliesView.swift b/kit/Sources/CodyncUI/Thread/RepliesView.swift
index 590d67a0..678e90a6 100644
--- a/kit/Sources/CodyncUI/Thread/RepliesView.swift
+++ b/kit/Sources/CodyncUI/Thread/RepliesView.swift
@@ -20,8 +20,8 @@ struct RepliesView: View {
VStack(spacing: 0) {
HStack(spacing: 8) {
VStack(alignment: .leading, spacing: 0) {
- Text("Thread").font(InterfaceMetrics.body.weight(.semibold)).foregroundStyle(Palette.text)
- Text(chat?.name ?? "").font(.caption).foregroundStyle(Palette.tertiary).lineLimit(1)
+ Text("Thread").appFont(AppFont.compactBody.weight(.semibold)).foregroundStyle(Palette.text)
+ Text(chat?.name ?? "").appFont(.caption).foregroundStyle(Palette.tertiary).lineLimit(1)
}
Spacer(minLength: 8)
IconButton("Close thread", systemImage: "xmark", action: close)
@@ -38,7 +38,7 @@ struct RepliesView: View {
ChatRow(entry: root, groupStart: true, chat: chat) { showTrace = true }
HStack(spacing: 10) {
Text(replies.isEmpty ? "No replies yet" : replies.count == 1 ? "1 reply" : "\(replies.count) replies")
- .font(.caption)
+ .appFont(.caption)
.foregroundStyle(Palette.tertiary)
.fixedSize()
Rectangle().fill(Palette.border).frame(height: 1)
diff --git a/kit/Sources/CodyncUI/Thread/ThreadView.swift b/kit/Sources/CodyncUI/Thread/ThreadView.swift
index 495c6cbe..74106382 100644
--- a/kit/Sources/CodyncUI/Thread/ThreadView.swift
+++ b/kit/Sources/CodyncUI/Thread/ThreadView.swift
@@ -98,7 +98,7 @@ public struct ThreadView: View {
if !model.historyComplete.contains(botId), thread.count >= 50 {
Button("Load earlier messages") { Task { await model.loadOlder(botId) } }
.buttonStyle(.plain)
- .font(.footnote)
+ .appFont(.footnote)
.foregroundStyle(Palette.secondary)
.frame(maxWidth: .infinity)
.padding(.vertical, 12)
@@ -282,7 +282,7 @@ public struct ThreadView: View {
switch item.kind {
case .separator(let date):
Text(RelativeTime.separator(date))
- .font(.footnote)
+ .appFont(.footnote)
.foregroundStyle(Palette.tertiary)
.frame(maxWidth: .infinity)
.padding(.top, 18)
@@ -293,7 +293,7 @@ public struct ThreadView: View {
openRoutine(id)
} label: {
Label(e.data.text ?? "Routine", systemImage: "clock.arrow.circlepath")
- .font(.footnote).foregroundStyle(Palette.secondary).padding(.vertical, 10)
+ .appFont(.footnote).foregroundStyle(Palette.secondary).padding(.vertical, 10)
}.buttonStyle(.plain)
} else {
ChatRow(entry: e, groupStart: groupStart, chat: bot) {
@@ -313,7 +313,7 @@ public struct ThreadView: View {
if model.shownConnection == .connecting {
Spinner(size: 8)
} else {
- Image(systemName: connectionSymbol).font(.system(size: 8, weight: .medium))
+ Image(systemName: connectionSymbol).appFont(.system(size: 8, weight: .medium))
}
}
.frame(width: 12)
@@ -322,7 +322,7 @@ public struct ThreadView: View {
.lineLimit(1)
.truncationMode(.middle)
}
- .font(.system(size: 10, weight: .medium))
+ .appFont(.system(size: 10, weight: .medium))
.foregroundStyle(Palette.secondary)
.accessibilityElement(children: .ignore)
.accessibilityLabel("\(model.hostName), \(connectionDescription)")
@@ -403,7 +403,7 @@ public struct ThreadView: View {
if bot.isGroup { GroupAvatar(members: model.members(of: bot), size: 22) } else { CharacterAvatar(bot: bot, size: 22) }
}
Text(bot?.name ?? "")
- .font(.system(size: 13, weight: .semibold))
+ .appFont(.system(size: 13, weight: .semibold))
.foregroundStyle(Palette.text)
.lineLimit(1)
}
@@ -527,19 +527,19 @@ private struct GroupIntroCard: View {
var body: some View {
VStack(spacing: 12) {
GroupAvatar(members: model.members(of: group), size: 72)
- Text(group.name).font(.title2.weight(.semibold)).foregroundStyle(Palette.text)
+ Text(group.name).appFont(.title2.weight(.semibold)).foregroundStyle(Palette.text)
Text(model.members(of: group).map(\.name).joined(separator: " · "))
- .font(.subheadline)
+ .appFont(.subheadline)
.foregroundStyle(Palette.secondary)
.multilineTextAlignment(.center)
if !group.description.isEmpty {
Text(group.description)
- .font(.subheadline)
+ .appFont(.subheadline)
.foregroundStyle(Palette.secondary)
.multilineTextAlignment(.center)
}
Text("Everyone answers in turn. @mention a bot to ask just that one. Each bot works in its own folder.")
- .font(.footnote)
+ .appFont(.footnote)
.foregroundStyle(Palette.tertiary)
.multilineTextAlignment(.center)
.padding(.top, 4)
@@ -558,15 +558,15 @@ private struct GroupMembersList: View {
var body: some View {
ScrollView {
VStack(alignment: .leading, spacing: 2) {
- Text("\(group.members.count) bots").font(.system(size: 13, weight: .semibold)).padding(.bottom, 6)
+ Text("\(group.members.count) bots").appFont(.system(size: 13, weight: .semibold)).padding(.bottom, 6)
ForEach(model.members(of: group)) { bot in
Button { model.selection = bot.id } label: {
HStack(spacing: 10) {
CharacterAvatar(bot: bot, size: 26)
VStack(alignment: .leading, spacing: 1) {
- Text(bot.name).font(.system(size: 13)).foregroundStyle(Palette.text)
+ Text(bot.name).appFont(.system(size: 13)).foregroundStyle(Palette.text)
Text(bot.isWorking ? (bot.activity.isEmpty ? "Working…" : bot.activity) : bot.folderName)
- .font(.system(size: 11)).foregroundStyle(Palette.tertiary).lineLimit(1)
+ .appFont(.system(size: 11)).foregroundStyle(Palette.tertiary).lineLimit(1)
}
Spacer()
}
@@ -590,19 +590,19 @@ private struct IntroCard: View {
var body: some View {
VStack(spacing: 12) {
CharacterAvatar(bot: bot, size: 72)
- Text(bot.name).font(.title2.weight(.semibold)).foregroundStyle(Palette.text)
+ Text(bot.name).appFont(.title2.weight(.semibold)).foregroundStyle(Palette.text)
Text(bot.managedWorkspace ? "\(model.backendName(bot.backend)) · Personal workspace" : "\(model.backendName(bot.backend)) in \(bot.cwd)")
- .font(.footnote.monospaced())
+ .appFont(.footnote.monospaced())
.foregroundStyle(Palette.tertiary)
.multilineTextAlignment(.center)
if !bot.description.isEmpty {
Text(bot.description)
- .font(.subheadline)
+ .appFont(.subheadline)
.foregroundStyle(Palette.secondary)
.multilineTextAlignment(.center)
}
Text("Tell it what you need. You'll get a notification when it's done or needs you.")
- .font(.footnote)
+ .appFont(.footnote)
.foregroundStyle(Palette.tertiary)
.multilineTextAlignment(.center)
.padding(.top, 4)
@@ -630,7 +630,7 @@ private struct DetailsPanel: View {
HStack(spacing: 10) {
if editing {
IconButton("Back to details", systemImage: "chevron.left") { setEditing(false) }
- Text("Settings").font(.system(size: 13, weight: .semibold)).foregroundStyle(Palette.text)
+ Text("Settings").appFont(.system(size: 13, weight: .semibold)).foregroundStyle(Palette.text)
Spacer()
} else if bot?.isGroup == true {
panelTitle("Members")
@@ -669,7 +669,7 @@ private struct DetailsPanel: View {
private func panelTitle(_ title: String) -> some View {
Text(title)
- .font(.system(size: 12, weight: .medium))
+ .appFont(.system(size: 12, weight: .medium))
.foregroundStyle(Palette.secondary)
.padding(.leading, 4)
}
@@ -694,23 +694,23 @@ private struct DetailsPanel: View {
ComputerBadge(model.computer, size: 32)
VStack(alignment: .leading, spacing: 4) {
Text(model.hostName)
- .font(.system(size: 13, weight: .semibold))
+ .appFont(.system(size: 13, weight: .semibold))
.foregroundStyle(Palette.text)
.lineLimit(2)
Text("Remote screen")
- .font(.system(size: 11))
+ .appFont(.system(size: 11))
.foregroundStyle(Palette.secondary)
}
}
if !model.isOffline {
Label(computerStatus, systemImage: computerStatusSymbol)
- .font(.system(size: 12, weight: .medium))
+ .appFont(.system(size: 12, weight: .medium))
.foregroundStyle(Palette.text)
.fixedSize(horizontal: false, vertical: true)
}
if screenReady {
Text("View and control this Mac from your iPhone.")
- .font(.system(size: 11))
+ .appFont(.system(size: 11))
.foregroundStyle(Palette.secondary)
.fixedSize(horizontal: false, vertical: true)
.padding(.top, -8)
@@ -724,27 +724,27 @@ private struct DetailsPanel: View {
private func agentSummary(_ bot: Bot) -> some View {
VStack(alignment: .leading, spacing: 14) {
Text("Agent")
- .font(.system(size: 13, weight: .semibold))
+ .appFont(.system(size: 13, weight: .semibold))
.foregroundStyle(Palette.text)
HStack {
Text("Runtime").foregroundStyle(Palette.secondary)
Spacer(minLength: 12)
Text(model.backendName(bot.backend)).foregroundStyle(Palette.text)
}
- .font(.system(size: 12))
+ .appFont(.system(size: 12))
VStack(alignment: .leading, spacing: 6) {
Label(bot.managedWorkspace ? "Workspace" : "Project folder", systemImage: "folder")
- .font(.system(size: 11))
+ .appFont(.system(size: 11))
.foregroundStyle(Palette.secondary)
Text(bot.managedWorkspace ? "Personal · managed by Codync" : bot.cwd)
- .font(.system(size: 11))
+ .appFont(.system(size: 11))
.foregroundStyle(Palette.text)
.fixedSize(horizontal: false, vertical: true)
.textSelection(.enabled)
}
if !bot.description.isEmpty {
Text(bot.description)
- .font(.system(size: 12))
+ .appFont(.system(size: 12))
.foregroundStyle(Palette.secondary)
.fixedSize(horizontal: false, vertical: true)
}
diff --git a/kit/Sources/CodyncUI/Thread/TraceView.swift b/kit/Sources/CodyncUI/Thread/TraceView.swift
index e53db253..3cfc673f 100644
--- a/kit/Sources/CodyncUI/Thread/TraceView.swift
+++ b/kit/Sources/CodyncUI/Thread/TraceView.swift
@@ -29,7 +29,7 @@ public struct TraceView: View {
// A plain one-line turn header (CardSection's own title wraps).
Text(entries.first { $0.kind == "user" }?.data.text ?? "Turn \(turn)")
.lineLimit(1)
- .font(InterfaceMetrics.secondary.weight(.semibold))
+ .appFont(AppFont.compactSecondary.weight(.semibold))
.foregroundStyle(Palette.text)
.padding(.leading, 4)
CardSection {
@@ -56,25 +56,25 @@ private struct TraceRow: View {
switch entry.kind {
case "user":
Label { Text(d.text ?? "").foregroundStyle(Palette.text) } icon: { Image(systemName: "person.fill").foregroundStyle(Palette.secondary) }
- .font(.subheadline)
+ .appFont(.subheadline)
case "agent":
VStack(alignment: .leading, spacing: 4) {
- Text(d.final == true ? "Reply" : "Said").font(.caption2.bold()).foregroundStyle(Palette.tertiary)
+ Text(d.final == true ? "Reply" : "Said").appFont(.caption2.bold()).foregroundStyle(Palette.tertiary)
MarkdownText(d.text ?? "")
}
case "thought":
Disclosure(isExpanded: $expanded) {
- Text(d.text ?? "").font(.footnote).foregroundStyle(Palette.secondary).textSelection(.enabled)
+ Text(d.text ?? "").appFont(.footnote).foregroundStyle(Palette.secondary).textSelection(.enabled)
} label: {
Label { Text("Thinking") } icon: {
ThinkingOrb(size: 16, color: Palette.secondary, animated: false)
- }.font(.subheadline).foregroundStyle(Palette.secondary)
+ }.appFont(.subheadline).foregroundStyle(Palette.secondary)
}
case "tool":
ToolRow(data: d)
case "plan":
VStack(alignment: .leading, spacing: 6) {
- Label("Plan", systemImage: "checklist").font(.subheadline.bold())
+ Label("Plan", systemImage: "checklist").appFont(.subheadline.bold())
ForEach(Array((d.entries ?? []).enumerated()), id: \.offset) { _, item in
Label {
Text(item.content).strikethrough(item.status == "completed").foregroundStyle(Palette.text)
@@ -82,15 +82,15 @@ private struct TraceRow: View {
Image(systemName: item.status == "completed" ? "checkmark.circle.fill" : item.status == "in_progress" ? "circle.dotted" : "circle")
.foregroundStyle(item.status == "completed" ? Palette.accent : Palette.tertiary)
}
- .font(.footnote)
+ .appFont(.footnote)
}
}
case "permission":
Label(d.title ?? "Approval", systemImage: "hand.raised")
- .font(.subheadline)
+ .appFont(.subheadline)
.foregroundStyle(Palette.secondary)
default:
- Text(d.text ?? "").font(.footnote).foregroundStyle(Palette.tertiary)
+ Text(d.text ?? "").appFont(.footnote).foregroundStyle(Palette.tertiary)
}
}
}
@@ -133,7 +133,7 @@ struct ToolRow: View {
private var label: some View {
HStack(spacing: 8) {
Image(systemName: icon).frame(width: 18).foregroundStyle(Palette.secondary)
- Text(data.title ?? "Tool").font(.subheadline).foregroundStyle(Palette.text).lineLimit(2)
+ Text(data.title ?? "Tool").appFont(.subheadline).foregroundStyle(Palette.text).lineLimit(2)
Spacer(minLength: 4)
switch data.status {
case "completed": Image(systemName: "checkmark").foregroundStyle(Palette.accent)
@@ -141,6 +141,6 @@ struct ToolRow: View {
default: ThinkingOrb(state: data.toolKind == "search" ? .searching : data.toolKind == "fetch" ? .connecting : .working, size: 16, color: Palette.secondary)
}
}
- .font(.caption)
+ .appFont(.caption)
}
}
diff --git a/kit/Sources/CodyncUI/Usage/UsageViews.swift b/kit/Sources/CodyncUI/Usage/UsageViews.swift
index be10c5d6..19cb64d8 100644
--- a/kit/Sources/CodyncUI/Usage/UsageViews.swift
+++ b/kit/Sources/CodyncUI/Usage/UsageViews.swift
@@ -15,7 +15,7 @@ public struct UsageLimits: View {
VStack(alignment: .leading, spacing: 10) {
HStack(spacing: 8) {
ProviderMascot(provider, size: 18, style: UsageIconStyle(rawValue: usageIconStyle) ?? .character)
- Text(provider.name).font(.system(size: 13, weight: .semibold)).foregroundStyle(Palette.text)
+ Text(provider.name).appFont(.system(size: 13, weight: .semibold)).foregroundStyle(Palette.text)
}
ForEach(provider.windows) { window in
HStack(spacing: 10) {
@@ -27,7 +27,7 @@ public struct UsageLimits: View {
Text(window.resetDescription ?? "").foregroundStyle(Palette.secondary)
.frame(width: 130, alignment: .trailing)
}
- .font(.system(size: 12))
+ .appFont(.system(size: 12))
.lineLimit(1)
.accessibilityElement(children: .combine)
}
diff --git a/kit/Tests/CodyncKitTests/AppFontTests.swift b/kit/Tests/CodyncKitTests/AppFontTests.swift
new file mode 100644
index 00000000..9c5d83e6
--- /dev/null
+++ b/kit/Tests/CodyncKitTests/AppFontTests.swift
@@ -0,0 +1,46 @@
+import SwiftUI
+import Testing
+@testable import CodyncKit
+
+#if os(macOS)
+@Test func appFontsPreserveDefaultStyling() {
+ let styles: [(AppFont, Font)] = [
+ (.body, .body),
+ (.title3, .title3),
+ (.footnote, .footnote),
+ (.headline, .headline),
+ (.caption.bold(), .caption.bold()),
+ (.footnote.monospaced(), .footnote.monospaced()),
+ (.caption.monospacedDigit(), .caption.monospacedDigit()),
+ (.system(size: 12), .system(size: 12)),
+ (.system(size: 20, weight: .medium, design: .rounded), .system(size: 20, weight: .medium, design: .rounded)),
+ ]
+ for (appFont, original) in styles {
+ #expect(appFont.scaled(by: 1) == original)
+ }
+}
+
+@Test func appFontsPreserveRelativeSizesAndTraits() throws {
+ guard #available(macOS 26, *) else { return }
+ let context = EnvironmentValues().fontResolutionContext
+ let styles: [AppFont] = [.compactBody, .compactSecondary, .headline, .caption.bold(), .footnote.monospaced(),
+ .system(size: 20, weight: .medium, design: .rounded)]
+ for font in styles {
+ let original = font.scaled(by: 1).resolve(in: context)
+ for scale: CGFloat in [11.0 / 12, 1.5] {
+ let enlarged = font.scaled(by: scale).resolve(in: context)
+ #expect(abs(enlarged.pointSize / original.pointSize - scale) < 0.001)
+ #expect(enlarged.weight == original.weight)
+ #expect(enlarged.isBold == original.isBold)
+ #expect(enlarged.isMonospaced == original.isMonospaced)
+ }
+ // Exercise the macOS 14–15 path even when this test runs on a newer Mac.
+ let fallbackOriginal = font.fallbackScaled(by: 1).resolve(in: context)
+ let fallbackEnlarged = font.fallbackScaled(by: 1.5).resolve(in: context)
+ #expect(abs(fallbackEnlarged.pointSize / fallbackOriginal.pointSize - 1.5) < 0.001)
+ #expect(fallbackEnlarged.weight == original.weight)
+ #expect(fallbackEnlarged.isBold == original.isBold)
+ #expect(fallbackEnlarged.isMonospaced == original.isMonospaced)
+ }
+}
+#endif
diff --git a/kit/Tests/CodyncUITests/ConversationTypographyTests.swift b/kit/Tests/CodyncUITests/ConversationTypographyTests.swift
new file mode 100644
index 00000000..942cd13f
--- /dev/null
+++ b/kit/Tests/CodyncUITests/ConversationTypographyTests.swift
@@ -0,0 +1,31 @@
+import SwiftUI
+import Testing
+@testable import CodyncUI
+
+@Test func conversationTypographySanitizesImportedPreferences() throws {
+ let defaultSize = ConversationTypography().pointSize
+ for invalid in [Double.nan, .infinity, -.infinity] {
+ #expect(ConversationTypography(pointSize: invalid).pointSize == defaultSize)
+ }
+ #expect(ConversationTypography(pointSize: -100).pointSize == ConversationTypography.sizes.first)
+ #expect(ConversationTypography(pointSize: 100).pointSize == ConversationTypography.sizes.last)
+ #expect(ConversationTypography(pointSize: 12.5).pointSize == 12.5)
+}
+
+#if os(macOS)
+@Test func conversationTypographyPreservesTextHierarchyWhenResized() throws {
+ guard #available(macOS 26, *) else { return }
+ let context = EnvironmentValues().fontResolutionContext
+ let original = ConversationTypography()
+ let resized = ConversationTypography(pointSize: 18)
+ let originalFonts = [original.body, original.code, original.heading(level: 1), original.heading(level: 2), original.heading(level: 3)]
+ let resizedFonts = [resized.body, resized.code, resized.heading(level: 1), resized.heading(level: 2), resized.heading(level: 3)]
+ for (originalFont, resizedFont) in zip(originalFonts, resizedFonts) {
+ let base = originalFont.resolve(in: context)
+ let changed = resizedFont.resolve(in: context)
+ #expect(abs(changed.pointSize / base.pointSize - resized.scale) < 0.001)
+ #expect(base.weight == changed.weight)
+ #expect(base.isMonospaced == changed.isMonospaced)
+ }
+}
+#endif