Files
QOffice/src/types.ts
T
2026-06-01 19:59:53 +03:00

154 lines
3.0 KiB
TypeScript

export type AppId = "word" | "sheets" | "slides" | "mail";
export interface WordDocument {
id: string;
title: string;
updatedAt: string;
html: string;
}
export interface Workbook {
id: string;
title: string;
updatedAt: string;
activeSheet: string;
sheets: Sheet[];
}
export interface Sheet {
id: string;
name: string;
visibility?: "hidden" | "veryHidden";
frozenPane?: SheetFrozenPane;
autoFilter?: string;
tabColor?: string;
columnWidths?: Record<string, number>;
rowHeights?: Record<string, number>;
showGridLines?: boolean;
zoomScale?: number;
printArea?: string;
cells: Record<string, string>;
mergedCells?: MergedCellRange[];
hyperlinks?: Record<string, string>;
cellFormats?: Record<string, CellFormat>;
charts?: SheetChart[];
}
export interface SheetFrozenPane {
columns?: number;
rows?: number;
topLeftCell?: string;
activePane?: "topRight" | "bottomLeft" | "bottomRight";
}
export interface CellFormat {
bold?: boolean;
italics?: boolean;
underline?: boolean;
strike?: boolean;
fontSize?: number;
fontFamily?: string;
textColor?: string;
fillColor?: string;
horizontalAlign?: "left" | "center" | "right";
verticalAlign?: "top" | "middle" | "bottom";
wrapText?: boolean;
border?: boolean;
borderColor?: string;
numberFormat?: string;
}
export interface MergedCellRange {
start: string;
end: string;
}
export type SheetChartType = "bar" | "line" | "pie";
export interface SheetChart {
id: string;
type: SheetChartType;
title: string;
labelRange: string;
valueRange: string;
}
export interface SlideDeck {
id: string;
title: string;
updatedAt: string;
activeSlideId: string;
slides: Slide[];
}
export interface Slide {
id: string;
title: string;
subtitle: string;
notes: string;
theme: "classic" | "ocean" | "graphite";
hidden?: boolean;
backgroundColor?: string;
titleColor?: string;
titleFontSize?: number;
titleFontFamily?: string;
subtitleColor?: string;
subtitleFontSize?: number;
subtitleFontFamily?: string;
images?: SlideImage[];
}
export interface SlideImage {
id: string;
src: string;
alt?: string;
x: number;
y: number;
width: number;
height: number;
}
export interface MailAttachment {
id: string;
fileName: string;
contentType: string;
size: number;
contentBase64: string;
disposition: "attachment" | "inline";
contentId?: string;
}
export interface MailMessage {
id: string;
folder: "inbox" | "sent" | "drafts" | "archive";
from: string;
to: string;
cc?: string;
bcc?: string;
replyTo?: string;
messageId?: string;
inReplyTo?: string;
references?: string;
importance?: string;
xPriority?: string;
priority?: string;
subject: string;
body: string;
time: string;
read: boolean;
flagged: boolean;
attachments?: MailAttachment[];
}
export interface QOfficeState {
activeApp: AppId;
word: WordDocument;
workbook: Workbook;
deck: SlideDeck;
mail: {
activeFolder: MailMessage["folder"];
activeMessageId: string;
messages: MailMessage[];
};
}