pdfjs-reader-core 0.5.5 → 0.5.7

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.d.cts CHANGED
@@ -1858,19 +1858,40 @@ interface TutorModeContainerProps {
1858
1858
  * Added in v0.4.2.
1859
1859
  */
1860
1860
  onPageChange?: (page: number) => void;
1861
+ /**
1862
+ * PDF-points → CSS-pixels scale factor. Direct override: when set, the
1863
+ * tutor renders the PDF at exactly this scale regardless of source DPI.
1864
+ * Takes precedence over `scale` when both are passed.
1865
+ *
1866
+ * If neither `renderScale` nor `scale` is passed:
1867
+ * - Desktop (`pointer: fine`): defaults to `page.dpi / 72` — identical
1868
+ * to pre-v0.6 behavior.
1869
+ * - Touch (`pointer: coarse`): defaults to fit-to-viewport — much
1870
+ * smaller canvas on mobile, sidesteps the iOS Safari crash root
1871
+ * cause even when bbox data ships at very high source DPI.
1872
+ *
1873
+ * Added in v0.6.0.
1874
+ */
1875
+ renderScale?: number;
1861
1876
  className?: string;
1862
1877
  }
1863
1878
  /** Build a cross-page/block index from the raw bbox list. */
1864
1879
  declare function buildBBoxIndex(bboxData: PageBBoxData[]): BBoxIndex;
1865
- declare function TutorModeContainer({ pageNumber, bboxData, narrationStore, scale, rotation, currentChunk, llm, idleTimeoutMs, llmTimeoutMs, embeddingProvider, showSubtitles, showExitButton, onExitTutorMode, minOverlayDurationMs, backgroundColor, loadingComponent, onPageChange, storyboardProvider, className, }: TutorModeContainerProps): react_jsx_runtime.JSX.Element;
1880
+ declare function TutorModeContainer({ pageNumber, bboxData, narrationStore, scale, rotation, currentChunk, llm, idleTimeoutMs, llmTimeoutMs, embeddingProvider, showSubtitles, showExitButton, onExitTutorMode, minOverlayDurationMs, backgroundColor, loadingComponent, onPageChange, storyboardProvider, renderScale, className, }: TutorModeContainerProps): react_jsx_runtime.JSX.Element;
1866
1881
 
1867
1882
  interface CinemaLayerProps {
1868
1883
  page: PageBBoxData;
1869
1884
  index: BBoxIndex;
1870
1885
  overlays: ActiveOverlay[];
1871
- scale: number;
1886
+ /**
1887
+ * Factor converting source-DPI pixel coords (the bbox space every
1888
+ * overlay primitive uses internally) into CSS-pixel coords. Applied
1889
+ * as `transform: scale(coordScale)` on the outer element so individual
1890
+ * overlay components don't need to know about CSS vs DPI space.
1891
+ */
1892
+ coordScale: number;
1872
1893
  }
1873
- declare function CinemaLayer({ page, index, overlays, scale, }: CinemaLayerProps): react_jsx_runtime.JSX.Element;
1894
+ declare function CinemaLayer({ page, index, overlays, coordScale, }: CinemaLayerProps): react_jsx_runtime.JSX.Element | null;
1874
1895
 
1875
1896
  interface CameraViewProps {
1876
1897
  camera: CameraState;
@@ -2062,8 +2083,24 @@ declare class StoryboardEngine {
2062
2083
  * `resetVisuals()` instead.
2063
2084
  */
2064
2085
  cancelPending(): void;
2065
- /** Cancel every removal timer (used by resetVisuals only). */
2086
+ /** Cancel every removal timer (used by resetVisuals and destroy). */
2066
2087
  private cancelAllRemovalTimers;
2088
+ /**
2089
+ * Full destructor — cancels both pending step timers AND overlay removal
2090
+ * timers. Use this in component unmount/cleanup. The per-storyboard
2091
+ * `cancelPending()` deliberately leaves overlay removal timers alone so a
2092
+ * mid-flight overlay doesn't get stranded (see `overlayRemovalTimers` doc),
2093
+ * but at destruction time we must release every timer or their closures
2094
+ * keep `deps` (narrationStore, the full bboxIndex) alive beyond the
2095
+ * lifetime of this engine. On iOS Safari with many engine recreations
2096
+ * this causes cumulative memory pressure and eventual tab reload.
2097
+ */
2098
+ destroy(): void;
2099
+ /** Test-only — exposes internal queue sizes for regression tests. */
2100
+ _queueSizesForTest(): {
2101
+ pending: number;
2102
+ removals: number;
2103
+ };
2067
2104
  /** Reset visuals: clear overlays, cancel every removal timer, fit camera. */
2068
2105
  resetVisuals(): void;
2069
2106
  /** Execute one step — dispatch to narrationStore. Returns true if applied. */
package/dist/index.d.ts CHANGED
@@ -1858,19 +1858,40 @@ interface TutorModeContainerProps {
1858
1858
  * Added in v0.4.2.
1859
1859
  */
1860
1860
  onPageChange?: (page: number) => void;
1861
+ /**
1862
+ * PDF-points → CSS-pixels scale factor. Direct override: when set, the
1863
+ * tutor renders the PDF at exactly this scale regardless of source DPI.
1864
+ * Takes precedence over `scale` when both are passed.
1865
+ *
1866
+ * If neither `renderScale` nor `scale` is passed:
1867
+ * - Desktop (`pointer: fine`): defaults to `page.dpi / 72` — identical
1868
+ * to pre-v0.6 behavior.
1869
+ * - Touch (`pointer: coarse`): defaults to fit-to-viewport — much
1870
+ * smaller canvas on mobile, sidesteps the iOS Safari crash root
1871
+ * cause even when bbox data ships at very high source DPI.
1872
+ *
1873
+ * Added in v0.6.0.
1874
+ */
1875
+ renderScale?: number;
1861
1876
  className?: string;
1862
1877
  }
1863
1878
  /** Build a cross-page/block index from the raw bbox list. */
1864
1879
  declare function buildBBoxIndex(bboxData: PageBBoxData[]): BBoxIndex;
1865
- declare function TutorModeContainer({ pageNumber, bboxData, narrationStore, scale, rotation, currentChunk, llm, idleTimeoutMs, llmTimeoutMs, embeddingProvider, showSubtitles, showExitButton, onExitTutorMode, minOverlayDurationMs, backgroundColor, loadingComponent, onPageChange, storyboardProvider, className, }: TutorModeContainerProps): react_jsx_runtime.JSX.Element;
1880
+ declare function TutorModeContainer({ pageNumber, bboxData, narrationStore, scale, rotation, currentChunk, llm, idleTimeoutMs, llmTimeoutMs, embeddingProvider, showSubtitles, showExitButton, onExitTutorMode, minOverlayDurationMs, backgroundColor, loadingComponent, onPageChange, storyboardProvider, renderScale, className, }: TutorModeContainerProps): react_jsx_runtime.JSX.Element;
1866
1881
 
1867
1882
  interface CinemaLayerProps {
1868
1883
  page: PageBBoxData;
1869
1884
  index: BBoxIndex;
1870
1885
  overlays: ActiveOverlay[];
1871
- scale: number;
1886
+ /**
1887
+ * Factor converting source-DPI pixel coords (the bbox space every
1888
+ * overlay primitive uses internally) into CSS-pixel coords. Applied
1889
+ * as `transform: scale(coordScale)` on the outer element so individual
1890
+ * overlay components don't need to know about CSS vs DPI space.
1891
+ */
1892
+ coordScale: number;
1872
1893
  }
1873
- declare function CinemaLayer({ page, index, overlays, scale, }: CinemaLayerProps): react_jsx_runtime.JSX.Element;
1894
+ declare function CinemaLayer({ page, index, overlays, coordScale, }: CinemaLayerProps): react_jsx_runtime.JSX.Element | null;
1874
1895
 
1875
1896
  interface CameraViewProps {
1876
1897
  camera: CameraState;
@@ -2062,8 +2083,24 @@ declare class StoryboardEngine {
2062
2083
  * `resetVisuals()` instead.
2063
2084
  */
2064
2085
  cancelPending(): void;
2065
- /** Cancel every removal timer (used by resetVisuals only). */
2086
+ /** Cancel every removal timer (used by resetVisuals and destroy). */
2066
2087
  private cancelAllRemovalTimers;
2088
+ /**
2089
+ * Full destructor — cancels both pending step timers AND overlay removal
2090
+ * timers. Use this in component unmount/cleanup. The per-storyboard
2091
+ * `cancelPending()` deliberately leaves overlay removal timers alone so a
2092
+ * mid-flight overlay doesn't get stranded (see `overlayRemovalTimers` doc),
2093
+ * but at destruction time we must release every timer or their closures
2094
+ * keep `deps` (narrationStore, the full bboxIndex) alive beyond the
2095
+ * lifetime of this engine. On iOS Safari with many engine recreations
2096
+ * this causes cumulative memory pressure and eventual tab reload.
2097
+ */
2098
+ destroy(): void;
2099
+ /** Test-only — exposes internal queue sizes for regression tests. */
2100
+ _queueSizesForTest(): {
2101
+ pending: number;
2102
+ removals: number;
2103
+ };
2067
2104
  /** Reset visuals: clear overlays, cancel every removal timer, fit camera. */
2068
2105
  resetVisuals(): void;
2069
2106
  /** Execute one step — dispatch to narrationStore. Returns true if applied. */