pdfjs-reader-core 0.5.10 → 0.5.11

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
@@ -2031,6 +2031,22 @@ interface EngineDeps {
2031
2031
  * visually in a narration context. Default: 3500ms.
2032
2032
  */
2033
2033
  minOverlayDurationMs?: number;
2034
+ /**
2035
+ * When true, only ONE annotation overlay is on-screen at any time: every
2036
+ * new overlay-emitting step first clears all prior overlays and their
2037
+ * auto-removal timers.
2038
+ *
2039
+ * Defaults to `isIOSMobile()` — on iOS Safari/WebKit, stacking 2-3 overlays
2040
+ * (e.g. highlight + box + underline + callout) on the same anchor is the
2041
+ * single biggest remaining crash vector we've measured. The GPU
2042
+ * compositor rejects the layer combination long before the canvas cap
2043
+ * kicks in. Dropping to one overlay at a time sacrifices overlay chaining
2044
+ * on iOS for a hard stability guarantee.
2045
+ *
2046
+ * Pass `false` explicitly to force multi-overlay mode even on iOS (e.g.
2047
+ * for tests or a deliberate opt-out in the consumer).
2048
+ */
2049
+ singleActiveOverlay?: boolean;
2034
2050
  }
2035
2051
  declare class StoryboardEngine {
2036
2052
  private deps;
@@ -2049,6 +2065,13 @@ declare class StoryboardEngine {
2049
2065
  */
2050
2066
  private overlayRemovalTimers;
2051
2067
  private currentStoryboardId;
2068
+ /**
2069
+ * Resolved value of `deps.singleActiveOverlay`. Cached at construction so
2070
+ * each step dispatch is a single branch rather than a per-call
2071
+ * userAgent sniff, and so the policy stays stable for the engine's
2072
+ * lifetime (a viewport flip that recreates the engine will re-evaluate).
2073
+ */
2074
+ private readonly singleActiveOverlay;
2052
2075
  constructor(deps: EngineDeps);
2053
2076
  /**
2054
2077
  * Execute a new storyboard. Cancels in-flight steps from the previous storyboard
package/dist/index.d.ts CHANGED
@@ -2031,6 +2031,22 @@ interface EngineDeps {
2031
2031
  * visually in a narration context. Default: 3500ms.
2032
2032
  */
2033
2033
  minOverlayDurationMs?: number;
2034
+ /**
2035
+ * When true, only ONE annotation overlay is on-screen at any time: every
2036
+ * new overlay-emitting step first clears all prior overlays and their
2037
+ * auto-removal timers.
2038
+ *
2039
+ * Defaults to `isIOSMobile()` — on iOS Safari/WebKit, stacking 2-3 overlays
2040
+ * (e.g. highlight + box + underline + callout) on the same anchor is the
2041
+ * single biggest remaining crash vector we've measured. The GPU
2042
+ * compositor rejects the layer combination long before the canvas cap
2043
+ * kicks in. Dropping to one overlay at a time sacrifices overlay chaining
2044
+ * on iOS for a hard stability guarantee.
2045
+ *
2046
+ * Pass `false` explicitly to force multi-overlay mode even on iOS (e.g.
2047
+ * for tests or a deliberate opt-out in the consumer).
2048
+ */
2049
+ singleActiveOverlay?: boolean;
2034
2050
  }
2035
2051
  declare class StoryboardEngine {
2036
2052
  private deps;
@@ -2049,6 +2065,13 @@ declare class StoryboardEngine {
2049
2065
  */
2050
2066
  private overlayRemovalTimers;
2051
2067
  private currentStoryboardId;
2068
+ /**
2069
+ * Resolved value of `deps.singleActiveOverlay`. Cached at construction so
2070
+ * each step dispatch is a single branch rather than a per-call
2071
+ * userAgent sniff, and so the policy stays stable for the engine's
2072
+ * lifetime (a viewport flip that recreates the engine will re-evaluate).
2073
+ */
2074
+ private readonly singleActiveOverlay;
2052
2075
  constructor(deps: EngineDeps);
2053
2076
  /**
2054
2077
  * Execute a new storyboard. Cancels in-flight steps from the previous storyboard
package/dist/index.js CHANGED
@@ -1879,6 +1879,15 @@ function detectDeviceCapabilities() {
1879
1879
  screenSize
1880
1880
  };
1881
1881
  }
1882
+ function isIOSMobile() {
1883
+ if (typeof window === "undefined" || typeof navigator === "undefined") {
1884
+ return false;
1885
+ }
1886
+ const ua = navigator.userAgent || "";
1887
+ if (/iPhone|iPad|iPod/i.test(ua)) return true;
1888
+ const isAppleTouch = /Mac/i.test(ua) && typeof navigator.maxTouchPoints === "number" && navigator.maxTouchPoints > 1;
1889
+ return isAppleTouch;
1890
+ }
1882
1891
  function getRenderConfig(quality = "auto", capabilities) {
1883
1892
  const caps = capabilities ?? detectDeviceCapabilities();
1884
1893
  if (quality === "auto") {
@@ -14811,6 +14820,7 @@ function SubtitleBar({ text }) {
14811
14820
  // src/director/storyboard-engine.ts
14812
14821
  init_narration_store();
14813
14822
  init_camera_math();
14823
+ init_mobile_config();
14814
14824
  var DEFAULT_MIN_OVERLAY_MS = 3500;
14815
14825
  var StoryboardEngine = class {
14816
14826
  constructor(deps) {
@@ -14830,6 +14840,7 @@ var StoryboardEngine = class {
14830
14840
  this.overlayRemovalTimers = /* @__PURE__ */ new Map();
14831
14841
  this.currentStoryboardId = 0;
14832
14842
  this.deps = deps;
14843
+ this.singleActiveOverlay = deps.singleActiveOverlay ?? isIOSMobile();
14833
14844
  }
14834
14845
  /**
14835
14846
  * Execute a new storyboard. Cancels in-flight steps from the previous storyboard
@@ -14999,6 +15010,10 @@ var StoryboardEngine = class {
14999
15010
  createdAt: Date.now(),
15000
15011
  expiresAt: Date.now() + visibleMs
15001
15012
  };
15013
+ if (this.singleActiveOverlay) {
15014
+ this.cancelAllRemovalTimers();
15015
+ narrationStore.getState().clearOverlays();
15016
+ }
15002
15017
  narrationStore.getState().addOverlay(overlay);
15003
15018
  const timer = setTimeout(() => {
15004
15019
  narrationStore.getState().removeOverlay(overlay.id);