@betteroffice/pptx 0.5.1 → 0.6.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/LICENSES/MIT-ruzstd.txt +21 -0
- package/LICENSES/MIT-twox-hash.txt +21 -0
- package/LICENSES/MIT-wuff.txt +20 -0
- package/README.md +24 -5
- package/dist/chunk-2XA2UH2O.js +1 -0
- package/dist/chunk-4WP5ZWYV.js +1 -0
- package/dist/chunk-65A2TX24.js +1 -0
- package/dist/chunk-663FARNX.js +1 -0
- package/dist/chunk-AYLLA7XR.js +1 -0
- package/dist/chunk-AZDGFDN2.js +1 -0
- package/dist/chunk-CCVGR3MS.js +1 -0
- package/dist/chunk-COS6CTH7.js +2 -0
- package/dist/chunk-G54T5CXF.js +1 -0
- package/dist/chunk-GAM2OAAP.js +2 -0
- package/dist/chunk-GHET7GIK.js +1 -0
- package/dist/chunk-GR7EGQ2Z.js +1 -0
- package/dist/chunk-HZODDD5T.js +1 -0
- package/dist/chunk-J54GRQWZ.js +1 -0
- package/dist/chunk-JJV35WHH.js +2 -0
- package/dist/chunk-KGEED2XY.js +1 -0
- package/dist/chunk-OUNTNO7R.js +1 -0
- package/dist/chunk-QRAGGQDN.js +1 -0
- package/dist/chunk-QWRXUT7T.js +1 -0
- package/dist/chunk-RNJM2LKC.js +3 -0
- package/dist/chunk-S6HKAO2F.js +1 -0
- package/dist/chunk-S6UYP4BX.js +1 -0
- package/dist/chunk-T6VUFMNC.js +1 -0
- package/dist/chunk-TRT2B252.js +10 -0
- package/dist/collaboration.js +1 -1
- package/dist/{editorSession-Cl_EWgAi.d.ts → editorSession-qQaVvMVR.d.ts} +346 -6
- package/dist/generated/metafile_svg_wasm_bg.wasm +0 -0
- package/dist/generated/pptx_wasm_bg.wasm +0 -0
- package/dist/generated/pptx_wasm_lean_bg.wasm +0 -0
- package/dist/generated/preflight/pptx_preflight_bg.wasm +0 -0
- package/dist/index.d.ts +21 -18
- package/dist/index.js +1 -1
- package/dist/pptxSessionWorker.mjs +13 -9
- package/dist/pptxSessionWorker.node.mjs +1 -0
- package/dist/pptxWorkerStart.d.ts +5 -0
- package/dist/pptxWorkerStart.js +1 -0
- package/dist/sessionWorker.missing.d.ts +3 -0
- package/dist/sessionWorker.missing.js +1 -0
- package/dist/sessionWorker.node.d.ts +3 -0
- package/dist/sessionWorker.node.js +1 -0
- package/dist/transport-BcduBS8X.d.ts +16 -0
- package/dist/wasm-preflight.d.ts +26 -0
- package/dist/wasm-preflight.js +1 -0
- package/dist/worker.d.ts +122 -22
- package/dist/worker.js +1 -1
- package/package.json +18 -5
- package/dist/chunk-2CPM3HRW.js +0 -1
- package/dist/chunk-3TTZUGDD.js +0 -1
- package/dist/chunk-B6OFSXHM.js +0 -1
- package/dist/chunk-DDNX2Z7E.js +0 -1
- package/dist/chunk-JZOLK2OC.js +0 -1
- package/dist/chunk-NWXUJY6L.js +0 -3
- /package/dist/{pptxSessionWorker.d.ts → pptxSessionWorker.node.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-TRT2B252.js';import'./chunk-4WP5ZWYV.js';import'./chunk-G54T5CXF.js';import'./chunk-RNJM2LKC.js';import'./chunk-KGEED2XY.js';import'./chunk-T6VUFMNC.js';import'./chunk-COS6CTH7.js';import'./chunk-CCVGR3MS.js';import'./chunk-S6UYP4BX.js';import'./chunk-HZODDD5T.js';import'./chunk-GHET7GIK.js';import'./chunk-65A2TX24.js';import {b}from'./chunk-AZDGFDN2.js';import'./chunk-OUNTNO7R.js';import'./chunk-O2XFH626.js';a(b());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as startSessionWorker}from'./chunk-TRT2B252.js';import'./chunk-4WP5ZWYV.js';import'./chunk-G54T5CXF.js';import'./chunk-RNJM2LKC.js';import'./chunk-KGEED2XY.js';import'./chunk-T6VUFMNC.js';import'./chunk-COS6CTH7.js';import'./chunk-CCVGR3MS.js';import'./chunk-S6UYP4BX.js';import'./chunk-HZODDD5T.js';import'./chunk-GHET7GIK.js';import'./chunk-65A2TX24.js';import'./chunk-O2XFH626.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-OUNTNO7R.js';import'./chunk-O2XFH626.js';function o(){throw a("openPresentation")}export{o as createSessionWorker};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-AZDGFDN2.js';import'./chunk-OUNTNO7R.js';import'./chunk-O2XFH626.js';function c(f,m,g){let{type:d,...p}=m,a$1=new(a(g)).Worker(f,p),t=new Map,s=false,o={onmessage:null,onerror:null,onmessageerror:null,postMessage(r,e){a$1.postMessage(r,e);},terminate(){s||(s=true,t.clear(),a$1.terminate());},addEventListener(r,e){if(!e)return;let n=t.get(r);n||t.set(r,n=new Set),n.add(e);},removeEventListener(r,e){e&&t.get(r)?.delete(e);}};for(let r of ["message","error","messageerror"])a$1.on(r,e=>{if(s)return;let n=r==="message"?{data:e}:{error:e,message:e instanceof Error?e.message:String(e)};for(let i of [...t.get(r)??[]])t.get(r)?.has(i)&&(typeof i=="function"?i.call(o,n):i.handleEvent(n));let u=o[`on${r}`];s||u?.call(o,n);});return o}function w(){return c(new URL("./pptxSessionWorker.node.mjs",import.meta.url),{type:"module"},"openPresentation")}export{w as createSessionWorker};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Endpoint seam: ordered reliable delivery; ports and sockets may copy instead of transfer. */
|
|
2
|
+
interface SessionTransport {
|
|
3
|
+
post(message: unknown, transfer?: Transferable[]): void;
|
|
4
|
+
listen(listener: (message: unknown) => void): () => void;
|
|
5
|
+
onError(listener: (error: unknown) => void): () => void;
|
|
6
|
+
close(): void;
|
|
7
|
+
}
|
|
8
|
+
interface SessionScope {
|
|
9
|
+
postMessage(message: unknown, transfer: Transferable[]): void;
|
|
10
|
+
addEventListener(type: string, listener: EventListener): void;
|
|
11
|
+
removeEventListener(type: string, listener: EventListener): void;
|
|
12
|
+
close?(): void;
|
|
13
|
+
start?(): void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type { SessionScope as S, SessionTransport as a };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
type PreflightWasmInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
2
|
+
/** @experimental */
|
|
3
|
+
interface FontPreflightFace {
|
|
4
|
+
family: string;
|
|
5
|
+
bold: boolean;
|
|
6
|
+
italic: boolean;
|
|
7
|
+
scripts: string[];
|
|
8
|
+
}
|
|
9
|
+
/** @experimental */
|
|
10
|
+
interface FontPreflight {
|
|
11
|
+
faces: FontPreflightFace[];
|
|
12
|
+
/** False when some font rules could not be resolved. */
|
|
13
|
+
complete: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare const preflightWasmState: {
|
|
17
|
+
status(): "idle" | "loading" | "ready";
|
|
18
|
+
memory(): WebAssembly.Memory | undefined;
|
|
19
|
+
preload(input?: PreflightWasmInput): Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
/** @experimental Load the font preflight wasm on demand. Idempotent. */
|
|
22
|
+
declare function preloadPreflightWasm(input?: PreflightWasmInput): Promise<void>;
|
|
23
|
+
/** @experimental Font faces for a zero-based slide index. Defaults to the first slide. */
|
|
24
|
+
declare function fontPreflight(bytes: Uint8Array, activeSlide?: number): Promise<FontPreflight>;
|
|
25
|
+
|
|
26
|
+
export { type FontPreflight, type FontPreflightFace, fontPreflight, preflightWasmState, preloadPreflightWasm };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{c as fontPreflight,a as preflightWasmState,b as preloadPreflightWasm}from'./chunk-AYLLA7XR.js';import'./chunk-S6UYP4BX.js';import'./chunk-O2XFH626.js';
|
package/dist/worker.d.ts
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { bu as StorySnapshot, C as CanvasImageResolver, c3 as FontDecoder, aE as PptxStoryTarget, bf as ShapeRect, aV as Proposal, bH as TextStyle, bJ as TextStyleSnapshot, y as ParagraphAlignment, D as DeckSnapshot, be as ShapeReceipt, _ as PptxEditResult, c4 as PresentationSlideSummary, c5 as PresentationWireFrame, aQ as PresentationHandle, Z as PptxEditRequest, b6 as ShapeDraft, aR as PresetShapeDraft, ay as PptxPngTarget, ax as PptxPngOptions, az as PptxReadRequest, aA as PptxReadResult, bm as SlideDisplayList, c6 as SessionFailure, c7 as FontDecoderMethods, c8 as FontCdnConfiguration, c9 as PresentationSessionOpenOptions, ca as OpenPresentationSessionOptions, cb as PptxWorkerEditorFailedError, bq as SlidePrimitive, bA as TextBoxPrimitive, K as PositionedTextLine, o as HitTestResult } from './editorSession-qQaVvMVR.js';
|
|
2
|
+
export { cc as PptxPeerHydrationError, aw as PptxPeerNotReadyError, cd as PptxWorkerEditorAccess, ce as PptxWorkerEditorCollaborationError, aP as PptxWorkerEditorDisposedError, cf as PptxWorkerEditorFrame, cg as PptxWorkerEditorInteractionAccess, ch as PptxWorkerEditorOperation, ci as PptxWorkerEditorOptions, cj as PptxWorkerEditorRecovery, ck as PptxWorkerEditorReply, cl as PptxWorkerEditorSession, cm as PptxWorkerEditorStage, cn as PptxWorkerEditorState, co as PresentationFrame, cp as PresentationSession, cq as PresentationSessionEvents, cr as PresentationSessionFont, cs as PresentationSessionMethods, ct as PresentationSessionState, bP as createPptxWorkerEditorSession, cu as decodeBrowserPresentationImage, b_ as openPresentationSession, cv as presentationStoryFormatting } from './editorSession-qQaVvMVR.js';
|
|
3
|
+
import { a as SessionTransport } from './transport-BcduBS8X.js';
|
|
3
4
|
import { P as PipeCommandPayload, a as PipeOutputBatch, C as CollaborationPipeChannel } from './main-C6-cc0fR.js';
|
|
4
5
|
import { P as PptxPresenceCursor, a as PptxPresencePeer } from './types-ui_ARP0o.js';
|
|
5
6
|
|
|
6
|
-
/** Endpoint seam: ordered reliable delivery; ports and sockets may copy instead of transfer. */
|
|
7
|
-
interface SessionTransport {
|
|
8
|
-
post(message: unknown, transfer?: Transferable[]): void;
|
|
9
|
-
listen(listener: (message: unknown) => void): () => void;
|
|
10
|
-
onError(listener: (error: unknown) => void): () => void;
|
|
11
|
-
close(): void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
7
|
interface EffectiveTextStyle {
|
|
15
8
|
bold: boolean;
|
|
16
9
|
italic: boolean;
|
|
17
10
|
underline: string;
|
|
11
|
+
strike?: string;
|
|
18
12
|
fontSizePt: number;
|
|
19
13
|
color: string;
|
|
20
14
|
fontFamily: string;
|
|
@@ -24,6 +18,7 @@ interface SelectionTextFormatting {
|
|
|
24
18
|
bold?: boolean;
|
|
25
19
|
italic?: boolean;
|
|
26
20
|
underline?: boolean;
|
|
21
|
+
strikethrough?: boolean;
|
|
27
22
|
fontSize?: number;
|
|
28
23
|
textColor?: string;
|
|
29
24
|
fontFamily?: string;
|
|
@@ -32,20 +27,57 @@ declare function selectionFormattingFromStory(story: StorySnapshot, anchor: numb
|
|
|
32
27
|
declare function storyFormattingFromStory(story: StorySnapshot, fallback: EffectiveTextStyle): SelectionTextFormatting;
|
|
33
28
|
declare function effectiveStyleFromSelection(story: StorySnapshot, anchor: number, focus: number, fallback: EffectiveTextStyle): EffectiveTextStyle;
|
|
34
29
|
|
|
35
|
-
declare function browserFrameImages(
|
|
30
|
+
declare function browserFrameImages(options?: {
|
|
31
|
+
maxDimension?: number;
|
|
32
|
+
}): {
|
|
36
33
|
resolve(frame: {
|
|
37
34
|
media: ReadonlyMap<string, Uint8Array>;
|
|
38
35
|
}): CanvasImageResolver & {
|
|
39
36
|
release(): void;
|
|
40
37
|
};
|
|
38
|
+
trim(): void;
|
|
41
39
|
dispose(): void;
|
|
42
40
|
};
|
|
43
41
|
|
|
44
|
-
|
|
42
|
+
interface PreparedFontWorker {
|
|
43
|
+
decoder: FontDecoder;
|
|
44
|
+
release(): void;
|
|
45
|
+
take(): Worker;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Starts the session worker for `source` early and returns a handle to its font decoder; the editor that opens the
|
|
49
|
+
* same `source` object adopts the worker. Preparing the same `source` again shares the worker: each handle is
|
|
50
|
+
* released on its own, and the worker stops when the last one is released. Unless `defaultFonts` is false, the
|
|
51
|
+
* worker also starts fetching the CJK coverage faces the opening slide needs. Pass the `defaultFonts` and
|
|
52
|
+
* `activeSlideIndex` the editor will use.
|
|
53
|
+
*/
|
|
54
|
+
declare function preparePresentationFontDecoder(source: Uint8Array | ArrayBuffer, options?: {
|
|
55
|
+
defaultFonts?: boolean;
|
|
56
|
+
activeSlideIndex?: number;
|
|
57
|
+
slicedFonts?: boolean;
|
|
58
|
+
}): PreparedFontWorker;
|
|
59
|
+
|
|
60
|
+
/** A face's drawable bytes for a realm that keeps its own copy; `bytes` is absent when `have` is still current. */
|
|
61
|
+
interface SlicedFontRead {
|
|
62
|
+
revision: number;
|
|
63
|
+
bytes?: ArrayBuffer;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface DefaultFontFace {
|
|
67
|
+
family: string;
|
|
68
|
+
bold: boolean;
|
|
69
|
+
italic: boolean;
|
|
70
|
+
bytes: ArrayBuffer;
|
|
71
|
+
kind?: 'primary' | 'coverage';
|
|
72
|
+
/** A lighter family's regular face drawn at its own weight whatever weight the run claims. */
|
|
73
|
+
ownWeight?: boolean;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
type PresentationCommandAccessMethods = Pick<PresentationHandle, 'snapshot' | 'story' | 'findText' | 'validateEdits' | 'exportStructured' | 'exportMarkdown' | 'searchText' | 'listProposals' | 'comments' | 'previewProposal' | 'layoutProposalSlide' | 'layoutProposalDiffSlide' | 'layoutProposalDiffSlideById' | 'proposalSlideStrip' | 'layoutSlide' | 'encodeStateVector' | 'encodeStateAsUpdate'>;
|
|
45
77
|
type PresentationCommandAccessMethod = keyof PresentationCommandAccessMethods;
|
|
46
78
|
type PresentationCommandAccessResult = ReturnType<PresentationCommandAccessMethods[PresentationCommandAccessMethod]>;
|
|
47
|
-
type PresentationCommandMutationMethods = Pick<PresentationHandle, 'insertTableRow' | 'deleteTableRow' | 'insertTableColumn' | 'deleteTableColumn' | 'setShapeFill' | 'setShapeStroke' | 'setShapeAdjust' | 'removeShape' | 'bringShapeToFront' | 'sendShapeToBack' | 'bringShapeForward' | 'sendShapeBackward' | 'insertSlide' | 'deleteSlide' | 'moveSlide' | 'setSlideNotes' | 'addComment' | 'replyToComment' | 'setCommentStatus' | 'setCommentPosition' | 'removeComment' | 'setCommentFlavor' | 'propose' | 'acceptProposal' | 'rejectProposal'>;
|
|
48
|
-
declare const PRESENTATION_COMMAND_MUTATIONS: readonly ["insertTableRow", "deleteTableRow", "insertTableColumn", "deleteTableColumn", "setShapeFill", "setShapeStroke", "setShapeAdjust", "removeShape", "bringShapeToFront", "sendShapeToBack", "bringShapeForward", "sendShapeBackward", "insertSlide", "deleteSlide", "moveSlide", "setSlideNotes", "addComment", "replyToComment", "setCommentStatus", "setCommentPosition", "removeComment", "setCommentFlavor", "propose", "acceptProposal", "rejectProposal"];
|
|
79
|
+
type PresentationCommandMutationMethods = Pick<PresentationHandle, 'insertTableRow' | 'deleteTableRow' | 'insertTableColumn' | 'deleteTableColumn' | 'setShapeFill' | 'setShapeStroke' | 'setShapeAdjust' | 'removeShape' | 'bringShapeToFront' | 'sendShapeToBack' | 'bringShapeForward' | 'sendShapeBackward' | 'insertSlide' | 'deleteSlide' | 'moveSlide' | 'duplicateSlide' | 'setSlideNotes' | 'addComment' | 'replyToComment' | 'setCommentStatus' | 'setCommentPosition' | 'removeComment' | 'setCommentFlavor' | 'propose' | 'acceptProposal' | 'rejectProposal'>;
|
|
80
|
+
declare const PRESENTATION_COMMAND_MUTATIONS: readonly ["insertTableRow", "deleteTableRow", "insertTableColumn", "deleteTableColumn", "setShapeFill", "setShapeStroke", "setShapeAdjust", "removeShape", "bringShapeToFront", "sendShapeToBack", "bringShapeForward", "sendShapeBackward", "insertSlide", "deleteSlide", "moveSlide", "duplicateSlide", "setSlideNotes", "addComment", "replyToComment", "setCommentStatus", "setCommentPosition", "removeComment", "setCommentFlavor", "propose", "acceptProposal", "rejectProposal"];
|
|
49
81
|
type PresentationCommandMutation = {
|
|
50
82
|
[K in keyof PresentationCommandMutationMethods]: {
|
|
51
83
|
method: K;
|
|
@@ -66,6 +98,8 @@ interface PresentationCommandSelection extends PptxStoryTarget {
|
|
|
66
98
|
focus: number;
|
|
67
99
|
affinity: 'upstream' | 'downstream';
|
|
68
100
|
goalX?: number;
|
|
101
|
+
/** Whether the selected story's owning shape is an eligible top-level resize target. */
|
|
102
|
+
canResize?: boolean;
|
|
69
103
|
}
|
|
70
104
|
interface PresentationCommandObjectSelection extends Omit<PresentationCommandSelection, 'kind'> {
|
|
71
105
|
kind: 'object';
|
|
@@ -94,6 +128,7 @@ type PresentationCommandSelectionReference = {
|
|
|
94
128
|
seq: number;
|
|
95
129
|
};
|
|
96
130
|
type PresentationCommandMotion = 'left' | 'right' | 'wordLeft' | 'wordRight' | 'lineStart' | 'lineEnd' | 'storyStart' | 'storyEnd' | 'up' | 'down' | 'nextCell' | 'previousCell';
|
|
131
|
+
type PresentationCommandResizeHandle = 'nw' | 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w';
|
|
97
132
|
type PresentationCommandFrameTag = Pick<PresentationCommandFrame, 'slideId' | 'slideRevision' | 'coversThroughSeq' | 'documentEpoch' | 'incarnation'>;
|
|
98
133
|
interface PresentationCommandInput {
|
|
99
134
|
inputTime: number;
|
|
@@ -164,9 +199,18 @@ type PresentationCommandPayloads = {
|
|
|
164
199
|
});
|
|
165
200
|
setShapeRect: PresentationCommandInput & {
|
|
166
201
|
frame: PresentationCommandFrameTag;
|
|
202
|
+
} & ({
|
|
167
203
|
target: PresentationCommandObjectTarget;
|
|
168
204
|
rect: ShapeRect;
|
|
169
|
-
}
|
|
205
|
+
} | {
|
|
206
|
+
at: PresentationCommandSelectionReference;
|
|
207
|
+
shapeId: string;
|
|
208
|
+
handle: PresentationCommandResizeHandle;
|
|
209
|
+
delta: {
|
|
210
|
+
x: number;
|
|
211
|
+
y: number;
|
|
212
|
+
};
|
|
213
|
+
});
|
|
170
214
|
undo: PresentationCommandInput;
|
|
171
215
|
redo: PresentationCommandInput;
|
|
172
216
|
activateSlide: Partial<PresentationCommandInput> & {
|
|
@@ -182,7 +226,7 @@ type PresentationCommandPayloads = {
|
|
|
182
226
|
};
|
|
183
227
|
formatText: PresentationCommandTextInput & {
|
|
184
228
|
patch: TextStyle;
|
|
185
|
-
toggle?: 'bold' | 'italic' | 'underline';
|
|
229
|
+
toggle?: 'bold' | 'italic' | 'underline' | 'strikethrough';
|
|
186
230
|
fontSizeStep?: {
|
|
187
231
|
direction: 'increase' | 'decrease';
|
|
188
232
|
sizes: readonly number[];
|
|
@@ -286,7 +330,11 @@ declare class CommandOutcomeUnknown extends Error {
|
|
|
286
330
|
};
|
|
287
331
|
constructor(seq: number, message: string);
|
|
288
332
|
}
|
|
289
|
-
|
|
333
|
+
/** Opening needed more than an engine budget allows (today: more than 256 distinct font faces). */
|
|
334
|
+
declare class PptxResourceLimitError extends Error {
|
|
335
|
+
constructor(message: string);
|
|
336
|
+
}
|
|
337
|
+
type PresentationCommandFailure = CommandOutcomeUnknown | SessionFailure | PptxResourceLimitError;
|
|
290
338
|
interface PresentationCommandOutcome {
|
|
291
339
|
seq: number;
|
|
292
340
|
status: 'applied' | 'noop' | 'refused' | 'cancelled';
|
|
@@ -341,6 +389,10 @@ interface PresentationCommandFrame extends PresentationWireFrame {
|
|
|
341
389
|
incarnation: string;
|
|
342
390
|
}
|
|
343
391
|
interface PresentationCommandAck extends PresentationCommandIdentity {
|
|
392
|
+
/** Families whose outlines load as text needs them; a paint prepares its text through `readCoverageFont`. */
|
|
393
|
+
slicedFamilies?: string[];
|
|
394
|
+
/** The styles of those families that draw under their own name, as `family|bold|italic`. */
|
|
395
|
+
slicedPlainStyles?: string[];
|
|
344
396
|
epoch: number;
|
|
345
397
|
throughSeq: number;
|
|
346
398
|
version: string;
|
|
@@ -375,8 +427,12 @@ interface PresentationCommandOpenOptions extends PresentationSessionOpenOptions,
|
|
|
375
427
|
activeSlideIndex?: number;
|
|
376
428
|
collaboration?: boolean;
|
|
377
429
|
observeChanges?: boolean;
|
|
430
|
+
defaultFonts?: boolean;
|
|
431
|
+
slicedFonts?: boolean;
|
|
378
432
|
}
|
|
379
433
|
interface PresentationCommandOpenResult extends PresentationCommandAck {
|
|
434
|
+
recoveryBaseline?: 'source' | 'update';
|
|
435
|
+
recoveryEngine?: string;
|
|
380
436
|
recoveryUpdate?: ArrayBuffer;
|
|
381
437
|
slides: PresentationSlideSummary[];
|
|
382
438
|
size: {
|
|
@@ -393,6 +449,12 @@ interface PresentationCommandThumbnailRequest extends PresentationCommandIdentit
|
|
|
393
449
|
slideId: string;
|
|
394
450
|
knownRevision?: number;
|
|
395
451
|
}
|
|
452
|
+
interface PresentationShapeRectPreviewRequest extends PresentationCommandIdentity {
|
|
453
|
+
basis: PresentationCommandBasis;
|
|
454
|
+
frame: PresentationCommandFrameTag;
|
|
455
|
+
target: PresentationCommandObjectTarget;
|
|
456
|
+
rect: ShapeRect;
|
|
457
|
+
}
|
|
396
458
|
type PresentationCommandThumbnailResult = PresentationCommandIdentity & {
|
|
397
459
|
epoch: number;
|
|
398
460
|
slideId: string;
|
|
@@ -416,14 +478,25 @@ interface PresentationCommandSaveResult extends PresentationCommandIdentity {
|
|
|
416
478
|
interface PresentationCommandReadResult extends PresentationCommandAck {
|
|
417
479
|
result: PptxReadResult;
|
|
418
480
|
}
|
|
419
|
-
type PresentationCommandMethods = {
|
|
481
|
+
type PresentationCommandMethods = FontDecoderMethods & {
|
|
482
|
+
/** Starts fetching the regular coverage face of each script (`cjk-jp`, `cjk-kr`, `cjk-sc`, `cjk-tc`) before the editor opens. */
|
|
483
|
+
prefetchCoverageFonts(scripts: string[], sliced?: boolean, fontCdn?: FontCdnConfiguration): void;
|
|
484
|
+
/** A sliced face with `text` loaded, unless the caller's revision `have` is still current; null for other families. */
|
|
485
|
+
readCoverageFont(family: string, text: string, have: number | null): SlicedFontRead | null;
|
|
486
|
+
/** The complete sliced faces, for paints that do not prepare their text. */
|
|
487
|
+
wholeCoverageFonts(have: string[]): DefaultFontFace[];
|
|
420
488
|
openCommandEditor(bytes: ArrayBuffer, options: PresentationCommandOpenOptions): PresentationCommandOpenResult;
|
|
421
489
|
command(envelope: PresentationCommandEnvelope): PresentationCommandAck;
|
|
490
|
+
previewShapeRect(request: PresentationShapeRectPreviewRequest): ArrayBuffer;
|
|
422
491
|
thumbnailFrame(request: PresentationCommandThumbnailRequest): PresentationCommandThumbnailResult;
|
|
423
492
|
flushCommandEditor(fence: PresentationCommandFence): PresentationCommandAck;
|
|
424
493
|
saveCommandEditor(fence: PresentationCommandFence): PresentationCommandSaveResult;
|
|
494
|
+
/** Draws a slide as PNG bytes in the worker, after the fenced commands. */
|
|
495
|
+
renderCommandPng(fence: PresentationCommandFence, target: PptxPngTarget, options: Omit<PptxPngOptions, 'signal'>): ArrayBuffer;
|
|
425
496
|
accessCommandEditor(fence: PresentationCommandFence, method: PresentationCommandAccessMethod, args: unknown[]): PresentationCommandAccessResult;
|
|
426
|
-
checkpointCommandEditor(fence: PresentationCommandFence
|
|
497
|
+
checkpointCommandEditor(fence: PresentationCommandFence, options?: {
|
|
498
|
+
rebase?: boolean;
|
|
499
|
+
}): PresentationCommandSaveResult;
|
|
427
500
|
prepareCommandPicture(fence: PresentationCommandFence, bytes: ArrayBuffer): ArrayBuffer;
|
|
428
501
|
readEditor(fence: PresentationCommandFence, request?: PptxReadRequest): PresentationCommandReadResult;
|
|
429
502
|
};
|
|
@@ -431,15 +504,31 @@ type PresentationCommandEvents = {
|
|
|
431
504
|
ack: PresentationCommandAck;
|
|
432
505
|
collaborationPipe: PipeOutputBatch<PptxPresencePeer>[];
|
|
433
506
|
};
|
|
507
|
+
/** @internal An intent the worker had not acknowledged, for replay after a crash. */
|
|
508
|
+
interface PresentationPendingIntent {
|
|
509
|
+
seq: number;
|
|
510
|
+
intent: PresentationCommandIntent;
|
|
511
|
+
afterSeq?: number;
|
|
512
|
+
}
|
|
434
513
|
interface PresentationCommandClient {
|
|
435
514
|
readonly state: PresentationCommandOpenResult;
|
|
515
|
+
readCoverageFont?(family: string, text: string, have: number | null): Promise<SlicedFontRead | null>;
|
|
516
|
+
wholeCoverageFonts?(have: string[]): Promise<DefaultFontFace[]>;
|
|
436
517
|
dispatch(intent: PresentationCommandIntent, basis?: PresentationCommandBasis): Promise<PresentationCommandAck>;
|
|
437
518
|
flush(seq?: number): Promise<PresentationCommandAck>;
|
|
438
519
|
save(): Promise<Uint8Array>;
|
|
520
|
+
/** Draws a slide as PNG bytes in the worker, after the commands sent so far. */
|
|
521
|
+
renderPng?(target: PptxPngTarget, options?: PptxPngOptions): Promise<Uint8Array>;
|
|
439
522
|
access?<K extends PresentationCommandAccessMethod>(method: K, ...args: Parameters<PresentationCommandAccessMethods[K]>): Promise<ReturnType<PresentationCommandAccessMethods[K]>>;
|
|
440
|
-
|
|
523
|
+
takeRecoveryUpdate?(): ArrayBuffer | undefined;
|
|
524
|
+
/** @internal Intents sent to the worker whose acknowledgement has not arrived, in send order, with the command each one follows. */
|
|
525
|
+
pendingIntents?(): PresentationPendingIntent[];
|
|
526
|
+
checkpoint?(options?: {
|
|
527
|
+
rebase?: boolean;
|
|
528
|
+
}): Promise<PresentationCommandSaveResult>;
|
|
441
529
|
preparePicture?(bytes: ArrayBuffer): Promise<ArrayBuffer>;
|
|
442
530
|
read(request?: PptxReadRequest): Promise<PresentationCommandReadResult>;
|
|
531
|
+
previewShapeRect(frame: PresentationCommandFrameTag, target: PresentationCommandObjectTarget, rect: ShapeRect): Promise<SlideDisplayList>;
|
|
443
532
|
thumbnail(slideId: string, knownRevision?: number): Promise<PresentationCommandThumbnailResult>;
|
|
444
533
|
subscribe(listener: (ack: PresentationCommandAck) => void): () => void;
|
|
445
534
|
subscribeFrame(listener: (frame: PresentationCommandFrame) => void): () => void;
|
|
@@ -449,11 +538,17 @@ interface PresentationCommandClient {
|
|
|
449
538
|
dispose(): Promise<void>;
|
|
450
539
|
}
|
|
451
540
|
declare const PRESENTATION_COMMAND_METHODS: {
|
|
541
|
+
decodeFontFace: true;
|
|
542
|
+
prefetchCoverageFonts: true;
|
|
543
|
+
readCoverageFont: true;
|
|
544
|
+
wholeCoverageFonts: true;
|
|
452
545
|
openCommandEditor: true;
|
|
453
546
|
command: true;
|
|
547
|
+
previewShapeRect: true;
|
|
454
548
|
thumbnailFrame: true;
|
|
455
549
|
flushCommandEditor: true;
|
|
456
550
|
saveCommandEditor: true;
|
|
551
|
+
renderCommandPng: true;
|
|
457
552
|
readEditor: true;
|
|
458
553
|
prepareCommandPicture: true;
|
|
459
554
|
accessCommandEditor: true;
|
|
@@ -467,6 +562,10 @@ interface PptxWorkerSessionOptions extends OpenPresentationSessionOptions {
|
|
|
467
562
|
readOnly?: boolean;
|
|
468
563
|
observeChanges?: boolean;
|
|
469
564
|
activeSlideIndex?: number;
|
|
565
|
+
/** Loads bundled faces for document families `fonts` does not supply; false fetches none. Defaults to true. */
|
|
566
|
+
defaultFonts?: boolean;
|
|
567
|
+
/** Opens CJK coverage faces in slices that load as text needs them. Defaults to false. */
|
|
568
|
+
slicedFonts?: boolean;
|
|
470
569
|
collaboration?: {
|
|
471
570
|
clientId: number;
|
|
472
571
|
initialUpdate?: Uint8Array;
|
|
@@ -515,7 +614,8 @@ type CommandTicket = {
|
|
|
515
614
|
|
|
516
615
|
interface PresentationSharedInput {
|
|
517
616
|
subscribeSent(listener: () => void): () => void;
|
|
518
|
-
|
|
617
|
+
cancel?(ticket: CommandTicket): boolean;
|
|
618
|
+
submit(intent: PresentationCommandIntent, basis: PresentationCommandBasis, after?: CommandTicket, waitForAfter?: boolean): {
|
|
519
619
|
ticket: CommandTicket;
|
|
520
620
|
operation: Promise<PresentationCommandAck>;
|
|
521
621
|
};
|
|
@@ -618,4 +718,4 @@ declare const presentationCollaborationPipes: {
|
|
|
618
718
|
delete(client: PresentationCommandClient): void;
|
|
619
719
|
};
|
|
620
720
|
|
|
621
|
-
export { type CommandGeometryIndex, type CommandGeometryLine, type CommandHitGeometryIndex, CommandOutcomeUnknown, type CommandRect, DEFAULT_EDITOR_TEXT_STYLE, type EffectiveTextStyle, OpenPresentationSessionOptions, PRESENTATION_COMMAND_ADMISSION, PRESENTATION_COMMAND_METHODS, PRESENTATION_COMMAND_MUTATIONS, PptxWorkerEditorFailedError, type PptxWorkerSession, type PptxWorkerSessionOptions, PptxWorkerUnsupportedError, type PresentationCommandAccessMethod, type PresentationCommandAccessMethods, type PresentationCommandAccessResult, type PresentationCommandAck, type PresentationCommandBasis, type PresentationCommandClient, type PresentationCommandEditState, type PresentationCommandEnvelope, type PresentationCommandEvents, type PresentationCommandFailure, type PresentationCommandFence, type PresentationCommandFrame, type PresentationCommandFrameTag, type PresentationCommandIdentity, type PresentationCommandInput, type PresentationCommandIntent, type PresentationCommandKind, type PresentationCommandMethods, type PresentationCommandMotion, type PresentationCommandMutation, type PresentationCommandMutationMethods, type PresentationCommandObjectSelection, type PresentationCommandObjectTarget, type PresentationCommandOpenOptions, type PresentationCommandOpenResult, type PresentationCommandOutcome, type PresentationCommandPayloads, type PresentationCommandReadResult, type PresentationCommandRefusalReason, type PresentationCommandSaveResult, type PresentationCommandSelected, type PresentationCommandSelection, type PresentationCommandSelectionReference, type PresentationCommandTextInput, type PresentationCommandThumbnailRequest, type PresentationCommandThumbnailResult, type PresentationCommandToolbarContext, PresentationSessionOpenOptions, PresentationSlideSummary, type SelectionTextFormatting, browserFrameImages, createPptxWorkerSession, createPresentationCommandClient, decodeCommandDisplayList, effectiveStyleFromSelection, findLine, frameAssetIds, hitGeometry, indexGeometry, indexHitGeometry, navigateGeometry, presentationCollaborationPipes, presentationSharedInputs, selectionFormattingFromStory, selectionGeometry, storyFormattingFromStory, transformedRect };
|
|
721
|
+
export { type CommandGeometryIndex, type CommandGeometryLine, type CommandHitGeometryIndex, CommandOutcomeUnknown, type CommandRect, DEFAULT_EDITOR_TEXT_STYLE, type EffectiveTextStyle, OpenPresentationSessionOptions, PRESENTATION_COMMAND_ADMISSION, PRESENTATION_COMMAND_METHODS, PRESENTATION_COMMAND_MUTATIONS, PptxResourceLimitError, PptxWorkerEditorFailedError, type PptxWorkerSession, type PptxWorkerSessionOptions, PptxWorkerUnsupportedError, type PresentationCommandAccessMethod, type PresentationCommandAccessMethods, type PresentationCommandAccessResult, type PresentationCommandAck, type PresentationCommandBasis, type PresentationCommandClient, type PresentationCommandEditState, type PresentationCommandEnvelope, type PresentationCommandEvents, type PresentationCommandFailure, type PresentationCommandFence, type PresentationCommandFrame, type PresentationCommandFrameTag, type PresentationCommandIdentity, type PresentationCommandInput, type PresentationCommandIntent, type PresentationCommandKind, type PresentationCommandMethods, type PresentationCommandMotion, type PresentationCommandMutation, type PresentationCommandMutationMethods, type PresentationCommandObjectSelection, type PresentationCommandObjectTarget, type PresentationCommandOpenOptions, type PresentationCommandOpenResult, type PresentationCommandOutcome, type PresentationCommandPayloads, type PresentationCommandReadResult, type PresentationCommandRefusalReason, type PresentationCommandResizeHandle, type PresentationCommandSaveResult, type PresentationCommandSelected, type PresentationCommandSelection, type PresentationCommandSelectionReference, type PresentationCommandTextInput, type PresentationCommandThumbnailRequest, type PresentationCommandThumbnailResult, type PresentationCommandToolbarContext, PresentationSessionOpenOptions, PresentationSlideSummary, type SelectionTextFormatting, browserFrameImages, createPptxWorkerSession, createPresentationCommandClient, decodeCommandDisplayList, effectiveStyleFromSelection, findLine, frameAssetIds, hitGeometry, indexGeometry, indexHitGeometry, navigateGeometry, preparePresentationFontDecoder, presentationCollaborationPipes, presentationSharedInputs, selectionFormattingFromStory, selectionGeometry, storyFormattingFromStory, transformedRect };
|