返回 oh-my-ppt
types.ts
根目录 / src / main / io / pptx-import / types.ts
1 import type { Chart, Element } from '@arcsin1/pptx2json'
2 import type { SlideAnimationPlan } from './animation-import'
3
4 export type ImportWarning = {
5 pageNumber?: number
6 message: string
7 }
8
9 export type PptxImportProgressPayload = {
10 sessionId?: string
11 stage: 'reading' | 'parsing' | 'media' | 'pages' | 'index' | 'database' | 'completed'
12 progress: number
13 label: string
14 pageNumber?: number
15 totalPages?: number
16 }
17
18 export type ImportProgress = (payload: PptxImportProgressPayload) => void
19
20 export type ImageRegistry = {
21 index: number
22 byKey: Map<string, string>
23 }
24
25 export type ImportedTableBorder = {
26 borderColor?: string
27 borderWidth?: number
28 borderType?: string
29 }
30
31 export type ImportedTableCell = {
32 text?: string
33 rowSpan?: number
34 colSpan?: number
35 vMerge?: number
36 hMerge?: number
37 fillColor?: string
38 fontColor?: string
39 fontBold?: boolean
40 vAlign?: string
41 borders?: Partial<Record<TableBorderSide, ImportedTableBorder>>
42 }
43
44 export type TableBorderSide = 'top' | 'right' | 'bottom' | 'left'
45
46 export type FlattenedElement = {
47 element: Element
48 left: number
49 top: number
50 width: number
51 height: number
52 text: string
53 }
54
55 export type TextImportAdjustment = {
56 content: string
57 extraCss: string[]
58 }
59
60 export type SlideAnimationContext = {
61 plan?: SlideAnimationPlan
62 usedAnimationIds: Set<number>
63 }
64
65 export type SvgShapeFill = {
66 defs: string[]
67 paint: string
68 content?: string
69 }
70
71 export type ZIndexCounter = {
72 value: number
73 }
74
75 export type ImportedPptxPage = {
76 pageNumber: number
77 pageId: string
78 title: string
79 htmlPath: string
80 html: string
81 contentOutline: string
82 }
83
84 export type ImportedPptxDeck = {
85 title: string
86 pageCount: number
87 indexPath: string
88 pages: ImportedPptxPage[]
89 warnings: string[]
90 }
91
92 export type PptxChartRewriteRequest = {
93 element: Chart
94 blockId: string
95 pageId: string
96 chartIndex: number
97 canvasId: string
98 frameStyle: string
99 animationAttrs: string
100 pageNumber?: number
101 }
102
103 export type PptxChartRewriteResult = {
104 config: Record<string, unknown>
105 warnings?: string[]
106 }
107
108 export type PptxChartRewriteHandler = (
109 request: PptxChartRewriteRequest
110 ) => Promise<PptxChartRewriteResult | null>
111
111 lines TYPESCRIPT