memories/src/types.ts

240 lines
5.1 KiB
TypeScript
Raw Normal View History

import { VueConstructor } from "vue";
2022-09-13 01:33:24 +00:00
export type IFileInfo = {
2022-11-07 21:55:11 +00:00
/** Same as fileid */
id: number;
2022-10-28 19:08:34 +00:00
/** Database file ID */
fileid: number;
/** Full file name, e.g. /pi/test/Qx0dq7dvEXA.jpg */
filename: string;
/** Original file name, e.g. /files/admin/pi/test/Qx0dq7dvEXA.jpg */
2022-10-28 21:26:56 +00:00
originalFilename?: string;
2022-10-28 19:08:34 +00:00
/** Base name of file e.g. Qx0dq7dvEXA.jpg */
basename: string;
/** Etag identifier */
etag: string;
/** File has preview available */
hasPreview: boolean;
/** File is marked favorite */
2022-10-28 21:26:56 +00:00
favorite?: boolean;
2022-10-28 19:08:34 +00:00
/** Vue flags */
flag?: number;
2022-10-28 22:46:13 +00:00
/** MIME type of file */
mime?: string;
/** WebDAV permissions string */
permissions?: string;
2022-10-28 19:08:34 +00:00
};
2022-09-13 01:33:24 +00:00
export type IDay = {
2022-10-28 19:08:34 +00:00
/** Day ID */
dayid: number;
/** Number of photos in this day */
count: number;
/** Rows in the day */
rows?: IRow[];
/** List of photos for this day */
detail?: IPhoto[];
};
2022-09-13 01:33:24 +00:00
export type IPhoto = {
2022-10-28 19:08:34 +00:00
/** Nextcloud ID of file */
fileid: number;
2022-11-01 05:16:53 +00:00
/** Vue key if duplicates present (otherwise use fileid) */
key?: string;
2022-10-28 19:08:34 +00:00
/** Etag from server */
etag?: string;
2022-10-29 00:25:39 +00:00
/** Path to file */
filename?: string;
2022-10-29 01:11:58 +00:00
/** Base name of file */
basename?: string;
/** Mime type of file */
mimetype?: string;
2022-10-28 19:08:34 +00:00
/** Bit flags */
flag: number;
/** DayID from server */
dayid?: number;
/** Width of full image */
w?: number;
/** Height of full image */
h?: number;
2022-11-22 13:04:15 +00:00
/** Live photo identifier */
liveid?: string;
2022-10-18 21:08:27 +00:00
2022-10-28 19:08:34 +00:00
/** Grid display width px */
dispW?: number;
/** Grid display height px */
dispH?: number;
/** Grid display X px */
dispX?: number;
/** Grid display Y px */
dispY?: number;
/** Grid display row id (relative to head) */
dispRowNum?: number;
2022-10-18 21:08:27 +00:00
2022-10-28 19:08:34 +00:00
/** Reference to day object */
d?: IDay;
2022-12-08 03:55:46 +00:00
/** Reference to exif object */
imageInfo?: {
h: number;
w: number;
datetaken: number;
exif?: {
Rotation?: number;
Orientation?: number;
ImageWidth?: number;
ImageHeight?: number;
Title?: string;
Description?: string;
[other: string]: unknown;
};
};
2022-10-18 21:08:27 +00:00
2022-10-28 19:08:34 +00:00
/** Face dimensions */
facerect?: IFaceRect;
2022-10-18 21:08:27 +00:00
2022-10-28 19:08:34 +00:00
/** Video flag from server */
isvideo?: boolean;
2022-11-10 03:48:03 +00:00
/** Video duration from server */
video_duration?: number;
2022-10-28 19:08:34 +00:00
/** Favorite flag from server */
isfavorite?: boolean;
/** Is this a folder */
isfolder?: boolean;
/** Is this a tag */
istag?: boolean;
/** Is this an album */
isalbum?: boolean;
/** Is this a face */
2022-12-08 21:00:53 +00:00
isface?: "recognize" | "facerecognition";
2022-10-28 19:08:34 +00:00
/** Optional datetaken epoch */
datetaken?: number;
};
2022-09-13 01:33:24 +00:00
2022-09-13 01:48:05 +00:00
export interface IFolder extends IPhoto {
2022-10-28 19:08:34 +00:00
/** Path to folder */
path: string;
2022-11-07 04:48:10 +00:00
/** Photos for preview images */
previews?: IPhoto[];
2022-10-28 19:08:34 +00:00
/** Name of folder */
name: string;
2022-09-13 01:48:05 +00:00
}
2022-10-06 23:28:35 +00:00
export interface ITag extends IPhoto {
2022-10-28 19:08:34 +00:00
/** Name of tag */
name: string;
/** Number of images in this tag */
count: number;
/** User for face if face */
user_id?: string;
/** Cache of previews */
previews?: IPhoto[];
2022-10-06 23:28:35 +00:00
}
2022-10-26 22:48:46 +00:00
export interface IAlbum extends ITag {
2022-10-28 19:08:34 +00:00
/** ID of album */
album_id: number;
/** Owner of album */
user: string;
/** Created timestamp */
created: number;
/** Location string */
location: string;
/** File ID of last added photo */
last_added_photo: number;
2022-10-26 22:48:46 +00:00
}
2022-10-18 21:08:27 +00:00
export interface IFaceRect {
2022-10-28 19:08:34 +00:00
w: number;
h: number;
x: number;
y: number;
2022-10-18 21:08:27 +00:00
}
2022-09-13 01:33:24 +00:00
export type IRow = {
2022-10-28 19:08:34 +00:00
/** Vue Recycler identifier */
id?: string;
/** Row ID from head */
num: number;
/** Day ID */
dayId: number;
/** Refrence to day object */
day: IDay;
/** Whether this is a head row */
type: IRowType;
/** [Head only] Title of the header */
name?: string;
/** [Head only] Boolean if the entire day is selected */
selected?: boolean;
/** Main list of photo items */
photos?: IPhoto[];
2022-11-12 08:20:12 +00:00
2022-10-28 19:08:34 +00:00
/** Height in px of the row */
size?: number;
/** Count of placeholders to create */
pct?: number;
2022-11-12 08:20:12 +00:00
/** Don't remove dom element */
virtualSticky?: boolean;
2022-10-28 19:08:34 +00:00
};
2022-09-15 17:49:51 +00:00
export type IHeadRow = IRow & {
2022-10-28 19:08:34 +00:00
type: IRowType.HEAD;
selected: boolean;
super?: string;
};
2022-09-15 03:52:58 +00:00
export enum IRowType {
2022-10-28 19:08:34 +00:00
HEAD = 0,
PHOTOS = 1,
FOLDERS = 2,
2022-09-15 03:52:58 +00:00
}
2022-09-13 01:33:24 +00:00
export type ITick = {
2022-10-28 19:08:34 +00:00
/** Day ID */
dayId: number;
/** Display top position */
topF: number;
/** Display top position (truncated to 1 decimal pt) */
top: number;
/** Y coordinate on recycler */
y: number;
/** Cumulative number of photos before this tick */
count: number;
/** Is a new month */
isMonth: boolean;
/** Text if any (e.g. year) */
text?: string | number;
/** Whether this tick should be shown */
s?: boolean;
/** Key for vue component */
key?: number;
};
export type TopMatter = {
2022-10-28 19:08:34 +00:00
type: TopMatterType;
};
export enum TopMatterType {
2022-10-28 19:08:34 +00:00
NONE = 0,
FOLDER = 1,
TAG = 2,
FACE = 3,
ALBUM = 4,
}
export type TopMatterFolder = TopMatter & {
2022-10-28 19:08:34 +00:00
type: TopMatterType.FOLDER;
list: {
text: string;
path: string;
}[];
};
export type ISelectionAction = {
2022-10-28 19:08:34 +00:00
/** Display text */
name: string;
/** Icon component */
icon: VueConstructor;
/** Action to perform */
callback: (selection: Map<number, IPhoto>) => Promise<void>;
/** Condition to check for including */
if?: (self?: any) => boolean;
2022-10-29 02:08:00 +00:00
/** Allow for public routes (default false) */
allowPublic?: boolean;
2022-10-28 19:08:34 +00:00
};