// The rubber stamp, out of the todo card and into the kit.//// DONE is a stamp and the text under it stays readable — the owner's rule, and// the reason there is no strike-through anywhere in the app. A stamp is one of// the two things in the kit that is still a photograph (the caps are the other),// because rubber on paper is ink that missed: the gaps ARE the object, and a// drawn one is a badge.//// It is positioned by the CALLER. A stamp lands where the hand put it, but// never on a heading.//// `stamp-keep` (a green KEEP, for the decide queue) is named in the paper-kit// spec and is NOT in the tree: generating it needs the image pipeline's API key,// which this machine has not got. There is no `.keep` case rather than a case// that draws nothing — a silent hole is worse than a missing verb.importCottonPaperimportSwiftUI/// The stamps there are. The raw value is the imageset's name.publicenumStampKind: String, CaseIterable, Sendable {case done = "stamp-done"case dropped = "stamp-dropped"/// The stamp a record's status earns, or none.publicstaticfunc of(status: String) -> StampKind? {switch status {case"done": return .donecase"dropped": return .droppeddefault: returnnil } }/// What the stamp says, for a reader that cannot see it.publicvar spoken: String {switchself {case .done: return"Done"case .dropped: return"Dropped" } }}publicstructStamp: View {privatelet kind: StampKindprivatelet width: CGFloatprivatelet scale: CGFloatpublicinit(_ kind: StampKind, width: CGFloat, scale: CGFloat = 1) {self.kind = kindself.width = widthself.scale = scale } @Environment(\.theme) privatevar themepublicvar body: someView {switch theme.family {case .paper: rubbercase .plain: label } }/// A flat family's stamp: the word in a ruled box, in the state's colour,/// laid in the box the rubber one takes — the picture's own proportion,/// held by the picture itself unseen — so it lands in the same place and/// the text under it reads on every platform the picture is drawn at. @ViewBuilder privatevar label: someView {let ink = kind == .done ? theme.colors.success.color : theme.colors.inkSecondary.colorlet word = Text(kind.spoken.uppercased()) .font(theme.type.interface(width * StampKnobs.stampLabelSize, weight: .semibold)) .tracking(width * StampKnobs.stampLabelTracking) .lineLimit(1) .foregroundStyle(ink) .padding(.horizontal, width * StampKnobs.stampLabelHorizontalPadding) .padding(.vertical, width * StampKnobs.stampLabelVerticalPadding) .overlay(RoundedRectangle(cornerRadius: theme.scale.radius * 0.5) .strokeBorder(ink, lineWidth: theme.scale.stroke * StampKnobs.stampLabelStrokeScale) )Group {iflet picture = CottonMedia.image(kind.rawValue) { picture.resizable().scaledToFit().hidden().accessibilityHidden(true).overlay { word } } else { word } } .frame(width: width) .opacity(Double(StampKnobs.stampOpacity)) .scaleEffect(scale) .allowsHitTesting(false) .accessibilityHidden(true) } @ViewBuilder privatevar rubber: someView {iflet picture = CottonMedia.image(kind.rawValue) { picture .resizable() .interpolation(.high) .scaledToFit() .frame(width: width) .blendMode(.multiply) .opacity(Double(StampKnobs.stampOpacity)) .scaleEffect(scale) .allowsHitTesting(false) .accessibilityHidden(true) } }// The thump a stamp lands with (1.3 → 1.0 in 220 ms) is the screen's, not// the stamp's, because WHEN it lands is the screen's fact — a card arriving// already stamped must not thump. A screen reads the worn theme's// `stamp_thump_from` and `stamp_thump_duration`.}/// The sizes, counts and timings Stamp draws with: Swift's own, beside/// their reader — a theme sets only its tokens (`scale.tokens`).enumStampKnobs {staticlet stampFootTiltDegrees: CGFloat = -9staticlet stampLabelHorizontalPadding: CGFloat = 0.08staticlet stampLabelSize: CGFloat = 0.16staticlet stampLabelStrokeScale: CGFloat = 1.5staticlet stampLabelTracking: CGFloat = 0.01staticlet stampLabelVerticalPadding: CGFloat = 0.03staticlet stampOpacity: CGFloat = 0.92}