flipbookengine 0.6.5 → 1.0.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 +115 -75
- package/README.md +429 -295
- package/dist/components/AnnotationPlacement.d.ts +5 -0
- package/dist/components/AnnotationPopover.d.ts +10 -0
- package/dist/components/App.d.ts +26 -0
- package/dist/components/HotspotLayer.d.ts +14 -0
- package/dist/components/NoteEditor.d.ts +13 -0
- package/dist/components/NotePlacementLayer.d.ts +11 -0
- package/dist/components/NotesPanel.d.ts +17 -0
- package/dist/components/PluginPanels.d.ts +5 -0
- package/dist/components/ReaderHelp.d.ts +3 -0
- package/dist/components/ReaderShortcuts.d.ts +16 -0
- package/dist/components/SearchPanel.d.ts +11 -0
- package/dist/components/TableOfContents.d.ts +1 -0
- package/dist/components/TextLayer.d.ts +8 -0
- package/dist/components/Toolbar.d.ts +7 -1
- package/dist/components/ToolbarMore.d.ts +6 -0
- package/dist/components/Viewer.d.ts +8 -0
- package/dist/core/LayoutManager.d.ts +1 -1
- package/dist/core/PdfRenderer.d.ts +11 -0
- package/dist/core/TextLayerLoader.d.ts +5 -0
- package/dist/core/domSignal.d.ts +2 -0
- package/dist/core-entry.d.ts +14 -0
- package/dist/core.d.ts +1 -0
- package/dist/embed.d.ts +80 -0
- package/dist/engine-DD5qEHLm.js +4657 -0
- package/dist/engine-DD5qEHLm.js.map +1 -0
- package/dist/engine.d.ts +124 -0
- package/dist/feature-Cicli9ie.js +17 -0
- package/dist/feature-Cicli9ie.js.map +1 -0
- package/dist/flipbook-engine.core.js +8 -0
- package/dist/flipbook-engine.core.js.map +1 -0
- package/dist/flipbook-engine.css +1 -1
- package/dist/flipbook-engine.iife.js +51 -55
- package/dist/flipbook-engine.iife.js.map +1 -1
- package/dist/flipbook-engine.js +10 -6
- package/dist/flipbook-engine.js.map +1 -1
- package/dist/flipbook-engine.plugins-annotations.js +14 -0
- package/dist/flipbook-engine.plugins-annotations.js.map +1 -0
- package/dist/flipbook-engine.plugins-bookmarks.js +16 -0
- package/dist/flipbook-engine.plugins-bookmarks.js.map +1 -0
- package/dist/flipbook-engine.plugins-deep-link.js +14 -0
- package/dist/flipbook-engine.plugins-deep-link.js.map +1 -0
- package/dist/flipbook-engine.plugins-hotspots.js +15 -0
- package/dist/flipbook-engine.plugins-hotspots.js.map +1 -0
- package/dist/flipbook-engine.plugins-notes.js +16 -0
- package/dist/flipbook-engine.plugins-notes.js.map +1 -0
- package/dist/flipbook-engine.plugins-search.js +15 -0
- package/dist/flipbook-engine.plugins-search.js.map +1 -0
- package/dist/flipbook-engine.plugins-share.js +13 -0
- package/dist/flipbook-engine.plugins-share.js.map +1 -0
- package/dist/flipbook-engine.plugins-toc.js +14 -0
- package/dist/flipbook-engine.plugins-toc.js.map +1 -0
- package/dist/flipbook-engine.plugins.js +5 -0
- package/dist/flipbook-engine.plugins.js.map +1 -0
- package/dist/flipbook-engine.react.js +1 -1
- package/dist/flipbook-engine.vue.js +1 -1
- package/dist/i18n/locales/en.d.ts +39 -0
- package/dist/i18n/locales/tr.d.ts +39 -0
- package/dist/i18n/service.d.ts +117 -0
- package/dist/index-BhTR2SK6.js +366 -0
- package/dist/index-BhTR2SK6.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/model/annotations.d.ts +15 -0
- package/dist/model/backend.d.ts +8 -0
- package/dist/model/hotspots.d.ts +40 -0
- package/dist/model/note-editor.d.ts +22 -0
- package/dist/model/search.d.ts +25 -0
- package/dist/model/text-layer.d.ts +21 -0
- package/dist/plugins/annotations.d.ts +4 -0
- package/dist/plugins/bookmarks.d.ts +4 -0
- package/dist/plugins/deep-link.d.ts +4 -0
- package/dist/plugins/feature.d.ts +5 -0
- package/dist/plugins/hotspots.d.ts +4 -0
- package/dist/plugins/index.d.ts +65 -0
- package/dist/plugins/notes.d.ts +4 -0
- package/dist/plugins/search.d.ts +4 -0
- package/dist/plugins/share.d.ts +4 -0
- package/dist/plugins/toc.d.ts +4 -0
- package/dist/plugins-annotations.d.ts +1 -0
- package/dist/plugins-bookmarks.d.ts +1 -0
- package/dist/plugins-deep-link.d.ts +1 -0
- package/dist/plugins-hotspots.d.ts +1 -0
- package/dist/plugins-notes.d.ts +1 -0
- package/dist/plugins-search.d.ts +1 -0
- package/dist/plugins-share.d.ts +1 -0
- package/dist/plugins-toc.d.ts +1 -0
- package/dist/plugins.d.ts +1 -0
- package/dist/state/store.d.ts +35 -5
- package/dist/vue/index.d.ts +1 -1
- package/docs/api-reference.md +228 -0
- package/docs/backend-text-layers.md +40 -0
- package/docs/frameworks.md +73 -0
- package/docs/getting-started.md +128 -0
- package/docs/i18n.md +47 -0
- package/docs/migration-0.4.0.md +24 -0
- package/docs/migration-0.5.0.md +25 -0
- package/docs/migration-1.0.0.md +59 -0
- package/docs/plugin-architecture.md +103 -0
- package/docs/release-checklist.md +37 -0
- package/docs/theming.md +61 -0
- package/package.json +52 -1
- package/dist/engine-DhQ2zxpm.js +0 -3535
- package/dist/engine-DhQ2zxpm.js.map +0 -1
|
@@ -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,6 +1,11 @@
|
|
|
1
|
+
import { FlipbookNoteDocument } from '../model/note-editor';
|
|
2
|
+
import { FlipbookSearchOptions } from '../model/search';
|
|
3
|
+
import { FlipbookHotspot } from '../model/hotspots';
|
|
4
|
+
import { FlipbookAnnotation } from '../model/annotations';
|
|
1
5
|
import { FlipbookStore } from '../state/store';
|
|
2
6
|
import { PageFlipAdapter } from '../adapters/PageFlipAdapter';
|
|
3
7
|
import { InteractionManager } from '../core/InteractionManager';
|
|
8
|
+
import { FlipbookPluginRegistry } from '../plugins';
|
|
4
9
|
|
|
5
10
|
interface AppProps {
|
|
6
11
|
pageFlipAdapterRef: {
|
|
@@ -14,8 +19,29 @@ interface AppProps {
|
|
|
14
19
|
bookContainerRef: (el: HTMLElement) => void;
|
|
15
20
|
className?: string;
|
|
16
21
|
onDownload: () => void;
|
|
22
|
+
onShare: () => void;
|
|
23
|
+
onToggleBookmark: () => void;
|
|
24
|
+
onToggleNotes: () => void;
|
|
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>;
|
|
32
|
+
onCloseNotes: () => void;
|
|
33
|
+
onSearch: (query: string, options?: FlipbookSearchOptions) => void;
|
|
34
|
+
onClearSearch: () => void;
|
|
35
|
+
onCloseSearch: () => void;
|
|
36
|
+
onSelectSearchResult: (pageIndex: number) => void;
|
|
37
|
+
onHotspotActivate: (hotspot: FlipbookHotspot) => void;
|
|
38
|
+
onHotspotClose: () => void;
|
|
39
|
+
onAnnotationActivate: (annotation: FlipbookAnnotation) => void;
|
|
40
|
+
onAnnotationClose: () => void;
|
|
17
41
|
onToggleFullscreen: () => void;
|
|
18
42
|
store: FlipbookStore;
|
|
43
|
+
pluginRegistry?: FlipbookPluginRegistry;
|
|
44
|
+
signal: AbortSignal;
|
|
19
45
|
}
|
|
20
46
|
export declare function App(props: AppProps): import('@serenity-is/domwise').JSXElement;
|
|
21
47
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FlipbookHotspot } from '../model/hotspots';
|
|
2
|
+
import { FlipbookAnnotation } from '../model/annotations';
|
|
3
|
+
import { FlipbookStore } from '../state/store';
|
|
4
|
+
|
|
5
|
+
interface HotspotLayerProps {
|
|
6
|
+
store: FlipbookStore;
|
|
7
|
+
pageIndex: number;
|
|
8
|
+
onActivate: (hotspot: FlipbookHotspot) => void;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
onAnnotationActivate: (annotation: FlipbookAnnotation) => void;
|
|
11
|
+
onAnnotationClose: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function HotspotLayer(props: HotspotLayerProps): import('@serenity-is/domwise').JSXElement;
|
|
14
|
+
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 {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FlipbookStore } from '../state/store';
|
|
2
|
+
import { FlipbookAnnotation } from '../model/annotations';
|
|
3
|
+
import { FlipbookNoteDocument } from '../model/note-editor';
|
|
4
|
+
|
|
5
|
+
interface NotesPanelProps {
|
|
6
|
+
store: FlipbookStore;
|
|
7
|
+
onSave: (note: string, document?: FlipbookNoteDocument) => Promise<boolean>;
|
|
8
|
+
onClear: () => Promise<boolean>;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
onSelect: (pageIndex: number) => void;
|
|
11
|
+
onAnnotation: (annotation: FlipbookAnnotation) => void;
|
|
12
|
+
onAdd: () => void;
|
|
13
|
+
signal: AbortSignal;
|
|
14
|
+
}
|
|
15
|
+
/** The editor keeps its draft until the host confirms persistence. */
|
|
16
|
+
export declare function NotesPanel(props: NotesPanelProps): import('@serenity-is/domwise').JSXElement;
|
|
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,11 @@
|
|
|
1
|
+
import { FlipbookStore } from '../state/store';
|
|
2
|
+
|
|
3
|
+
interface SearchPanelProps {
|
|
4
|
+
store: FlipbookStore;
|
|
5
|
+
onSearch: (query: string) => void;
|
|
6
|
+
onClear: () => void;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
onSelect: (pageIndex: number) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function SearchPanel(props: SearchPanelProps): import('@serenity-is/domwise').JSXElement;
|
|
11
|
+
export {};
|
|
@@ -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;
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { FlipbookStore } from '../state/store';
|
|
2
|
+
import { FlipbookPluginRegistry } from '../plugins';
|
|
2
3
|
|
|
3
4
|
interface ToolbarProps {
|
|
4
5
|
store: FlipbookStore;
|
|
5
6
|
onToggleThumbs: () => void;
|
|
6
7
|
onToggleToc: () => void;
|
|
8
|
+
onToggleSearch: () => void;
|
|
7
9
|
onToggleSingleMode: () => void;
|
|
8
10
|
onZoomIn: () => void;
|
|
9
11
|
onZoomOut: () => void;
|
|
10
12
|
onDownload?: () => void;
|
|
13
|
+
onShare: () => void;
|
|
14
|
+
onToggleBookmark: () => void;
|
|
15
|
+
onToggleNotes: () => void;
|
|
11
16
|
onSoundToggle: () => void;
|
|
12
17
|
onNextPage: () => void;
|
|
13
18
|
onPrevPage: () => void;
|
|
14
19
|
onToggleAutoPlay: () => void;
|
|
15
20
|
onToggleFullscreen: () => void;
|
|
21
|
+
pluginRegistry?: FlipbookPluginRegistry;
|
|
16
22
|
}
|
|
17
|
-
export declare function Toolbar(props: ToolbarProps):
|
|
23
|
+
export declare function Toolbar(props: ToolbarProps): HTMLElement;
|
|
18
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;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { FlipbookStore } from '../state/store';
|
|
2
|
+
import { FlipbookHotspot } from '../model/hotspots';
|
|
3
|
+
import { FlipbookAnnotation } from '../model/annotations';
|
|
2
4
|
|
|
3
5
|
interface ViewerProps {
|
|
4
6
|
store: FlipbookStore;
|
|
5
7
|
bookWrapperRef: (el: HTMLElement) => void;
|
|
6
8
|
bookSizerRef: (el: HTMLElement) => void;
|
|
7
9
|
bookContainerRef: (el: HTMLElement) => void;
|
|
10
|
+
onHotspotActivate: (hotspot: FlipbookHotspot) => void;
|
|
11
|
+
onHotspotClose: () => void;
|
|
12
|
+
onAnnotationActivate: (annotation: FlipbookAnnotation) => void;
|
|
13
|
+
onAnnotationClose: () => void;
|
|
14
|
+
onPlaceAnnotation: (pageIndex: number, x: number, y: number) => void;
|
|
15
|
+
signal: AbortSignal;
|
|
8
16
|
}
|
|
9
17
|
export declare function Viewer(props: ViewerProps): import('@serenity-is/domwise').JSXElement;
|
|
10
18
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NormalizedFlipbookPage } from '../model/pages';
|
|
2
|
+
import { FlipbookSearchOptions, FlipbookSearchHighlight } from '../model/search';
|
|
2
3
|
|
|
3
4
|
export interface PdfRenderProgress {
|
|
4
5
|
completed: number;
|
|
@@ -25,11 +26,21 @@ export declare class PdfRenderer {
|
|
|
25
26
|
private loadingTask;
|
|
26
27
|
private options;
|
|
27
28
|
private readonly cache;
|
|
29
|
+
private readonly textCache;
|
|
28
30
|
constructor(options?: PdfRenderOptions);
|
|
29
31
|
/** Loads a PDF document and cancels PDF.js loading when the signal aborts. */
|
|
30
32
|
loadDocument(pdfUrl: string, signal?: AbortSignal): Promise<number>;
|
|
31
33
|
/** Renders a specific page to a Data URL. The page index is 1-based. */
|
|
32
34
|
renderPageToDataUrl(pageIndex: number, signal?: AbortSignal): Promise<string>;
|
|
35
|
+
/** Extracts text from a 1-based PDF source page using PDF.js text content. */
|
|
36
|
+
extractPageText(pageNumber: number): Promise<string>;
|
|
37
|
+
/** Searches all PDF source pages and returns normalized rectangles for matched text. */
|
|
38
|
+
searchText(query: string, options?: FlipbookSearchOptions): Promise<Array<{
|
|
39
|
+
sourcePageNumber: number;
|
|
40
|
+
matches: number;
|
|
41
|
+
snippet: string;
|
|
42
|
+
highlights?: FlipbookSearchHighlight[];
|
|
43
|
+
}>>;
|
|
33
44
|
/** Returns source page dimensions and whether the page should be split. */
|
|
34
45
|
getPageLayouts(mode?: PdfPageMode): Promise<PdfPageLayout[]>;
|
|
35
46
|
/** Calculates the best viewport dimensions based on the first logical page. */
|
|
@@ -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;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license FlipbookEngine v1.0.0
|
|
3
|
+
* Copyright (c) 2026 Murat Dogan
|
|
4
|
+
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
|
+
*/
|
|
6
|
+
export { FlipbookEngine, type FlipbookEngineOptions, type FlipbookLocaleMessages, type PageImages, type FlipbookEngineEventMap, type FlipbookEngineEventName } from './engine';
|
|
7
|
+
export type { FlipbookPageAsset, FlipbookPageKind, FlipbookCropMode, FlipbookSplitDirection, NormalizedFlipbookPage } from './model/pages';
|
|
8
|
+
export { normalizeFlipbookPages, isFlipbookPageAsset } from './model/pages';
|
|
9
|
+
export type { FlipbookLocale, FlipbookMessages, PartialFlipbookMessages } from './i18n/service';
|
|
10
|
+
export type { FlipbookThemeMode, FlipbookBackgroundStyle, FlipbookBackgrounds } from './theme/theme';
|
|
11
|
+
export type { PdfPageMode, PdfPageLayout } from './core/PdfRenderer';
|
|
12
|
+
export { isA3Landscape } from './core/PdfRenderer';
|
|
13
|
+
export type { FlipbookHotspot, FlipbookHotspotKind, FlipbookHotspotMedia, FlipbookHotspotMediaType, FlipbookHotspotGalleryItem } from './model/hotspots';
|
|
14
|
+
export type { FlipbookTextRun, FlipbookTextPage, FlipbookTextLayerProvider } from './model/text-layer';
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './core-entry'
|
package/dist/embed.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { FlipbookEngine, FlipbookEngineEventMap, FlipbookEngineEventName, FlipbookEngineOptions } from './engine';
|
|
2
|
+
import { FlipbookSearchOptions, FlipbookSearchResult } from './model/search';
|
|
3
|
+
import { FlipbookTocEntry } from './model/toc';
|
|
4
|
+
|
|
5
|
+
export type FlipbookEmbedCommandName = 'goToPage' | 'nextPage' | 'prevPage' | 'setZoom' | 'setSingleMode' | 'updateOptions' | 'toggleFullscreen' | 'search' | 'clearSearch' | 'getSearchResults' | 'getToc' | 'setToc' | 'getState';
|
|
6
|
+
export interface FlipbookEmbedOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Origins allowed to send commands. Defaults to the current origin.
|
|
9
|
+
* Use an explicit origin for cross-origin iframe integrations.
|
|
10
|
+
*/
|
|
11
|
+
allowedOrigins?: string[];
|
|
12
|
+
/** Origin used for messages sent to the embedding parent. */
|
|
13
|
+
targetOrigin?: string;
|
|
14
|
+
/** Response timeout for the parent-side controller. */
|
|
15
|
+
responseTimeout?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface FlipbookEmbedCommand {
|
|
18
|
+
type: 'flipbook:command';
|
|
19
|
+
command: FlipbookEmbedCommandName;
|
|
20
|
+
requestId?: string;
|
|
21
|
+
payload?: unknown;
|
|
22
|
+
}
|
|
23
|
+
export interface FlipbookEmbedEvent<T extends FlipbookEngineEventName = FlipbookEngineEventName> {
|
|
24
|
+
type: 'flipbook:event';
|
|
25
|
+
event: T;
|
|
26
|
+
payload: FlipbookEngineEventMap[T];
|
|
27
|
+
}
|
|
28
|
+
export interface FlipbookEmbedResponse {
|
|
29
|
+
type: 'flipbook:response';
|
|
30
|
+
requestId?: string;
|
|
31
|
+
ok: boolean;
|
|
32
|
+
result?: unknown;
|
|
33
|
+
error?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface FlipbookEmbedState {
|
|
36
|
+
currentPage: number;
|
|
37
|
+
totalPages: number;
|
|
38
|
+
zoom: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Runs inside an iframe and exposes a restricted postMessage command bridge.
|
|
42
|
+
* Commands are accepted only from window.parent and configured origins.
|
|
43
|
+
*/
|
|
44
|
+
export declare class FlipbookEmbedBridge {
|
|
45
|
+
private readonly engine;
|
|
46
|
+
private readonly options;
|
|
47
|
+
private readonly listener;
|
|
48
|
+
private readonly unsubs;
|
|
49
|
+
private connected;
|
|
50
|
+
private parentOrigin;
|
|
51
|
+
constructor(engine: FlipbookEngine, options?: FlipbookEmbedOptions);
|
|
52
|
+
connect(): this;
|
|
53
|
+
disconnect(): void;
|
|
54
|
+
private readonly engineEventNames;
|
|
55
|
+
private isAllowedOrigin;
|
|
56
|
+
private post;
|
|
57
|
+
private postEvent;
|
|
58
|
+
private respond;
|
|
59
|
+
private handleMessage;
|
|
60
|
+
private getState;
|
|
61
|
+
}
|
|
62
|
+
export interface FlipbookEmbedController {
|
|
63
|
+
send(command: FlipbookEmbedCommandName, payload?: unknown): Promise<unknown>;
|
|
64
|
+
goToPage(pageIndex: number): Promise<FlipbookEmbedState>;
|
|
65
|
+
nextPage(): Promise<FlipbookEmbedState>;
|
|
66
|
+
prevPage(): Promise<FlipbookEmbedState>;
|
|
67
|
+
setZoom(zoom: number): Promise<FlipbookEmbedState>;
|
|
68
|
+
setSingleMode(isSingle: boolean): Promise<FlipbookEmbedState>;
|
|
69
|
+
updateOptions(options: Partial<FlipbookEngineOptions>): Promise<FlipbookEmbedState>;
|
|
70
|
+
toggleFullscreen(): Promise<FlipbookEmbedState>;
|
|
71
|
+
search(query: string, options?: FlipbookSearchOptions): Promise<FlipbookSearchResult[]>;
|
|
72
|
+
clearSearch(): Promise<FlipbookEmbedState>;
|
|
73
|
+
getSearchResults(): Promise<FlipbookSearchResult[]>;
|
|
74
|
+
getToc(): Promise<FlipbookTocEntry[]>;
|
|
75
|
+
setToc(entries: FlipbookTocEntry[], show?: boolean): Promise<FlipbookEmbedState>;
|
|
76
|
+
getState(): Promise<FlipbookEmbedState>;
|
|
77
|
+
on<T extends FlipbookEngineEventName>(event: T, handler: (payload: FlipbookEngineEventMap[T]) => void): () => void;
|
|
78
|
+
destroy(): void;
|
|
79
|
+
}
|
|
80
|
+
export declare function createFlipbookEmbedController(iframe: HTMLIFrameElement, options?: FlipbookEmbedOptions): FlipbookEmbedController;
|