@betteroffice/pptx 0.1.0 → 0.2.0
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 +145 -8
- package/dist/generated/pptx_wasm_bg.wasm +0 -0
- package/dist/index.d.ts +762 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ interface TextStyleSnapshot {
|
|
|
18
18
|
underline: string | null;
|
|
19
19
|
spacingPt?: number | null;
|
|
20
20
|
baselinePct?: number | null;
|
|
21
|
+
/** `a:rPr@cap`: how the run is cased when drawn, never in the stored text. */
|
|
22
|
+
caps?: 'none' | 'small' | 'all' | null;
|
|
21
23
|
}
|
|
22
24
|
interface TextRunSnapshot {
|
|
23
25
|
text: string;
|
|
@@ -37,6 +39,30 @@ interface StorySnapshot {
|
|
|
37
39
|
length: number;
|
|
38
40
|
paragraphs: ParagraphSnapshot[];
|
|
39
41
|
}
|
|
42
|
+
interface PptxTextSearchOptions {
|
|
43
|
+
/** Defaults to false. */
|
|
44
|
+
caseSensitive?: boolean;
|
|
45
|
+
/** Maximum matches; unlimited by default. */
|
|
46
|
+
limit?: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A caret position in a story that later edits, undo, redo and remote updates
|
|
50
|
+
* move along with the text. Plain data; `position` is opaque.
|
|
51
|
+
*/
|
|
52
|
+
interface PptxCaretAnchor {
|
|
53
|
+
storyId: string;
|
|
54
|
+
position: string;
|
|
55
|
+
}
|
|
56
|
+
/** Zero-based slide index; story-local UTF-16 offsets. */
|
|
57
|
+
interface PptxTextMatch {
|
|
58
|
+
slideIndex: number;
|
|
59
|
+
slideId: string;
|
|
60
|
+
shapeId: string;
|
|
61
|
+
storyId: string;
|
|
62
|
+
start: number;
|
|
63
|
+
end: number;
|
|
64
|
+
text: string;
|
|
65
|
+
}
|
|
40
66
|
type ShapeKind = 'shape' | 'picture' | 'graphicFrame' | 'group';
|
|
41
67
|
interface ColorValue {
|
|
42
68
|
rgb?: string;
|
|
@@ -44,17 +70,40 @@ interface ColorValue {
|
|
|
44
70
|
themeTint?: string;
|
|
45
71
|
themeShade?: string;
|
|
46
72
|
auto?: boolean;
|
|
73
|
+
luminanceModulation?: number;
|
|
74
|
+
luminanceOffset?: number;
|
|
75
|
+
saturationModulation?: number;
|
|
76
|
+
alpha?: number;
|
|
47
77
|
}
|
|
78
|
+
interface ShapeGradient {
|
|
79
|
+
type: string;
|
|
80
|
+
angle?: number;
|
|
81
|
+
stops: Array<{
|
|
82
|
+
position: number;
|
|
83
|
+
color: ColorValue;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
/** An authored fill as the deck stores it. */
|
|
48
87
|
interface ShapeFill {
|
|
49
88
|
type: string;
|
|
50
89
|
color?: ColorValue;
|
|
90
|
+
gradient?: ShapeGradient;
|
|
91
|
+
}
|
|
92
|
+
interface ShapeLineEnd {
|
|
93
|
+
type: string;
|
|
94
|
+
width: string | null;
|
|
95
|
+
length: string | null;
|
|
51
96
|
}
|
|
97
|
+
/** An authored outline as the deck stores it; `width` is EMU. */
|
|
52
98
|
interface ShapeOutline {
|
|
53
99
|
width?: number;
|
|
54
100
|
color?: ColorValue;
|
|
101
|
+
gradient?: ShapeGradient;
|
|
55
102
|
style?: string;
|
|
56
103
|
cap?: string;
|
|
57
104
|
join?: string;
|
|
105
|
+
headEnd?: ShapeLineEnd;
|
|
106
|
+
tailEnd?: ShapeLineEnd;
|
|
58
107
|
}
|
|
59
108
|
type BlipEffect = {
|
|
60
109
|
type: 'biLevel';
|
|
@@ -87,6 +136,8 @@ interface ShapeSnapshot {
|
|
|
87
136
|
rotationDeg: number;
|
|
88
137
|
flipH: boolean;
|
|
89
138
|
flipV: boolean;
|
|
139
|
+
/** The geometry the shape draws at, present only while it has none of its own. */
|
|
140
|
+
inherited?: InheritedGeometry | null;
|
|
90
141
|
/** Hides this shape and its descendants; omitted when false. */
|
|
91
142
|
hidden?: boolean;
|
|
92
143
|
geometry: string;
|
|
@@ -97,11 +148,26 @@ interface ShapeSnapshot {
|
|
|
97
148
|
outline: ShapeOutline | null;
|
|
98
149
|
resolvedOutlineColor: string | null;
|
|
99
150
|
mediaPartPath: string | null;
|
|
151
|
+
/** Image data added to this session, retained across saves. */
|
|
152
|
+
pendingMedia?: {
|
|
153
|
+
contentType: string;
|
|
154
|
+
base64: string;
|
|
155
|
+
} | null;
|
|
100
156
|
blipEffects?: BlipEffect[];
|
|
101
157
|
graphic: unknown | null;
|
|
102
158
|
textStories: StorySnapshot[];
|
|
103
159
|
children: ShapeSnapshot[];
|
|
104
160
|
}
|
|
161
|
+
/** The transform a placeholder takes from its layout or master. */
|
|
162
|
+
interface InheritedGeometry {
|
|
163
|
+
x: number;
|
|
164
|
+
y: number;
|
|
165
|
+
width: number;
|
|
166
|
+
height: number;
|
|
167
|
+
rotationDeg: number;
|
|
168
|
+
flipH: boolean;
|
|
169
|
+
flipV: boolean;
|
|
170
|
+
}
|
|
105
171
|
interface SlideSnapshot {
|
|
106
172
|
id: string;
|
|
107
173
|
sourcePartPath: string | null;
|
|
@@ -149,6 +215,12 @@ interface ShapeReceipt {
|
|
|
149
215
|
shapeId: string;
|
|
150
216
|
index: number;
|
|
151
217
|
}
|
|
218
|
+
interface ShapeZOrderReceipt {
|
|
219
|
+
slideId: string;
|
|
220
|
+
shapeId: string;
|
|
221
|
+
fromIndex: number;
|
|
222
|
+
toIndex: number;
|
|
223
|
+
}
|
|
152
224
|
interface ShapeRect {
|
|
153
225
|
x: number;
|
|
154
226
|
y: number;
|
|
@@ -179,6 +251,14 @@ interface PresetShapeDraft {
|
|
|
179
251
|
rect: ShapeRect;
|
|
180
252
|
fill?: string | null;
|
|
181
253
|
}
|
|
254
|
+
interface PictureDraft {
|
|
255
|
+
name: string;
|
|
256
|
+
rect: ShapeRect;
|
|
257
|
+
/** The image's MIME type, e.g. `image/png`. */
|
|
258
|
+
contentType: string;
|
|
259
|
+
/** The image bytes, base64-encoded. */
|
|
260
|
+
mediaBase64: string;
|
|
261
|
+
}
|
|
182
262
|
interface ShapeStroke {
|
|
183
263
|
color?: string;
|
|
184
264
|
widthPt?: number;
|
|
@@ -205,6 +285,31 @@ interface HistoryResult {
|
|
|
205
285
|
applied: boolean;
|
|
206
286
|
snapshot: DeckSnapshot;
|
|
207
287
|
}
|
|
288
|
+
/** Renderer stage latencies of one profiled slide layout, in ms. */
|
|
289
|
+
interface LayoutProfile {
|
|
290
|
+
scopeMs: number;
|
|
291
|
+
layoutMs: number;
|
|
292
|
+
serializeMs: number;
|
|
293
|
+
}
|
|
294
|
+
interface ProfiledLayout {
|
|
295
|
+
layout: SlideDisplayList;
|
|
296
|
+
profile: LayoutProfile;
|
|
297
|
+
}
|
|
298
|
+
/** Boundary stage latencies of one profiled edit, in ms. */
|
|
299
|
+
interface EditProfile {
|
|
300
|
+
parseMs: number;
|
|
301
|
+
applyMs: number;
|
|
302
|
+
serializeMs: number;
|
|
303
|
+
}
|
|
304
|
+
interface HistoryProfile {
|
|
305
|
+
undoMs: number;
|
|
306
|
+
snapshotMs: number;
|
|
307
|
+
serializeMs: number;
|
|
308
|
+
}
|
|
309
|
+
interface Profiled<T, P = EditProfile> {
|
|
310
|
+
receipt: T;
|
|
311
|
+
profile: P;
|
|
312
|
+
}
|
|
208
313
|
interface PptxFontFace {
|
|
209
314
|
family: string;
|
|
210
315
|
bold?: boolean;
|
|
@@ -259,11 +364,17 @@ interface Stroke {
|
|
|
259
364
|
width: number;
|
|
260
365
|
dashed?: boolean;
|
|
261
366
|
paint?: Paint;
|
|
367
|
+
join?: 'round' | 'bevel' | 'miter';
|
|
262
368
|
headEnd?: StrokeEnd;
|
|
263
369
|
tailEnd?: StrokeEnd;
|
|
264
370
|
}
|
|
265
371
|
/** An `a:outerShdw`: a blurred copy of the shape's own path, offset and tinted. */
|
|
266
372
|
interface Shadow {
|
|
373
|
+
paths?: Array<{
|
|
374
|
+
path: GeometryPathCommand[];
|
|
375
|
+
fill: boolean;
|
|
376
|
+
stroke?: Stroke;
|
|
377
|
+
}>;
|
|
267
378
|
color: string;
|
|
268
379
|
blur?: number;
|
|
269
380
|
dx?: number;
|
|
@@ -290,6 +401,8 @@ interface ShapePrimitive extends PrimitiveBase {
|
|
|
290
401
|
name: string;
|
|
291
402
|
geometry: string;
|
|
292
403
|
path: GeometryPathCommand[];
|
|
404
|
+
/** A rectangle substitutes for the authored outline or clip. */
|
|
405
|
+
geometryFallback?: boolean;
|
|
293
406
|
clip?: GeometryPathCommand[];
|
|
294
407
|
evenOdd?: boolean;
|
|
295
408
|
adjustValues?: Record<string, number>;
|
|
@@ -303,6 +416,9 @@ type ImageEffect = {
|
|
|
303
416
|
threshold: number;
|
|
304
417
|
} | {
|
|
305
418
|
kind: 'grayscale';
|
|
419
|
+
} | {
|
|
420
|
+
kind: 'alpha';
|
|
421
|
+
amount: number;
|
|
306
422
|
} | {
|
|
307
423
|
kind: 'luminance';
|
|
308
424
|
brightness: number;
|
|
@@ -331,8 +447,15 @@ interface ImagePrimitive extends PrimitiveBase {
|
|
|
331
447
|
effects?: ImageEffect[];
|
|
332
448
|
/** Fraction of the source discarded per edge, from `a:srcRect`. */
|
|
333
449
|
crop?: ImageCrop;
|
|
450
|
+
/** `a:tile`: repeat the picture at its own size, scaled by these fractions. */
|
|
451
|
+
tile?: {
|
|
452
|
+
scaleX: number;
|
|
453
|
+
scaleY: number;
|
|
454
|
+
};
|
|
334
455
|
/** Outline the picture is masked to, when its `spPr` gives it one. */
|
|
335
456
|
path?: GeometryPathCommand[];
|
|
457
|
+
/** A rectangle substitutes for the authored mask. */
|
|
458
|
+
geometryFallback?: boolean;
|
|
336
459
|
stroke?: Stroke;
|
|
337
460
|
shadow?: Shadow;
|
|
338
461
|
}
|
|
@@ -395,6 +518,8 @@ interface TextBoxPrimitive extends PrimitiveBase {
|
|
|
395
518
|
}>;
|
|
396
519
|
lines: PositionedTextLine[];
|
|
397
520
|
overflow?: boolean;
|
|
521
|
+
/** `a:rPr/a:effectLst`: the shadow the box's glyphs are drawn with. */
|
|
522
|
+
textShadow?: Shadow;
|
|
398
523
|
}
|
|
399
524
|
interface PlaceholderPrimitive extends PrimitiveBase {
|
|
400
525
|
kind: 'placeholder';
|
|
@@ -544,6 +669,13 @@ declare function paintSlide(ctx: CanvasRenderingContext2D, list: SlideDisplayLis
|
|
|
544
669
|
|
|
545
670
|
/** Convert presentation image formats that browsers cannot decode. */
|
|
546
671
|
declare function presentationImageBlob(bytes: Uint8Array): Blob;
|
|
672
|
+
/** Media the `<img>` element must decode, because `createImageBitmap` is not portable for it. */
|
|
673
|
+
declare function needsElementDecode(blob: Blob): boolean;
|
|
674
|
+
/**
|
|
675
|
+
* Decode presentation media for the canvas backend, rejecting with
|
|
676
|
+
* `errorMessage` when the browser will not decode it.
|
|
677
|
+
*/
|
|
678
|
+
declare function decodePresentationImage(bytes: Uint8Array, errorMessage: string): Promise<CanvasImageSource>;
|
|
547
679
|
|
|
548
680
|
interface SlideToPngOptions {
|
|
549
681
|
/** Output scale, e.g. 2 for hidpi. */
|
|
@@ -712,10 +844,566 @@ declare function presenceColorForClientId(clientId: number): string;
|
|
|
712
844
|
|
|
713
845
|
type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
714
846
|
|
|
847
|
+
/**
|
|
848
|
+
* Result envelopes shared by the formats' host edit APIs. Targets, steps, receipts and failure
|
|
849
|
+
* codes stay format-owned; these shapes only fix how every format reports success and refusal.
|
|
850
|
+
*/
|
|
851
|
+
/** Why a host operation was refused, as data. The document is unchanged. */
|
|
852
|
+
interface OperationFailure<Code extends string, Target> {
|
|
853
|
+
code: Code;
|
|
854
|
+
/** The request step that failed, when one did. */
|
|
855
|
+
stepIndex?: number;
|
|
856
|
+
/** The earlier step an `overlapping-steps` failure conflicts with. */
|
|
857
|
+
conflictingStepIndex?: number;
|
|
858
|
+
/** The failing step's target as requested or resolved. */
|
|
859
|
+
target?: Target;
|
|
860
|
+
message: string;
|
|
861
|
+
}
|
|
862
|
+
/** A policy refusal carrying the version the document is still at. */
|
|
863
|
+
interface OperationRefusal<Failure> {
|
|
864
|
+
ok: false;
|
|
865
|
+
version: string;
|
|
866
|
+
failure: Failure;
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* An accepted edit request. `applied` is false when every step was a no-op; the version then
|
|
870
|
+
* stays `baseVersion` and no history or change notification was produced.
|
|
871
|
+
*/
|
|
872
|
+
interface EditSuccess<Receipt> {
|
|
873
|
+
ok: true;
|
|
874
|
+
baseVersion: string;
|
|
875
|
+
version: string;
|
|
876
|
+
applied: boolean;
|
|
877
|
+
/** One receipt per request step, in request order. */
|
|
878
|
+
receipts: Receipt[];
|
|
879
|
+
}
|
|
880
|
+
/** A validated edit request. Validation reserves nothing and cannot be committed later. */
|
|
881
|
+
interface ValidationSuccess<Preview> {
|
|
882
|
+
ok: true;
|
|
883
|
+
baseVersion: string;
|
|
884
|
+
wouldApply: boolean;
|
|
885
|
+
previews: Preview[];
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* Versioned reads and version-checked edit batches over one presentation session. Every shape
|
|
890
|
+
* here is plain JSON so it can cross a worker boundary unchanged; the semantics live in Rust.
|
|
891
|
+
*
|
|
892
|
+
* Text offsets are half-open, story-local UTF-16 positions. A story reads as its paragraphs'
|
|
893
|
+
* text joined by `\n` with no trailing separator; soft line breaks read as `\n` too, and
|
|
894
|
+
* `PptxParagraphText` tells them apart. Slide, shape, story and paragraph ids anchor targets
|
|
895
|
+
* within one session; they are not promised to survive save and reopen.
|
|
896
|
+
*/
|
|
897
|
+
|
|
898
|
+
/** Provenance only: it selects neither permissions nor history. */
|
|
899
|
+
type PptxEditSource = 'host' | 'agent';
|
|
900
|
+
/** `separate`: exactly one undo step. `none`: outside undo history, keeping existing entries. */
|
|
901
|
+
type PptxEditHistory = 'separate' | 'none';
|
|
902
|
+
interface PptxSlideTarget {
|
|
903
|
+
slideId: string;
|
|
904
|
+
}
|
|
905
|
+
/** A shape addressed through the slide that owns it. */
|
|
906
|
+
interface PptxShapeTarget extends PptxSlideTarget {
|
|
907
|
+
shapeId: string;
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* A text story addressed through its slide and owning shape. Targets reject unknown fields, so
|
|
911
|
+
* copy the ids off a read record rather than passing the record itself.
|
|
912
|
+
*/
|
|
913
|
+
interface PptxStoryTarget extends PptxShapeTarget {
|
|
914
|
+
storyId: string;
|
|
915
|
+
}
|
|
916
|
+
interface PptxTextRange extends PptxStoryTarget {
|
|
917
|
+
start: number;
|
|
918
|
+
end: number;
|
|
919
|
+
}
|
|
920
|
+
/** An explicit range, or the one exact, case-sensitive, paragraph-local match of `text`. */
|
|
921
|
+
type PptxTextTarget = ({
|
|
922
|
+
kind: 'range';
|
|
923
|
+
} & PptxTextRange) | {
|
|
924
|
+
kind: 'search';
|
|
925
|
+
within: PptxStoryTarget;
|
|
926
|
+
text: string;
|
|
927
|
+
};
|
|
928
|
+
/** Refuses the step unless its target currently reads exactly `text`. */
|
|
929
|
+
interface PptxTextGuard {
|
|
930
|
+
text: string;
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* One batch step. Insertion, replacement and deletion stay inside one paragraph; formatting and
|
|
934
|
+
* alignment may span paragraphs of one story. Geometry, fill and outline steps address shapes at
|
|
935
|
+
* the top of a slide, and fill and outline only preset shapes.
|
|
936
|
+
*/
|
|
937
|
+
type PptxEditStep = {
|
|
938
|
+
op: 'insertText';
|
|
939
|
+
target: PptxTextTarget;
|
|
940
|
+
at: 'start' | 'end';
|
|
941
|
+
text: string;
|
|
942
|
+
expect?: PptxTextGuard;
|
|
943
|
+
} | {
|
|
944
|
+
op: 'replaceText';
|
|
945
|
+
target: PptxTextTarget;
|
|
946
|
+
text: string;
|
|
947
|
+
expect?: PptxTextGuard;
|
|
948
|
+
} | {
|
|
949
|
+
op: 'deleteText';
|
|
950
|
+
target: PptxTextTarget;
|
|
951
|
+
expect?: PptxTextGuard;
|
|
952
|
+
} | {
|
|
953
|
+
op: 'formatText';
|
|
954
|
+
target: PptxTextTarget;
|
|
955
|
+
patch: TextStylePatch;
|
|
956
|
+
expect?: PptxTextGuard;
|
|
957
|
+
} | {
|
|
958
|
+
op: 'setParagraphAlignment';
|
|
959
|
+
target: PptxTextTarget;
|
|
960
|
+
/** `null` restores the inherited alignment. */
|
|
961
|
+
alignment: ParagraphAlignment | null;
|
|
962
|
+
expect?: PptxTextGuard;
|
|
963
|
+
} | {
|
|
964
|
+
op: 'setSlideNotes';
|
|
965
|
+
target: PptxSlideTarget;
|
|
966
|
+
text: string;
|
|
967
|
+
expect?: PptxTextGuard;
|
|
968
|
+
} | {
|
|
969
|
+
op: 'setShapeRect';
|
|
970
|
+
target: PptxShapeTarget;
|
|
971
|
+
rect: ShapeRect;
|
|
972
|
+
expect?: {
|
|
973
|
+
rect: ShapeRect;
|
|
974
|
+
};
|
|
975
|
+
} | {
|
|
976
|
+
op: 'setShapeFill';
|
|
977
|
+
target: PptxShapeTarget;
|
|
978
|
+
/** A `#RRGGBB` solid fill; `null` removes the fill. */
|
|
979
|
+
color: string | null;
|
|
980
|
+
/** The authored fill, as `snapshot()` reports it. */
|
|
981
|
+
expect?: {
|
|
982
|
+
fill: ShapeFill | null;
|
|
983
|
+
};
|
|
984
|
+
} | {
|
|
985
|
+
op: 'setShapeStroke';
|
|
986
|
+
target: PptxShapeTarget;
|
|
987
|
+
stroke: ShapeStroke;
|
|
988
|
+
/** The authored outline, as `snapshot()` reports it. */
|
|
989
|
+
expect?: {
|
|
990
|
+
outline: ShapeOutline | null;
|
|
991
|
+
};
|
|
992
|
+
};
|
|
993
|
+
interface PptxEditRequest {
|
|
994
|
+
/** The version the targets were read at; a changed deck refuses with `stale-version`. */
|
|
995
|
+
expectVersion: string;
|
|
996
|
+
/** Defaults to `host`. */
|
|
997
|
+
source?: PptxEditSource;
|
|
998
|
+
/** Defaults to `separate`. */
|
|
999
|
+
history?: PptxEditHistory;
|
|
1000
|
+
steps: readonly PptxEditStep[];
|
|
1001
|
+
}
|
|
1002
|
+
/** `read-only` comes only from an editor host that does not accept edits, never from a session. */
|
|
1003
|
+
type PptxEditFailureCode = 'stale-version' | 'missing-target' | 'ambiguous-target' | 'content-mismatch' | 'overlapping-steps' | 'unsupported' | 'invalid-step' | 'limit-exceeded' | 'read-only';
|
|
1004
|
+
type PptxEditTarget = PptxTextTarget | ({
|
|
1005
|
+
kind: 'story';
|
|
1006
|
+
} & PptxStoryTarget) | ({
|
|
1007
|
+
kind: 'shape';
|
|
1008
|
+
} & PptxShapeTarget) | ({
|
|
1009
|
+
kind: 'slide';
|
|
1010
|
+
} & PptxSlideTarget);
|
|
1011
|
+
type PptxEditFailure = OperationFailure<PptxEditFailureCode, PptxEditTarget>;
|
|
1012
|
+
type PptxEditRefusal = OperationRefusal<PptxEditFailure>;
|
|
1013
|
+
/** What one step did. Text targets describe the final state; a deletion reports its collapsed boundary. */
|
|
1014
|
+
interface PptxEditReceipt {
|
|
1015
|
+
stepIndex: number;
|
|
1016
|
+
changed: boolean;
|
|
1017
|
+
target: PptxEditTarget;
|
|
1018
|
+
}
|
|
1019
|
+
/** What one step would do at its resolved pre-batch target; it cannot be committed later. */
|
|
1020
|
+
interface PptxEditPreview {
|
|
1021
|
+
stepIndex: number;
|
|
1022
|
+
target: PptxEditTarget;
|
|
1023
|
+
wouldChange: boolean;
|
|
1024
|
+
}
|
|
1025
|
+
type PptxEditResult = (EditSuccess<PptxEditReceipt> & {
|
|
1026
|
+
source: PptxEditSource;
|
|
1027
|
+
changedSlides: string[];
|
|
1028
|
+
changedStories: string[];
|
|
1029
|
+
}) | PptxEditRefusal;
|
|
1030
|
+
type PptxValidationResult = ValidationSuccess<PptxEditPreview> | PptxEditRefusal;
|
|
1031
|
+
interface PptxReadRequest {
|
|
1032
|
+
/** Restricts the read to these slides, returned in deck order; every slide when omitted. */
|
|
1033
|
+
slideIds?: readonly string[];
|
|
1034
|
+
}
|
|
1035
|
+
/** The story offsets of a field result, such as a slide number. */
|
|
1036
|
+
interface PptxTextField {
|
|
1037
|
+
start: number;
|
|
1038
|
+
end: number;
|
|
1039
|
+
fieldType?: string;
|
|
1040
|
+
}
|
|
1041
|
+
interface PptxParagraphText {
|
|
1042
|
+
paragraphId: string;
|
|
1043
|
+
/** Story offsets of the paragraph's text; a following separator sits at `end`. */
|
|
1044
|
+
start: number;
|
|
1045
|
+
end: number;
|
|
1046
|
+
/** Story offsets of soft line breaks, which read as `\n` inside the paragraph. */
|
|
1047
|
+
lineBreaks: number[];
|
|
1048
|
+
/** Field results that text steps leave whole. */
|
|
1049
|
+
fields: PptxTextField[];
|
|
1050
|
+
/**
|
|
1051
|
+
* False when saving could not keep a field once the paragraph changes: the field is empty or
|
|
1052
|
+
* left the paragraph's unchanged leading or trailing text. Steps changing it refuse.
|
|
1053
|
+
*/
|
|
1054
|
+
editable: boolean;
|
|
1055
|
+
}
|
|
1056
|
+
interface PptxStoryText extends PptxStoryTarget {
|
|
1057
|
+
/** Paragraph texts joined by `\n`. */
|
|
1058
|
+
text: string;
|
|
1059
|
+
paragraphs: PptxParagraphText[];
|
|
1060
|
+
}
|
|
1061
|
+
type PptxReadResult = {
|
|
1062
|
+
ok: true;
|
|
1063
|
+
version: string;
|
|
1064
|
+
slides: SlideSnapshot[];
|
|
1065
|
+
stories: PptxStoryText[];
|
|
1066
|
+
} | PptxEditRefusal;
|
|
1067
|
+
/** A slide, one shape and its descendants, or one story; `storyId` needs `shapeId`. */
|
|
1068
|
+
interface PptxFindScope {
|
|
1069
|
+
slideId: string;
|
|
1070
|
+
shapeId?: string;
|
|
1071
|
+
storyId?: string;
|
|
1072
|
+
}
|
|
1073
|
+
interface PptxFindRequest {
|
|
1074
|
+
text: string;
|
|
1075
|
+
/** The whole deck when omitted. */
|
|
1076
|
+
within?: PptxFindScope;
|
|
1077
|
+
/** Defaults to 100; at most 10,000. */
|
|
1078
|
+
limit?: number;
|
|
1079
|
+
}
|
|
1080
|
+
/** One search hit; `range` is reusable as a `{ kind: 'range' }` target. */
|
|
1081
|
+
interface PptxFindMatch {
|
|
1082
|
+
text: string;
|
|
1083
|
+
range: PptxTextRange;
|
|
1084
|
+
}
|
|
1085
|
+
type PptxFindResult = {
|
|
1086
|
+
ok: true;
|
|
1087
|
+
version: string;
|
|
1088
|
+
matches: PptxFindMatch[];
|
|
1089
|
+
truncated: boolean;
|
|
1090
|
+
} | PptxEditRefusal;
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* Shapes shared by the formats' read-only structured exports. Content trees, anchors, story or
|
|
1094
|
+
* sheet selectors, diagnostic codes and limits stay format-owned; these only fix how every format
|
|
1095
|
+
* reports diagnostics, truncation and Markdown markers.
|
|
1096
|
+
*/
|
|
1097
|
+
type ExportSeverity = 'info' | 'warning' | 'error';
|
|
1098
|
+
/** Something an export omitted or could not represent, anchored where it applies. */
|
|
1099
|
+
interface ExportDiagnostic<Code extends string, Anchor> {
|
|
1100
|
+
code: Code;
|
|
1101
|
+
severity: ExportSeverity;
|
|
1102
|
+
anchor: Anchor | null;
|
|
1103
|
+
message: string;
|
|
1104
|
+
}
|
|
1105
|
+
/** Whether an export stopped at its limits before the end of the content. */
|
|
1106
|
+
interface ExportCompletion {
|
|
1107
|
+
truncated: boolean;
|
|
1108
|
+
}
|
|
1109
|
+
/** A Markdown marker comment and the anchor of the content it precedes. */
|
|
1110
|
+
interface MarkdownAnchor<Anchor> {
|
|
1111
|
+
marker: string;
|
|
1112
|
+
anchor: Anchor;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Read-only structured export of PPTX content: slides in deck order, each with its shape tree,
|
|
1117
|
+
* text stories, tables and placeholders for content the export cannot represent, every record
|
|
1118
|
+
* with the location it was read from, and diagnostics for everything omitted. Plain JSON,
|
|
1119
|
+
* produced by one Rust walker for sessions and bytes.
|
|
1120
|
+
*
|
|
1121
|
+
* Reading order is the current shape tree, depth first: slides in deck order, shapes in tree
|
|
1122
|
+
* order, a group's descendants at the group's position, table cells row by row. It is the
|
|
1123
|
+
* authored order, not a reading order inferred from geometry.
|
|
1124
|
+
*
|
|
1125
|
+
* `range` anchors are batch text targets in the story offsets of `readContent()`, so a session
|
|
1126
|
+
* export's `range` anchor can be a step's `target` at the version it was read at; `notes` and
|
|
1127
|
+
* `comment` anchors index the plain text they carry; `sourcePart` anchors address retained source
|
|
1128
|
+
* XML by element-child ordinals. Session anchors belong to the version they were read at; ids are
|
|
1129
|
+
* deterministic export-tree paths.
|
|
1130
|
+
*/
|
|
1131
|
+
|
|
1132
|
+
/** `session` anchors resolve against the returned version; `snapshot` ones against the content. */
|
|
1133
|
+
type PptxAnchorScope = 'session' | 'snapshot';
|
|
1134
|
+
/** A half-open range of UTF-16 offsets. */
|
|
1135
|
+
interface PptxTextSpan {
|
|
1136
|
+
start: number;
|
|
1137
|
+
end: number;
|
|
1138
|
+
}
|
|
1139
|
+
type PptxAnchor = {
|
|
1140
|
+
kind: 'slide';
|
|
1141
|
+
slideId: string;
|
|
1142
|
+
} | {
|
|
1143
|
+
kind: 'shape';
|
|
1144
|
+
slideId: string;
|
|
1145
|
+
shapeId: string;
|
|
1146
|
+
} | Extract<PptxTextTarget, {
|
|
1147
|
+
kind: 'range';
|
|
1148
|
+
}> | {
|
|
1149
|
+
kind: 'notes';
|
|
1150
|
+
slideId: string;
|
|
1151
|
+
range: PptxTextSpan;
|
|
1152
|
+
} | {
|
|
1153
|
+
kind: 'comment';
|
|
1154
|
+
slideId: string;
|
|
1155
|
+
commentId: string;
|
|
1156
|
+
range: PptxTextSpan;
|
|
1157
|
+
} | {
|
|
1158
|
+
kind: 'sourcePart';
|
|
1159
|
+
part: string;
|
|
1160
|
+
partSha256: string;
|
|
1161
|
+
path: number[];
|
|
1162
|
+
};
|
|
1163
|
+
/**
|
|
1164
|
+
* The retained source XML a record was seeded from: `sldId` is the owning slide's `p:sldId/@id`,
|
|
1165
|
+
* `sourceId` a shape's `cNvPr/@id`.
|
|
1166
|
+
*/
|
|
1167
|
+
interface PptxSourceProvenance {
|
|
1168
|
+
part: string;
|
|
1169
|
+
partSha256: string;
|
|
1170
|
+
path: number[];
|
|
1171
|
+
sldId: number | null;
|
|
1172
|
+
sourceId: number | null;
|
|
1173
|
+
}
|
|
1174
|
+
interface PptxStructuredContent extends ExportCompletion {
|
|
1175
|
+
schemaVersion: 1;
|
|
1176
|
+
anchorScope: PptxAnchorScope;
|
|
1177
|
+
readingOrder: 'shapeTree';
|
|
1178
|
+
included: {
|
|
1179
|
+
hiddenSlides: boolean;
|
|
1180
|
+
hiddenShapes: boolean;
|
|
1181
|
+
notes: boolean;
|
|
1182
|
+
comments: boolean;
|
|
1183
|
+
formatting: boolean;
|
|
1184
|
+
};
|
|
1185
|
+
slides: PptxExportSlide[];
|
|
1186
|
+
diagnostics: PptxExportDiagnostic[];
|
|
1187
|
+
}
|
|
1188
|
+
interface PptxExportSlide {
|
|
1189
|
+
id: string;
|
|
1190
|
+
/** Zero-based position in the current deck, hidden slides counted. */
|
|
1191
|
+
index: number;
|
|
1192
|
+
anchor: PptxAnchor;
|
|
1193
|
+
name: string | null;
|
|
1194
|
+
/**
|
|
1195
|
+
* `null` when the deck does not record it: such slides are exported with a
|
|
1196
|
+
* `visibility-unknown` diagnostic.
|
|
1197
|
+
*/
|
|
1198
|
+
hidden: boolean | null;
|
|
1199
|
+
provenance: PptxSourceProvenance | null;
|
|
1200
|
+
shapes: PptxExportShape[];
|
|
1201
|
+
notes: PptxExportNotes | null;
|
|
1202
|
+
comments: PptxExportComment[];
|
|
1203
|
+
}
|
|
1204
|
+
/** `unknown` is a shape-tree element only the source holds, anchored by its source location. */
|
|
1205
|
+
type PptxExportShapeKind = 'shape' | 'picture' | 'graphicFrame' | 'group' | 'unknown';
|
|
1206
|
+
interface PptxExportShape {
|
|
1207
|
+
id: string;
|
|
1208
|
+
anchor: PptxAnchor;
|
|
1209
|
+
kind: PptxExportShapeKind;
|
|
1210
|
+
name: string;
|
|
1211
|
+
/** Alternative-text title and description. */
|
|
1212
|
+
title: string | null;
|
|
1213
|
+
description: string | null;
|
|
1214
|
+
/** Hidden itself or through a hidden group. */
|
|
1215
|
+
hidden: boolean;
|
|
1216
|
+
placeholder: {
|
|
1217
|
+
type: string | null;
|
|
1218
|
+
index: number | null;
|
|
1219
|
+
} | null;
|
|
1220
|
+
provenance: PptxSourceProvenance | null;
|
|
1221
|
+
stories: PptxExportStory[];
|
|
1222
|
+
table: PptxExportTable | null;
|
|
1223
|
+
object: PptxExportObject | null;
|
|
1224
|
+
children: PptxExportShape[];
|
|
1225
|
+
}
|
|
1226
|
+
interface PptxExportStory {
|
|
1227
|
+
id: string;
|
|
1228
|
+
/** Spans the whole story. */
|
|
1229
|
+
anchor: PptxAnchor;
|
|
1230
|
+
paragraphs: PptxExportParagraph[];
|
|
1231
|
+
}
|
|
1232
|
+
interface PptxExportParagraph {
|
|
1233
|
+
id: string;
|
|
1234
|
+
anchor: PptxAnchor;
|
|
1235
|
+
paragraphId: string;
|
|
1236
|
+
level: number;
|
|
1237
|
+
/** The authored alignment, else the inherited one. */
|
|
1238
|
+
alignment: string | null;
|
|
1239
|
+
/** The paragraph's own bullet, as the session stores it. */
|
|
1240
|
+
bulletJson: string | null;
|
|
1241
|
+
/** The marker after inheritance and numbering; `null` for a paragraph that is no list item. */
|
|
1242
|
+
list: PptxExportList | null;
|
|
1243
|
+
runs: PptxExportRun[];
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* `character` is the authored `a:buChar` and `font` its typeface, a symbol font when the character
|
|
1247
|
+
* names a glyph slot. `marker` is the formatted number, `null` for a scheme that cannot be
|
|
1248
|
+
* formatted.
|
|
1249
|
+
*/
|
|
1250
|
+
type PptxExportList = {
|
|
1251
|
+
kind: 'bullet';
|
|
1252
|
+
character: string;
|
|
1253
|
+
font: string | null;
|
|
1254
|
+
} | {
|
|
1255
|
+
kind: 'number';
|
|
1256
|
+
scheme: string;
|
|
1257
|
+
startAt: number;
|
|
1258
|
+
value: number;
|
|
1259
|
+
marker: string | null;
|
|
1260
|
+
};
|
|
1261
|
+
type PptxExportMark = {
|
|
1262
|
+
kind: 'bold' | 'italic' | 'superscript' | 'subscript' | 'smallCaps' | 'allCaps';
|
|
1263
|
+
} | {
|
|
1264
|
+
kind: 'underline';
|
|
1265
|
+
style: string;
|
|
1266
|
+
};
|
|
1267
|
+
/** Line breaks are one `\n` unit, fields cover their cached result; unsupported runs are zero-width. */
|
|
1268
|
+
type PptxExportRun = {
|
|
1269
|
+
anchor: PptxAnchor;
|
|
1270
|
+
/** `null` when the export excludes formatting. */
|
|
1271
|
+
marks: PptxExportMark[] | null;
|
|
1272
|
+
/** A click hyperlink: an external URL, or the part an internal link jumps to. */
|
|
1273
|
+
link: {
|
|
1274
|
+
href: string;
|
|
1275
|
+
external: boolean;
|
|
1276
|
+
} | null;
|
|
1277
|
+
} & ({
|
|
1278
|
+
kind: 'text';
|
|
1279
|
+
text: string;
|
|
1280
|
+
} | {
|
|
1281
|
+
kind: 'lineBreak';
|
|
1282
|
+
}
|
|
1283
|
+
/** A field's cached result; fields are never evaluated. */
|
|
1284
|
+
| {
|
|
1285
|
+
kind: 'field';
|
|
1286
|
+
fieldType: string | null;
|
|
1287
|
+
text: string;
|
|
1288
|
+
} | {
|
|
1289
|
+
kind: 'unsupported';
|
|
1290
|
+
element: string;
|
|
1291
|
+
});
|
|
1292
|
+
/**
|
|
1293
|
+
* A table on its grid. Every source cell appears once; `merged` marks a continuation covered by
|
|
1294
|
+
* the cell at `mergeOrigin`, whose content PowerPoint does not show.
|
|
1295
|
+
*/
|
|
1296
|
+
interface PptxExportTable {
|
|
1297
|
+
columns: number;
|
|
1298
|
+
rows: Array<{
|
|
1299
|
+
cells: PptxExportTableCell[];
|
|
1300
|
+
}>;
|
|
1301
|
+
}
|
|
1302
|
+
interface PptxExportTableCell {
|
|
1303
|
+
id: string;
|
|
1304
|
+
anchor: PptxAnchor;
|
|
1305
|
+
row: number;
|
|
1306
|
+
column: number;
|
|
1307
|
+
gridSpan: number;
|
|
1308
|
+
rowSpan: number;
|
|
1309
|
+
merged: boolean;
|
|
1310
|
+
mergeOrigin: {
|
|
1311
|
+
row: number;
|
|
1312
|
+
column: number;
|
|
1313
|
+
} | null;
|
|
1314
|
+
story: PptxExportStory | null;
|
|
1315
|
+
}
|
|
1316
|
+
type PptxExportObjectKind = 'picture' | 'video' | 'audio' | 'chart' | 'smartArt' | 'embeddedObject' | 'unknown';
|
|
1317
|
+
/** A placeholder for content the export does not represent; its data is never included. */
|
|
1318
|
+
interface PptxExportObject {
|
|
1319
|
+
id: string;
|
|
1320
|
+
kind: PptxExportObjectKind;
|
|
1321
|
+
/** The source element's qualified name, such as `p:graphicFrame`. */
|
|
1322
|
+
element: string;
|
|
1323
|
+
uri: string | null;
|
|
1324
|
+
relationshipIds: string[];
|
|
1325
|
+
/** The package parts the object references. */
|
|
1326
|
+
parts: string[];
|
|
1327
|
+
/** Targets of its external relationships, such as a linked video. */
|
|
1328
|
+
externalTargets: string[];
|
|
1329
|
+
}
|
|
1330
|
+
/** A slide's speaker notes, as plain text. */
|
|
1331
|
+
interface PptxExportNotes {
|
|
1332
|
+
id: string;
|
|
1333
|
+
anchor: PptxAnchor;
|
|
1334
|
+
text: string;
|
|
1335
|
+
provenance: PptxSourceProvenance | null;
|
|
1336
|
+
}
|
|
1337
|
+
interface PptxExportComment {
|
|
1338
|
+
id: string;
|
|
1339
|
+
anchor: PptxAnchor;
|
|
1340
|
+
commentId: string;
|
|
1341
|
+
author: string | null;
|
|
1342
|
+
date: string | null;
|
|
1343
|
+
parentId: string | null;
|
|
1344
|
+
resolved: boolean;
|
|
1345
|
+
text: string;
|
|
1346
|
+
}
|
|
1347
|
+
type PptxExportDiagnosticCode = 'unsupported-content' | 'image-data-omitted' | 'unsupported-numbering' | 'field-cached-result' | 'provenance-unavailable' | 'visibility-unknown' | 'hidden-content-excluded' | 'stories-omitted' | 'formatting-omitted' | 'inherited-content-omitted' | 'notes-structure-omitted' | 'merge-continuation-content-omitted' | 'truncated' | 'markdown-lossy';
|
|
1348
|
+
type PptxExportDiagnostic = ExportDiagnostic<PptxExportDiagnosticCode, PptxAnchor>;
|
|
1349
|
+
/**
|
|
1350
|
+
* What to export. Hidden slides and shapes, notes and comments are excluded unless requested, and
|
|
1351
|
+
* formatting is included unless turned off. `maxBlocks` defaults to 10,000 (at most 1,000,000;
|
|
1352
|
+
* every slide, shape, paragraph, notes story and comment counts) and `maxBytes` to 8,388,608
|
|
1353
|
+
* (1,024 to 67,108,864, measured on the compact JSON).
|
|
1354
|
+
*/
|
|
1355
|
+
interface PptxExportOptions {
|
|
1356
|
+
includeHiddenSlides?: boolean;
|
|
1357
|
+
includeHiddenShapes?: boolean;
|
|
1358
|
+
includeNotes?: boolean;
|
|
1359
|
+
includeComments?: boolean;
|
|
1360
|
+
includeFormatting?: boolean;
|
|
1361
|
+
maxBlocks?: number;
|
|
1362
|
+
maxBytes?: number;
|
|
1363
|
+
}
|
|
1364
|
+
/** `maxBytes` bounds the Markdown text; the default and range are the export's. */
|
|
1365
|
+
interface PptxMarkdownOptions {
|
|
1366
|
+
maxBytes?: number;
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* Markdown rendered from structured content. Each `<!-- pptx-export:N -->` marker precedes the
|
|
1370
|
+
* record `anchors` maps it to. Markdown keeps no slide layout, geometry or typography.
|
|
1371
|
+
*/
|
|
1372
|
+
interface PptxMarkdownContent extends ExportCompletion {
|
|
1373
|
+
markdown: string;
|
|
1374
|
+
anchors: MarkdownAnchor<PptxAnchor>[];
|
|
1375
|
+
diagnostics: PptxExportDiagnostic[];
|
|
1376
|
+
}
|
|
1377
|
+
/**
|
|
1378
|
+
* Options out of range or above a hard maximum, or structured content handed to the renderer that
|
|
1379
|
+
* contradicts itself. Unsupported deck content is diagnosed, never refused.
|
|
1380
|
+
*/
|
|
1381
|
+
type PptxExportFailureCode = 'invalid-options' | 'limit-exceeded' | 'invalid-content';
|
|
1382
|
+
/** Why an export was refused; `target` is the anchor the refusal concerns, if any. */
|
|
1383
|
+
interface PptxExportFailure {
|
|
1384
|
+
code: PptxExportFailureCode;
|
|
1385
|
+
target: PptxAnchor | null;
|
|
1386
|
+
message: string;
|
|
1387
|
+
}
|
|
1388
|
+
type PptxExportRefusal = OperationRefusal<PptxExportFailure>;
|
|
1389
|
+
/** A session export: the content with the version it was read at, or a refusal. */
|
|
1390
|
+
type PptxExportResult<T> = {
|
|
1391
|
+
ok: true;
|
|
1392
|
+
version: string;
|
|
1393
|
+
content: T;
|
|
1394
|
+
} | PptxExportRefusal;
|
|
1395
|
+
/** A headless export or rendering the engine refused as data. */
|
|
1396
|
+
declare class PptxExportError extends Error {
|
|
1397
|
+
readonly failure: PptxExportFailure;
|
|
1398
|
+
constructor(failure: PptxExportFailure);
|
|
1399
|
+
}
|
|
1400
|
+
|
|
715
1401
|
type WasmInitInput = InitInput | Promise<InitInput>;
|
|
716
1402
|
interface OpenPresentationOptions {
|
|
717
1403
|
clientId?: number;
|
|
718
1404
|
fonts?: ReadonlyArray<PptxFontFace>;
|
|
1405
|
+
/** Faces drawn only for characters the run's own face has no glyph for, e.g. a script's Noto face. */
|
|
1406
|
+
fallbackFonts?: ReadonlyArray<PptxFontFace>;
|
|
719
1407
|
/**
|
|
720
1408
|
* Opens from a collaboration update instead of parsing the file bytes.
|
|
721
1409
|
* When the bytes are the file the update was seeded from, the session
|
|
@@ -724,6 +1412,7 @@ interface OpenPresentationOptions {
|
|
|
724
1412
|
*/
|
|
725
1413
|
initialUpdate?: Uint8Array;
|
|
726
1414
|
}
|
|
1415
|
+
type UndoCaptureMode = 'auto' | 'manual';
|
|
727
1416
|
interface PresentationHandle extends CollaborationReplica {
|
|
728
1417
|
isProposalsAvailable(): boolean;
|
|
729
1418
|
propose(agentId: string, note: string | null, edits: readonly ProposalEdit[]): Proposal;
|
|
@@ -738,30 +1427,78 @@ interface PresentationHandle extends CollaborationReplica {
|
|
|
738
1427
|
readonly clientId: number;
|
|
739
1428
|
snapshot(): DeckSnapshot;
|
|
740
1429
|
story(storyId: string): StorySnapshot;
|
|
1430
|
+
/** Anchors the UTF-16 caret `index` of a story so later edits move it along. */
|
|
1431
|
+
anchorCaret(storyId: string, index: number): PptxCaretAnchor;
|
|
1432
|
+
/** The anchor's current offset, or `null` once its story is gone. */
|
|
1433
|
+
resolveCaretAnchor(anchor: PptxCaretAnchor): number | null;
|
|
1434
|
+
/**
|
|
1435
|
+
* The session-scoped version token. It changes with every committed change, local or remote,
|
|
1436
|
+
* undo and redo included; compare tokens only within this session.
|
|
1437
|
+
*/
|
|
1438
|
+
version(): string;
|
|
1439
|
+
/** Slides and their stories' text, with the version they were read at. */
|
|
1440
|
+
readContent(request?: PptxReadRequest): PptxReadResult;
|
|
1441
|
+
/** Exact, case-sensitive, paragraph-local search; overlapping matches count separately. */
|
|
1442
|
+
findText(request: PptxFindRequest): PptxFindResult;
|
|
1443
|
+
/**
|
|
1444
|
+
* Structured slide content with the version it was read at, read from committed state: pending
|
|
1445
|
+
* editor input is not flushed and nothing changes. Option refusals are returned; malformed
|
|
1446
|
+
* options throw.
|
|
1447
|
+
*/
|
|
1448
|
+
exportStructured(options?: PptxExportOptions): PptxExportResult<PptxStructuredContent>;
|
|
1449
|
+
/** `exportStructured` rendered as Markdown from the same read. */
|
|
1450
|
+
exportMarkdown(options?: PptxExportOptions): PptxExportResult<PptxMarkdownContent>;
|
|
1451
|
+
/** Runs every check of `applyEdits`, staging included, without changing anything. */
|
|
1452
|
+
validateEdits(request: PptxEditRequest): PptxValidationResult;
|
|
1453
|
+
/**
|
|
1454
|
+
* Applies every step or none against `expectVersion`, as one transaction, one update and, for
|
|
1455
|
+
* `history: 'separate'`, one undo step. Policy failures are returned; malformed requests throw.
|
|
1456
|
+
*/
|
|
1457
|
+
applyEdits(request: PptxEditRequest): PptxEditResult;
|
|
1458
|
+
/** Literal search in slide order. */
|
|
1459
|
+
searchText(query: string, options?: PptxTextSearchOptions): PptxTextMatch[];
|
|
741
1460
|
registerFont(face: PptxFontFace): number;
|
|
1461
|
+
/** Registers a face drawn only where a run's own face has no glyph. */
|
|
1462
|
+
registerFallbackFont(face: PptxFontFace): number;
|
|
742
1463
|
layoutSlide(slideIndex: number): SlideDisplayList;
|
|
1464
|
+
/** `layoutSlide` with scope, layout and serialize time measured inside the renderer. */
|
|
1465
|
+
layoutSlideProfiled(slideIndex: number): ProfiledLayout;
|
|
743
1466
|
hitTest(x: number, y: number): HitTestResult | null;
|
|
744
1467
|
mediaBytes(partPath: string): Uint8Array;
|
|
745
1468
|
/** serialize the presentation back to .pptx bytes, edits included. */
|
|
746
1469
|
save(): Uint8Array;
|
|
747
1470
|
insertText(storyId: string, index: number, text: string, style?: TextStyle): TextReceipt;
|
|
1471
|
+
/** `insertText` with the boundary's stage timings attached. */
|
|
1472
|
+
insertTextProfiled(storyId: string, index: number, text: string, style?: TextStyle): Profiled<TextReceipt>;
|
|
748
1473
|
deleteText(storyId: string, start: number, end: number): TextReceipt;
|
|
1474
|
+
deleteTextProfiled(storyId: string, start: number, end: number): Profiled<TextReceipt>;
|
|
749
1475
|
formatText(storyId: string, start: number, end: number, patch: TextStylePatch): TextReceipt;
|
|
750
1476
|
insertParagraphBreak(storyId: string, index: number): TextReceipt;
|
|
751
1477
|
/** Sets the alignment of every paragraph the range touches; `null` restores
|
|
752
1478
|
* the inherited value. */
|
|
753
1479
|
setParagraphAlignment(storyId: string, start: number, end: number, alignment: ParagraphAlignment | null): TextReceipt;
|
|
754
1480
|
insertSlide(index: number, layoutPartPath?: string): SlideReceipt;
|
|
1481
|
+
insertSlideProfiled(index: number, layoutPartPath?: string): Profiled<SlideReceipt>;
|
|
755
1482
|
deleteSlide(slideId: string): SlideReceipt;
|
|
756
1483
|
moveSlide(slideId: string, toIndex: number): SlideReceipt;
|
|
757
1484
|
/** Sets a slide's speaker notes; empty text clears them. */
|
|
758
1485
|
setSlideNotes(slideId: string, text: string): void;
|
|
759
1486
|
addTextBox(slideId: string, draft: ShapeDraft): ShapeReceipt;
|
|
1487
|
+
addTextBoxProfiled(slideId: string, draft: ShapeDraft): Profiled<ShapeReceipt>;
|
|
760
1488
|
addShape(slideId: string, draft: PresetShapeDraft): ShapeReceipt;
|
|
1489
|
+
addPicture(slideId: string, draft: PictureDraft): ShapeReceipt;
|
|
761
1490
|
setShapeFill(slideId: string, shapeId: string, color: string | null): ShapeFillReceipt;
|
|
762
1491
|
setShapeStroke(slideId: string, shapeId: string, stroke: ShapeStroke): ShapeStrokeReceipt;
|
|
763
1492
|
setShapeAdjust(slideId: string, shapeId: string, adjustments: Record<string, number>): ShapeAdjustReceipt;
|
|
764
1493
|
removeShape(slideId: string, shapeId: string): ShapeReceipt;
|
|
1494
|
+
/** Moves a shape to the top of its slide's paint order (drawn last). */
|
|
1495
|
+
bringShapeToFront(slideId: string, shapeId: string): ShapeZOrderReceipt;
|
|
1496
|
+
/** Moves a shape to the bottom of its slide's paint order (drawn first). */
|
|
1497
|
+
sendShapeToBack(slideId: string, shapeId: string): ShapeZOrderReceipt;
|
|
1498
|
+
/** Swaps a shape one step later in its slide's paint order. */
|
|
1499
|
+
bringShapeForward(slideId: string, shapeId: string): ShapeZOrderReceipt;
|
|
1500
|
+
/** Swaps a shape one step earlier in its slide's paint order. */
|
|
1501
|
+
sendShapeBackward(slideId: string, shapeId: string): ShapeZOrderReceipt;
|
|
765
1502
|
/** Adds a slide comment; coordinates are EMU. */
|
|
766
1503
|
addComment(slideId: string, comment: {
|
|
767
1504
|
author: string;
|
|
@@ -780,16 +1517,27 @@ interface PresentationHandle extends CollaborationReplica {
|
|
|
780
1517
|
}): CommentReceipt;
|
|
781
1518
|
/** Resolves or reopens a modern comment. */
|
|
782
1519
|
setCommentStatus(commentId: string, resolved: boolean): CommentReceipt;
|
|
1520
|
+
/** Moves a root comment on its slide; coordinates are safe integer EMU. */
|
|
1521
|
+
setCommentPosition(commentId: string, position: {
|
|
1522
|
+
xEmu: number;
|
|
1523
|
+
yEmu: number;
|
|
1524
|
+
}): CommentReceipt;
|
|
783
1525
|
removeComment(commentId: string): CommentReceipt;
|
|
784
1526
|
/** Only legal while the deck has no comments. */
|
|
785
1527
|
setCommentFlavor(flavor: CommentFlavor): CommentFlavor;
|
|
786
1528
|
comments(): CommentSnapshot[];
|
|
787
1529
|
moveShape(slideId: string, shapeId: string, x: number, y: number): TransformReceipt;
|
|
1530
|
+
moveShapeProfiled(slideId: string, shapeId: string, x: number, y: number): Profiled<TransformReceipt>;
|
|
788
1531
|
resizeShape(slideId: string, shapeId: string, width: number, height: number): TransformReceipt;
|
|
789
1532
|
setShapeRect(slideId: string, shapeId: string, rect: ShapeRect): TransformReceipt;
|
|
790
1533
|
canUndo(): boolean;
|
|
791
1534
|
canRedo(): boolean;
|
|
1535
|
+
undoCaptureMode(): UndoCaptureMode;
|
|
1536
|
+
setUndoCaptureMode(mode: UndoCaptureMode): void;
|
|
1537
|
+
addUndoBoundary(): void;
|
|
792
1538
|
undo(): HistoryResult;
|
|
1539
|
+
/** `undo` with undo, snapshot and serialize time measured at the boundary. */
|
|
1540
|
+
undoProfiled(): Profiled<HistoryResult, HistoryProfile>;
|
|
793
1541
|
redo(): HistoryResult;
|
|
794
1542
|
encodeStateVector(): Uint8Array;
|
|
795
1543
|
encodeStateAsUpdate(remoteStateVector?: Uint8Array): Uint8Array;
|
|
@@ -803,6 +1551,19 @@ declare function initWasm(input?: WasmInitInput): Promise<void>;
|
|
|
803
1551
|
declare function isWasmAvailable(): boolean;
|
|
804
1552
|
declare function wasmVersion(): string;
|
|
805
1553
|
declare function inspectPresentation(bytes: Uint8Array): unknown;
|
|
1554
|
+
/**
|
|
1555
|
+
* Exports PPTX bytes as structured content whose anchors address the returned snapshot. No
|
|
1556
|
+
* session, DOM or font is involved. Throws `PptxExportError` for refused options and an `Error`
|
|
1557
|
+
* for bytes that are not a readable PPTX.
|
|
1558
|
+
*/
|
|
1559
|
+
declare function exportPptxStructured(bytes: Uint8Array, options?: PptxExportOptions): Promise<PptxStructuredContent>;
|
|
1560
|
+
/** `exportPptxStructured` rendered as Markdown with anchor markers. */
|
|
1561
|
+
declare function exportPptxMarkdown(bytes: Uint8Array, options?: PptxExportOptions): Promise<PptxMarkdownContent>;
|
|
1562
|
+
/**
|
|
1563
|
+
* Renders structured content (schema version 1) as Markdown. Content the renderer cannot trust
|
|
1564
|
+
* refuses with `invalid-content`.
|
|
1565
|
+
*/
|
|
1566
|
+
declare function renderPptxMarkdown(content: PptxStructuredContent, options?: PptxMarkdownOptions): Promise<PptxMarkdownContent>;
|
|
806
1567
|
declare function openPresentation(bytes: Uint8Array, options?: OpenPresentationOptions): PresentationHandle;
|
|
807
1568
|
|
|
808
|
-
export { type BlipEffect, type CanvasImageResolver, type CaretStop, CollaborationError, type CollaborationErrorCode, type CollaborationErrorListener, CollaborationProvider, type CollaborationProviderOptions, type CollaborationReplica, type CollaborationStatus, type CollaborationStatusChange, type CollaborationStatusListener, type CollaborationTransport, type CollaborationTransportEvent, type CollaborationUpdateOrigin, type CollaborationUser, type ColorValue, type CommentFlavor, type CommentReceipt, type CommentSnapshot, type DeckSnapshot, type GeometryPathCommand, type HistoryResult, type HitTestResult, type ImageCrop, type ImageEffect, type ImagePrimitive, type OpenPresentationOptions, PRESENCE_LABEL_DURATION_MS, type Paint, type PaintSlideOptions, type ParagraphAlignment, type ParagraphSnapshot, type PlaceholderPrimitive, type PositionedGlyph, type PositionedTextLine, type PositionedTextRun, type PptxFontFace, type PptxPresence, type PptxPresenceCursor, type PptxPresenceListener, type PptxPresencePeer, type PptxPresenceState, type PptxPresenceUser, type PresentationHandle, type PresetShapeDraft, type PrimitiveTransform, type Proposal, type ProposalAcceptance, type ProposalChange, type ProposalDiffSlide, type ProposalEdit, type ProposalPreview, type ProposalTextChange, type ShapeAdjustReceipt, type ShapeDraft, type ShapeFill, type ShapeFillReceipt, type ShapeKind, type ShapeOutline, type ShapePrimitive, type ShapeReceipt, type ShapeRect, type ShapeSnapshot, type ShapeStroke, type ShapeStrokeReceipt, type SlideCanvasLike, type SlideDisplayList, type SlidePrimitive, type SlideReceipt, type SlideSnapshot, type SlideToPngOptions, StaleProposalError, type StorySnapshot, type Stroke, type StrokeEnd, type TextBoxPrimitive, type TextReceipt, type TextRunSnapshot, type TextStyle, type TextStylePatch, type TextStyleSnapshot, type TransformReceipt, type UpdateEvent, type WasmInitInput, initWasm, inspectPresentation, isProposalsAvailable, isWasmAvailable, openPresentation, paintSlide, presenceColorForClientId, presentationImageBlob, sizeCanvasForSlide, slideToPng, wasmVersion };
|
|
1569
|
+
export { type BlipEffect, type CanvasImageResolver, type CaretStop, CollaborationError, type CollaborationErrorCode, type CollaborationErrorListener, CollaborationProvider, type CollaborationProviderOptions, type CollaborationReplica, type CollaborationStatus, type CollaborationStatusChange, type CollaborationStatusListener, type CollaborationTransport, type CollaborationTransportEvent, type CollaborationUpdateOrigin, type CollaborationUser, type ColorValue, type CommentFlavor, type CommentReceipt, type CommentSnapshot, type DeckSnapshot, type EditProfile, type EditSuccess, type ExportCompletion, type ExportDiagnostic, type ExportSeverity, type GeometryPathCommand, type HistoryProfile, type HistoryResult, type HitTestResult, type ImageCrop, type ImageEffect, type ImagePrimitive, type InheritedGeometry, type LayoutProfile, type MarkdownAnchor, type OpenPresentationOptions, type OperationFailure, type OperationRefusal, PRESENCE_LABEL_DURATION_MS, type Paint, type PaintSlideOptions, type ParagraphAlignment, type ParagraphSnapshot, type PictureDraft, type PlaceholderPrimitive, type PositionedGlyph, type PositionedTextLine, type PositionedTextRun, type PptxAnchor, type PptxAnchorScope, type PptxCaretAnchor, type PptxEditFailure, type PptxEditFailureCode, type PptxEditHistory, type PptxEditPreview, type PptxEditReceipt, type PptxEditRefusal, type PptxEditRequest, type PptxEditResult, type PptxEditSource, type PptxEditStep, type PptxEditTarget, type PptxExportComment, type PptxExportDiagnostic, type PptxExportDiagnosticCode, PptxExportError, type PptxExportFailure, type PptxExportFailureCode, type PptxExportList, type PptxExportMark, type PptxExportNotes, type PptxExportObject, type PptxExportObjectKind, type PptxExportOptions, type PptxExportParagraph, type PptxExportRefusal, type PptxExportResult, type PptxExportRun, type PptxExportShape, type PptxExportShapeKind, type PptxExportSlide, type PptxExportStory, type PptxExportTable, type PptxExportTableCell, type PptxFindMatch, type PptxFindRequest, type PptxFindResult, type PptxFindScope, type PptxFontFace, type PptxMarkdownContent, type PptxMarkdownOptions, type PptxParagraphText, type PptxPresence, type PptxPresenceCursor, type PptxPresenceListener, type PptxPresencePeer, type PptxPresenceState, type PptxPresenceUser, type PptxReadRequest, type PptxReadResult, type PptxShapeTarget, type PptxSlideTarget, type PptxSourceProvenance, type PptxStoryTarget, type PptxStoryText, type PptxStructuredContent, type PptxTextField, type PptxTextGuard, type PptxTextMatch, type PptxTextRange, type PptxTextSearchOptions, type PptxTextSpan, type PptxTextTarget, type PptxValidationResult, type PresentationHandle, type PresetShapeDraft, type PrimitiveTransform, type Profiled, type ProfiledLayout, type Proposal, type ProposalAcceptance, type ProposalChange, type ProposalDiffSlide, type ProposalEdit, type ProposalPreview, type ProposalTextChange, type ShapeAdjustReceipt, type ShapeDraft, type ShapeFill, type ShapeFillReceipt, type ShapeGradient, type ShapeKind, type ShapeLineEnd, type ShapeOutline, type ShapePrimitive, type ShapeReceipt, type ShapeRect, type ShapeSnapshot, type ShapeStroke, type ShapeStrokeReceipt, type ShapeZOrderReceipt, type SlideCanvasLike, type SlideDisplayList, type SlidePrimitive, type SlideReceipt, type SlideSnapshot, type SlideToPngOptions, StaleProposalError, type StorySnapshot, type Stroke, type StrokeEnd, type TextBoxPrimitive, type TextReceipt, type TextRunSnapshot, type TextStyle, type TextStylePatch, type TextStyleSnapshot, type TransformReceipt, type UndoCaptureMode, type UpdateEvent, type ValidationSuccess, type WasmInitInput, decodePresentationImage, exportPptxMarkdown, exportPptxStructured, initWasm, inspectPresentation, isProposalsAvailable, isWasmAvailable, needsElementDecode, openPresentation, paintSlide, presenceColorForClientId, presentationImageBlob, renderPptxMarkdown, sizeCanvasForSlide, slideToPng, wasmVersion };
|