react-pptx-preview-kit 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +147 -0
- package/dist/chart-parser-OM57xOST.js +99 -0
- package/dist/index-BiEAfEne.js +29592 -0
- package/dist/index.d.ts +252 -0
- package/dist/index.js +5 -0
- package/dist/index.umd.cjs +77 -0
- package/package.json +53 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
declare interface BodyProps {
|
|
4
|
+
vertAlign: 'top' | 'middle' | 'bottom';
|
|
5
|
+
wrap: boolean;
|
|
6
|
+
lIns: number;
|
|
7
|
+
tIns: number;
|
|
8
|
+
rIns: number;
|
|
9
|
+
bIns: number;
|
|
10
|
+
autofit?: 'autofit' | 'normAutofit' | 'none';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare interface Border {
|
|
14
|
+
width: number;
|
|
15
|
+
color: string;
|
|
16
|
+
dash: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare interface BulletProps {
|
|
20
|
+
type: 'char' | 'autoNum';
|
|
21
|
+
char?: string;
|
|
22
|
+
autoNumType?: string;
|
|
23
|
+
startAt?: number;
|
|
24
|
+
color?: string;
|
|
25
|
+
fontSize?: number;
|
|
26
|
+
fontFamily?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare interface ChartNode extends NodeBase {
|
|
30
|
+
type: 'chart';
|
|
31
|
+
chartData: any;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare interface EffectProps {
|
|
35
|
+
shadow?: {
|
|
36
|
+
blur: number;
|
|
37
|
+
dx: number;
|
|
38
|
+
dy: number;
|
|
39
|
+
color: string;
|
|
40
|
+
opacity: number;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare type Fill = SolidFill | GradientFill | ImageFill | PatternFill | NoFill;
|
|
45
|
+
|
|
46
|
+
declare interface GradientFill {
|
|
47
|
+
type: 'gradient';
|
|
48
|
+
gradientType?: 'linear' | 'radial' | 'rect';
|
|
49
|
+
angle?: number;
|
|
50
|
+
stops: GradientStop[];
|
|
51
|
+
center?: {
|
|
52
|
+
l: number;
|
|
53
|
+
t: number;
|
|
54
|
+
r: number;
|
|
55
|
+
b: number;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
declare interface GradientStop {
|
|
60
|
+
position: number;
|
|
61
|
+
color: string;
|
|
62
|
+
opacity: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
declare interface GroupNode extends NodeBase {
|
|
66
|
+
type: 'group';
|
|
67
|
+
childOffset: {
|
|
68
|
+
x: number;
|
|
69
|
+
y: number;
|
|
70
|
+
};
|
|
71
|
+
childExtent: {
|
|
72
|
+
w: number;
|
|
73
|
+
h: number;
|
|
74
|
+
};
|
|
75
|
+
children: SlideNode[];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
declare interface ImageFill {
|
|
79
|
+
type: 'image';
|
|
80
|
+
src: string;
|
|
81
|
+
stretch?: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare interface NodeBase {
|
|
85
|
+
offset: {
|
|
86
|
+
x: number;
|
|
87
|
+
y: number;
|
|
88
|
+
};
|
|
89
|
+
size: {
|
|
90
|
+
w: number;
|
|
91
|
+
h: number;
|
|
92
|
+
};
|
|
93
|
+
rotate: number;
|
|
94
|
+
flipH: boolean;
|
|
95
|
+
flipV: boolean;
|
|
96
|
+
order: number;
|
|
97
|
+
phType?: string;
|
|
98
|
+
phIdx?: string;
|
|
99
|
+
effectProps?: EffectProps;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
declare interface NoFill {
|
|
103
|
+
type: 'none';
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
declare interface Paragraph {
|
|
107
|
+
runs: TextRun[];
|
|
108
|
+
props: ParagraphProps;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
declare interface ParagraphProps {
|
|
112
|
+
align: 'left' | 'center' | 'right' | 'justify';
|
|
113
|
+
indent: number;
|
|
114
|
+
marginLeft: number;
|
|
115
|
+
lineSpacing: number | null;
|
|
116
|
+
spaceBefore: number;
|
|
117
|
+
spaceAfter: number;
|
|
118
|
+
bullet: BulletProps | null;
|
|
119
|
+
level: number;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export declare function parsePptx(buffer: ArrayBuffer): Promise<PptxData>;
|
|
123
|
+
|
|
124
|
+
declare interface PatternFill {
|
|
125
|
+
type: 'pattern';
|
|
126
|
+
preset: string;
|
|
127
|
+
fgColor: string;
|
|
128
|
+
bgColor: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
declare interface PicNode extends NodeBase {
|
|
132
|
+
type: 'picture';
|
|
133
|
+
src: string;
|
|
134
|
+
srcRect: {
|
|
135
|
+
top: number;
|
|
136
|
+
right: number;
|
|
137
|
+
bottom: number;
|
|
138
|
+
left: number;
|
|
139
|
+
} | null;
|
|
140
|
+
clipGeom?: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export declare interface PptxData {
|
|
144
|
+
width: number;
|
|
145
|
+
height: number;
|
|
146
|
+
slides: SlideData[];
|
|
147
|
+
theme: ThemeData;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export declare function PptxPreview({ file }: Props): JSX_2.Element;
|
|
151
|
+
|
|
152
|
+
declare interface Props {
|
|
153
|
+
file: ArrayBuffer | null;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
declare interface RunProps {
|
|
157
|
+
fontFamily: string | null;
|
|
158
|
+
fontSize: number | null;
|
|
159
|
+
bold: boolean;
|
|
160
|
+
italic: boolean;
|
|
161
|
+
underline: boolean;
|
|
162
|
+
strikethrough: boolean;
|
|
163
|
+
color: string | null;
|
|
164
|
+
highlight: string | null;
|
|
165
|
+
baseline?: number;
|
|
166
|
+
hyperlink?: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
declare interface ShapeNode extends NodeBase {
|
|
170
|
+
type: 'shape';
|
|
171
|
+
presetGeom: string;
|
|
172
|
+
custGeomPath?: string;
|
|
173
|
+
fill: Fill;
|
|
174
|
+
border: Border | null;
|
|
175
|
+
textBody: TextBody | null;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export declare interface SlideData {
|
|
179
|
+
index: number;
|
|
180
|
+
background: Fill;
|
|
181
|
+
nodes: SlideNode[];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export declare type SlideNode = ShapeNode | PicNode | TableNode | GroupNode | ChartNode;
|
|
185
|
+
|
|
186
|
+
declare interface SolidFill {
|
|
187
|
+
type: 'solid';
|
|
188
|
+
color: string;
|
|
189
|
+
opacity: number;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
declare interface TableCell {
|
|
193
|
+
textBody: TextBody;
|
|
194
|
+
fill: Fill;
|
|
195
|
+
borders: {
|
|
196
|
+
top: Border | null;
|
|
197
|
+
right: Border | null;
|
|
198
|
+
bottom: Border | null;
|
|
199
|
+
left: Border | null;
|
|
200
|
+
};
|
|
201
|
+
margins: {
|
|
202
|
+
left: number;
|
|
203
|
+
right: number;
|
|
204
|
+
top: number;
|
|
205
|
+
bottom: number;
|
|
206
|
+
};
|
|
207
|
+
gridSpan: number;
|
|
208
|
+
rowSpan: number;
|
|
209
|
+
hMerge: boolean;
|
|
210
|
+
vMerge: boolean;
|
|
211
|
+
anchor: 'top' | 'middle' | 'bottom';
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
declare interface TableNode extends NodeBase {
|
|
215
|
+
type: 'table';
|
|
216
|
+
colWidths: number[];
|
|
217
|
+
rows: {
|
|
218
|
+
height: number;
|
|
219
|
+
cells: TableCell[];
|
|
220
|
+
}[];
|
|
221
|
+
tableFill?: Fill;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
declare interface TextBody {
|
|
225
|
+
paragraphs: Paragraph[];
|
|
226
|
+
bodyProps: BodyProps;
|
|
227
|
+
listStyle?: TextListStyle;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
declare interface TextLevelStyle {
|
|
231
|
+
pPr?: Partial<ParagraphProps>;
|
|
232
|
+
rPr?: Partial<RunProps>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
declare type TextListStyle = Record<number, TextLevelStyle>;
|
|
236
|
+
|
|
237
|
+
declare interface TextRun {
|
|
238
|
+
type: 'text' | 'break' | 'field';
|
|
239
|
+
text: string;
|
|
240
|
+
props: RunProps;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
declare interface ThemeData {
|
|
244
|
+
colorScheme: Record<string, string>;
|
|
245
|
+
colorMap: Record<string, string>;
|
|
246
|
+
fontScheme: {
|
|
247
|
+
majorFont: string;
|
|
248
|
+
minorFont: string;
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export { }
|