Open source CapCut alternative.
TypeScript
feat(app): grow the notch input from one line to multiline
David Le9fcdbff46803
diff --git a/apps/Donkey/Sources/Donkey/UserQueryOverlayModel.swift b/apps/Donkey/Sources/Donkey/UserQueryOverlayModel.swiftindex 9eac8439..6fbc4f50 100644--- a/apps/Donkey/Sources/Donkey/UserQueryOverlayModel.swift+++ b/apps/Donkey/Sources/Donkey/UserQueryOverlayModel.swift@@ -708,7 +708,7 @@ final class UserQueryOverlayModel: ObservableObject, UserQueryIntentSink {}var notchCommandInputSurfaceHeight: CGFloat {- max(92, notchCommandInputTextHeight + 60)+ UserQueryLayout.followUpComposerHeight(inputTextHeight: notchCommandInputTextHeight)}/// Desktop pointer spawning is temporarily disabled. Submissions no longer launch adiff --git a/apps/Donkey/Sources/DonkeyContracts/UserQueryLayout.swift b/apps/Donkey/Sources/DonkeyContracts/UserQueryLayout.swiftindex c6e166bf..53788632 100644--- a/apps/Donkey/Sources/DonkeyContracts/UserQueryLayout.swift+++ b/apps/Donkey/Sources/DonkeyContracts/UserQueryLayout.swift@@ -38,6 +38,34 @@ public enum UserQueryLayout {public static let composerExpandedToolbarHeight: CGFloat = 54public static let composerExpandedMinimumHeight: CGFloat = 156+ // The notch follow-up box starts as a single line and grows with its text. Send button sits+ // in the bottom-right corner of the same box (no separate toolbar row), mirroring the prototype.+ public static let followUpComposerCornerRadius: CGFloat = 14+ public static let followUpComposerSendButtonSize: CGFloat = 32+ public static let followUpComposerLeadingPadding: CGFloat = 20+ /// Right inset large enough to keep wrapped text clear of the corner send button.+ public static let followUpComposerTrailingPadding: CGFloat = 48+ public static let followUpComposerVerticalInset: CGFloat = 12+ /// One-line resting height: tall enough to seat the corner send button (12 + 32 + 12).+ public static let followUpComposerMinimumHeight: CGFloat = 56++ public static var followUpComposerTextWidth: CGFloat {+ composerInputSurfaceWidth - followUpComposerLeadingPadding - followUpComposerTrailingPadding+ }++ /// Clamped height of the editable text area inside the follow-up box (one line up to the scroll cap).+ public static func followUpComposerTextAreaHeight(inputTextHeight: CGFloat) -> CGFloat {+ clampedComposerInputTextHeight(inputTextHeight)+ }++ /// Outer follow-up box height: the text area plus vertical insets, never below the one-line resting height.+ public static func followUpComposerHeight(inputTextHeight: CGFloat) -> CGFloat {+ max(+ followUpComposerMinimumHeight,+ followUpComposerTextAreaHeight(inputTextHeight: inputTextHeight) + followUpComposerVerticalInset * 2+ )+ }+public static let contentSize = contentSize(inputTextHeight: composerInputTextMinimumHeight)public static let composerSize = CGSize(width: composerWidth,diff --git a/apps/Donkey/Sources/DonkeyUI/UserQueryStageView.swift b/apps/Donkey/Sources/DonkeyUI/UserQueryStageView.swiftindex ec27a001..fbaa9a83 100644--- a/apps/Donkey/Sources/DonkeyUI/UserQueryStageView.swift+++ b/apps/Donkey/Sources/DonkeyUI/UserQueryStageView.swift@@ -164,11 +164,57 @@ struct UserQueryComposer: View {@ViewBuilderprivate var promptSurface: some View {- if usesExpandedSurface {- expandedPromptSurface- } else {- promptCapsule+ switch toolbarStyle {+ case .followUp:+ followUpSurface+ case .waveformOnly:+ if usesExpandedSurface {+ expandedPromptSurface+ } else {+ promptCapsule+ }+ }+ }++ // A single rounded box that opens as one line and grows with its text up to a scroll cap, with the+ // send button pinned to the bottom-right corner — the notch follow-up input from the prototype.+ private var followUpSurface: some View {+ ZStack(alignment: .bottomTrailing) {+ textInput+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)+ .padding(.top, followUpTextTopPadding)+ .padding(.leading, UserQueryLayout.followUpComposerLeadingPadding)+ .padding(.trailing, UserQueryLayout.followUpComposerTrailingPadding)++ sendButton(size: UserQueryLayout.followUpComposerSendButtonSize)+ .padding(UserQueryLayout.followUpComposerVerticalInset)+ }+ .frame(+ width: UserQueryLayout.composerInputSurfaceWidth,+ height: composerHeight,+ alignment: .topLeading+ )+ .background {+ RoundedRectangle(+ cornerRadius: UserQueryLayout.followUpComposerCornerRadius,+ style: .continuous+ )+ .fill(surfaceFill)}+ .accessibilityElement(children: .contain)+ }++ // Center the line vertically while resting; it settles toward the top inset as the text grows,+ // matching the prototype's `items-center` box.+ private var followUpTextTopPadding: CGFloat {+ max(+ UserQueryLayout.followUpComposerVerticalInset,+ (composerHeight - followUpTextAreaHeight) / 2+ )+ }++ private var followUpTextAreaHeight: CGFloat {+ UserQueryLayout.followUpComposerTextAreaHeight(inputTextHeight: inputTextHeight)}private var promptCapsule: some View {@@ -349,7 +395,16 @@ struct UserQueryComposer: View {submit: submit).frame(maxWidth: .infinity)- .frame(height: inputTextHeight)+ .frame(height: textInputFrameHeight)+ }++ private var textInputFrameHeight: CGFloat {+ switch toolbarStyle {+ case .followUp:+ return followUpTextAreaHeight+ case .waveformOnly:+ return inputTextHeight+ }}private var expandedSurfaceHeight: CGFloat {@@ -430,6 +485,10 @@ struct UserQueryComposer: View {}var composerHeight: CGFloat {+ if toolbarStyle == .followUp {+ return UserQueryLayout.followUpComposerHeight(inputTextHeight: inputTextHeight)+ }+if usesExpandedSurface {return max(sizeProfile.expandedMinimumHeight,