feat: add e-reader device presets

- Kindle: Paperwhite 5, Paperwhite 4, Oasis 3, Scribe, Basic
- Kobo: Clara 2E, Libra 2, Sage
- reMarkable 2, Boox Note Air
- Helper to group devices by brand

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-05-13 18:07:24 -04:00
parent 496be2701f
commit c985cf4193

111
src/lib/data/devices.ts Normal file
View File

@@ -0,0 +1,111 @@
import type { Device } from '$lib/types';
export const PRESET_DEVICES: readonly Device[] = [
// Kindle
{
id: 'kindle_pw5',
brand: 'Kindle',
name: 'Paperwhite 5 (11th gen)',
width: 1236,
height: 1648,
greyLevels: 16,
outputFormat: 'png'
},
{
id: 'kindle_pw4',
brand: 'Kindle',
name: 'Paperwhite 4 (10th gen)',
width: 1072,
height: 1448,
greyLevels: 16,
outputFormat: 'png'
},
{
id: 'kindle_oasis3',
brand: 'Kindle',
name: 'Oasis 3',
width: 1264,
height: 1680,
greyLevels: 16,
outputFormat: 'png'
},
{
id: 'kindle_scribe',
brand: 'Kindle',
name: 'Scribe',
width: 1860,
height: 2480,
greyLevels: 16,
outputFormat: 'png'
},
{
id: 'kindle_basic_2022',
brand: 'Kindle',
name: 'Basic (2022)',
width: 1072,
height: 1448,
greyLevels: 16,
outputFormat: 'png'
},
// Kobo
{
id: 'kobo_clara_2e',
brand: 'Kobo',
name: 'Clara 2E',
width: 1072,
height: 1448,
greyLevels: 16,
outputFormat: 'png'
},
{
id: 'kobo_libra_2',
brand: 'Kobo',
name: 'Libra 2',
width: 1264,
height: 1680,
greyLevels: 16,
outputFormat: 'png'
},
{
id: 'kobo_sage',
brand: 'Kobo',
name: 'Sage',
width: 1440,
height: 1920,
greyLevels: 16,
outputFormat: 'png'
},
// Other
{
id: 'remarkable_2',
brand: 'reMarkable',
name: 'reMarkable 2',
width: 1404,
height: 1872,
greyLevels: 16,
outputFormat: 'png'
},
{
id: 'boox_note_air',
brand: 'Boox',
name: 'Note Air',
width: 1404,
height: 1872,
greyLevels: 16,
outputFormat: 'png'
}
];
export const DEFAULT_DEVICE = PRESET_DEVICES[0];
export function groupDevicesByBrand(devices: readonly Device[]): Map<string, Device[]> {
const grouped = new Map<string, Device[]>();
for (const device of devices) {
const existing = grouped.get(device.brand) ?? [];
existing.push(device);
grouped.set(device.brand, existing);
}
return grouped;
}