// The viewer's one head row, the same for a picture, a film and a document,// and the same as every paper page's: the place in the set at the left, then// the circles at the right — Share, and the X last (walker 604bcce6: the// viewers were black system sheets with the close on the left). The hand of// the record's acts is not here: on a thing-first page it stands at the// BOTTOM right (`ViewerFoot`), where a thumb holding the phone reaches it, and// Details is the first card it raises (owner's feedback on 311). An item with// no record (a chat picture never filed) shows its facts behind a circle in// the head. It is defined here and nowhere else — a kind's page draws its own// tools (a scrub bar, a page strip) below, never a second row of these.importSwiftUIextensionEnvironmentValues { @Entry var viewerHeadInk: Color? = nil}structViewerChrome: View {let item: ViewerItem?let index: Intlet count: Int/// The item's file on this device, once its page has it: what Share hands on.let file: URL?let words: ViewerWords?let onClose: () -> Voidlet onDetails: (ViewerItem) -> Void @Environment(\.theme) privatevar theme @Environment(\.viewerHeadInk) privatevar headInkvar body: someView { HStack(alignment: .center, spacing: PaperScreenKnobs.paperScreenHeadingGap) {iflet place = words?.position(index, of: count) {Text(place) .font(theme.type.display(theme.scale[.headTitleSize] * ViewerKnobs.placeScale).monospacedDigit()) .foregroundStyle(headInk ?? theme.colors.ink.color) .lineLimit(1) .accessibilityIdentifier("viewer-position") }Spacer(minLength: 0) actsNavCircle(symbol: Glyph.symbol("x") ?? "xmark", label: words?.close ?? "", action: onClose) .accessibilityIdentifier("viewer-close") } .cottonContentMargin() .padding(.top, theme.scale.navRowTop) }/// Share hands the file on (also "Open in…" and "Save to Photos"); an/// item with no record shows its facts. @ViewBuilder privatevar acts: someView {iflet file {ShareLink(item: file) { NavDisc(symbol: "square.and.arrow.up") } .buttonStyle(MotionButtonStyle()) .accessibilityLabel(words?.share ?? "") .accessibilityIdentifier("viewer-share") }iflet item, item.record == nil {NavCircle(symbol: "text.below.photo", label: words?.details ?? "") { onDetails(item) } .accessibilityIdentifier("viewer-details") } }}/// The viewer's foot: the hand of the record's acts at the bottom right. The/// record's own page is reached by it (Details, its first card) as well as by/// the swipe up. A kind's bottom strip (the player's controls, a document's/// page strip) stands above it, by `viewerFootHeight`, so nothing is covered./// The record page's hand mode stands its own (unseen) hand here too, so the/// cards rise from the button the person tapped.structViewerFoot: View {let onActs: () -> Void @Environment(\.theme) privatevar themevar body: someView { HStack(spacing: 0) {Spacer(minLength: 0)TrayStackButton(action: onActs) .accessibilityIdentifier("viewer-acts") } .cottonContentMargin() .padding(.bottom, theme.scale.navRowTop) }}/// What the viewer knows of an item with no record behind it — a picture sent/// in a chat that was never filed: its name, its size and its kind of file,/// as values, never a sentence.structViewerFacts: View {let item: ViewerItem @Environment(\.theme) privatevar themeprivatevar facts: [String] {var lines: [String] = []iflet title = item.title, !title.isEmpty { lines.append(title) }iflet width = item.width, let height = item.height, width > 0, height > 0 { lines.append("\(width) × \(height)") }iflet type = item.contentType, !type.isEmpty { lines.append(type) }return lines }var body: someView { VStack(alignment: .leading, spacing: ViewerKnobs.chromeGap) {ForEach(facts, id: \.self) { line inText(line) .font(theme.type.interface(ViewerKnobs.captionSize)) .foregroundStyle(theme.colors.ink.color) } } .frame(maxWidth: .infinity, alignment: .leading) .padding(ViewerKnobs.chromeInset) .accessibilityIdentifier("viewer-facts") }}