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.
Files changed (104) hide show
  1. package/CHANGELOG.md +115 -75
  2. package/README.md +429 -295
  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 +26 -0
  6. package/dist/components/HotspotLayer.d.ts +14 -0
  7. package/dist/components/NoteEditor.d.ts +13 -0
  8. package/dist/components/NotePlacementLayer.d.ts +11 -0
  9. package/dist/components/NotesPanel.d.ts +17 -0
  10. package/dist/components/PluginPanels.d.ts +5 -0
  11. package/dist/components/ReaderHelp.d.ts +3 -0
  12. package/dist/components/ReaderShortcuts.d.ts +16 -0
  13. package/dist/components/SearchPanel.d.ts +11 -0
  14. package/dist/components/TableOfContents.d.ts +1 -0
  15. package/dist/components/TextLayer.d.ts +8 -0
  16. package/dist/components/Toolbar.d.ts +7 -1
  17. package/dist/components/ToolbarMore.d.ts +6 -0
  18. package/dist/components/Viewer.d.ts +8 -0
  19. package/dist/core/LayoutManager.d.ts +1 -1
  20. package/dist/core/PdfRenderer.d.ts +11 -0
  21. package/dist/core/TextLayerLoader.d.ts +5 -0
  22. package/dist/core/domSignal.d.ts +2 -0
  23. package/dist/core-entry.d.ts +14 -0
  24. package/dist/core.d.ts +1 -0
  25. package/dist/embed.d.ts +80 -0
  26. package/dist/engine-DD5qEHLm.js +4657 -0
  27. package/dist/engine-DD5qEHLm.js.map +1 -0
  28. package/dist/engine.d.ts +124 -0
  29. package/dist/feature-Cicli9ie.js +17 -0
  30. package/dist/feature-Cicli9ie.js.map +1 -0
  31. package/dist/flipbook-engine.core.js +8 -0
  32. package/dist/flipbook-engine.core.js.map +1 -0
  33. package/dist/flipbook-engine.css +1 -1
  34. package/dist/flipbook-engine.iife.js +51 -55
  35. package/dist/flipbook-engine.iife.js.map +1 -1
  36. package/dist/flipbook-engine.js +10 -6
  37. package/dist/flipbook-engine.js.map +1 -1
  38. package/dist/flipbook-engine.plugins-annotations.js +14 -0
  39. package/dist/flipbook-engine.plugins-annotations.js.map +1 -0
  40. package/dist/flipbook-engine.plugins-bookmarks.js +16 -0
  41. package/dist/flipbook-engine.plugins-bookmarks.js.map +1 -0
  42. package/dist/flipbook-engine.plugins-deep-link.js +14 -0
  43. package/dist/flipbook-engine.plugins-deep-link.js.map +1 -0
  44. package/dist/flipbook-engine.plugins-hotspots.js +15 -0
  45. package/dist/flipbook-engine.plugins-hotspots.js.map +1 -0
  46. package/dist/flipbook-engine.plugins-notes.js +16 -0
  47. package/dist/flipbook-engine.plugins-notes.js.map +1 -0
  48. package/dist/flipbook-engine.plugins-search.js +15 -0
  49. package/dist/flipbook-engine.plugins-search.js.map +1 -0
  50. package/dist/flipbook-engine.plugins-share.js +13 -0
  51. package/dist/flipbook-engine.plugins-share.js.map +1 -0
  52. package/dist/flipbook-engine.plugins-toc.js +14 -0
  53. package/dist/flipbook-engine.plugins-toc.js.map +1 -0
  54. package/dist/flipbook-engine.plugins.js +5 -0
  55. package/dist/flipbook-engine.plugins.js.map +1 -0
  56. package/dist/flipbook-engine.react.js +1 -1
  57. package/dist/flipbook-engine.vue.js +1 -1
  58. package/dist/i18n/locales/en.d.ts +39 -0
  59. package/dist/i18n/locales/tr.d.ts +39 -0
  60. package/dist/i18n/service.d.ts +117 -0
  61. package/dist/index-BhTR2SK6.js +366 -0
  62. package/dist/index-BhTR2SK6.js.map +1 -0
  63. package/dist/index.d.ts +10 -0
  64. package/dist/model/annotations.d.ts +15 -0
  65. package/dist/model/backend.d.ts +8 -0
  66. package/dist/model/hotspots.d.ts +40 -0
  67. package/dist/model/note-editor.d.ts +22 -0
  68. package/dist/model/search.d.ts +25 -0
  69. package/dist/model/text-layer.d.ts +21 -0
  70. package/dist/plugins/annotations.d.ts +4 -0
  71. package/dist/plugins/bookmarks.d.ts +4 -0
  72. package/dist/plugins/deep-link.d.ts +4 -0
  73. package/dist/plugins/feature.d.ts +5 -0
  74. package/dist/plugins/hotspots.d.ts +4 -0
  75. package/dist/plugins/index.d.ts +65 -0
  76. package/dist/plugins/notes.d.ts +4 -0
  77. package/dist/plugins/search.d.ts +4 -0
  78. package/dist/plugins/share.d.ts +4 -0
  79. package/dist/plugins/toc.d.ts +4 -0
  80. package/dist/plugins-annotations.d.ts +1 -0
  81. package/dist/plugins-bookmarks.d.ts +1 -0
  82. package/dist/plugins-deep-link.d.ts +1 -0
  83. package/dist/plugins-hotspots.d.ts +1 -0
  84. package/dist/plugins-notes.d.ts +1 -0
  85. package/dist/plugins-search.d.ts +1 -0
  86. package/dist/plugins-share.d.ts +1 -0
  87. package/dist/plugins-toc.d.ts +1 -0
  88. package/dist/plugins.d.ts +1 -0
  89. package/dist/state/store.d.ts +35 -5
  90. package/dist/vue/index.d.ts +1 -1
  91. package/docs/api-reference.md +228 -0
  92. package/docs/backend-text-layers.md +40 -0
  93. package/docs/frameworks.md +73 -0
  94. package/docs/getting-started.md +128 -0
  95. package/docs/i18n.md +47 -0
  96. package/docs/migration-0.4.0.md +24 -0
  97. package/docs/migration-0.5.0.md +25 -0
  98. package/docs/migration-1.0.0.md +59 -0
  99. package/docs/plugin-architecture.md +103 -0
  100. package/docs/release-checklist.md +37 -0
  101. package/docs/theming.md +61 -0
  102. package/package.json +52 -1
  103. package/dist/engine-DhQ2zxpm.js +0 -3535
  104. package/dist/engine-DhQ2zxpm.js.map +0 -1
@@ -0,0 +1,128 @@
1
+ # Getting Started
2
+
3
+ Welcome to **FlipbookEngine**! This guide will help you set up and embed FlipbookEngine into your web applications.
4
+
5
+ ## Quick Installation
6
+
7
+ You can install FlipbookEngine via npm:
8
+
9
+ ```bash
10
+ npm install flipbookengine
11
+ ```
12
+
13
+ Or reference it directly via CDN (such as unpkg) in your HTML:
14
+
15
+ ```html
16
+ <link rel="stylesheet" href="https://unpkg.com/flipbookengine/dist/flipbook-engine.css" />
17
+ <script src="https://unpkg.com/flipbookengine/dist/flipbook-engine.iife.js"></script>
18
+ ```
19
+
20
+ ## Setup Container
21
+
22
+ Create an element in your HTML that will contain the flipbook viewer. Ensure the container has explicit dimensions:
23
+
24
+ ```html
25
+ <div id="viewer" style="width: 100%; height: 600px;"></div>
26
+ ```
27
+
28
+ ## Initialize the Engine
29
+
30
+ Import `FlipbookEngine` (if using ESM) and instantiate it:
31
+
32
+ ```javascript
33
+ import { FlipbookEngine } from 'flipbookengine';
34
+ import 'flipbookengine/dist/flipbook-engine.css';
35
+
36
+ const engine = new FlipbookEngine('#viewer', {
37
+ allowDownload: true,
38
+ showThumbs: false,
39
+ primaryColor: '#7367f0'
40
+ });
41
+
42
+ // Load the PDF catalog file along with its rendered images
43
+ await engine.init('/files/catalog.pdf', [
44
+ { kind: 'cover', pageNumber: 1, normal: '/img/1.jpg', low: '/img/1-low.jpg', thumb: '/img/1-thumb.jpg' },
45
+ { kind: 'spread', pageNumbers: [2, 3], normal: '/img/2-3.jpg', low: '/img/2-3-low.jpg', thumb: '/img/2-3-thumb.jpg' }
46
+ ]);
47
+ ```
48
+
49
+ ## Mixed Page Spreads
50
+
51
+ FlipbookEngine supports loading single pages, spreads (double-pages), and covers mixed together. The engine will automatically normalize spreads (cutting them into left and right halves on portrait viewports) for responsive mobile viewing.
52
+
53
+
54
+ ## Iframe embedding
55
+
56
+ For a viewer hosted in an iframe, connect the bridge from the iframe document and allow only the parent origin:
57
+
58
+ ```javascript
59
+ const engine = new FlipbookEngine('#viewer', { showThumbs: false });
60
+ engine.connectEmbed({
61
+ allowedOrigins: ['https://catalog.example.com']
62
+ });
63
+ await engine.init('/files/catalog.pdf');
64
+ ```
65
+
66
+ From the parent page, use the controller exported by the package:
67
+
68
+ ```javascript
69
+ import { createFlipbookEmbedController } from 'flipbookengine';
70
+
71
+ const controller = createFlipbookEmbedController(
72
+ document.querySelector('#catalog-frame'),
73
+ { targetOrigin: 'https://viewer.example.com' }
74
+ );
75
+ await controller.goToPage(2);
76
+ ```
77
+
78
+ Always configure explicit origins for cross-origin embeds. The bridge supports page navigation, zoom, single mode, option updates, fullscreen, TOC read/update, search, state queries, and event forwarding.
79
+
80
+
81
+ ## Deep links and sharing
82
+
83
+ Enable opt-in URL synchronization with the `deepLink` option. The viewer reads an initial `?page=` value, updates it when the page changes, and responds to browser back/forward navigation. Page numbers in URLs are 1-based; engine API indexes remain 0-based.
84
+
85
+ ```ts
86
+ const engine = new FlipbookEngine('#viewer', { deepLink: true });
87
+ await engine.init('/files/catalog.pdf');
88
+
89
+ const pageUrl = engine.getPageUrl(4);
90
+ await engine.sharePage(4);
91
+ // The viewer toolbar also exposes a localized Share button.
92
+ // Bookmark state is host-managed and can be persisted from bookmarkChange.
93
+ engine.on('bookmarkChange', ({ pageNumber, bookmarked }) => {
94
+ console.log(`Page ${pageNumber} bookmarked: ${bookmarked}`);
95
+ });
96
+ engine.on('noteChange', ({ pageNumber, note }) => {
97
+ console.log(`Page ${pageNumber} note changed`, note);
98
+ });
99
+ engine.on('deepLinkChange', ({ pageNumber, url }) => {
100
+ console.log(`Sharing page ${pageNumber}: ${url}`);
101
+ });
102
+ ```
103
+
104
+
105
+ ## Client-side PDF search
106
+
107
+ When initialized with a PDF URL, `search(query)` extracts text through PDF.js without rendering every page. It returns page-level matches and snippets, updates the search toolbar panel, and overlays precise normalized rectangles over matching text when PDF.js exposes text geometry. Search results use a zero-based `pageIndex` for API navigation and a one-based `pageNumber` for display.
108
+
109
+ ```ts
110
+ const results = await engine.search('catalog', { caseSensitive: false, maxResults: 50 });
111
+ engine.goToPage(results[0]?.pageIndex ?? 0);
112
+ engine.clearSearch();
113
+ ```
114
+
115
+ Search is unavailable for image-only page lists because those assets do not contain extractable PDF text or text geometry. For image mode, applications that need search/highlights should generate page text and normalized coordinates on the server and pass the resulting page metadata as a host-side feature; the open-source viewer does not OCR raster images. The iframe controller exposes the same operation with `search`, `clearSearch`, and `getSearchResults`.
116
+
117
+ ## Interactive hotspots
118
+
119
+ Hosts can provide normalized (0..1) page coordinates for lightweight links and pop-ups:
120
+
121
+ ```ts
122
+ const engine = new FlipbookEngine('#viewer', {
123
+ hotspots: [{ id: 'product-42', pageIndex: 3, x: 0.60, y: 0.25, width: 0.25, height: 0.18, label: 'Product details', content: 'Open the product details page.', href: '/products/42' }]
124
+ });
125
+ engine.on('hotspotActivate', ({ hotspot }) => console.log(hotspot.id));
126
+ ```
127
+
128
+ Hotspots support `kind: 'info' | 'media' | 'gallery' | 'commerce'`. A hotspot can render a single image/video/audio preview through `media`, a selectable image gallery through `gallery`, and a safe external/product destination through `href`. Content remains plain text; applications should sanitize server-provided URLs before passing them to the viewer. Use `activateHotspot(id)` and `closeHotspot()` for programmatic control.
package/docs/i18n.md ADDED
@@ -0,0 +1,47 @@
1
+ # Internationalization (i18n)
2
+
3
+ FlipbookEngine features built-in support for multiple locales and customization of all user-facing copy.
4
+
5
+ ## Supported Locales
6
+
7
+ - **`en`** (English - default)
8
+ - **`tr`** (Turkish)
9
+
10
+ ## Set Active Locale
11
+
12
+ Change the language on initialization or dynamically at runtime:
13
+
14
+ ```javascript
15
+ // Initialization
16
+ const engine = new FlipbookEngine('#viewer', {
17
+ locale: 'tr'
18
+ });
19
+
20
+ // Runtime change
21
+ engine.setLocale('en');
22
+ ```
23
+
24
+ ## Overriding Messages
25
+
26
+ Provide translation strings to override specific labels or define messages for a new locale:
27
+
28
+ ```javascript
29
+ const engine = new FlipbookEngine('#viewer', {
30
+ locale: 'de',
31
+ messages: {
32
+ de: {
33
+ emptyStateTitle: 'Keine Seiten gefunden.',
34
+ thumbnails: 'Miniaturansichten',
35
+ singlePageMode: 'Einzelseiten-Modus',
36
+ pages: 'Seiten',
37
+ previous: 'Zurück',
38
+ next: 'Weiter',
39
+ zoomOut: 'Herauszoomen',
40
+ zoomIn: 'Herinzoomen',
41
+ fullscreen: 'Vollbild',
42
+ settings: 'Einstellungen',
43
+ downloadCatalog: 'PDF Herunterladen'
44
+ }
45
+ }
46
+ });
47
+ ```
@@ -0,0 +1,24 @@
1
+ # Migration Guide for 0.4.0
2
+
3
+ ## Scope
4
+
5
+ FlipbookEngine 0.4.0 is the stabilization release described by the audit plan. It keeps the core public navigation methods while making lifecycle, state, wrapper, event, and viewer behavior deterministic across multiple instances.
6
+
7
+ ## Required consumer checks
8
+
9
+ - Keep `pdfjs-dist` installed as the production dependency and provide `pdfWorkerSrc` from the host bundler or CDN. PDF.js is intentionally external to the FlipbookEngine bundle.
10
+ - If host CSS or automation selected fixed viewer IDs, migrate to the instance-scoped classes such as `.bk-book-wrapper`, `.bk-book-sizer`, `.bk-book`, and `.bk-single-view` within the engine container.
11
+ - Treat `pages` as optional when `pdfUrl` is provided. Framework wrappers may update `pdfUrl` and `pages` independently without triggering duplicate initialization.
12
+ - Image-only viewers do not render a download button because no PDF URL is available.
13
+
14
+ ## Runtime behavior changes
15
+
16
+ - Each `FlipbookEngine` instance owns its reactive state; internal singleton store imports must not be used by integrations.
17
+ - A newer `init()` or `destroy()` cancels stale PDF loading, rendering, timers, and listeners.
18
+ - `progress` and `error` events are available for PDF loading/rendering telemetry and failure handling.
19
+ - High-quality page assets are promoted when pages become visible. PDF rendering uses bounded concurrency controlled by `pdfRenderConcurrency` (default `3`).
20
+ - Toolbar and thumbnail controls expose accessible names, state, and keyboard interaction.
21
+
22
+ ## Verification
23
+
24
+ Before shipping an integration, run `npm run typecheck`, `npm test`, and `npm run build` against the locked 0.4.0 dependency tree.
@@ -0,0 +1,25 @@
1
+ # Migration Guide for 0.5.0
2
+
3
+ ## Scope
4
+
5
+ FlipbookEngine 0.5.0 makes PDF-backed viewers responsive for large documents. Page markup is created from PDF metadata, while rendered page images are requested only for the current/nearby pages or when a page becomes visible.
6
+
7
+ ## Runtime behavior changes
8
+
9
+ - `init()` resolves after the first PDF page has rendered. The next page is prefetched in the background.
10
+ - PDF render requests are deduplicated and cancelled when a newer initialization starts or the engine is destroyed.
11
+ - `pdfRenderConcurrency` continues to bound PDF.js work (default `3`).
12
+ - `pdfRenderCacheSize` controls a per-instance least-recently-used cache (default `32`). Set it to `0` to disable retention of rendered page images.
13
+ - `progress` reports loading and rendering phases; `error` reports `PDF_LOAD_FAILED` and `PDF_RENDER_FAILED` failures.
14
+ - Browser, React, and Vue wrappers share the same lifecycle-safe on-demand behavior.
15
+ - Keyboard controls and visible focus states remain available, and `prefers-reduced-motion: reduce` disables page-turn animation and shortens CSS transitions.
16
+
17
+ ## Consumer checks
18
+
19
+ - Keep `pdfjs-dist` installed as the production dependency and provide `pdfWorkerSrc` from the host bundler or CDN.
20
+ - If an application assumed that every PDF page image existed immediately after `init()`, listen for `progress` events or select the page before reading its image element.
21
+ - Choose a cache size based on available memory and page dimensions. A value of `0` is appropriate for strictly bounded memory usage.
22
+
23
+ ## Verification
24
+
25
+ Run `npm run typecheck`, `npm test`, `npm run build`, and `npm run test:e2e` (after installing Playwright browsers) before shipping an integration.
@@ -0,0 +1,59 @@
1
+ # 1.0.0 migration guide
2
+
3
+ FlipbookEngine 1.0.0 is the first stable open-source release. The 0.x line was
4
+ alpha/beta and does not provide a compatibility guarantee. Test the viewer and
5
+ wrapper integrations against the new package before deploying.
6
+
7
+ ## Plugin entry points
8
+
9
+ The all-in-one import remains available:
10
+
11
+ ```ts
12
+ import { FlipbookEngine } from 'flipbookengine';
13
+ ```
14
+
15
+ Optional feature adapters can be loaded independently:
16
+
17
+ ```ts
18
+ import { FlipbookEngine } from 'flipbookengine/core';
19
+ import { notesPlugin } from 'flipbookengine/plugins/notes';
20
+
21
+ const engine = new FlipbookEngine('#viewer', { plugins: [notesPlugin] });
22
+ ```
23
+
24
+ Available adapters are documented in [plugin architecture](./plugin-architecture.md).
25
+ The official OSS package does not include analytics, OCR, PDF outline extraction,
26
+ protected downloads, or backend rendering.
27
+
28
+ ## TOC and iframe API
29
+
30
+ TOC is supplied as a host-provided `FlipbookTocEntry[]` manifest. Use
31
+ `engine.getToc()` and `engine.setToc(entries, show?)` for runtime updates. Iframe
32
+ controllers additionally expose `getToc()` and `setToc()` through the validated
33
+ postMessage bridge.
34
+
35
+ ## Wrapper validation
36
+
37
+ React and Vue wrappers continue to accept the engine options object, including
38
+ `plugins`. Validate wrapper lifecycle, CSS import, PDF worker configuration, and
39
+ host-managed note/bookmark persistence during migration.
40
+
41
+ ## 0.8.0 to 1.0.0 differences
42
+
43
+ The 1.0.0 release is the first compatibility boundary. The 0.x line was alpha/beta, so applications must validate the complete integration instead of assuming semver compatibility.
44
+
45
+ | Area | 0.8.0 | 1.0.0 | Migration impact |
46
+ | --- | --- | --- | --- |
47
+ | Package surface | All-in-one public entry | All-in-one plus core, plugins, and feature subpaths | Imports from documented public paths are supported; imports from internal src/dist files are breaking and must be replaced. |
48
+ | Optional features | Built-in reader surface only | Plugin contract with install/uninstall, typed events, toolbar/panel/API contributions | If an application wants an adapter API, register the adapter explicitly; omitted adapters are inactive. |
49
+ | TOC | Host-provided TOC panel | Nested TOC plus getToc/setToc and iframe commands | Existing TOC data remains host-provided; update integrations that need runtime or embed control. |
50
+ | Hotspots | Basic text/link overlays | info/media/gallery/commerce, image/video/audio previews, galleries, product links | Existing overlays remain valid; new media/gallery fields are additive. |
51
+ | Image mode search | Disabled for raster page lists | Still disabled; PDF mode only | No change; raster search requires host/server text metadata. |
52
+ | Commercial capabilities | Not part of OSS | Still not part of OSS | Backend rendering, OCR/indexing, protected downloads, persistence, identity, and analytics remain commercial/backend work. |
53
+
54
+ ### Breaking-change requirements
55
+
56
+ - Do not depend on undocumented internal modules, generated chunk filenames, or 0.x implementation details.
57
+ - Re-run wrapper and iframe smoke tests after upgrading; React and Vue wrappers must be rebuilt against the 1.0.0 declarations.
58
+ - Treat plugin registration as explicit state. Calling uninstallPlugin removes APIs, UI contributions, event listeners, and cleanup callbacks; it does not merely hide a button.
59
+ - Existing all-in-one initialization with documented options is retained, but the 0.x line has no compatibility guarantee and must not be used as a rollback contract.
@@ -0,0 +1,103 @@
1
+ # Plugin architecture
2
+
3
+ FlipbookEngine v1 exposes a small plugin contract so optional reader features can
4
+ be distributed independently from the rendering core. Plugins are installed
5
+ before the first render through `plugins` or `engine.installPlugin(plugin)`.
6
+
7
+ ```ts
8
+ import { FlipbookEngine } from 'flipbookengine/core';
9
+ import type { FlipbookPlugin } from 'flipbookengine/plugins';
10
+
11
+ const tocPlugin: FlipbookPlugin = {
12
+ name: 'toc',
13
+ install(engine, context) {
14
+ context.registerToolbarButton({
15
+ id: 'toc',
16
+ label: 'Contents',
17
+ icon: '☰',
18
+ onClick: () => context.openPanel('contents')
19
+ });
20
+
21
+ context.registerPanel({
22
+ id: 'contents',
23
+ title: 'Table of contents',
24
+ render: (container) => {
25
+ container.textContent = `Page ${engine.getCurrentPage() + 1}`;
26
+ }
27
+ });
28
+
29
+ context.registerApi('getCurrentSection', () => engine.getCurrentPage());
30
+ return () => context.closePanel('contents');
31
+ }
32
+ };
33
+
34
+ const engine = new FlipbookEngine('#viewer', { plugins: [tocPlugin] });
35
+ ```
36
+
37
+ The context provides:
38
+
39
+ - `registerToolbarButton()` for a framework-agnostic toolbar action.
40
+ - `registerPanel()` for a panel mounted inside the viewer shell.
41
+ - `registerApi()` and `engine.callPluginApi()` for namespaced plugin methods.
42
+ - `on()` for typed engine event subscriptions with automatic cleanup.
43
+ - `openPanel()` / `closePanel()` for panel state.
44
+
45
+ Plugin names and contribution identifiers must be unique within an engine.
46
+ Calling `engine.destroy()` removes all plugin registrations and runs cleanup
47
+ callbacks. A plugin installed after initialization is available on the next
48
+ viewer render; install initial plugins in the constructor options when their UI
49
+ must be present on the first render.
50
+
51
+ For example, a host that only needs note persistence can load the notes adapter
52
+ without importing the other feature adapters:
53
+
54
+ ```ts
55
+ import { FlipbookEngine } from 'flipbookengine/core';
56
+ import { notesPlugin } from 'flipbookengine/plugins/notes';
57
+
58
+ const engine = new FlipbookEngine('#viewer', { plugins: [notesPlugin] });
59
+ await engine.callPluginApi('notes', 'set', 0, 'Review this page');
60
+ ```
61
+
62
+ Official lightweight adapters are available as independent entry points:
63
+
64
+ - `flipbookengine/plugins/notes`
65
+ - `flipbookengine/plugins/bookmarks`
66
+ - `flipbookengine/plugins/toc`
67
+ - `flipbookengine/plugins/search`
68
+ - `flipbookengine/plugins/annotations`
69
+ - `flipbookengine/plugins/hotspots`
70
+ - `flipbookengine/plugins/share`
71
+ - `flipbookengine/plugins/deep-link`
72
+
73
+ Each adapter registers namespaced APIs over the existing host-managed engine
74
+ methods. The all-in-one entry remains unchanged, so applications can migrate
75
+ incrementally without loading an adapter they do not use.
76
+
77
+ The public `flipbookengine` entry remains the all-in-one build. `flipbookengine/core`
78
+ contains the core engine exports, `flipbookengine/plugins` contains the plugin
79
+ contract, and the feature subpaths above contain the optional adapters. Analytics is intentionally not an official
80
+ open-source plugin; applications may consume events directly or use a private
81
+ commercial adapter.
82
+
83
+
84
+ ## Activating and deactivating plugins
85
+
86
+ Pass adapters in the constructor to activate them before the first render:
87
+
88
+ ```ts
89
+ import { FlipbookEngine } from 'flipbookengine/core';
90
+ import { hotspotsPlugin } from 'flipbookengine/plugins/hotspots';
91
+
92
+ const engine = new FlipbookEngine('#viewer', { plugins: [hotspotsPlugin] });
93
+ ```
94
+
95
+ A plugin can also be enabled or disabled after initialization. installPlugin returns the engine instance; uninstallPlugin returns true when a plugin was removed and clears all registered contributions.
96
+
97
+ ```ts
98
+ engine.uninstallPlugin('hotspots');
99
+ engine.installPlugin(hotspotsPlugin);
100
+ await engine.callPluginApi('hotspots', 'activate', 'product-42');
101
+ ```
102
+
103
+ Feature adapters are API-only contributions. The built-in all-in-one viewer continues to render its existing toolbar and panels from the corresponding options; custom plugins can add their own UI contributions with registerToolbarButton and registerPanel.
@@ -0,0 +1,37 @@
1
+ # Release Checklist
2
+
3
+ Use this checklist for every phase commit and every published release.
4
+
5
+ ## Before committing a phase
6
+
7
+ - [ ] Confirm the change scope and choose the correct SemVer impact (patch, minor, or major).
8
+ - [ ] Keep each coherent phase in a separate commit with an action-oriented message.
9
+ - [ ] Add or update tests for every new feature, API, bug fix, and changed behavior.
10
+ - [ ] Run the relevant focused tests and record results in the local `development-notes/` report.
11
+ - [ ] Confirm no local audit reports, build output, credentials, or environment files are staged.
12
+ - [ ] Review `git diff --check` and the staged diff.
13
+
14
+ ## Before a release
15
+
16
+ - [ ] Update the version in `package.json` and `package-lock.json`.
17
+ - [ ] Update every published version reference in README files, CHANGELOG, API documentation, migration guides, examples, and license/source headers.
18
+ - [ ] Add a CHANGELOG entry describing features, fixes, API changes, and test coverage.
19
+ - [ ] Document every new or changed API in the API reference and README examples.
20
+ - [ ] Mark all breaking changes explicitly, explain the impact, and provide migration guidance.
21
+ - [ ] Verify wrapper exports, generated declarations, package entry points, and framework integrations.
22
+ - [ ] Run `npm run typecheck`, `npm test`, `npm run build`, and `npm run pack:check`.
23
+ - [ ] Confirm `npm pkg get version` matches the intended release.
24
+ - [ ] Inspect the `npm pack --dry-run` file list and package size.
25
+ - [ ] Confirm both local repositories have clean working trees and the intended commits are on the correct branches.
26
+ - [ ] Create and push the matching Git tag (for example, `v1.0.0`).
27
+ - [ ] Create or update the GitHub Release from that tag and verify the Latest designation.
28
+ - [ ] Push commits and tags before handing off the manual npm publish step.
29
+ - [ ] Publish to npm manually with maintainer credentials; verify the registry version afterward.
30
+ - [ ] Record all commands, results, release URLs, and follow-up items in local `development-notes/`.
31
+
32
+ ## After publishing
33
+
34
+ - [ ] Verify the npm package page, tarball version, README, and package contents.
35
+ - [ ] Verify GitHub tag/release and the default branch point to the same release commit.
36
+ - [ ] Check that no deprecated or unreleased version is shown as Latest.
37
+ - [ ] Note any known warnings (for example, network/DNS or jsdom media warnings) separately from failures.
@@ -0,0 +1,61 @@
1
+ # Theming & Customization
2
+
3
+ FlipbookEngine provides deep customization support through compiled CSS custom properties (variables) and dark-mode compatibility.
4
+
5
+ ## CSS Custom Properties
6
+
7
+ The styling system is driven by standard CSS variables. You can override these variables globally in your stylesheet or per-instance:
8
+
9
+ ```css
10
+ :root {
11
+ --mainbgcolor: #f3f6fb; /* Main canvas background */
12
+ --surfacebgcolor: #ffffff; /* Overlay elements background */
13
+ --panelbgcolor: #172033; /* Settings panel background */
14
+ --flipbook-accent: #7367f0; /* Buttons and accent color */
15
+ --thumbrailbgcolor: #0f172a; /* Thumbnails container background */
16
+ --bordercolor: #e2e8f0; /* Border and separations color */
17
+ --textcolor: #1e293b; /* General text color */
18
+ }
19
+ ```
20
+
21
+ ## Dark Mode
22
+
23
+ FlipbookEngine is compatible with Bootstrap 5 setups and automatically responds to light/dark themes in the hosting environment.
24
+
25
+ - It queries `data-bs-theme="dark"` on the body/parent element to toggle styling.
26
+ - You can force dark theme on initialization:
27
+ ```javascript
28
+ const engine = new FlipbookEngine('#viewer', {
29
+ theme: 'dark'
30
+ });
31
+ ```
32
+
33
+ ## Instance Overrides
34
+
35
+ To style a single instance differently from the rest of your app, pass the `cssVariables` object to options:
36
+
37
+ ```javascript
38
+ const engine = new FlipbookEngine('#viewer', {
39
+ cssVariables: {
40
+ mainbgcolor: '#0f172a',
41
+ flipbook-accent: '#10b981'
42
+ }
43
+ });
44
+ ```
45
+
46
+
47
+ ## Optional Light/Dark Viewer Backgrounds
48
+
49
+ A host can provide separate, optional backgrounds for the viewer surface. The default is null, so the built-in theme surfaces remain unchanged. Backgrounds are applied outside the PDF pages and automatically follow the selected light, dark, or auto theme.
50
+
51
+ ```ts
52
+ const engine = new FlipbookEngine('#viewer', {
53
+ theme: 'auto',
54
+ background: {
55
+ light: { color: '#f8fafc', image: '/branding/catalog-light.webp', size: 'cover', position: 'center', repeat: 'no-repeat' },
56
+ dark: { color: '#0f172a', image: '/branding/catalog-dark.webp', size: 'cover' }
57
+ }
58
+ });
59
+ ```
60
+
61
+ The viewer reserves a bottom attribution area and uses equal responsive page gutters so the watermark does not overlap PDF content. Thumbnail rail scrolling is horizontal-only; thumbnail dimensions are reduced responsively to avoid vertical overflow.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flipbookengine",
3
- "version": "0.6.5",
3
+ "version": "1.0.2",
4
4
  "description": "A modern, embeddable HTML flipbook engine for PDF-backed catalogs and digital publications.",
5
5
  "private": false,
6
6
  "scripts": {
@@ -43,6 +43,7 @@
43
43
  ],
44
44
  "files": [
45
45
  "dist",
46
+ "docs",
46
47
  "react",
47
48
  "vue",
48
49
  "README.md",
@@ -73,6 +74,56 @@
73
74
  "types": "./dist/vue/index.d.ts",
74
75
  "import": "./dist/flipbook-engine.vue.js",
75
76
  "default": "./dist/flipbook-engine.vue.js"
77
+ },
78
+ "./core": {
79
+ "types": "./dist/core-entry.d.ts",
80
+ "import": "./dist/flipbook-engine.core.js",
81
+ "default": "./dist/flipbook-engine.core.js"
82
+ },
83
+ "./plugins": {
84
+ "types": "./dist/plugins/index.d.ts",
85
+ "import": "./dist/flipbook-engine.plugins.js",
86
+ "default": "./dist/flipbook-engine.plugins.js"
87
+ },
88
+ "./plugins/notes": {
89
+ "types": "./dist/plugins-notes.d.ts",
90
+ "import": "./dist/flipbook-engine.plugins-notes.js",
91
+ "default": "./dist/flipbook-engine.plugins-notes.js"
92
+ },
93
+ "./plugins/bookmarks": {
94
+ "types": "./dist/plugins-bookmarks.d.ts",
95
+ "import": "./dist/flipbook-engine.plugins-bookmarks.js",
96
+ "default": "./dist/flipbook-engine.plugins-bookmarks.js"
97
+ },
98
+ "./plugins/toc": {
99
+ "types": "./dist/plugins-toc.d.ts",
100
+ "import": "./dist/flipbook-engine.plugins-toc.js",
101
+ "default": "./dist/flipbook-engine.plugins-toc.js"
102
+ },
103
+ "./plugins/search": {
104
+ "types": "./dist/plugins-search.d.ts",
105
+ "import": "./dist/flipbook-engine.plugins-search.js",
106
+ "default": "./dist/flipbook-engine.plugins-search.js"
107
+ },
108
+ "./plugins/annotations": {
109
+ "types": "./dist/plugins-annotations.d.ts",
110
+ "import": "./dist/flipbook-engine.plugins-annotations.js",
111
+ "default": "./dist/flipbook-engine.plugins-annotations.js"
112
+ },
113
+ "./plugins/hotspots": {
114
+ "types": "./dist/plugins-hotspots.d.ts",
115
+ "import": "./dist/flipbook-engine.plugins-hotspots.js",
116
+ "default": "./dist/flipbook-engine.plugins-hotspots.js"
117
+ },
118
+ "./plugins/share": {
119
+ "types": "./dist/plugins-share.d.ts",
120
+ "import": "./dist/flipbook-engine.plugins-share.js",
121
+ "default": "./dist/flipbook-engine.plugins-share.js"
122
+ },
123
+ "./plugins/deep-link": {
124
+ "types": "./dist/plugins-deep-link.d.ts",
125
+ "import": "./dist/flipbook-engine.plugins-deep-link.js",
126
+ "default": "./dist/flipbook-engine.plugins-deep-link.js"
76
127
  }
77
128
  },
78
129
  "peerDependencies": {