Files
QOffice/src/types.ts
T
2026-06-04 22:24:33 +03:00

201 lines
4.5 KiB
TypeScript

export type AppId = "word" | "sheets" | "slides" | "mail";
export type WordPageSizeId = "a4" | "letter";
export type WordPageOrientation = "portrait" | "landscape";
export type WordPageMarginPreset = "normal" | "narrow" | "wide";
export type SheetPageSizeId = "a4" | "letter";
export type SheetPageOrientation = "portrait" | "landscape";
export type SheetPageMarginPreset = "normal" | "narrow" | "wide";
export interface WordPageSetup {
size: WordPageSizeId;
orientation: WordPageOrientation;
marginPreset: WordPageMarginPreset;
}
export interface SheetPageSetup {
size: SheetPageSizeId;
orientation: SheetPageOrientation;
marginPreset: SheetPageMarginPreset;
}
export interface WordDocument {
id: string;
title: string;
updatedAt: string;
html: string;
pageSetup?: WordPageSetup;
}
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>;
hiddenColumns?: Record<string, boolean>;
hiddenRows?: Record<string, boolean>;
showGridLines?: boolean;
zoomScale?: number;
printArea?: string;
pageSetup?: SheetPageSetup;
cells: Record<string, string>;
mergedCells?: MergedCellRange[];
hyperlinks?: Record<string, string>;
comments?: 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 type SlideSizeId = "wide" | "standard";
export interface SlideDeck {
id: string;
title: string;
updatedAt: string;
activeSlideId: string;
slideSize?: SlideSizeId;
slides: Slide[];
}
export interface Slide {
id: string;
title: string;
titleHyperlink?: string;
subtitle: string;
subtitleHyperlink?: string;
subtitleListStyle?: SlideListStyle;
notes: string;
theme: "classic" | "ocean" | "graphite";
hidden?: boolean;
transition?: SlideTransition;
backgroundColor?: string;
titleBold?: boolean;
titleItalics?: boolean;
titleUnderline?: boolean;
titleStrike?: boolean;
titleAlign?: SlideTextAlign;
titleColor?: string;
titleFontSize?: number;
titleFontFamily?: string;
subtitleBold?: boolean;
subtitleItalics?: boolean;
subtitleUnderline?: boolean;
subtitleStrike?: boolean;
subtitleAlign?: SlideTextAlign;
subtitleColor?: string;
subtitleFontSize?: number;
subtitleFontFamily?: string;
images?: SlideImage[];
}
export type SlideListStyle = "bullet" | "number";
export type SlideTextAlign = "left" | "center" | "right";
export type SlideTransition = "fade" | "push" | "wipe";
export interface SlideImage {
id: string;
src: string;
alt?: string;
hyperlink?: 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;
bodyHtml?: 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[];
};
}