Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

Polish Fluid Intelligence onboarding with cinematic mode introduction

altic-dev5e140d532da6
diff --git a/Prototypes/OverlayOnboarding/.gitignore b/Prototypes/OverlayOnboarding/.gitignore
new file mode 100644
index 00000000..a3553849
--- /dev/null
+++ b/Prototypes/OverlayOnboarding/.gitignore
@@ -0,0 +1,2 @@
+.build/
+evidence/
diff --git a/Prototypes/OverlayOnboarding/README.md b/Prototypes/OverlayOnboarding/README.md
new file mode 100644
index 00000000..3675b0a2
--- /dev/null
+++ b/Prototypes/OverlayOnboarding/README.md
@@ -0,0 +1 @@
+Native source for the bundled onboarding film. Render offscreen with --render-frames evidence/frames --film --intro-only. The app embeds the exported film; do not launch the standalone preview for app verification.
diff --git a/Prototypes/OverlayOnboarding/Sources/FluidTypography.swift b/Prototypes/OverlayOnboarding/Sources/FluidTypography.swift
new file mode 100644
index 00000000..85406a55
--- /dev/null
+++ b/Prototypes/OverlayOnboarding/Sources/FluidTypography.swift
@@ -0,0 +1,113 @@
+import AppKit
+import SwiftUI
+
+/// Edit these four choices to experiment across the app, then rebuild.
+/// `.system` keeps Apple's native font. `.named("AvenirNext-Regular")` uses an installed
+/// PostScript font name. `.newYork` uses Apple’s native serif at every size and weight.
+/// Invalid names fall back to the original system design.
+enum FluidTypography {
+ enum Family {
+ case system
+ case newYork
+ case named(String)
+ }
+
+ static let standard: Family = .system
+ static let serif: Family = .system
+ static let rounded: Family = .system
+ static let monospace: Family = .system
+
+ // Resolve each choice once, rather than looking up installed fonts during rendering.
+ private static let standardName = resolvedName(for: standard)
+ private static let serifName = resolvedName(for: serif)
+ private static let roundedName = resolvedName(for: rounded)
+ private static let monospaceName = resolvedName(for: monospace)
+
+ static func resolvedName(for family: Family) -> String? {
+ guard case let .named(name) = family, NSFont(name: name, size: 12) != nil else { return nil }
+ return name
+ }
+
+ static func name(for design: Font.Design) -> String? {
+ switch design {
+ case .serif: self.serifName
+ case .rounded: self.roundedName
+ case .monospaced: self.monospaceName
+ default: self.standardName
+ }
+ }
+
+ static var overridesStandard: Bool {
+ if case .system = self.standard { return false }
+ return true
+ }
+
+ static func systemDesign(for design: Font.Design) -> Font.Design {
+ let family: Family = switch design {
+ case .serif: self.serif
+ case .rounded: self.rounded
+ case .monospaced: self.monospace
+ default: self.standard
+ }
+ if case .newYork = family { return .serif }
+ return design
+ }
+
+ static func pointSize(for style: Font.TextStyle) -> CGFloat {
+ switch style {
+ case .largeTitle: NSFont.preferredFont(forTextStyle: .largeTitle).pointSize
+ case .title: NSFont.preferredFont(forTextStyle: .title1).pointSize
+ case .title2: NSFont.preferredFont(forTextStyle: .title2).pointSize
+ case .title3: NSFont.preferredFont(forTextStyle: .title3).pointSize
+ case .headline: NSFont.preferredFont(forTextStyle: .headline).pointSize
+ case .subheadline: NSFont.preferredFont(forTextStyle: .subheadline).pointSize
+ case .callout: NSFont.preferredFont(forTextStyle: .callout).pointSize
+ case .footnote: NSFont.preferredFont(forTextStyle: .footnote).pointSize
+ case .caption: NSFont.preferredFont(forTextStyle: .caption1).pointSize
+ case .caption2: NSFont.preferredFont(forTextStyle: .caption2).pointSize
+ default: NSFont.preferredFont(forTextStyle: .body).pointSize
+ }
+ }
+}
+
+extension Font {
+ /// Family indirection only: default size, weight, and design remain native.
+ static func fluidSystem(size: CGFloat, weight: Font.Weight = .regular, design: Font.Design = .default) -> Font {
+ guard let name = FluidTypography.name(for: design) else {
+ return .system(size: size, weight: weight, design: FluidTypography.systemDesign(for: design))
+ }
+ return .custom(name, fixedSize: size).weight(weight)
+ }
+
+ static func fluidSystem(_ style: Font.TextStyle, design: Font.Design = .default) -> Font {
+ guard let name = FluidTypography.name(for: design) else {
+ return .system(style, design: FluidTypography.systemDesign(for: design))
+ }
+ let font = Font.custom(name, size: FluidTypography.pointSize(for: style), relativeTo: style)
+ return style == .headline ? font.weight(.semibold) : font
+ }
+}
+
+extension NSFont {
+ static func fluidSystemFont(ofSize size: CGFloat, weight: NSFont.Weight = .regular) -> NSFont {
+ self.fluidFont(ofSize: size, weight: weight, design: .default)
+ }
+
+ static func fluidMonospacedSystemFont(ofSize size: CGFloat, weight: NSFont.Weight) -> NSFont {
+ self.fluidFont(ofSize: size, weight: weight, design: .monospaced)
+ }
+
+ private static func fluidFont(ofSize size: CGFloat, weight: NSFont.Weight, design: Font.Design) -> NSFont {
+ if let name = FluidTypography.name(for: design), let font = NSFont(name: name, size: size) {
+ let descriptor = font.fontDescriptor.addingAttributes([.traits: [NSFontDescriptor.TraitKey.weight: weight.rawValue]])
+ return NSFont(descriptor: descriptor, size: size) ?? font
+ }
+ if FluidTypography.systemDesign(for: design) == .serif,
+ let descriptor = NSFont.systemFont(ofSize: size, weight: weight).fontDescriptor.withDesign(.serif),
+ let font = NSFont(descriptor: descriptor, size: size)
+ {
+ return font
+ }
+ return design == .monospaced ? .monospacedSystemFont(ofSize: size, weight: weight) : .systemFont(ofSize: size, weight: weight)
+ }
+}
diff --git a/Prototypes/OverlayOnboarding/Sources/FrozenInputs.swift b/Prototypes/OverlayOnboarding/Sources/FrozenInputs.swift
new file mode 100644
index 00000000..91f5bbcc
--- /dev/null
+++ b/Prototypes/OverlayOnboarding/Sources/FrozenInputs.swift
@@ -0,0 +1,39 @@
+import AppKit
+import SwiftUI
+
+// No UserDefaults, recording services, observers or production controllers.
+// Source defaults and the read-only installed preference snapshot both select medium/streaming.
+struct SettingsStore {
+ enum OverlaySize { case pill, small, medium, large }
+ let overlaySize = OverlaySize.medium
+}
+struct FrozenAppServices { struct ASR { let isAsrReady = true; let isLoadingModel = false; let isDownloadingModel = false }; let asr = ASR() }
+struct FrozenOverlayState {
+ let isProcessing = false
+ let isBottomOverlayPresented = false
+ let isBottomOverlayReleaseTransitioning = false
+ let isBottomOverlayDismissing = false
+ let spokenSendIndicatorState = false
+ let spokenSendCountdownID = 0
+}
+struct SpokenSendIndicatorView: View {
+ let state: Bool; let color: Color; let size: CGFloat
+ var body: some View { EmptyView() }
+}
+struct CompositorShimmerSweep: View {
+ let duration: Double; let peakOpacity: Double
+ var body: some View { EmptyView() }
+}
+enum FluidOnboardingLandingColors { static let blue = FluidBrandColors.blue }
+private struct EmptyThemeKey: EnvironmentKey { static let defaultValue = 0 }
+extension EnvironmentValues { var theme: Int { get { self[EmptyThemeKey.self] } set { self[EmptyThemeKey.self] = newValue } } }
+enum PillShadowMetrics { static let radius: CGFloat = 10; static let yOffset: CGFloat = 4 }
+struct DynamicPreviewHeightPreferenceKey: PreferenceKey {
+ static var defaultValue: CGFloat = 0
+ static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) { value = max(value, nextValue()) }
+}
+// Frozen transcription branches never change; this keeps their copied two-value callback
+// syntax compilable on macOS 13 without attaching any production event behavior.
+extension View {
+ func onChange<V: Equatable>(of value: V, _ action: @escaping (V, V) -> Void) -> some View { self }
+}
diff --git a/Prototypes/OverlayOnboarding/Sources/OnboardingGlassSurface.swift b/Prototypes/OverlayOnboarding/Sources/OnboardingGlassSurface.swift
new file mode 100644
index 00000000..556f62a3
--- /dev/null
+++ b/Prototypes/OverlayOnboarding/Sources/OnboardingGlassSurface.swift
@@ -0,0 +1,57 @@
+import SwiftUI
+
+/// A bounded, static glass surface for onboarding, with an opaque accessibility fallback.
+struct OnboardingGlassSurface: ViewModifier {
+ let selected: Bool
+ var forceOpaque = false
+ // Painted glass keeps perspective shots and offline renders identical.
+ var useNativeGlass = false
+ @Environment(\.accessibilityReduceTransparency) private var reduceTransparency
+ @Environment(\.colorSchemeContrast) private var contrast
+
+ private var shape: RoundedRectangle {
+ RoundedRectangle(cornerRadius: AppTheme.Metrics.Showcase.cardRadius, style: .continuous)
+ }
+
+ func body(content: Content) -> some View {
+ self.material(content: content)
+ .overlay {
+ if !self.reduceTransparency && !self.forceOpaque {
+ self.shape.fill(LinearGradient(
+ colors: [.white.opacity(self.selected ? 0.08 : 0.025), .clear, FluidBrandColors.blue.opacity(self.selected ? 0.055 : 0.015)],
+ startPoint: .topLeading,
+ endPoint: .bottomTrailing
+ ))
+ .allowsHitTesting(false)
+ }
+ }
+ .overlay {
+ self.shape.strokeBorder(
+ LinearGradient(
+ colors: [.white.opacity(self.edgeOpacity), .white.opacity(0.06), .white.opacity(self.edgeOpacity * 0.55)],
+ startPoint: .topLeading,
+ endPoint: .bottomTrailing
+ ),
+ lineWidth: self.contrast == .increased ? 2 : 1
+ )
+ .allowsHitTesting(false)
+ }
+ .shadow(color: .black.opacity(self.selected ? 0.22 : 0.1), radius: self.selected ? 12 : 4, y: self.selected ? 8 : 2)
+ }
+
+ private var edgeOpacity: Double {
+ self.contrast == .increased ? 0.8 : (self.selected ? 0.30 : 0.10)
+ }
+
+ @ViewBuilder private func material(content: Content) -> some View {
+ if self.reduceTransparency || self.forceOpaque {
+ content.background(self.shape.fill(Color(red: 0.065, green: 0.075, blue: 0.11)))
+ } else if #available(macOS 26, *), self.useNativeGlass {
+ content.background {
+ Color.clear.glassEffect(.regular.tint(FluidBrandColors.blue.opacity(self.selected ? 0.08 : 0.025)), in: self.shape)
+ }
+ } else {
+ content.background(self.shape.fill(Color(red: 0.07, green: 0.095, blue: 0.15)))
+ }
+ }
+}
diff --git a/Prototypes/OverlayOnboarding/Sources/PracticeExamples.swift b/Prototypes/OverlayOnboarding/Sources/PracticeExamples.swift
new file mode 100644
index 00000000..a01979ba
--- /dev/null
+++ b/Prototypes/OverlayOnboarding/Sources/PracticeExamples.swift
@@ -0,0 +1,14 @@
+// Verbatim examples from the earlier onboarding cleanup carousel in the original checkout.
+// Source: Sources/Fluid/UI/OnboardingCleanupExampleCarousel.swift, correction and list entries.
+enum PracticeExamples {
+ struct Item {
+ let label: String
+ let title: String
+ let spoken: String
+ let cleaned: String
+ }
+ static let items = [
+ Item(label: "Correction", title: "Understand when you change your mind", spoken: "I'm free at 7:30 tomorrow morning. Would you be available for a quick call? Sorry, I meant 9:30 am.", cleaned: "I'm free at 9:30 am tomorrow morning. Would you be available for a quick call?"),
+ Item(label: "List & numbers", title: "Turn your rambling into lists", spoken: "Grocery list. First one is apples, second one is milk, third one is egg.", cleaned: "Grocery list\n\n1. Apples\n2. Milk\n3. Egg")
+ ]
+}
diff --git a/Prototypes/OverlayOnboarding/Sources/Preview.swift b/Prototypes/OverlayOnboarding/Sources/Preview.swift
new file mode 100644
index 00000000..d93c3840
--- /dev/null
+++ b/Prototypes/OverlayOnboarding/Sources/Preview.swift
@@ -0,0 +1,397 @@
+import AppKit
+import SwiftUI
+
+// Extracted product colors; no SettingsStore, audio, models, or production callbacks.
+enum FluidBrandColors { static let blue = Color(red: 0.10, green: 0.46, blue: 1) }
+enum AppTheme { enum Metrics { enum Showcase { static let cardRadius: CGFloat = 24 } } }
+
+/// One bounded clock makes pause/scrub deterministic. No clock remains at rest.
+@MainActor final class SequencePlayer: ObservableObject {
+ static let duration = 25.0
+ @Published var time = 0.0
+ @Published private(set) var playing = false
+ @Published var slow = false
+ @Published private(set) var demoActive = false
+ var canActivate: Bool { time >= 13.4 }
+ func toggleDemo() {
+ guard canActivate else { return }
+ pause()
+ demoActive.toggle()
+ }
+ private var timer: Timer?
+ private var lastTick = 0.0
+ private var intervals: [Double] = []
+ private(set) var tickCount = 0
+ var stage: String {
+ switch time {
+ case ..<3.4: return "Overlay arrives"
+ case ..<4.3: return "Mode chip"
+ case ..<7.3: return "Basic and Smart"
+ case ..<10.0: return "Smart selected"
+ case ..<13.4: return "Shortcut"
+ case ..<19.5: return "Correction example"
+ default: return "Numbered list example"
+ }
+ }
+ func play() {
+ guard timer == nil else { return }
+ if time >= Self.duration { time = 0 }
+ playing = true
+ lastTick = ProcessInfo.processInfo.systemUptime
+ let timer = Timer(timeInterval: 1 / 60, repeats: true) { [weak self] _ in
+ MainActor.assumeIsolated { self?.tick() }
+ }
+ timer.tolerance = 0.002
+ self.timer = timer
+ RunLoop.main.add(timer, forMode: .common)
+ }
+ private func tick() {
+ let now = ProcessInfo.processInfo.systemUptime
+ let delta = now - lastTick
+ lastTick = now
+ if intervals.count < 5000 { intervals.append(delta) }
+ tickCount += 1
+ time = min(Self.duration, time + delta * (slow ? 0.5 : 1))
+ if time >= Self.duration { pause() }
+ }
+ func pause() { timer?.invalidate(); timer = nil; playing = false }
+ func seek(_ value: Double) { pause(); demoActive = false; time = min(Self.duration, max(0, value)) }
+ func replay() { seek(0); intervals.removeAll(keepingCapacity: true); tickCount = 0; play() }
+ func report() -> String {
+ let sorted = intervals.sorted()
+ let p95 = sorted.isEmpty ? 0 : sorted[min(sorted.count - 1, Int(Double(sorted.count) * 0.95))] * 1000
+ return "ticks=\(tickCount) activeTimer=\(timer != nil) time=\(time) callback_p95_ms=\(p95) callback_over_33ms=\(intervals.filter { $0 > 0.0333 }.count)\nCallback timing is not presented-frame or GPU timing.\n"
+ }
+}
+
+struct PreviewScene: View {
+ @ObservedObject var player: SequencePlayer
+ @Environment(\.accessibilityReduceMotion) private var systemReduceMotion
+ @Environment(\.accessibilityReduceTransparency) private var systemReduceTransparency
+ @State private var previewReduceMotion = false
+ @State private var previewOpaque = false
+ var reduced: Bool { systemReduceMotion || previewReduceMotion }
+ private let paleBlue = Color(red: 0.48, green: 0.72, blue: 1)
+ private func progress(_ start: Double, _ length: Double) -> Double {
+ let x = min(1, max(0, (player.time - start) / length))
+ return x * x * x * (x * (x * 6 - 15) + 10)
+ }
+ private var arrival: Double { progress(0.15, 1.1) }
+ private var overlayOpacity: Double { player.demoActive ? 1 : arrival * (1 - progress(12.0, 0.6)) }
+ private var press: Double { progress(4.10, 0.16) * (1 - progress(4.30, 0.25)) }
+ private var menu: Double { progress(4.40, 0.5) * (1 - progress(9.3, 0.5)) }
+ private var menuSpring: Double {
+ let t = min(1.2, max(0, player.time - 4.40))
+ return 1 - exp(-8 * t) * (cos(11 * t) + (8.0 / 11) * sin(11 * t))
+ }
+ private var secondPress: Double { progress(7.0, 0.12) * (1 - progress(7.18, 0.18)) }
+ private var selection: Double { player.time >= 7.18 ? 1 : 0 }
+ private var pointerApproach: Double { progress(5.05, 0.55) }
+ private var pointerToSmart: Double { progress(6.15, 0.65) }
+ private var highlight: Double { progress(3.55, 0.4) * (1 - progress(10.0, 0.4)) }
+
+ var body: some View {
+ VStack(spacing: 0) {
+ stage
+ controls
+ }
+ .preferredColorScheme(.dark)
+ .frame(minWidth: 880, idealWidth: 1040, minHeight: 730, idealHeight: 810)
+ }
+ // A continuous camera move, with still reading holds. All transforms stop at 11.8s.
+ private var reveal: Double { progress(0.5, 2.7) }
+ private var dock: Double { progress(10.0, 1.8) }
+ private var cameraScale: Double { reduced ? 1 : 2.8 - 0.85 * reveal - 0.95 * dock }
+ private var pitch: Double { reduced ? 0 : 60 * (1 - reveal) + 12 * reveal * (1 - dock) }
+ private var yaw: Double { reduced ? 0 : 28 * (1 - reveal) - 10 * reveal * (1 - dock) }
+ private var roll: Double { reduced ? 0 : -14 * (1 - reveal) + 2 * reveal * (1 - dock) }
+ fileprivate var stage: some View {
+ GeometryReader { geo in
+ ZStack {
+ Color(red: 0.018, green: 0.026, blue: 0.05)
+ RadialGradient(colors: [FluidBrandColors.blue.opacity(0.19), .clear], center: .init(x: 0.64, y: 0.65), startRadius: 0, endRadius: 510)
+ // A second fixed light gives the moving glass a spatial reference.
+ Ellipse().fill(RadialGradient(colors: [Color(red: 0.12, green: 0.25, blue: 0.47).opacity(0.16), .clear], center: .center, startRadius: 0, endRadius: 400))
+ .frame(width: 820, height: 240).rotationEffect(.degrees(-25))
+ .position(x: geo.size.width * 0.68, y: geo.size.height * 0.7)
+ VStack(alignment: .leading, spacing: 12) {
+ Text("Meet your overlay")
+ .font(.fluidSystem(size: 42, design: .serif))
+ Text("Change modes with one click.")
+ .font(.fluidSystem(size: 15)).foregroundStyle(.white.opacity(0.5))
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.leading, 70)
+ .opacity(progress(1.15, 1.0) * (1 - progress(3.4, 0.55)))
+ .offset(y: reduced ? 0 : 15 * (1 - progress(1.15, 1.0)))
+ .position(x: geo.size.width / 2, y: 100)
+
+ Text("Change modes\nwith one click.")
+ .font(.fluidSystem(size: 32, design: .serif))
+ .foregroundStyle(.white.opacity(0.92))
+ .frame(maxWidth: .infinity, alignment: .leading).padding(.leading, 70)
+ .opacity(progress(4.0, 0.6) * (1 - progress(9.5, 0.5)))
+ .position(x: geo.size.width / 2, y: 122)
+
+ // Overlay and menu share one camera, so their attachment never drifts.
+ ZStack {
+ overlay
+ }
+ .frame(width: 340, height: 90.25)
+ .rotation3DEffect(.degrees(pitch), axis: (x: 1, y: 0, z: 0), perspective: 0.45)
+ .rotation3DEffect(.degrees(yaw), axis: (x: 0, y: 1, z: 0), perspective: 0.45)
+ .rotationEffect(.degrees(roll))
+ .scaleEffect(cameraScale)
+ .opacity(overlayOpacity)
+ .offset(y: player.demoActive || reduced ? 0 : 8 * progress(12.0, 0.6))
+ .animation(reduced ? .easeOut(duration: 0.15) : .easeOut(duration: 0.25), value: player.demoActive)
+ .position(x: geo.size.width / 2 + (reduced ? 0 : 90 * (1 - reveal)),
+ y: geo.size.height * 0.57 + dock * (geo.size.height * 0.43 - 123))
+ .accessibilityHidden(overlayOpacity < 0.1)
+
+ VStack(spacing: 12) {
+ if player.demoActive {
+ Text("Overlay preview · microphone off")
+ .font(.fluidSystem(size: 12)).foregroundStyle(.white.opacity(0.55))
+ Button("Hide overlay") { player.toggleDemo() }
+ .buttonStyle(.plain).foregroundStyle(paleBlue)
+ } else {
+ Text("Let’s try Smart mode")
+ .font(.fluidSystem(size: 22, design: .serif))
+ .foregroundStyle(.white.opacity(0.92))
+ HStack(spacing: 10) {
+ Text("Press").foregroundStyle(.white.opacity(0.8))
+ Text("⌥ Space")
+ .font(.fluidSystem(size: 22, weight: .medium))
+ .padding(.horizontal, 13).padding(.vertical, 8)
+ .background(.white.opacity(0.08), in: RoundedRectangle(cornerRadius: 9))
+ Text("to start dictating").foregroundStyle(.white.opacity(0.8))
+ }
+ .font(.fluidSystem(size: 18))
+ Button("Try dictation") { player.toggleDemo() }
+ .buttonStyle(.plain).font(.fluidSystem(size: 13, weight: .medium))
+ .foregroundStyle(paleBlue)
+ Text("Preview shortcut · no audio recorded")
+ .font(.fluidSystem(size: 11)).foregroundStyle(.white.opacity(0.4))
+ }
+ }
+ .opacity(progress(12.8, 0.6))
+ .disabled(!player.canActivate)
+ .allowsHitTesting(player.canActivate)
+ .position(x: geo.size.width / 2, y: geo.size.height - (player.demoActive ? 37 : 110))
+ .accessibilityHidden(!player.canActivate)
+
+ example
+ .opacity(progress(13.4, 0.8))
+ .offset(y: reduced ? 0 : 18 * (1 - progress(13.4, 0.8)))
+ .position(x: geo.size.width / 2, y: geo.size.height * 0.32)
+ .accessibilityHidden(player.time < 13.4)
+ }
+ .clipped()
+ }
+ }
+ private var overlay: some View {
+ BottomOverlayView(smart: selection > 0.5,
+ chipScale: reduced ? 1 : 1 - 0.075 * press,
+ chipHighlighted: highlight > 0.1,
+ demonstrationMenu: AnyView(
+ modeMenu
+ .scaleEffect(reduced ? 1 : (player.time < 9.3 ? 0.86 + 0.14 * menuSpring : 0.86 + 0.14 * menu), anchor: .bottomTrailing)
+ .rotation3DEffect(.degrees(reduced ? 0 : -16 * (1 - menu)), axis: (x: 1, y: 0, z: 0), anchor: .bottom, perspective: 0.35)
+ .opacity(menu)
+ .offset(y: reduced ? 0 : 9 * (1 - menuSpring))
+ .accessibilityHidden(menu < 0.5)
+ ),
+ demonstrationPointer: AnyView(
+ Image(systemName: "cursorarrow")
+ .font(.system(size: 15)).foregroundStyle(.white)
+ .shadow(color: .black.opacity(0.5), radius: 2, y: 1)
+ .scaleEffect(reduced ? 1 : 1 - 0.12 * max(press, secondPress))
+ .offset(x: 7 + 34 * (1 - progress(3.4, 0.65)) - 65 * pointerApproach,
+ y: 7 + 31 * (1 - progress(3.4, 0.65)) - 54 * pointerApproach + 25 * pointerToSmart)
+ .opacity((reduced ? 0 : 1) * progress(3.3, 0.2) * (1 - progress(8.05, 0.3)))
+ .accessibilityHidden(true)
+ ))
+ }
+ private var modeMenu: some View {
+ ProductionPromptMenu(smart: selection > 0.5,
+ smartPress: reduced ? 0 : secondPress,
+ hoveredRowID: player.time >= 6.75 && player.time < 7.18 ? "privateAI" : nil,
+ basicOpacity: progress(4.65, 0.24),
+ smartOpacity: progress(4.73, 0.28),
+ basicOffset: reduced ? 0 : 5 * (1 - progress(4.65, 0.30)),
+ smartOffset: reduced ? 0 : 7 * (1 - progress(4.73, 0.34)))
+ }
+ private var example: some View {
+ let index = player.time >= 19.5 ? 1 : 0
+ let item = PracticeExamples.items[index]
+ let switchOpacity = player.time < 19.5 ? 1 - progress(19.15, 0.35) : progress(19.5, 0.4)
+ return VStack(alignment: .leading, spacing: 18) {
+ HStack(spacing: 16) {
+ ForEach(0..<2) { option in
+ Button(PracticeExamples.items[option].label) { player.seek(option == 0 ? 16 : 23) }
+ .buttonStyle(.plain)
+ .font(.fluidSystem(size: 12, weight: .medium))
+ .foregroundStyle(option == index ? paleBlue : .white.opacity(0.45))
+ .accessibilityAddTraits(option == index ? [.isSelected] : [])
+ }
+ }
+ VStack(alignment: .leading, spacing: 16) {
+ Text(item.title)
+ .font(.fluidSystem(size: 26, design: .serif))
+ .fixedSize(horizontal: false, vertical: true)
+ HStack(alignment: .top, spacing: 24) {
+ VStack(alignment: .leading, spacing: 8) {
+ Text("You say").foregroundStyle(.white.opacity(0.5))
+ Text(item.spoken).foregroundStyle(.white.opacity(0.8))
+ }.frame(maxWidth: .infinity, alignment: .leading)
+ Rectangle().fill(.white.opacity(0.1)).frame(width: 1, height: 132)
+ VStack(alignment: .leading, spacing: 8) {
+ Text("Smart").foregroundStyle(paleBlue)
+ Text(item.cleaned).foregroundStyle(.white.opacity(0.93))
+ }.frame(maxWidth: .infinity, alignment: .leading)
+ }
+ .font(.fluidSystem(size: 14)).lineSpacing(3)
+ }
+ .frame(height: 198, alignment: .topLeading)
+ .opacity(switchOpacity)
+ }
+ .padding(26).frame(width: 650, alignment: .leading)
+ .modifier(OnboardingGlassSurface(selected: true, forceOpaque: previewOpaque))
+ }
+ private var controls: some View {
+ VStack(spacing: 12) {
+ HStack(spacing: 14) {
+ Button(action: { player.replay() }) { Image(systemName: "arrow.counterclockwise") }.help("Replay")
+ Button(action: { player.playing ? player.pause() : player.play() }) {
+ Image(systemName: player.playing ? "pause.fill" : "play.fill").frame(width: 14)
+ }.help(player.playing ? "Pause" : "Play").keyboardShortcut(.space, modifiers: [])
+ Slider(value: Binding(get: { player.time }, set: { player.seek($0) }), in: 0...SequencePlayer.duration)
+ .accessibilityLabel("Sequence position")
+ Text(String(format: "%04.1f / 25s", player.time)).monospacedDigit().frame(width: 85)
+ }
+ HStack(spacing: 18) {
+ Text(player.stage).foregroundStyle(.white.opacity(0.7)).frame(width: 130, alignment: .leading)
+ Spacer()
+ Toggle("Half speed", isOn: $player.slow)
+ Toggle("Reduce motion", isOn: $previewReduceMotion)
+ Toggle("Opaque surfaces", isOn: $previewOpaque)
+ Text("VISUAL PREVIEW").font(.fluidSystem(size: 9, weight: .semibold)).tracking(1.4).foregroundStyle(.white.opacity(0.35))
+ }
+ }
+ .font(.fluidSystem(size: 11)).toggleStyle(.checkbox).buttonStyle(.plain)
+ .padding(.horizontal, 28).padding(.vertical, 18)
+ .background(Color(red: 0.04, green: 0.045, blue: 0.065))
+ }
+}
+
+@MainActor final class PreviewDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
+ let player = SequencePlayer()
+ var window: NSWindow!
+ var observers: [NSObjectProtocol] = []
+ var previewKeyMonitor: Any?
+ func applicationDidFinishLaunching(_ notification: Notification) {
+ window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 1040, height: 810), styleMask: [.titled, .closable, .miniaturizable, .resizable], backing: .buffered, defer: false)
+ window.title = "FluidVoice · Overlay Film"
+ window.minSize = NSSize(width: 880, height: 758)
+ window.delegate = self
+ let args = ProcessInfo.processInfo.arguments
+ let rendering = args.contains("--render-frames")
+ if rendering {
+ window.setFrameOrigin(NSPoint(x: -12000, y: -12000))
+ } else {
+ window.contentView = NSHostingView(rootView: PreviewScene(player: player))
+ window.center()
+ window.makeKeyAndOrderFront(nil)
+ NSApp.activate(ignoringOtherApps: true)
+ // Foreground preview only. Never install a global shortcut or connect to recording.
+ previewKeyMonitor = NSEvent.addLocalMonitorForEvents(matching: .keyDown) { [weak self] event in
+ guard let self, self.window.isKeyWindow, self.player.canActivate,
+ event.keyCode == 49,
+ event.modifierFlags.intersection([.option, .command, .control, .shift]) == .option else { return event }
+ if !event.isARepeat { self.player.toggleDemo() }
+ return nil
+ }
+ }
+ for name in [NSWindow.didChangeOcclusionStateNotification, NSWindow.didMiniaturizeNotification, NSApplication.didHideNotification] {
+ observers.append(NotificationCenter.default.addObserver(forName: name, object: nil, queue: .main) { [weak self] _ in
+ MainActor.assumeIsolated {
+ guard let self else { return }
+ if !self.window.occlusionState.contains(.visible) || self.window.isMiniaturized || NSApp.isHidden { self.player.pause() }
+ }
+ })
+ }
+ if let i = args.firstIndex(of: "--seek"), args.count > i + 1, let value = Double(args[i + 1]) { player.seek(value) }
+ else if !rendering { player.play() }
+ if let i = args.firstIndex(of: "--render-frames"), args.count > i + 1 {
+ renderFrames(to: URL(fileURLWithPath: args[i + 1], isDirectory: true))
+ }
+ if let i = args.firstIndex(of: "--metrics"), args.count > i + 1 {
+ let path = args[i + 1]
+ DispatchQueue.main.asyncAfter(deadline: .now() + 18) { [weak self] in
+ try? self?.player.report().write(toFile: path, atomically: true, encoding: .utf8)
+ }
+ }
+ }
+ func renderFrames(to directory: URL) {
+ try? FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)
+ let landmarks: [(String, Double)] = [("01-angle", 0.9), ("02-reveal", 2.0), ("03-settle", 3.3), ("04-press", 4.25), ("05-unfold", 4.7), ("05-basic", 6), ("06-pointer-basic", 5.8), ("06-pointer-smart", 6.85), ("06-smart-click", 7.1), ("06-smart-selected", 7.4), ("07-dock", 11), ("08-vanishing", 12.3), ("08-shortcut", 13.4), ("09-correction", 16), ("10-numbered-list", 23)]
+ let film = ProcessInfo.processInfo.arguments.contains("--film")
+ let reference = ProcessInfo.processInfo.arguments.contains("--reference")
+ let filmDuration = ProcessInfo.processInfo.arguments.contains("--intro-only") ? 12.8 : SequencePlayer.duration
+ let frames = reference ? [("production-medium-smart", 16.0)] : (film ? (0...Int(filmDuration * 60)).map { (String(format: "%04d", $0), Double($0) / 60) } : landmarks)
+ for (index, frame) in frames.enumerated() {
+ DispatchQueue.main.asyncAfter(deadline: .now() + Double(index) * (film ? 0.04 : 0.55)) { [weak self] in
+ self?.player.seek(frame.1)
+ DispatchQueue.main.asyncAfter(deadline: .now() + (film ? 0 : 0.25)) { [weak self] in
+ guard let self else { return }
+ self.player.seek(frame.1)
+ if ProcessInfo.processInfo.arguments.contains("--activated") { self.player.toggleDemo() }
+ let content = reference
+ ? AnyView(BottomOverlayView(smart: true).fixedSize().padding(20).environment(\.colorScheme, .dark))
+ : AnyView(PreviewScene(player: self.player).stage.frame(width: 1040, height: 730).environment(\.colorScheme, .dark))
+ let renderer = ImageRenderer(content: content)
+ renderer.scale = reference ? 3 : 1.5
+ if let data = renderer.nsImage?.tiffRepresentation, let bitmap = NSBitmapImageRep(data: data) {
+ try? bitmap.representation(using: .png, properties: [:])?.write(to: directory.appendingPathComponent(frame.0 + ".png"))
+ }
+ if index == frames.count - 1 { NSApp.terminate(nil) }
+ }
+ }
+ }
+ }
+ func windowWillClose(_ notification: Notification) {
+ player.pause()
+ if let previewKeyMonitor { NSEvent.removeMonitor(previewKeyMonitor) }
+ previewKeyMonitor = nil
+ NSApp.terminate(nil)
+ }
+ func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { true }
+}
+
+@main struct OverlayPreviewMain {
+ static func main() {
+ if ProcessInfo.processInfo.arguments.contains("--check-interaction") {
+ let player = SequencePlayer()
+ player.seek(12.7)
+ player.toggleDemo()
+ precondition(!player.demoActive, "Activation must wait for the introduction")
+ player.seek(13.4)
+ player.play()
+ player.toggleDemo()
+ precondition(player.demoActive && !player.playing, "Activation should reveal overlay and stop autoplay")
+ player.toggleDemo()
+ precondition(!player.demoActive, "Second activation should hide the demo")
+ player.toggleDemo()
+ player.seek(0)
+ precondition(!player.demoActive, "Scrubbing or replay must reset activation")
+ print("PASS: early input ignored; ready input toggles overlay; autoplay pauses; seek resets activation")
+ return
+ }
+ let app = NSApplication.shared
+ let delegate = PreviewDelegate()
+ app.setActivationPolicy(ProcessInfo.processInfo.arguments.contains("--render-frames") ? .accessory : .regular)
+ app.delegate = delegate
+ withExtendedLifetime(delegate) { app.run() }
+ }
+}
diff --git a/Prototypes/OverlayOnboarding/Sources/ProductionMenu.swift b/Prototypes/OverlayOnboarding/Sources/ProductionMenu.swift
new file mode 100644
index 00000000..5d7ff3ac
--- /dev/null
+++ b/Prototypes/OverlayOnboarding/Sources/ProductionMenu.swift
@@ -0,0 +1,98 @@
+import SwiftUI
+struct ProductionPromptMenu: View {
+ let smart: Bool
+ var smartPress = 0.0
+ var hoveredRowID: String? = nil
+ var basicOpacity = 1.0
+ var smartOpacity = 1.0
+ var basicOffset = 0.0
+ var smartOffset = 0.0
+ private func shortcutBadge(for selection: PreviewSelection) -> some View { EmptyView() }
+ private func rowBackground(isSelected: Bool, rowID: String) -> some View {
+ let isHovered = self.hoveredRowID == rowID
+ let fillColor: Color
+ if isSelected {
+ fillColor = Color.white.opacity(0.28)
+ } else if isHovered {
+ fillColor = Color.white.opacity(0.20)
+ } else {
+ fillColor = Color.clear
+ }
+
+ let strokeColor: Color
+ if isSelected {
+ strokeColor = Color.white.opacity(0.38)
+ } else if isHovered {
+ strokeColor = Color.white.opacity(0.24)
+ } else {
+ strokeColor = Color.clear
+ }
+
+ return RoundedRectangle(cornerRadius: 7)
+ .fill(fillColor)
+ .overlay(
+ RoundedRectangle(cornerRadius: 7)
+ .stroke(strokeColor, lineWidth: 1)
+ )
+ }
+ @ViewBuilder private var offRow: some View {
+ let isSelected = !smart
+ HStack(alignment: .firstTextBaseline, spacing: 8) {
+ Text("Basic")
+ Spacer(minLength: 12)
+ Text("No cleanup")
+ .font(.fluidSystem(size: 10, weight: .medium))
+ .foregroundStyle(.white.opacity(0.45))
+ if isSelected {
+ Image(systemName: "checkmark")
+ .font(.fluidSystem(size: 10, weight: .semibold))
+ }
+ self.shortcutBadge(for: .off)
+ }
+ .padding(.horizontal, 8)
+ .padding(.vertical, 6)
+ .background(self.rowBackground(isSelected: isSelected, rowID: "off"))
+ }
+ @ViewBuilder private var privateAIRow: some View {
+ let isSelected = smart
+ HStack(alignment: .firstTextBaseline, spacing: 8) {
+ Text("Smart")
+ Spacer(minLength: 12)
+ Text("Fluid-1")
+ .font(.fluidSystem(size: 10, weight: .medium))
+ .foregroundStyle(.white.opacity(0.45))
+ if isSelected {
+ Image(systemName: "checkmark")
+ .font(.fluidSystem(size: 10, weight: .semibold))
+ }
+ self.shortcutBadge(for: .privateAI)
+ }
+ .padding(.horizontal, 8)
+ .padding(.vertical, 6)
+ .background(self.rowBackground(isSelected: isSelected, rowID: PrivateAIProviderFeature.shared.providerID))
+ }
+ var body: some View {
+ VStack(alignment: .leading, spacing: 0) {
+ Text("ON-DEVICE")
+ .font(.fluidSystem(size: 10, weight: .semibold))
+ .foregroundStyle(.white.opacity(0.4))
+ .padding(.horizontal, 8)
+ .padding(.top, 4)
+ .padding(.bottom, 3)
+ offRow.opacity(basicOpacity).offset(y: basicOffset)
+ privateAIRow.opacity(smartOpacity).offset(y: smartOffset).scaleEffect(1 - 0.035 * smartPress)
+ }
+ .padding(.horizontal, 8)
+ .padding(.vertical, 4)
+ .background(Color.black)
+ .cornerRadius(8)
+ .overlay(
+ RoundedRectangle(cornerRadius: 8)
+ .stroke(Color.white.opacity(0.12), lineWidth: 1)
+ )
+ .frame(width: 227.5, alignment: .leading)
+ .preferredColorScheme(.dark)
+ }
+}
+enum PreviewSelection { case off, privateAI }
+enum PrivateAIProviderFeature { struct Value { let providerID = "privateAI" }; static let shared = Value() }
diff --git a/Prototypes/OverlayOnboarding/Sources/ProductionOverlay.swift b/Prototypes/OverlayOnboarding/Sources/ProductionOverlay.swift
new file mode 100644
index 00000000..04e6771e
--- /dev/null
+++ b/Prototypes/OverlayOnboarding/Sources/ProductionOverlay.swift
@@ -0,0 +1,760 @@
+import AppKit
+import SwiftUI
+
+// Generated from Upstream/BottomOverlayView.swift. Visual declarations below are verbatim.
+// Only inputs are frozen, and production action/anchor controllers are not included.
+struct BottomOverlayView: View {
+ let smart: Bool
+ var chipScale: Double = 1
+ var chipHighlighted = false
+ var demonstrationMenu = AnyView(EmptyView())
+ var demonstrationPointer = AnyView(EmptyView())
+ private let settings = SettingsStore()
+ private let contentState = FrozenOverlayState()
+ private let appServices = FrozenAppServices()
+ private let displayedAppIcon: NSImage? = nil
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+ @State private var onboardingHighlight = false
+ @State private var isHoveringActionsChip = false
+ private let isHoveringPromptChip = false
+ private let showsOnboardingHint = false
+ private let isAppPromptOverrideActive = false
+ private let isPromptSelectableMode = true
+ private let shouldReservePreviewArea = true
+ private let shouldSuppressPreviewDuringRelease = false
+ private let shouldShowTextDeliveryFailure = false
+ private let shouldShowAIProcessingFailure = false
+ private let shouldShowProcessingPreview = false
+ private let shouldShowProcessingStatus = false
+ private let hasTranscription = false
+ private let frozenDynamicPreviewHeight: CGFloat? = nil
+ private let borderAnimationStartedAt: Date? = nil
+ private let showsSpokenSendIndicator = false
+ private let spokenSendIndicatorSize: CGFloat = 15
+ private let modeColor = Color.white.opacity(0.85)
+ private let modeLabel = "Dictate"
+ private let processingPreviewText = ""
+ private let transcriptionPreviewText = ""
+ private var layout: LayoutConstants { .get(for: settings.overlaySize) }
+ private var promptSelectorIconName: String? { smart ? "sparkles" : "bolt.fill" }
+ private var promptSelectorDisplayLabel: String { smart ? "Smart" : "Basic" }
+ private var promptSelectorBuiltInLabel: String? { promptSelectorDisplayLabel }
+ // Wrappers supply only demonstration animation; the label itself is copied unchanged.
+ private var promptSelectorView: some View {
+ promptSelectorTrigger.scaleEffect(chipScale)
+ .background(RoundedRectangle(cornerRadius: promptSelectorCornerRadius).fill(.white.opacity(chipHighlighted ? 0.10 : 0)))
+ .overlay(alignment: .topTrailing) {
+ demonstrationMenu.fixedSize()
+ .alignmentGuide(.top) { $0[.bottom] + max(0, layout.vPadding * 0.05) }
+ }
+ .overlay { demonstrationPointer }
+ }
+ private var actionsSelectorView: some View { actionsSelectorTrigger }
+ // Unreachable branches in the frozen, medium, silence state.
+ private var settingsChip: some View { EmptyView() }
+ private var textDeliveryFailureView: some View { EmptyView() }
+ private var aiProcessingFailureView: some View { EmptyView() }
+ private func scrollablePreviewText(_ text: String) -> some View { EmptyView() }
+ private func dynamicPreviewText(_ text: String) -> some View { EmptyView() }
+ struct LayoutConstants {
+ let hPadding: CGFloat
+ let vPadding: CGFloat
+ let waveformWidth: CGFloat
+ let waveformHeight: CGFloat
+ let iconSize: CGFloat
+ let transFontSize: CGFloat
+ let modeFontSize: CGFloat
+ let cornerRadius: CGFloat
+ let barCount: Int
+ let barWidth: CGFloat
+ let barSpacing: CGFloat
+ let minBarHeight: CGFloat
+ let maxBarHeight: CGFloat
+ let containerWidth: CGFloat
+ let overlayWidth: CGFloat
+ let overlayHeight: CGFloat
+ let previewBoxHeight: CGFloat
+ let usesFixedCanvas: Bool
+ let showsTopControls: Bool
+ let showsPreview: Bool
+ let showsModeLabel: Bool
+
+ static func get(for size: SettingsStore.OverlaySize) -> LayoutConstants {
+ switch size {
+ case .pill:
+ return LayoutConstants(
+ hPadding: 12,
+ vPadding: 8,
+ waveformWidth: 46,
+ waveformHeight: 30,
+ iconSize: 18,
+ transFontSize: 10,
+ modeFontSize: 9,
+ cornerRadius: 23,
+ barCount: 8,
+ barWidth: 3.0,
+ barSpacing: 2.5,
+ minBarHeight: 4,
+ maxBarHeight: 28,
+ containerWidth: 100,
+ overlayWidth: 100,
+ overlayHeight: 46,
+ previewBoxHeight: 0,
+ usesFixedCanvas: false,
+ showsTopControls: false,
+ showsPreview: false,
+ showsModeLabel: false
+ )
+ case .small:
+ return LayoutConstants(
+ hPadding: 10,
+ vPadding: 6,
+ waveformWidth: 90,
+ waveformHeight: 20,
+ iconSize: 16,
+ transFontSize: 11,
+ modeFontSize: 10,
+ cornerRadius: 14,
+ barCount: 7,
+ barWidth: 3.0,
+ barSpacing: 3.5,
+ minBarHeight: 5,
+ maxBarHeight: 16,
+ containerWidth: 200,
+ overlayWidth: 300,
+ overlayHeight: 124,
+ previewBoxHeight: 0,
+ usesFixedCanvas: false,
+ showsTopControls: false,
+ showsPreview: true,
+ showsModeLabel: true
+ )
+ case .medium:
+ return LayoutConstants(
+ hPadding: 18,
+ vPadding: 12,
+ waveformWidth: 130,
+ waveformHeight: 32,
+ iconSize: 20,
+ transFontSize: 13,
+ modeFontSize: 12,
+ cornerRadius: 18,
+ barCount: 8,
+ barWidth: 3.5,
+ barSpacing: 4.5,
+ minBarHeight: 6,
+ maxBarHeight: 28,
+ containerWidth: 340,
+ overlayWidth: 380,
+ overlayHeight: 156,
+ previewBoxHeight: 0,
+ usesFixedCanvas: false,
+ showsTopControls: true,
+ showsPreview: true,
+ showsModeLabel: true
+ )
+ case .large:
+ return LayoutConstants(
+ hPadding: 18,
+ vPadding: 12,
+ waveformWidth: 180,
+ waveformHeight: 48,
+ iconSize: 26,
+ transFontSize: 15,
+ modeFontSize: 14,
+ cornerRadius: 24,
+ barCount: 11,
+ barWidth: 5.0,
+ barSpacing: 6.0,
+ minBarHeight: 8,
+ maxBarHeight: 44,
+ containerWidth: 600,
+ overlayWidth: 600,
+ overlayHeight: 288,
+ previewBoxHeight: 92,
+ usesFixedCanvas: true,
+ showsTopControls: true,
+ showsPreview: true,
+ showsModeLabel: true
+ )
+ }
+ }
+ }
+
+ private var isCompactControls: Bool {
+ self.settings.overlaySize == .medium
+ }
+
+ private var waveformHorizontalOffset: CGFloat {
+ self.settings.overlaySize == .medium ? -28 : 0
+ }
+
+ private var isPillSize: Bool {
+ self.settings.overlaySize == .pill
+ }
+
+ private var promptSelectorFontSize: CGFloat {
+ if self.isCompactControls { return 10 }
+ return max(self.layout.modeFontSize - 1, 9)
+ }
+
+ private var promptSelectorLabelFontSize: CGFloat {
+ max(self.promptSelectorFontSize - 1, 8)
+ }
+
+ private var promptSelectorVerticalPadding: CGFloat {
+ 4
+ }
+
+ private var promptSelectorCornerRadius: CGFloat {
+ max(self.layout.cornerRadius * 0.42, 8)
+ }
+
+ private var previewMaxHeight: CGFloat {
+ self.layout.usesFixedCanvas ? self.layout.previewBoxHeight : self.layout.transFontSize * 4.2
+ }
+
+ private var overlayFrameHeight: CGFloat? {
+ guard self.layout.usesFixedCanvas else { return nil }
+ return self.shouldReservePreviewArea ? self.layout.overlayHeight : nil
+ }
+
+ private var previewMaxWidth: CGFloat {
+ if self.layout.usesFixedCanvas {
+ return self.layout.waveformWidth * 2.2
+ }
+
+ return max(self.layout.waveformWidth * 2.2, self.layout.containerWidth - self.layout.hPadding * 2)
+ }
+
+ private var dynamicPreviewBaseMinHeight: CGFloat {
+ guard self.shouldReservePreviewArea else { return 0 }
+ let verticalPadding = self.settings.overlaySize == .small
+ ? max(2, self.transcriptionVerticalPadding - 1)
+ : self.transcriptionVerticalPadding
+ return self.estimatedPreviewLineHeight + verticalPadding * 2
+ }
+
+ private var effectiveDynamicPreviewLockedHeight: CGFloat? {
+ guard self.contentState.isBottomOverlayReleaseTransitioning else { return nil }
+ guard let frozenDynamicPreviewHeight else { return nil }
+ return max(frozenDynamicPreviewHeight, self.dynamicPreviewBaseMinHeight)
+ }
+
+ private var effectiveDynamicPreviewMinHeight: CGFloat {
+ self.effectiveDynamicPreviewLockedHeight ?? self.dynamicPreviewBaseMinHeight
+ }
+
+ private var estimatedPreviewLineHeight: CGFloat {
+ max(self.layout.transFontSize * 1.25, self.layout.transFontSize + 2)
+ }
+
+ private var transcriptionVerticalPadding: CGFloat {
+ max(4, self.layout.vPadding / 2)
+ }
+
+ private var overlayBorderLineWidth: CGFloat {
+ self.settings.overlaySize == .large ? 0.8 : 1
+ }
+
+ private var overlayBorderTopOpacity: Double {
+ switch self.settings.overlaySize {
+ case .pill: return 0.22 // a touch crisper so the smaller pill reads clearly
+ case .large: return 0.10
+ default: return 0.15
+ }
+ }
+
+ private var overlayBorderBottomOpacity: Double {
+ switch self.settings.overlaySize {
+ case .pill: return 0.10
+ case .large: return 0.05
+ default: return 0.08
+ }
+ }
+
+ private var targetAppIconView: some View {
+ let appIcon = self.displayedAppIcon
+ let showModelLoading = self.layout.showsModeLabel && !self.appServices.asr.isAsrReady &&
+ (self.appServices.asr.isLoadingModel || self.appServices.asr.isDownloadingModel)
+ return VStack(spacing: 2) {
+ if showModelLoading {
+ ProgressView()
+ .controlSize(.mini)
+ }
+ if let appIcon = appIcon {
+ Image(nsImage: appIcon)
+ .resizable()
+ .aspectRatio(contentMode: .fit)
+ .frame(width: self.layout.iconSize, height: self.layout.iconSize)
+ .clipShape(RoundedRectangle(cornerRadius: self.layout.iconSize / 4))
+ } else if !self.layout.showsModeLabel {
+ Circle()
+ .fill(self.modeColor.opacity(0.9))
+ .frame(width: max(self.layout.iconSize * 0.45, 7), height: max(self.layout.iconSize * 0.45, 7))
+ }
+ }
+ .frame(width: self.layout.iconSize, height: self.layout.iconSize)
+ .opacity((appIcon != nil || showModelLoading || !self.layout.showsModeLabel) ? 1 : 0)
+ }
+
+ private var leadingAppContextView: some View {
+ HStack(spacing: self.isPillSize ? 4 : 8) {
+ if self.showsSpokenSendIndicator {
+ SpokenSendIndicatorView(
+ state: self.contentState.spokenSendIndicatorState,
+ color: self.modeColor,
+ size: self.isPillSize ? 14 : self.spokenSendIndicatorSize
+ )
+ .id(self.contentState.spokenSendCountdownID)
+ .transition(.scale(scale: 0.8).combined(with: .opacity))
+ }
+
+ self.targetAppIconView
+ }
+ .animation(
+ self.reduceMotion ? nil : .easeOut(duration: 0.14),
+ value: self.contentState.spokenSendIndicatorState
+ )
+ }
+
+ private var promptSelectorTrigger: some View {
+ HStack(spacing: 5) {
+ if let promptSelectorIconName = self.promptSelectorIconName {
+ Image(systemName: promptSelectorIconName)
+ .font(.fluidSystem(size: max(self.promptSelectorFontSize - 1, 9), weight: .semibold))
+ .foregroundStyle(.white.opacity(0.72))
+ }
+ Text(self.promptSelectorDisplayLabel)
+ .font(.fluidSystem(size: self.promptSelectorFontSize, weight: .semibold))
+ .foregroundStyle(.white.opacity(0.82))
+ .lineLimit(1)
+ .truncationMode(.tail)
+ .frame(
+ maxWidth: self.promptSelectorBuiltInLabel == nil ? 72 : nil,
+ alignment: .leading
+ )
+ if self.isAppPromptOverrideActive {
+ Text("App")
+ .font(.fluidSystem(size: max(self.promptSelectorFontSize - 2, 8), weight: .semibold))
+ .foregroundStyle(.white.opacity(0.9))
+ .padding(.horizontal, 5)
+ .padding(.vertical, 1)
+ .background(
+ Capsule()
+ .fill(Color.white.opacity(0.15))
+ )
+ }
+ Image(systemName: "chevron.down")
+ .font(.fluidSystem(size: max(self.promptSelectorFontSize - 1, 8), weight: .semibold))
+ .foregroundStyle(.white.opacity(0.45))
+ }
+ .padding(.horizontal, 7)
+ .padding(.vertical, self.promptSelectorVerticalPadding)
+ .background(
+ RoundedRectangle(cornerRadius: self.promptSelectorCornerRadius, style: .continuous)
+ .fill(
+ self.isHoveringPromptChip && self.isPromptSelectableMode && !self.contentState.isProcessing
+ ? Color.white.opacity(0.10)
+ : Color.clear
+ )
+ )
+ .overlay(alignment: .top) {
+ if self.isHoveringPromptChip, !self.showsOnboardingHint, self.isPromptSelectableMode, !self.contentState.isProcessing {
+ Text("Select dictation mode")
+ .font(.fluidSystem(size: 11, weight: .semibold))
+ .foregroundStyle(.white.opacity(0.9))
+ .padding(.horizontal, 8)
+ .padding(.vertical, 4)
+ .background(Color.black.opacity(0.94))
+ .clipShape(Capsule())
+ .overlay(
+ Capsule()
+ .stroke(Color.white.opacity(0.16), lineWidth: 1)
+ )
+ .fixedSize()
+ .offset(y: -30)
+ .allowsHitTesting(false)
+ }
+ }
+ .accessibilityElement(children: .combine)
+ .accessibilityLabel("Select dictation mode")
+ .overlay {
+ if self.showsOnboardingHint {
+ RoundedRectangle(cornerRadius: self.promptSelectorCornerRadius)
+ .stroke(FluidOnboardingLandingColors.blue, lineWidth: 1.5)
+ .padding(-3)
+ .opacity(self.reduceMotion || self.onboardingHighlight ? 1 : 0.2)
+ .allowsHitTesting(false)
+ }
+ }
+ .task(id: self.showsOnboardingHint) {
+ guard self.showsOnboardingHint else {
+ self.onboardingHighlight = false
+ return
+ }
+ withAnimation(self.reduceMotion ? nil : .easeOut(duration: 0.45)) {
+ self.onboardingHighlight = true
+ }
+ }
+ }
+
+ private var actionsSelectorTrigger: some View {
+ let actionsDisabled = self.contentState.isProcessing
+ return HStack(spacing: 0) {
+ Image(systemName: "ellipsis")
+ .font(.fluidSystem(size: 16, weight: .bold))
+ .foregroundStyle(.white.opacity(actionsDisabled ? 0.3 : 0.78))
+ }
+ .frame(width: 32, height: 32)
+ .background(
+ RoundedRectangle(cornerRadius: 9, style: .continuous)
+ .fill(self.isHoveringActionsChip && !actionsDisabled ? Color.white.opacity(0.1) : Color.clear)
+ )
+ .overlay(alignment: .top) {
+ if self.isHoveringActionsChip, !actionsDisabled {
+ Text("Actions")
+ .font(.fluidSystem(size: 11, weight: .semibold))
+ .foregroundStyle(.white.opacity(0.9))
+ .padding(.horizontal, 8)
+ .padding(.vertical, 4)
+ .background(Color.black.opacity(0.94))
+ .clipShape(Capsule())
+ .overlay(
+ Capsule()
+ .stroke(Color.white.opacity(0.16), lineWidth: 1)
+ )
+ .fixedSize()
+ .offset(y: -30)
+ .allowsHitTesting(false)
+ }
+ }
+ .accessibilityElement(children: .ignore)
+ .accessibilityLabel("Actions")
+ }
+
+ private func chipBackground(isHovered: Bool, disabled: Bool) -> some View {
+ let fillColor: Color
+ if disabled {
+ fillColor = Color.black.opacity(0.95)
+ } else if isHovered {
+ fillColor = Color(red: 0.13, green: 0.13, blue: 0.16)
+ } else {
+ fillColor = Color.black
+ }
+
+ let topStrokeOpacity: Double = disabled ? 0.10 : (isHovered ? 0.36 : 0.14)
+ let bottomStrokeOpacity: Double = disabled ? 0.06 : (isHovered ? 0.22 : 0.08)
+ let hoverShadowColor: Color = (isHovered && !disabled) ? Color.white.opacity(0.16) : .clear
+
+ return RoundedRectangle(cornerRadius: self.promptSelectorCornerRadius)
+ .fill(fillColor)
+ .overlay(
+ RoundedRectangle(cornerRadius: self.promptSelectorCornerRadius)
+ .strokeBorder(
+ LinearGradient(
+ colors: [
+ Color.white.opacity(topStrokeOpacity),
+ Color.white.opacity(bottomStrokeOpacity),
+ ],
+ startPoint: .top,
+ endPoint: .bottom
+ ),
+ lineWidth: 1
+ )
+ )
+ .shadow(color: hoverShadowColor, radius: 6, x: 0, y: 1)
+ }
+
+ var body: some View {
+ VStack(spacing: max(4, self.layout.vPadding / 2)) {
+ if self.layout.showsTopControls, !self.isCompactControls {
+ HStack {
+ Spacer(minLength: 4)
+ self.settingsChip
+ }
+ .padding(.horizontal, self.layout.hPadding)
+ }
+
+ VStack(spacing: self.layout.vPadding / 2) {
+ if self.shouldReservePreviewArea {
+ if self.layout.usesFixedCanvas {
+ // Transcription text area (fixed-height in large mode)
+ Group {
+ if self.shouldSuppressPreviewDuringRelease {
+ Color.clear
+ } else if self.shouldShowTextDeliveryFailure {
+ self.textDeliveryFailureView
+ } else if self.shouldShowAIProcessingFailure {
+ self.aiProcessingFailureView
+ } else if self.shouldShowProcessingPreview {
+ self.scrollablePreviewText(self.processingPreviewText)
+ } else if self.shouldShowProcessingStatus {
+ // Temporarily hidden; the waveform sweep carries processing state.
+ // ShimmerText(
+ // text: self.processingStatusText,
+ // color: self.modeColor,
+ // font: .fluidSystem(size: self.layout.transFontSize, weight: .medium)
+ // )
+ // .id(self.processingStatusCycleID)
+ // .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
+ Color.clear
+ } else if self.contentState.isProcessing {
+ Color.clear
+ } else if self.hasTranscription {
+ let previewText = self.transcriptionPreviewText
+ if !previewText.isEmpty {
+ ScrollViewReader { proxy in
+ ScrollView(.vertical, showsIndicators: false) {
+ Text(previewText)
+ .font(.fluidSystem(size: self.layout.transFontSize, weight: .medium))
+ .foregroundStyle(.white.opacity(0.9))
+ .multilineTextAlignment(.leading)
+ .lineLimit(nil)
+ .fixedSize(horizontal: false, vertical: true)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ Color.clear.frame(height: 1).id("bottom")
+ }
+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
+ .clipped()
+ .onAppear {
+ DispatchQueue.main.async {
+ proxy.scrollTo("bottom", anchor: .bottom)
+ }
+ }
+ .onChange(of: previewText) { _, _ in
+ DispatchQueue.main.async {
+ proxy.scrollTo("bottom", anchor: .bottom)
+ }
+ }
+ }
+ }
+ } else {
+ Color.clear
+ }
+ }
+ .padding(.vertical, self.transcriptionVerticalPadding)
+ .frame(
+ maxWidth: .infinity,
+ minHeight: self.previewMaxHeight,
+ maxHeight: self.previewMaxHeight,
+ alignment: .topLeading
+ )
+ } else {
+ // Original dynamic preview behavior for small/medium
+ Group {
+ if self.shouldSuppressPreviewDuringRelease {
+ Color.clear
+ } else if self.shouldShowTextDeliveryFailure {
+ self.textDeliveryFailureView
+ } else if self.shouldShowAIProcessingFailure {
+ self.aiProcessingFailureView
+ } else if self.shouldShowProcessingPreview {
+ self.dynamicPreviewText(self.processingPreviewText)
+ } else if self.hasTranscription && !self.contentState.isProcessing {
+ let previewText = self.transcriptionPreviewText
+ if !previewText.isEmpty {
+ if self.settings.overlaySize == .small {
+ Text(previewText)
+ .font(.fluidSystem(size: self.layout.transFontSize, weight: .medium))
+ .foregroundStyle(.white.opacity(0.9))
+ .multilineTextAlignment(.leading)
+ .lineLimit(1)
+ .truncationMode(.head)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.vertical, max(2, self.transcriptionVerticalPadding - 1))
+ } else {
+ Text(previewText)
+ .font(.fluidSystem(size: self.layout.transFontSize, weight: .medium))
+ .foregroundStyle(.white.opacity(0.9))
+ .multilineTextAlignment(.leading)
+ .lineLimit(Int(self.previewMaxHeight / max(self.estimatedPreviewLineHeight, 1)))
+ .truncationMode(.head)
+ .fixedSize(horizontal: false, vertical: true)
+ .frame(width: self.previewMaxWidth, alignment: .leading)
+ .padding(.vertical, self.transcriptionVerticalPadding)
+ }
+ }
+ } else if self.shouldShowProcessingStatus {
+ // Temporarily hidden; the waveform sweep carries processing state.
+ // ShimmerText(
+ // text: self.processingStatusText,
+ // color: self.modeColor,
+ // font: .fluidSystem(size: self.layout.transFontSize, weight: .medium)
+ // )
+ // .id(self.processingStatusCycleID)
+ Color.clear
+ } else if self.contentState.isProcessing {
+ Color.clear
+ } else {
+ Color.clear
+ }
+ }
+ .background(
+ GeometryReader { proxy in
+ Color.clear
+ .preference(key: DynamicPreviewHeightPreferenceKey.self, value: proxy.size.height)
+ }
+ )
+ .frame(
+ maxWidth: self.previewMaxWidth,
+ minHeight: self.effectiveDynamicPreviewMinHeight,
+ maxHeight: self.effectiveDynamicPreviewLockedHeight
+ )
+ }
+ }
+
+ // Waveform + Mode label row
+ HStack(spacing: self.isPillSize ? 4 : self.layout.hPadding / 1.5) {
+ if !self.layout.showsTopControls {
+ self.leadingAppContextView
+ }
+
+ // Waveform visualization
+ BottomWaveformView(
+ color: self.modeColor,
+ layout: self.layout,
+ visibleBarCount: self.isPillSize && self.showsSpokenSendIndicator ? 6 : nil
+ )
+ .frame(
+ width: self.isPillSize && self.showsSpokenSendIndicator
+ ? 32
+ : self.layout.waveformWidth,
+ height: self.layout.waveformHeight
+ )
+
+ // Compact overlays still need a visible mode because they have no selector.
+ if self.layout.showsModeLabel, !self.layout.showsTopControls {
+ VStack(alignment: .leading, spacing: 2) {
+ Text(self.modeLabel)
+ .font(.fluidSystem(size: self.layout.modeFontSize, weight: .semibold))
+ .foregroundStyle(self.modeColor)
+ .lineLimit(1)
+ .fixedSize(horizontal: true, vertical: false)
+
+ if !self.appServices.asr.isAsrReady &&
+ (self.appServices.asr.isLoadingModel || self.appServices.asr.isDownloadingModel)
+ && self.settings.overlaySize != .small
+ {
+ Text("Loading model…")
+ .font(.fluidSystem(size: max(self.layout.modeFontSize - 2, 9), weight: .medium))
+ .foregroundStyle(.orange.opacity(0.85))
+ .lineLimit(1)
+ }
+ }
+ .animation(
+ self.reduceMotion ? nil : .easeOut(duration: 0.14),
+ value: self.contentState.spokenSendIndicatorState
+ )
+ }
+ }
+ .offset(x: self.waveformHorizontalOffset)
+ .frame(maxWidth: .infinity, alignment: .center)
+ .overlay(alignment: .leading) {
+ if self.layout.showsTopControls {
+ self.leadingAppContextView
+ }
+ }
+ .overlay(alignment: .trailing) {
+ if self.layout.showsTopControls {
+ HStack(spacing: 8) {
+ self.promptSelectorView
+ self.actionsSelectorView
+ }
+ }
+ }
+ }
+ .padding(.horizontal, self.layout.hPadding)
+ .padding(.vertical, self.layout.vPadding)
+ .frame(maxWidth: .infinity, alignment: .center)
+ .background(
+ ZStack {
+ // Solid pitch black background, with a soft drop shadow so the pill lifts
+ // off whatever is behind it (pill size only; outer padding reserves room).
+ RoundedRectangle(cornerRadius: self.layout.cornerRadius)
+ .fill(Color.black)
+ .shadow(
+ color: Color.black.opacity(self.isPillSize ? 0.32 : 0),
+ radius: self.isPillSize ? PillShadowMetrics.radius : 0,
+ x: 0,
+ y: self.isPillSize ? PillShadowMetrics.yOffset : 0
+ )
+
+ if self.isPillSize {
+ // Glossy border: a bright highlight that slowly rotates around the edge.
+ // Paused under reduce-motion to avoid continuous redraws on low-resource Macs.
+ if self.reduceMotion || !self.contentState.isBottomOverlayPresented {
+ RoundedRectangle(cornerRadius: self.layout.cornerRadius)
+ .strokeBorder(
+ AngularGradient(
+ gradient: Gradient(stops: [
+ .init(color: .white.opacity(0.06), location: 0.00),
+ .init(color: .white.opacity(0.55), location: 0.13),
+ .init(color: .white.opacity(0.10), location: 0.30),
+ .init(color: .white.opacity(0.03), location: 0.55),
+ .init(color: .white.opacity(0.22), location: 0.80),
+ .init(color: .white.opacity(0.06), location: 1.00),
+ ]),
+ center: .center,
+ angle: .degrees(0)
+ ),
+ lineWidth: 1.2
+ )
+ } else {
+ TimelineView(.animation(minimumInterval: 1.0 / 30.0)) { timeline in
+ let seconds = max(
+ 0,
+ timeline.date.timeIntervalSince(self.borderAnimationStartedAt ?? timeline.date)
+ )
+ let angle = (seconds.truncatingRemainder(dividingBy: 6.0) / 6.0) * 360.0
+ RoundedRectangle(cornerRadius: self.layout.cornerRadius)
+ .strokeBorder(
+ AngularGradient(
+ gradient: Gradient(stops: [
+ .init(color: .white.opacity(0.06), location: 0.00),
+ .init(color: .white.opacity(0.55), location: 0.13),
+ .init(color: .white.opacity(0.10), location: 0.30),
+ .init(color: .white.opacity(0.03), location: 0.55),
+ .init(color: .white.opacity(0.22), location: 0.80),
+ .init(color: .white.opacity(0.06), location: 1.00),
+ ]),
+ center: .center,
+ angle: .degrees(angle)
+ ),
+ lineWidth: 1.2
+ )
+ }
+ }
+ } else {
+ // Inner border
+ RoundedRectangle(cornerRadius: self.layout.cornerRadius)
+ .strokeBorder(
+ LinearGradient(
+ colors: [
+ Color.white.opacity(self.overlayBorderTopOpacity),
+ Color.white.opacity(self.overlayBorderBottomOpacity),
+ ],
+ startPoint: .top,
+ endPoint: .bottom
+ ),
+ lineWidth: self.overlayBorderLineWidth
+ )
+ }
+ }
+ )
+ .frame(maxWidth: .infinity, alignment: .top)
+ .transaction { transaction in
+ if self.shouldSuppressPreviewDuringRelease {
+ transaction.animation = nil
+ }
+ }
+ }
+ .frame(
+ width: self.layout.usesFixedCanvas ? self.layout.overlayWidth : self.layout.containerWidth,
+ height: self.overlayFrameHeight,
+ alignment: .top
+ )
+ // Reserve space around the pill so its drop shadow isn't clipped by the (content-sized) window.
+ .padding(self.isPillSize ? 26 : 0)
+ }
+}
diff --git a/Prototypes/OverlayOnboarding/Sources/ProductionWaveform.swift b/Prototypes/OverlayOnboarding/Sources/ProductionWaveform.swift
new file mode 100644
index 00000000..0a2265ac
--- /dev/null
+++ b/Prototypes/OverlayOnboarding/Sources/ProductionWaveform.swift
@@ -0,0 +1,103 @@
+import SwiftUI
+struct BottomWaveformView: View {
+ let color: Color
+ let layout: BottomOverlayView.LayoutConstants
+ let visibleBarCount: Int?
+ private let contentState = FrozenOverlayState()
+ private let barHeights: [CGFloat] = Array(repeating: 6, count: 11)
+ private var barCount: Int {
+ self.visibleBarCount ?? self.layout.barCount
+ }
+
+ private var barWidth: CGFloat {
+ self.layout.barWidth
+ }
+
+ private var barSpacing: CGFloat {
+ self.layout.barSpacing
+ }
+
+ private var minHeight: CGFloat {
+ self.layout.minBarHeight
+ }
+
+ private var maxHeight: CGFloat {
+ self.layout.maxBarHeight
+ }
+
+ private var isPillStyle: Bool {
+ !self.layout.showsModeLabel
+ }
+
+ private var isProcessingVisualActive: Bool {
+ self.contentState.isProcessing || self.isReleaseAnimationActive
+ }
+
+ private var currentGlowIntensity: CGFloat {
+ if self.isPillStyle {
+ return 0.0
+ }
+ return self.isProcessingVisualActive ? 0.0 : 0.5
+ }
+
+ private var currentGlowRadius: CGFloat {
+ if self.isPillStyle {
+ return 0.0
+ }
+ return self.isProcessingVisualActive ? 0.0 : 4
+ }
+
+ private var barFillColor: Color {
+ if self.isPillStyle {
+ return Color.white.opacity(self.isProcessingVisualActive ? 0.32 : 0.88)
+ }
+ return self.color.opacity(self.isProcessingVisualActive ? 0.16 : 1.0)
+ }
+
+ private var isReleaseAnimationActive: Bool {
+ self.contentState.isBottomOverlayReleaseTransitioning || self.contentState.isBottomOverlayDismissing
+ }
+
+ private var barsView: some View {
+ HStack(spacing: self.barSpacing) {
+ ForEach(0..<self.barCount, id: \.self) { index in
+ RoundedRectangle(cornerRadius: self.barWidth / 2)
+ .frame(width: self.barWidth, height: self.displayHeight(at: index))
+ .shadow(
+ color: self.color.opacity(self.isReleaseAnimationActive ? 0 : self.currentGlowIntensity),
+ radius: self.isReleaseAnimationActive ? 0 : self.currentGlowRadius,
+ x: 0,
+ y: 0
+ )
+ }
+ }
+ }
+
+ private func safeBarHeight(at index: Int) -> CGFloat {
+ guard index >= 0 && index < self.barHeights.count else {
+ return self.minHeight
+ }
+ return self.barHeights[index]
+ }
+
+ private func displayHeight(at index: Int) -> CGFloat {
+ if self.isReleaseAnimationActive || self.contentState.isProcessing {
+ return self.minHeight
+ }
+ return self.safeBarHeight(at: index)
+ }
+ var body: some View {
+ ZStack {
+ self.barsView
+ .foregroundStyle(self.barFillColor)
+
+ if self.isProcessingVisualActive {
+ CompositorShimmerSweep(duration: 1.05, peakOpacity: 0.9)
+ .mask {
+ self.barsView
+ }
+ .shadow(color: .white.opacity(0.28), radius: 2.5, x: 0, y: 0)
+ }
+ }
+ }
+}
diff --git a/Prototypes/OverlayOnboarding/build.sh b/Prototypes/OverlayOnboarding/build.sh
new file mode 100644
index 00000000..1c743606
--- /dev/null
+++ b/Prototypes/OverlayOnboarding/build.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+set -eu
+cd "$(dirname "$0")"
+SELECTED=$(xcode-select -p)
+case "$SELECTED" in
+ *.app/Contents/Developer) export DEVELOPER_DIR="$SELECTED" ;;
+ *) export DEVELOPER_DIR="${DEVELOPER_DIR:-/Applications/Xcode-beta6.app/Contents/Developer}" ;;
+esac
+[ -d "$DEVELOPER_DIR/Platforms/MacOSX.platform" ] || { echo "Full Xcode required" >&2; exit 1; }
+APP="$PWD/.build/FluidVoice Overlay Preview.app"
+mkdir -p "$APP/Contents/MacOS"
+xcrun swiftc -parse-as-library -O -target "$(uname -m)-apple-macosx13.0" Sources/*.swift -o "$APP/Contents/MacOS/OverlayPreview" -framework SwiftUI -framework AppKit
+cat > "$APP/Contents/Info.plist" <<'PLIST'
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0"><dict>
+<key>CFBundleIdentifier</key><string>com.fluidvoice.experimental.overlay-preview</string>
+<key>CFBundleName</key><string>FluidVoice Overlay Preview</string>
+<key>CFBundleExecutable</key><string>OverlayPreview</string>
+<key>CFBundlePackageType</key><string>APPL</string>
+<key>CFBundleVersion</key><string>1</string>
+<key>LSMinimumSystemVersion</key><string>13.0</string>
+<key>NSHighResolutionCapable</key><true/>
+</dict></plist>
+PLIST
+codesign --force --sign "${PREVIEW_SIGN_IDENTITY:-Apple Development: Barathwaj Anandan (XJ27RZ3HBK)}" "$APP"
+printf '%s\n' "$APP"
diff --git a/Sources/Fluid/Resources/OnboardingSmartMode.mp4 b/Sources/Fluid/Resources/OnboardingSmartMode.mp4
new file mode 100644
index 00000000..1e25ba91
Binary files /dev/null and b/Sources/Fluid/Resources/OnboardingSmartMode.mp4 differ
diff --git a/Sources/Fluid/Resources/OnboardingSmartModeSelected.png b/Sources/Fluid/Resources/OnboardingSmartModeSelected.png
new file mode 100644
index 00000000..b5943d44
Binary files /dev/null and b/Sources/Fluid/Resources/OnboardingSmartModeSelected.png differ
diff --git a/Sources/Fluid/Services/OnboardingPolishPractice.swift b/Sources/Fluid/Services/OnboardingPolishPractice.swift
index acf27914..2f9025c0 100644
--- a/Sources/Fluid/Services/OnboardingPolishPractice.swift
+++ b/Sources/Fluid/Services/OnboardingPolishPractice.swift
@@ -8,14 +8,17 @@ struct OnboardingPolishPractice {
}
static let examples = [
- Example(spoken: "Hey John, Newline, how are you doing today?", expected: "Hey John,\nHow are you doing today?"),
Example(
- spoken: "Hey, can we meet at five thirty tomorrow morning? Sorry, can you make it three thirty p.m. today?",
- expected: "Hey, can we meet at 3:30 PM today?"
+ spoken: "I'm free at 7:30 tomorrow morning. Would you be available for a quick call? Sorry, I meant 9:30 am.",
+ expected: "I'm free at 9:30 am tomorrow morning. Would you be available for a quick call?"
),
Example(
- spoken: "Make a grocery list. First one is banana, second one is apple, third one is orange.",
- expected: "Grocery list:\n- banana\n- apple\n- orange"
+ spoken: "Grocery list. First one is apples, second one is milk, third one is egg.",
+ expected: "Grocery list\n\n1. Apples\n2. Milk\n3. Egg"
+ ),
+ Example(
+ spoken: "I think I'm gonna meet you tomorrow at 3 p.m. Let me know if the time works. If not, we can figure out some other time. Also, I think you need to fix the bug. Please let me know if you need some help there.",
+ expected: "I think I'm gonna meet you tomorrow at 3 p.m. Let me know if the time works. If not, we can figure out some other time.\n\nAlso, I think you need to fix the bug. Please let me know if you need some help there."
),
]
diff --git a/Sources/Fluid/UI/OnboardingAIEnhancementStepView.swift b/Sources/Fluid/UI/OnboardingAIEnhancementStepView.swift
index 5d97b229..4cca9ea3 100644
--- a/Sources/Fluid/UI/OnboardingAIEnhancementStepView.swift
+++ b/Sources/Fluid/UI/OnboardingAIEnhancementStepView.swift
@@ -7,6 +7,7 @@ struct OnboardingAIEnhancementStepView: View {
let glowCenter: UnitPoint
let shortcutDisplay: String
let isRunning: Bool
+ let isListening: Bool
let isRecordingShortcut: Bool
let shortcutRecordingMessage: String?
let onToggleShortcut: () -> Void
@@ -24,9 +25,35 @@ struct OnboardingAIEnhancementStepView: View {
@StateObject private var carouselAutoplay = OnboardingCarouselAutoplay()
@State private var hoveredButtonID: String?
@State private var overlayOwner = UUID()
+ @State private var introductionFinished = false
+ @State private var showPractice = false
+ @State private var introductionPlaybackID = UUID()
@State private var practice = OnboardingPolishPractice()
@ObservedObject private var contentState = NotchContentState.shared
+ private static let overlaySceneOffset: CGFloat = 24
+
+ private static let selectedOverlayImage: NSImage = {
+ guard let url = Bundle.main.url(forResource: "OnboardingSmartModeSelected", withExtension: "png"),
+ let image = NSImage(contentsOf: url) else { return NSImage() }
+ return image
+ }()
+
+ // Hide only the old title area; the menu begins below 36% of the frame.
+ private static let heldFrameMask: [Gradient.Stop] = [
+ .init(color: .clear, location: 0),
+ .init(color: .clear, location: 0.27),
+ .init(color: .white, location: 0.35),
+ .init(color: .white, location: 0.88),
+ .init(color: .clear, location: 1),
+ ]
+ private static let horizontalFrameMask: [Gradient.Stop] = [
+ .init(color: .clear, location: 0),
+ .init(color: .white, location: 0.12),
+ .init(color: .white, location: 0.88),
+ .init(color: .clear, location: 1),
+ ]
+
private enum ButtonTone { case primary, secondary, destructive }
private struct PillButtonConfiguration {
let id: String
@@ -39,7 +66,8 @@ struct OnboardingAIEnhancementStepView: View {
let isEnabled: Bool
}
- private var canNavigate: Bool { !self.isRunning && !self.isRecordingShortcut && !self.contentState.isProcessing }
+ private var canNavigate: Bool { !self.isRunning && !self.isRecordingShortcut && !self.contentState.isProcessing && !self.isShowingIntroduction }
+ private var isShowingIntroduction: Bool { self.isReady && !self.introductionFinished && !self.reduceMotion }
private var isReady: Bool { self.setup.phase == .ready }
private var sizeText: String? {
guard let count = self.setup.model?.byteCount, count > 0 else { return nil }
@@ -59,24 +87,25 @@ struct OnboardingAIEnhancementStepView: View {
VStack(spacing: 0) {
FluidOnboardingCompactProgress(value: self.progressValue)
.padding(.top, 28)
- OnboardingFittedContent(width: self.isReady ? 680 : 944, heightAnimation: self.reduceMotion ? nil : .easeInOut(duration: 0.32)) {
+ OnboardingFittedContent(width: self.isReady ? 844 : 944, heightAnimation: self.reduceMotion ? nil : .easeInOut(duration: 0.32)) {
VStack(spacing: 0) {
- self.hero
- .padding(.bottom, 24)
+ if !self.isReady {
+ self.hero.padding(.bottom, 24)
+ }
if self.isReady {
- self.tryout
+ self.introductionScene
} else {
self.offer
}
- Text(self.isReady
- ? "These same controls appear whenever you dictate."
- : "You can choose a different model or turn off Fluid Intelligence anytime in Settings.")
- .font(self.theme.typography.caption)
- .foregroundStyle(.white.opacity(0.46))
- .multilineTextAlignment(.center)
- .padding(.top, 28)
+ if !self.isReady {
+ Text("You can choose a different model or turn off Fluid Intelligence anytime in Settings.")
+ .font(self.theme.typography.caption)
+ .foregroundStyle(.white.opacity(0.46))
+ .multilineTextAlignment(.center)
+ .padding(.top, 28)
+ }
}
- .frame(maxWidth: self.isReady ? 600 : 880)
+ .frame(maxWidth: self.isReady ? 780 : 880)
.frame(maxWidth: .infinity)
.padding(.horizontal, 32)
.padding(.top, 36)
@@ -84,12 +113,16 @@ struct OnboardingAIEnhancementStepView: View {
}
HStack(alignment: .center, spacing: 20) {
self.action(id: "back", title: "Back", tone: .secondary, width: 132) {
- self.setup.cancel()
- self.onBack()
+ if self.isReady && self.showPractice {
+ self.showPractice = false
+ } else {
+ self.setup.cancel()
+ self.onBack()
+ }
}
.keyboardShortcut(.cancelAction)
Spacer()
- if self.isReady {
+ if self.isReady && self.showPractice {
Button("Skip practice", action: self.onFinishSetup)
.buttonStyle(.plain)
.foregroundStyle(.white.opacity(0.58))
@@ -103,7 +136,17 @@ struct OnboardingAIEnhancementStepView: View {
}
}
.disabled(self.practice.result == nil)
- } else {
+ } else if self.isReady && !self.isShowingIntroduction {
+ if !self.reduceMotion {
+ self.action(id: "intro-replay", title: "Replay", tone: .secondary, width: 132) {
+ self.introductionFinished = false
+ self.introductionPlaybackID = UUID()
+ }
+ }
+ self.action(id: "intro-continue", title: "Continue", tone: .primary, width: 160) {
+ self.showPractice = true
+ }
+ } else if !self.isReady {
self.offerNavigation
}
}
@@ -142,7 +185,7 @@ struct OnboardingAIEnhancementStepView: View {
.lineLimit(2)
Text(self.isReady
? "Try three short examples with Smart mode."
- : "Built for FluidVoice. Optimized for your Mac. It turns your spoken words into clear, formatted text. Entirely on your device.")
+ : "Exclusive to FluidVoice. Optimized for your Mac. It turns your spoken words into clear, formatted text. Entirely on your device.")
.font(.fluidSystem(size: 15, weight: .medium))
.foregroundStyle(.white.opacity(0.64))
.multilineTextAlignment(.center)
@@ -150,7 +193,7 @@ struct OnboardingAIEnhancementStepView: View {
.frame(maxWidth: 540)
if !self.isReady {
Text("Fluid Intelligence can…")
- .font(.fluidSystem(size: 15, weight: .medium))
+ .font(.fluidSystem(size: 20, weight: .semibold))
.foregroundStyle(.white.opacity(0.8))
.padding(.top, 4)
}
@@ -191,14 +234,16 @@ struct OnboardingAIEnhancementStepView: View {
private var offerNavigation: some View {
HStack(spacing: 20) {
- Button("I’ll set it up later") {
- self.setup.cancel()
- self.onSkip()
+ if !self.setup.isBusy {
+ Button("I’ll set it up later") {
+ self.setup.cancel()
+ self.onSkip()
+ }
+ .buttonStyle(.plain)
+ .font(.fluidSystem(size: 15, weight: .medium))
+ .foregroundStyle(.white.opacity(self.canNavigate ? 0.86 : 0.4))
+ .disabled(!self.canNavigate)
}
- .buttonStyle(.plain)
- .font(.fluidSystem(size: 15, weight: .medium))
- .foregroundStyle(.white.opacity(self.canNavigate ? 0.86 : 0.4))
- .disabled(!self.canNavigate)
if self.setup.phase == .offered {
self.action(id: "enable", title: self.enableTitle, tone: .primary, width: 210) {
@@ -291,17 +336,95 @@ struct OnboardingAIEnhancementStepView: View {
}
}
+ private var introductionScene: some View {
+ ZStack(alignment: .top) {
+ if self.reduceMotion {
+ Color.clear.aspectRatio(1560.0 / 1096.0, contentMode: .fit)
+ } else {
+ OnboardingOverlayIntroductionView { self.introductionFinished = true }
+ .id(self.introductionPlaybackID)
+ .offset(y: Self.overlaySceneOffset)
+ .allowsHitTesting(false)
+ }
+ if !self.isShowingIntroduction && !self.showPractice {
+ // The still is a 1560 × 1096 video frame. Use exactly the player's
+ // aspect-fit canvas and shared offset; never crop or independently size it.
+ Image(nsImage: Self.selectedOverlayImage)
+ .resizable()
+ .aspectRatio(1560.0 / 1096.0, contentMode: .fit)
+ .mask {
+ LinearGradient(stops: Self.heldFrameMask, startPoint: .top, endPoint: .bottom)
+ .mask {
+ LinearGradient(stops: Self.horizontalFrameMask, startPoint: .leading, endPoint: .trailing)
+ }
+ }
+ .offset(y: Self.overlaySceneOffset)
+ .accessibilityLabel("The same tilted overlay frame from the video, with Smart selected.")
+ }
+ Group {
+ if self.showPractice {
+ self.tryout
+ } else if !self.isShowingIntroduction {
+ self.introductionSummary
+ }
+ }
+ .frame(maxWidth: self.showPractice ? 680 : 600)
+ .padding(.top, 28)
+ }
+ .animation(self.reduceMotion ? nil : .easeOut(duration: 0.45), value: self.introductionFinished)
+ }
+
+ private var introductionSummary: some View {
+ VStack(alignment: .leading, spacing: 20) {
+ Text("Change modes with one click")
+ .font(.fluidSystem(size: 28, weight: .regular, design: .serif))
+ .foregroundStyle(.white.opacity(0.94))
+ HStack(alignment: .top, spacing: 24) {
+ self.modeSummary(
+ name: "Basic",
+ subtitle: "Without Fluid Intelligence",
+ detail: "Keeps your words as spoken, including mistakes.",
+ smart: false
+ )
+ .frame(maxWidth: .infinity, alignment: .leading)
+ self.modeSummary(
+ name: "Smart",
+ subtitle: "With Fluid Intelligence",
+ detail: "Removes rambling, fixes mistakes, and formats your text.",
+ smart: true
+ )
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+ }
+ .padding(28)
+ }
+
+ private func modeSummary(name: String, subtitle: String, detail: String, smart: Bool) -> some View {
+ VStack(alignment: .leading, spacing: 10) {
+ HStack(spacing: 10) {
+ Label(name, systemImage: smart ? "sparkles" : "bolt.fill")
+ .font(.fluidSystem(size: 18, weight: .semibold))
+ .foregroundStyle(smart ? Color(red: 0.48, green: 0.72, blue: 1) : .white)
+ Text(subtitle)
+ .font(.fluidSystem(size: 12, weight: .medium))
+ .foregroundStyle(.white.opacity(0.5))
+ }
+ Text(detail)
+ .font(.fluidSystem(size: 15))
+ .foregroundStyle(.white.opacity(0.78))
+ .fixedSize(horizontal: false, vertical: true)
+ }
+ }
+
private var tryout: some View {
OnboardingPolishPracticeView(
+ finalText: self.$finalText,
practice: self.practice,
- isRunning: self.isRunning,
+ isRunning: self.isListening,
isProcessing: self.contentState.isProcessing,
- isRecordingShortcut: self.isRecordingShortcut,
- shortcutDisplay: self.shortcutDisplay,
- shortcutRecordingMessage: self.shortcutRecordingMessage,
- onToggleShortcut: self.onToggleShortcut
+ isActive: !self.isShowingIntroduction,
+ shortcutDisplay: self.shortcutDisplay
)
- .onAppear { NotchOverlayManager.shared.beginOnboardingOverlay(owner: self.overlayOwner) }
.onDisappear { NotchOverlayManager.shared.endOnboardingOverlay(owner: self.overlayOwner) }
.onChange(of: self.isRunning) { _, running in
if running { self.practice.beginAttempt() }
diff --git a/Sources/Fluid/UI/OnboardingCleanupExampleCarousel.swift b/Sources/Fluid/UI/OnboardingCleanupExampleCarousel.swift
index 8f9fb87f..6a173dcd 100644
--- a/Sources/Fluid/UI/OnboardingCleanupExampleCarousel.swift
+++ b/Sources/Fluid/UI/OnboardingCleanupExampleCarousel.swift
@@ -33,12 +33,6 @@ struct OnboardingCleanupExampleCarousel: View {
spoken: "I think I'm gonna meet you tomorrow at 3 p.m. Let me know if the time works. If not, we can figure out some other time. Also, I think you need to fix the bug. Please let me know if you need some help there.",
cleaned: "I think I'm gonna meet you tomorrow at 3 p.m. Let me know if the time works. If not, we can figure out some other time.\n\nAlso, I think you need to fix the bug. Please let me know if you need some help there."
),
- Example(
- id: "email",
- title: "Format your words into an email",
- spoken: "Hey Marcus, hope you're doing well. Please let me know if you have any updates on the work that we've been doing last week. Thanks.",
- cleaned: "Hey Marcus,\n\nHope you're doing well. Please let me know if you have any updates on the work that we've been doing last week.\n\nThanks."
- ),
]
private var ids: [String] { Self.examples.map(\.id) }
diff --git a/Sources/Fluid/UI/OnboardingOverlayIntroductionView.swift b/Sources/Fluid/UI/OnboardingOverlayIntroductionView.swift
new file mode 100644
index 00000000..d8a663b1
--- /dev/null
+++ b/Sources/Fluid/UI/OnboardingOverlayIntroductionView.swift
@@ -0,0 +1,172 @@
+import AVKit
+import SwiftUI
+
+/// A silent, one-shot introduction. Practice copy and the configured shortcut stay native.
+struct OnboardingOverlayIntroductionView: View {
+ let onComplete: () -> Void
+
+ private static let edgeStops: [Gradient.Stop] = [
+ .init(color: .clear, location: 0),
+ .init(color: .white, location: 0.12),
+ .init(color: .white, location: 0.88),
+ .init(color: .clear, location: 1),
+ ]
+
+ var body: some View {
+ OnboardingIntroductionPlayer(onComplete: self.onComplete)
+ .aspectRatio(1560.0 / 1096.0, contentMode: .fit)
+ .mask {
+ LinearGradient(stops: Self.edgeStops, startPoint: .leading, endPoint: .trailing)
+ .mask {
+ LinearGradient(stops: Self.edgeStops, startPoint: .top, endPoint: .bottom)
+ }
+ }
+ .accessibilityLabel("Basic opens the mode menu. The pointer selects Smart, then the overlay returns to the bottom and disappears.")
+ }
+}
+
+private struct OnboardingIntroductionPlayer: NSViewRepresentable {
+ let onComplete: () -> Void
+
+ func makeCoordinator() -> Coordinator {
+ Coordinator(onComplete: self.onComplete)
+ }
+
+ func makeNSView(context: Context) -> IntroductionPlayerView {
+ let view = IntroductionPlayerView()
+ view.controlsStyle = .none
+ view.videoGravity = .resizeAspect
+ view.allowsPictureInPicturePlayback = false
+ context.coordinator.start(in: view)
+ return view
+ }
+
+ func updateNSView(_: IntroductionPlayerView, context: Context) {
+ context.coordinator.onComplete = self.onComplete
+ }
+
+ static func dismantleNSView(_ view: IntroductionPlayerView, coordinator: Coordinator) {
+ coordinator.stop()
+ view.player = nil
+ }
+
+ final class Coordinator {
+ var onComplete: () -> Void
+ private var player: AVPlayer?
+ private var observers: [NSObjectProtocol] = []
+ private var statusObservation: NSKeyValueObservation?
+ private var completed = false
+ private var startupTimeout: DispatchWorkItem?
+ private weak var view: IntroductionPlayerView?
+
+ init(onComplete: @escaping () -> Void) {
+ self.onComplete = onComplete
+ }
+
+ func start(in view: IntroductionPlayerView) {
+ self.view = view
+ view.onVisibilityChange = { [weak self] in self?.updatePlayback() }
+ guard let url = Bundle.main.url(forResource: "OnboardingSmartMode", withExtension: "mp4") else {
+ DispatchQueue.main.async { [weak self] in self?.finish() }
+ return
+ }
+ let item = AVPlayerItem(url: url)
+ let player = AVPlayer(playerItem: item)
+ player.isMuted = true
+ player.actionAtItemEnd = .pause
+ self.player = player
+ view.player = player
+ let center = NotificationCenter.default
+ for name in [Notification.Name.AVPlayerItemDidPlayToEndTime, .AVPlayerItemFailedToPlayToEndTime, .AVPlayerItemPlaybackStalled] {
+ self.observers.append(center.addObserver(forName: name, object: item, queue: .main) { [weak self] _ in
+ self?.finish()
+ })
+ }
+ // A bundled movie should load quickly, but decoding failure must not trap onboarding.
+ let timeout = DispatchWorkItem { [weak self] in self?.finish() }
+ self.startupTimeout = timeout
+ DispatchQueue.main.asyncAfter(deadline: .now() + 30, execute: timeout)
+ self.statusObservation = item.observe(\.status, options: [.initial, .new]) { [weak self] item, _ in
+ let status = item.status
+ DispatchQueue.main.async { [weak self] in
+ guard let self, !self.completed else { return }
+ if status == .readyToPlay {
+ self.startupTimeout?.cancel()
+ self.startupTimeout = nil
+ self.updatePlayback()
+ } else if status == .failed {
+ self.finish()
+ }
+ }
+ }
+ self.observers.append(center.addObserver(forName: NSApplication.didResignActiveNotification, object: nil, queue: .main) { [weak self] _ in
+ self?.player?.pause()
+ })
+ self.observers.append(center.addObserver(forName: NSApplication.didBecomeActiveNotification, object: nil, queue: .main) { [weak self] _ in
+ self?.updatePlayback()
+ })
+ self.updatePlayback()
+ }
+
+ private func updatePlayback() {
+ guard !self.completed else { return }
+ if NSApp.isActive, self.view?.window?.occlusionState.contains(.visible) == true {
+ self.player?.play()
+ } else {
+ self.player?.pause()
+ }
+ }
+
+ private func finish() {
+ guard !self.completed else { return }
+ self.completed = true
+ self.startupTimeout?.cancel()
+ self.startupTimeout = nil
+ // Retain the final background frame while native practice appears over it.
+ self.player?.pause()
+ self.statusObservation = nil
+ for observer in self.observers {
+ NotificationCenter.default.removeObserver(observer)
+ }
+ self.observers.removeAll()
+ self.onComplete()
+ }
+
+ func stop() {
+ self.completed = true
+ self.startupTimeout?.cancel()
+ self.startupTimeout = nil
+ self.player?.pause()
+ self.player?.replaceCurrentItem(with: nil)
+ self.player = nil
+ self.statusObservation = nil
+ for observer in self.observers {
+ NotificationCenter.default.removeObserver(observer)
+ }
+ self.observers.removeAll()
+ }
+
+ deinit { self.stop() }
+ }
+}
+
+private final class IntroductionPlayerView: AVPlayerView {
+ var onVisibilityChange: (() -> Void)?
+ private var visibilityObserver: NSObjectProtocol?
+
+ override func viewDidMoveToWindow() {
+ super.viewDidMoveToWindow()
+ if let visibilityObserver { NotificationCenter.default.removeObserver(visibilityObserver) }
+ self.visibilityObserver = nil
+ if let window {
+ self.visibilityObserver = NotificationCenter.default.addObserver(
+ forName: NSWindow.didChangeOcclusionStateNotification, object: window, queue: .main
+ ) { [weak self] _ in self?.onVisibilityChange?() }
+ }
+ self.onVisibilityChange?()
+ }
+
+ deinit {
+ if let visibilityObserver { NotificationCenter.default.removeObserver(visibilityObserver) }
+ }
+}
diff --git a/Sources/Fluid/UI/OnboardingPolishPracticeView.swift b/Sources/Fluid/UI/OnboardingPolishPracticeView.swift
index 88f937ef..053b322d 100644
--- a/Sources/Fluid/UI/OnboardingPolishPracticeView.swift
+++ b/Sources/Fluid/UI/OnboardingPolishPracticeView.swift
@@ -1,88 +1,137 @@
import SwiftUI
-/// Mirrors the iOS practice composition using the Mac onboarding palette.
+/// The shortcut stays above the example; recording reveals and focuses the editor.
struct OnboardingPolishPracticeView: View {
+ @Binding var finalText: String
let practice: OnboardingPolishPractice
let isRunning: Bool
let isProcessing: Bool
- let isRecordingShortcut: Bool
+ let isActive: Bool
let shortcutDisplay: String
- let shortcutRecordingMessage: String?
- let onToggleShortcut: () -> Void
+
+ @Environment(\.scenePhase) private var scenePhase
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+ @FocusState private var isEditorFocused: Bool
+ @State private var hasActivated = false
+ @State private var isKeyPressed = false
private var blue: Color { FluidOnboardingLandingColors.blue }
+ private var status: String {
+ if !self.hasActivated { return "Press \(self.shortcutDisplay) to begin." }
+ if self.isRunning { return "Listening" }
+ if self.isProcessing { return "Polishing…" }
+ return ""
+ }
var body: some View {
- VStack(spacing: 20) {
- HStack(spacing: 12) {
- ForEach(0..<OnboardingPolishPractice.examples.count, id: \.self) { index in
- let done = self.practice.results[index] != nil
- ZStack {
- Circle().fill(done || index == self.practice.index ? self.blue : .white.opacity(0.1))
- if done {
- Image(systemName: "checkmark").font(.fluidSystem(size: 11, weight: .bold))
- } else {
- Text("\(index + 1)").font(.fluidSystem(size: 12, weight: .bold))
- }
+ VStack(alignment: .leading, spacing: 22) {
+ Text("Let’s try a few examples.")
+ .font(.fluidSystem(size: 28, weight: .regular, design: .serif))
+ .foregroundStyle(.white.opacity(0.94))
+ HStack(spacing: 18) {
+ OnboardingShortcutKeycap(text: self.shortcutDisplay, isPressed: self.isKeyPressed, isListening: self.isRunning)
+ self.recordingStatus
+ }
+ VStack(alignment: .leading, spacing: 16) {
+ if self.hasActivated {
+ VStack(alignment: .leading, spacing: 10) {
+ Label("Say this", systemImage: "quote.opening")
+ .font(.fluidSystem(size: 13, weight: .semibold))
+ .foregroundStyle(Color(red: 0.48, green: 0.72, blue: 1))
+ Text(self.practice.example.spoken)
+ .font(.fluidSystem(size: 17))
+ .foregroundStyle(.white.opacity(0.92))
+ .lineSpacing(5)
+ .fixedSize(horizontal: false, vertical: true)
+ .padding(.leading, 14)
+ .overlay(alignment: .leading) {
+ Capsule().fill(self.blue.opacity(0.38)).frame(width: 2)
+ }
}
- .foregroundStyle(.white.opacity(done || index == self.practice.index ? 1 : 0.45))
- .frame(width: 28, height: 28)
- .accessibilityLabel("Step \(index + 1), \(done ? "complete" : (index == self.practice.index ? "current" : "upcoming"))")
+ self.editor
}
}
- self.exampleText("Try saying this", text: self.practice.example.spoken, accent: false)
- self.exampleText("It should come out as", text: self.practice.example.expected, accent: true)
- Text(self.practice.result ?? "Your polished words appear here")
- .font(.fluidSystem(size: 18, weight: .medium))
- .foregroundStyle(.white.opacity(self.practice.result == nil ? 0.35 : 0.92))
- .frame(maxWidth: .infinity, alignment: .leading)
- .padding(16)
- .textSelection(.enabled)
- .fixedSize(horizontal: false, vertical: true)
- .frame(minHeight: 105)
- .background(.white.opacity(0.04), in: RoundedRectangle(cornerRadius: 14))
- .overlay(RoundedRectangle(cornerRadius: 14).stroke(.white.opacity(0.15)))
- .accessibilityLabel("Your dictation result")
- VStack(spacing: 8) {
- HStack(spacing: 16) {
- Text(self.isRecordingShortcut ? "Press your new shortcut…" : self.shortcutDisplay)
- .font(.fluidSystem(size: 14, weight: .semibold))
- .foregroundStyle(.white)
- Button(self.isRecordingShortcut ? "Cancel" : "Change shortcut", action: self.onToggleShortcut)
- .buttonStyle(.plain)
- .font(.fluidSystem(size: 12, weight: .semibold))
- .foregroundStyle(self.blue)
- .disabled(self.isRunning || self.isProcessing)
- }
+ .frame(maxWidth: .infinity, minHeight: 250, alignment: .topLeading)
+ }
+ .padding(28)
+ .frame(maxWidth: 680, alignment: .leading)
+ .animation(self.reduceMotion ? nil : .easeOut(duration: 0.25), value: self.hasActivated)
+ .onAppear {
+ if self.practice.result != nil { self.hasActivated = true }
+ }
+ .onChange(of: self.practice.index) { _, _ in
+ self.finalText = ""
+ self.isEditorFocused = self.hasActivated && self.isActive
+ }
+ .onChange(of: self.isActive) { _, active in
+ if active && self.isRunning { self.revealExample() }
+ self.isEditorFocused = active && self.hasActivated
+ }
+ .task(id: self.isRunning) {
+ self.isKeyPressed = false
+ guard self.isActive, self.isRunning else { return }
+ self.revealExample()
+ guard !self.reduceMotion else { return }
+ withAnimation(.easeOut(duration: 0.055)) { self.isKeyPressed = true }
+ do { try await Task.sleep(for: .milliseconds(110)) } catch { return }
+ withAnimation(.spring(response: 0.18, dampingFraction: 0.72)) { self.isKeyPressed = false }
+ }
+ }
+
+ @ViewBuilder
+ private var recordingStatus: some View {
+ if self.hasActivated && (self.isRunning || self.isProcessing) {
+ HStack(spacing: 8) {
+ Image(systemName: self.isRunning ? "waveform" : "sparkles")
+ .font(.fluidSystem(size: 15, weight: .medium))
+ .foregroundStyle(self.blue)
+ .symbolEffect(.variableColor, options: .repeating, isActive: self.isRunning && self.isActive && self.scenePhase == .active && !self.reduceMotion)
+ .accessibilityHidden(true)
Text(self.status)
- .font(.fluidSystem(size: 12))
- .foregroundStyle(.white.opacity(0.58))
- if let message = self.shortcutRecordingMessage, self.isRecordingShortcut {
- Text(message).font(.fluidSystem(size: 12)).foregroundStyle(.orange)
- }
+ .font(.fluidSystem(size: 14, weight: .medium))
+ .foregroundStyle(.white.opacity(0.86))
}
- .multilineTextAlignment(.center)
+ .padding(.horizontal, 12)
+ .padding(.vertical, 8)
+ .background(self.blue.opacity(0.09), in: Capsule())
+ .accessibilityElement(children: .combine)
+ } else if !self.hasActivated {
+ Text(self.status)
+ .font(.fluidSystem(size: 14, weight: .medium))
+ .foregroundStyle(.white.opacity(0.64))
}
- .frame(maxWidth: 500)
}
- private var status: String {
- if self.isRunning { return "Press your shortcut again when you’re done." }
- if self.isProcessing { return "Polishing your words…" }
- return self.practice.result == nil ? "Choose Smart mode below, then press your shortcut to try this one." : "Press your shortcut to try it again."
+ private func revealExample() {
+ self.hasActivated = true
+ self.isEditorFocused = true
}
- private func exampleText(_ label: String, text: String, accent: Bool) -> some View {
- VStack(spacing: 8) {
- Text(label.uppercased())
- .font(.fluidSystem(size: 10, weight: .bold))
- .tracking(0.8)
- .foregroundStyle(accent ? self.blue : .white.opacity(0.4))
- Text(text)
- .font(.fluidSystem(size: accent ? 17 : 18, weight: accent ? .regular : .semibold))
- .foregroundStyle(.white.opacity(accent ? 0.6 : 0.9))
- .multilineTextAlignment(.center)
- .fixedSize(horizontal: false, vertical: true)
+ private var editor: some View {
+ ZStack(alignment: .topLeading) {
+ TextEditor(text: self.$finalText)
+ .font(.fluidSystem(size: 16))
+ .scrollContentBackground(.hidden)
+ .focused(self.$isEditorFocused)
+ .padding(12)
+ .accessibilityLabel("Dictation practice text")
+ .accessibilityHint("Your dictation appears here automatically. You can also edit it.")
+ if self.finalText.isEmpty {
+ Text("Your words appear here…")
+ .font(.fluidSystem(size: 16))
+ .foregroundStyle(.white.opacity(0.38))
+ .padding(.horizontal, 18)
+ .padding(.top, 12)
+ .allowsHitTesting(false)
+ }
+ }
+ .frame(height: 180)
+ .background(.white.opacity(self.isEditorFocused ? 0.055 : 0.025), in: RoundedRectangle(cornerRadius: 12))
+ .overlay(alignment: .bottom) {
+ Rectangle()
+ .fill(self.isEditorFocused ? self.blue.opacity(0.8) : .white.opacity(0.18))
+ .frame(height: 1)
+ .padding(.horizontal, 12)
}
}
}
diff --git a/Sources/Fluid/UI/OnboardingShortcutKeycap.swift b/Sources/Fluid/UI/OnboardingShortcutKeycap.swift
new file mode 100644
index 00000000..32818c14
--- /dev/null
+++ b/Sources/Fluid/UI/OnboardingShortcutKeycap.swift
@@ -0,0 +1,39 @@
+import SwiftUI
+
+/// The same shortcut key used throughout onboarding.
+struct OnboardingShortcutKeycap: View {
+ let text: String
+ let isPressed: Bool
+ let isListening: Bool
+
+ var body: some View {
+ let shape = RoundedRectangle(cornerRadius: 10, style: .continuous)
+
+ return Text(self.text)
+ .font(.fluidSystem(size: 20, weight: .semibold))
+ .foregroundStyle(.white)
+ .lineLimit(1)
+ .minimumScaleFactor(0.62)
+ .padding(.horizontal, 14)
+ .frame(width: 112, height: 74)
+ .background(
+ shape
+ .fill(Color.white.opacity(self.isListening ? 0.115 : 0.075))
+ .overlay(
+ shape.stroke(
+ FluidOnboardingLandingColors.blue.opacity(self.isListening ? 0.86 : 0.48),
+ lineWidth: self.isListening ? 1.6 : 1.2
+ )
+ )
+ .shadow(
+ color: FluidOnboardingLandingColors.blue.opacity(self.isListening ? 0.34 : 0.20),
+ radius: self.isListening ? 18 : 12,
+ x: 0,
+ y: self.isPressed ? 2 : 0
+ )
+ )
+ .scaleEffect(self.isPressed ? 0.965 : 1)
+ .offset(y: self.isPressed ? 4 : 0)
+ .accessibilityLabel("Current shortcut \(self.text)")
+ }
+}
diff --git a/Sources/Fluid/UI/OnboardingTryoutStepView.swift b/Sources/Fluid/UI/OnboardingTryoutStepView.swift
index b191bc50..43d3090d 100644
--- a/Sources/Fluid/UI/OnboardingTryoutStepView.swift
+++ b/Sources/Fluid/UI/OnboardingTryoutStepView.swift
@@ -334,36 +334,7 @@ struct OnboardingTryoutStepView: View {
}
private func shortcutKeycap(_ text: String) -> some View {
- let shape = RoundedRectangle(cornerRadius: 10, style: .continuous)
- let isPressed = self.isShortcutKeyPressed
- let isListening = self.isShortcutGlowActive
-
- return Text(text)
- .font(.fluidSystem(size: 20, weight: .semibold))
- .foregroundStyle(.white)
- .lineLimit(1)
- .minimumScaleFactor(0.62)
- .padding(.horizontal, 14)
- .frame(width: 112, height: 74)
- .background(
- shape
- .fill(Color.white.opacity(isListening ? 0.115 : 0.075))
- .overlay(
- shape.stroke(
- FluidOnboardingLandingColors.blue.opacity(isListening ? 0.86 : 0.48),
- lineWidth: isListening ? 1.6 : 1.2
- )
- )
- .shadow(
- color: FluidOnboardingLandingColors.blue.opacity(isListening ? 0.34 : 0.20),
- radius: isListening ? 18 : 12,
- x: 0,
- y: isPressed ? 2 : 0
- )
- )
- .scaleEffect(isPressed ? 0.965 : 1)
- .offset(y: isPressed ? 4 : 0)
- .accessibilityLabel("Current shortcut \(text)")
+ OnboardingShortcutKeycap(text: text, isPressed: self.isShortcutKeyPressed, isListening: self.isShortcutGlowActive)
}
private func examplePill(_ text: String) -> some View {
diff --git a/Sources/Fluid/UI/WelcomeView.swift b/Sources/Fluid/UI/WelcomeView.swift
index a127f37a..b2cf8a36 100644
--- a/Sources/Fluid/UI/WelcomeView.swift
+++ b/Sources/Fluid/UI/WelcomeView.swift
@@ -1572,6 +1572,7 @@ struct OnboardingFlowView: View {
glowCenter: self.landingGlowCenter,
shortcutDisplay: self.onboardingShortcutDisplay,
isRunning: self.asr.isRunning || self.asr.isStarting,
+ isListening: self.asr.isRunning,
isRecordingShortcut: self.isRecordingPrimaryShortcut,
shortcutRecordingMessage: self.shortcutRecordingMessage,
onToggleShortcut: self.togglePrimaryShortcutRecording,
diff --git a/Sources/Fluid/Views/BottomOverlayView.swift b/Sources/Fluid/Views/BottomOverlayView.swift
index cd113be8..33dbd4c9 100644
--- a/Sources/Fluid/Views/BottomOverlayView.swift
+++ b/Sources/Fluid/Views/BottomOverlayView.swift
@@ -2917,30 +2917,13 @@ struct BottomOverlayView: View {
.allowsHitTesting(false)
}
}
- .overlay(alignment: .top) {
- if self.showsOnboardingHint {
- VStack(spacing: 5) {
- Text("Switch modes here")
- .font(.fluidSystem(size: 12, weight: .semibold))
- Text("Click to switch between Basic and Smart")
- .font(.fluidSystem(size: 11))
- .foregroundStyle(.white.opacity(0.65))
- Image(systemName: "arrow.down")
- .font(.fluidSystem(size: 11, weight: .medium))
- .foregroundStyle(FluidOnboardingLandingColors.blue)
- }
- .fixedSize()
- .offset(y: -78)
- .allowsHitTesting(false)
- }
- }
.task(id: self.showsOnboardingHint) {
- guard self.showsOnboardingHint, !self.reduceMotion else { return }
- for _ in 0..<2 {
- withAnimation(.easeInOut(duration: 0.45)) { self.onboardingHighlight = true }
- do { try await Task.sleep(for: .milliseconds(500)) } catch { return }
- withAnimation(.easeInOut(duration: 0.45)) { self.onboardingHighlight = false }
- do { try await Task.sleep(for: .milliseconds(500)) } catch { return }
+ guard self.showsOnboardingHint else {
+ self.onboardingHighlight = false
+ return
+ }
+ withAnimation(self.reduceMotion ? nil : .easeOut(duration: 0.45)) {
+ self.onboardingHighlight = true
}
}
}
@@ -3521,6 +3504,25 @@ struct BottomOverlayView: View {
)
// Reserve space around the pill so its drop shadow isn't clipped by the (content-sized) window.
.padding(self.isPillSize ? 26 : 0)
+ .overlay(alignment: .top) {
+ if self.showsOnboardingHint {
+ VStack(spacing: 5) {
+ Text("Meet your overlay")
+ .font(.fluidSystem(size: 14, weight: .semibold))
+ .foregroundStyle(.white.opacity(0.94))
+ Text("Your dictation controls, in any app.")
+ .font(.fluidSystem(size: 11))
+ .foregroundStyle(.white.opacity(0.62))
+ Image(systemName: "arrow.down")
+ .font(.fluidSystem(size: 11, weight: .medium))
+ .foregroundStyle(FluidOnboardingLandingColors.blue)
+ }
+ .fixedSize()
+ .opacity(self.reduceMotion || self.onboardingHighlight ? 1 : 0)
+ .offset(y: -64 + (self.reduceMotion || self.onboardingHighlight ? 0 : -8))
+ .allowsHitTesting(false)
+ }
+ }
.padding(.top, self.showsOnboardingHint ? 82 : 0)
.onChange(of: self.showsOnboardingHint) { _, _ in
BottomOverlayWindowController.shared.refreshSizeForContent()