// The pure half of `scripts/derive-icons.ts` — the macOS iconset's members and// the geometry of the app tile. Kept apart from the sharp/iconutil plumbing so// the naming contract (which `iconutil` enforces silently, by producing an// icns missing a size) is testable without rendering anything.exportinterfaceIconsetEntry {/** The file name `iconutil` expects inside a `.iconset` directory. */ file: string;/** Its side in real pixels — an `@2x` entry is twice its nominal point size. */ pixels: number;}/** Point sizes macOS asks for; each contributes a 1x and a 2x member. */const POINT_SIZES = [16, 32, 128, 256, 512] asconst;/** * Every member of the iconset, in the order `iconutil` lists them. * * The names are a contract, not a convention: `iconutil` skips a file it does * not recognise WITHOUT an error, so a typo ships an icon that is crisp in the * Dock and blurry in Finder's list view. */exportfunction iconsetEntries(): IconsetEntry[] {return POINT_SIZES.flatMap((points) => [ { file: `icon_${points}x${points}.png`, pixels: points }, { file: `icon_${points}x${points}@2x.png`, pixels: points * 2 }, ]);}exportinterfaceTileGeometry {/** Corner radius of the graphite tile. */ radius: number;/** Side of the square box the logo is fitted inside, centred. */ logoBox: number;}/** The Big Sur superellipse is close enough to a 22.5%-radius rounded square. */const RADIUS_RATIO = 0.225;/** The logo occupies the middle 62%, leaving the margin macOS icons all share. */const LOGO_RATIO = 0.62;/** * Tile geometry for a given side, both values rounded to whole pixels — a * fractional radius at 16px renders as a soft smear rather than a corner. */exportfunction tileGeometry(side: number): TileGeometry {return { radius: Math.round(side * RADIUS_RATIO), logoBox: Math.round(side * LOGO_RATIO), };}/** Centre offset for a `width`×`height` image on a `side`×`side` canvas. */exportfunction centreOffset(side: number, width: number, height: number): { left: number; top: number } {return { left: Math.round((side - width) / 2), top: Math.round((side - height) / 2), };}