// The TODO as an INDEX CARD in a TRAY (the coordinator's pick for Todos,// owner, 29 Oct 2026: "most of your things look good"; the todo picture// `objects-2/todos/3-punched-card`): a ruled cream index card standing at the// front of a worn green-grey steel card tray, the cards behind it showing// their coloured tabs, the tray bare on the todos' dark teal baize// (`FaceGround.baizeTeal`) with no paper and no rule of the deck's. The tray, its// stack, its front wall, its shadow, the card with its rules and the blank// tabs are PAINTED (`Media.xcassets`, cut and imported by// `scripts/import-todos-materials.py`); the face draws live only what the// card decides, typed on the painted rules in Courier Prime://// the title on the first rule under the red head rule, one line or two// and no further — a title that wants a third stops at the second's last// whole word, with no ellipsis: a card just stops.// the description's opening on the rules after it, as many whole lines as// the card holds above the tray's lip, stopping at the last whole word// that fits: nothing scrolls, no pages, no "and more".// "made <date>" on the last rule the lip leaves showing: the card's own// label for its made place and the day the core says.// the due date on a tab standing up behind the card's top right — the// card's date words typed in capitals, the tab as long as they need; a red// tab once the day is behind (the card's `pressing`); no tab at all for a// todo with no date.// the completed card's word rubber-stamped across its head in worn ink,// the title struck through in pencil; an open card's head stays bare.//// Tagged parts: the title, the description (body), the tab (when), the stamp// (done, the face's own toggle) and, for a todo with no date, the bare place// where the tab would stand (corner), so a date is given from the card. The// day it was made is no part: nothing writes it. Tap steps keep the card// in place so the stamp lands and lifts.//// Every word is the core's (`DeckCard`): the face only types them on the// rules.importCottonPaperimportCottonValuesimportCoreTextimportSwiftUIenumTodoCardFaceKnobs {// THE TRAY, as painted (`todo-tray`, cut from 1388 by 1003 pixels): its// width over its height; the lip's top edge and the front wall's layer// (`todo-tray-front`, 1140 by 276) as shares of its height; the stack's// front card's left and right edges as shares of its width, which the// front card covers; how far its shadow (`todo-tray-shadow`, 804 by// 612) reaches past it on every side, as a share of its width —// measured off the painting by the cut that made the layers (`cut.py`// beside them), so a repainted tray owes new knobs.staticlet trayAspect: CGFloat = 1388.0 / 1003.0staticlet lip: CGFloat = 0.667staticlet frontTop: CGFloat = 0.665staticlet frontAspect: CGFloat = 1140.0 / 276.0staticlet stackLeft: CGFloat = 0.0857staticlet stackRight: CGFloat = 0.9222staticlet shadowReach: CGFloat = 0.0793staticlet shadowAspect: CGFloat = 804.0 / 612.0/// The tray in the card's room: the most of its width it takes, and of/// its height.staticlet fillWidth: CGFloat = 0.96staticlet fillHeight: CGFloat = 0.96// THE CARD, as painted (`todo-card`, cut from 1462 by 786): its width// over its height, the red head rule's and each blue rule's height as// shares of it.staticlet cardAspect: CGFloat = 1462.0 / 786.0staticlet head: CGFloat = 0.1833staticlet rules: [CGFloat] = [0.3007, 0.4189, 0.5368, 0.6604, 0.7834, 0.9098]/// The card stands this far past the stack's card on either side, as a/// share of the tray's width, and its top this far down the tray, as a/// share of the tray's height: proud of the cards behind it, under their/// tabs, five of its rules showing above the lip.staticlet overhang: CGFloat = 0.006staticlet top: CGFloat = 0.13/// The rules showing above the lip: the title's, the description's and/// the made day's.staticlet shown = 5// THE TAB (`todo-tab`, 720 by 102; `todo-tab-late`, 720 by 71): its// height as a share of the card's width, the share of it hidden behind// the card, its right end's distance in from the card's right edge;// each painting's tapered ends, as shares of its own height, which keep// their painted size while the tab stretches between them to its words.staticlet tabHeight: CGFloat = 0.09staticlet tabBuried: CGFloat = 0.2staticlet tabInset: CGFloat = 0.03staticlet tabAspect: CGFloat = 720.0 / 102.0staticlet tabEnds: CGFloat = 0.7225staticlet lateTabAspect: CGFloat = 720.0 / 71.0staticlet lateTabEnds: CGFloat = 0.59/// The tab's words, as a share of its height, and the room either side/// of them inside the tapered ends, as a share of its height; the/// shortest and the longest a tab may be, as shares of the card's width.staticlet tabSize: CGFloat = 0.5staticlet tabPad: CGFloat = 0.25staticlet tabShortest: CGFloat = 0.3staticlet tabLongest: CGFloat = 0.64// THE TYPE, as shares of the card's height (at a phone's card, about// 16 and 14 points on rules 18 apart): print on an object scales with// the object, never with Dynamic Type.staticlet titleSize: CGFloat = 0.108staticlet bodySize: CGFloat = 0.092/// The writing's room: from this far in from the card's left edge to/// this far in from its right, as shares of its width.staticlet lead: CGFloat = 0.065staticlet trail: CGFloat = 0.05staticlet titleLines = 2/// Pencil strike through a completed title.staticlet pencilLine: CGFloat = 0.011}/// A todo's card as the index card types it: the title's lines, the/// description's, the made day and the rule each stands on, the tab and the/// stamp.publicstructIndexCard: Equatable, Sendable {publicvar title: [TornLine]publicvar body: [TornLine]publicvar made: String?/// The due date, as typed on the tab; nil, no tab.publicvar tab: String?/// The tab is the red one: the day is behind.publicvar late: Bool/// The stamp is printed and the title struck through.publicvar done: Bool/// The card’s own word printed by the stamp.publicvar stampWord: String?publicvar titleRules: Range<Int> { 0..<title.count }publicvar bodyRule: Int { title.count }publicvar bodyRules: Range<Int> { bodyRule..<(bodyRule + body.count) }publicvar madeRule: Int? { made.map { _ inTodoCardFaceKnobs.shown - 1 } }}/// How a todo's card is typed on the index card.publicenumIndexCardSetting {/// The card's own label for its place `slot` (`labels`), nil when it/// has none.staticfunc label(_ card: DeckCard, _ slot: String) -> String? {guardlet label = card.labels[slot: slot], !label.isEmpty else { returnnil }return label }/// The made day under its label ("made Thu 22 Oct"), nil when the card/// carries no made place.publicstaticfunc made(_ card: DeckCard) -> String? {guardlet day = card.text("made")?.trimmingCharacters(in: .whitespacesAndNewlines), !day.isEmpty else { returnnil }return label(card, "made").map { "\($0) \(day)" } ?? day }/// The type the card is written in, at a card `height` points tall.staticfunc fonts(height: CGFloat) -> (title: CTFont, body: CTFont) {let knobs = TodoCardFaceKnobs.self// Asked of CottonFonts first, so the bundled faces are registered// before CoreText is asked for them by name. _ = CottonFonts.type(1)return ( CTFontCreateWithName(CottonFonts.typeFace as CFString, drawable(knobs.titleSize * height), nil), CTFontCreateWithName(CottonFonts.typeFace as CFString, drawable(knobs.bodySize * height), nil) ) }/// The writing's room across a card `size` points: where it starts and/// how wide it is.staticfunc column(_ size: CGSize) -> (lead: CGFloat, width: CGFloat) {let knobs = TodoCardFaceKnobs.selflet lead = knobs.lead * size.widthreturn (lead, size.width * (1 - knobs.trail) - lead) }/// `card` typed on an index card `size` points: the title on the first/// rules, the description on the rules after it, the made day on the/// last rule showing.publicstaticfunc set(_ card: DeckCard, size: CGSize) -> IndexCard {let knobs = TodoCardFaceKnobs.selflet faces = fonts(height: size.height)let column = column(size)let flat = (card.text("title") ?? "").split(whereSeparator: \.isNewline).joined(separator: " ")let title = TornPageSetting.lines(flat, font: faces.title, width: column.width, limit: knobs.titleLines)let made = made(card)let room = knobs.shown - title.count - (made == nil ? 0 : 1)let body = TornPageSetting.lines( card.text("body")?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "", font: faces.body, width: column.width, limit: max(0, room))let done = card.checked == true && card.text("state") == nilreturnIndexCard( title: title, body: body, made: made, tab: card.dated?.uppercased(), late: card.pressing && !done, done: done, stampWord: label(card, "check")?.uppercased()) }}/// The size CottonFonts draws a face at, which a font measured by name must/// match: never under a point.privatefunc drawable(_ points: CGFloat) -> CGFloat { points.isFinite ? max(points, 1) : 1}/// A painted layer, by its catalogue name, at the scale it was painted for;/// nil where this build carries no pictures.privatefunc painted(_ name: String) -> Image? {CottonMedia.image(name, scale: 3)}publicstructTodoCardFace: View { @Environment(\.faceOpened) privatevar openedlet card: DeckCardlet toggle: () -> Voidpublicinit(card: DeckCard, toggle: @escaping () -> Void = {}) {self.card = cardself.toggle = toggle }publicvar body: someView {let knobs = TodoCardFaceKnobs.selfif opened { LiftedIndexCard(card: card, toggle: toggle) } else {GeometryReader { box inlet width = min(box.size.width * knobs.fillWidth, box.size.height * knobs.fillHeight * knobs.trayAspect)let size = CGSize(width: width, height: width / knobs.trayAspect)CardTray(card: card, toggle: toggle, size: size) .frame(width: size.width, height: size.height) .frame(width: box.size.width, height: box.size.height) } } }}/// The tray standing on the steel: its shadow, the tray and its stack, the/// tab, the front card and what is typed on it, and the front wall over the/// card's foot.privatestructCardTray: View {let card: DeckCardlet toggle: () -> Voidlet size: CGSizevar body: someView {let knobs = TodoCardFaceKnobs.selflet w = size.widthlet h = size.heightlet reach = knobs.shadowReach * wlet cardWidth = (knobs.stackRight - knobs.stackLeft + 2 * knobs.overhang) * wlet cardSize = CGSize(width: cardWidth, height: cardWidth / knobs.cardAspect)let cardOrigin = CGPoint(x: (knobs.stackLeft - knobs.overhang) * w, y: knobs.top * h)let typed = IndexCardSetting.set(card, size: cardSize) ZStack(alignment: .topLeading) {iflet shadow = painted("todo-tray-shadow") { shadow.resizable().interpolation(.high) .frame(width: w + 2 * reach, height: (w + 2 * reach) / knobs.shadowAspect) .offset(x: -reach, y: -reach) .accessibilityHidden(true) }iflet tray = painted("todo-tray") { tray.resizable().interpolation(.high) .frame(width: w, height: h) .accessibilityHidden(true) } else {StandInTray(size: size) }DueTab(typed: typed, cardSize: cardSize) .offset(x: cardOrigin.x, y: cardOrigin.y)IndexCardSheet(typed: typed, checked: card.checked, title: card.text("title") ?? "", toggle: toggle, size: cardSize) .frame(width: cardSize.width, height: cardSize.height) .offset(x: cardOrigin.x, y: cardOrigin.y)iflet front = painted("todo-tray-front") { front.resizable().interpolation(.high) .frame(width: w, height: w / knobs.frontAspect) .offset(y: knobs.frontTop * h) .accessibilityHidden(true) } else {TodosMaterial.enamel.colour .frame(width: w, height: h * (1 - knobs.lip)) .offset(y: knobs.lip * h) .accessibilityHidden(true) } } .frame(width: w, height: h, alignment: .topLeading) .accessibilityElement(children: .contain) .accessibilityIdentifier("todo-card") }}/// The tab behind the card's top right with the due date typed on it, the/// red one once the day is behind; for a todo with no date, no tab, and its/// bare place the corner a date is given from.privatestructDueTab: View {let typed: IndexCardlet cardSize: CGSizevar body: someView {let knobs = TodoCardFaceKnobs.selflet height = knobs.tabHeight * cardSize.widthlet showing = height * (1 - knobs.tabBuried)let size = knobs.tabSize * heightlet ends = (typed.late ? knobs.lateTabEnds : knobs.tabEnds) * heightlet words = typed.tab.map { tabWords($0, size: size) }let width = min( knobs.tabLongest * cardSize.width, max(knobs.tabShortest * cardSize.width, (words?.width ?? 0) + 2 * (ends + knobs.tabPad * height)))let x = cardSize.width * (1 - knobs.tabInset) - widthiflet tab = typed.tab, let words {// The words centred on the showing part, their capitals' middle// on its middle; squeezed to the room inside the ends when they// outrun the longest tab.let room = max(1, width - 2 * (ends + knobs.tabPad * height))let typedWidth = min(room, words.width + 1)let baseline = showing / 2 + size * 0.3 ZStack(alignment: .topLeading) {TabStock(late: typed.late, ends: ends) .frame(width: width, height: height)Typed(lines: [TornLine(tab)], rules: [baseline], font: CottonFonts.type(size), size: size, ink: TodosMaterial.ink.colour, width: typedWidth, fits: true) .blendMode(.multiply) .accessibilityRepresentation { Text(tab) } .accessibilityIdentifier("todo-card-tab") .offset(x: (width - typedWidth) / 2, y: baseline - size * 1.1) } .frame(width: width, height: height, alignment: .topLeading) .facePart(.when) .pencilRinged(.when, reach: EdgeInsets(top: 2, leading: 2, bottom: -height * knobs.tabBuried, trailing: 2)) .offset(x: x, y: -showing) } else {Color.clear .frame(width: width, height: showing) .contentShape(Rectangle()) .accessibilityIdentifier("todo-card-corner") .facePart(.corner) .offset(x: x, y: -showing) } }privatefunc tabWords(_ words: String, size: CGFloat) -> (words: String, width: CGFloat) { _ = CottonFonts.type(1)let font = CTFontCreateWithName(CottonFonts.typeFace as CFString, drawable(size), nil)let set = NSAttributedString(string: words, attributes: [NSAttributedString.Key(kCTFontAttributeName asString): font])return (words, CGFloat(CTLineGetTypographicBounds(CTLineCreateWithAttributedString(set), nil, nil, nil))) }}/// The tab's painted stock, stretched between its tapered ends; flat where/// this build carries no pictures.privatestructTabStock: View {let late: Bool/// Each tapered end's width, in points.let ends: CGFloatvar body: someView {let knobs = TodoCardFaceKnobs.selflet name = late ? "todo-tab-late" : "todo-tab"let aspect = late ? knobs.lateTabAspect : knobs.tabAspectGeometryReader { room in// The painting's pixels a point at the tab's height, so its ends// keep their painted shape.let pixels = 720 / aspect / max(room.size.height, 1)iflet image = CottonMedia.image(name, scale: pixels) { image .resizable(capInsets: EdgeInsets(top: 0, leading: ends, bottom: 0, trailing: ends), resizingMode: .stretch) .interpolation(.high) .accessibilityHidden(true) } else {UnevenRoundedRectangle(topLeadingRadius: ends / 2, topTrailingRadius: ends / 2) .fill((late ? TodosMaterial.tabLate : TodosMaterial.tab).colour) .accessibilityHidden(true) } } }}/// The painted card, its writing and the stamp overprinting its head.privatestructIndexCardSheet: View {let typed: IndexCardlet checked: Bool?let title: Stringlet toggle: () -> Voidlet size: CGSizevar body: someView {let knobs = TodoCardFaceKnobs.selflet w = size.widthlet h = size.heightlet column = IndexCardSetting.column(size)let rule = { (index: Int) in knobs.rules[min(max(0, index), knobs.rules.count - 1)] * h }let titleSize = knobs.titleSize * hlet bodySize = knobs.bodySize * h ZStack(alignment: .topLeading) {iflet paper = painted("todo-card") { paper.resizable().interpolation(.high) .frame(width: w, height: h) .cardPaperLaid() .accessibilityHidden(true) } else {StandInCard(size: size) }Group {if !typed.title.isEmpty {Typed( lines: typed.title, rules: typed.titleRules.map(rule), font: CottonFonts.type(titleSize), size: titleSize, ink: TodosMaterial.ink.colour, width: column.width, struck: typed.done ? TodosMaterial.pencil.colour : nil, strike: knobs.pencilLine * h) .accessibilityRepresentation { Text(typed.title.map(\.words).joined(separator: " ")) } .accessibilityIdentifier("deck-title") .facePart(.title) .pencilRinged(.title, reach: EdgeInsets(top: 2, leading: 4, bottom: 2, trailing: 4)) .offset(x: column.lead, y: rule(typed.titleRules.lowerBound) - titleSize * 1.1) }if !typed.body.isEmpty {Typed( lines: typed.body, rules: typed.bodyRules.map(rule), font: CottonFonts.type(bodySize), size: bodySize, ink: TodosMaterial.ink.colour, width: column.width) .accessibilityRepresentation { Text(typed.body.map(\.words).joined(separator: " ")) } .accessibilityIdentifier("todo-card-body") .facePart(.body) .pencilRinged(.body, reach: EdgeInsets(top: 2, leading: 4, bottom: 2, trailing: 4)) .offset(x: column.lead, y: rule(typed.bodyRule) - bodySize * 1.1) }iflet made = typed.made, let at = typed.madeRule {Typed( lines: [TornLine(made)], rules: [rule(at)], font: CottonFonts.type(bodySize), size: bodySize, ink: TodosMaterial.ink.colour, width: column.width, fits: true) .accessibilityRepresentation { Text(made) } .accessibilityIdentifier("todo-card-made") .offset(x: column.lead, y: rule(at) - bodySize * 1.1) } }// A typewriter's ink sits in the card's stock. .blendMode(.multiply)DoneStamp(typed: typed, checked: checked, title: title, toggle: toggle, cardSize: size) .offset(x: column.lead, y: h * 0.08) .blendMode(.multiply) } .frame(width: w, height: h, alignment: .topLeading) }}/// The bare landing place stays a toggle; completed cards carry its worn ink.privatestructDoneStamp: View {let typed: IndexCardlet checked: Bool?let title: Stringlet toggle: () -> Voidlet cardSize: CGSize @Environment(\.accessibilityReduceMotion) privatevar reduceMotionprivatevar arrival: AnyTransition { reduceMotion ? .identity : .asymmetric( insertion: .scale(scale: 1.6).combined(with: .offset(y: -cardSize.height * 0.24)) .combined(with: .modifier(active: StampSettle(turn: -3), identity: StampSettle(turn: 0))), removal: .scale(scale: 1.15).combined(with: .offset(y: -cardSize.height * 0.12)).combined(with: .opacity)) }var body: someView {let width = cardSize.width / 3let height = cardSize.height * 0.24let drawn = ZStack {Color.clearif typed.done, let word = typed.stampWord {RubberStamp(words: word, size: cardSize.height * 0.13, turn: -5) .frame(width: width, height: height) .transition(arrival) } } .frame(width: width, height: height) .contentShape(Rectangle()) .animation(reduceMotion ? nil : (typed.done ? .timingCurve(0.16, 1, 0.3, 1, duration: 0.18) : .easeOut(duration: 0.12)), value: typed.done)iflet checked {Button(action: toggle) { drawn } .buttonStyle(.plain) .accessibilityLabel(title) .accessibilityAddTraits(checked ? .isSelected : []) .accessibilityIdentifier("deck-check") .facePart(.done) .pencilRinged(.done, reach: EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)) } else { drawn.accessibilityHidden(true) } }}privatestructStampSettle: ViewModifier {let turn: Doublefunc body(content: Content) -> someView { content.rotationEffect(.degrees(turn)) }}/// Lines typed on the card's rules: each line's baseline on its rule, drawn/// into a room from just above the first line's letters to just under the/// last's; struck through in pencil when a finished todo's title.privatestructTyped: View {let lines: [TornLine]/// Each line's rule, from the card's top.let rules: [CGFloat]let font: Fontlet size: CGFloatlet ink: Colorlet width: CGFloat/// One line squeezed to the room rather than cut: a date.var fits = false/// The pencil a line is struck through in; nil, none.var struck: Color?var strike: CGFloat = 1var body: someView {let top = (rules.first ?? 0) - size * 1.1let height = (rules.last ?? 0) - top + size * 0.4Canvas { context, room infor (line, rule) in zip(lines, rules) {let text = context.resolve(Text(line.words).font(font).foregroundStyle(ink))let ideal = text.measure(in: CGSize(width: 10_000, height: 10_000))let base = text.firstBaseline(in: CGSize(width: 10_000, height: 10_000))let scale = fits && ideal.width > room.width ? room.width / ideal.width : 1var drawn = context drawn.translateBy(x: 0, y: rule - top) drawn.scaleBy(x: scale, y: scale) drawn.draw(text, at: CGPoint(x: 0, y: -base), anchor: .topLeading)iflet struck {// A ruler-less pencil line through the letters' middle,// a touch past either end and a little uphill.let y = -size * 0.3var line = Path() line.move(to: CGPoint(x: -size * 0.2, y: y + size * 0.04)) line.addLine(to: CGPoint(x: ideal.width + size * 0.25, y: y - size * 0.05)) drawn.stroke(line, with: .color(struck), style: StrokeStyle(lineWidth: strike, lineCap: .round)) } } } .frame(width: width, height: max(height, 1)) }}/// The tray where this build carries no pictures: its enamel, the stack's/// cream, flat.privatestructStandInTray: View {let size: CGSizevar body: someView {let knobs = TodoCardFaceKnobs.selfCanvas { context, room in context.fill(Path(roundedRect: CGRect(origin: .zero, size: room), cornerRadius: room.width * 0.04), with: .color(TodosMaterial.enamel.colour))let inside = CGRect( x: knobs.stackLeft * room.width, y: room.height * 0.05, width: (knobs.stackRight - knobs.stackLeft) * room.width, height: room.height * (knobs.lip - 0.05)) context.fill(Path(inside), with: .color(TodosMaterial.card.colour.opacity(0.8))) } .frame(width: size.width, height: size.height) .accessibilityHidden(true) }}/// The card where this build carries no pictures: its cream, its head rule/// and its rules, flat.privatestructStandInCard: View {let size: CGSizevar body: someView {let knobs = TodoCardFaceKnobs.selfCanvas { context, room in context.fill(Path(roundedRect: CGRect(origin: .zero, size: room), cornerRadius: room.width * 0.01), with: .color(TodosMaterial.card.colour))let ruling = [(knobs.head, TodosMaterial.head.colour)] + knobs.rules.map { ($0, TodosMaterial.rule.colour) }for (share, colour) in ruling {let y = share * room.height context.stroke(Path { $0.move(to: CGPoint(x: 0, y: y)); $0.addLine(to: CGPoint(x: room.width, y: y)) }, with: .color(colour), lineWidth: 0.6) } } .frame(width: size.width, height: size.height) .accessibilityHidden(true) }}/// The index card, by its id beside the todo's own face, and the todos it/// is reviewed in: invented words only. The specimen world's today is/// Thursday 29 October 2026; a todo's date and its corner as the core says/// them (`weekday_date`, `late`), the day it was made under the card's own/// label for it.publicenumTodoCardFaceCatalogue {publicstaticlet stock: FaceStock = .ownpublicstaticlet ground: FaceGround = .baizeTealpublicstaticvar opened: DeckCard {var card = long card.fields["check"] = .bool(true) card.fields["started"] = .text("Thu 22 Oct") card.fields["expires"] = .text("Thu 29 Oct") card.fields["repeats"] = .text("Every week")return card }publicstaticlet face = Face(id: "todo.card", specimens: [Specimen("opened", opened, opened: true),Specimen("open", open), Specimen("done", done), Specimen("overdue", overdue),Specimen("no-date", noDate), Specimen("long", long), ], steps: .inPlace) { card, _, taps inTodoCardFace(card: card, toggle: taps.toggle ?? {}) }/// The labels a todo's card carries for its check and its made place.staticlet labels = CardLabels(bySlot: ["check": "Done", "made": "made"])staticfunc todo(corner: String?, pressing: Bool = false, pace: DeckPace?, _ fields: [String: RecordValue]) -> DeckCard {var card = DeckCard(face: "todo.card", corner: corner, pressing: pressing, pace: pace, plate: nil, fields: fields) card.labels = labelsreturn card }/// The reference's todo: due tomorrow, Friday.publicstaticletopen = todo(corner: "Tomorrow", pace: .soon, ["check": .bool(false), "title": .text("Renew the car insurance"),"body": .text("Policy ends 3 Nov; ask for the no-claims letter"),"date": .text("Fri 30 Oct"), "made": .text("Thu 22 Oct"), ])/// The same todo, done today: stamped, the title struck through.publicstaticlet done = todo(corner: "Done today", pace: .done, ["check": .bool(true), "title": .text("Renew the car insurance"),"body": .text("Policy ends 3 Nov; ask for the no-claims letter"),"date": .text("Fri 30 Oct"), "made": .text("Thu 22 Oct"), ])/// Two days past its day: the red tab.publicstaticlet overdue = todo(corner: "2 days late", pressing: true, pace: .late, ["check": .bool(false), "title": .text("Pay the building maintenance"),"body": .text("The society office takes cheques only, and shuts at noon on Saturday."),"date": .text("Tue 27 Oct"), "made": .text("Mon 12 Oct"), ])/// No date: no tab.publicstaticlet noDate = todo(corner: nil, pace: .someday, ["check": .bool(false), "title": .text("Sort the old photographs"),"body": .text("The shoebox under the bed first. The wedding ones can wait for Amma's visit."),"date": .text(ShellLines.line("cards", "date.add")), "made": .text("Sun 4 Oct"), ])/// A title on two lines over a long description, due on Saturday evening.publicstaticlet long = todo(corner: "in 2 days", pace: .soon, ["check": .bool(false),"title": .text("Call the insurance agent about the scratch on the rear door"),"body": .text(""" The policy number is on the renewal letter in the blue folder. Ask whether the surveyor can come on Saturday morning before ten, and whether the garage by the station is on their list or we have to take it all the way to the one on the ring road. """),"date": .text("Sat 31 Oct\(EventWhen.join)6:00 pm"), "group": .text("Car"), "made": .text("Tue 27 Oct"), ])}/// The same ruled stock lifted clear of the tray's front wall.privatestructLiftedIndexCard: View {let card: DeckCardlet toggle: () -> Voidvar body: someView {GeometryReader { room inlet width = room.size.width * 0.88ScrollView { VStack(alignment: .leading, spacing: 18) {iflet title = card.text("title") {Text(title).font(CottonFonts.type(width * 0.062)) .strikethrough(card.checked == true).facePart(.title) }if card.checked == true {Text(IndexCardSetting.label(card, "check")?.uppercased() ?? "") .foregroundStyle(TodosMaterial.tabLate.colour).rotationEffect(.degrees(-8)) .onTapGesture(perform: toggle) }iflet notes = card.text("body") {Text(notes).font(CottonFonts.type(width * 0.05)) .lineSpacing(7).fixedSize(horizontal: false, vertical: true).facePart(.body) }let history = [ card.text("started").map { ShellLines.line("cards", "opened.made") + " " + EventWhen.parted($0).day }, card.checked == true ? card.text("expires").map { ShellLines.line("cards", "opened.done") + " " + EventWhen.parted($0).day } : nil, card.text("repeats").map { ShellLines.line("cards", "opened.repeats") + " " + $0 } ].compactMap { $0 }.joined(separator: " · ")if !history.isEmpty {Text(history).font(CottonFonts.type(width * 0.035)) .lineLimit(1).minimumScaleFactor(0.5).accessibilityIdentifier("todo-card-history") } } .foregroundStyle(TodosMaterial.ink.colour) .padding(width * 0.07) .padding(.top, width * 0.06) .frame(width: width, alignment: .leading) .background {iflet paper = painted("todo-card") { paper.resizable().cardPaperLaid() }else { TodosMaterial.card.colour } } .shadow(color: .black.opacity(0.25), radius: 8, x: 2, y: 8) .padding(.vertical, 20) .frame(maxWidth: .infinity) } .accessibilityIdentifier("todo-card-opened") } }}