// The PLAYLIST on the album face (card kind `album` on a table whose card// opens through its entries into tracks; the Codex playlist-1 card, 23 Oct// 2026): a cassette's J-card in its clear case, taped to the card — the name// written large by hand, how many songs and how long typed under it, the day// it was made by hand under its label (`date`), and the first four of the// songs it holds pinned in pairs: each cover once, and a sleeve printed with// its title and artist for a song that keeps no cover. Every word is the// core's (`DeckCard`); the covers are the songs' own, read through the store// by the deck (`DeckCardFill`, `MusicWholeCovers`, CottonUI).importCottonPaperimportCottonValuesimportSwiftUIpublicstructPlaylistFace<Cover: View>: View {let card: DeckCard/// The songs it holds, each cover once, in its order.let covers: [MusicTile]/// A cover by its key, decoded at an edge in points.let cover: (_ key: String, _ edge: CGFloat) -> Coverpublicinit(card: DeckCard, covers: [MusicTile], cover: @escaping (_ key: String, _ edge: CGFloat) -> Cover) {self.card = cardself.covers = coversself.cover = cover }publicvar body: someView { ZStack(alignment: .top) { JCase() VStack(spacing: 0) {iflet name = card.text("title") {Text(name) .font(CottonFonts.hand(MusicWholeKnobs.nameHand)) .multilineTextAlignment(.center) .lineLimit(2) .minimumScaleFactor(0.5) .faceInk(.ink) .accessibilityAddTraits(.isHeader) .accessibilityIdentifier("deck-title") .facePart(.title) }iflet facts = MusicWhole.joined([card.text("count"), card.text("length")]) {Text(facts) .font(CottonFonts.type(MusicWholeKnobs.playlistFacts)) .lineLimit(1) .minimumScaleFactor(0.8) .faceInk(.ink) .padding(.top, 4) .accessibilityIdentifier("face-facts") }iflet made = card.dated {Text([card.label("date"), made].compactMap { $0 }.joined(separator: " ")) .font(CottonFonts.hand(MusicWholeKnobs.madeHand)) .lineLimit(1) .minimumScaleFactor(0.7) .faceInk(.ink) .padding(.top, 2) .accessibilityIdentifier("face-date") .facePart(.when) }PinnedCovers(tiles: Array(covers.prefix(MusicWholeKnobs.covers)), cover: cover) .padding(.top, 18) } .padding(MusicWholeKnobs.cardPadding) .padding(MusicWholeKnobs.cardInset)Tape(size: MusicWholeKnobs.tape) .offset(y: -MusicWholeKnobs.tape.height / 2) } .padding(MusicWholeKnobs.inset) .onCardPaper(PlaylistFaceCatalogue.stock.laid(card.pace)) }}/// The clear case and the J-card in it: two hairlines round a rounded/// corner, the card's paper a shade warmer than the stock inside them.privatestruct JCase: View { @Environment(\.theme) privatevar themevar body: someView {let corner = MusicWholeKnobs.caseCorner ZStack {PaperSurface(dye: .straw, edge: .cut, seed: "j-card") .saturation(0.45) .clipShape(RoundedRectangle(cornerRadius: corner / 2)) .shadow(color: theme.colors.shadow.color.opacity(0.18), radius: 1.5, x: 0, y: 1) .padding(MusicWholeKnobs.cardInset)Group {RoundedRectangle(cornerRadius: corner) .stroke(theme.print(.pencil).opacity(0.5), lineWidth: 1.1)RoundedRectangle(cornerRadius: corner - MusicWholeKnobs.caseLine / 2) .inset(by: MusicWholeKnobs.caseLine) .stroke(theme.print(.pencil).opacity(0.25), lineWidth: 0.75) } .blendMode(theme.printBlend) } .accessibilityHidden(true) }}/// A strip of clear tape: the paper showing through, its edges a hair/// darker.privatestructTape: View {let size: CGSize @Environment(\.theme) privatevar themevar body: someView {Rectangle() .fill(theme.colors.paper.color.opacity(0.55)) .overlay(Rectangle().stroke(theme.print(.pencil).opacity(0.18), lineWidth: 0.6)) .frame(width: size.width, height: size.height) .rotationEffect(.degrees(MusicWholeKnobs.tapeTurn)) .accessibilityHidden(true) }}/// The songs pinned on the J-card, two across, each turned a little and/// taped at its head: a song's own cover in a white mount, or, for a song/// that keeps none, its sleeve a size smaller printed with its title and/// artist; a lone one pinned large.privatestructPinnedCovers<Cover: View>: View {let tiles: [MusicTile]let cover: (_ key: String, _ edge: CGFloat) -> Covervar body: someView {GeometryReader { room inlet gutter = MusicWholeKnobs.coverGutterlet rows = tiles.count > 1 ? (tiles.count + 1) / MusicWholeKnobs.coverColumns : 1let across = tiles.count > 1 ? MusicWholeKnobs.coverColumns : 1let side = max(0, min( (room.size.width - gutter * CGFloat(across - 1)) / CGFloat(across), (room.size.height - gutter * CGFloat(rows - 1)) / CGFloat(rows))) VStack(spacing: gutter) {ForEach(0..<rows, id: \.self) { row in HStack(spacing: gutter) {ForEach(Array(tiles.enumerated()).filter { $0.offset / across == row }, id: \.offset) { at, tile in pinned(tile, at: at, side: side) } } } } .frame(width: room.size.width, height: room.size.height) } .accessibilityHidden(true) }privatefunc pinned(_ tile: MusicTile, at: Int, side: CGFloat) -> someView {Group {switch tile {case .art(let key):MountedPrint(photo: cover(key, MusicWholeKnobs.coverEdge)) .padding(MusicWholeKnobs.coverMount) .background(MountPaper()) .frame(width: side, height: side)case .sleeve(let title, let artist):TypeSleeve(title: title, artist: artist) .frame(width: side * MusicWholeKnobs.sleeveShare, height: side * MusicWholeKnobs.sleeveShare) } } .rotationEffect(.degrees(at.isMultiple(of: 2) ? -MusicWholeKnobs.coverTurn : MusicWholeKnobs.coverTurn)) .overlay(alignment: .top) {Tape(size: MusicWholeKnobs.smallTape).offset(y: -MusicWholeKnobs.smallTape.height / 2) } .frame(width: side, height: side) }}/// The white mount under a pinned cover, a soft shadow where it lifts.privatestructMountPaper: View { @Environment(\.theme) privatevar themevar body: someView {Rectangle() .fill(theme.faceStocks.printMount) .shadow(color: theme.colors.shadow.color.opacity(0.2), radius: 1.5, x: 0, y: 1) }}/// The playlist face, and the cards it is reviewed in. No card kind names it/// yet (`music.playlist`): the deck draws it for an album whose whole deals/// tracks through its entries (the album face, `whole`), its songs' covers on/// its card (`covers`); here it is drawn from its card alone, pinning the/// picture the card names, as the deck does before the covers are read.publicenumPlaylistFaceCatalogue {publicstaticlet stock: FaceStock = .creampublicstaticlet ground: FaceGround = .paperpublicstaticlet face = Face(id: "music.playlist", specimens: [Specimen("sunday", sunday)]) { card, _, _ inPlaylistFace(card: card, covers: [card.text("photo")].compactMap { $0 }.map(MusicTile.art)) { key, edge inFacePicture(key: key, edge: edge) } }publicstaticlet sunday = DeckCard(face: .musicPlaylist, fields: ["title": .text("Sunday Morning"),"count": .text("14 songs"),"length": .text("58:03"),"date": .text("Sat 3 Oct"),// The date's label, brought by the card (`labels`)."labels": .object(["date": .text("Made")]), ])}