flipbookengine 1.0.0 → 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.
Files changed (42) hide show
  1. package/CHANGELOG.md +113 -94
  2. package/README.md +427 -421
  3. package/dist/components/AnnotationPlacement.d.ts +5 -0
  4. package/dist/components/AnnotationPopover.d.ts +10 -0
  5. package/dist/components/App.d.ts +9 -2
  6. package/dist/components/NoteEditor.d.ts +13 -0
  7. package/dist/components/NotePlacementLayer.d.ts +11 -0
  8. package/dist/components/NotesPanel.d.ts +9 -6
  9. package/dist/components/ReaderHelp.d.ts +3 -0
  10. package/dist/components/ReaderShortcuts.d.ts +16 -0
  11. package/dist/components/TableOfContents.d.ts +1 -0
  12. package/dist/components/TextLayer.d.ts +8 -0
  13. package/dist/components/Toolbar.d.ts +1 -1
  14. package/dist/components/ToolbarMore.d.ts +6 -0
  15. package/dist/components/Viewer.d.ts +2 -0
  16. package/dist/core/TextLayerLoader.d.ts +5 -0
  17. package/dist/core/domSignal.d.ts +2 -0
  18. package/dist/core-entry.d.ts +1 -0
  19. package/dist/engine-DD5qEHLm.js +4657 -0
  20. package/dist/engine-DD5qEHLm.js.map +1 -0
  21. package/dist/engine.d.ts +23 -0
  22. package/dist/flipbook-engine.core.js +1 -1
  23. package/dist/flipbook-engine.css +1 -1
  24. package/dist/flipbook-engine.iife.js +34 -47
  25. package/dist/flipbook-engine.iife.js.map +1 -1
  26. package/dist/flipbook-engine.js +1 -1
  27. package/dist/flipbook-engine.react.js +1 -1
  28. package/dist/flipbook-engine.vue.js +1 -1
  29. package/dist/i18n/locales/en.d.ts +22 -0
  30. package/dist/i18n/locales/tr.d.ts +22 -0
  31. package/dist/i18n/service.d.ts +66 -0
  32. package/dist/index.d.ts +3 -0
  33. package/dist/model/annotations.d.ts +1 -0
  34. package/dist/model/backend.d.ts +8 -0
  35. package/dist/model/note-editor.d.ts +22 -0
  36. package/dist/model/text-layer.d.ts +21 -0
  37. package/dist/state/store.d.ts +16 -0
  38. package/docs/api-reference.md +227 -205
  39. package/docs/backend-text-layers.md +40 -0
  40. package/package.json +165 -165
  41. package/dist/engine-Dt2Fn6O-.js +0 -4060
  42. package/dist/engine-Dt2Fn6O-.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { F as e, a as i, c as s, i as l, b as r, n as b, d as p } from "./engine-Dt2Fn6O-.js";
1
+ import { F as e, a as i, c as s, i as l, b as r, n as b, d as p } from "./engine-DD5qEHLm.js";
2
2
  import { F as n } from "./index-BhTR2SK6.js";
3
3
  export {
4
4
  e as FlipbookEmbedBridge,
@@ -1,6 +1,6 @@
1
1
  import { jsx as m } from "react/jsx-runtime";
2
2
  import { forwardRef as P, useRef as g, useImperativeHandle as x, useEffect as c } from "react";
3
- import { a as d } from "./engine-Dt2Fn6O-.js";
3
+ import { a as d } from "./engine-DD5qEHLm.js";
4
4
  const v = P(({
5
5
  className: a,
6
6
  style: f,
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as d, ref as s, onMounted as g, onBeforeUnmount as P, watch as l, h as c } from "vue";
2
- import { a as h } from "./engine-Dt2Fn6O-.js";
2
+ import { a as h } from "./engine-DD5qEHLm.js";
3
3
  const v = d({
4
4
  name: "Flipbook",
5
5
  props: {
@@ -36,4 +36,26 @@ export declare const enMessages: {
36
36
  readonly searchUnavailable: "Text search is available only in Direct PDF mode.";
37
37
  readonly closeHotspot: "Close popup";
38
38
  readonly annotation: "Page annotation";
39
+ readonly saving: "Saving…";
40
+ readonly noteFailed: "Could not save the note. Your draft is retained; try again.";
41
+ readonly searching: "Searching…";
42
+ readonly searchFailed: "Search failed. Try again.";
43
+ readonly closeContents: "Close table of contents";
44
+ readonly moreActions: "More actions";
45
+ readonly sound: "Sound";
46
+ readonly myNotes: "My notes";
47
+ readonly currentPage: "This page";
48
+ readonly allNotes: "All notes";
49
+ readonly privateNotes: "Your personal notes for this document.";
50
+ readonly noNotes: "No notes yet. Select a place on the page to add your first note.";
51
+ readonly addNote: "Place a note";
52
+ readonly pageHasNote: "This page has a note";
53
+ readonly page: "Page";
54
+ readonly noteSaved: "Saved";
55
+ readonly confirmDeleteNote: "Delete this note?";
56
+ readonly cancel: "Cancel";
57
+ readonly placeNote: "Click or tap a place on the page for your note.";
58
+ readonly keyboardShortcuts: "Keyboard shortcuts";
59
+ readonly textSelection: "Select text";
60
+ readonly resetZoom: "Fit page";
39
61
  };
@@ -36,4 +36,26 @@ export declare const trMessages: {
36
36
  readonly searchUnavailable: "Metin arama yalnızca Doğrudan PDF modunda desteklenir.";
37
37
  readonly closeHotspot: "Açılır pencereyi kapat";
38
38
  readonly annotation: "Sayfa açıklaması";
39
+ readonly saving: "Kaydediliyor…";
40
+ readonly noteFailed: "Not kaydedilemedi. Taslağınız korundu; tekrar deneyin.";
41
+ readonly searching: "Aranıyor…";
42
+ readonly searchFailed: "Arama başarısız oldu. Tekrar deneyin.";
43
+ readonly closeContents: "İçindekileri kapat";
44
+ readonly moreActions: "Diğer işlemler";
45
+ readonly sound: "Ses";
46
+ readonly myNotes: "Notlarım";
47
+ readonly currentPage: "Bu sayfa";
48
+ readonly allNotes: "Tüm notlar";
49
+ readonly privateNotes: "Bu belge için kişisel notlarınız.";
50
+ readonly noNotes: "Henüz not yok. İlk notunuz için sayfada bir yer seçin.";
51
+ readonly addNote: "Konuma not ekle";
52
+ readonly pageHasNote: "Bu sayfada not var";
53
+ readonly page: "Sayfa";
54
+ readonly noteSaved: "Kaydedildi";
55
+ readonly confirmDeleteNote: "Bu not silinsin mi?";
56
+ readonly cancel: "Vazgeç";
57
+ readonly placeNote: "Not eklemek için sayfada bir yere tıklayın veya dokunun.";
58
+ readonly keyboardShortcuts: "Klavye kısayolları";
59
+ readonly textSelection: "Metin seçimi";
60
+ readonly resetZoom: "Sayfaya sığdır";
39
61
  };
@@ -5,6 +5,7 @@
5
5
  * https://flipbookengine.com
6
6
  */
7
7
  export interface FlipbookMessages {
8
+ textSelection: string;
8
9
  emptyStateTitle: string;
9
10
  thumbnails: string;
10
11
  singlePageMode: string;
@@ -36,6 +37,27 @@ export interface FlipbookMessages {
36
37
  searchUnavailable: string;
37
38
  closeHotspot: string;
38
39
  annotation: string;
40
+ saving: string;
41
+ noteFailed: string;
42
+ searching: string;
43
+ searchFailed: string;
44
+ closeContents: string;
45
+ moreActions: string;
46
+ sound: string;
47
+ myNotes: string;
48
+ currentPage: string;
49
+ allNotes: string;
50
+ privateNotes: string;
51
+ noNotes: string;
52
+ addNote: string;
53
+ pageHasNote: string;
54
+ page: string;
55
+ noteSaved: string;
56
+ confirmDeleteNote: string;
57
+ cancel: string;
58
+ placeNote: string;
59
+ keyboardShortcuts: string;
60
+ resetZoom: string;
39
61
  }
40
62
  export declare const builtInMessages: {
41
63
  readonly en: {
@@ -70,6 +92,28 @@ export declare const builtInMessages: {
70
92
  readonly searchUnavailable: "Text search is available only in Direct PDF mode.";
71
93
  readonly closeHotspot: "Close popup";
72
94
  readonly annotation: "Page annotation";
95
+ readonly saving: "Saving…";
96
+ readonly noteFailed: "Could not save the note. Your draft is retained; try again.";
97
+ readonly searching: "Searching…";
98
+ readonly searchFailed: "Search failed. Try again.";
99
+ readonly closeContents: "Close table of contents";
100
+ readonly moreActions: "More actions";
101
+ readonly sound: "Sound";
102
+ readonly myNotes: "My notes";
103
+ readonly currentPage: "This page";
104
+ readonly allNotes: "All notes";
105
+ readonly privateNotes: "Your personal notes for this document.";
106
+ readonly noNotes: "No notes yet. Select a place on the page to add your first note.";
107
+ readonly addNote: "Place a note";
108
+ readonly pageHasNote: "This page has a note";
109
+ readonly page: "Page";
110
+ readonly noteSaved: "Saved";
111
+ readonly confirmDeleteNote: "Delete this note?";
112
+ readonly cancel: "Cancel";
113
+ readonly placeNote: "Click or tap a place on the page for your note.";
114
+ readonly keyboardShortcuts: "Keyboard shortcuts";
115
+ readonly textSelection: "Select text";
116
+ readonly resetZoom: "Fit page";
73
117
  };
74
118
  readonly tr: {
75
119
  readonly emptyStateTitle: "Veri bulunamadi.";
@@ -103,6 +147,28 @@ export declare const builtInMessages: {
103
147
  readonly searchUnavailable: "Metin arama yalnızca Doğrudan PDF modunda desteklenir.";
104
148
  readonly closeHotspot: "Açılır pencereyi kapat";
105
149
  readonly annotation: "Sayfa açıklaması";
150
+ readonly saving: "Kaydediliyor…";
151
+ readonly noteFailed: "Not kaydedilemedi. Taslağınız korundu; tekrar deneyin.";
152
+ readonly searching: "Aranıyor…";
153
+ readonly searchFailed: "Arama başarısız oldu. Tekrar deneyin.";
154
+ readonly closeContents: "İçindekileri kapat";
155
+ readonly moreActions: "Diğer işlemler";
156
+ readonly sound: "Ses";
157
+ readonly myNotes: "Notlarım";
158
+ readonly currentPage: "Bu sayfa";
159
+ readonly allNotes: "Tüm notlar";
160
+ readonly privateNotes: "Bu belge için kişisel notlarınız.";
161
+ readonly noNotes: "Henüz not yok. İlk notunuz için sayfada bir yer seçin.";
162
+ readonly addNote: "Konuma not ekle";
163
+ readonly pageHasNote: "Bu sayfada not var";
164
+ readonly page: "Sayfa";
165
+ readonly noteSaved: "Kaydedildi";
166
+ readonly confirmDeleteNote: "Bu not silinsin mi?";
167
+ readonly cancel: "Vazgeç";
168
+ readonly placeNote: "Not eklemek için sayfada bir yere tıklayın veya dokunun.";
169
+ readonly keyboardShortcuts: "Klavye kısayolları";
170
+ readonly textSelection: "Metin seçimi";
171
+ readonly resetZoom: "Sayfaya sığdır";
106
172
  };
107
173
  };
108
174
  export type FlipbookLocale = keyof typeof builtInMessages;
package/dist/index.d.ts CHANGED
@@ -7,9 +7,11 @@
7
7
  export { FlipbookEngine, type FlipbookEngineOptions, type FlipbookLocaleMessages, type PageImages, type FlipbookEngineEventMap, type FlipbookEngineEventName } from './engine';
8
8
  export type { FlipbookPageAsset, FlipbookPageKind, FlipbookCropMode, FlipbookSplitDirection, NormalizedFlipbookPage } from './model/pages';
9
9
  export type { FlipbookTocEntry } from './model/toc';
10
+ export type { FlipbookSearchProvider, FlipbookNoteProvider, FlipbookAnnotationProvider } from './model/backend';
10
11
  export type { FlipbookSearchHighlight, FlipbookSearchResult, FlipbookSearchOptions } from './model/search';
11
12
  export type { FlipbookHotspot, FlipbookHotspotKind, FlipbookHotspotMedia, FlipbookHotspotMediaType, FlipbookHotspotGalleryItem } from './model/hotspots';
12
13
  export type { FlipbookAnnotation } from './model/annotations';
14
+ export type { FlipbookNoteDocument, FlipbookNoteValue, FlipbookNoteEditor, FlipbookNoteEditorFactory } from './model/note-editor';
13
15
  export { FlipbookPluginRegistry } from './plugins';
14
16
  export type { FlipbookPlugin, FlipbookPluginContext, FlipbookPluginApiHandler, FlipbookPluginEventHandler, FlipbookPluginPanel, FlipbookPluginToolbarButton } from './plugins';
15
17
  export { normalizeFlipbookToc } from './model/toc';
@@ -20,3 +22,4 @@ export type { PdfPageMode, PdfPageLayout } from './core/PdfRenderer';
20
22
  export { isA3Landscape } from './core/PdfRenderer';
21
23
  export { FlipbookEmbedBridge, createFlipbookEmbedController } from './embed';
22
24
  export type { FlipbookEmbedOptions, FlipbookEmbedCommandName, FlipbookEmbedCommand, FlipbookEmbedEvent, FlipbookEmbedResponse, FlipbookEmbedState, FlipbookEmbedController } from './embed';
25
+ export type { FlipbookTextRun, FlipbookTextPage, FlipbookTextLayerProvider } from './model/text-layer';
@@ -5,6 +5,7 @@
5
5
  */
6
6
  /** A host-provided note marker anchored to a logical page using 0..1 coordinates. */
7
7
  export interface FlipbookAnnotation {
8
+ document?: import('./note-editor').FlipbookNoteDocument;
8
9
  id: string;
9
10
  pageIndex: number;
10
11
  x: number;
@@ -0,0 +1,8 @@
1
+ import { FlipbookSearchOptions, FlipbookSearchResult } from './search';
2
+ import { FlipbookAnnotation } from './annotations';
3
+ import { FlipbookNoteDocument } from './note-editor';
4
+
5
+ /** Host-owned storage and authorization stay outside the viewer. Indexes are zero-based. */
6
+ export type FlipbookSearchProvider = (query: string, options: FlipbookSearchOptions, signal: AbortSignal) => Promise<FlipbookSearchResult[]>;
7
+ export type FlipbookNoteProvider = (pageIndex: number, note: string | null, signal: AbortSignal, document?: FlipbookNoteDocument) => Promise<void>;
8
+ export type FlipbookAnnotationProvider = (annotation: FlipbookAnnotation, action: 'save' | 'delete', signal: AbortSignal) => Promise<void>;
@@ -0,0 +1,22 @@
1
+ export interface FlipbookNoteMark {
2
+ type: string;
3
+ attrs?: Record<string, string | null>;
4
+ }
5
+ export interface FlipbookNoteDocument {
6
+ type: string;
7
+ text?: string;
8
+ content?: FlipbookNoteDocument[];
9
+ marks?: FlipbookNoteMark[];
10
+ }
11
+ export interface FlipbookNoteValue {
12
+ text: string;
13
+ document?: FlipbookNoteDocument;
14
+ }
15
+ export interface FlipbookNoteEditor {
16
+ getValue(): FlipbookNoteValue;
17
+ setReadOnly(value: boolean): void;
18
+ destroy(): void;
19
+ }
20
+ export type FlipbookNoteEditorFactory = (container: HTMLElement, value: FlipbookNoteValue, signal: AbortSignal) => FlipbookNoteEditor | Promise<FlipbookNoteEditor>;
21
+ /** Render a restricted document as DOM nodes. Raw HTML is never accepted. */
22
+ export declare function renderNoteDocument(value: FlipbookNoteDocument | undefined, fallback: string): HTMLElement;
@@ -0,0 +1,21 @@
1
+ /** Backend-owned text in logical-page, top-left, normalized coordinates. */
2
+ export interface FlipbookTextRun {
3
+ text: string;
4
+ start: number;
5
+ x: number;
6
+ y: number;
7
+ width: number;
8
+ height: number;
9
+ direction?: 'ltr' | 'rtl';
10
+ }
11
+ export interface FlipbookTextPage {
12
+ schemaVersion: 1;
13
+ pageIndex: number;
14
+ /** Immutable source/extraction generation, shared with the image manifest. */
15
+ revision: string;
16
+ text: string;
17
+ runs: FlipbookTextRun[];
18
+ }
19
+ export type FlipbookTextLayerProvider = (pageIndex: number, signal: AbortSignal) => Promise<FlipbookTextPage | null>;
20
+ /** Reject invalid host data before creating DOM or CSS. Run offsets use UTF-16 code units. */
21
+ export declare function validateTextPage(page: FlipbookTextPage, index: number): FlipbookTextPage;
@@ -1,3 +1,4 @@
1
+ import { FlipbookTextPage } from '../model/text-layer';
1
2
  import { Signal, ReadonlySignal } from '@preact/signals-core';
2
3
  import { FlipbookThemeMode } from '../theme/theme';
3
4
  import { NormalizedFlipbookPage } from '../model/pages';
@@ -7,6 +8,7 @@ import { PartialFlipbookMessages } from '../i18n/service';
7
8
  import { FlipbookSearchResult } from '../model/search';
8
9
  import { FlipbookHotspot } from '../model/hotspots';
9
10
  import { FlipbookAnnotation } from '../model/annotations';
11
+ import { FlipbookNoteDocument, FlipbookNoteEditorFactory } from '../model/note-editor';
10
12
 
11
13
  export type FlipState = 'read' | 'fold_corner' | 'flipping';
12
14
  export type Orientation = 'landscape' | 'portrait';
@@ -18,6 +20,20 @@ export interface ZoomState {
18
20
  scale: number;
19
21
  }
20
22
  export interface FlipbookStore {
23
+ textAvailable: Signal<boolean>;
24
+ textPages: Signal<ReadonlyMap<number, FlipbookTextPage>>;
25
+ textSelection: Signal<boolean>;
26
+ pageNoteDocuments: Signal<ReadonlyMap<number, FlipbookNoteDocument>>;
27
+ noteEditor: Signal<FlipbookNoteEditorFactory | undefined>;
28
+ canAnnotate: Signal<boolean>;
29
+ placingNote: Signal<boolean>;
30
+ pendingAnnotation: Signal<FlipbookAnnotation | null>;
31
+ notesView: Signal<'page' | 'all'>;
32
+ searchAvailable: Signal<boolean>;
33
+ searchBusy: Signal<boolean>;
34
+ searchFailed: Signal<boolean>;
35
+ notesSaving: Signal<boolean>;
36
+ notesFailed: Signal<boolean>;
21
37
  currentPage: Signal<number>;
22
38
  totalPages: Signal<number>;
23
39
  isSingleMode: Signal<boolean>;