Cotton code
42 lines · 2.7 KB · SwiftRaw
// The fixtures of the deck's faces still in CottonUI (programme cardtrial):// synthetic records as the core would resolve them, kept with those faces'// tests, and the staging the tests draw them on, at the size// a reference picture shows a card. Each face's fixtures move into its face// file when the face moves to Loom; the Loom app and `CottonFacesTests` draw// the moved faces' specimens from their catalogues. The photographs are// invented pictures cut from the design's own references (CottonFaces'// `FixturePictures`); every name and fact is invented.import CottonPaperimport CottonValuesimport SwiftUI@testable import CottonUIenum GalleryFaces {    /// Each reference card's size in points, read off its picture.    enum Size {        static let audio = CGSize(width: 340, height: 398)    }    /// A business look, for the tests of the look machinery and the kitchen    /// faces: the row Nancy's Naga Kitchen shipped, kept here as a fixture    /// since no app ships a look (Nancy left the tree, 22 Nov 2026).    static let kitchen = FlavourLook(flavour: "kitchen", row: Data(kitchenRow.utf8))!    static let kitchenLook: Theme? = kitchen.theme    static let kitchenRow = ##"{"id":"kitchen","name":"Synthetic Kitchen","family":"plain","palette":{"light":{"accent":"#B4532A","accent_contrast":"#FFFFFF","chip_ground":"#EFE3CF","ground":"#F7F0E3","ground_elevated":"#FFFBF3","ground_muted":"#EFE6D6","hairline":"#E2D5C0","ink":"#1F4A3A","ink_body":"#2B2621","ink_secondary":"#6E6458","ink_tertiary":"#A0958A","paper":"#FFFBF3","print":"#1F4A3A","selection":"#B4532A2E","tags":{"fill":"#1F4A3A","ink":"#FFFFFF"},"faces":{"cream":"#FFFBF3","buff":"#F3EADB","mount":"#FFFBF3","slip":"#EFE3CF","initials":"#B4532A","ornament":"#1F4A3A66","ruling":"#E2D5C059","margin":"#B4532A99","shadow":"#2B2621"}}},"cards":{"current_tile_fill":"accent","primary_act_fill":"accent"},"scale":{"tokens":{"radius":26,"radius_min":26,"radius_fraction":1,"card_shadow_opacity":0.16,"card_under_shade":0.04}},"texture":{"grain":false,"shadow":"soft","tilt":false}}"##    /// A fixture picture filling its frame, as a deck's picture does.    @ViewBuilder static func picture(_ name: String) -> some View {        if let image = FixturePictures.image(name) { image.resizable().interpolation(.high).scaledToFill() }    }    /// One face on the page ground at its reference size, on the paper it    /// lays, nothing behind it, as the deck draws it.    @MainActor @ViewBuilder static func stage<Face: View>(_ size: CGSize, _ card: DeckCard, @ViewBuilder _ face: () -> Face) -> some View {        face()        .frame(width: size.width, height: size.height)        .padding(.top, 84)        .padding(.bottom, 18)        .frame(maxWidth: .infinity)    }}