export type ViewMode = 'grid' | 'develop'; export type Flag = 'none' | 'pick' | 'reject'; export type ColorLabel = '' | 'red' | 'yellow' | 'green' | 'blue' | 'purple'; /** Contrast filter placed over the lens when shooting black & white film. */ export type BwFilter = 'none' | 'yellow' | 'orange' | 'red' | 'green' | 'blue'; export type CurveChannel = 'rgb' | 'red' | 'green' | 'blue'; export interface CurvePoint { x: number; y: number; } export interface CropState { /** normalized crop rect inside the straightened frame, origin top-left */ x: number; y: number; w: number; h: number; /** straighten angle in degrees */ angle: number; /** extra 90° turns applied before the straighten angle, 0–3 */ quarter: number; /** locked aspect preset id, "free" or "original" */ aspect: string; flipH: boolean; flipV: boolean; } /** * One spot-heal patch. Coordinates are normalized source-image uv (y down), * r is a fraction of the source width, and sx/sy mark the area sampled to cover * the spot. */ export interface HealSpot { x: number; y: number; r: number; /** edge softness 0–100 */ feather: number; sx: number; sy: number; } export type LocalMaskKind = 'brush' | 'linear' | 'radial' | 'raster'; /** A generated, low-resolution raster mask (auto subject / sky / background). */ export interface RasterMask { /** base64-encoded 8-bit coverage, width × height */ data: string; width: number; height: number; } export interface LocalPoint { x: number; y: number; } export interface LocalStroke { points: LocalPoint[]; /** brush radius as a fraction of the source width */ size: number; erase?: boolean; } /** One shape inside a local adjustment layer's mask group. */ export interface LocalComponent { id: string; kind: LocalMaskKind; /** How this shape combines with the shapes before it inside the layer. */ mode: 'add' | 'subtract' | 'intersect'; inverted: boolean; /** softness of the mask edge, 0–100 */ feather: number; brush: { strokes: LocalStroke[] }; linear: { x1: number; y1: number; x2: number; y2: number }; radial: { cx: number; cy: number; rx: number; ry: number }; raster?: RasterMask; } /** One non-destructive local adjustment layer. Mask geometry is in source uv. */ export interface LocalLayer { id: string; name: string; /** How the whole layer combines with the layer above it in the list. */ mode: 'add' | 'subtract' | 'intersect'; /** Shapes composited in order into this layer's mask. */ components: LocalComponent[]; /** luminance and colour limits applied on top of the shape group */ range: { enabled: boolean; lumaMin: number; lumaMax: number; hue: number; hueRange: number; satMin: number; }; /** * Per-mask RGB tone curve, applied to the masked pixels only. Identity for * masks created before this existed, so old edits keep their look. */ curve: CurvePoint[]; adjust: { exposure: number; contrast: number; highlights: number; shadows: number; whites: number; blacks: number; temp: number; tint: number; saturation: number; vibrance: number; /** hue rotation in degrees, -180–180 */ hue: number; /** detail and haze tools, applied after the global finish pass */ texture: number; clarity: number; dehaze: number; sharpen: number; }; } /** Manual perspective and lens corrections. */ export interface LensCorrections { distortion: boolean; tca: boolean; vignetting: boolean; } export interface LensProfile { /** Profile id in the bundled lens database, when it came from a search. */ id?: string; /** Maker/model and the sensor crop used for calibration. */ maker: string; model: string; crop: number; cameraMaker?: string; cameraModel?: string; corrections: LensCorrections; distance?: number; } export interface GeometryEdits { /** barrel/pincushion, -100–100 */ distortion: number; /** vertical keystone, -100–100 */ vertical: number; /** horizontal keystone, -100–100 */ horizontal: number; /** fine rotation in degrees, -15–15 */ rotate: number; /** scale in percent, 50–200; hides transformed edges */ scale: number; } /** ICC rendering intents the soft proof can build its round trip from. */ export type ProofIntent = 'perceptual' | 'relative' | 'saturation'; export interface Edits { /** relative warm/cool offset, used when `kelvin` is null */ temp: number; tint: number; /** * Scene illuminant in Kelvin, or null to use the relative Temp offset. The * gains are computed against a 5500 K daylight reference, which is also what * the demosaiced proxy is assumed to be balanced for. */ kelvin: number | null; exposure: number; /** pulls clipped highlights back into range without shifting hue */ recovery: number; contrast: number; highlights: number; shadows: number; whites: number; blacks: number; texture: number; clarity: number; dehaze: number; vibrance: number; saturation: number; /** * Redscale film response, 0–100: simulates colour film exposed through its * base, where the red-sensitive layer is hit first and blue is absorbed. */ redscale: number; bw: boolean; /** colored filter simulated in black & white mode */ bwFilter: BwFilter; /** how strongly that filter acts, 0–100 */ bwFilterAmount: number; curve: Record; /** input black/white points and midtone gamma, applied before the curves */ levels: { black: number; white: number; gamma: number }; /** region tone shaping applied on top of the point curve */ parametric: { highlights: number; lights: number; darks: number; blacks: number }; hsl: { hue: number[]; sat: number[]; lum: number[] }; grading: { shadows: { h: number; s: number }; highlights: { h: number; s: number }; balance: number; }; /** lensSoftness compensates for edge softness, 0–100 */ sharpen: { amount: number; radius: number; detail: number; mask: number; lensSoftness: number }; /** paper/output simulation for soft proofing */ proof: { enabled: boolean; paper: 'matte' | 'gloss' | 'newsprint'; blackPoint: number; gamut: boolean; /** Which ICC table pair the printer round trip is built from. */ intent: ProofIntent; }; /** * Camera profile override for a raw file, as the camera-to-sRGB matrix derived * from a DCP's ColorMatrix. Null renders with the matrix the body supplied. */ cameraProfile: { name: string; matrix: number[] } | null; /** chroma is the colour-noise amount; chromaDetail trades smoothing for fine colour */ noise: { luminance: number; detail: number; chroma: number; chromaDetail: number }; /** * Server-rendered, detail-preserving denoise. `key` is the parameter hash of a * generated asset and is null until one exists; `amount` blends it over the * source. Separate from `noise`, which is a small GPU-side filter. */ aiDenoise: { amount: number; key: string | null; model: 'guided' | 'nlm' | 'scunet' }; /** fringe removal amounts for the two casts lens CA produces */ defringe: { purple: number; green: number }; /** spot healing, applied to the source before grading */ heal: HealSpot[]; /** local adjustment layers, composited after the global grade */ local: LocalLayer[]; /** lens distortion and perspective correction, applied while sampling */ geometry: GeometryEdits; /** optional Lensfun calibration profile; focal/aperture come from the photo */ lens?: LensProfile; vignette: { amount: number; midpoint: number; feather: number }; /** roughness leans from creamy clumps (0) to crisp per-pixel bite (100) */ grain: { amount: number; size: number; roughness: number }; crop: CropState; } export interface PhotoMeta { camera?: string; lens?: string; iso?: number; aperture?: number; shutter?: string; focal?: number; } export interface HistoryEntry { label: string; ts: number; edits: Edits; } export interface Snapshot { id: string; name: string; ts: number; edits: Edits; } export interface MetadataPreset { id: string; name: string; creator?: string; copyright?: string; keywords: string[]; } export interface SmartCollection { id: string; name: string; filters: Filters; eventId?: string; sort: SortKey; asc: boolean; } export interface MergeInfo { kind: 'hdr' | 'panorama' | 'focus'; sourceIds: string[]; } export interface PhotoRecord { id: string; eventId: string; /** manual sort position inside the event */ order?: number; name: string; width: number; height: number; size: number; mime: string; addedAt: number; takenAt?: number; meta: PhotoMeta; thumb: string; rating: number; /** set when the photo sits in the trash; cleared on restore */ deletedAt?: number; flag: Flag; color: ColorLabel; keywords: string[]; title?: string; caption?: string; creator?: string; copyright?: string; /** virtual copies point at the master but keep their own edits */ copyOf?: string; copyName?: string; snapshots?: Snapshot[]; /** set on files generated by HDR / panorama / focus merge */ merge?: MergeInfo; edits: Edits; history: HistoryEntry[]; /** true when the original is a camera raw decoded by the server */ raw?: boolean; /** how the editable proxy was produced */ decode?: 'libraw' | 'embedded' | 'sharp'; /** server URL for the editable proxy (raw only) */ previewUrl?: string; /** server URL for the grid thumbnail */ thumbUrl?: string; /** Bumped when the stored RAW is re-decoded, to invalidate cached previews. */ previewVersion?: number; /** Bytes of the server-written editable proxy (raw and TIFF imports). */ proxyBytes?: number; /** set when this photo was imported from an Immich album */ immich?: { albumId: string; assetId: string; checksum: string }; /** timestamp of the last rendered client proof published to the server */ proofAt?: number; /** Account this cached record belongs to (server workspaces). */ workspace?: string; /** Set when the photo is proxied from a dashboard bridge session. */ bridgeSource?: { sessionId: string; sourceId: string }; /** Photos sharing a stack id collapse to their lowest-index member. */ stackId?: string; stackIndex?: number; } export interface EventRecord { id: string; name: string; date?: number; createdAt: number; notes?: string; /** sidebar position */ order?: number; /** Account this cached record belongs to (server workspaces). */ workspace?: string; /** Set when this event mirrors an Immich album. */ immich?: { albumId: string; albumName: string; serverUrl: string; lastSyncAt: number; }; /** Set when this event is a temporary import from the dashboard bridge. */ bridge?: { sessionId: string; sourceEventId: string; /** Where "Back to dashboard" goes. */ dashboardUrl: string; expiresAt: number; }; } export interface Filters { minRating: number; flag: Flag | 'any'; colors: ColorLabel[]; text: string; editedOnly: boolean; unrated: boolean; /** only photos picked by a client in a proofing gallery */ proofed: boolean; /** client approval state from the proofing gallery */ clientStatus: 'any' | 'approved' | 'changes'; } export type SortKey = 'taken' | 'added' | 'name' | 'rating' | 'custom'; export interface Preset { id: string; name: string; /** brand for film stocks, sub-collection for creative looks */ group: string; /** top-level browser category, e.g. "Colour Negative" or "Portrait" */ category?: string; /** one-line description of the look, shown in the preset browser */ description?: string; /** free-text search terms */ tags?: string[]; /** present only on film emulations; drives the push/pull variants */ film?: { speed?: number; process?: string }; edits: Partial>; custom?: boolean; }