@betteroffice/pptx 0.5.1 → 0.6.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.
Files changed (57) hide show
  1. package/LICENSES/MIT-ruzstd.txt +21 -0
  2. package/LICENSES/MIT-twox-hash.txt +21 -0
  3. package/LICENSES/MIT-wuff.txt +20 -0
  4. package/README.md +24 -5
  5. package/dist/chunk-2XA2UH2O.js +1 -0
  6. package/dist/chunk-4WP5ZWYV.js +1 -0
  7. package/dist/chunk-65A2TX24.js +1 -0
  8. package/dist/chunk-663FARNX.js +1 -0
  9. package/dist/chunk-AYLLA7XR.js +1 -0
  10. package/dist/chunk-AZDGFDN2.js +1 -0
  11. package/dist/chunk-CCVGR3MS.js +1 -0
  12. package/dist/chunk-COS6CTH7.js +2 -0
  13. package/dist/chunk-G54T5CXF.js +1 -0
  14. package/dist/chunk-GAM2OAAP.js +2 -0
  15. package/dist/chunk-GHET7GIK.js +1 -0
  16. package/dist/chunk-GR7EGQ2Z.js +1 -0
  17. package/dist/chunk-HZODDD5T.js +1 -0
  18. package/dist/chunk-J54GRQWZ.js +1 -0
  19. package/dist/chunk-JJV35WHH.js +2 -0
  20. package/dist/chunk-KGEED2XY.js +1 -0
  21. package/dist/chunk-OUNTNO7R.js +1 -0
  22. package/dist/chunk-QRAGGQDN.js +1 -0
  23. package/dist/chunk-QWRXUT7T.js +1 -0
  24. package/dist/chunk-RNJM2LKC.js +3 -0
  25. package/dist/chunk-S6HKAO2F.js +1 -0
  26. package/dist/chunk-S6UYP4BX.js +1 -0
  27. package/dist/chunk-T6VUFMNC.js +1 -0
  28. package/dist/chunk-TRT2B252.js +10 -0
  29. package/dist/collaboration.js +1 -1
  30. package/dist/{editorSession-Cl_EWgAi.d.ts → editorSession-qQaVvMVR.d.ts} +346 -6
  31. package/dist/generated/metafile_svg_wasm_bg.wasm +0 -0
  32. package/dist/generated/pptx_wasm_bg.wasm +0 -0
  33. package/dist/generated/pptx_wasm_lean_bg.wasm +0 -0
  34. package/dist/generated/preflight/pptx_preflight_bg.wasm +0 -0
  35. package/dist/index.d.ts +21 -18
  36. package/dist/index.js +1 -1
  37. package/dist/pptxSessionWorker.mjs +13 -9
  38. package/dist/pptxSessionWorker.node.mjs +1 -0
  39. package/dist/pptxWorkerStart.d.ts +5 -0
  40. package/dist/pptxWorkerStart.js +1 -0
  41. package/dist/sessionWorker.missing.d.ts +3 -0
  42. package/dist/sessionWorker.missing.js +1 -0
  43. package/dist/sessionWorker.node.d.ts +3 -0
  44. package/dist/sessionWorker.node.js +1 -0
  45. package/dist/transport-BcduBS8X.d.ts +16 -0
  46. package/dist/wasm-preflight.d.ts +26 -0
  47. package/dist/wasm-preflight.js +1 -0
  48. package/dist/worker.d.ts +122 -22
  49. package/dist/worker.js +1 -1
  50. package/package.json +18 -5
  51. package/dist/chunk-2CPM3HRW.js +0 -1
  52. package/dist/chunk-3TTZUGDD.js +0 -1
  53. package/dist/chunk-B6OFSXHM.js +0 -1
  54. package/dist/chunk-DDNX2Z7E.js +0 -1
  55. package/dist/chunk-JZOLK2OC.js +0 -1
  56. package/dist/chunk-NWXUJY6L.js +0 -3
  57. /package/dist/{pptxSessionWorker.d.ts → pptxSessionWorker.node.d.ts} +0 -0
@@ -7,6 +7,7 @@ interface TextStyle {
7
7
  color?: string;
8
8
  fontFamily?: string;
9
9
  underline?: string;
10
+ strike?: string;
10
11
  spacingPt?: number;
11
12
  baselinePct?: number;
12
13
  }
@@ -18,6 +19,7 @@ interface TextStyleSnapshot {
18
19
  color: string | null;
19
20
  fontFamily: string | null;
20
21
  underline: string | null;
22
+ strike?: string | null;
21
23
  spacingPt?: number | null;
22
24
  baselinePct?: number | null;
23
25
  /** `a:rPr@kern`: the smallest size, in points, the run is kerned at. */
@@ -142,6 +144,12 @@ interface ShapeSnapshot {
142
144
  sourceId: number;
143
145
  kind: ShapeKind;
144
146
  name: string;
147
+ /** `p:cNvPr/@title`, the alternative-text title. */
148
+ title?: string;
149
+ /** `p:cNvPr/@descr`, the alternative-text description. */
150
+ description?: string;
151
+ /** True when `p:cNvPr` carries the a16 decorative extension; omitted when false. */
152
+ decorative?: boolean;
145
153
  x: number;
146
154
  y: number;
147
155
  width: number;
@@ -183,11 +191,37 @@ interface InheritedGeometry {
183
191
  flipH: boolean;
184
192
  flipV: boolean;
185
193
  }
194
+ /** Stored layout or master settings; omitted boolean attributes default to true and do not gate slide placeholders. */
195
+ interface HeaderFooterSettings {
196
+ slideNumber: boolean;
197
+ footer: boolean;
198
+ date: boolean;
199
+ header: boolean;
200
+ }
201
+ /** Session shape id and text of the first visible slide placeholder in shape order, including groups; text joins stories with newlines and preserves empty text.
202
+ * Slide number fields use firstSlideNum (default 1) plus deck index, counting hidden slides; fixed text stays unchanged. */
203
+ interface SlideHeaderFooterText {
204
+ shapeId: string;
205
+ text: string;
206
+ }
207
+ /** Stored date text; field is the first datetime* field type (updates on display), or null for fixed text. */
208
+ interface SlideDateText extends SlideHeaderFooterText {
209
+ field: string | null;
210
+ }
211
+ /** Visible placeholders from the slide itself, independent of stored settings; missing placeholders are null. */
212
+ interface SlideHeaderFooter {
213
+ footer: SlideHeaderFooterText | null;
214
+ slideNumber: SlideHeaderFooterText | null;
215
+ date: SlideDateText | null;
216
+ }
186
217
  interface SlideLayoutSnapshot {
218
+ /** Layout settings, falling back to the master; null when neither stores p:hf. */
219
+ headerFooter?: HeaderFooterSettings | null;
187
220
  name: string | null;
188
221
  type: string | null;
189
222
  }
190
223
  interface SlideSnapshot {
224
+ headerFooter?: SlideHeaderFooter | null;
191
225
  title?: string | null;
192
226
  hidden?: boolean | null;
193
227
  layout?: SlideLayoutSnapshot | null;
@@ -516,9 +550,12 @@ interface PositionedTextRun {
516
550
  bold: boolean;
517
551
  italic: boolean;
518
552
  underline: boolean;
553
+ strike?: string;
519
554
  color: string;
520
555
  letterSpacingPx?: number;
521
556
  baselineOffsetPx?: number;
557
+ /** `false` when layout shaped the run without kerning, below its `kern` threshold; absent when kerned. */
558
+ kerning?: false;
522
559
  glyphs: PositionedGlyph[];
523
560
  }
524
561
  interface PositionedTextLine {
@@ -540,6 +577,8 @@ interface TextBoxPrimitive extends PrimitiveBase {
540
577
  paragraphs: Array<{
541
578
  align?: 'left' | 'center' | 'right' | 'justify';
542
579
  level: number;
580
+ languages?: TextLanguage[];
581
+ links?: TextLink[];
543
582
  runs: Array<{
544
583
  text: string;
545
584
  fontFamily: string;
@@ -555,6 +594,28 @@ interface TextBoxPrimitive extends PrimitiveBase {
555
594
  /** `a:rPr/a:effectLst`: the shadow the box's glyphs are drawn with. */
556
595
  textShadow?: Shadow;
557
596
  }
597
+ /** UTF-16 offsets into the paragraph's concatenated run text. */
598
+ interface TextLanguage {
599
+ start: number;
600
+ end: number;
601
+ lang: string;
602
+ }
603
+ /** UTF-16 offsets into the paragraph's concatenated run text. */
604
+ interface TextLink {
605
+ start: number;
606
+ end: number;
607
+ target: TextLinkTarget;
608
+ }
609
+ type TextLinkTarget = {
610
+ kind: 'url';
611
+ href: string;
612
+ } | {
613
+ kind: 'slide';
614
+ index: number;
615
+ } | {
616
+ kind: 'jump';
617
+ jump: 'next' | 'previous' | 'first' | 'last';
618
+ };
558
619
  interface PlaceholderPrimitive extends PrimitiveBase {
559
620
  kind: 'placeholder';
560
621
  name: string;
@@ -567,6 +628,21 @@ interface ChartPrimitive extends PrimitiveBase {
567
628
  name: string;
568
629
  label: string;
569
630
  primitives: SlidePrimitive[];
631
+ /** The plotted values as text, for assistive technology, with no categories
632
+ * or series when the chart caches no points. Older engines and charts over
633
+ * the size cap leave it out. */
634
+ data?: ChartData;
635
+ }
636
+ /** What a chart plots: one row per category and one column per series. */
637
+ interface ChartData {
638
+ categories: string[];
639
+ series: ChartDataSeries[];
640
+ }
641
+ interface ChartDataSeries {
642
+ name?: string;
643
+ /** Each category's value as the chart's data labels would show it; `null`
644
+ * where the chart has no number. */
645
+ values: (string | null)[];
570
646
  }
571
647
  /** A laid-out table. Its cells paint clipped to the table rectangle, and
572
648
  * `label` is the screen-reader summary of the whole table. */
@@ -575,14 +651,51 @@ interface TablePrimitive extends PrimitiveBase {
575
651
  name: string;
576
652
  label: string;
577
653
  primitives: SlidePrimitive[];
654
+ /** The row and column structure, for assistive technology. Older engines
655
+ * leave it out. */
656
+ grid?: TableGrid;
657
+ }
658
+ interface TableGrid {
659
+ rows: number;
660
+ columns: number;
661
+ /** Cells that start a span, in row then column order; cells merged into
662
+ * another one are left out. */
663
+ cells: TableGridCell[];
664
+ }
665
+ interface TableGridCell {
666
+ row: number;
667
+ column: number;
668
+ rowSpan: number;
669
+ columnSpan: number;
670
+ /** `column` heads its column (the header row), `row` heads its row (the
671
+ * first column). */
672
+ header?: 'column' | 'row';
673
+ /** The `[start, end)` range of the table's `primitives` that hold the
674
+ * cell's text. */
675
+ primitives: [number, number];
578
676
  }
579
677
  type SlidePrimitive = ShapePrimitive | ImagePrimitive | TextBoxPrimitive | PlaceholderPrimitive | ChartPrimitive | TablePrimitive;
678
+ /** What `p:cNvPr` says about a shape for assistive technology. */
679
+ interface ShapeAltText {
680
+ title?: string;
681
+ description?: string;
682
+ /** The shape, or a group around it, is marked decorative. */
683
+ decorative?: boolean;
684
+ /** The nearest enclosing group with alternative text, by its key in `altText`. */
685
+ group?: string;
686
+ /** Where the shape starts in `primitives` when what paints it carries no shape id. */
687
+ primitive?: number;
688
+ }
580
689
  interface SlideDisplayList {
581
690
  contractVersion: number;
582
691
  width: number;
583
692
  height: number;
584
693
  background?: Paint;
585
694
  primitives: SlidePrimitive[];
695
+ /** Alternative text by shape id, for the shapes that have some. */
696
+ altText?: Record<string, ShapeAltText>;
697
+ /** The shape holding the slide's title placeholder. */
698
+ titleShape?: string;
586
699
  }
587
700
  type HitTestResult = {
588
701
  kind: 'shape';
@@ -599,7 +712,7 @@ interface UpdateEvent {
599
712
  }
600
713
  interface TextParagraphDraft {
601
714
  bullet?: boolean;
602
- alignment?: ParagraphAlignment | null;
715
+ alignment?: ParagraphAlignment | 'justLow' | 'dist' | 'thaiDist' | null;
603
716
  runs: Array<{
604
717
  text: string;
605
718
  style?: TextStyle;
@@ -614,6 +727,72 @@ interface TableReceipt {
614
727
  }
615
728
 
616
729
  type ProposalEdit = {
730
+ type: 'addTextBox';
731
+ ref?: string;
732
+ slideId: string;
733
+ draft: ShapeDraft;
734
+ } | {
735
+ type: 'addShape';
736
+ ref?: string;
737
+ slideId: string;
738
+ draft: PresetShapeDraft;
739
+ } | {
740
+ type: 'addPicture';
741
+ ref?: string;
742
+ slideId: string;
743
+ draft: PictureDraft;
744
+ } | {
745
+ type: 'removeShape';
746
+ slideId: string;
747
+ shapeId: string;
748
+ } | {
749
+ type: 'reorderShape';
750
+ slideId: string;
751
+ shapeId: string;
752
+ to: 'front' | 'back' | 'forward' | 'backward';
753
+ } | {
754
+ type: 'insertTableRow';
755
+ slideId: string;
756
+ shapeId: string;
757
+ index: number;
758
+ position: 'before' | 'after';
759
+ cells?: string[];
760
+ } | {
761
+ type: 'deleteTableRow';
762
+ slideId: string;
763
+ shapeId: string;
764
+ index: number;
765
+ } | {
766
+ type: 'insertTableColumn';
767
+ slideId: string;
768
+ shapeId: string;
769
+ index: number;
770
+ position: 'before' | 'after';
771
+ cells?: string[];
772
+ width?: 'split' | 'copy';
773
+ } | {
774
+ type: 'deleteTableColumn';
775
+ slideId: string;
776
+ shapeId: string;
777
+ index: number;
778
+ } | {
779
+ type: 'insertSlide';
780
+ ref?: string;
781
+ afterSlideId: string | null;
782
+ layoutPartPath?: string;
783
+ } | {
784
+ type: 'duplicateSlide';
785
+ ref?: string;
786
+ slideId: string;
787
+ afterSlideId?: string | null;
788
+ } | {
789
+ type: 'deleteSlide';
790
+ slideId: string;
791
+ } | {
792
+ type: 'moveSlide';
793
+ slideId: string;
794
+ afterSlideId: string | null;
795
+ } | {
617
796
  type: 'replaceText';
618
797
  storyId: string;
619
798
  start: number;
@@ -632,6 +811,10 @@ type ProposalEdit = {
632
811
  start: number;
633
812
  end: number;
634
813
  alignment: ParagraphAlignment | 'justLow' | 'dist' | 'thaiDist' | null;
814
+ } | {
815
+ type: 'setStoryParagraphs';
816
+ storyId: string;
817
+ paragraphs: TextParagraphDraft[];
635
818
  } | {
636
819
  type: 'setShapeRect';
637
820
  slideId: string;
@@ -654,12 +837,30 @@ type ProposalEdit = {
654
837
  slideId: string;
655
838
  shapeId: string;
656
839
  adjustments: Record<string, number>;
840
+ } | {
841
+ type: 'setSlideLayout';
842
+ slideId: string;
843
+ layoutPartPath: string;
844
+ mapping?: [string, number][];
845
+ } | {
846
+ type: 'setSlideBackground';
847
+ slideId: string;
848
+ background: ShapeFill | null;
657
849
  } | {
658
850
  type: 'setSlideNotes';
659
851
  slideId: string;
660
852
  text: string;
661
853
  };
854
+ interface ProposalStripEntry {
855
+ slideId: string;
856
+ status: 'unchanged' | 'changed' | 'inserted' | 'deleted' | 'moved';
857
+ liveIndex: number | null;
858
+ previewIndex: number | null;
859
+ }
662
860
  interface ProposalChange {
861
+ kind?: 'content' | 'inserted' | 'deleted' | 'moved';
862
+ beforeIndex?: number | null;
863
+ afterIndex?: number | null;
663
864
  slideId: string;
664
865
  shapeId: string | null;
665
866
  before: ShapeSnapshot | null;
@@ -674,6 +875,7 @@ interface Proposal {
674
875
  edits: ProposalEdit[];
675
876
  changes: ProposalChange[];
676
877
  staleTargets: string[];
878
+ refs?: Record<string, string>;
677
879
  }
678
880
  interface ProposalPreview {
679
881
  proposal: Proposal;
@@ -685,9 +887,18 @@ interface ProposalTextChange {
685
887
  end: number;
686
888
  kind: 'insertion' | 'deletion';
687
889
  }
890
+ interface ProposalShapeChange {
891
+ shapeId: string;
892
+ kind: 'inserted' | 'deleted' | 'moved' | 'resized' | 'changed' | 'reordered';
893
+ }
688
894
  interface ProposalDiffSlide extends ProposalPreview {
895
+ shapeChanges?: ProposalShapeChange[];
689
896
  frame: SlideDisplayList;
690
897
  textChanges: ProposalTextChange[];
898
+ media?: {
899
+ assetId: string;
900
+ bytes: ArrayBuffer;
901
+ }[];
691
902
  }
692
903
  interface ProposalAcceptance {
693
904
  proposalId: string;
@@ -698,6 +909,12 @@ declare class StaleProposalError extends Error {
698
909
  readonly targets: string[];
699
910
  constructor(targets: string[]);
700
911
  }
912
+ declare class ProposalPictureMediaTooLargeError extends Error {
913
+ readonly totalBytes: number;
914
+ readonly limitBytes: number;
915
+ readonly code = "proposalPictureMediaTooLarge";
916
+ constructor(totalBytes: number, limitBytes?: number);
917
+ }
701
918
 
702
919
  type CanvasImageResolver = ((assetId: string) => CanvasImageSource | Promise<CanvasImageSource | null> | null) & {
703
920
  acquire?(): CanvasImageResolver;
@@ -707,6 +924,31 @@ interface PaintSlideOptions {
707
924
  resolveImage?: CanvasImageResolver;
708
925
  maxShadowPixels?: number;
709
926
  textChanges?: readonly ProposalTextChange[];
927
+ shapeChanges?: readonly ProposalShapeChange[];
928
+ /** The family a run paints with in place of its own, e.g. an export's private face. */
929
+ fontFamily?: (font: {
930
+ family: string;
931
+ bold: boolean;
932
+ italic: boolean;
933
+ id: number;
934
+ }) => string | undefined;
935
+ /**
936
+ * Makes the faces a slide draws with ready before any text is painted. Without it, text draws with each run's own
937
+ * family, as the host installed it.
938
+ */
939
+ fontCoverage?: PaintFontCoverage;
940
+ }
941
+ /** Prepares the fonts a paint draws text with. */
942
+ interface PaintFontCoverage {
943
+ /**
944
+ * Resolves once every character of `text` can be drawn in `family`, with the family name to draw it with (for
945
+ * example a newer installed revision of the same face).
946
+ */
947
+ prepare(family: string, text: string): Promise<string>;
948
+ /** The newest family to draw prepared text with now; a newer revision holds everything an older one did. */
949
+ latest?(family: string): string | undefined;
950
+ /** False for a style that draws under its own name, whatever the family's other styles do. Defaults to true. */
951
+ covers?(family: string, bold: boolean, italic: boolean): boolean;
710
952
  }
711
953
  interface SlideCanvasLike {
712
954
  width: number;
@@ -719,8 +961,53 @@ interface SlideCanvasLike {
719
961
  declare function sizeCanvasForSlide(canvas: SlideCanvasLike, list: Pick<SlideDisplayList, 'width' | 'height'>, dpr: number, scale?: number): void;
720
962
  declare function paintSlide(ctx: CanvasRenderingContext2D, list: SlideDisplayList, dpr?: number, scale?: number, options?: PaintSlideOptions): Promise<void>;
721
963
 
964
+ interface PresentationImageDecodeOptions {
965
+ maxDimension?: number;
966
+ }
967
+ declare function needsElementDecode(blob: Blob): boolean;
968
+ declare function decodeBrowserPresentationImage(bytes: Uint8Array, errorMessage: string, options?: PresentationImageDecodeOptions): Promise<CanvasImageSource>;
969
+ /**
970
+ * A metafile's display bytes: `resolve`'s replay of it, unless the browser
971
+ * path already draws it (a plain bitmap wrapper). Other images are unchanged.
972
+ * @internal
973
+ */
974
+ declare function metafileImageBytes(bytes: Uint8Array, resolve?: () => Uint8Array | undefined): Uint8Array;
975
+
976
+ /** What `renderPng` draws: a slide by zero-based index or by its ID. */
977
+ type PptxPngTarget = {
978
+ slide: number | string;
979
+ };
980
+ interface PptxPngOptions {
981
+ /** Device pixels per slide pixel. Defaults to 1. */
982
+ scale?: number;
983
+ /** `'slide'` (default) paints white under the slide, as the editor shows it; `'transparent'` nothing; or a `#rrggbb` color. */
984
+ background?: 'slide' | 'transparent' | `#${string}`;
985
+ /** Scratch pixels every shadow on the slide may blur between them. */
986
+ maxShadowPixels?: number;
987
+ signal?: AbortSignal;
988
+ /**
989
+ * Faces to paint with besides those the presentation registered, matched by
990
+ * family and style. One that fails to load rejects with `PngExportError`
991
+ * `font-unavailable`.
992
+ */
993
+ fonts?: ReadonlyArray<PptxFontFace>;
994
+ }
995
+
722
996
  type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
723
997
 
998
+ type FontDecoder = (bytes: ArrayBuffer | Uint8Array, options: {
999
+ codec: string;
1000
+ dict?: ArrayBuffer | Uint8Array;
1001
+ maxOutput?: number;
1002
+ }) => Promise<{
1003
+ font: ArrayBuffer;
1004
+ payload?: ArrayBuffer;
1005
+ }>;
1006
+ type FontDecodeResult = Awaited<ReturnType<FontDecoder>>;
1007
+ type FontDecoderMethods = {
1008
+ decodeFontFace(bytes: ArrayBuffer, options: Parameters<FontDecoder>[1], wasm?: ArrayBuffer | WebAssembly.Module): FontDecodeResult;
1009
+ };
1010
+
724
1011
  /**
725
1012
  * Result envelopes shared by the formats' host edit APIs. Targets, steps, receipts and failure
726
1013
  * codes stay format-owned; these shapes only fix how every format reports success and refusal.
@@ -1279,10 +1566,21 @@ declare class PptxExportError extends Error {
1279
1566
  constructor(failure: PptxExportFailure);
1280
1567
  }
1281
1568
 
1569
+ declare const decodeFontFace: FontDecoder;
1570
+
1282
1571
  type WasmInitInput = InitInput | Promise<InitInput>;
1283
1572
  interface InspectPresentationOptions {
1284
1573
  includeMedia?: boolean;
1285
1574
  }
1575
+ /**
1576
+ * Faces a save lays out text with, in a renderer of its own, so the saved
1577
+ * bytes do not depend on the faces earlier renders registered with the handle.
1578
+ */
1579
+ interface SavePresentationOptions {
1580
+ fonts: ReadonlyArray<PptxFontFace>;
1581
+ /** Faces drawn only for characters the run's own face has no glyph for. */
1582
+ fallbackFonts?: ReadonlyArray<PptxFontFace>;
1583
+ }
1286
1584
  interface OpenPresentationOptions {
1287
1585
  clientId?: number;
1288
1586
  fonts?: ReadonlyArray<PptxFontFace>;
@@ -1295,6 +1593,8 @@ interface OpenPresentationOptions {
1295
1593
  * and `save()` throws.
1296
1594
  */
1297
1595
  initialUpdate?: Uint8Array;
1596
+ /** @internal Retains the source bytes for `fork()` and `layouts()`; worker sessions pass false. */
1597
+ retainSource?: boolean;
1298
1598
  }
1299
1599
  type UndoCaptureMode = 'auto' | 'manual';
1300
1600
  interface PresentationHistoryReceipt {
@@ -1319,12 +1619,21 @@ type PresentationCommandReadResult = Extract<PptxReadResult, {
1319
1619
  }[];
1320
1620
  });
1321
1621
  interface PresentationHandle extends CollaborationReplica {
1622
+ /**
1623
+ * Draws a slide as PNG bytes with the editor's painter on a canvas, with the
1624
+ * faces layout measured with. Rejects with `PngExportError` rather than
1625
+ * paint a substitute font, and where no canvas exists names
1626
+ * `@betteroffice/pptx-native`.
1627
+ */
1628
+ renderPng(target: PptxPngTarget, options?: PptxPngOptions): Promise<Uint8Array>;
1322
1629
  isProposalsAvailable(): boolean;
1323
1630
  propose(agentId: string, note: string | null, edits: readonly ProposalEdit[]): Proposal;
1324
1631
  listProposals(): Proposal[];
1325
1632
  previewProposal(id: string): ProposalPreview;
1326
1633
  layoutProposalSlide(id: string, slideIndex: number): SlideDisplayList;
1327
1634
  layoutProposalDiffSlide(id: string, slideIndex: number): ProposalDiffSlide;
1635
+ layoutProposalDiffSlideById(id: string, slideId: string): ProposalDiffSlide;
1636
+ proposalSlideStrip(id: string): ProposalStripEntry[];
1328
1637
  acceptProposal(id: string, options?: {
1329
1638
  force?: boolean;
1330
1639
  }): ProposalAcceptance;
@@ -1383,13 +1692,24 @@ interface PresentationHandle extends CollaborationReplica {
1383
1692
  registerFont(face: PptxFontFace): number;
1384
1693
  /** Registers a face drawn only where a run's own face has no glyph. */
1385
1694
  registerFallbackFont(face: PptxFontFace): number;
1695
+ /** Gives PNG export the complete bytes of a family layout measured with only part of. */
1696
+ replaceExportFace(family: string, bytes: Uint8Array, keep?: (face: {
1697
+ id: number;
1698
+ bold?: boolean;
1699
+ italic?: boolean;
1700
+ }) => boolean): void;
1386
1701
  layoutSlide(slideIndex: number): SlideDisplayList;
1387
1702
  /** `layoutSlide` with scope, layout and serialize time measured inside the renderer. */
1388
1703
  layoutSlideProfiled(slideIndex: number): ProfiledLayout;
1389
1704
  hitTest(x: number, y: number): HitTestResult | null;
1390
1705
  mediaBytes(partPath: string): Uint8Array;
1391
- /** serialize the presentation back to .pptx bytes, edits included. */
1392
- save(): Uint8Array;
1706
+ metafileSvg(partPath: string): Uint8Array | undefined;
1707
+ /**
1708
+ * serialize the presentation back to .pptx bytes, edits included. Normal
1709
+ * autofit text the edits changed is fitted with the registered faces, or
1710
+ * with `options.fonts` alone when given.
1711
+ */
1712
+ save(options?: SavePresentationOptions): Uint8Array;
1393
1713
  insertText(storyId: string, index: number, text: string, style?: TextStyle): TextReceipt;
1394
1714
  /** `insertText` with the boundary's stage timings attached. */
1395
1715
  insertTextProfiled(storyId: string, index: number, text: string, style?: TextStyle): Profiled<TextReceipt>;
@@ -1503,6 +1823,12 @@ interface PresentationReplayReply {
1503
1823
  consumed: boolean;
1504
1824
  outcome: PresentationReplayOutcome;
1505
1825
  }
1826
+ type PptxStoryFormattingTarget = {
1827
+ slideId: string;
1828
+ shapeId: string;
1829
+ storyId: string;
1830
+ };
1831
+ declare function presentationStoryFormatting(handle: PresentationHandle, target: PptxStoryFormattingTarget): StorySnapshot;
1506
1832
  declare function isProposalsAvailable(): boolean;
1507
1833
  declare function initWasm(input?: WasmInitInput): Promise<void>;
1508
1834
  declare function isWasmAvailable(): boolean;
@@ -1568,6 +1894,14 @@ declare class SessionFailure extends Error {
1568
1894
  constructor(code: SessionFailureCode, message: string, diagnostics?: string | undefined);
1569
1895
  }
1570
1896
 
1897
+ /** @internal */
1898
+ interface FontCdnConfiguration {
1899
+ baseUrl: string | false;
1900
+ timeoutMs: number;
1901
+ }
1902
+
1903
+ /** PNG options a session call carries; an abort signal stays on the caller's side. */
1904
+ type PresentationPngOptions = Omit<PptxPngOptions, 'signal'>;
1571
1905
  /** @experimental */
1572
1906
  interface PresentationFrame {
1573
1907
  displayList: SlideDisplayList;
@@ -1602,6 +1936,8 @@ interface PresentationSessionOpenOptions extends Omit<OpenPresentationOptions, '
1602
1936
  fonts?: readonly PresentationSessionFont[];
1603
1937
  fallbackFonts?: readonly PresentationSessionFont[];
1604
1938
  wasm?: ArrayBuffer | WebAssembly.Module;
1939
+ /** @internal */
1940
+ fontCdn?: FontCdnConfiguration;
1605
1941
  }
1606
1942
  /**
1607
1943
  * Slide metadata without layout; indices are zero-based.
@@ -1654,6 +1990,8 @@ type PresentationSessionMethods = {
1654
1990
  height: number;
1655
1991
  };
1656
1992
  save(): ArrayBuffer;
1993
+ /** Draws a slide as PNG bytes in the session's engine, with the faces it measured with. */
1994
+ renderPng(target: PptxPngTarget, options?: PresentationPngOptions): ArrayBuffer;
1657
1995
  dispose(): void;
1658
1996
  };
1659
1997
 
@@ -1680,12 +2018,14 @@ interface OpenPresentationSessionOptions extends OpenPresentationOptions {
1680
2018
  */
1681
2019
  interface PresentationSession {
1682
2020
  readonly state: PresentationSessionState;
1683
- readonly call: Promisified<Omit<PresentationSessionMethods, 'open' | 'dispose' | 'frame'>> & {
2021
+ readonly call: Promisified<Omit<PresentationSessionMethods, 'open' | 'dispose' | 'frame' | 'renderPng'>> & {
1684
2022
  /**
1685
2023
  * @experimental A newer frame call replaces a queued one, which rejects with an error
1686
2024
  * named SessionSuperseded.
1687
2025
  */
1688
2026
  frame(slideIndex: number): Promise<PresentationFrame>;
2027
+ /** Draws a slide as PNG bytes in the session's engine. */
2028
+ renderPng(target: PptxPngTarget, options?: PptxPngOptions): Promise<Uint8Array>;
1689
2029
  };
1690
2030
  save(): Promise<Uint8Array>;
1691
2031
  on<K extends keyof PresentationSessionEvents>(name: K, listener: (payload: PresentationSessionEvents[K]) => void): () => void;
@@ -1699,7 +2039,7 @@ interface PresentationSession {
1699
2039
  */
1700
2040
  declare function openPresentationSession(bytes: Uint8Array | ArrayBuffer, options?: OpenPresentationSessionOptions): Promise<PresentationSession>;
1701
2041
 
1702
- declare const readMethods: readonly ["snapshot", "story", "anchorCaret", "resolveCaretAnchor", "version", "readContent", "findText", "validateEdits", "searchText", "isProposalsAvailable", "listProposals", "layoutSlide", "hitTest", "mediaBytes", "comments", "canUndo", "canRedo", "undoCaptureMode", "onUpdate"];
2042
+ declare const readMethods: readonly ["snapshot", "story", "anchorCaret", "resolveCaretAnchor", "version", "readContent", "findText", "validateEdits", "searchText", "proposalSlideStrip", "layoutProposalDiffSlideById", "isProposalsAvailable", "listProposals", "layoutSlide", "hitTest", "mediaBytes", "metafileSvg", "comments", "canUndo", "canRedo", "undoCaptureMode", "onUpdate"];
1703
2043
  interface PptxWorkerEditorInteractionAccess {
1704
2044
  snapshot(): {
1705
2045
  snapshot: DeckSnapshot;
@@ -1748,4 +2088,4 @@ interface PptxWorkerEditorSession {
1748
2088
  }
1749
2089
  declare function createPptxWorkerEditorSession(bytes: Uint8Array | ArrayBuffer, options?: PptxWorkerEditorOptions): PptxWorkerEditorSession;
1750
2090
 
1751
- export { type PptxExportDiagnostic as $, type PptxAnchor as A, type BlipEffect as B, type CanvasImageResolver as C, type DeckSnapshot as D, type EditProfile as E, type PptxAnchorScope as F, type GeometryPathCommand as G, type HistoryProfile as H, type ImageCrop as I, type PptxCaretAnchor as J, type PptxEditFailure as K, type LayoutProfile as L, type MarkdownAnchor as M, type PptxEditFailureCode as N, type OpenPresentationOptions as O, type Paint as P, type PptxEditHistory as Q, type PptxEditPreview as R, type SlideDisplayList as S, type PptxEditReceipt as T, type PptxEditRefusal as U, type PptxEditRequest as V, type PptxEditResult as W, type PptxEditSource as X, type PptxEditStep as Y, type PptxEditTarget as Z, type PptxExportComment as _, type CaretStop as a, type ShapeKind as a$, type PptxExportDiagnosticCode as a0, PptxExportError as a1, type PptxExportFailure as a2, type PptxExportFailureCode as a3, type PptxExportList as a4, type PptxExportMark as a5, type PptxExportNotes as a6, type PptxExportObject as a7, type PptxExportObjectKind as a8, type PptxExportOptions as a9, type PptxStructuredContent as aA, type PptxTextField as aB, type PptxTextGuard as aC, type PptxTextMatch as aD, type PptxTextRange as aE, type PptxTextSearchOptions as aF, type PptxTextSpan as aG, type PptxTextTarget as aH, type PptxValidationResult as aI, PptxWorkerEditorDisposedError as aJ, type PresentationHandle as aK, type PresetShapeDraft as aL, type PrimitiveTransform as aM, type Profiled as aN, type ProfiledLayout as aO, type Proposal as aP, type ProposalAcceptance as aQ, type ProposalChange as aR, type ProposalDiffSlide as aS, type ProposalEdit as aT, type ProposalPreview as aU, type ProposalTextChange as aV, type ShapeAdjustReceipt as aW, type ShapeDraft as aX, type ShapeFill as aY, type ShapeFillReceipt as aZ, type ShapeGradient as a_, type PptxExportParagraph as aa, type PptxExportRefusal as ab, type PptxExportResult as ac, type PptxExportRun as ad, type PptxExportShape as ae, type PptxExportShapeKind as af, type PptxExportSlide as ag, type PptxExportStory as ah, type PptxExportTable as ai, type PptxExportTableCell as aj, type PptxFindMatch as ak, type PptxFindRequest as al, type PptxFindResult as am, type PptxFindScope as an, type PptxFontFace as ao, type PptxMarkdownContent as ap, type PptxMarkdownOptions as aq, type PptxParagraphText as ar, PptxPeerNotReadyError as as, type PptxReadRequest as at, type PptxReadResult as au, type PptxShapeTarget as av, type PptxSlideTarget as aw, type PptxSourceProvenance as ax, type PptxStoryTarget as ay, type PptxStoryText as az, type ColorTransform as b, type PresentationSession as b$, type ShapeLineEnd as b0, type ShapeOutline as b1, type ShapePrimitive as b2, type ShapeReceipt as b3, type ShapeRect as b4, type ShapeSnapshot as b5, type ShapeStroke as b6, type ShapeStrokeReceipt as b7, type ShapeZOrderReceipt as b8, type SlideCanvasLike as b9, isProposalsAvailable as bA, isWasmAvailable as bB, openPresentation as bC, openPresentationSession as bD, paintSlide as bE, renderPptxMarkdown as bF, sizeCanvasForSlide as bG, wasmVersion as bH, type PresentationSlideSummary as bI, type PresentationWireFrame as bJ, SessionFailure as bK, type PresentationSessionOpenOptions as bL, type OpenPresentationSessionOptions as bM, PptxWorkerEditorFailedError as bN, PptxPeerHydrationError as bO, type PptxWorkerEditorAccess as bP, PptxWorkerEditorCollaborationError as bQ, type PptxWorkerEditorFrame as bR, type PptxWorkerEditorInteractionAccess as bS, type PptxWorkerEditorOperation as bT, type PptxWorkerEditorOptions as bU, type PptxWorkerEditorRecovery as bV, type PptxWorkerEditorReply as bW, type PptxWorkerEditorSession as bX, type PptxWorkerEditorStage as bY, type PptxWorkerEditorState as bZ, type PresentationFrame as b_, type SlideLayoutSnapshot as ba, type SlidePrimitive as bb, type SlideReceipt as bc, type SlideSnapshot as bd, StaleProposalError as be, type StorySnapshot as bf, type Stroke as bg, type StrokeEnd as bh, type TableReceipt as bi, type TextBoxPrimitive as bj, type TextParagraphDraft as bk, type TextReceipt as bl, type TextRunSnapshot as bm, type TextStyle as bn, type TextStylePatch as bo, type TextStyleSnapshot as bp, type TransformReceipt as bq, type UndoCaptureMode as br, type UpdateEvent as bs, type ValidationSuccess as bt, type WasmInitInput as bu, createPptxWorkerEditorSession as bv, exportPptxMarkdown as bw, exportPptxStructured as bx, initWasm as by, inspectPresentation as bz, type ColorValue as c, type PresentationSessionEvents as c0, type PresentationSessionFont as c1, type PresentationSessionMethods as c2, type PresentationSessionState as c3, type CommentFlavor as d, type CommentReceipt as e, type CommentSnapshot as f, type EditSuccess as g, type ExportCompletion as h, type ExportDiagnostic as i, type ExportSeverity as j, type HistoryResult as k, type HitTestResult as l, type ImageEffect as m, type ImagePrimitive as n, type InheritedGeometry as o, type InspectPresentationOptions as p, type OperationFailure as q, type OperationRefusal as r, type PaintSlideOptions as s, type ParagraphAlignment as t, type ParagraphSnapshot as u, type PictureDraft as v, type PlaceholderPrimitive as w, type PositionedGlyph as x, type PositionedTextLine as y, type PositionedTextRun as z };
2091
+ export { type PptxEditSource as $, type PictureDraft as A, type BlipEffect as B, type CanvasImageResolver as C, type DeckSnapshot as D, type EditProfile as E, type PlaceholderPrimitive as F, type GeometryPathCommand as G, type HeaderFooterSettings as H, type ImageCrop as I, type PositionedGlyph as J, type PositionedTextLine as K, type LayoutProfile as L, type MarkdownAnchor as M, type PositionedTextRun as N, type OpenPresentationOptions as O, type PresentationImageDecodeOptions as P, type PptxAnchor as Q, type PptxAnchorScope as R, type PptxCaretAnchor as S, type PptxEditFailure as T, type PptxEditFailureCode as U, type PptxEditHistory as V, type PptxEditPreview as W, type PptxEditReceipt as X, type PptxEditRefusal as Y, type PptxEditRequest as Z, type PptxEditResult as _, type CaretStop as a, type ProposalPreview as a$, type PptxEditStep as a0, type PptxEditTarget as a1, type PptxExportComment as a2, type PptxExportDiagnostic as a3, type PptxExportDiagnosticCode as a4, PptxExportError as a5, type PptxExportFailure as a6, type PptxExportFailureCode as a7, type PptxExportList as a8, type PptxExportMark as a9, type PptxReadResult as aA, type PptxShapeTarget as aB, type PptxSlideTarget as aC, type PptxSourceProvenance as aD, type PptxStoryTarget as aE, type PptxStoryText as aF, type PptxStructuredContent as aG, type PptxTextField as aH, type PptxTextGuard as aI, type PptxTextMatch as aJ, type PptxTextRange as aK, type PptxTextSearchOptions as aL, type PptxTextSpan as aM, type PptxTextTarget as aN, type PptxValidationResult as aO, PptxWorkerEditorDisposedError as aP, type PresentationHandle as aQ, type PresetShapeDraft as aR, type PrimitiveTransform as aS, type Profiled as aT, type ProfiledLayout as aU, type Proposal as aV, type ProposalAcceptance as aW, type ProposalChange as aX, type ProposalDiffSlide as aY, type ProposalEdit as aZ, ProposalPictureMediaTooLargeError as a_, type PptxExportNotes as aa, type PptxExportObject as ab, type PptxExportObjectKind as ac, type PptxExportOptions as ad, type PptxExportParagraph as ae, type PptxExportRefusal as af, type PptxExportResult as ag, type PptxExportRun as ah, type PptxExportShape as ai, type PptxExportShapeKind as aj, type PptxExportSlide as ak, type PptxExportStory as al, type PptxExportTable as am, type PptxExportTableCell as an, type PptxFindMatch as ao, type PptxFindRequest as ap, type PptxFindResult as aq, type PptxFindScope as ar, type PptxFontFace as as, type PptxMarkdownContent as at, type PptxMarkdownOptions as au, type PptxParagraphText as av, PptxPeerNotReadyError as aw, type PptxPngOptions as ax, type PptxPngTarget as ay, type PptxReadRequest as az, type ChartData as b, paintSlide as b$, type ProposalShapeChange as b0, type ProposalStripEntry as b1, type ProposalTextChange as b2, type SavePresentationOptions as b3, type ShapeAdjustReceipt as b4, type ShapeAltText as b5, type ShapeDraft as b6, type ShapeFill as b7, type ShapeFillReceipt as b8, type ShapeGradient as b9, type TextBoxPrimitive as bA, type TextLanguage as bB, type TextLink as bC, type TextLinkTarget as bD, type TextParagraphDraft as bE, type TextReceipt as bF, type TextRunSnapshot as bG, type TextStyle as bH, type TextStylePatch as bI, type TextStyleSnapshot as bJ, type TransformReceipt as bK, type UndoCaptureMode as bL, type UpdateEvent as bM, type ValidationSuccess as bN, type WasmInitInput as bO, createPptxWorkerEditorSession as bP, decodeFontFace as bQ, exportPptxMarkdown as bR, exportPptxStructured as bS, initWasm as bT, inspectPresentation as bU, isProposalsAvailable as bV, isWasmAvailable as bW, metafileImageBytes as bX, needsElementDecode as bY, openPresentation as bZ, openPresentationSession as b_, type ShapeKind as ba, type ShapeLineEnd as bb, type ShapeOutline as bc, type ShapePrimitive as bd, type ShapeReceipt as be, type ShapeRect as bf, type ShapeSnapshot as bg, type ShapeStroke as bh, type ShapeStrokeReceipt as bi, type ShapeZOrderReceipt as bj, type SlideCanvasLike as bk, type SlideDateText as bl, type SlideDisplayList as bm, type SlideHeaderFooter as bn, type SlideHeaderFooterText as bo, type SlideLayoutSnapshot as bp, type SlidePrimitive as bq, type SlideReceipt as br, type SlideSnapshot as bs, StaleProposalError as bt, type StorySnapshot as bu, type Stroke as bv, type StrokeEnd as bw, type TableGrid as bx, type TableGridCell as by, type TableReceipt as bz, type ChartDataSeries as c, renderPptxMarkdown as c0, sizeCanvasForSlide as c1, wasmVersion as c2, type FontDecoder as c3, type PresentationSlideSummary as c4, type PresentationWireFrame as c5, SessionFailure as c6, type FontDecoderMethods as c7, type FontCdnConfiguration as c8, type PresentationSessionOpenOptions as c9, type OpenPresentationSessionOptions as ca, PptxWorkerEditorFailedError as cb, PptxPeerHydrationError as cc, type PptxWorkerEditorAccess as cd, PptxWorkerEditorCollaborationError as ce, type PptxWorkerEditorFrame as cf, type PptxWorkerEditorInteractionAccess as cg, type PptxWorkerEditorOperation as ch, type PptxWorkerEditorOptions as ci, type PptxWorkerEditorRecovery as cj, type PptxWorkerEditorReply as ck, type PptxWorkerEditorSession as cl, type PptxWorkerEditorStage as cm, type PptxWorkerEditorState as cn, type PresentationFrame as co, type PresentationSession as cp, type PresentationSessionEvents as cq, type PresentationSessionFont as cr, type PresentationSessionMethods as cs, type PresentationSessionState as ct, decodeBrowserPresentationImage as cu, presentationStoryFormatting as cv, type ColorTransform as d, type ColorValue as e, type CommentFlavor as f, type CommentReceipt as g, type CommentSnapshot as h, type EditSuccess as i, type ExportCompletion as j, type ExportDiagnostic as k, type ExportSeverity as l, type HistoryProfile as m, type HistoryResult as n, type HitTestResult as o, type ImageEffect as p, type ImagePrimitive as q, type InheritedGeometry as r, type InspectPresentationOptions as s, type OperationFailure as t, type OperationRefusal as u, type Paint as v, type PaintFontCoverage as w, type PaintSlideOptions as x, type ParagraphAlignment as y, type ParagraphSnapshot as z };
Binary file