flipbookengine 1.0.0 → 1.0.3
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 +25 -2
- package/README.md +12 -6
- package/dist/components/AnnotationPlacement.d.ts +5 -0
- package/dist/components/AnnotationPopover.d.ts +10 -0
- package/dist/components/App.d.ts +9 -2
- package/dist/components/NoteEditor.d.ts +13 -0
- package/dist/components/NotePlacementLayer.d.ts +11 -0
- package/dist/components/NotesPanel.d.ts +9 -6
- package/dist/components/ReaderHelp.d.ts +3 -0
- package/dist/components/ReaderShortcuts.d.ts +16 -0
- package/dist/components/TableOfContents.d.ts +1 -0
- package/dist/components/TextLayer.d.ts +8 -0
- package/dist/components/Toolbar.d.ts +1 -1
- package/dist/components/ToolbarMore.d.ts +6 -0
- package/dist/components/Viewer.d.ts +2 -0
- package/dist/core/TextLayerLoader.d.ts +5 -0
- package/dist/core/domSignal.d.ts +2 -0
- package/dist/core-entry.d.ts +1 -0
- package/dist/engine-B7R3u8jR.js +4661 -0
- package/dist/engine-B7R3u8jR.js.map +1 -0
- package/dist/engine.d.ts +23 -0
- package/dist/flipbook-engine.core.js +1 -1
- package/dist/flipbook-engine.css +1 -1
- package/dist/flipbook-engine.iife.js +34 -47
- package/dist/flipbook-engine.iife.js.map +1 -1
- package/dist/flipbook-engine.js +1 -1
- package/dist/flipbook-engine.react.js +1 -1
- package/dist/flipbook-engine.vue.js +1 -1
- package/dist/i18n/locales/en.d.ts +22 -0
- package/dist/i18n/locales/tr.d.ts +22 -0
- package/dist/i18n/service.d.ts +66 -0
- package/dist/index.d.ts +3 -0
- package/dist/model/annotations.d.ts +1 -0
- package/dist/model/backend.d.ts +8 -0
- package/dist/model/note-editor.d.ts +22 -0
- package/dist/model/text-layer.d.ts +21 -0
- package/dist/state/store.d.ts +16 -0
- package/docs/api-reference.md +227 -205
- package/docs/backend-text-layers.md +40 -0
- package/package.json +1 -1
- package/dist/engine-Dt2Fn6O-.js +0 -4060
- package/dist/engine-Dt2Fn6O-.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.3 - 2026-10-24
|
|
4
|
+
|
|
5
|
+
- Fixed placing coordinate notes on Node 18 and on pages served over plain HTTP, where the browser or runtime has no `crypto.randomUUID`; the viewer now falls back to a generated note id.
|
|
6
|
+
|
|
7
|
+
## 1.0.2 - 2026-10-24
|
|
8
|
+
|
|
9
|
+
- Native backend search, page-note and coordinate-annotation providers, including multiple note markers per page and host-owned persistence.
|
|
10
|
+
- Optional restricted rich-note editor factory and validated structured-note rendering; native note list, marker popups, edit/delete and failed-save draft retention.
|
|
11
|
+
- Responsive native panels and More actions menu, localized keyboard help, focus restoration and gesture isolation for notes, zoom and page navigation.
|
|
12
|
+
- Optional backend text-layer provider for image/WebP books, with schema v1 normalized logical-page runs and UTF-16 offsets.
|
|
13
|
+
- Bounded current/adjacent-page loading, abort/stale-response isolation, defensive geometry validation and opt-in native text selection.
|
|
14
|
+
- Isolated page images from host padding/margins so normalized overlays align with the complete page viewport.
|
|
15
|
+
- Select-text command in the native More actions menu; Escape exits selection without hijacking page flipping or note gestures.
|
|
16
|
+
- Backend search highlights continue to work independently of a text layer. OCR, persistence and search indexing remain host responsibilities.
|
|
17
|
+
- Muted toolbar and More-menu items no longer show a diagonal strike line; they are only dimmed.
|
|
18
|
+
- Toolbar play/pause and sound icons now switch by rendering a single icon instead of toggling two hidden ones.
|
|
19
|
+
- The bottom toolbar adapts its buttons to the available width.
|
|
20
|
+
- PDF mode renders the previous, current and next pages ahead of time (and the facing page in two-page view), so flipping shows pages without a blank flash; zoom reuses the rendered page image.
|
|
21
|
+
- Page overlays (text layer, search highlights, hotspots, note placement) are drawn only in single-page view where they belong; page images no longer use native lazy loading.
|
|
22
|
+
- The note popover is more compact, with smaller action buttons on mouse devices and touch-sized buttons on touch devices.
|
|
23
|
+
- Removed a duplicate region landmark around the viewer for cleaner screen-reader navigation.
|
|
24
|
+
- Fixed a type error in PDF page rendering when a rendered page has no image data.
|
|
25
|
+
|
|
3
26
|
## 1.0.0 - 2026-09-14
|
|
4
27
|
|
|
5
28
|
- first stable open-source release of the FlipbookEngine viewer
|
|
@@ -9,7 +32,7 @@
|
|
|
9
32
|
- added interactive hotspot overlays with image/video/audio previews, selectable image galleries, and commerce/product links
|
|
10
33
|
- added plugin and embed regression coverage; full suite passes 84/84 tests
|
|
11
34
|
- documented PDF outline extraction, OCR, analytics, backend rendering, and protected downloads as commercial/backend responsibilities
|
|
12
|
-
- breaking change: 0.x releases were alpha/beta and are not compatibility guarantees; applications should validate imports and options against the 1.0 API before upgrading
|
|
35
|
+
- breaking change: 0.x releases were alpha/beta and are not compatibility guarantees; applications should validate imports and options against the 1.0 API before upgrading
|
|
13
36
|
- 0.8.0 to 1.0.0 migration: documented public entrypoint changes, explicit plugin activation/deactivation, nested TOC/embed APIs, expanded hotspot payloads, and the unchanged image-mode search limitation
|
|
14
37
|
- added an origin-validated iframe embed bridge with parent-side command and event helpers
|
|
15
38
|
- added opt-in deep links, localized share controls, host-managed bookmarks and notes, and their regression coverage
|
|
@@ -93,4 +116,4 @@
|
|
|
93
116
|
- introduced dual-license documentation structure
|
|
94
117
|
- prepared package metadata for public distribution
|
|
95
118
|
- preserved legacy `BizekaFlipEngine` compatibility alias
|
|
96
|
-
- added contribution, security, and trademark policy documents
|
|
119
|
+
- added contribution, security, and trademark policy documents
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# FlipbookEngine
|
|
2
2
|
|
|
3
|
-
> **
|
|
4
|
-
> **
|
|
3
|
+
> **Current release:** `flipbookengine@1.0.3` includes the localized Table of Contents API, backend text layers and coordinate notes.
|
|
4
|
+
> **1.0.0 scope:** Version 1.0.0 added the plugin contract, independent feature entrypoints, TOC runtime/embed APIs, and the complete open-source reader surface.
|
|
5
5
|
|
|
6
6
|
[](https://www.npmjs.com/package/flipbookengine)
|
|
7
7
|
[](https://github.com/Bizeka/flipbook-engine/blob/main/LICENSE)
|
|
@@ -27,6 +27,12 @@ FlipbookEngine is a modern, lightweight, and embeddable HTML flipbook viewer for
|
|
|
27
27
|
- **Client-Side PDF Search**: Extracts and searches PDF text on demand with localized snippets and normalized text-rectangle highlighting.
|
|
28
28
|
- **Interactive Hotspots**: Adds normalized page overlays with accessible plain-text popups and optional links.
|
|
29
29
|
|
|
30
|
+
## Backend text layers for image books
|
|
31
|
+
|
|
32
|
+
WebP/JPEG books can consume persistent text extracted by the host backend. Supply optional `textLayerProvider(pageIndex, signal)` alongside `searchProvider`. The reader loads at most the current page and its neighbors, validates normalized run coordinates, and overlays transparent selectable text without downloading the PDF. Enable **More actions > Select text**, or call `setTextSelection(true)`; Escape returns to navigation mode. Pointer selection is isolated from flip gestures and note long-press. Toolbar/keyboard page navigation stays available.
|
|
33
|
+
|
|
34
|
+
Extraction, OCR, indexing, authorization and persistence belong to the host, not the browser. A text layer is fixed-layout accessibility/selection data, not EPUB reflow. See [backend text layer contract](docs/backend-text-layers.md) and [API reference](docs/api-reference.md). These APIs are available from npm 1.0.2.
|
|
35
|
+
|
|
30
36
|
## Installation
|
|
31
37
|
|
|
32
38
|
Install via npm:
|
|
@@ -75,7 +81,7 @@ Passing `pages` remains optional. When omitted, FlipbookEngine creates the page
|
|
|
75
81
|
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.
|
|
76
82
|
|
|
77
83
|
```html
|
|
78
|
-
<link rel="stylesheet" href="https://unpkg.com/flipbookengine@1.0.
|
|
84
|
+
<link rel="stylesheet" href="https://unpkg.com/flipbookengine@1.0.3/dist/flipbook-engine.css" />
|
|
79
85
|
<div id="viewer" style="width: 100%; height: 600px;"></div>
|
|
80
86
|
|
|
81
87
|
<script type="importmap">
|
|
@@ -86,7 +92,7 @@ Use the ESM build with an import map for PDF.js. The worker must be served from
|
|
|
86
92
|
}
|
|
87
93
|
</script>
|
|
88
94
|
<script type="module">
|
|
89
|
-
import { FlipbookEngine } from 'https://unpkg.com/flipbookengine@1.0.
|
|
95
|
+
import { FlipbookEngine } from 'https://unpkg.com/flipbookengine@1.0.3/dist/flipbook-engine.js';
|
|
90
96
|
|
|
91
97
|
const engine = new FlipbookEngine('#viewer', {
|
|
92
98
|
pdfWorkerSrc: 'https://unpkg.com/pdfjs-dist@5.4.530/build/pdf.worker.min.mjs'
|
|
@@ -419,5 +425,5 @@ Host uygulamaları, kullanıcı notunu sayfa üzerindeki normalize koordinata ba
|
|
|
419
425
|
const engine = new FlipbookEngine('#viewer', {
|
|
420
426
|
annotations: [{ id: 'note-1', pageIndex: 4, x: .42, y: .36, text: 'Review pricing' }]
|
|
421
427
|
});
|
|
422
|
-
```
|
|
423
|
-
|
|
428
|
+
```
|
|
429
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FlipbookAnnotation } from '../model/annotations';
|
|
2
|
+
import { FlipbookStore } from '../state/store';
|
|
3
|
+
|
|
4
|
+
export declare function AnnotationPopover(props: {
|
|
5
|
+
store: FlipbookStore;
|
|
6
|
+
signal: AbortSignal;
|
|
7
|
+
onSave: (note: FlipbookAnnotation) => Promise<boolean>;
|
|
8
|
+
onDelete: (note: FlipbookAnnotation) => Promise<boolean>;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
}): import('@serenity-is/domwise').JSXElement;
|
package/dist/components/App.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FlipbookNoteDocument } from '../model/note-editor';
|
|
1
2
|
import { FlipbookSearchOptions } from '../model/search';
|
|
2
3
|
import { FlipbookHotspot } from '../model/hotspots';
|
|
3
4
|
import { FlipbookAnnotation } from '../model/annotations';
|
|
@@ -21,8 +22,13 @@ interface AppProps {
|
|
|
21
22
|
onShare: () => void;
|
|
22
23
|
onToggleBookmark: () => void;
|
|
23
24
|
onToggleNotes: () => void;
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
onSelectNote: (pageIndex: number) => void;
|
|
26
|
+
onBeginAnnotation: () => void;
|
|
27
|
+
onPlaceAnnotation: (pageIndex: number, x: number, y: number) => void;
|
|
28
|
+
onSaveAnnotation: (annotation: FlipbookAnnotation) => Promise<boolean>;
|
|
29
|
+
onDeleteAnnotation: (annotation: FlipbookAnnotation) => Promise<boolean>;
|
|
30
|
+
onSaveNote: (note: string, document?: FlipbookNoteDocument) => Promise<boolean>;
|
|
31
|
+
onClearNote: () => Promise<boolean>;
|
|
26
32
|
onCloseNotes: () => void;
|
|
27
33
|
onSearch: (query: string, options?: FlipbookSearchOptions) => void;
|
|
28
34
|
onClearSearch: () => void;
|
|
@@ -35,6 +41,7 @@ interface AppProps {
|
|
|
35
41
|
onToggleFullscreen: () => void;
|
|
36
42
|
store: FlipbookStore;
|
|
37
43
|
pluginRegistry?: FlipbookPluginRegistry;
|
|
44
|
+
signal: AbortSignal;
|
|
38
45
|
}
|
|
39
46
|
export declare function App(props: AppProps): import('@serenity-is/domwise').JSXElement;
|
|
40
47
|
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FlipbookNoteEditor, FlipbookNoteEditorFactory, FlipbookNoteValue } from '../model/note-editor';
|
|
2
|
+
|
|
3
|
+
export declare function NoteEditor(props: {
|
|
4
|
+
value: FlipbookNoteValue;
|
|
5
|
+
factory?: FlipbookNoteEditorFactory;
|
|
6
|
+
signal: AbortSignal;
|
|
7
|
+
label: string;
|
|
8
|
+
view: {
|
|
9
|
+
current: FlipbookNoteEditor | null;
|
|
10
|
+
};
|
|
11
|
+
onReady: (ready: boolean) => void;
|
|
12
|
+
onDraft?: (value: FlipbookNoteValue) => void;
|
|
13
|
+
}): HTMLDivElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FlipbookStore } from '../state/store';
|
|
2
|
+
|
|
3
|
+
type Place = (page: number, x: number, y: number) => void;
|
|
4
|
+
export declare function NotePlacementLayer(props: {
|
|
5
|
+
store: FlipbookStore;
|
|
6
|
+
pageIndex: number;
|
|
7
|
+
onPlace: Place;
|
|
8
|
+
}): import('@serenity-is/domwise').JSXElement;
|
|
9
|
+
/** Long press tolerates small finger movement; dragging/pinching always cancels it. */
|
|
10
|
+
export declare function bindNoteGestures(element: HTMLElement, store: FlipbookStore, place: Place, signal: AbortSignal): void;
|
|
11
|
+
export {};
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { FlipbookStore } from '../state/store';
|
|
2
|
+
import { FlipbookAnnotation } from '../model/annotations';
|
|
3
|
+
import { FlipbookNoteDocument } from '../model/note-editor';
|
|
2
4
|
|
|
3
5
|
interface NotesPanelProps {
|
|
4
6
|
store: FlipbookStore;
|
|
5
|
-
onSave: (note: string) =>
|
|
6
|
-
onClear: () =>
|
|
7
|
+
onSave: (note: string, document?: FlipbookNoteDocument) => Promise<boolean>;
|
|
8
|
+
onClear: () => Promise<boolean>;
|
|
7
9
|
onClose: () => void;
|
|
10
|
+
onSelect: (pageIndex: number) => void;
|
|
11
|
+
onAnnotation: (annotation: FlipbookAnnotation) => void;
|
|
12
|
+
onAdd: () => void;
|
|
13
|
+
signal: AbortSignal;
|
|
8
14
|
}
|
|
9
|
-
/**
|
|
10
|
-
* Page-level note UI. Persistence remains host-owned through the engine API and
|
|
11
|
-
* noteChange event; the panel intentionally does not know about a backend.
|
|
12
|
-
*/
|
|
15
|
+
/** The editor keeps its draft until the host confirms persistence. */
|
|
13
16
|
export declare function NotesPanel(props: NotesPanelProps): import('@serenity-is/domwise').JSXElement;
|
|
14
17
|
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FlipbookStore } from '../state/store';
|
|
2
|
+
import { InteractionManager } from '../core/InteractionManager';
|
|
3
|
+
import { PageFlipAdapter } from '../adapters/PageFlipAdapter';
|
|
4
|
+
|
|
5
|
+
export declare function ReaderShortcuts(root: HTMLElement, store: FlipbookStore, commands: {
|
|
6
|
+
pageFlipAdapterRef: {
|
|
7
|
+
current: PageFlipAdapter | null;
|
|
8
|
+
};
|
|
9
|
+
interactionManagerRef: {
|
|
10
|
+
current: InteractionManager | null;
|
|
11
|
+
};
|
|
12
|
+
onBeginAnnotation: () => void;
|
|
13
|
+
onToggleNotes: () => void;
|
|
14
|
+
onToggleFullscreen: () => void;
|
|
15
|
+
onAnnotationClose: () => void;
|
|
16
|
+
}, signal: AbortSignal): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FlipbookStore } from '../state/store';
|
|
2
|
+
|
|
3
|
+
/** Transparent text is loaded independently of the PDF and page image resolution. */
|
|
4
|
+
export declare function TextLayer(props: {
|
|
5
|
+
store: FlipbookStore;
|
|
6
|
+
pageIndex: number;
|
|
7
|
+
signal: AbortSignal;
|
|
8
|
+
}): import('@serenity-is/domwise').JSXElement;
|
|
@@ -20,5 +20,5 @@ interface ToolbarProps {
|
|
|
20
20
|
onToggleFullscreen: () => void;
|
|
21
21
|
pluginRegistry?: FlipbookPluginRegistry;
|
|
22
22
|
}
|
|
23
|
-
export declare function Toolbar(props: ToolbarProps):
|
|
23
|
+
export declare function Toolbar(props: ToolbarProps): HTMLElement;
|
|
24
24
|
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ReadonlySignal } from '@preact/signals-core';
|
|
2
|
+
import { FlipbookMessages } from '../i18n/service';
|
|
3
|
+
import { FlipbookStore } from '../state/store';
|
|
4
|
+
|
|
5
|
+
/** Secondary commands retain their original handlers and reactive icons. */
|
|
6
|
+
export declare function attachToolbarMore(toolbar: HTMLElement, messages: ReadonlySignal<FlipbookMessages>, store: FlipbookStore): void;
|
|
@@ -11,6 +11,8 @@ interface ViewerProps {
|
|
|
11
11
|
onHotspotClose: () => void;
|
|
12
12
|
onAnnotationActivate: (annotation: FlipbookAnnotation) => void;
|
|
13
13
|
onAnnotationClose: () => void;
|
|
14
|
+
onPlaceAnnotation: (pageIndex: number, x: number, y: number) => void;
|
|
15
|
+
signal: AbortSignal;
|
|
14
16
|
}
|
|
15
17
|
export declare function Viewer(props: ViewerProps): import('@serenity-is/domwise').JSXElement;
|
|
16
18
|
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FlipbookStore } from '../state/store';
|
|
2
|
+
import { FlipbookTextLayerProvider } from '../model/text-layer';
|
|
3
|
+
|
|
4
|
+
/** At most three visible/adjacent pages; stale requests cannot update a new session. */
|
|
5
|
+
export declare function loadTextLayers(store: FlipbookStore, provider: FlipbookTextLayerProvider, lifetime: AbortSignal): () => void;
|
package/dist/core-entry.d.ts
CHANGED
|
@@ -11,3 +11,4 @@ export type { FlipbookThemeMode, FlipbookBackgroundStyle, FlipbookBackgrounds }
|
|
|
11
11
|
export type { PdfPageMode, PdfPageLayout } from './core/PdfRenderer';
|
|
12
12
|
export { isA3Landscape } from './core/PdfRenderer';
|
|
13
13
|
export type { FlipbookHotspot, FlipbookHotspotKind, FlipbookHotspotMedia, FlipbookHotspotMediaType, FlipbookHotspotGalleryItem } from './model/hotspots';
|
|
14
|
+
export type { FlipbookTextRun, FlipbookTextPage, FlipbookTextLayerProvider } from './model/text-layer';
|