// A record named by a link column, worn as a small straw paper tag with its// string hole (a solid tag in the palette's tag colours, in plain) — a picture's albums, each opening its page. Drawn once for any// link column holding several records (`multiple`), on any page.importCottonKitimportSwiftUI/// One linked record as a tag.structPaperTag: View { @Environment(\.theme) privatevar themelet title: Stringlet seed: Stringvar body: someView {switch theme.family {case .paper:Paper(dye: .straw, edge: .cut, seed: seed, tilt: true, inset: 0) { HStack(spacing: PaperTagKnobs.faceTagGap) {Circle() .strokeBorder(theme.print(.pencil), lineWidth: 1) .frame(width: PaperTagKnobs.faceTagDotSize, height: PaperTagKnobs.faceTagDotSize)Text(title) .paperBody(theme.scale.bodySize - 1) .lineLimit(1) } .padding(.horizontal, PaperTagKnobs.faceTagHorizontalPadding) .padding(.vertical, PaperTagKnobs.faceTagVerticalPadding) } .fixedSize()case .plain:// Plain's tags are solid: the palette's tag fill, its ink on it.let tag = Self.solid(theme) HStack(spacing: PaperTagKnobs.faceTagGap) {Circle() .strokeBorder(tag.ink.color, lineWidth: 1) .frame(width: PaperTagKnobs.faceTagDotSize, height: PaperTagKnobs.faceTagDotSize)Text(title) .font(theme.type.body(theme.scale.bodySize - 1)) .lineLimit(1) } .foregroundStyle(tag.ink.color) .padding(.horizontal, PaperTagKnobs.faceTagHorizontalPadding) .padding(.vertical, PaperTagKnobs.faceTagVerticalPadding) .background(tag.fill.color, in: RoundedRectangle(cornerRadius: theme.scale.radius * 0.5)) .fixedSize() } }/// The fill and ink a solid tag wears in `theme` — its palette's tags.staticfunc solid(_ theme: Theme) -> ThemeTags { theme.colors.tags }}/// The sizes, counts and timings PaperTag draws with: Swift's own, beside/// their reader — a theme sets only its tokens (`scale.tokens`).enumPaperTagKnobs {staticlet faceTagDotSize: CGFloat = 7staticlet faceTagGap: CGFloat = 8staticlet faceTagHorizontalPadding: CGFloat = 12staticlet faceTagVerticalPadding: CGFloat = 8}