// The typed-sigil completion strip — the vocabulary answering inline, while the// thought is still being typed.//// The grammar it renders is `SigilTokenizer.swift`'s; this file draws it and// nothing more.//// Spec 2026-08-29 §D4: `#` completes PROJECT names, `@` completes people. The// strip does not care which — it renders what the dock hands it, wearing the// sigil that asked.//// It sits ABOVE the pill, where the plan chips sit, for the same reason they do:// what the capture is about to become belongs beside the words that made it,// not in a sheet that covers them.//// Every suggestion is the app's ONE `Chip` — `#name` / `@name` in ink, never an// emoji. **The LEFTMOST is the top match: the one a space or an enter commits// without a tap, so reading order and keyboard order are the same order.**//// NOTHING AT ALL when there is nothing to offer. Not an empty strip, not a// reserved height: a bare `#` is not a question, and a strip that held its space// would make the composer jump every time somebody typed one.//// `keyboardShouldPersistTaps="always"` becomes `.scrollDismissesKeyboard(.never)`// — the same requirement said in each toolkit's own words. A tap on a chip must// land on the CHIP; a keyboard that closes first eats the first tap and the// writer has to aim twice.importSwiftUI/// Which chip form a sigil wears. A total switch rather than a raw-value hop:/// the two enums are declared in different files for different reasons, and a/// third sigil would be a compile error here rather than a chip with no prefix.func chipPrefix(for sigil: Sigil) -> Chip.Prefix {switch sigil {case .hash: return .projectcase .at: return .person }}publicstructSigilSuggestions: View {privatelet sigil: Sigilprivatelet matches: [SigilCandidate]privatelet onPick: (SigilCandidate) -> Void/// The accessibility-identifier stem, so the strip's identifiers are the/// dock's own rather than a second spelling of them — the dock's stem with/// `-sigil` appended, which for the one host that exists is this default.privatelet identifier: String @Environment(\.cottonHaptics) privatevar haptics/// - Parameters:/// - sigil: which grammar these completions answer — the chip wears it./// - matches: already matched and ordered by `matchCandidates`. This view/// does no filtering of its own: the order IS the meaning (leftmost is/// what space commits), so a second opinion here could disagree with the/// keyboard.publicinit( sigil: Sigil, matches: [SigilCandidate], identifier: String = "dock-sigil", onPick: @escaping (SigilCandidate) -> Void ) {self.sigil = sigilself.matches = matchesself.identifier = identifierself.onPick = onPick }publicvar body: someView {// Nothing at all when empty — see the header.if !matches.isEmpty {ScrollView(.horizontal, showsIndicators: false) { HStack(spacing: 8) {ForEach(matches, id: \.id) { candidate inChip( label: candidate.name, prefix: chipPrefix(for: sigil) ) { haptics.select() onPick(candidate) } .accessibilityIdentifier("\(identifier)-\(candidate.id)") } } .padding(.bottom, 8) } .scrollDismissesKeyboard(.never) .accessibilityIdentifier(identifier) } }}