next-flipbook 0.0.0-stage → 0.7.0

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 (312) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +278 -2
  3. package/dist/actions/download.d.ts +18 -0
  4. package/dist/actions/download.d.ts.map +1 -0
  5. package/dist/actions/download.js +82 -0
  6. package/dist/actions/download.js.map +1 -0
  7. package/dist/actions/fullscreen.d.ts +44 -0
  8. package/dist/actions/fullscreen.d.ts.map +1 -0
  9. package/dist/actions/fullscreen.js +153 -0
  10. package/dist/actions/fullscreen.js.map +1 -0
  11. package/dist/actions/index.d.ts +8 -0
  12. package/dist/actions/index.d.ts.map +1 -0
  13. package/dist/actions/index.js +5 -0
  14. package/dist/actions/index.js.map +1 -0
  15. package/dist/actions/print.d.ts +49 -0
  16. package/dist/actions/print.d.ts.map +1 -0
  17. package/dist/actions/print.js +172 -0
  18. package/dist/actions/print.js.map +1 -0
  19. package/dist/actions/share.d.ts +21 -0
  20. package/dist/actions/share.d.ts.map +1 -0
  21. package/dist/actions/share.js +47 -0
  22. package/dist/actions/share.js.map +1 -0
  23. package/dist/core/animation/easing.d.ts +9 -0
  24. package/dist/core/animation/easing.d.ts.map +1 -0
  25. package/dist/core/animation/easing.js +16 -0
  26. package/dist/core/animation/easing.js.map +1 -0
  27. package/dist/core/animation/scheduler.d.ts +12 -0
  28. package/dist/core/animation/scheduler.d.ts.map +1 -0
  29. package/dist/core/animation/scheduler.js +19 -0
  30. package/dist/core/animation/scheduler.js.map +1 -0
  31. package/dist/core/animation/turn.d.ts +34 -0
  32. package/dist/core/animation/turn.d.ts.map +1 -0
  33. package/dist/core/animation/turn.js +27 -0
  34. package/dist/core/animation/turn.js.map +1 -0
  35. package/dist/core/animation/tween.d.ts +14 -0
  36. package/dist/core/animation/tween.d.ts.map +1 -0
  37. package/dist/core/animation/tween.js +27 -0
  38. package/dist/core/animation/tween.js.map +1 -0
  39. package/dist/core/bookmarks/BookmarkStore.d.ts +64 -0
  40. package/dist/core/bookmarks/BookmarkStore.d.ts.map +1 -0
  41. package/dist/core/bookmarks/BookmarkStore.js +170 -0
  42. package/dist/core/bookmarks/BookmarkStore.js.map +1 -0
  43. package/dist/core/cache/PageCache.d.ts +80 -0
  44. package/dist/core/cache/PageCache.d.ts.map +1 -0
  45. package/dist/core/cache/PageCache.js +159 -0
  46. package/dist/core/cache/PageCache.js.map +1 -0
  47. package/dist/core/engine/FlipBookEngine.d.ts +106 -0
  48. package/dist/core/engine/FlipBookEngine.d.ts.map +1 -0
  49. package/dist/core/engine/FlipBookEngine.js +408 -0
  50. package/dist/core/engine/FlipBookEngine.js.map +1 -0
  51. package/dist/core/errors.d.ts +42 -0
  52. package/dist/core/errors.d.ts.map +1 -0
  53. package/dist/core/errors.js +28 -0
  54. package/dist/core/errors.js.map +1 -0
  55. package/dist/core/index.d.ts +33 -0
  56. package/dist/core/index.d.ts.map +1 -0
  57. package/dist/core/index.js +18 -0
  58. package/dist/core/index.js.map +1 -0
  59. package/dist/core/interaction/GestureRecognizer.d.ts +102 -0
  60. package/dist/core/interaction/GestureRecognizer.d.ts.map +1 -0
  61. package/dist/core/interaction/GestureRecognizer.js +237 -0
  62. package/dist/core/interaction/GestureRecognizer.js.map +1 -0
  63. package/dist/core/interaction/drag.d.ts +33 -0
  64. package/dist/core/interaction/drag.d.ts.map +1 -0
  65. package/dist/core/interaction/drag.js +46 -0
  66. package/dist/core/interaction/drag.js.map +1 -0
  67. package/dist/core/layout/sizing.d.ts +34 -0
  68. package/dist/core/layout/sizing.d.ts.map +1 -0
  69. package/dist/core/layout/sizing.js +68 -0
  70. package/dist/core/layout/sizing.js.map +1 -0
  71. package/dist/core/layout/spreads.d.ts +37 -0
  72. package/dist/core/layout/spreads.d.ts.map +1 -0
  73. package/dist/core/layout/spreads.js +54 -0
  74. package/dist/core/layout/spreads.js.map +1 -0
  75. package/dist/core/persistence/readingState.d.ts +15 -0
  76. package/dist/core/persistence/readingState.d.ts.map +1 -0
  77. package/dist/core/persistence/readingState.js +38 -0
  78. package/dist/core/persistence/readingState.js.map +1 -0
  79. package/dist/core/search/SearchController.d.ts +91 -0
  80. package/dist/core/search/SearchController.d.ts.map +1 -0
  81. package/dist/core/search/SearchController.js +188 -0
  82. package/dist/core/search/SearchController.js.map +1 -0
  83. package/dist/core/search/text.d.ts +57 -0
  84. package/dist/core/search/text.d.ts.map +1 -0
  85. package/dist/core/search/text.js +107 -0
  86. package/dist/core/search/text.js.map +1 -0
  87. package/dist/core/types.d.ts +173 -0
  88. package/dist/core/types.d.ts.map +1 -0
  89. package/dist/core/types.js +2 -0
  90. package/dist/core/types.js.map +1 -0
  91. package/dist/core/ui/UiStore.d.ts +60 -0
  92. package/dist/core/ui/UiStore.d.ts.map +1 -0
  93. package/dist/core/ui/UiStore.js +85 -0
  94. package/dist/core/ui/UiStore.js.map +1 -0
  95. package/dist/core/zoom/ZoomController.d.ts +130 -0
  96. package/dist/core/zoom/ZoomController.d.ts.map +1 -0
  97. package/dist/core/zoom/ZoomController.js +319 -0
  98. package/dist/core/zoom/ZoomController.js.map +1 -0
  99. package/dist/image/index.d.ts +3 -0
  100. package/dist/image/index.d.ts.map +1 -0
  101. package/dist/image/index.js +2 -0
  102. package/dist/image/index.js.map +1 -0
  103. package/dist/image/loader.d.ts +19 -0
  104. package/dist/image/loader.d.ts.map +1 -0
  105. package/dist/image/loader.js +70 -0
  106. package/dist/image/loader.js.map +1 -0
  107. package/dist/index.d.ts +4 -0
  108. package/dist/index.d.ts.map +1 -0
  109. package/dist/index.js +2 -0
  110. package/dist/index.js.map +1 -0
  111. package/dist/pdf/errors.d.ts +10 -0
  112. package/dist/pdf/errors.d.ts.map +1 -0
  113. package/dist/pdf/errors.js +64 -0
  114. package/dist/pdf/errors.js.map +1 -0
  115. package/dist/pdf/index.d.ts +13 -0
  116. package/dist/pdf/index.d.ts.map +1 -0
  117. package/dist/pdf/index.js +9 -0
  118. package/dist/pdf/index.js.map +1 -0
  119. package/dist/pdf/links.d.ts +6 -0
  120. package/dist/pdf/links.d.ts.map +1 -0
  121. package/dist/pdf/links.js +21 -0
  122. package/dist/pdf/links.js.map +1 -0
  123. package/dist/pdf/manager.d.ts +96 -0
  124. package/dist/pdf/manager.d.ts.map +1 -0
  125. package/dist/pdf/manager.js +247 -0
  126. package/dist/pdf/manager.js.map +1 -0
  127. package/dist/pdf/renderer.d.ts +39 -0
  128. package/dist/pdf/renderer.d.ts.map +1 -0
  129. package/dist/pdf/renderer.js +59 -0
  130. package/dist/pdf/renderer.js.map +1 -0
  131. package/dist/pdf/session.d.ts +192 -0
  132. package/dist/pdf/session.d.ts.map +1 -0
  133. package/dist/pdf/session.js +800 -0
  134. package/dist/pdf/session.js.map +1 -0
  135. package/dist/pdf/source.d.ts +13 -0
  136. package/dist/pdf/source.d.ts.map +1 -0
  137. package/dist/pdf/source.js +52 -0
  138. package/dist/pdf/source.js.map +1 -0
  139. package/dist/pdf/types.d.ts +165 -0
  140. package/dist/pdf/types.d.ts.map +1 -0
  141. package/dist/pdf/types.js +2 -0
  142. package/dist/pdf/types.js.map +1 -0
  143. package/dist/pdf/worker.d.ts +11 -0
  144. package/dist/pdf/worker.d.ts.map +1 -0
  145. package/dist/pdf/worker.js +51 -0
  146. package/dist/pdf/worker.js.map +1 -0
  147. package/dist/react/components/BookmarkRibbon.d.ts +8 -0
  148. package/dist/react/components/BookmarkRibbon.d.ts.map +1 -0
  149. package/dist/react/components/BookmarkRibbon.js +13 -0
  150. package/dist/react/components/BookmarkRibbon.js.map +1 -0
  151. package/dist/react/components/FlipBook.d.ts +15 -0
  152. package/dist/react/components/FlipBook.d.ts.map +1 -0
  153. package/dist/react/components/FlipBook.js +173 -0
  154. package/dist/react/components/FlipBook.js.map +1 -0
  155. package/dist/react/components/FlipBookBookmarks.d.ts +13 -0
  156. package/dist/react/components/FlipBookBookmarks.d.ts.map +1 -0
  157. package/dist/react/components/FlipBookBookmarks.js +65 -0
  158. package/dist/react/components/FlipBookBookmarks.js.map +1 -0
  159. package/dist/react/components/FlipBookControls.d.ts +11 -0
  160. package/dist/react/components/FlipBookControls.d.ts.map +1 -0
  161. package/dist/react/components/FlipBookControls.js +42 -0
  162. package/dist/react/components/FlipBookControls.js.map +1 -0
  163. package/dist/react/components/FlipBookPageView.d.ts +11 -0
  164. package/dist/react/components/FlipBookPageView.d.ts.map +1 -0
  165. package/dist/react/components/FlipBookPageView.js +55 -0
  166. package/dist/react/components/FlipBookPageView.js.map +1 -0
  167. package/dist/react/components/FlipBookProvider.d.ts +12 -0
  168. package/dist/react/components/FlipBookProvider.d.ts.map +1 -0
  169. package/dist/react/components/FlipBookProvider.js +386 -0
  170. package/dist/react/components/FlipBookProvider.js.map +1 -0
  171. package/dist/react/components/FlipBookSearch.d.ts +15 -0
  172. package/dist/react/components/FlipBookSearch.d.ts.map +1 -0
  173. package/dist/react/components/FlipBookSearch.js +87 -0
  174. package/dist/react/components/FlipBookSearch.js.map +1 -0
  175. package/dist/react/components/FlipBookSidePanel.d.ts +12 -0
  176. package/dist/react/components/FlipBookSidePanel.d.ts.map +1 -0
  177. package/dist/react/components/FlipBookSidePanel.js +106 -0
  178. package/dist/react/components/FlipBookSidePanel.js.map +1 -0
  179. package/dist/react/components/FlipBookStage.d.ts +8 -0
  180. package/dist/react/components/FlipBookStage.d.ts.map +1 -0
  181. package/dist/react/components/FlipBookStage.js +358 -0
  182. package/dist/react/components/FlipBookStage.js.map +1 -0
  183. package/dist/react/components/FlipBookTOC.d.ts +12 -0
  184. package/dist/react/components/FlipBookTOC.d.ts.map +1 -0
  185. package/dist/react/components/FlipBookTOC.js +113 -0
  186. package/dist/react/components/FlipBookTOC.js.map +1 -0
  187. package/dist/react/components/FlipBookThumbnails.d.ts +20 -0
  188. package/dist/react/components/FlipBookThumbnails.d.ts.map +1 -0
  189. package/dist/react/components/FlipBookThumbnails.js +218 -0
  190. package/dist/react/components/FlipBookThumbnails.js.map +1 -0
  191. package/dist/react/components/FlipBookToolbar.d.ts +16 -0
  192. package/dist/react/components/FlipBookToolbar.d.ts.map +1 -0
  193. package/dist/react/components/FlipBookToolbar.js +46 -0
  194. package/dist/react/components/FlipBookToolbar.js.map +1 -0
  195. package/dist/react/components/FlipBookToolbarButton.d.ts +18 -0
  196. package/dist/react/components/FlipBookToolbarButton.d.ts.map +1 -0
  197. package/dist/react/components/FlipBookToolbarButton.js +27 -0
  198. package/dist/react/components/FlipBookToolbarButton.js.map +1 -0
  199. package/dist/react/components/HotspotPopover.d.ts +20 -0
  200. package/dist/react/components/HotspotPopover.d.ts.map +1 -0
  201. package/dist/react/components/HotspotPopover.js +48 -0
  202. package/dist/react/components/HotspotPopover.js.map +1 -0
  203. package/dist/react/components/PageOverlays.d.ts +11 -0
  204. package/dist/react/components/PageOverlays.d.ts.map +1 -0
  205. package/dist/react/components/PageOverlays.js +63 -0
  206. package/dist/react/components/PageOverlays.js.map +1 -0
  207. package/dist/react/components/PasswordDialog.d.ts +11 -0
  208. package/dist/react/components/PasswordDialog.d.ts.map +1 -0
  209. package/dist/react/components/PasswordDialog.js +58 -0
  210. package/dist/react/components/PasswordDialog.js.map +1 -0
  211. package/dist/react/components/PdfPageView.d.ts +16 -0
  212. package/dist/react/components/PdfPageView.d.ts.map +1 -0
  213. package/dist/react/components/PdfPageView.js +124 -0
  214. package/dist/react/components/PdfPageView.js.map +1 -0
  215. package/dist/react/components/Thumbnail.d.ts +9 -0
  216. package/dist/react/components/Thumbnail.d.ts.map +1 -0
  217. package/dist/react/components/Thumbnail.js +61 -0
  218. package/dist/react/components/Thumbnail.js.map +1 -0
  219. package/dist/react/context.d.ts +73 -0
  220. package/dist/react/context.d.ts.map +1 -0
  221. package/dist/react/context.js +11 -0
  222. package/dist/react/context.js.map +1 -0
  223. package/dist/react/controller.d.ts +30 -0
  224. package/dist/react/controller.d.ts.map +1 -0
  225. package/dist/react/controller.js +109 -0
  226. package/dist/react/controller.js.map +1 -0
  227. package/dist/react/hooks/useBookContent.d.ts +50 -0
  228. package/dist/react/hooks/useBookContent.d.ts.map +1 -0
  229. package/dist/react/hooks/useBookContent.js +135 -0
  230. package/dist/react/hooks/useBookContent.js.map +1 -0
  231. package/dist/react/hooks/useBookExtras.d.ts +47 -0
  232. package/dist/react/hooks/useBookExtras.d.ts.map +1 -0
  233. package/dist/react/hooks/useBookExtras.js +232 -0
  234. package/dist/react/hooks/useBookExtras.js.map +1 -0
  235. package/dist/react/hooks/useConstant.d.ts +7 -0
  236. package/dist/react/hooks/useConstant.d.ts.map +1 -0
  237. package/dist/react/hooks/useConstant.js +11 -0
  238. package/dist/react/hooks/useConstant.js.map +1 -0
  239. package/dist/react/hooks/useElementSize.d.ts +11 -0
  240. package/dist/react/hooks/useElementSize.d.ts.map +1 -0
  241. package/dist/react/hooks/useElementSize.js +40 -0
  242. package/dist/react/hooks/useElementSize.js.map +1 -0
  243. package/dist/react/hooks/useEngineState.d.ts +5 -0
  244. package/dist/react/hooks/useEngineState.d.ts.map +1 -0
  245. package/dist/react/hooks/useEngineState.js +7 -0
  246. package/dist/react/hooks/useEngineState.js.map +1 -0
  247. package/dist/react/hooks/useFlipBook.d.ts +29 -0
  248. package/dist/react/hooks/useFlipBook.d.ts.map +1 -0
  249. package/dist/react/hooks/useFlipBook.js +30 -0
  250. package/dist/react/hooks/useFlipBook.js.map +1 -0
  251. package/dist/react/hooks/useGestures.d.ts +26 -0
  252. package/dist/react/hooks/useGestures.d.ts.map +1 -0
  253. package/dist/react/hooks/useGestures.js +183 -0
  254. package/dist/react/hooks/useGestures.js.map +1 -0
  255. package/dist/react/hooks/useIsoLayoutEffect.d.ts +4 -0
  256. package/dist/react/hooks/useIsoLayoutEffect.d.ts.map +1 -0
  257. package/dist/react/hooks/useIsoLayoutEffect.js +5 -0
  258. package/dist/react/hooks/useIsoLayoutEffect.js.map +1 -0
  259. package/dist/react/hooks/useLatest.d.ts +17 -0
  260. package/dist/react/hooks/useLatest.d.ts.map +1 -0
  261. package/dist/react/hooks/useLatest.js +28 -0
  262. package/dist/react/hooks/useLatest.js.map +1 -0
  263. package/dist/react/hooks/useMountedCanvas.d.ts +10 -0
  264. package/dist/react/hooks/useMountedCanvas.d.ts.map +1 -0
  265. package/dist/react/hooks/useMountedCanvas.js +27 -0
  266. package/dist/react/hooks/useMountedCanvas.js.map +1 -0
  267. package/dist/react/hooks/usePageAspect.d.ts +22 -0
  268. package/dist/react/hooks/usePageAspect.d.ts.map +1 -0
  269. package/dist/react/hooks/usePageAspect.js +77 -0
  270. package/dist/react/hooks/usePageAspect.js.map +1 -0
  271. package/dist/react/hooks/usePrefersReducedMotion.d.ts +3 -0
  272. package/dist/react/hooks/usePrefersReducedMotion.d.ts.map +1 -0
  273. package/dist/react/hooks/usePrefersReducedMotion.js +17 -0
  274. package/dist/react/hooks/usePrefersReducedMotion.js.map +1 -0
  275. package/dist/react/hooks/useReadingPosition.d.ts +34 -0
  276. package/dist/react/hooks/useReadingPosition.d.ts.map +1 -0
  277. package/dist/react/hooks/useReadingPosition.js +179 -0
  278. package/dist/react/hooks/useReadingPosition.js.map +1 -0
  279. package/dist/react/icons.d.ts +8 -0
  280. package/dist/react/icons.d.ts.map +1 -0
  281. package/dist/react/icons.js +27 -0
  282. package/dist/react/icons.js.map +1 -0
  283. package/dist/react/index.d.ts +33 -0
  284. package/dist/react/index.d.ts.map +1 -0
  285. package/dist/react/index.js +19 -0
  286. package/dist/react/index.js.map +1 -0
  287. package/dist/react/locale.d.ts +7 -0
  288. package/dist/react/locale.d.ts.map +1 -0
  289. package/dist/react/locale.js +81 -0
  290. package/dist/react/locale.js.map +1 -0
  291. package/dist/react/outline.d.ts +10 -0
  292. package/dist/react/outline.d.ts.map +1 -0
  293. package/dist/react/outline.js +28 -0
  294. package/dist/react/outline.js.map +1 -0
  295. package/dist/react/pages.d.ts +5 -0
  296. package/dist/react/pages.d.ts.map +1 -0
  297. package/dist/react/pages.js +10 -0
  298. package/dist/react/pages.js.map +1 -0
  299. package/dist/react/styles.d.ts +12 -0
  300. package/dist/react/styles.d.ts.map +1 -0
  301. package/dist/react/styles.js +43 -0
  302. package/dist/react/styles.js.map +1 -0
  303. package/dist/react/theme.d.ts +5 -0
  304. package/dist/react/theme.d.ts.map +1 -0
  305. package/dist/react/theme.js +23 -0
  306. package/dist/react/theme.js.map +1 -0
  307. package/dist/styles.css +38 -0
  308. package/dist/types/index.d.ts +406 -0
  309. package/dist/types/index.d.ts.map +1 -0
  310. package/dist/types/index.js +2 -0
  311. package/dist/types/index.js.map +1 -0
  312. package/package.json +96 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Samith Mendis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,279 @@
1
- # Temporary Holding Version
1
+ # next-flipbook
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A realistic, responsive flipbook engine for React and Next.js.
4
+
5
+ Give it a PDF, images or React components and it gives you a book: a physical page-turn animation you can grab and drag, pinch and double-tap zoom, thumbnails, bookmarks, text search and a table of contents, single or two-page layout that follows the container size, keyboard navigation, accessible controls and right-to-left support. The engine has no React or Next.js dependency, and the React layer is a thin, SSR-safe shell around it.
6
+
7
+ > **Status: Phase 7 (0.7.0).** PDFs (PDF.js), images and custom React pages; drag, swipe and zoom; a toolbar with thumbnails, bookmarks, fullscreen, download, print and share; text search, the PDF's table of contents, clickable PDF links, hotspots, overlays, deep links and a saved reading place; bounded memory on very long PDFs, with benchmarks; linted, with end-to-end, accessibility and visual tests and CI. Not built yet: autoplay, hard pages, page curl, sound, plugins. The API only exposes what is implemented.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install next-flipbook
13
+ ```
14
+
15
+ Requires React 18 or newer. The package is ESM-only. `pdfjs-dist` is installed with it and is loaded only when a PDF is shown, in its own chunk, so image-only books never download it.
16
+
17
+ ## Quick start: a PDF
18
+
19
+ ```tsx
20
+ // app/magazine/page.tsx
21
+ import { FlipBook } from "next-flipbook";
22
+
23
+ export default function Magazine() {
24
+ return (
25
+ <FlipBook
26
+ source="/magazine.pdf"
27
+ pdf={{ workerSrc: "/pdf.worker.min.mjs" }}
28
+ cover
29
+ height="80vh"
30
+ />
31
+ );
32
+ }
33
+ ```
34
+
35
+ `source` can be a URL, `File`, `Blob`, `ArrayBuffer` or `Uint8Array`. Remote PDFs must be readable from the browser (CORS).
36
+
37
+ **About the worker.** PDF.js parses documents in a Web Worker and needs a URL for it. If you do not set `pdf.workerSrc`, the worker is fetched from the jsDelivr CDN at the installed pdfjs-dist version, which is convenient for a first try but is an external request and fails under a strict Content-Security-Policy or offline. For production, serve it yourself: see [docs/pdf.md](docs/pdf.md) for Next.js (Webpack and Turbopack), Vite and plain Webpack.
38
+
39
+ ## Quick start: images (Next.js App Router)
40
+
41
+ ```tsx
42
+ // app/magazine/page.tsx
43
+ import { FlipBook } from "next-flipbook";
44
+
45
+ export default function Magazine() {
46
+ return (
47
+ <FlipBook
48
+ pages={["/pages/1.jpg", "/pages/2.jpg", "/pages/3.jpg", "/pages/4.jpg"]}
49
+ cover
50
+ height="80vh"
51
+ />
52
+ );
53
+ }
54
+ ```
55
+
56
+ ```tsx
57
+ // app/layout.tsx: optional, adds hover and focus styles and the CSS variables
58
+ import "next-flipbook/styles.css";
59
+ ```
60
+
61
+ `FlipBook` is a client component boundary, so you can render it directly from a Server Component as long as the props you pass are serializable (strings, numbers, plain objects). If you pass functions such as `render`, `renderLoader` or `onPageChange`, put the page in a file marked `"use client"`.
62
+
63
+ The viewer draws nothing on the server. It measures its container in the browser first, so the server HTML is a small shell and there is no hydration mismatch or flash of the wrong layout.
64
+
65
+ ## Examples
66
+
67
+ ```tsx
68
+ // Two pages on wide containers, one on narrow ones (the default)
69
+ <FlipBook pages={pages} mode="auto" />
70
+
71
+ // Right-to-left publications
72
+ <FlipBook pages={pages} direction="rtl" cover />
73
+
74
+ // Mix images and React
75
+ <FlipBook
76
+ pages={[
77
+ { type: "image", src: "/cover.jpg", width: 1200, height: 1600 },
78
+ { type: "custom", component: <Welcome /> },
79
+ { type: "custom", render: () => <Chart data={data} /> },
80
+ ]}
81
+ />
82
+
83
+ // A password-protected PDF: built-in dialog, or bring your own
84
+ <FlipBook source={file} onPassword={(answer, reason) => askUser(reason).then(answer)} />
85
+
86
+ // A PDF page in the middle of a book of other things
87
+ <FlipBook
88
+ pages={[
89
+ { type: "image", src: "/cover.jpg" },
90
+ { type: "pdf", source: "/terms.pdf", page: 3 },
91
+ { type: "custom", component: <Welcome /> },
92
+ ]}
93
+ />
94
+
95
+ // Everything on: thumbnails, bookmarks that persist, fullscreen, download, print, share
96
+ <FlipBook
97
+ source="/catalog.pdf"
98
+ thumbnails
99
+ bookmarks={{ persist: true }}
100
+ download print share
101
+ />
102
+
103
+ // Search the text, show the PDF's own table of contents, keep the page in the address bar
104
+ // and remember where the reader stopped
105
+ <FlipBook source="/guide.pdf" search outline urlState persistState />
106
+
107
+ // Regions of a page that open a popover or link somewhere, and React drawn over a page
108
+ <FlipBook
109
+ pages={pages}
110
+ hotspots={[{ id: "map", page: 3, x: 0.1, y: 0.2, width: 0.4, height: 0.25, content: <p>Drawn in 1921.</p> }]}
111
+ overlays={{ 1: <button onClick={start}>Start reading</button> }}
112
+ />
113
+
114
+ // Drive it from outside
115
+ const ref = useRef<FlipBookController>(null);
116
+ <FlipBook ref={ref} pages={pages} />;
117
+ ref.current?.goToPage(10);
118
+ ref.current?.zoomIn(); // also: zoomOut, setZoom(2), fit, fitWidth, fitHeight, getZoom
119
+ ref.current?.search("train"); // also: nextSearchResult, previousSearchResult, clearSearch, getOutline
120
+ ref.current?.getCacheStats(); // what the viewer holds: cached pages, thumbnails, search index
121
+
122
+ // Build your own UI
123
+ <FlipBookProvider pages={pages}>
124
+ <MyToolbar /> {/* calls useFlipBook() */}
125
+ <FlipBookStage />
126
+ </FlipBookProvider>
127
+ ```
128
+
129
+ ## Props
130
+
131
+ | Prop | Default | Notes |
132
+ | --- | --- | --- |
133
+ | `source` | none | A PDF: URL, `File`, `Blob`, `ArrayBuffer` or `Uint8Array`. Pass `source` or `pages`, not both. Keep it referentially stable: a new value loads a new document. |
134
+ | `pages` | none | Strings (image URLs), `{ type: "image", src, alt?, width?, height? }`, `{ type: "custom", component? \| render? }` or `{ type: "pdf", source, page }`. |
135
+ | `pdf` | none | `workerSrc`, `renderScale`, `maxCanvasPixels`, `maxCacheBytes`, `maxTextCacheBytes`, `cleanupAfterPages`, `password`, `withCredentials`, `httpHeaders`, `maxConcurrentRenders`, `documentParams`, `loadPdfjs`. See [docs/pdf.md](docs/pdf.md). |
136
+ | `onPassword` | built-in dialog | `(answer, reason) => void`. Call `answer(password)` or `answer(null)` to give up. |
137
+ | `cacheSize` | `10` | Rendered PDF pages kept in memory. Pages that would not fit alongside the visible ones are not prefetched, so a large `preloadPages` with a small `cacheSize` cannot thrash. |
138
+ | `mode` | `"auto"` | `"single"`, `"double"` or `"auto"` (double from `breakpoint` px wide). |
139
+ | `breakpoint` | `640` | Container width, not window width. |
140
+ | `direction` | `"ltr"` | `"rtl"` mirrors the spine, turn direction and arrow keys. |
141
+ | `cover` | `false` | Page 1 alone as a front cover. With an even page count the last page is a back cover. |
142
+ | `initialPage` | `1` | 1-based. |
143
+ | `aspectRatio` | `"auto"` | `"auto"`, a number, or `"4/3"`. `auto` uses the first image page. |
144
+ | `width`, `height` | `"100%"`, `"80vh"` | Any CSS length. |
145
+ | `duration` | `700` | Base turn time in ms. |
146
+ | `whileTurning` | `"queue"` | `"ignore"` drops navigation that arrives mid-turn. |
147
+ | `shadow`, `shadowIntensity` | `true`, `0.5` | Dynamic shading during turns. |
148
+ | `reducedMotion` | `"auto"` | Follows `prefers-reduced-motion`; page changes become instant. |
149
+ | `theme` | none | `"light"` or `"dark"`. |
150
+ | `background` | CSS variable | Any CSS background, including `"transparent"`. |
151
+ | `toolbar`, `navigation`, `keyboard` | `true` | The bottom bar; its previous/next/counter; arrow keys, Home, End, `+` `-` `0` zoom, `F` fullscreen, `B` bookmark. |
152
+ | `fullscreen` | `true` | Button and `F`. Fills the window where the browser API is missing. |
153
+ | `thumbnails`, `defaultThumbnailsOpen` | `false` | Thumbnail panel: sidebar, or bottom sheet when narrow. |
154
+ | `bookmarks` | `false` | `true` or `{ value, defaultValue, onChange, persist, storage }`. The reader's own bookmarks, not a PDF's outline. |
155
+ | `download`, `print`, `share` | `false` | `true` or options: `{ filename, url }`, `{ scale }`, `{ url, title, text }`. See [docs/toolbar.md](docs/toolbar.md). |
156
+ | `onShare`, `onFullscreenChange` | none | Take over sharing; fullscreen entered or left. |
157
+ | `search`, `onSearch`, `onSearchResult` | `false` | Text search over the PDF pages: `/` key, panel, highlights. `true` or `{ minLength, maxResults }`. See [docs/search-and-links.md](docs/search-and-links.md). |
158
+ | `outline` | `false` | A Contents panel from the PDF's own bookmarks. Shown only if the PDF has some. |
159
+ | `links`, `onLinkClick` | `true` | Links inside PDF pages work: internal ones turn the book, web ones open in a new tab (`http`, `https`, `mailto`, `tel` only). `onLinkClick` can return `false` to stop one. |
160
+ | `hotspots` | none | `{ id, page, x, y, width, height, label?, content?, href?, onClick? }`. Coordinates are fractions of the page. |
161
+ | `overlays` | none | `{ [page]: ReactNode }` drawn over a page. |
162
+ | `urlState` | `false` | `true` or `{ param, hash, history }`. The address (`?page=5`) follows the page and opens the book there. |
163
+ | `persistState` | `false` | `true` (keyed by the PDF URL), a key, or `{ key, storage, zoom }`. Remembers the page and zoom between visits. |
164
+ | `renderToolbar` | none | Replace the bar. Receives `{ controls }`. |
165
+ | `dragToTurn` | `true` | Drag or swipe a page to turn it. Turns off text selection on pages while on. |
166
+ | `zoom` | `true` | Pinch, double-tap, wheel and key zoom, pan, and the controller's zoom methods. |
167
+ | `minZoom`, `maxZoom`, `zoomStep` | `1`, `4`, `0.25` | `1` is the fitted size. Set `minZoom={0.5}` to allow zooming out. |
168
+ | `doubleTapZoom` | `2` | Zoom a double-tap or double-click jumps to; `false` turns it off. |
169
+ | `wheelZoom` | `"ctrl"` | `"ctrl"`: Ctrl/Cmd + wheel and trackpad pinch. `true`: plain wheel. `false`: never. |
170
+ | `onZoomChange` | none | Fires once when a zoom settles, not on every pinch frame. |
171
+ | `preloadPages` | `2` | Pages either side of the visible ones to preload. |
172
+ | `padding` | `16` | Space around the book, in px. |
173
+ | `locale` | English | Partial map of every UI string. |
174
+ | `renderLoader`, `renderError`, `renderEmpty` | built-in | Custom states. `renderLoader` receives `{ progress }` (0..1) while a PDF downloads. |
175
+ | `onReady`, `onPageChange`, `onPageTurnStart`, `onPageTurnEnd`, `onError` | none | See `FlipBookProps`. |
176
+ | `onDocumentLoaded`, `onPageLoaded`, `onPageError` | none | PDF loaded (`{ numPages }`), a page finished rendering, one page failed (the rest keep working). |
177
+
178
+ Errors arrive as `{ code, message, cause?, page? }`. Codes: `INVALID_PDF`, `PDF_NOT_FOUND`, `NETWORK_ERROR` (offline or blocked by CORS), `PASSWORD_REQUIRED`, `PDF_WORKER_FAILED`, `PAGE_RENDER_FAILED`, `IMAGE_LOAD_FAILED`, `UNSUPPORTED_SOURCE`, `INVALID_ARGUMENT`.
179
+
180
+ Every value can be styled through CSS variables: `--flipbook-background`, `--flipbook-toolbar-background`, `--flipbook-toolbar-color`, `--flipbook-page-background`, `--flipbook-shadow`, `--flipbook-accent`.
181
+
182
+ ## How it stays fast
183
+
184
+ - **Bounded DOM.** At most four pages exist at any moment (the two visible ones, plus the turning leaf's two faces), however long the document is. Spreads are computed arithmetically, so a 5,000-page book costs the same as a 5-page one.
185
+ - **No React renders per frame.** A page turn renders twice (start and end). The frames in between write `transform` and `opacity` straight to the DOM.
186
+ - **Gestures without renders.** While a page is held or a pinch is running, the page angle, shading and zoom are written straight to the DOM. React renders when a gesture starts and ends, not on every pointer move.
187
+ - **Image warm-up.** Images around the current page are decoded ahead of time and de-duplicated.
188
+ - **PDF pages on demand.** Only the visible pages and a few neighbours are rendered, nearest first, two at a time. Work that falls out of range is dropped before it starts.
189
+ - **Bounded memory.** Rendered pages live in a cache that evicts the page farthest from the reader first, never the pages on screen. Canvas size is capped (`maxCanvasPixels`) and shrunk to zero on eviction so the browser can reclaim it.
190
+ - **Right-sized renders.** Resolution follows the on-screen size and the device pixel ratio, in quarter steps so small resizes reuse the cache. A lower-resolution render is shown while the sharp one is drawn.
191
+ - **Clean shutdown.** Unmounting cancels animation frames, aborts image loads, cancels PDF renders and terminates the PDF.js worker.
192
+
193
+ ## Gestures
194
+
195
+ | Gesture | Fitted size | Zoomed in |
196
+ | --- | --- | --- |
197
+ | One finger or mouse, horizontal drag | Turns a page; the page follows the pointer | Pans |
198
+ | Release | Finishes the turn past halfway or on a fast flick, otherwise springs back | |
199
+ | Vertical drag (touch) | Scrolls the page as normal | Pans |
200
+ | Two fingers | Pinch to zoom | Pinch and pan |
201
+ | Double-tap / double-click | Zooms to `doubleTapZoom` | Back to fitted |
202
+ | Ctrl/Cmd + wheel, trackpad pinch | Zooms about the pointer | Same |
203
+ | A second finger during a turn | Cancels the turn and starts a pinch | |
204
+
205
+ A drag never starts on a link, button or form field inside a page, and the click that ends a drag is swallowed. Panning or pinching can never turn a page. Full details in [docs/interaction.md](docs/interaction.md). The toolbar, thumbnails, bookmarks and actions are covered in [docs/toolbar.md](docs/toolbar.md); search, contents, links, hotspots, deep links and saved place in [docs/search-and-links.md](docs/search-and-links.md).
206
+
207
+ ## Accessibility
208
+
209
+ The viewer is a labelled region that takes keyboard focus. Arrow keys, Home and End navigate (arrows swap in RTL), `+` `-` `0` zoom. Dragging is an extra way to turn pages, never the only one. Buttons have text labels and stay focusable at the ends of the book (`aria-disabled`). A polite live region announces the visible pages. The turning leaf is `aria-hidden`. `prefers-reduced-motion` turns page turns into instant changes.
210
+
211
+ ## Browser support
212
+
213
+ Current Chrome, Edge, Firefox, Safari, iOS Safari and Chrome for Android. The page turn uses CSS 3D transforms, `ResizeObserver` and `requestAnimationFrame`.
214
+
215
+ ## Packages and subpath imports
216
+
217
+ | Import | Contents |
218
+ | --- | --- |
219
+ | `next-flipbook` | React components, hooks and types |
220
+ | `next-flipbook/react` | Same React layer |
221
+ | `next-flipbook/core` | Framework-free engine, layout maths and animation helpers |
222
+ | `next-flipbook/image` | The image loader |
223
+ | `next-flipbook/pdf` | PDF session and manager, page cache, worker helpers (advanced) |
224
+ | `next-flipbook/actions` | Fullscreen controller, download, print and share helpers |
225
+ | `next-flipbook/styles.css` | Optional stylesheet |
226
+
227
+ `FlipBookControls` (component) and `FlipBookPageView` (component) are named so they do not collide with the `FlipBookController` and `FlipBookPage` types.
228
+
229
+ ## Long PDFs and memory
230
+
231
+ Only the pages near the reader are drawn and kept: the visible spread, `preloadPages` either side, at most `cacheSize` rendered pages and `pdf.maxCacheBytes` of canvas, whatever the length of the document. Prefetching stops when the reader jumps away, thumbnails draw only when they stay in view, the search index has a byte budget, and PDF.js's own per-page memory is released when the reader is idle. `getCacheStats()` reports what is held. The numbers for 100, 500 and 1000 page documents, and the limits of those measurements, are in [docs/performance.md](docs/performance.md).
232
+
233
+ ## Roadmap
234
+
235
+ | Phase | Scope | State |
236
+ | --- | --- | --- |
237
+ | 1 | Monorepo, engine, image and custom pages, page turn, single/double, responsive, RTL, keyboard | **Done** |
238
+ | 2 | PDF.js loading, worker, page rendering, page cache, passwords | **Done** |
239
+ | 3 | Mouse and touch drag, velocity, spring-back, zoom, pinch, double-tap | **Done** |
240
+ | 4 | Toolbar, thumbnails, fullscreen, download, print, share, **bookmarks** | **Done** |
241
+ | 5 | Search, outline (the PDF's own bookmarks), PDF links, hotspots, overlays, deep linking, saved place | **Done** |
242
+ | 6 | Prefetch tuning, memory bounds and cleanup, benchmarks on 100 to 1000 page PDFs, cache statistics | **Done** |
243
+ | 7 | ESLint, Playwright end-to-end, accessibility and visual tests, a playground, CI, release workflow | **Done**, except a docs site and the first npm publish |
244
+
245
+ Not yet in the API, on purpose: `hardPages`, `pageCurl`, `autoplay`, `sound`, plugins, annotations, OCR and a selectable text layer.
246
+
247
+ ## Development
248
+
249
+ ```bash
250
+ npm install
251
+ npm run build # build the package
252
+ npm test # unit, DOM and real PDF.js tests
253
+ npm run lint
254
+ npm run typecheck:all
255
+ npm run dev # build, then start the Next.js demo (the /playground page is there)
256
+ npm run build:demo && npm run e2e # Playwright against the built demo
257
+ npm run verify:pack # install the packed tarball into an empty project and use it
258
+ ```
259
+
260
+ What is tested, how, and what none of it proves: [docs/testing.md](docs/testing.md).
261
+
262
+ Benchmarks (not part of `npm test`; see [benchmarks/README.md](benchmarks/README.md)):
263
+
264
+ ```bash
265
+ node --expose-gc benchmarks/pipeline.mjs # the PDF pipeline in Node, 10 to 1000 pages
266
+ node benchmarks/browser.mjs # a real Chromium on the demo's /large-pdf route
267
+ ```
268
+
269
+ What was measured, on what, and what it does not show: [docs/performance.md](docs/performance.md).
270
+
271
+ Layout: `packages/flipbook` is the library, `demo/next-app` is the App Router demo, `benchmarks` holds the benchmarks, `docs` holds design notes. See [docs/architecture.md](docs/architecture.md).
272
+
273
+ ## Author
274
+
275
+ Samith Mendis ([@dsamithmendis](https://github.com/dsamithmendis)) · samithmendis.01@gmail.com
276
+
277
+ ## License
278
+
279
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,18 @@
1
+ import type { PdfSource } from "../pdf/types.js";
2
+ /** Releases every object URL still waiting to be revoked. Call it when the viewer unmounts. */
3
+ export declare function revokePendingDownloads(): void;
4
+ /** A sensible file name for a source: the explicit one, the File's own, the URL's, or `document.pdf`. */
5
+ export declare function filenameFor(source: PdfSource, explicit?: string): string;
6
+ /**
7
+ * Hands a PDF to the browser as a download.
8
+ *
9
+ * A same-origin URL downloads directly. A cross-origin URL cannot be forced
10
+ * to download (browsers ignore the attribute), so it opens in a new tab
11
+ * rather than navigating away from the viewer. A Blob, File, ArrayBuffer or
12
+ * Uint8Array is saved from memory through an object URL that is revoked
13
+ * afterwards.
14
+ */
15
+ export declare function downloadSource(source: PdfSource, options?: {
16
+ filename?: string;
17
+ }): Promise<void>;
18
+ //# sourceMappingURL=download.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/actions/download.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAMjD,+FAA+F;AAC/F,wBAAgB,sBAAsB,IAAI,IAAI,CAM7C;AAED,yGAAyG;AACzG,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAaxE;AASD;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAoC1G"}
@@ -0,0 +1,82 @@
1
+ import { FlipBookRuntimeError } from "../core/errors.js";
2
+ /** Object URLs stay alive briefly after the click: some browsers read them asynchronously. */
3
+ const REVOKE_AFTER_MS = 30000;
4
+ const pending = new Map();
5
+ /** Releases every object URL still waiting to be revoked. Call it when the viewer unmounts. */
6
+ export function revokePendingDownloads() {
7
+ for (const [url, timer] of pending) {
8
+ clearTimeout(timer);
9
+ URL.revokeObjectURL(url);
10
+ }
11
+ pending.clear();
12
+ }
13
+ /** A sensible file name for a source: the explicit one, the File's own, the URL's, or `document.pdf`. */
14
+ export function filenameFor(source, explicit) {
15
+ if (explicit)
16
+ return explicit;
17
+ if (typeof File !== "undefined" && source instanceof File && source.name)
18
+ return source.name;
19
+ if (typeof source === "string" || source instanceof URL) {
20
+ try {
21
+ const base = typeof document === "undefined" ? "http://localhost/" : document.baseURI;
22
+ const last = new URL(String(source), base).pathname.split("/").filter(Boolean).pop();
23
+ if (last && /\.pdf$/i.test(last))
24
+ return decodeURIComponent(last);
25
+ }
26
+ catch {
27
+ // Fall through to the default.
28
+ }
29
+ }
30
+ return "document.pdf";
31
+ }
32
+ function click(anchor) {
33
+ anchor.style.display = "none";
34
+ document.body.appendChild(anchor);
35
+ anchor.click();
36
+ anchor.remove();
37
+ }
38
+ /**
39
+ * Hands a PDF to the browser as a download.
40
+ *
41
+ * A same-origin URL downloads directly. A cross-origin URL cannot be forced
42
+ * to download (browsers ignore the attribute), so it opens in a new tab
43
+ * rather than navigating away from the viewer. A Blob, File, ArrayBuffer or
44
+ * Uint8Array is saved from memory through an object URL that is revoked
45
+ * afterwards.
46
+ */
47
+ export async function downloadSource(source, options = {}) {
48
+ if (typeof document === "undefined") {
49
+ throw new FlipBookRuntimeError("UNSUPPORTED_ENVIRONMENT", "Downloads only work in a browser.");
50
+ }
51
+ const filename = filenameFor(source, options.filename);
52
+ const anchor = document.createElement("a");
53
+ anchor.rel = "noopener";
54
+ if (typeof source === "string" || source instanceof URL) {
55
+ const url = new URL(String(source), document.baseURI);
56
+ anchor.href = url.href;
57
+ if (url.origin === location.origin)
58
+ anchor.download = filename;
59
+ else
60
+ anchor.target = "_blank";
61
+ click(anchor);
62
+ return;
63
+ }
64
+ let blob;
65
+ if (typeof Blob !== "undefined" && source instanceof Blob)
66
+ blob = source;
67
+ else if (ArrayBuffer.isView(source) || Object.prototype.toString.call(source) === "[object ArrayBuffer]") {
68
+ blob = new Blob([source], { type: "application/pdf" });
69
+ }
70
+ else {
71
+ throw new FlipBookRuntimeError("DOWNLOAD_FAILED", "This source cannot be downloaded.");
72
+ }
73
+ const url = URL.createObjectURL(blob);
74
+ anchor.href = url;
75
+ anchor.download = filename;
76
+ click(anchor);
77
+ pending.set(url, setTimeout(() => {
78
+ URL.revokeObjectURL(url);
79
+ pending.delete(url);
80
+ }, REVOKE_AFTER_MS));
81
+ }
82
+ //# sourceMappingURL=download.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download.js","sourceRoot":"","sources":["../../src/actions/download.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGzD,8FAA8F;AAC9F,MAAM,eAAe,GAAG,KAAM,CAAC;AAC/B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAyC,CAAC;AAEjE,+FAA+F;AAC/F,MAAM,UAAU,sBAAsB;IACpC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE,CAAC;QACnC,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,WAAW,CAAC,MAAiB,EAAE,QAAiB;IAC9D,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9B,IAAI,OAAO,IAAI,KAAK,WAAW,IAAI,MAAM,YAAY,IAAI,IAAI,MAAM,CAAC,IAAI;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC;IAC7F,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,YAAY,GAAG,EAAE,CAAC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 -0,0 +1,44 @@
1
+ import type { FullscreenMode } from "../core/ui/UiStore.js";
2
+ export interface FullscreenOptions {
3
+ onChange?: (mode: FullscreenMode) => void;
4
+ /**
5
+ * When the Fullscreen API is missing or refused (iPhone Safari, an iframe
6
+ * without `allow="fullscreen"`), fill the browser window instead. Default true.
7
+ */
8
+ fallback?: boolean;
9
+ }
10
+ /**
11
+ * Fullscreen for one element. Uses the browser's Fullscreen API when it can
12
+ * and otherwise stretches the element over the viewport, so the button still
13
+ * does something useful everywhere. No browser global is read until a method
14
+ * is called or an element is attached.
15
+ */
16
+ export declare class FullscreenController {
17
+ private element;
18
+ private mode;
19
+ private readonly onChange;
20
+ private readonly fallback;
21
+ private savedOverflow;
22
+ private listening;
23
+ constructor(options?: FullscreenOptions);
24
+ private readonly onDocumentChange;
25
+ /** The element to make fullscreen. Pass null to detach. */
26
+ attach(element: HTMLElement | null): void;
27
+ getMode(): FullscreenMode;
28
+ isFullscreen(): boolean;
29
+ /** Whether the browser's own Fullscreen API can be used for the attached element. */
30
+ isNativeAvailable(): boolean;
31
+ enter(): Promise<void>;
32
+ exit(): Promise<void>;
33
+ toggle(): Promise<void>;
34
+ /** Leaves fullscreen and removes listeners. */
35
+ destroy(): void;
36
+ private doc;
37
+ private startListening;
38
+ private stopListening;
39
+ private setMode;
40
+ /** The fixed fallback covers the page, so the page behind it must not scroll. */
41
+ private lockScroll;
42
+ private unlockScroll;
43
+ }
44
+ //# sourceMappingURL=fullscreen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fullscreen.d.ts","sourceRoot":"","sources":["../../src/actions/fullscreen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAiB5D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,OAAO,CAAkD;IACjE,OAAO,CAAC,IAAI,CAA0B;IACtC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+C;IACxE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,SAAS,CAAS;gBAEd,OAAO,GAAE,iBAAsB;IAK3C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAK/B;IAEF,2DAA2D;IAC3D,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI;IAQzC,OAAO,IAAI,cAAc;IAIzB,YAAY,IAAI,OAAO;IAIvB,qFAAqF;IACrF,iBAAiB,IAAI,OAAO;IAQtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBrB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAK7B,+CAA+C;IAC/C,OAAO,IAAI,IAAI;IAUf,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,OAAO;IAOf,iFAAiF;IACjF,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,YAAY;CAMrB"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Fullscreen for one element. Uses the browser's Fullscreen API when it can
3
+ * and otherwise stretches the element over the viewport, so the button still
4
+ * does something useful everywhere. No browser global is read until a method
5
+ * is called or an element is attached.
6
+ */
7
+ export class FullscreenController {
8
+ constructor(options = {}) {
9
+ this.element = null;
10
+ this.mode = "none";
11
+ this.savedOverflow = null;
12
+ this.listening = false;
13
+ this.onDocumentChange = () => {
14
+ const doc = this.doc();
15
+ const active = doc?.fullscreenElement ?? doc?.webkitFullscreenElement ?? null;
16
+ if (this.element !== null && active === this.element)
17
+ this.setMode("native");
18
+ else if (this.mode === "native")
19
+ this.setMode("none");
20
+ };
21
+ this.onChange = options.onChange;
22
+ this.fallback = options.fallback ?? true;
23
+ }
24
+ /** The element to make fullscreen. Pass null to detach. */
25
+ attach(element) {
26
+ if (this.element === element)
27
+ return;
28
+ this.stopListening();
29
+ if (this.mode !== "none")
30
+ this.setMode("none");
31
+ this.element = element;
32
+ if (element)
33
+ this.startListening();
34
+ }
35
+ getMode() {
36
+ return this.mode;
37
+ }
38
+ isFullscreen() {
39
+ return this.mode !== "none";
40
+ }
41
+ /** Whether the browser's own Fullscreen API can be used for the attached element. */
42
+ isNativeAvailable() {
43
+ const doc = this.doc();
44
+ const element = this.element;
45
+ if (!doc || !element)
46
+ return false;
47
+ const enabled = doc.fullscreenEnabled ?? doc.webkitFullscreenEnabled ?? false;
48
+ return enabled && (element.requestFullscreen !== undefined || element.webkitRequestFullscreen !== undefined);
49
+ }
50
+ async enter() {
51
+ const element = this.element;
52
+ if (!element || this.mode !== "none")
53
+ return;
54
+ if (this.isNativeAvailable()) {
55
+ try {
56
+ if (element.requestFullscreen)
57
+ await element.requestFullscreen();
58
+ else
59
+ await element.webkitRequestFullscreen?.();
60
+ this.onDocumentChange();
61
+ if (this.mode !== "none")
62
+ return;
63
+ }
64
+ catch {
65
+ // Refused (not allowed here, or the user said no): use the fallback if there is one.
66
+ }
67
+ }
68
+ if (this.fallback) {
69
+ this.lockScroll();
70
+ this.setMode("fixed");
71
+ }
72
+ }
73
+ async exit() {
74
+ if (this.mode === "none")
75
+ return;
76
+ if (this.mode === "fixed") {
77
+ this.setMode("none");
78
+ return;
79
+ }
80
+ const doc = this.doc();
81
+ try {
82
+ if (doc?.exitFullscreen)
83
+ await doc.exitFullscreen();
84
+ else
85
+ await doc?.webkitExitFullscreen?.();
86
+ }
87
+ catch {
88
+ // Already out.
89
+ }
90
+ this.onDocumentChange();
91
+ if (this.mode === "native")
92
+ this.setMode("none");
93
+ }
94
+ async toggle() {
95
+ if (this.mode === "none")
96
+ await this.enter();
97
+ else
98
+ await this.exit();
99
+ }
100
+ /** Leaves fullscreen and removes listeners. */
101
+ destroy() {
102
+ this.stopListening();
103
+ if (this.mode === "native")
104
+ void this.exit();
105
+ this.unlockScroll();
106
+ this.mode = "none";
107
+ this.element = null;
108
+ }
109
+ // ---- internals -----------------------------------------------------------
110
+ doc() {
111
+ return typeof document === "undefined" ? null : document;
112
+ }
113
+ startListening() {
114
+ const doc = this.doc();
115
+ if (!doc || this.listening)
116
+ return;
117
+ doc.addEventListener("fullscreenchange", this.onDocumentChange);
118
+ doc.addEventListener("webkitfullscreenchange", this.onDocumentChange);
119
+ this.listening = true;
120
+ }
121
+ stopListening() {
122
+ const doc = this.doc();
123
+ if (!doc || !this.listening)
124
+ return;
125
+ doc.removeEventListener("fullscreenchange", this.onDocumentChange);
126
+ doc.removeEventListener("webkitfullscreenchange", this.onDocumentChange);
127
+ this.listening = false;
128
+ }
129
+ setMode(mode) {
130
+ if (mode === this.mode)
131
+ return;
132
+ this.mode = mode;
133
+ if (mode !== "fixed")
134
+ this.unlockScroll();
135
+ this.onChange?.(mode);
136
+ }
137
+ /** The fixed fallback covers the page, so the page behind it must not scroll. */
138
+ lockScroll() {
139
+ const body = this.doc()?.body;
140
+ if (!body || this.savedOverflow !== null)
141
+ return;
142
+ this.savedOverflow = body.style.overflow;
143
+ body.style.overflow = "hidden";
144
+ }
145
+ unlockScroll() {
146
+ const body = this.doc()?.body;
147
+ if (!body || this.savedOverflow === null)
148
+ return;
149
+ body.style.overflow = this.savedOverflow;
150
+ this.savedOverflow = null;
151
+ }
152
+ }
153
+ //# sourceMappingURL=fullscreen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fullscreen.js","sourceRoot":"","sources":["../../src/actions/fullscreen.ts"],"names":[],"mappings":"AA0BA;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IAQ/B,YAAY,UAA6B,EAAE;QAPnC,YAAO,GAA6C,IAAI,CAAC;QACzD,SAAI,GAAmB,MAAM,CAAC;QAG9B,kB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 export type { FullscreenOptions } from "./fullscreen.js";
4
+ export { buildPrintHtml, canvasToPrintable, createIframeFrame, printPages } from "./print.js";
5
+ export type { PrintablePage, PrintFrame, PrintSource } from "./print.js";
6
+ export { shareLink } from "./share.js";
7
+ export type { ShareData, ShareResult } from "./share.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC9F,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { downloadSource, filenameFor, revokePendingDownloads } from "./download.js";
2
+ export { FullscreenController } from "./fullscreen.js";
3
+ export { buildPrintHtml, canvasToPrintable, createIframeFrame, printPages } from "./print.js";
4
+ export { shareLink } from "./share.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE9F,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC"}