flipbookengine 0.6.0 → 0.6.5

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
@@ -1,6 +1,19 @@
1
1
  # Changelog
2
2
 
3
- ## 0.6.0 (unreleased)
3
+ ## Next (unreleased)
4
+
5
+ ## 0.6.5
6
+
7
+ - added automatic A3 landscape PDF splitting with configurable auto, single, and split modes
8
+ - added source-page-aware lazy rendering for split PDF pages
9
+ - added optional light/dark viewer backgrounds and responsive presentation gutters
10
+ - enlarged the opt-in thumbnail rail and moved page labels into transparent, high-contrast overlays
11
+ - kept thumbnail labels black in both themes and preserved a thin neon selected state
12
+ - enabled native mobile scrolling to avoid non-cancelable touchstart interventions
13
+ - fixed single-view PDF hydration after switching from spread mode
14
+ - added regression coverage for PDF splitting, backgrounds, presentation layout, and PDF hydration
15
+
16
+ ## 0.6.0
4
17
 
5
18
  - added a localized, theme-aware Table of Contents panel with nested host-provided page entries
6
19
  - added TOC visibility events, page navigation, normalization, accessibility, and regression tests
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # FlipbookEngine
2
2
 
3
- > **Release notice:** `flipbookengine@0.5.3` is a valid published release. Upgrade to `0.5.4` or later for lifecycle, locale, and PDF render error-handling fixes. The post-tag source regression was corrected before the 0.5.4 release.
4
- > **Development notice:** `0.6.0` is the next unreleased feature candidate and adds the localized Table of Contents API. `0.5.4` remains the latest published version until the 0.6.0 release.
3
+ > **Release notice:** `flipbookengine@0.6.5` is the latest published release and includes the localized Table of Contents API.
4
+ > **Development notice:** Version 0.6.5 adds automatic PDF A3 splitting, per-theme backgrounds, responsive viewer gutters, enlarged thumbnails, and mobile touch fixes.
5
5
 
6
6
  [![NPM Version](https://img.shields.io/npm/v/flipbookengine?style=flat-square&color=blue)](https://www.npmjs.com/package/flipbookengine)
7
7
  [![License](https://img.shields.io/npm/l/flipbookengine?style=flat-square)](https://github.com/Bizeka/flipbook-engine/blob/main/LICENSE)
@@ -45,18 +45,23 @@ import pdfWorkerSrc from 'pdfjs-dist/build/pdf.worker.mjs?url';
45
45
 
46
46
  const engine = new FlipbookEngine('#viewer', {
47
47
  allowDownload: true,
48
- showThumbs: true,
48
+ showThumbs: false,
49
49
  primaryColor: '#7367f0',
50
50
  theme: 'auto',
51
51
  locale: 'en',
52
52
  pdfWorkerSrc,
53
- pdfRenderCacheSize: 32
53
+ pdfRenderCacheSize: 32,
54
+ pdfPageMode: 'auto',
55
+ background: {
56
+ light: { color: '#f8fafc', image: '/branding/light.webp', size: 'cover' },
57
+ dark: { color: '#0f172a', image: '/branding/dark.webp', size: 'cover' }
58
+ }
54
59
  });
55
60
 
56
61
  await engine.init('/files/catalog.pdf');
57
62
  ```
58
63
 
59
- Passing `pages` remains optional. When omitted, FlipbookEngine creates the page structure from `pdfUrl`, renders the first page before `init` resolves, and prefetches the next page. Additional pages render as they become visible or are selected.
64
+ Passing `pages` remains optional. When omitted, FlipbookEngine creates the page structure from `pdfUrl`, renders the first page before `init` resolves, and prefetches the next page. Additional pages render as they become visible or are selected. In `pdfPageMode: 'auto'` (the default), ISO A3 landscape pages are normalized into two logical pages; use `'single'` to keep every PDF page intact or `'split'` to split every landscape PDF page.
60
65
 
61
66
  `pdfRenderCacheSize` controls the per-instance LRU cache (default `32`, set to `0` to disable it).
62
67
 
@@ -65,7 +70,7 @@ Passing `pages` remains optional. When omitted, FlipbookEngine creates the page
65
70
  Use the ESM build with an import map for PDF.js. The worker must be served from a URL your site permits in its Content Security Policy.
66
71
 
67
72
  ```html
68
- <link rel="stylesheet" href="https://unpkg.com/flipbookengine@0.5.4/dist/flipbook-engine.css" />
73
+ <link rel="stylesheet" href="https://unpkg.com/flipbookengine@0.6.5/dist/flipbook-engine.css" />
69
74
  <div id="viewer" style="width: 100%; height: 600px;"></div>
70
75
 
71
76
  <script type="importmap">
@@ -76,7 +81,7 @@ Use the ESM build with an import map for PDF.js. The worker must be served from
76
81
  }
77
82
  </script>
78
83
  <script type="module">
79
- import { FlipbookEngine } from 'https://unpkg.com/flipbookengine@0.5.4/dist/flipbook-engine.js';
84
+ import { FlipbookEngine } from 'https://unpkg.com/flipbookengine@0.6.5/dist/flipbook-engine.js';
80
85
 
81
86
  const engine = new FlipbookEngine('#viewer', {
82
87
  pdfWorkerSrc: 'https://unpkg.com/pdfjs-dist@5.4.530/build/pdf.worker.min.mjs'
@@ -192,6 +197,12 @@ Supported events: `init`, `progress`, `pageChange`, `zoomChange`, `singlePageMod
192
197
  | `pdfWorkerSrc` | `string` | - | URL of the PDF.js worker emitted or hosted by the consuming application. |
193
198
  | `pdfRenderConcurrency` | `number` | `3` | Maximum number of PDF pages rendered concurrently when on-demand pages are requested. |
194
199
  | `pdfRenderCacheSize` | `number` | `32` | Maximum number of rendered PDF page images retained per engine instance (LRU); `0` disables caching. |
200
+ | `pdfPageMode` | `'auto' \| 'single' \| 'split'` | `'auto'` | Controls PDF page splitting: A3 landscape pages are split automatically, all landscape pages can be split explicitly, or splitting can be disabled. |
201
+ | `background` | `FlipbookBackgrounds \| null` | `null` | Optional light/dark viewer backgrounds with color, image, size, position, and repeat settings. |
202
+
203
+ ## PDF page formats
204
+
205
+ PDF.js page dimensions are detected at runtime, so portrait A4, landscape A4, and other page ratios are supported without a fixed size preset. A3 landscape pages are split into left/right logical pages when `pdfPageMode` is `'auto'` or `'split'`; the halves are presented as an A4-like spread in double-page mode.
195
206
 
196
207
  ## Styling and Theming
197
208
 
@@ -1,7 +1,7 @@
1
1
  import { FlipbookStore } from '../state/store';
2
2
 
3
3
  /**
4
- * @license FlipbookEngine v0.6.0
4
+ * @license FlipbookEngine v0.6.5
5
5
  * Copyright (c) 2026 Murat Dogan
6
6
  *
7
7
  * This source code is dual-licensed under the AGPLv3 and a Commercial License.
@@ -4,6 +4,14 @@ export interface PdfRenderProgress {
4
4
  completed: number;
5
5
  total: number;
6
6
  }
7
+ export type PdfPageMode = 'auto' | 'single' | 'split';
8
+ export interface PdfPageLayout {
9
+ width: number;
10
+ height: number;
11
+ split: boolean;
12
+ }
13
+ /** Detects ISO A3 landscape pages while allowing PDF metadata rounding and bleed. */
14
+ export declare function isA3Landscape(width: number, height: number): boolean;
7
15
  export interface PdfRenderOptions {
8
16
  scale?: number;
9
17
  quality?: number;
@@ -22,8 +30,10 @@ export declare class PdfRenderer {
22
30
  loadDocument(pdfUrl: string, signal?: AbortSignal): Promise<number>;
23
31
  /** Renders a specific page to a Data URL. The page index is 1-based. */
24
32
  renderPageToDataUrl(pageIndex: number, signal?: AbortSignal): Promise<string>;
25
- /** Calculates the best viewport dimensions based on the first page. */
26
- calculateViewportDimensions(baseShortSide?: number): Promise<{
33
+ /** Returns source page dimensions and whether the page should be split. */
34
+ getPageLayouts(mode?: PdfPageMode): Promise<PdfPageLayout[]>;
35
+ /** Calculates the best viewport dimensions based on the first logical page. */
36
+ calculateViewportDimensions(baseShortSide?: number, firstPageLayout?: PdfPageLayout): Promise<{
27
37
  width: number;
28
38
  height: number;
29
39
  }>;