// The project scope, as the list column's paper shows it.//// Mac redesign spec §4. While the sidebar narrows the content to one or more// projects, the list column's screen says so: a row of the chosen projects'// caps under its title (`PaperScreen`), and an empty list that says what it is// empty OF (`ObjectEmpty`). Both read it from the environment — the host sets// it on the list column, the phone never does, and neither component knows or// asks which platform it is on (`ScreenPlatformSweepTests`).importSwiftUI/// One chosen project, as a chip draws it.publicstructScopeChip: Equatable, Identifiable, Sendable {publiclet slug: Stringpubliclet name: Stringpubliclet colour: CapColourpublicvar id: String { slug }publicinit(slug: String, name: String, colour: CapColour) {self.slug = slugself.name = nameself.colour = colour }}publicenumScopeWording {/// An empty list under a scope: what it is empty of. One project by name,/// two by both names, more as "these projects" — a sentence that lists/// five names is a sentence nobody reads to the end.publicstaticfunc nothingIn(_ names: [String]) -> String? {switch names.count {case0: returnnilcase1: returnShellLines.line("empty", "scope.one", ["name": names[0]])case2: returnShellLines.line("empty", "scope.two", ["first": names[0], "second": names[1]])default: returnShellLines.line("empty", "scope.many") } }}privatestructCottonProjectScopeKey: EnvironmentKey {/// Empty, and empty is every project — the phone, always.staticlet defaultValue: [ScopeChip] = []}extensionEnvironmentValues {/// The projects the content is narrowed to, in the sidebar's order; empty/// is every project.////// **Paper reads this; no screen does.** The list column's host sets it,/// and `PaperScreen` and `ObjectEmpty` draw it, so a screen shows its/// scope without a line of its own.publicvar cottonProjectScope: [ScopeChip] { get { self[CottonProjectScopeKey.self] } set { self[CottonProjectScopeKey.self] = newValue } }}/// The row of chosen caps, each with its name.structScopeChipRow: View {let chips: [ScopeChip] @Environment(\.theme) privatevar themevar body: someView { HStack(spacing: 12) {ForEach(chips) { chip in HStack(spacing: 5) {CapChip(name: chip.name, colour: chip.colour, side: 18)Text(chip.name) .font(CottonFonts.type(theme.scale.metaSize)) .foregroundStyle(CottonColors.inkSecondary) .lineLimit(1) } } } .accessibilityElement(children: .combine) .accessibilityIdentifier("paper-project-scope") }}