Cotton code
113 lines · 5.3 KB · SwiftRaw
// swift-tools-version: 6.0//// Loom — the faces' own package (Loom, 27 Oct 2026): every face a person sees,// the look it is drawn in and the plain values it is drawn from, with no// database, no core and no Rust anywhere under it. Cotton (`apps/cotton`)// depends on it by path and wires its faces to data; the Loom app draws them// from their specimens alone.//// It is a package of its own, not three more targets of `apps/cotton`'s,// because that manifest declares the core's XCFramework unconditionally// (its own header says why), so nothing in it resolves where no `.ffi`// exists. Here nothing names a binary, so `swift build` works in a bare// clone.//// THE MODULES////   CottonValues   the plain values a face draws from (the card, a record and//                  its column values, the card kinds). Foundation alone.//   CottonPaper    the look: the palette, the type, the materials, the theme//                  and the paper they are drawn on. The SDK alone.//   CottonFaces    the faces: one file per face, a folder per app (Cotton/,//                  Sharmila/, Nancy/, Rigby/, Shared/), each with its//                  specimens. Over CottonPaper and CottonValues.//   CottonSpecimens a specimen drawn: the one way a face is drawn from its//                  specimen alone, which the face shots render. Over//                  CottonFaces. (The Loom app that showed them retired, 22 Nov//                  2026.)//// Nothing here depends on anything but the SDK and these targets (guard// `scripts/__tests__/loom-imports.test.ts`).import PackageDescriptionlet package = Package(    name: "Loom",    defaultLocalization: "en",    // The floor `apps/cotton` declares: the faces run in that app, and a    // floor below it here would only let a face use less than its app has.    platforms: [.iOS("26.0"), .macOS("26.0")],    products: [        .library(name: "CottonValues", targets: ["CottonValues"]),        .library(name: "CottonPaper", targets: ["CottonPaper"]),        .library(name: "CottonFaces", targets: ["CottonFaces"]),        .library(name: "CottonSpecimens", targets: ["CottonSpecimens"]),    ],    targets: [        // The plain values a face draws from: Foundation only.        .target(            name: "CottonValues",            path: "Sources/CottonValues",            // The kit's line sets, one file per set, as the app bundles them            // (`ShellLines`). `.copy` keeps the folder whole in the bundle.            resources: [.copy("Resources/lines")]        ),        // The look, and nothing that draws a page (architect, 20 Oct 2026):        // the palette, the mark, the type roles, the print voices, the theme        // and its pictures. `CottonUI` re-exports it        // (`apps/cotton/Sources/CottonUI/CottonPaper.swift`) so the phone's        // code reads it as its own. What the app knows that the look does not        // (the manifest's flavour, a record's brand kit) the app says to it in        // the look's own plain types (`CottonUI/Theme/ThemeAppLook.swift`).        .target(            name: "CottonPaper",            path: "Sources/CottonPaper",            resources: [                // The generated palette. `.process` compiles it with actool, so                // a colour resolves through the system's own light/dark trait                // rather than through anything of ours.                .process("Generated/Palette.xcassets"),                // The photographic assets Home's project caps are made of —                // the thirteen caps and the plaster tile in both appearances.                // An image, so actool compiles it and the                // dark plaster resolves by the system trait like a colour does.                .process("Media.xcassets"),                // The bundled faces (`Fonts.swift`): `.copy` keeps the                // directory, which is how `CottonFonts.register` finds them.                .copy("Resources/Fonts"),                // The shipped themes' rows, for a process that draws before                // any core has answered — the share sheet, the tests                // (`ShippedThemes`). The `themes` of the core's catalogue                // snapshot, written beside it by the same generation and held                // equal to it by the core's guard.                .copy("Resources/Themes"),            ]        ),        // Every face, one file each, with its specimens.        .target(            name: "CottonFaces",            dependencies: ["CottonValues", "CottonPaper"],            path: "Sources/CottonFaces",            // The specimens' invented photographs and files            // (`FixturePictures`). `.copy` keeps the folder whole in the bundle.            resources: [.copy("Resources/Fixtures")]        ),        // A specimen drawn, one way for every reader: the Loom app's face        // screen, its tests and the face shots.        .target(            name: "CottonSpecimens",            dependencies: ["CottonFaces", "CottonPaper", "CottonValues"],            path: "Sources/CottonSpecimens"        ),        // Every registered specimen drawn, on a Mac, with no simulator.        .testTarget(            name: "CottonFacesTests",            dependencies: ["CottonSpecimens", "CottonFaces", "CottonPaper", "CottonValues"],            path: "Tests/CottonFacesTests"        ),    ],    swiftLanguageModes: [.v6])