@file-viewer/pptx 3.1.2 → 3.2.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/dist/viewer.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { PptxPresentationState } from './presentation';
2
- import type { PptxViewerOptions } from './types';
1
+ import type { PptxPresentationState } from "./presentation.js";
2
+ import type { PptxViewerOptions } from "./types.js";
3
3
  export declare class PptxViewer {
4
4
  static open(buffer: ArrayBuffer, target: HTMLElement, options?: PptxViewerOptions): Promise<PptxViewer>;
5
5
  readonly target: HTMLElement;
@@ -41,19 +41,9 @@ export declare class PptxViewer {
41
41
  get presenting(): boolean;
42
42
  get presentationSlideNumber(): number;
43
43
  private get styleRoot();
44
- /**
45
- * Where the slideshow overlay is mounted. It has to share a root with the injected slide styles,
46
- * or the engine's scoped CSS stops applying once the slides move into the overlay.
47
- */
48
44
  get presentationRoot(): ShadowRoot | HTMLElement;
49
- /** Force a slide out of the virtualized window so the slideshow can show it immediately. */
50
45
  ensureSlideRendered(slideNumber: number): Element | null;
51
46
  refreshLayout(): void;
52
- /**
53
- * Remember where the deck was scrolled before the slideshow moves the scale
54
- * box into the overlay. Moving it collapses the scroller and clamps scrollTop
55
- * to zero, so the position has to be captured up front and restored on exit.
56
- */
57
47
  saveScrollPosition(): void;
58
48
  restoreScrollPosition(): void;
59
49
  emitPresentationChange(state: PptxPresentationState): void;
@@ -89,7 +79,6 @@ export declare class PptxViewer {
89
79
  private findSlideWindowTarget;
90
80
  private postProcessRenderedContent;
91
81
  private postProcessSlideRecord;
92
- /** Materializes every lazy slide only for the duration of an export snapshot. */
93
82
  cloneForExport(): Promise<HTMLElement>;
94
83
  private complete;
95
84
  private fail;
package/dist/viewer.js CHANGED
@@ -1,9 +1,9 @@
1
- import { renderPptxPostProcessing } from './chart.js';
2
- import { resolvePptxEngineOptions, RECOMMENDED_ZIP_LIMITS } from './options.js';
3
- import { PptxPresentation } from './presentation.js';
4
- import { sanitizePptxCss, sanitizePptxMarkup } from './sanitize.js';
5
- import { ensurePptxViewerStyles } from './styles.js';
6
- import { createPptxWorker } from './worker.js';
1
+ import { renderPptxPostProcessing } from "./chart.js";
2
+ import { resolvePptxEngineOptions, RECOMMENDED_ZIP_LIMITS } from "./options.js";
3
+ import { PptxPresentation } from "./presentation.js";
4
+ import { sanitizePptxCss, sanitizePptxMarkup } from "./sanitize.js";
5
+ import { ensurePptxViewerStyles } from "./styles.js";
6
+ import { createPptxWorker } from "./worker.js";
7
7
  const clamp = (value, min, max) => {
8
8
  return Math.min(max, Math.max(min, value));
9
9
  };
@@ -97,10 +97,6 @@ export class PptxViewer {
97
97
  this.previewThumbnailDataUrl = null;
98
98
  this.slideSize = null;
99
99
  this.slideRecords = [];
100
- // Total slides received from the worker. The windowed path mirrors this in
101
- // slideRecords, but the default (non-windowed) path appends slides straight
102
- // into the content node without creating records, so the deck size has to be
103
- // counted independently of the virtualization bookkeeping.
104
100
  this.totalSlides = 0;
105
101
  this.savedScroll = null;
106
102
  this.pendingScrollRestore = null;
@@ -164,10 +160,6 @@ export class PptxViewer {
164
160
  ? root
165
161
  : documentRef;
166
162
  }
167
- /**
168
- * Where the slideshow overlay is mounted. It has to share a root with the injected slide styles,
169
- * or the engine's scoped CSS stops applying once the slides move into the overlay.
170
- */
171
163
  get presentationRoot() {
172
164
  const documentRef = this.target.ownerDocument || document;
173
165
  const styleRoot = this.styleRoot;
@@ -176,7 +168,6 @@ export class PptxViewer {
176
168
  }
177
169
  return documentRef.body || documentRef.documentElement;
178
170
  }
179
- /** Force a slide out of the virtualized window so the slideshow can show it immediately. */
180
171
  ensureSlideRendered(slideNumber) {
181
172
  const record = this.slideRecords.find(item => item.slideNumber === slideNumber);
182
173
  if (!record) {
@@ -190,11 +181,6 @@ export class PptxViewer {
190
181
  refreshLayout() {
191
182
  this.scheduleResize();
192
183
  }
193
- /**
194
- * Remember where the deck was scrolled before the slideshow moves the scale
195
- * box into the overlay. Moving it collapses the scroller and clamps scrollTop
196
- * to zero, so the position has to be captured up front and restored on exit.
197
- */
198
184
  saveScrollPosition() {
199
185
  const view = this.target.ownerDocument.defaultView || window;
200
186
  const HTMLElementCtor = view.HTMLElement;
@@ -536,9 +522,6 @@ export class PptxViewer {
536
522
  }
537
523
  const windowOptions = this.getSlideWindowOptions();
538
524
  const indexesToRender = this.getWindowedSlideIndexes(windowOptions);
539
- // While presenting, the active slide and its neighbour live inside the fixed
540
- // overlay, outside the scroll-view geometry the windowing code measures. Keep
541
- // them mounted so a resize cannot unmount the slide that is on screen.
542
525
  const presentation = this.presentation;
543
526
  if (presentation === null || presentation === void 0 ? void 0 : presentation.active) {
544
527
  const activeIndex = this.slideRecords.findIndex(record => record.slideNumber === presentation.slideNumber);
@@ -711,7 +694,6 @@ export class PptxViewer {
711
694
  }
712
695
  await record.postProcessPromise;
713
696
  }
714
- /** Materializes every lazy slide only for the duration of an export snapshot. */
715
697
  async cloneForExport() {
716
698
  if (!this.shouldWindowSlides()) {
717
699
  return this.target.cloneNode(true);
@@ -878,7 +860,6 @@ export class PptxViewer {
878
860
  }
879
861
  resize() {
880
862
  var _a, _b, _c;
881
- // While presenting, the slideshow owns the transform of the same nodes.
882
863
  if ((_a = this.presentation) === null || _a === void 0 ? void 0 : _a.active) {
883
864
  this.presentation.layout();
884
865
  return;
@@ -901,8 +882,6 @@ export class PptxViewer {
901
882
  this.scaleBox.style.width = `${Math.ceil(slideWidth * effectiveScale)}px`;
902
883
  this.scaleBox.style.height = `${Math.ceil(this.content.scrollHeight * effectiveScale)}px`;
903
884
  this.scaleBox.style.minHeight = '';
904
- // The scale box height is recomputed above; only now can the saved scroll
905
- // position be applied without the scroller clamping it back to zero.
906
885
  if (this.pendingScrollRestore) {
907
886
  const { top, left } = this.pendingScrollRestore;
908
887
  this.pendingScrollRestore = null;