Skip to content

Open source CapCut alternative.

TypeScript

Fix UI issues

David Le7dbadc3a7833
diff --git a/apps/Donkey/README.md b/apps/Donkey/README.md
index f908697f..a9699065 100644
--- a/apps/Donkey/README.md
+++ b/apps/Donkey/README.md
@@ -2,7 +2,7 @@
SwiftUI macOS app for the production pointer prompt UI.
-This slice renders a floating native-cursor-sized agent arrowhead and compact prompt modal with a live voice waveform. Donkey starts in an inactive pointer-only state that follows the main pointer. Double-tap Command and release to show and focus the prompt modal at the current pointer location, where the pointer and modal stay pinned while live microphone levels drive the waveform. The prompt starts as a wide pill, expands into a rounded rectangle for multiline text, and moves the waveform into a bottom toolbar that matches the input background. Clicking outside the modal dismisses it, and a small gray circular x button at the top-right outside corner closes it directly. The overlay follows the mouse on a 45-degree bottom-right diagonal by default.
+This slice renders a compact prompt modal with a live voice waveform. Double-tap Command and release to show and focus the prompt modal near the current pointer location, where the modal stays pinned while live microphone levels drive the waveform. The prompt starts as a wide pill, expands into a rounded rectangle for multiline text, and moves the waveform into a bottom toolbar that blends with the input background without a divider or inactive controls. Clicking outside the modal dismisses it, and a small gray circular x button at the top-right outside corner closes it directly. The overlay opens near the mouse on a 45-degree bottom-right diagonal by default.
It requests microphone permission for local waveform visualization. It does not request Accessibility, Screen Recording, model access, screen capture-loop, or input-control permissions.
@@ -16,4 +16,4 @@ swift build
swift run Donkey
```
-Customize the pointer colors in [Sources/Donkey/Resources/theme.json](Sources/Donkey/Resources/theme.json). The app supports `#RRGGBB` and `rgba(r, g, b, a)` color strings.
+Pointer theme resources are retained for future pointer rendering work in [Sources/Donkey/Resources/theme.json](Sources/Donkey/Resources/theme.json).
diff --git a/apps/Donkey/Sources/DonkeyUI/PointerPromptStageView.swift b/apps/Donkey/Sources/DonkeyUI/PointerPromptStageView.swift
index d2c7c0db..162c8a43 100644
--- a/apps/Donkey/Sources/DonkeyUI/PointerPromptStageView.swift
+++ b/apps/Donkey/Sources/DonkeyUI/PointerPromptStageView.swift
@@ -3,6 +3,8 @@ import DonkeyContracts
import SwiftUI
public struct PointerPromptStageView: View {
+ private static let rendersAgentPointer = false
+
private let state: PointerPromptState
@Binding private var messageText: String
private let inputTextHeight: CGFloat
@@ -36,16 +38,34 @@ public struct PointerPromptStageView: View {
if placement.placesContentOnLeft {
HStack(alignment: .top, spacing: PointerPromptLayout.pointerComposerSpacing) {
activeComposer
- pointer
+ pointerSlot
}
} else {
HStack(alignment: .top, spacing: PointerPromptLayout.pointerComposerSpacing) {
- pointer
+ pointerSlot
activeComposer
}
}
}
+ @ViewBuilder
+ private var pointerSlot: some View {
+ if Self.rendersAgentPointer {
+ pointer
+ } else {
+ hiddenPointerSlot
+ }
+ }
+
+ private var hiddenPointerSlot: some View {
+ Color.clear
+ .frame(
+ width: PointerPromptLayout.pointerSlotSize.width,
+ height: PointerPromptLayout.pointerSlotSize.height
+ )
+ .accessibilityHidden(true)
+ }
+
private var pointer: some View {
AgentPointerView(
placement: placement,
@@ -88,6 +108,8 @@ public struct PointerPromptStageView: View {
}
private struct PointerPromptComposer: View {
+ private static let rendersToolbarControls = false
+
let state: PointerPromptState
@Binding var messageText: String
let inputTextHeight: CGFloat
@@ -196,6 +218,24 @@ private struct PointerPromptComposer: View {
private var promptToolbar: some View {
HStack {
+ if Self.rendersToolbarControls {
+ toolbarControls
+ }
+
+ Spacer(minLength: 0)
+
+ VoiceWaveformView(levels: state.voiceWaveformLevels)
+ .frame(width: 54, height: 28)
+ }
+ .padding(.horizontal, PointerPromptLayout.composerExpandedTextHorizontalPadding)
+ .frame(
+ width: PointerPromptLayout.composerInputSurfaceWidth,
+ height: PointerPromptLayout.composerExpandedToolbarHeight
+ )
+ }
+
+ private var toolbarControls: some View {
+ HStack(spacing: 12) {
toolbarIcon(systemName: "plus")
HStack(spacing: 8) {
@@ -209,21 +249,6 @@ private struct PointerPromptComposer: View {
.font(.system(size: 11, weight: .semibold))
}
.foregroundStyle(Color.white.opacity(0.6))
-
- Spacer(minLength: 0)
-
- VoiceWaveformView(levels: state.voiceWaveformLevels)
- .frame(width: 54, height: 28)
- }
- .padding(.horizontal, PointerPromptLayout.composerExpandedTextHorizontalPadding)
- .frame(
- width: PointerPromptLayout.composerInputSurfaceWidth,
- height: PointerPromptLayout.composerExpandedToolbarHeight
- )
- .overlay(alignment: .top) {
- Rectangle()
- .fill(Color.white.opacity(0.08))
- .frame(height: 1)
}
}
@@ -349,9 +374,8 @@ private struct ComposerMultilineTextInput: NSViewRepresentable {
}
}
textView.string = text
- textView.font = .systemFont(ofSize: 16)
- textView.textColor = .white
textView.insertionPointColor = .white
+ ComposerTextStyle.apply(to: textView)
textView.backgroundColor = .clear
textView.drawsBackground = false
textView.isRichText = false
@@ -394,9 +418,11 @@ private struct ComposerMultilineTextInput: NSViewRepresentable {
submit()
}
}
+ ComposerTextStyle.apply(to: textView)
if textView.string != text {
textView.string = text
+ ComposerTextStyle.apply(to: textView)
textView.needsDisplay = true
}
@@ -507,12 +533,43 @@ private final class ComposerTextView: NSTextView {
let attributes: [NSAttributedString.Key: Any] = [
.foregroundColor: NSColor.white.withAlphaComponent(0.58),
- .font: font ?? NSFont.systemFont(ofSize: 16)
+ .font: font ?? ComposerTextStyle.font,
+ .ligature: 0
]
(placeholder as NSString).draw(at: .zero, withAttributes: attributes)
}
}
+@MainActor
+private enum ComposerTextStyle {
+ static var font: NSFont {
+ NSFont.systemFont(ofSize: 16, weight: .light)
+ }
+
+ static func apply(to textView: NSTextView) {
+ let textAttributes = attributes(color: .white, font: font)
+ textView.font = font
+ textView.textColor = .white
+ textView.typingAttributes = textAttributes
+
+ let textRange = NSRange(location: 0, length: textView.string.utf16.count)
+ guard textRange.length > 0 else { return }
+
+ textView.textStorage?.setAttributes(textAttributes, range: textRange)
+ }
+
+ static func attributes(
+ color: NSColor,
+ font: NSFont
+ ) -> [NSAttributedString.Key: Any] {
+ [
+ .foregroundColor: color,
+ .font: font,
+ .ligature: 0
+ ]
+ }
+}
+
private struct AgentPointerView: View {
let placement: PointerPromptPlacement
let theme: PointerPromptTheme
diff --git a/docs/README.md b/docs/README.md
index b0159be1..3324c6d9 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -6,7 +6,7 @@ Plans describe what we might build. Guides describe what Donkey currently suppor
## Product Guides
-- [Pointer Prompt Overlay](guides/pointer-prompt-overlay.md): double-Command agent pointer and standard macOS-style `Make this so` composer that follows the mouse at a fixed offset.
+- [Pointer Prompt Overlay](guides/pointer-prompt-overlay.md): double-Command standard macOS-style `Make this so` composer that opens near the mouse at a fixed offset.
## Engineering Guides
diff --git a/docs/guides/pointer-prompt-overlay.md b/docs/guides/pointer-prompt-overlay.md
index 3b5f91d2..ff92522f 100644
--- a/docs/guides/pointer-prompt-overlay.md
+++ b/docs/guides/pointer-prompt-overlay.md
@@ -4,22 +4,19 @@
Donkey supports a floating macOS pointer prompt overlay:
-- shows a small inactive agent pointer that follows the user pointer immediately when Donkey starts
- double-tap Command and release to activate and focus a compact prompt modal at the current pointer location without clicking into the target app
- double-tap Command and hold the second Command press to activate voice input
-- shows a native-cursor-sized agent arrowhead and a black prompt modal with text input and a white voice waveform while active
+- shows a black prompt modal with text input and a white voice waveform while active
- uses a wide pill-shaped prompt for single-line text, then expands to a rounded rectangle when text wraps at the max input width or the user inserts new lines
-- places the waveform and toolbar affordances in a bottom toolbar that uses the same background color as the input when the prompt is expanded
+- places the waveform in a bottom toolbar that blends with the input background when the prompt is expanded
- captures microphone audio while active and renders the waveform from recent live audio levels
-- keeps the pointer and prompt modal pinned where activation happened until the user drags, dismisses, or closes the modal
+- keeps the prompt modal pinned where activation happened until the user drags, dismisses, or closes the modal
- dismisses the active modal when the user clicks outside it
- closes the active modal with a small gray circular x button outside the prompt surface at the top-right corner
- supports dragging the active modal from capsule areas outside the text input
-- lets normal clicks pass through the inactive pointer-only overlay and transparent active overlay space
-- follows the user mouse at a fixed 45-degree bottom-right diagonal
+- lets normal clicks pass through the inactive overlay and transparent active overlay space
+- opens near the user mouse at a fixed 45-degree bottom-right diagonal
- keeps that fixed offset at screen edges instead of flipping or clamping to the visible screen bounds
-- renders a shadow underneath the agent pointer when active
-- supports user-accessible theme customization through `apps/Donkey/Sources/Donkey/Resources/theme.json`
- keeps runtime and AI harness behavior behind explicit integration boundaries
This is a visual and microphone-level UI capability. It does not capture the screen, send input, call models, or require Accessibility permission. It does request microphone permission so the waveform can reflect live local audio levels.
@@ -31,15 +28,15 @@ This is a visual and microphone-level UI capability. It does not capture the scr
- SwiftUI rendering stays in `DonkeyUI`; it receives `PointerPromptState` and `PointerPromptPlacement` from `DonkeyContracts`.
- Product state stays in `PointerPromptOverlayModel`.
- Treat the active modal as a compact black prompt surface with a text input, embedded waveform, and a small gray circular x button perched outside the surface at the top-right corner. It has no separate voice button.
-- Single-line input should render as a full pill. Multiline input should render as a rounded rectangle with non-pill corners and a bottom toolbar matching the input background, containing the waveform and lightweight control affordances.
+- Single-line input should render as a full pill. Multiline input should render as a rounded rectangle with non-pill corners and a bottom toolbar matching the input background, containing the waveform without a divider between text and toolbar. The plus and permissions controls may remain available in code for future wiring, but should not render while non-functional.
+- The text input should use 16pt light system UI text with ligatures disabled, matching thin `-apple-system` sans-serif web input rendering.
- Text wraps at the prompt width. Return submits typed text. Shift-Return inserts a deliberate newline.
- The controller owns microphone capture and publishes normalized audio levels into product state; SwiftUI only renders the levels it receives.
-- Pointer colors load from JSON into `PointerPromptTheme`; views must not hard-code product colors.
- The active prompt modal should use a capsule shape and keep transparent active overlay space passing clicks through to windows underneath after it dismisses.
-- The active modal top edge should align with the highest visible point of the agent pointer.
-- The agent pointer should remain close to native cursor size, use the mirrored SVG cursor silhouette from the Noun Project pointer asset, point in the same up-left direction as the native macOS cursor, and keep its tip 48px from the real pointer on an equal x/y diagonal.
+- Agent pointer drawing and theme code may remain available for future features, but the prompt overlay should not render a visible cursor.
+- The prompt should keep its retained fixed offset geometry from the real pointer on an equal x/y diagonal.
- Runtime placement is fixed to `bottomRight`; alternate `PointerPromptPlacement` values are only rendering variants.
-- The controller must not clamp visible pointer/modal bounds to `NSScreen.visibleFrame`; cursor positioning is a direct fixed-offset calculation.
+- The controller must not clamp visible modal bounds to `NSScreen.visibleFrame`; cursor-relative positioning is a direct fixed-offset calculation.
- Launch positioning and double-Command activation handling belong in `PointerPromptOverlayController`, not the SwiftUI view.
- Double-Command is the only active shortcut today. Its default lives in `PointerPromptActivationShortcut.doubleCommand` so a future settings layer can supply a different shortcut without rewriting controller event handling.
- Double-Command prompt activation should require two clean Command down/up taps within 450ms. Any intervening key press, mouse press, extra modifier, or overlong Command hold should reset the sequence so normal shortcuts do not summon the modal.
@@ -55,9 +52,7 @@ swift build
swift run Donkey
```
-Launch Donkey and confirm only the small agent pointer appears and follows the main pointer at a fixed bottom-right diagonal offset. Double-tap Command and release to show the black prompt capsule with keyboard focus, grant microphone permission if prompted, then speak or tap near the microphone and confirm the waveform responds to real audio levels. Type enough text to wrap and confirm the prompt changes from a pill into a rounded rectangle, grows downward while its top edge stays fixed, and moves the waveform into a blended bottom toolbar. Press Shift-Return and confirm it inserts a newline; press Return and confirm it submits. Move the mouse and confirm the active pointer and modal stay pinned. Double-tap Command again but hold the second Command press, and confirm the same prompt modal appears. Click outside the active modal and confirm it dismisses. Reactivate, click the gray rounded x button outside the capsule, and confirm it closes. Drag the modal from non-input capsule areas. Activate near the bottom-right screen edge to confirm the prompt keeps the same fixed offset instead of flipping or clamping. Confirm Command plus another key, Command-click, and a single Command tap do not activate the modal.
-
-To verify color customization, edit `apps/Donkey/Sources/Donkey/Resources/theme.json`, rebuild, and run Donkey.
+Launch Donkey and confirm the inactive overlay does not render a visible cursor. Double-tap Command and release to show the black prompt capsule with keyboard focus, grant microphone permission if prompted, then speak or tap near the microphone and confirm the waveform responds to real audio levels. Type enough text to wrap and confirm the prompt changes from a pill into a rounded rectangle, grows downward while its top edge stays fixed, and moves the waveform into a blended bottom toolbar with no divider between the toolbar and text input. Press Shift-Return and confirm it inserts a newline; press Return and confirm it submits. Move the mouse and confirm the active modal stays pinned. Double-tap Command again but hold the second Command press, and confirm the same prompt modal appears. Click outside the active modal and confirm it dismisses. Reactivate, click the gray rounded x button outside the capsule, and confirm it closes. Drag the modal from non-input capsule areas. Activate near the bottom-right screen edge to confirm the prompt keeps the same fixed offset instead of flipping or clamping. Confirm Command plus another key, Command-click, and a single Command tap do not activate the modal.
## Source Entry Points