// The ARTIFACT face (reference `artifacts.png` and its cases) — the face of// a tool that reads another tool's table (Artifacts reads documents). The// framed cream card (house references 4/31, 5/33, 90): the page in a// browser's window on a wash of blue in a cream mat — its picture, or the// empty window with a blank page ruled inside while there is none — then the// title typed heavy, "made with …" in type, and at the foot the day by hand// with the group on a buff tag beside it, or on a hairline when there is no// group; the day's label only when no "made with …" says it. Every word is// the core's (`DeckCard`).importCottonPaperimportCottonValuesimportSwiftUIenumArtifactFaceKnobs {staticlet inset = EdgeInsets(top: 26, leading: 26, bottom: 24, trailing: 24)staticlet windowShare: CGFloat = 0.52/// The cream mat round the wash, and the wash round the window.staticlet mat: CGFloat = 8staticlet wash: CGFloat = 12staticlet washSaturation: Double = 1.6staticlet titleSize: CGFloat = 23staticlet madeSize: CGFloat = 15staticlet dateHand: CGFloat = 29staticlet bar: CGFloat = 16staticlet dot: CGFloat = 6staticlet dotOpacity: Double = 0.7staticlet field: CGFloat = 7staticlet line: CGFloat = 0.7/// The blank page's ruled frame inside the empty window.staticlet blankInset: CGFloat = 9}publicstructArtifactFace<Picture: View>: View {let card: DeckCard/// The page's picture filling its frame; nil draws the empty window.var picture: Picture? @Environment(\.theme) privatevar themepublicinit(card: DeckCard, picture: Picture? = nil) {self.card = cardself.picture = picture }publicvar body: someView {GeometryReader { sheet in VStack(alignment: .leading, spacing: 0) {iflet kind = card.text("subtitle") { FaceKind(words: kind).padding(.bottom, 12).facePart(.subtitle) }BrowserWindow(picture: picture) .padding(ArtifactFaceKnobs.wash) .background(PaperSurface(dye: .blue, edge: .torn, seed: "artifact-wash") .saturation(ArtifactFaceKnobs.washSaturation) ) .padding(ArtifactFaceKnobs.mat) .background(theme.faceStocks.printMount) .overlay(Rectangle().stroke(theme.print(.pencil).opacity(0.25), lineWidth: ArtifactFaceKnobs.line)) .frame(height: sheet.size.height * ArtifactFaceKnobs.windowShare) .shadow(color: theme.colors.shadow.color.opacity(0.22), radius: 2.5, x: 0, y: 1.5) .accessibilityElement(children: .ignore) .accessibilityLabel(card.text("title") ?? "") .facePart(.picture)// A page filed under its address reads by its name, the// address's host under it (real-data walk, 23 Oct 2026).let named = card.text("title").map(ArtifactTitle.init)iflet named {HeavyType(words: named.words, size: ArtifactFaceKnobs.titleSize) .lineLimit(2) .minimumScaleFactor(0.8) .padding(.top, 20) .accessibilityIdentifier("deck-title") .facePart(.title) }iflet host = named?.host {Text(host) .font(CottonFonts.type(ArtifactFaceKnobs.madeSize)) .lineLimit(1) .faceInk(.pencil) .padding(.top, 4) }let made = card.text("source")iflet made {Text(made) .font(CottonFonts.type(ArtifactFaceKnobs.madeSize)) .lineLimit(1) .faceInk(.ink) .padding(.top, 6) }Spacer(minLength: 6)let group = card.text("group")// With no tag beside it, the day sits on a hairline.if group == nil, card.text("date") != nil { FaceHairline().padding(.bottom, 8) } HStack(alignment: .bottom) {iflet date = card.text("date") { VStack(alignment: .leading, spacing: 2) {// "made with …" already says what the day is.if made == nil, let label = card.label("date") { FaceLabel(words: label) }Text(HandRun.tail(date)) .font(CottonFonts.hand(ArtifactFaceKnobs.dateHand)) .lineLimit(1) .minimumScaleFactor(0.7) .faceInk(.ink) .accessibilityIdentifier("face-date") } .facePart(.when) }Spacer(minLength: 8)iflet group {PaperLabel(words: group) .facePart(.group) } } } .padding(ArtifactFaceKnobs.inset) } .onCardPaper(ArtifactFaceCatalogue.stock.laid(card.pace)) }}/// A browser's window: a bar with its three dots and an address field, the/// page under it — or, while there is no picture, a blank page ruled inside.privatestructBrowserWindow<Picture: View>: View {let picture: Picture? @Environment(\.theme) privatevar themevar body: someView { VStack(spacing: 0) { HStack(spacing: ArtifactFaceKnobs.dot * 0.8) {ForEach([PaperInk.red, .pencil, .green], id: \.self) { ink inCircle() .fill(theme.print(ink).opacity(ArtifactFaceKnobs.dotOpacity)) .frame(width: ArtifactFaceKnobs.dot, height: ArtifactFaceKnobs.dot) }RoundedRectangle(cornerRadius: 2) .stroke(theme.print(.pencil).opacity(0.35), lineWidth: ArtifactFaceKnobs.line) .frame(height: ArtifactFaceKnobs.field) .padding(.leading, ArtifactFaceKnobs.dot) } .padding(.horizontal, 8) .frame(height: ArtifactFaceKnobs.bar)Rectangle().fill(theme.print(.pencil).opacity(0.25)).frame(height: ArtifactFaceKnobs.line) ZStack {Rectangle().fill(theme.faceStocks.printMount)iflet picture {Color.clear.overlay(picture, alignment: .top).clipped() } else {RoundedRectangle(cornerRadius: 2) .stroke(theme.print(.pencil).opacity(0.22), lineWidth: ArtifactFaceKnobs.line) .padding(ArtifactFaceKnobs.blankInset) } } } .background(theme.faceStocks.printMount) .overlay(Rectangle().stroke(theme.print(.pencil).opacity(0.3), lineWidth: ArtifactFaceKnobs.line)) .accessibilityHidden(true) }}/// A word typed on a slip of buff paper, a little askew (a group's label).structPaperLabel: View {let words: String @Environment(\.theme) privatevar themevar body: someView {Text(words) .font(CottonFonts.type(FacePartsKnobs.tagSize)) .lineLimit(1) .faceInk(.ink) .padding(.horizontal, 14) .padding(.vertical, 8) .background(PaperSurface(dye: .buff, edge: .torn, seed: "label-\(words)") .saturation(1.3) .shadow(color: theme.colors.shadow.color.opacity(0.2), radius: 1.5, x: 0, y: 1) ) .rotationEffect(.degrees(-4)) .accessibilityIdentifier("face-group") }}/// An artifact's title as the card says it: a page titled with its own/// address reads by the address's last part ("trip-planner.html" → "Trip/// planner"), its host kept apart; any other title as it is.structArtifactTitle: Equatable {let words: Stringlet host: String?}extensionArtifactTitle {init(_ title: String) {let trimmed = title.trimmingCharacters(in: .whitespacesAndNewlines)guard trimmed.contains("://"), let url = URL(string: trimmed), let host = url.host() else { words = title host = nilreturn }let last = url.deletingPathExtension().lastPathComponentlet spoken = last.replacingOccurrences(of: "-", with: " ").replacingOccurrences(of: "_", with: " ") .trimmingCharacters(in: .whitespaces)if spoken.isEmpty || spoken == "/" { words = hostself.host = nil } else { words = spoken.prefix(1).uppercased() + spoken.dropFirst()self.host = host } }}/// The artifact face, by the kind's name, and the cards it is reviewed in.publicenumArtifactFaceCatalogue {publicstaticlet stock: FaceStock = .framedpublicstaticlet ground: FaceGround = .paperpublicstaticlet face = Face(id: "artifact", specimens: [Specimen("planner", planner, picture: "verandah-wide")]) { card, picture, _ inArtifactFace(card: card, picture: picture) }publicstaticlet planner = DeckCard(face: .artifact, fields: ["subtitle": .text("Artifact"),"title": .text("Trip budget planner"),"source": .text("made with Claude"),"date": .text("14 Oct 2026"),"group": .text("Travel"),"photo": .text("verandah-wide"), ])}