41 lines
769 B
TypeScript
41 lines
769 B
TypeScript
|
|
export interface DeviceModel {
|
||
|
|
name: string;
|
||
|
|
label: string;
|
||
|
|
description: string;
|
||
|
|
width: number;
|
||
|
|
height: number;
|
||
|
|
colors: number;
|
||
|
|
bit_depth: number;
|
||
|
|
scale_factor: number;
|
||
|
|
rotation: number;
|
||
|
|
mime_type: string;
|
||
|
|
offset_x: number;
|
||
|
|
offset_y: number;
|
||
|
|
kind: string;
|
||
|
|
palette_ids: string[];
|
||
|
|
preview_white_point: string;
|
||
|
|
image_size_limit: number;
|
||
|
|
image_upload_supported: boolean;
|
||
|
|
css: {
|
||
|
|
classes: {
|
||
|
|
device: string;
|
||
|
|
size: string;
|
||
|
|
density: string;
|
||
|
|
};
|
||
|
|
|
||
|
|
variables: [string, string][];
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
export const devices: DeviceModel[] = (
|
||
|
|
(await (
|
||
|
|
await fetch(
|
||
|
|
(globalThis as any).document
|
||
|
|
? '/api/models'
|
||
|
|
: 'https://trmnl.com/api/models'
|
||
|
|
)
|
||
|
|
).json()) as {
|
||
|
|
data: DeviceModel[];
|
||
|
|
}
|
||
|
|
).data;
|