@8btc/wujie-ppt 0.0.14-beta → 0.0.15-beta
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/dist/PPTCanvas.d.ts +2 -17
- package/dist/types/edit.d.ts +6 -6
- package/dist/types/slides.d.ts +43 -27
- package/dist/wujie-ppt.es.js +170 -164
- package/dist/wujie-ppt.umd.js +3 -3
- package/package.json +1 -1
- package/dist/hooks/useExport.util.d.ts +0 -0
package/dist/PPTCanvas.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { RawSlideJson } from './utils/import-parser';
|
|
3
|
-
import { Slide,
|
|
4
|
-
import { PresetTheme } from './configs/theme';
|
|
3
|
+
import { Slide, IPPTCanvasRef } from './types/slides';
|
|
5
4
|
|
|
6
5
|
export type SlideJsonData = RawSlideJson;
|
|
7
6
|
interface PPTCanvasProps {
|
|
@@ -12,19 +11,5 @@ interface PPTCanvasProps {
|
|
|
12
11
|
currentSlide: Slide | null;
|
|
13
12
|
}) => React.ReactNode;
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
applyThemeToAllSlides: (all?: boolean) => void;
|
|
17
|
-
applyPresetTheme: (theme: PresetTheme, applyToAllSlides: boolean) => void;
|
|
18
|
-
applyFontToAllSlides: (fontname: string) => void;
|
|
19
|
-
exportPPTX: (data: {
|
|
20
|
-
slides: Slide[];
|
|
21
|
-
theme: SlideTheme;
|
|
22
|
-
masterOverwrite?: boolean;
|
|
23
|
-
ignoreMedia?: boolean;
|
|
24
|
-
writeFile?: boolean;
|
|
25
|
-
onError?: (e: any) => void;
|
|
26
|
-
onSuccess?: (data: any) => void;
|
|
27
|
-
}) => void;
|
|
28
|
-
}
|
|
29
|
-
declare const _default: React.ForwardRefExoticComponent<PPTCanvasProps & React.RefAttributes<IRef>>;
|
|
14
|
+
declare const _default: React.ForwardRefExoticComponent<PPTCanvasProps & React.RefAttributes<IPPTCanvasRef>>;
|
|
30
15
|
export default _default;
|
package/dist/types/edit.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export interface AlignmentLineAxis {
|
|
|
45
45
|
y: number;
|
|
46
46
|
}
|
|
47
47
|
export interface AlignmentLineProps {
|
|
48
|
-
type:
|
|
48
|
+
type: "vertical" | "horizontal";
|
|
49
49
|
axis: AlignmentLineAxis;
|
|
50
50
|
length: number;
|
|
51
51
|
}
|
|
@@ -77,19 +77,19 @@ export interface CreateCustomShapeData {
|
|
|
77
77
|
outline?: PPTElementOutline;
|
|
78
78
|
}
|
|
79
79
|
export interface CreatingTextElement {
|
|
80
|
-
type:
|
|
80
|
+
type: "text";
|
|
81
81
|
vertical?: boolean;
|
|
82
82
|
}
|
|
83
83
|
export interface CreatingShapeElement {
|
|
84
|
-
type:
|
|
84
|
+
type: "shape";
|
|
85
85
|
data: ShapePoolItem;
|
|
86
86
|
}
|
|
87
87
|
export interface CreatingLineElement {
|
|
88
|
-
type:
|
|
88
|
+
type: "line";
|
|
89
89
|
data: LinePoolItem;
|
|
90
90
|
}
|
|
91
91
|
export type CreatingElement = CreatingTextElement | CreatingShapeElement | CreatingLineElement;
|
|
92
|
-
export type TextFormatPainterKeys =
|
|
92
|
+
export type TextFormatPainterKeys = "bold" | "em" | "underline" | "strikethrough" | "color" | "backcolor" | "fontsize" | "fontname" | "align";
|
|
93
93
|
export interface TextFormatPainter {
|
|
94
94
|
keep: boolean;
|
|
95
95
|
bold?: boolean;
|
|
@@ -100,7 +100,7 @@ export interface TextFormatPainter {
|
|
|
100
100
|
backcolor?: string;
|
|
101
101
|
fontsize?: string;
|
|
102
102
|
fontname?: string;
|
|
103
|
-
align?:
|
|
103
|
+
align?: "left" | "right" | "center";
|
|
104
104
|
}
|
|
105
105
|
export interface ShapeFormatPainter {
|
|
106
106
|
keep: boolean;
|
package/dist/types/slides.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { PresetTheme } from '../configs/theme';
|
|
2
|
+
|
|
1
3
|
export declare const enum ShapePathFormulasKeys {
|
|
2
4
|
ROUND_RECT = "roundRect",
|
|
3
5
|
ROUND_RECT_DIAGONAL = "roundRectDiagonal",
|
|
@@ -39,7 +41,7 @@ export declare const enum ElementTypes {
|
|
|
39
41
|
*
|
|
40
42
|
* rotate: 渐变角度(线性渐变)
|
|
41
43
|
*/
|
|
42
|
-
export type GradientType =
|
|
44
|
+
export type GradientType = "linear" | "radial";
|
|
43
45
|
export type GradientColor = {
|
|
44
46
|
pos: number;
|
|
45
47
|
color: string;
|
|
@@ -49,7 +51,7 @@ export interface Gradient {
|
|
|
49
51
|
colors: GradientColor[];
|
|
50
52
|
rotate: number;
|
|
51
53
|
}
|
|
52
|
-
export type LineStyleType =
|
|
54
|
+
export type LineStyleType = "solid" | "dashed" | "dotted";
|
|
53
55
|
/**
|
|
54
56
|
* 元素阴影
|
|
55
57
|
*
|
|
@@ -81,7 +83,7 @@ export interface PPTElementOutline {
|
|
|
81
83
|
width?: number;
|
|
82
84
|
color?: string;
|
|
83
85
|
}
|
|
84
|
-
export type ElementLinkType =
|
|
86
|
+
export type ElementLinkType = "web" | "slide";
|
|
85
87
|
/**
|
|
86
88
|
* 元素超链接
|
|
87
89
|
*
|
|
@@ -125,7 +127,7 @@ interface PPTBaseElement {
|
|
|
125
127
|
link?: PPTElementLink;
|
|
126
128
|
name?: string;
|
|
127
129
|
}
|
|
128
|
-
export type TextType =
|
|
130
|
+
export type TextType = "title" | "subtitle" | "content" | "item" | "itemTitle" | "notes" | "header" | "footer" | "partNumber" | "itemNumber";
|
|
129
131
|
/**
|
|
130
132
|
* 文本元素
|
|
131
133
|
*
|
|
@@ -156,7 +158,7 @@ export type TextType = 'title' | 'subtitle' | 'content' | 'item' | 'itemTitle' |
|
|
|
156
158
|
* textType?: 文本类型
|
|
157
159
|
*/
|
|
158
160
|
export interface PPTTextElement extends PPTBaseElement {
|
|
159
|
-
type:
|
|
161
|
+
type: "text";
|
|
160
162
|
content: string;
|
|
161
163
|
defaultFontName: string;
|
|
162
164
|
defaultColor: string;
|
|
@@ -200,14 +202,14 @@ export interface ImageOrShapeFlip {
|
|
|
200
202
|
*
|
|
201
203
|
* 'opacity'?: 不透明度,默认100(%)
|
|
202
204
|
*/
|
|
203
|
-
export type ImageElementFilterKeys =
|
|
205
|
+
export type ImageElementFilterKeys = "blur" | "brightness" | "contrast" | "grayscale" | "saturate" | "hue-rotate" | "opacity" | "sepia" | "invert";
|
|
204
206
|
export interface ImageElementFilters {
|
|
205
207
|
blur?: string;
|
|
206
208
|
brightness?: string;
|
|
207
209
|
contrast?: string;
|
|
208
210
|
grayscale?: string;
|
|
209
211
|
saturate?: string;
|
|
210
|
-
|
|
212
|
+
"hue-rotate"?: string;
|
|
211
213
|
sepia?: string;
|
|
212
214
|
invert?: string;
|
|
213
215
|
opacity?: string;
|
|
@@ -224,7 +226,7 @@ export interface ImageElementClip {
|
|
|
224
226
|
range: ImageClipDataRange;
|
|
225
227
|
shape: string;
|
|
226
228
|
}
|
|
227
|
-
export type ImageType =
|
|
229
|
+
export type ImageType = "pageFigure" | "itemFigure" | "background";
|
|
228
230
|
/**
|
|
229
231
|
* 图片元素
|
|
230
232
|
*
|
|
@@ -253,7 +255,7 @@ export type ImageType = 'pageFigure' | 'itemFigure' | 'background';
|
|
|
253
255
|
* imageType?: 图片类型
|
|
254
256
|
*/
|
|
255
257
|
export interface PPTImageElement extends PPTBaseElement {
|
|
256
|
-
type:
|
|
258
|
+
type: "image";
|
|
257
259
|
fixedRatio: boolean;
|
|
258
260
|
src: string;
|
|
259
261
|
outline?: PPTElementOutline;
|
|
@@ -266,7 +268,7 @@ export interface PPTImageElement extends PPTBaseElement {
|
|
|
266
268
|
colorMask?: string;
|
|
267
269
|
imageType?: ImageType;
|
|
268
270
|
}
|
|
269
|
-
export type ShapeTextAlign =
|
|
271
|
+
export type ShapeTextAlign = "top" | "middle" | "bottom";
|
|
270
272
|
/**
|
|
271
273
|
* 形状内文本
|
|
272
274
|
*
|
|
@@ -325,7 +327,7 @@ export interface ShapeText {
|
|
|
325
327
|
* keypoints?: 关键点位置百分比
|
|
326
328
|
*/
|
|
327
329
|
export interface PPTShapeElement extends PPTBaseElement {
|
|
328
|
-
type:
|
|
330
|
+
type: "shape";
|
|
329
331
|
viewBox: [number, number];
|
|
330
332
|
path: string;
|
|
331
333
|
fixedRatio: boolean;
|
|
@@ -342,7 +344,7 @@ export interface PPTShapeElement extends PPTBaseElement {
|
|
|
342
344
|
pathFormula?: ShapePathFormulasKeys;
|
|
343
345
|
keypoints?: number[];
|
|
344
346
|
}
|
|
345
|
-
export type LinePoint =
|
|
347
|
+
export type LinePoint = "" | "arrow" | "dot";
|
|
346
348
|
/**
|
|
347
349
|
* 线条元素
|
|
348
350
|
*
|
|
@@ -368,8 +370,8 @@ export type LinePoint = '' | 'arrow' | 'dot';
|
|
|
368
370
|
*
|
|
369
371
|
* cubic?: 三次曲线控制点位置([[x1, y1], [x2, y2]])
|
|
370
372
|
*/
|
|
371
|
-
export interface PPTLineElement extends Omit<PPTBaseElement,
|
|
372
|
-
type:
|
|
373
|
+
export interface PPTLineElement extends Omit<PPTBaseElement, "height" | "rotate"> {
|
|
374
|
+
type: "line";
|
|
373
375
|
start: [number, number];
|
|
374
376
|
end: [number, number];
|
|
375
377
|
style: LineStyleType;
|
|
@@ -381,7 +383,7 @@ export interface PPTLineElement extends Omit<PPTBaseElement, 'height' | 'rotate'
|
|
|
381
383
|
curve?: [number, number];
|
|
382
384
|
cubic?: [[number, number], [number, number]];
|
|
383
385
|
}
|
|
384
|
-
export type ChartType =
|
|
386
|
+
export type ChartType = "bar" | "column" | "line" | "pie" | "ring" | "area" | "radar" | "scatter";
|
|
385
387
|
export interface ChartOptions {
|
|
386
388
|
lineSmooth?: boolean;
|
|
387
389
|
stack?: boolean;
|
|
@@ -413,7 +415,7 @@ export interface ChartData {
|
|
|
413
415
|
* lineColor?: 网格颜色
|
|
414
416
|
*/
|
|
415
417
|
export interface PPTChartElement extends PPTBaseElement {
|
|
416
|
-
type:
|
|
418
|
+
type: "chart";
|
|
417
419
|
fill?: string;
|
|
418
420
|
chartType: ChartType;
|
|
419
421
|
data: ChartData;
|
|
@@ -423,7 +425,7 @@ export interface PPTChartElement extends PPTBaseElement {
|
|
|
423
425
|
textColor?: string;
|
|
424
426
|
lineColor?: string;
|
|
425
427
|
}
|
|
426
|
-
export type TextAlign =
|
|
428
|
+
export type TextAlign = "left" | "center" | "right" | "justify";
|
|
427
429
|
/**
|
|
428
430
|
* 表格单元格样式
|
|
429
431
|
*
|
|
@@ -512,7 +514,7 @@ export interface TableTheme {
|
|
|
512
514
|
* data: 表格数据
|
|
513
515
|
*/
|
|
514
516
|
export interface PPTTableElement extends PPTBaseElement {
|
|
515
|
-
type:
|
|
517
|
+
type: "table";
|
|
516
518
|
outline: PPTElementOutline;
|
|
517
519
|
theme?: TableTheme;
|
|
518
520
|
colWidths: number[];
|
|
@@ -537,7 +539,7 @@ export interface PPTTableElement extends PPTBaseElement {
|
|
|
537
539
|
* fixedRatio: 固定形状宽高比例
|
|
538
540
|
*/
|
|
539
541
|
export interface PPTLatexElement extends PPTBaseElement {
|
|
540
|
-
type:
|
|
542
|
+
type: "latex";
|
|
541
543
|
latex: string;
|
|
542
544
|
path: string;
|
|
543
545
|
color: string;
|
|
@@ -559,7 +561,7 @@ export interface PPTLatexElement extends PPTBaseElement {
|
|
|
559
561
|
* ext: 视频后缀,当资源链接缺少后缀时用该字段确认资源类型
|
|
560
562
|
*/
|
|
561
563
|
export interface PPTVideoElement extends PPTBaseElement {
|
|
562
|
-
type:
|
|
564
|
+
type: "video";
|
|
563
565
|
src: string;
|
|
564
566
|
autoplay: boolean;
|
|
565
567
|
poster?: string;
|
|
@@ -583,7 +585,7 @@ export interface PPTVideoElement extends PPTBaseElement {
|
|
|
583
585
|
* ext: 音频后缀,当资源链接缺少后缀时用该字段确认资源类型
|
|
584
586
|
*/
|
|
585
587
|
export interface PPTAudioElement extends PPTBaseElement {
|
|
586
|
-
type:
|
|
588
|
+
type: "audio";
|
|
587
589
|
fixedRatio: boolean;
|
|
588
590
|
color: string;
|
|
589
591
|
loop: boolean;
|
|
@@ -592,8 +594,8 @@ export interface PPTAudioElement extends PPTBaseElement {
|
|
|
592
594
|
ext?: string;
|
|
593
595
|
}
|
|
594
596
|
export type PPTElement = PPTTextElement | PPTImageElement | PPTShapeElement | PPTLineElement | PPTChartElement | PPTTableElement | PPTLatexElement | PPTVideoElement | PPTAudioElement;
|
|
595
|
-
export type AnimationType =
|
|
596
|
-
export type AnimationTrigger =
|
|
597
|
+
export type AnimationType = "in" | "out" | "attention";
|
|
598
|
+
export type AnimationTrigger = "click" | "meantime" | "auto";
|
|
597
599
|
/**
|
|
598
600
|
* 元素动画
|
|
599
601
|
*
|
|
@@ -617,8 +619,8 @@ export interface PPTAnimation {
|
|
|
617
619
|
duration: number;
|
|
618
620
|
trigger: AnimationTrigger;
|
|
619
621
|
}
|
|
620
|
-
export type SlideBackgroundType =
|
|
621
|
-
export type SlideBackgroundImageSize =
|
|
622
|
+
export type SlideBackgroundType = "solid" | "image" | "gradient";
|
|
623
|
+
export type SlideBackgroundImageSize = "cover" | "contain" | "repeat";
|
|
622
624
|
export interface SlideBackgroundImage {
|
|
623
625
|
src: string;
|
|
624
626
|
size: SlideBackgroundImageSize;
|
|
@@ -640,7 +642,7 @@ export interface SlideBackground {
|
|
|
640
642
|
image?: SlideBackgroundImage;
|
|
641
643
|
gradient?: Gradient;
|
|
642
644
|
}
|
|
643
|
-
export type TurningMode =
|
|
645
|
+
export type TurningMode = "no" | "fade" | "slideX" | "slideY" | "random" | "slideX3D" | "slideY3D" | "rotate" | "scaleY" | "scaleX" | "scale" | "scaleReverse";
|
|
644
646
|
export interface NoteReply {
|
|
645
647
|
id: string;
|
|
646
648
|
content: string;
|
|
@@ -659,7 +661,7 @@ export interface SectionTag {
|
|
|
659
661
|
id: string;
|
|
660
662
|
title?: string;
|
|
661
663
|
}
|
|
662
|
-
export type SlideType =
|
|
664
|
+
export type SlideType = "cover" | "contents" | "transition" | "content" | "end";
|
|
663
665
|
/**
|
|
664
666
|
* 幻灯片页面
|
|
665
667
|
*
|
|
@@ -715,4 +717,18 @@ export interface SlideTemplate {
|
|
|
715
717
|
cover: string;
|
|
716
718
|
origin?: string;
|
|
717
719
|
}
|
|
720
|
+
export interface IPPTCanvasRef {
|
|
721
|
+
applyThemeToAllSlides: (all?: boolean) => void;
|
|
722
|
+
applyPresetTheme: (theme: PresetTheme, applyToAllSlides: boolean) => void;
|
|
723
|
+
applyFontToAllSlides: (fontname: string) => void;
|
|
724
|
+
exportPPTX: (data: {
|
|
725
|
+
slides: Slide[];
|
|
726
|
+
theme: SlideTheme;
|
|
727
|
+
masterOverwrite?: boolean;
|
|
728
|
+
ignoreMedia?: boolean;
|
|
729
|
+
writeFile?: boolean;
|
|
730
|
+
onError?: (e: any) => void;
|
|
731
|
+
onSuccess?: (data: any) => void;
|
|
732
|
+
}) => void;
|
|
733
|
+
}
|
|
718
734
|
export {};
|