pptx-svelte-viewer 3.13.0 → 3.14.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/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as e, G as a, J as t, K as o, Q as i, W as r, X as n, Y as l, Z as S, a as d, at as m, c as p, ct as T, dt as v, et as P, ft as g, it as u, l as h, lt as c, mt as A, nt as C, o as N, ot as f, pt as k, q as D, rt as E, s as x, st as b, t as B, tt as I, u as O, ut as _ } from "./export-Txp0tpwN.js";
1
+ import { $ as e, G as a, J as t, K as o, Q as i, W as r, X as n, Y as l, Z as S, a as d, at as m, c as p, ct as T, dt as v, et as P, ft as g, it as u, l as h, lt as c, mt as A, nt as C, o as N, ot as f, pt as k, q as D, rt as E, s as x, st as b, t as B, tt as I, u as O, ut as _ } from "./export-BcVW1Iq0.js";
2
2
  import { i as R } from "./translator-DTR0k69d.js";
3
3
  import "./i18n.js";
4
4
  export {
@@ -1,5 +1,5 @@
1
1
  import { PptxData, PptxSlide } from 'pptx-viewer-core';
2
- import { CanvasSize } from 'pptx-viewer-shared';
2
+ import { CanvasSize, RasterizeElementResult, RasterizeElementTilesResult } from 'pptx-viewer-shared';
3
3
  import { ExportGifOptions } from './export-gif';
4
4
  import { OpenPrintWindow, PrintOptions } from './export-print';
5
5
  import { ExportVideoOptions } from './export-video';
@@ -25,6 +25,21 @@ export interface ExportControllerDeps {
25
25
  /** Live slide list (print needs slide notes/titles, not just the count). */
26
26
  getSlides(): PptxSlide[];
27
27
  rasterizeSlide: RasterizeSlide;
28
+ /**
29
+ * PNG-export / "copy slide as image" only: returns the full
30
+ * `RasterizeElementResult` (tiled `png-bytes` included) instead of a
31
+ * plain canvas. Optional so existing test fixtures that only configure
32
+ * `rasterizeSlide` keep working; `exportSlidePng`/`copySlideAsImage` fall
33
+ * back to wrapping `rasterizeSlide`'s canvas when omitted.
34
+ */
35
+ rasterizeSlideToRaster?: (index: number, scaleMultiplier?: number) => Promise<RasterizeElementResult>;
36
+ /**
37
+ * PDF export only: returns the raw per-tile canvases (no PNG stitching)
38
+ * instead of a plain canvas. Optional so existing test fixtures that only
39
+ * configure `rasterizeSlide` keep working; `exportPdf` falls back to
40
+ * placing a single full-page image (today's behaviour) when omitted.
41
+ */
42
+ rasterizeSlideToTiles?: (index: number, scaleMultiplier?: number) => Promise<RasterizeElementTilesResult>;
28
43
  /** Print-surface opener override; see `export-print.ts` for the default. */
29
44
  openPrintWindow?: OpenPrintWindow;
30
45
  /** Base file name (without extension) for downloads. Defaults to `presentation`. */
@@ -1 +1 @@
1
- {"version":3,"file":"export-controller.svelte.d.ts","sourceRoot":"","sources":["../../../src/viewer/export/export-controller.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AASrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGzD;0DAC0D;AAC1D,MAAM,MAAM,cAAc,GAAG,CAC5B,KAAK,EAAE,MAAM,EACb,eAAe,CAAC,EAAE,MAAM,KACpB,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEhC,uEAAuE;AACvE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAEtE,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAChC,sEAAsE;IACtE,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,mEAAmE;IACnE,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACpC,kDAAkD;IAClD,a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file":"export-controller.svelte.d.ts","sourceRoot":"","sources":["../../../src/viewer/export/export-controller.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EACX,UAAU,EACV,sBAAsB,EACtB,2BAA2B,EAC3B,MAAM,oBAAoB,CAAC;AAW5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAIzD;0DAC0D;AAC1D,MAAM,MAAM,cAAc,GAAG,CAC5B,KAAK,EAAE,MAAM,EACb,eAAe,CAAC,EAAE,MAAM,KACpB,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEhC,uEAAuE;AACvE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAEtE,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAChC,sEAAsE;IACtE,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,mEAAmE;IACnE,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACpC,kDAAkD;IAClD,aAAa,IAAI,MAAM,CAAC;IACxB,qEAAqE;IACrE,UAAU,IAAI,MAAM,CAAC;IACrB,0DAA0D;IAC1D,aAAa,IAAI,UAAU,CAAC;IAC5B,4EAA4E;IAC5E,SAAS,IAAI,SAAS,EAAE,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE,CACxB,KAAK,EAAE,MAAM,EACb,eAAe,CAAC,EAAE,MAAM,KACpB,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACrC;;;;;OAKG;IACH,qBAAqB,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AY;IAC5B,6EAA6E;IAC7E,UAAU,EAAE,gBAAgB,CAAC;IAC7B,kEAAkE;IAClE,OAAO,IAAI,IAAI,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,GAAG,YAAY,CA8CvE"}
@@ -0,0 +1,18 @@
1
+ import { RasterizeElementTilesResult } from 'pptx-viewer-shared';
2
+ /** The subset of jsPDF's `addImage` this module needs (duck-typed so callers can pass the real `jsPDF` instance). */
3
+ export interface JsPdfImageTarget {
4
+ addImage(imageData: string, format: string, x: number, y: number, width: number, height: number): unknown;
5
+ }
6
+ /**
7
+ * Draw every tile of `tilesResult` onto `pdf`'s current page via `addImage`,
8
+ * each placed at its proportional position (`placeTileOnPage`) on a
9
+ * `pageWidth` x `pageHeight` page. Extracted out of `export-controller.svelte.ts`
10
+ * purely to keep that file under the file-size budget; also independently
11
+ * unit-testable without a `jsPDF` instance (a plain mock satisfying
12
+ * {@link JsPdfImageTarget} is enough).
13
+ *
14
+ * A single-tile result (the overwhelming majority of exports) degrades to
15
+ * exactly one full-page `addImage` call.
16
+ */
17
+ export declare function addTiledPageImages(pdf: JsPdfImageTarget, tilesResult: RasterizeElementTilesResult, pageWidth: number, pageHeight: number): void;
18
+ //# sourceMappingURL=pdf-tile-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf-tile-page.d.ts","sourceRoot":"","sources":["../../../src/viewer/export/pdf-tile-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAGtE,qHAAqH;AACrH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CACP,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACZ,OAAO,CAAC;CACX;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,gBAAgB,EACrB,WAAW,EAAE,2BAA2B,EACxC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAChB,IAAI,CAkBN"}
@@ -0,0 +1,91 @@
1
+ import { PptxSlide } from 'pptx-viewer-core';
2
+ import { CanvasSize, FieldSubstitutionContext, RasterizeElementResult, RasterizeElementTilesResult } from 'pptx-viewer-shared';
3
+ import { Translator } from '../../i18n/translator';
4
+ /** Extracted from `rasterize-slide.ts` purely to keep that file under the file-size budget. */
5
+ export interface RasterizeSlideDeps {
6
+ doc: Document;
7
+ /** Host the off-screen capture stage is appended to; removed on `destroy()`. */
8
+ container: HTMLElement;
9
+ getSlides(): PptxSlide[];
10
+ getCanvasSize(): CanvasSize;
11
+ getMediaDataUrls(): Map<string, string>;
12
+ getTranslator(): Translator;
13
+ /** Opt-in WebGL SmartArt renderer flag; see `PowerPointViewerProps.smartArt3D`. */
14
+ smartArt3D: boolean;
15
+ /**
16
+ * Opt-in WebGL surface-chart renderer flag; see
17
+ * `PowerPointViewerProps.surfaceChart3D`.
18
+ */
19
+ surfaceChart3D: boolean;
20
+ /**
21
+ * Opt-in WebGL bar3D-chart renderer flag; see
22
+ * `PowerPointViewerProps.barChart3D`.
23
+ */
24
+ barChart3D: boolean;
25
+ /**
26
+ * Opt-in WebGL line3D-chart renderer flag; see
27
+ * `PowerPointViewerProps.lineChart3D`.
28
+ */
29
+ lineChart3D: boolean;
30
+ /**
31
+ * Opt-in WebGL area3D-chart renderer flag; see
32
+ * `PowerPointViewerProps.areaChart3D`.
33
+ */
34
+ areaChart3D: boolean;
35
+ /**
36
+ * Opt-in WebGL pie3D-chart renderer flag; see
37
+ * `PowerPointViewerProps.pieChart3D`.
38
+ */
39
+ pieChart3D: boolean;
40
+ /**
41
+ * Options > Advanced > "Default resolution" / "Do not compress images"
42
+ * raster-scale multiplier (see `resolveImageResolutionScale` in
43
+ * `pptx-viewer-shared`), applied on top of the baseline capture scale so
44
+ * the option has real effect without changing the default (highFidelity)
45
+ * export quality.
46
+ */
47
+ getImageResolutionScale(): number;
48
+ /**
49
+ * Deck-level OOXML field-substitution context. The capture stage is mounted
50
+ * outside the viewer tree, so without this an exported PNG/PDF would print
51
+ * the authored "Slide #" placeholder while the screen shows "Slide 1".
52
+ * `SlideStage` re-points its per-slide fields at the slide being captured.
53
+ */
54
+ getFieldContext?: () => FieldSubstitutionContext | undefined;
55
+ /**
56
+ * Overridable frame-wait before capture (test seam: the real
57
+ * `requestAnimationFrame` double-wait is not worth driving through fake
58
+ * timers). Defaults to `nextFrame` in `rasterize-slide.ts`.
59
+ */
60
+ waitForFrame?: () => Promise<void>;
61
+ }
62
+ export interface RasterizeSlideController {
63
+ /**
64
+ * Mount slide `index` and rasterise it to a single canvas, reducing scale
65
+ * (never tiling) if the requested resolution would exceed the browser's
66
+ * canvas cap. `scaleMultiplier` (default 1) is an extra factor on top of
67
+ * the baseline 2x * Options > Advanced > Image Size/Quality scale; the
68
+ * Print dialog's notes/handouts raster path passes a higher value when
69
+ * Options > Advanced > "High quality" is on, without changing plain
70
+ * PNG/PDF export.
71
+ */
72
+ rasterizeSlide(index: number, scaleMultiplier?: number): Promise<HTMLCanvasElement>;
73
+ /**
74
+ * Same capture as {@link rasterizeSlide}, but returns the full
75
+ * `RasterizeElementResult` instead of unwrapping/clamping to a single
76
+ * canvas. Used by the PNG-export and "copy slide as image" paths so a
77
+ * request whose full resolution exceeds the browser's canvas cap is
78
+ * tiled and stitched (`kind: 'png-bytes'`) instead of downscaled.
79
+ */
80
+ rasterizeSlideToRaster(index: number, scaleMultiplier?: number): Promise<RasterizeElementResult>;
81
+ /**
82
+ * Same capture as {@link rasterizeSlide}, but returns the raw per-tile
83
+ * canvases (no PNG stitching) instead of a single canvas. Used by PDF
84
+ * export so a page whose resolution exceeds the browser canvas cap is
85
+ * composed of several small tile images instead of one oversized canvas.
86
+ */
87
+ rasterizeSlideToTiles(index: number, scaleMultiplier?: number): Promise<RasterizeElementTilesResult>;
88
+ /** Remove the off-screen capture stage from the DOM. */
89
+ destroy(): void;
90
+ }
91
+ //# sourceMappingURL=rasterize-slide-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rasterize-slide-types.d.ts","sourceRoot":"","sources":["../../../src/viewer/export/rasterize-slide-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EACX,UAAU,EACV,wBAAwB,EACxB,sBAAsB,EACtB,2BAA2B,EAC3B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,+FAA+F;AAC/F,MAAM,WAAW,kBAAkB;IAClC,GAAG,EAAE,QAAQ,CAAC;IACd,gFAAgF;IAChF,SAAS,EAAE,WAAW,CAAC;IACvB,SAAS,IAAI,SAAS,EAAE,CAAC;IACzB,aAAa,IAAI,UAAU,CAAC;IAC5B,gBAAgB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,aAAa,IAAI,UAAU,CAAC;IAC5B,mFAAmF;IACnF,UAAU,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB;;;;;;OAMG;IACH,uBAAuB,IAAI,MAAM,CAAC;IAClC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,wBAAwB,GAAG,SAAS,CAAC;IAC7D;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,wBAAwB;IACxC;;;;;;;;OAQG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACpF;;;;;;OAMG;IACH,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACjG;;;;;OAKG;IACH,qBAAqB,CACpB,KAAK,EAAE,MAAM,EACb,eAAe,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACxC,wDAAwD;IACxD,OAAO,IAAI,IAAI,CAAC;CAChB"}
@@ -1,76 +1,5 @@
1
- import { PptxSlide } from 'pptx-viewer-core';
2
- import { CanvasSize, FieldSubstitutionContext } from 'pptx-viewer-shared';
3
- import { Translator } from '../../i18n/translator';
4
- export interface RasterizeSlideDeps {
5
- doc: Document;
6
- /** Host the off-screen capture stage is appended to; removed on `destroy()`. */
7
- container: HTMLElement;
8
- getSlides(): PptxSlide[];
9
- getCanvasSize(): CanvasSize;
10
- getMediaDataUrls(): Map<string, string>;
11
- getTranslator(): Translator;
12
- /** Opt-in WebGL SmartArt renderer flag; see `PowerPointViewerProps.smartArt3D`. */
13
- smartArt3D: boolean;
14
- /**
15
- * Opt-in WebGL surface-chart renderer flag; see
16
- * `PowerPointViewerProps.surfaceChart3D`.
17
- */
18
- surfaceChart3D: boolean;
19
- /**
20
- * Opt-in WebGL bar3D-chart renderer flag; see
21
- * `PowerPointViewerProps.barChart3D`.
22
- */
23
- barChart3D: boolean;
24
- /**
25
- * Opt-in WebGL line3D-chart renderer flag; see
26
- * `PowerPointViewerProps.lineChart3D`.
27
- */
28
- lineChart3D: boolean;
29
- /**
30
- * Opt-in WebGL area3D-chart renderer flag; see
31
- * `PowerPointViewerProps.areaChart3D`.
32
- */
33
- areaChart3D: boolean;
34
- /**
35
- * Opt-in WebGL pie3D-chart renderer flag; see
36
- * `PowerPointViewerProps.pieChart3D`.
37
- */
38
- pieChart3D: boolean;
39
- /**
40
- * Options > Advanced > "Default resolution" / "Do not compress images"
41
- * raster-scale multiplier (see `resolveImageResolutionScale` in
42
- * `pptx-viewer-shared`), applied on top of the baseline capture scale so
43
- * the option has real effect without changing the default (highFidelity)
44
- * export quality.
45
- */
46
- getImageResolutionScale(): number;
47
- /**
48
- * Deck-level OOXML field-substitution context. The capture stage is mounted
49
- * outside the viewer tree, so without this an exported PNG/PDF would print
50
- * the authored "Slide #" placeholder while the screen shows "Slide 1".
51
- * `SlideStage` re-points its per-slide fields at the slide being captured.
52
- */
53
- getFieldContext?: () => FieldSubstitutionContext | undefined;
54
- /**
55
- * Overridable frame-wait before capture (test seam: the real
56
- * `requestAnimationFrame` double-wait is not worth driving through fake
57
- * timers). Defaults to {@link nextFrame}.
58
- */
59
- waitForFrame?: () => Promise<void>;
60
- }
61
- export interface RasterizeSlideController {
62
- /**
63
- * Render slide `index` off-screen at scale 1 and capture it with
64
- * html2canvas-pro. `scaleMultiplier` (default 1) is an extra factor on top
65
- * of the baseline 2x * Options > Advanced > Image Size/Quality scale; the
66
- * Print dialog's notes/handouts raster path passes a higher value when
67
- * Options > Advanced > "High quality" is on, without changing plain
68
- * PNG/PDF export.
69
- */
70
- rasterizeSlide(index: number, scaleMultiplier?: number): Promise<HTMLCanvasElement>;
71
- /** Remove the off-screen capture stage from the DOM. */
72
- destroy(): void;
73
- }
1
+ import { RasterizeSlideController, RasterizeSlideDeps } from './rasterize-slide-types';
2
+ export type { RasterizeSlideController, RasterizeSlideDeps } from './rasterize-slide-types';
74
3
  /**
75
4
  * Build the off-screen capture stage used by PNG/PDF export: a hidden host
76
5
  * (fixed off-canvas, `aria-hidden`) that mounts one slide at a time via
@@ -1 +1 @@
1
- {"version":3,"file":"rasterize-slide.d.ts","sourceRoot":"","sources":["../../../src/viewer/export/rasterize-slide.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,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sBA,OAAO,KAAK,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG5F,YAAY,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAwB5F;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,GAAG,wBAAwB,CAqKvF"}
@@ -12955,6 +12955,56 @@ interface RunProgramNotice {
12955
12955
  /** i18n key for the Copy button label. */
12956
12956
  readonly copyLabelKey: string;
12957
12957
  }
12958
+ //#endregion
12959
+ //#region src/export/rasterize-element-strategy.d.ts
12960
+ /** Which path actually produced the tile, for telemetry/tests. */
12961
+ type RasterStrategy = 'foreignObject' | 'vectorSvg' | 'html2canvas';
12962
+ /** The common case: a normal canvas any `toBlob`/`toDataURL` caller can use directly. */
12963
+ interface RasterizeElementCanvasResult {
12964
+ kind: 'canvas';
12965
+ canvas: HTMLCanvasElement;
12966
+ strategy: RasterStrategy;
12967
+ width: number;
12968
+ height: number;
12969
+ }
12970
+ /** The tiled case: pre-encoded PNG bytes, since no single canvas held the full image. */
12971
+ interface RasterizeElementPngBytesResult {
12972
+ kind: 'png-bytes';
12973
+ bytes: Uint8Array;
12974
+ width: number;
12975
+ height: number;
12976
+ /** Strategy used per tile, in row-major order, for diagnostics/tests. */
12977
+ strategies: RasterStrategy[];
12978
+ }
12979
+ type RasterizeElementResult = RasterizeElementCanvasResult | RasterizeElementPngBytesResult;
12980
+ //#endregion
12981
+ //#region src/export/rasterize-element-tiles.d.ts
12982
+ /** One rasterised tile: its full-raster position/size plus the canvas and strategy that produced it. */
12983
+ interface RasterizedTile {
12984
+ /** 0-based column index (tiles in the same row share increasing `col`). */
12985
+ col: number;
12986
+ /** 0-based row index. */
12987
+ row: number;
12988
+ /** Left edge, in full-raster device pixels. */
12989
+ x: number;
12990
+ /** Top edge, in full-raster device pixels. */
12991
+ y: number;
12992
+ width: number;
12993
+ height: number;
12994
+ canvas: HTMLCanvasElement;
12995
+ strategy: RasterStrategy;
12996
+ }
12997
+ /** The full set of tiles covering one element's export, tiled or not. */
12998
+ interface RasterizeElementTilesResult {
12999
+ /** Full raster width in device pixels (sum of every column's width). */
13000
+ fullWidth: number;
13001
+ /** Full raster height in device pixels (sum of every row's height). */
13002
+ fullHeight: number;
13003
+ /** `false` when a single tile already covers the whole export. */
13004
+ tiled: boolean;
13005
+ /** Every tile, row-major order. Exactly one entry when `tiled` is `false`. */
13006
+ tiles: RasterizedTile[];
13007
+ }
12958
13008
 
12959
13009
  //#endregion
12960
13010
  //#region src/ai/change-diff.d.ts
@@ -13363,6 +13413,21 @@ interface ExportControllerDeps {
13363
13413
  /** Live slide list (print needs slide notes/titles, not just the count). */
13364
13414
  getSlides(): PptxSlide[];
13365
13415
  rasterizeSlide: RasterizeSlide;
13416
+ /**
13417
+ * PNG-export / "copy slide as image" only: returns the full
13418
+ * `RasterizeElementResult` (tiled `png-bytes` included) instead of a
13419
+ * plain canvas. Optional so existing test fixtures that only configure
13420
+ * `rasterizeSlide` keep working; `exportSlidePng`/`copySlideAsImage` fall
13421
+ * back to wrapping `rasterizeSlide`'s canvas when omitted.
13422
+ */
13423
+ rasterizeSlideToRaster?: (index: number, scaleMultiplier?: number) => Promise<RasterizeElementResult>;
13424
+ /**
13425
+ * PDF export only: returns the raw per-tile canvases (no PNG stitching)
13426
+ * instead of a plain canvas. Optional so existing test fixtures that only
13427
+ * configure `rasterizeSlide` keep working; `exportPdf` falls back to
13428
+ * placing a single full-page image (today's behaviour) when omitted.
13429
+ */
13430
+ rasterizeSlideToTiles?: (index: number, scaleMultiplier?: number) => Promise<RasterizeElementTilesResult>;
13366
13431
  /** Print-surface opener override; see `export-print.ts` for the default. */
13367
13432
  openPrintWindow?: OpenPrintWindow;
13368
13433
  /** Base file name (without extension) for downloads. Defaults to `presentation`. */
@@ -1,4 +1,4 @@
1
- import { A as e, M as a, c as s, d as t, f as i, gt as l, ht as S, i as n, j as o, l as v, m as d, n as p, o as b, p as g, r as c, s as x, t as m, u as w } from "../export-Txp0tpwN.js";
1
+ import { A as e, M as a, c as s, d as t, f as i, gt as l, ht as S, i as n, j as o, l as v, m as d, n as p, o as b, p as g, r as c, s as x, t as m, u as w } from "../export-BcVW1Iq0.js";
2
2
  var T = a, A = o, P = e;
3
3
  export {
4
4
  m as PowerPointViewer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptx-svelte-viewer",
3
- "version": "3.13.0",
3
+ "version": "3.14.0",
4
4
  "description": "Svelte 5 PowerPoint viewer and editor component: render, edit, present, and export PPTX slides in the browser.",
5
5
  "keywords": [
6
6
  "office",