Cotton code
72 lines · 2.8 KB · SwiftRaw
// Cotton Story's PLACE CARD (`place.card`, contract 17 Nov 2026): where scenes// happen. The place's name, what it is like, and how many scenes are set// there.//// Slots: `title` (the name), `body` (about it), `note` (the scenes set there,// in the core's words: "3 scenes"). Every word is the core's.import CottonPaperimport CottonValuesimport SwiftUIstruct StoryPlaceCardFace: View {    let card: DeckCard    init(card: DeckCard) {        self.card = card    }    var body: some View {        VStack(alignment: .leading, spacing: StoryCardKnobs.gap) {            if let name = card.text("title") {                Text(verbatim: name)                    .font(StoryType.script(26, relativeTo: .title).bold())                    .foregroundStyle(StoryMaterial.ink.colour)                    .fixedSize(horizontal: false, vertical: true)                    .accessibilityIdentifier("deck-title")                    .facePart(.title)            }            Rectangle().fill(StoryMaterial.hairline.colour).frame(height: 1)            if let about = card.text("body") {                Text(verbatim: about)                    .font(StoryType.sans(.body))                    .foregroundStyle(StoryMaterial.ink.colour)                    .fixedSize(horizontal: false, vertical: true)                    .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)                    .clipped()                    .storyFadesOut()                    .accessibilityIdentifier("place-about")                    .facePart(.body)            }            Spacer(minLength: 0)            if let scenes = card.text("note") {                StoryQuietLine(text: scenes)                    .accessibilityIdentifier("place-scenes")            }        }        .padding(StoryCardKnobs.inset)        .storySheet()        .accessibilityElement(children: .contain)        .accessibilityIdentifier("place-card")    }}/// The place card, and the cards it is reviewed in.public enum StoryPlaceCardFaceCatalogue {    public static let stock: FaceStock = .own    public static let ground: FaceGround = .blank    public static let face = Face(id: "place.card", specimens: [Specimen("described", described), Specimen("named", named)]) { card, _, _ in        StoryPlaceCardFace(card: card)    }    public static let described = DeckCard(face: "place.card", corner: nil, pressing: false, pace: nil, plate: nil, fields: [        "title": .text("LIGHTHOUSE KITCHEN"),        "body": .text("Low ceiling, one swinging lamp, a table scarred by thirty years of knives. The window looks at nothing but sea."),        "note": .text("4 scenes"),    ])    public static let named = DeckCard(face: "place.card", corner: nil, pressing: false, pace: nil, plate: nil, fields: [        "title": .text("HARBOUR WALL"),        "note": .text("1 scene"),    ])}