// The plain parts Nancy's Naga Kitchen's faces are drawn from, in her own // look (Codex round 2, 23 Oct 2026; the coordinator's review of the brand // faces): the sizes, the package's columns a delivery's state is read from, // a card's places under their columns' labels, a delivery's state, a // portrait or the name's letters, the heavy heading, the small label, the // woven strip and the band it runs down, the initials' mount, a chip, a // fact by its symbol, a stamped state, a figure under its label, and a fact // as the core said it (`PlainFact`, the plain face's too). The LOOK is the // theme's roles, which in her app are her look; every word is the core's. // Which table wears these faces, and its labels read off the table, are the // app's (CottonUI's `DeckCardFill`). import CottonPaper import CottonValues import SwiftUI public enum KitchenKnobs { /// A flat card's face runs to its edge (`CardMaterial`): the bands are /// full bleed, and the words keep `side` from the edge. public static let inset = EdgeInsets() public static let side: CGFloat = 22 public static let foot: CGFloat = 18 /// The dish face's own inset, its page dots clear of the card's foot. public static let dishInset = EdgeInsets(top: 0, leading: 0, bottom: 12, trailing: 0) public static let radius: CGFloat = 16 public static let strip: CGFloat = 16 public static let stripStep: CGFloat = 14 public static let stripLine: CGFloat = 1.4 public static let stripInk = 0.55 public static let heading: CGFloat = 32 public static let headingSmall: CGFloat = 24 public static let figure: CGFloat = 44 public static let body: CGFloat = 14 public static let label: CGFloat = 10.5 public static let labelTracking: CGFloat = 2 public static let fact: CGFloat = 14 public static let symbol: CGFloat = 17 public static let chip: CGFloat = 13 public static let chipPad = EdgeInsets(top: 6, leading: 11, bottom: 6, trailing: 12) public static let gap: CGFloat = 12 public static let shadow = 0.22 public static let shadowRadius: CGFloat = 8 public static let shadowDrop: CGFloat = 4 public static let stamp: CGFloat = 22 public static let faint = 0.85 } /// A picture or, with none, the name's letters: never a stock face. public enum KitchenPortrait: Equatable { case photo(String) case monogram(String) public static func of(_ card: DeckCard) -> KitchenPortrait? { if let key = card.text("photo") { return .photo(key) } return card.text("title").flatMap(CardPerson.initials).map(KitchenPortrait.monogram) } } /// The heavy narrow heading the kitchen sets its names in. public struct KitchenHeading: View { let words: String var size: CGFloat = KitchenKnobs.heading var ink: Color? @Environment(\.theme) private var theme public init(words: String, size: CGFloat = KitchenKnobs.heading, ink: Color? = nil) { self.words = words self.size = size self.ink = ink } public var body: some View { Text(words) .font(theme.type.title.font(size, weight: .heavy).width(.condensed)) .foregroundStyle(ink ?? theme.colors.ink.color) .accessibilityAddTraits(.isHeader) } } /// A small spaced capital line over a heading or a fact. struct KitchenLabel: View { let words: String var ink: Color? @Environment(\.theme) private var theme var body: some View { Text(words) .font(theme.type.body.font(KitchenKnobs.label, weight: .semibold)) .textCase(.uppercase) .tracking(KitchenKnobs.labelTracking) .lineLimit(2) .foregroundStyle(ink ?? theme.colors.inkSecondary.color) } } /// A woven strip down (or across) a band: diamonds between two rules. struct TribalStrip: Shape { var across = false public func path(in rect: CGRect) -> Path { let long = across ? rect.width : rect.height let short = across ? rect.height : rect.width let step = KitchenKnobs.stripStep var path = Path() func point(_ along: CGFloat, _ side: CGFloat) -> CGPoint { across ? CGPoint(x: rect.minX + along, y: rect.minY + side) : CGPoint(x: rect.minX + side, y: rect.minY + along) } path.move(to: point(0, 1)); path.addLine(to: point(long, 1)) path.move(to: point(0, short - 1)); path.addLine(to: point(long, short - 1)) var at: CGFloat = 0 while at < long { let mid = at + step / 2 path.move(to: point(at, short / 2)); path.addLine(to: point(mid, 3)) path.addLine(to: point(at + step, short / 2)); path.addLine(to: point(mid, short - 3)) path.closeSubpath() path.addEllipse(in: CGRect(origin: point(mid - 1.2, short / 2 - 1.2), size: CGSize(width: 2.4, height: 2.4))) at += step } return path } } /// The terracotta band the kitchen's cards wear, full bleed (the card's corner /// cuts it), a woven strip down each side. public struct KitchenBand: View { var fill: Color? var weave: Color? @Environment(\.theme) private var theme public init(fill: Color? = nil, weave: Color? = nil) { self.fill = fill self.weave = weave } public var body: some View { let weave = weave ?? theme.colors.inkBody.color Rectangle() .fill(fill ?? theme.colors.accent.color) .overlay(alignment: .leading) { strip(weave) } .overlay(alignment: .trailing) { strip(weave) } .clipShape(Rectangle()) } private func strip(_ ink: Color) -> some View { TribalStrip() .stroke(ink.opacity(KitchenKnobs.stripInk), lineWidth: KitchenKnobs.stripLine) .frame(width: KitchenKnobs.strip) .padding(.vertical, 4) .padding(.horizontal, 5) } } /// A name's letters on a round terracotta mount: a person or a dish with /// no picture. public struct KitchenInitials: View { let letters: String @Environment(\.theme) private var theme public init(letters: String) { self.letters = letters } public var body: some View { GeometryReader { room in let edge = min(room.size.width, room.size.height) ZStack { Circle().fill(theme.colors.accent.color) Circle().inset(by: edge * 0.06).stroke(theme.colors.paper.color.opacity(0.6), lineWidth: 1.5) KitchenHeading(words: letters, size: edge * 0.4, ink: theme.colors.paper.color) } .frame(width: edge, height: edge) .frame(maxWidth: .infinity, maxHeight: .infinity) } .accessibilityIdentifier("kitchen-initials") } } /// One of a card's parts as a soft chip, marked or with a symbol. public struct KitchenChip: View { let words: String var mark: PaperInk? var symbol: String? @Environment(\.theme) private var theme public init(words: String, mark: PaperInk? = nil, symbol: String? = nil) { self.words = words self.mark = mark self.symbol = symbol } public var body: some View { HStack(spacing: 6) { if let mark { Circle().frame(width: 8, height: 8).foregroundStyle(theme.print(mark)) } if let symbol { Image(systemName: symbol).foregroundStyle(theme.colors.accent.color) } Text(words).lineLimit(1).foregroundStyle(theme.colors.inkBody.color) } .font(theme.type.body.font(KitchenKnobs.chip, weight: .medium)) .padding(KitchenKnobs.chipPad) .background(Capsule().fill(theme.colors.chipGround.color)) } } /// A fact by its symbol: its label small over its words. struct KitchenFact: View { let label: String? let said: String var symbol: String? /// The words' ink; the body's unless named (cream on a dark band). var ink: Color? var lines = 2 @Environment(\.theme) private var theme var body: some View { HStack(alignment: .center, spacing: 10) { if let symbol { Image(systemName: symbol) .font(.system(size: KitchenKnobs.symbol, weight: .semibold)) .foregroundStyle(ink ?? theme.colors.accent.color) .frame(width: 24) } VStack(alignment: .leading, spacing: 2) { if let label { KitchenLabel(words: label, ink: ink?.opacity(KitchenKnobs.faint)) } Text(said) .font(theme.type.body.font(KitchenKnobs.fact, weight: .semibold)) .foregroundStyle(ink ?? theme.colors.inkBody.color) .lineLimit(lines) .minimumScaleFactor(0.8) } } .frame(maxWidth: .infinity, alignment: .leading) } } /// A state the columns hold, stamped: its label in a ruled box, struck at /// an angle in her ink. struct KitchenStamp: View { let words: String var turn: Double = -6 var ink: Color? @Environment(\.theme) private var theme var body: some View { KitchenHeading(words: words, size: KitchenKnobs.stamp, ink: ink ?? theme.colors.ink.color) .textCase(.uppercase) .lineLimit(1) .padding(.horizontal, 12) .padding(.vertical, 4) .overlay(RoundedRectangle(cornerRadius: 4).inset(by: 1).stroke(ink ?? theme.colors.ink.color, lineWidth: 2.5)) .overlay(RoundedRectangle(cornerRadius: 6).inset(by: -3).stroke(ink ?? theme.colors.ink.color, lineWidth: 1)) .mask(StampWear(seed: words)) .rotationEffect(.degrees(turn)) .accessibilityIdentifier("face-state") } } extension DeckCard { /// The facts the core said, each under its label, but the ones `except` /// names (by label) or whose words another place already says. func kitchenFacts(except labels: Set = [], saying shown: Set = []) -> [PlainFact] { entries("facts").compactMap { entry in guard let said = entry["said"]?.text, !said.isEmpty, !shown.contains(said) else { return nil } let label = entry["label"]?.text if let label, labels.contains(label) { return nil } return PlainFact(label: label, said: said) } } } /// A figure large under its small label. public struct KitchenFigure: View { let label: String? let words: String var size: CGFloat = KitchenKnobs.figure var ink: Color? var trailing = false var labelInk: Color? public init(label: String?, words: String, size: CGFloat = KitchenKnobs.figure, ink: Color? = nil, trailing: Bool = false, labelInk: Color? = nil) { self.label = label self.words = words self.size = size self.ink = ink self.trailing = trailing self.labelInk = labelInk } public var body: some View { VStack(alignment: trailing ? .trailing : .leading, spacing: 0) { if let label { KitchenLabel(words: label, ink: labelInk) } KitchenHeading(words: words, size: size, ink: ink).lineLimit(1).minimumScaleFactor(0.5) } } } /// One fact as the core said it: its label, then its words. public struct PlainFact: Equatable { public let label: String? public let said: String public init(label: String?, said: String) { self.label = label self.said = said } }