teamsync-pdf-viewer 1.3.0 → 1.3.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to `teamsync-pdf-viewer` are documented here.
4
4
 
5
+ ## [1.3.2] — 2026-09-04
6
+
7
+ ### Fixed
8
+ - **Hardware-Bounded Canvas Texture Clamping**: Fixed crash and invisible content when zooming past 800% (up to 1000%) by clamping internal raster buffers to safe hardware limits (`MAX_CANVAS_DIM` = 4096 / 8192 px, `MAX_CANVAS_PIXELS` = 16.7 MP / ~64MB buffer) while keeping CSS layout full-sized for smooth, distortion-free GPU scaling.
9
+ - **In-Flight Render Task Cancellation**: Resolved UI freezing and crashes during rapid clicking of `+` / `-` zoom buttons by cancelling running PDF.js render tasks directly by reference and releasing completed/cancelled page resources (`page.cleanup()`).
10
+ - **Immediate GPU Texture Deallocation**: Zeroed offscreen `tempCanvas` dimensions immediately after raster blitting to return GPU backing texture memory to the system without waiting for garbage collection.
11
+ - **Zoom Gesture Debouncing**: Added 150ms debounce on zoom changes to allow existing textures to scale at 60fps via CSS transforms before triggering expensive PDF.js vector rasterization upon motion settling.
12
+ - **Eliminated False Cache Invalidation in `React.memo`**: Removed stale `scrollTop` / `scrollLeft` checks in `PageRenderer`, preventing re-rendering of all mounted pages on every scroll and zoom frame.
13
+ - **Scale-Aware Virtualization Window**: Virtualized document rows dynamically based on zoom scale, keeping mounted pages to a maximum of 3 at high zoom levels.
14
+ - **Intuitive Zoom Stepping Curves & Controls**: Implemented responsive stepping curves (+0.25 under 2x, +0.5 under 5x, +1.0 above 5x), capped max zoom at 1000% (`MAX_SCALE = 10.0`), and disabled `+` / `-` toolbar buttons at boundary limits. Exported `MIN_SCALE`, `MAX_SCALE`, `clampScale`, `calculateNextZoomIn`, and `calculateNextZoomOut`.
15
+
16
+ ## [1.3.1] — 2026-09-04
17
+
18
+ ### Fixed
19
+ - **Settings & Keyboard Shortcuts Customization**: Fixed settings search bar filtering across all shortcuts and general settings. Resolved shortcut recording and key normalization for US keyboard layouts (such as `Meta+Shift+=` and `Meta+Shift+-`), enabled `Escape` cancellation, and added a "Reset to Defaults" option.
20
+ - **Cross-Component Shortcut Synchronization**: Replaced local hook state with a shared reactive pub/sub store backed by `window.localStorage`, ensuring shortcut customizations sync immediately across all active viewer instances.
21
+ - **Viewer-Side Shortcut Execution**: Enabled full shortcut action handling in the viewer, adding support for `SEARCH` (`Meta+F`), `FILE_PICKER` (`Meta+O`), `COPY` (`Meta+C`), and `PASTE` (`Meta+V`) alongside existing rotation and undo/redo shortcuts. Added an "Open PDF..." action to the header menu and window-level shortcut handling.
22
+ - **Sidebar Search Bar**: Enabled immediate search on `Enter` keypress, immediate query and highlight clearing, auto-focus when opening the search tab, and corrected box-sizing to eliminate container overflow.
23
+
5
24
  ## [1.3.0] — 2026-09-04
6
25
 
7
26
  ### Added
@@ -13,6 +13,7 @@ interface HeaderProps {
13
13
  onZoomIn: () => void;
14
14
  onZoomOut: () => void;
15
15
  onZoomSet: (scale: number) => void;
16
+ onOpenFile?: () => void;
16
17
  onDownload: () => void;
17
18
  onFullScreen: () => void;
18
19
  onSaveAs: () => void;
@@ -32,5 +33,5 @@ interface HeaderProps {
32
33
  plugins?: ViewerPlugin[];
33
34
  permissions?: SDKPermissions;
34
35
  }
35
- export default function Header({ activeTab, setActiveTab, leftSidebarOpen, setLeftSidebarOpen, rightSidebarOpen, setRightSidebarOpen: _setRightSidebarOpen, sidebarTab, scale, onZoomIn, onZoomOut, onZoomSet, onDownload, onFullScreen, onSaveAs, onPrint, onOpenSettings, onOpenAbout, onOpenSidebarTab, pageTransition, setPageTransition, pageLayout, setPageLayout, rotation, setRotation, signatureCount, enableAnnotations, enableSign, plugins, permissions }: HeaderProps): React.JSX.Element;
36
+ export default function Header({ activeTab, setActiveTab, leftSidebarOpen, setLeftSidebarOpen, rightSidebarOpen, setRightSidebarOpen: _setRightSidebarOpen, sidebarTab, scale, onZoomIn, onZoomOut, onZoomSet, onOpenFile, onDownload, onFullScreen, onSaveAs, onPrint, onOpenSettings, onOpenAbout, onOpenSidebarTab, pageTransition, setPageTransition, pageLayout, setPageLayout, rotation, setRotation, signatureCount, enableAnnotations, enableSign, plugins, permissions }: HeaderProps): React.JSX.Element;
36
37
  export {};
@@ -5,9 +5,19 @@ export interface Shortcut {
5
5
  defaultCommand: string;
6
6
  command: string;
7
7
  }
8
+ export declare const DEFAULT_SHORTCUTS: Shortcut[];
9
+ export declare function loadStoredShortcuts(): Shortcut[];
8
10
  export declare function useShortcuts(): {
9
11
  shortcuts: Shortcut[];
10
12
  updateShortcut: (action: ActionType, newCommand: string) => void;
13
+ resetShortcuts: () => void;
11
14
  getCommand: (action: ActionType) => string;
12
15
  };
16
+ export interface ParsedCommand {
17
+ meta: boolean;
18
+ shift: boolean;
19
+ alt: boolean;
20
+ key: string;
21
+ }
22
+ export declare function parseCommandString(commandString: string): ParsedCommand;
13
23
  export declare function matchShortcut(e: KeyboardEvent, commandString: string): boolean;
@@ -31,4 +31,5 @@ export type { PrintOptions } from './core/print';
31
31
  export { usePdfSearch, searchPdfText } from './hooks/usePdfSearch';
32
32
  export type { SearchResult, SearchBounds } from './hooks/usePdfSearch';
33
33
  export type { TransientHighlight } from './core/types';
34
+ export { MIN_SCALE, MAX_SCALE, clampScale, calculateNextZoomIn, calculateNextZoomOut } from './utils/zoomUtils';
34
35
  export * from './plugins/types';
@@ -0,0 +1,32 @@
1
+ /**
2
+ * © 2026 AngelBot Ai Pvt Ltd. All rights reserved.
3
+ */
4
+ export declare const MIN_SCALE = 0.1;
5
+ export declare const MAX_SCALE = 10;
6
+ export declare const isSafariOrMobile: () => boolean;
7
+ export declare const MAX_CANVAS_DIM = 8192;
8
+ export declare const MAX_CANVAS_DIM_MOBILE = 4096;
9
+ export declare const MAX_CANVAS_PIXELS = 16777216;
10
+ /**
11
+ * Calculates the next step when zooming in.
12
+ * - Below 200%: steps by +25%
13
+ * - 200% to 500%: steps by +50%
14
+ * - 500% to 1000%: steps by +100%
15
+ */
16
+ export declare function calculateNextZoomIn(currentScale: number, maxScale?: number): number;
17
+ /**
18
+ * Calculates the next step when zooming out.
19
+ * - At or below 200%: steps by -25%
20
+ * - 200% to 500%: steps by -50%
21
+ * - Above 500%: steps by -100%
22
+ */
23
+ export declare function calculateNextZoomOut(currentScale: number, minScale?: number): number;
24
+ /**
25
+ * Clamps and rounds a requested zoom level within [minScale, maxScale].
26
+ */
27
+ export declare function clampScale(scale: number, minScale?: number, maxScale?: number): number;
28
+ /**
29
+ * Calculates the safe rasterization scale for PDF.js viewport rendering so that
30
+ * canvas dimensions and texture memory stay strictly within hardware limits.
31
+ */
32
+ export declare function calculateSafeRenderScale(scale: number, outputScale: number, unscaledWidth: number, unscaledHeight: number, maxDim?: number, maxPixels?: number): number;