// THE WHOLE SCREEN (owner, 26 Oct 2026: "full screen is the thing"). What // opens over the deck as itself — a note or a memory on its reading page, a // card whole, Now Playing, the contacts import — covers the screen edge to // edge on the page's own paper, never the system's white and never a card // inside the deck's frame. One presentation for all of them, so each is the // same cover: the paper ground under it, the cards it opens standing inside it // (`cardLayers`), its receipts drawn over it rather than under it at the root, // its own top inset measured, and the page under it out of the accessibility // tree while it stands. What // stands on it brings its own one close; the cover adds none. import CottonPaper import SwiftUI extension View { /// Covers the whole screen with `content` while `isPresented` is true. /// `onDismiss` runs once it is down, however it went. func wholeScreen( isPresented: Binding, onDismiss: (() -> Void)? = nil, @ViewBuilder content: @escaping () -> Cover ) -> some View { modifier(WholeScreenCover(isPresented: isPresented, onDismiss: onDismiss, cover: content)) } } private struct WholeScreenCover: ViewModifier { @Binding var isPresented: Bool let onDismiss: (() -> Void)? let cover: () -> Cover /// The window's centre, when there is one: a cover is its own presentation /// over the root, so the root's receipt would be drawn under it. @Environment(ToastCenter.self) private var toasts: ToastCenter? func body(content: Content) -> some View { content.fullScreenCover(isPresented: $isPresented, onDismiss: onDismiss) { WholeScreenPage(toasts: toasts, content: cover) } } } private struct WholeScreenPage: View { let toasts: ToastCenter? let content: () -> Content var body: some View { receipts(content().cardLayers()) // The cover is a host of its own over the whole window: what // stands on it clears the status bar by the cover's inset, not by // the page it was opened from (a tile's page has none left). .modifier(MeasuresHostTopInset()) #if os(iOS) // The page under the cover leaves the accessibility tree while it // is up, as under the viewer (`ViewerHost`). .background { SheetModalAnchor() } #endif // The paper under it, never the system's white. .presentationBackground { PageGroundFill().ignoresSafeArea() } } @ViewBuilder private func receipts(_ page: some View) -> some View { if let toasts { page.cottonToastsOverCover(toasts) } else { page } } }