html-flip-book-react 0.0.0-alpha.51 → 0.0.0-alpha.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FlipBook.d.ts +4 -1
- package/dist/FlipBook.d.ts.map +1 -1
- package/dist/commands/CommandContext.d.ts +2 -1
- package/dist/commands/CommandContext.d.ts.map +1 -1
- package/dist/commands/index.d.ts +2 -2
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/download/types.d.ts +1 -0
- package/dist/download/types.d.ts.map +1 -1
- package/dist/flip-book.js +33 -31
- package/dist/flip-book.js.map +1 -1
- package/dist/toolbar/FullscreenButton.d.ts +1 -0
- package/dist/toolbar/FullscreenButton.d.ts.map +1 -1
- package/dist/toolbar/MouseModeButton.d.ts.map +1 -1
- package/dist/toolbar/ToggleButton.d.ts +11 -0
- package/dist/toolbar/ToggleButton.d.ts.map +1 -0
- package/dist/toolbar/Toolbar.d.ts.map +1 -1
- package/dist/toolbar/index.d.ts +5 -2
- package/dist/toolbar/index.d.ts.map +1 -1
- package/dist/toolbar/index.js +782 -551
- package/dist/toolbar/index.js.map +1 -1
- package/package.json +2 -2
package/dist/FlipBook.d.ts
CHANGED
|
@@ -18,7 +18,9 @@ export interface FlipBookHandle {
|
|
|
18
18
|
getDownloadConfig: () => DownloadConfig | undefined;
|
|
19
19
|
getTocPageIndex: () => number;
|
|
20
20
|
getMouseMode: () => MouseMode;
|
|
21
|
-
setMouseMode: (mode: MouseMode
|
|
21
|
+
setMouseMode: (mode: MouseMode, options?: {
|
|
22
|
+
persist?: boolean;
|
|
23
|
+
}) => void;
|
|
22
24
|
}
|
|
23
25
|
export interface CoverConfig {
|
|
24
26
|
hardCovers?: boolean;
|
|
@@ -68,6 +70,7 @@ export interface FlipBookProps {
|
|
|
68
70
|
declare const FlipBookReact: React.ForwardRefExoticComponent<FlipBookProps & React.RefAttributes<FlipBookHandle>>;
|
|
69
71
|
export { FlipBookReact as FlipBook };
|
|
70
72
|
export type { Bookmark, BookmarkContext, BookmarkPlacement, FlipPageSemantic, HistoryMapper, MouseMode, PageFlipParams, PageSemantics, } from "html-flip-book-vanilla";
|
|
73
|
+
export { createDefaultHistoryMapper } from "html-flip-book-vanilla";
|
|
71
74
|
export type { TocEntry, TocPageProps } from "./TocPage";
|
|
72
75
|
export { TocPage } from "./TocPage";
|
|
73
76
|
//# sourceMappingURL=FlipBook.d.ts.map
|
package/dist/FlipBook.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlipBook.d.ts","sourceRoot":"","sources":["../src/FlipBook.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gBAAgB,IAAI,oBAAoB,EAG7C,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAoBrE,MAAM,WAAW,cAAc;IAE9B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjD,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAExC,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAE5B,mBAAmB,EAAE,MAAM,MAAM,CAAC;IAElC,aAAa,EAAE,MAAM,MAAM,CAAC;IAE5B,KAAK,EAAE,MAA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,EAAE,CAAC;IAE/B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAM5B,YAAY,CAAC,EAAE,MAAM,CAAC;IAItB,WAAW,CAAC,EAAE,WAAW,CAAC;IAK1B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAKrB,eAAe,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAMpD,gBAAgB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAIrD,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAM5B,aAAa,CAAC,EAAE,aAAa,CAAC;IAK9B,YAAY,CAAC,EAAE,MAAM,CAAC;IAMtB,cAAc,CAAC,EAAE,cAAc,CAAC;IAKhC,UAAU,CAAC,EAAE,OAAO,CAAC;IAOrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAK7B,aAAa,CAAC,EAAE,OAAO,CAAC;IAMxB,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAsBD,QAAA,MAAM,aAAa,sFAuXlB,CAAC;AAIF,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,CAAC;AACrC,YAAY,EACX,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,cAAc,EACd,aAAa,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CommandDefinition, type CommandOptions } from "html-flip-book-vanilla/commands";
|
|
1
|
+
import { type CommandDefinition, type CommandOptions, type ToggleCommandDefinition } from "html-flip-book-vanilla/commands";
|
|
2
2
|
import type React from "react";
|
|
3
3
|
import type { FlipBookHandle } from "../FlipBook";
|
|
4
4
|
interface CommandProviderProps {
|
|
@@ -14,6 +14,7 @@ interface CommandProviderProps {
|
|
|
14
14
|
interface CommandsContextValue {
|
|
15
15
|
execute: (command: CommandDefinition, runData?: Record<string, unknown>) => void;
|
|
16
16
|
canExecute: (command: CommandDefinition) => boolean;
|
|
17
|
+
isActive: (command: ToggleCommandDefinition) => boolean;
|
|
17
18
|
getAllCommands: () => CommandDefinition[];
|
|
18
19
|
}
|
|
19
20
|
export declare const CommandProvider: React.FC<CommandProviderProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandContext.d.ts","sourceRoot":"","sources":["../../src/commands/CommandContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,iBAAiB,EACtB,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"CommandContext.d.ts","sourceRoot":"","sources":["../../src/commands/CommandContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAMnB,KAAK,uBAAuB,EAC5B,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,UAAU,oBAAoB;IAE7B,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAEpD,WAAW,EAAE,MAAM,CAAC;IAEpB,UAAU,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAE1B,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAE/B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAEhD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAED,UAAU,oBAAoB;IAE7B,OAAO,EAAE,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAEjF,UAAU,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC;IAEpD,QAAQ,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,OAAO,CAAC;IAExD,cAAc,EAAE,MAAM,iBAAiB,EAAE,CAAC;CAC1C;AAgDD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsI1D,CAAC;AAEF,eAAO,MAAM,WAAW,QAAO,oBAM9B,CAAC"}
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { Command, CommandContext, CommandData, CommandDefinition, CommandOptions, CommandRegistry, FlipNavCommand, HotkeyBinding, JumpNavCommand, NavCommand, } from "html-flip-book-vanilla/commands";
|
|
2
|
-
export { defaultCommands, downloadCommand, flipNextCommand, flipPrevCommand, goToFirstCommand, goToLastCommand, goToTocCommand, toggleDebugCommand, toggleFullscreenCommand, } from "html-flip-book-vanilla/commands";
|
|
1
|
+
export type { ActionCommandDefinition, Command, CommandContext, CommandData, CommandDefinition, CommandOptions, CommandRegistry, FlipNavCommand, HotkeyBinding, JumpNavCommand, NavCommand, ToggleCommandDefinition, } from "html-flip-book-vanilla/commands";
|
|
2
|
+
export { canUseFullscreen, defaultCommands, downloadCommand, exitFullscreen, flipNextCommand, flipPrevCommand, fullscreenStateEvents, getFullscreenElement, goToFirstCommand, goToLastCommand, goToTocCommand, requestFullscreen, toggleDebugCommand, toggleFullscreenCommand, toggleTextSelectionCommand, } from "html-flip-book-vanilla/commands";
|
|
3
3
|
export { CommandProvider, useCommands } from "./CommandContext";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAIA,YAAY,EACX,OAAO,EACP,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,cAAc,EACd,aAAa,EACb,cAAc,EACd,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAIA,YAAY,EACX,uBAAuB,EACvB,OAAO,EACP,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,cAAc,EACd,aAAa,EACb,cAAc,EACd,UAAU,EACV,uBAAuB,GACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,EACd,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,GAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/download/types.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export type { DownloadConfig, DownloadResult, PageRangesDownloadContext, PageRangesDownloadHandler, SeferDownloadHandler, SemanticPageInfo, } from "html-flip-book-vanilla/download";
|
|
2
|
+
export { createDefaultDownloadConfig } from "html-flip-book-vanilla/download";
|
|
2
3
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/download/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/download/types.ts"],"names":[],"mappings":"AAEA,YAAY,EACX,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dist/flip-book.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as c, jsxs as O, Fragment as ae } from "react/jsx-runtime";
|
|
2
2
|
import { FlipBook as ce } from "html-flip-book-vanilla";
|
|
3
|
+
import { createDefaultHistoryMapper as Ce } from "html-flip-book-vanilla";
|
|
3
4
|
import { forwardRef as le, useState as W, useRef as F, useEffect as S, useImperativeHandle as ie, Children as ue } from "react";
|
|
4
5
|
import { createPortal as de } from "react-dom";
|
|
5
|
-
const pe = (
|
|
6
|
-
onNavigate:
|
|
6
|
+
const pe = (x) => x.title.length > 0, Ie = ({
|
|
7
|
+
onNavigate: x,
|
|
7
8
|
totalPages: d,
|
|
8
9
|
pageSemantics: T,
|
|
9
10
|
heading: B = "Table of Contents",
|
|
@@ -13,16 +14,16 @@ const pe = (k) => k.title.length > 0, Ie = ({
|
|
|
13
14
|
getHref: g,
|
|
14
15
|
renderEntry: f
|
|
15
16
|
}) => {
|
|
16
|
-
const
|
|
17
|
+
const k = [];
|
|
17
18
|
for (let n = 0; n < d; n++) {
|
|
18
19
|
const u = T?.indexToTitle(n) ?? "", m = T?.indexToSemanticName(n) ?? "", N = { pageIndex: n, title: u, semanticName: m };
|
|
19
|
-
$(N, n) &&
|
|
20
|
+
$(N, n) && k.push(N);
|
|
20
21
|
}
|
|
21
|
-
const
|
|
22
|
-
const N = n.title || n.semanticName || `Page ${n.pageIndex + 1}`,
|
|
22
|
+
const D = (n, u, m) => {
|
|
23
|
+
const N = n.title || n.semanticName || `Page ${n.pageIndex + 1}`, L = n.semanticName || String(n.pageIndex + 1), a = /* @__PURE__ */ O(ae, { children: [
|
|
23
24
|
/* @__PURE__ */ c("span", { className: "toc-title", children: N }),
|
|
24
25
|
/* @__PURE__ */ c("span", { className: "toc-dots", "aria-hidden": !0 }),
|
|
25
|
-
/* @__PURE__ */ c("span", { className: "toc-page-num", children:
|
|
26
|
+
/* @__PURE__ */ c("span", { className: "toc-page-num", children: L })
|
|
26
27
|
] });
|
|
27
28
|
return /* @__PURE__ */ c("li", { children: m ? /* @__PURE__ */ c(
|
|
28
29
|
"a",
|
|
@@ -43,16 +44,16 @@ const pe = (k) => k.title.length > 0, Ie = ({
|
|
|
43
44
|
style: { direction: p, textAlign: p === "rtl" ? "right" : "left" },
|
|
44
45
|
children: /* @__PURE__ */ O("div", { className: "toc-page__scroll", children: [
|
|
45
46
|
/* @__PURE__ */ c("h2", { className: "toc-heading", children: B }),
|
|
46
|
-
/* @__PURE__ */ c("ul", { className: "toc-list", children:
|
|
47
|
-
const u = () =>
|
|
48
|
-
return f ? f(n, u, m) :
|
|
47
|
+
/* @__PURE__ */ c("ul", { className: "toc-list", children: k.map((n) => {
|
|
48
|
+
const u = () => x(n.pageIndex), m = g?.(n) ?? void 0;
|
|
49
|
+
return f ? f(n, u, m) : D(n, u, m);
|
|
49
50
|
}) })
|
|
50
51
|
] })
|
|
51
52
|
}
|
|
52
53
|
);
|
|
53
54
|
}, ge = le(
|
|
54
55
|
({
|
|
55
|
-
pages:
|
|
56
|
+
pages: x,
|
|
56
57
|
className: d,
|
|
57
58
|
debug: T = !1,
|
|
58
59
|
direction: B = "ltr",
|
|
@@ -61,13 +62,13 @@ const pe = (k) => k.title.length > 0, Ie = ({
|
|
|
61
62
|
pageSemantics: $ = void 0,
|
|
62
63
|
bookmarkProvider: g,
|
|
63
64
|
enableBookmarks: f = !1,
|
|
64
|
-
initialTurnedLeaves:
|
|
65
|
-
fastDeltaThreshold:
|
|
65
|
+
initialTurnedLeaves: k = [],
|
|
66
|
+
fastDeltaThreshold: D,
|
|
66
67
|
leavesBuffer: n,
|
|
67
68
|
pageShadow: u = !0,
|
|
68
69
|
snapshotDuringFlip: m = !0,
|
|
69
70
|
enableHistory: N,
|
|
70
|
-
enableDownload:
|
|
71
|
+
enableDownload: L,
|
|
71
72
|
coverConfig: a,
|
|
72
73
|
of: h,
|
|
73
74
|
leafAspectRatio: z,
|
|
@@ -78,19 +79,19 @@ const pe = (k) => k.title.length > 0, Ie = ({
|
|
|
78
79
|
downloadConfig: Q
|
|
79
80
|
}, X) => {
|
|
80
81
|
const [Y, _] = W(() => {
|
|
81
|
-
if (
|
|
82
|
-
const t = Math.max(...
|
|
83
|
-
return t >=
|
|
82
|
+
if (k && k.length > 0) {
|
|
83
|
+
const t = Math.max(...k) * 2 + 1;
|
|
84
|
+
return t >= x.length ? (Math.ceil(x.length / 2) - 1) * 2 : t;
|
|
84
85
|
}
|
|
85
86
|
return 0;
|
|
86
|
-
}), w = F(_), [Z,
|
|
87
|
+
}), w = F(_), [Z, H] = W([]);
|
|
87
88
|
w.current = _;
|
|
88
89
|
const j = F(h);
|
|
89
90
|
j.current = h;
|
|
90
|
-
const ee = 80, v = F(null),
|
|
91
|
+
const ee = 80, v = F(null), U = F((e) => {
|
|
91
92
|
w.current?.(e);
|
|
92
93
|
});
|
|
93
|
-
|
|
94
|
+
U.current = (e) => {
|
|
94
95
|
if (v.current != null && clearTimeout(v.current), n == null) {
|
|
95
96
|
w.current?.(e);
|
|
96
97
|
return;
|
|
@@ -105,16 +106,16 @@ const pe = (k) => k.title.length > 0, Ie = ({
|
|
|
105
106
|
new ce({
|
|
106
107
|
pageSemantics: $,
|
|
107
108
|
enableBookmarks: f,
|
|
108
|
-
pagesCount:
|
|
109
|
+
pagesCount: x.length,
|
|
109
110
|
direction: B,
|
|
110
111
|
mouseMode: y,
|
|
111
|
-
initialTurnedLeaves:
|
|
112
|
-
fastDeltaThreshold:
|
|
112
|
+
initialTurnedLeaves: k,
|
|
113
|
+
fastDeltaThreshold: D,
|
|
113
114
|
leavesBuffer: n,
|
|
114
115
|
leafAspectRatio: z,
|
|
115
116
|
coverAspectRatio: G,
|
|
116
117
|
coverPageIndices: a?.coverIndices,
|
|
117
|
-
onPageChanged: (e) =>
|
|
118
|
+
onPageChanged: (e) => U.current(e),
|
|
118
119
|
onPageFlipping: A?.onPageFlipping,
|
|
119
120
|
onPageFlipped: A?.onPageFlipped,
|
|
120
121
|
historyMapper: J,
|
|
@@ -123,7 +124,7 @@ const pe = (k) => k.title.length > 0, Ie = ({
|
|
|
123
124
|
pageShadow: u,
|
|
124
125
|
snapshotDuringFlip: m,
|
|
125
126
|
enableHistory: N,
|
|
126
|
-
enableDownload:
|
|
127
|
+
enableDownload: L
|
|
127
128
|
})
|
|
128
129
|
);
|
|
129
130
|
ie(
|
|
@@ -146,8 +147,8 @@ const pe = (k) => k.title.length > 0, Ie = ({
|
|
|
146
147
|
getDownloadConfig: () => s.current.getDownloadConfig(),
|
|
147
148
|
getTocPageIndex: () => s.current.getTocPageIndex(),
|
|
148
149
|
getMouseMode: () => s.current.getMouseMode(),
|
|
149
|
-
setMouseMode: (e) => {
|
|
150
|
-
if (s.current.setMouseMode(e), p)
|
|
150
|
+
setMouseMode: (e, t) => {
|
|
151
|
+
if (s.current.setMouseMode(e), p && t?.persist !== !1)
|
|
151
152
|
try {
|
|
152
153
|
localStorage.setItem(p, e);
|
|
153
154
|
} catch {
|
|
@@ -173,7 +174,7 @@ const pe = (k) => k.title.length > 0, Ie = ({
|
|
|
173
174
|
}, [f]), S(() => {
|
|
174
175
|
const e = s.current;
|
|
175
176
|
if (!g) {
|
|
176
|
-
|
|
177
|
+
H([]);
|
|
177
178
|
return;
|
|
178
179
|
}
|
|
179
180
|
let t = !0;
|
|
@@ -196,7 +197,7 @@ const pe = (k) => k.title.length > 0, Ie = ({
|
|
|
196
197
|
if (t) {
|
|
197
198
|
for (const [o, I] of r)
|
|
198
199
|
I.element.isConnected || r.delete(o);
|
|
199
|
-
|
|
200
|
+
H([...r.values()]);
|
|
200
201
|
}
|
|
201
202
|
}), C;
|
|
202
203
|
},
|
|
@@ -210,7 +211,7 @@ const pe = (k) => k.title.length > 0, Ie = ({
|
|
|
210
211
|
const e = d.split(/\s+/)[0], t = document.querySelector(`.${e}`);
|
|
211
212
|
t && (u ? t.classList.remove("flipbook--no-page-shadow") : t.classList.add("flipbook--no-page-shadow"));
|
|
212
213
|
}, [d, u]);
|
|
213
|
-
const R = ue.toArray(
|
|
214
|
+
const R = ue.toArray(x), M = R.length, E = new Set(
|
|
214
215
|
a?.coverIndices === "auto" ? [0, M - 1] : a?.coverIndices ?? [0]
|
|
215
216
|
), te = (e) => E.has(e), q = /* @__PURE__ */ new Map();
|
|
216
217
|
if (a?.interiorCoverClassName || a?.frontInteriorCoverClassName || a?.backInteriorCoverClassName)
|
|
@@ -270,6 +271,7 @@ const pe = (k) => k.title.length > 0, Ie = ({
|
|
|
270
271
|
ge.displayName = "FlipBook";
|
|
271
272
|
export {
|
|
272
273
|
ge as FlipBook,
|
|
273
|
-
Ie as TocPage
|
|
274
|
+
Ie as TocPage,
|
|
275
|
+
Ce as createDefaultHistoryMapper
|
|
274
276
|
};
|
|
275
277
|
//# sourceMappingURL=flip-book.js.map
|
package/dist/flip-book.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flip-book.js","sources":["../src/TocPage.tsx","../src/FlipBook.tsx"],"sourcesContent":["import type { PageSemantics } from \"html-flip-book-vanilla\";\nimport type React from \"react\";\nimport \"./TocPage.css\";\n\n/**\n * Entry in the table of contents.\n */\nexport interface TocEntry {\n\t/** Page index to navigate to */\n\tpageIndex: number;\n\t/** Display title (from pageSemantics.indexToTitle or custom) */\n\ttitle: string;\n\t/** Semantic page name/number (from pageSemantics.indexToSemanticName) */\n\tsemanticName: string;\n}\n\n/**\n * Props for the TocPage component.\n */\nexport interface TocPageProps {\n\t/** Callback to navigate to a specific page */\n\tonNavigate: (pageIndex: number) => void;\n\t/** Total number of pages in the book */\n\ttotalPages: number;\n\t/** Page semantics for generating titles and page numbers */\n\tpageSemantics?: PageSemantics;\n\t/** Custom heading text. Default: \"Table of Contents\" */\n\theading?: string;\n\t/** Custom CSS class for the container */\n\tclassName?: string;\n\t/** Reading direction for RTL support */\n\tdirection?: \"ltr\" | \"rtl\";\n\t/**\n\t * Filter function to determine which pages appear in TOC.\n\t * By default, only pages with a title are included.\n\t */\n\tfilter?: (entry: TocEntry, pageIndex: number) => boolean;\n\t/** URL for an entry. When provided, modified clicks use native browser navigation. */\n\tgetHref?: (entry: TocEntry) => string | null | undefined;\n\t/**\n\t * Custom render function for TOC entries.\n\t * If not provided, uses default rendering.\n\t */\n\trenderEntry?: (entry: TocEntry, onClick: () => void, href?: string) => React.ReactNode;\n}\n\n/**\n * Default filter: include pages that have a non-empty title.\n */\nconst defaultFilter = (entry: TocEntry): boolean => entry.title.length > 0;\n\n/**\n * A table of contents page component for FlipBook.\n *\n * Automatically generates TOC entries from pageSemantics, showing pages\n * that have titles. Entries display title with fallback to semantic name,\n * then page index.\n *\n * @example\n * ```tsx\n * <TocPage\n * onNavigate={(pageIndex) => flipBookRef.current?.flipToPage(pageIndex)}\n * totalPages={20}\n * pageSemantics={mySemantics}\n * heading=\"Contents\"\n * direction=\"rtl\"\n * />\n * ```\n */\nconst TocPage: React.FC<TocPageProps> = ({\n\tonNavigate,\n\ttotalPages,\n\tpageSemantics,\n\theading = \"Table of Contents\",\n\tclassName,\n\tdirection = \"ltr\",\n\tfilter = defaultFilter,\n\tgetHref,\n\trenderEntry,\n}) => {\n\t// Generate TOC entries for all pages\n\tconst entries: TocEntry[] = [];\n\tfor (let i = 0; i < totalPages; i++) {\n\t\tconst title = pageSemantics?.indexToTitle(i) ?? \"\";\n\t\tconst semanticName = pageSemantics?.indexToSemanticName(i) ?? \"\";\n\t\tconst entry: TocEntry = { pageIndex: i, title, semanticName };\n\n\t\tif (filter(entry, i)) {\n\t\t\tentries.push(entry);\n\t\t}\n\t}\n\n\tconst renderDefaultEntry = (entry: TocEntry, onClick: () => void, href?: string) => {\n\t\t// Title on one side (left in LTR, right in RTL); semantic name or page index on the other\n\t\tconst title = entry.title || entry.semanticName || `Page ${entry.pageIndex + 1}`;\n\t\tconst pageOrSemantic = entry.semanticName || String(entry.pageIndex + 1);\n\n\t\tconst content = (\n\t\t\t<>\n\t\t\t\t<span className=\"toc-title\">{title}</span>\n\t\t\t\t<span className=\"toc-dots\" aria-hidden />\n\t\t\t\t<span className=\"toc-page-num\">{pageOrSemantic}</span>\n\t\t\t</>\n\t\t);\n\n\t\treturn (\n\t\t\t<li key={entry.pageIndex}>\n\t\t\t\t{href ? (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref={href}\n\t\t\t\t\t\tclassName=\"toc-link\"\n\t\t\t\t\t\tonClick={(event) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tevent.button !== 0 ||\n\t\t\t\t\t\t\t\tevent.ctrlKey ||\n\t\t\t\t\t\t\t\tevent.metaKey ||\n\t\t\t\t\t\t\t\tevent.shiftKey ||\n\t\t\t\t\t\t\t\tevent.altKey\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tonClick();\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\t<button type=\"button\" className=\"toc-link\" onClick={onClick}>\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</button>\n\t\t\t\t)}\n\t\t\t</li>\n\t\t);\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`toc-page ${className ?? \"\"}`.trim()}\n\t\t\tstyle={{ direction, textAlign: direction === \"rtl\" ? \"right\" : \"left\" }}\n\t\t>\n\t\t\t<div className=\"toc-page__scroll\">\n\t\t\t\t<h2 className=\"toc-heading\">{heading}</h2>\n\t\t\t\t<ul className=\"toc-list\">\n\t\t\t\t\t{entries.map((entry) => {\n\t\t\t\t\t\tconst onClick = () => onNavigate(entry.pageIndex);\n\t\t\t\t\t\tconst href = getHref?.(entry) ?? undefined;\n\t\t\t\t\t\treturn renderEntry\n\t\t\t\t\t\t\t? renderEntry(entry, onClick, href)\n\t\t\t\t\t\t\t: renderDefaultEntry(entry, onClick, href);\n\t\t\t\t\t})}\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport { TocPage };\n","import {\n\ttype BookmarkProvider as BaseBookmarkProvider,\n\ttype Bookmark,\n\tFlipBook as FlipBookBase,\n\ttype HistoryMapper,\n\ttype MouseMode,\n\ttype PageFlipParams,\n\ttype PageSemantics,\n} from \"html-flip-book-vanilla\";\nimport \"../../base/src/mouse-mode.scss\";\nimport type { DownloadConfig } from \"html-flip-book-vanilla/download\";\nimport type React from \"react\";\nimport { Children, forwardRef, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\n\n/** Bookmark content is rendered with React and keeps access to the consumer's contexts. */\nexport type BookmarkProvider = BaseBookmarkProvider<React.ReactNode>;\n\ninterface BookmarkSlot {\n\tkey: string;\n\tbookmark: Bookmark;\n\telement: HTMLElement;\n\trenderer: BookmarkProvider[\"renderBookmark\"];\n}\n\n/**\n * Imperative handle exposed via ref for programmatic control of the FlipBook.\n * Flipbook methods (flipNext, jumpToPage, etc.) are called internally by commands;\n * consumers interact through commands (execute) and getters (ref).\n *\n * @example\n * ```tsx\n * const ref = useRef<FlipBookHandle>(null);\n * const page = ref.current?.getCurrentPageIndex();\n * ```\n */\nexport interface FlipBookHandle {\n\t/** Animate flip to the next page */\n\tflipNext: () => Promise<void>;\n\t/** Animate flip to the previous page */\n\tflipPrev: () => Promise<void>;\n\t/** Animate flip to a specific page index */\n\tflipToPage: (pageIndex: number) => Promise<void>;\n\t/** Jump to a specific page instantly without animation */\n\tjumpToPage: (pageIndex: number) => void;\n\t/** Show a router-selected page without adding a browser history entry. */\n\trestorePage: (pageIndex: number) => void;\n\t/** Toggle debug toolbar visibility (when debug mode is enabled). Bound to Ctrl+Alt+D by default. */\n\ttoggleDebugBar?: () => void;\n\t/** Get the current (leftmost visible) page index */\n\tgetCurrentPageIndex: () => number;\n\t/** Get the total number of pages */\n\tgetTotalPages: () => number;\n\t/** Get the \"of\" value for the indicator (e.g. total label). Defaults to total pages when not set. */\n\tgetOf: () => string | number;\n\t/** Check if currently at the first page */\n\tisFirstPage: () => boolean;\n\t/** Check if currently at the last page */\n\tisLastPage: () => boolean;\n\t/** Get download configuration for the book. Undefined when no download is configured. */\n\tgetDownloadConfig: () => DownloadConfig | undefined;\n\t/** Get the configured table of contents page index. */\n\tgetTocPageIndex: () => number;\n\t/** Current mouse interaction mode. Touch gestures are unaffected. */\n\tgetMouseMode: () => MouseMode;\n\t/** Switch between continuous page turning and native text selection. */\n\tsetMouseMode: (mode: MouseMode) => void;\n}\n\n/**\n * Configuration for book covers.\n */\nexport interface CoverConfig {\n\t/**\n\t * Make covers \"hard\" - no page curl effect on covers.\n\t * When true, cover pages appear flat without the soft page bend.\n\t * Default: false\n\t */\n\thardCovers?: boolean;\n\t/**\n\t * Disable shadow effects on cover pages.\n\t * Default: false\n\t */\n\tnoShadow?: boolean;\n\t/**\n\t * Page indices that are considered cover pages.\n\t * Default: [0] (front cover only). Use [0, totalPages-1] for front and back covers.\n\t * If \"auto\", uses first and last pages as covers.\n\t */\n\tcoverIndices?: number[] | \"auto\";\n\t/**\n\t * CSS class applied to interior sides of cover leaves (the endpaper).\n\t * Sets the page background to the cover color; the white endpaper inset\n\t * is created automatically by the infrastructure.\n\t */\n\tinteriorCoverClassName?: string;\n\t/**\n\t * Override interiorCoverClassName for the front cover interior specifically.\n\t */\n\tfrontInteriorCoverClassName?: string;\n\t/**\n\t * Override interiorCoverClassName for the back cover interior specifically.\n\t */\n\tbackInteriorCoverClassName?: string;\n\t/**\n\t * Inset size for the interior endpaper frame.\n\t * Any valid CSS length (e.g. \"5%\", \"12px\"). Default: \"5%\".\n\t */\n\tcoverInset?: string;\n}\n\n/**\n * Handlers for FlipBook events. Pass via the `handlers` prop.\n */\nexport interface FlipBookHandlers {\n\t/** Fired when a flip animation starts. Params: leaf index, page indices, semantics, direction. */\n\tonPageFlipping?: (params: PageFlipParams) => void;\n\t/** Fired when a flip completes. Params: leaf index, page indices, semantics, direction. */\n\tonPageFlipped?: (params: PageFlipParams) => void;\n}\n\n/**\n * Props for the FlipBook React component.\n */\nexport interface FlipBookProps {\n\t/** Array of React elements to render as pages */\n\tpages: React.ReactNode[];\n\t/** CSS class name for the flipbook container */\n\tclassName: string;\n\t/** Define which pages are covers for special styling */\n\tpageSemantics?: PageSemantics;\n\t/** Page bookmark content, placement, ordering, and optional click behavior. */\n\tbookmarkProvider?: BookmarkProvider;\n\t/** Opt in to bookmarks. Without a custom provider, use the TOC and its chapter entries. Default: false. */\n\tenableBookmarks?: boolean;\n\t/** Enable debug mode */\n\tdebug?: boolean;\n\t/** Reading direction: 'ltr' (left-to-right) or 'rtl' (right-to-left) */\n\tdirection?: \"rtl\" | \"ltr\";\n\t/** Initial mouse interaction mode. Default: 'turn'. */\n\tmouseMode?: MouseMode;\n\t/** Optional localStorage key used to remember the user's mouse mode. */\n\tmouseModeStorageKey?: string;\n\t/** Indices of leaves that should start in the turned (flipped) state */\n\tinitialTurnedLeaves?: number[];\n\t/** Velocity threshold (px/s) for fast swipe to complete flip. Default: 500 */\n\tfastDeltaThreshold?: number;\n\t/**\n\t * Number of leaves to keep rendered before and after the current position.\n\t * When set, only leaves within the buffer range are visible for performance.\n\t * Default: undefined (all leaves are always rendered)\n\t */\n\tleavesBuffer?: number;\n\t/**\n\t * Configuration for cover pages (front and back covers).\n\t */\n\tcoverConfig?: CoverConfig;\n\t/**\n\t * Override for the \"of\" part of the page indicator (e.g. a gematria letter for the total, like \"נ\" for 50 in Hebrew books).\n\t * Defaults to total pages count when not set.\n\t */\n\tof?: string | number;\n\t/**\n\t * Aspect ratio for inner pages (text block leaves).\n\t * Default: { width: 2, height: 3 }\n\t */\n\tleafAspectRatio?: { width: number; height: number };\n\t/**\n\t * Aspect ratio for cover boards (slightly larger than leaf).\n\t * The delta between cover and leaf aspect ratios determines the visible frame.\n\t * Default: { width: 2.15, height: 3.15 }\n\t */\n\tcoverAspectRatio?: { width: number; height: number };\n\t/**\n\t * Event handlers. Use this to pass callbacks (e.g. onPageFlipped) instead of top-level props.\n\t */\n\thandlers?: FlipBookHandlers;\n\t/**\n\t * When set, syncs the flip-book with browser history: pushState on flip, restore page on back/forward.\n\t * Default: undefined.\n\t */\n\thistoryMapper?: HistoryMapper;\n\t/**\n\t * Table of contents page index (book-level). Populates the store used by goToToc command and TocButton.\n\t * Default: 4.\n\t */\n\ttocPageIndex?: number;\n\t/**\n\t * Download configuration: entire book and page-range handlers plus filename hints.\n\t * Toolbar's DownloadDropdown reads this from the flipbook ref.\n\t */\n\tdownloadConfig?: DownloadConfig;\n\t/**\n\t * When false, disables the inner page shadow/highlight (e.g. to avoid flicker with multiple books).\n\t * Default: true.\n\t */\n\tpageShadow?: boolean;\n\t/**\n\t * When true, uses aggressive containment on pages during flip animations\n\t * so the browser can operate on a cached GPU texture rather than\n\t * re-rendering content every frame. Reduces jank when flipping rapidly.\n\t * Default: true.\n\t */\n\tsnapshotDuringFlip?: boolean;\n\t/**\n\t * When false, history integration is disabled. When true or omitted, the provided historyMapper\n\t * is used; there is no default implementation. See base FlipBookOptions and issue #168.\n\t */\n\tenableHistory?: boolean;\n\t/**\n\t * When false, download is disabled (getDownloadConfig returns undefined). When true or omitted,\n\t * the provided downloadConfig is used; there is no default implementation. See base FlipBookOptions and issue #168.\n\t */\n\tenableDownload?: boolean;\n}\n\n/**\n * A React component for creating realistic page-flip animations.\n *\n * @example\n * ```tsx\n * import { FlipBook } from 'html-flip-book-react';\n *\n * function App() {\n * const ref = useRef<FlipBookHandle>(null);\n * return (\n * <FlipBook\n * ref={ref}\n * pages={[<div>Page 1</div>, <div>Page 2</div>]}\n * className=\"my-book\"\n * direction=\"ltr\"\n * />\n * );\n * }\n * ```\n */\nconst FlipBookReact = forwardRef<FlipBookHandle, FlipBookProps>(\n\t(\n\t\t{\n\t\t\tpages,\n\t\t\tclassName,\n\t\t\tdebug = false,\n\t\t\tdirection = \"ltr\",\n\t\t\tmouseMode = \"turn\",\n\t\t\tmouseModeStorageKey,\n\t\t\tpageSemantics = undefined,\n\t\t\tbookmarkProvider,\n\t\t\tenableBookmarks = false,\n\t\t\tinitialTurnedLeaves = [],\n\t\t\tfastDeltaThreshold,\n\t\t\tleavesBuffer,\n\t\t\tpageShadow = true,\n\t\t\tsnapshotDuringFlip = true,\n\t\t\tenableHistory,\n\t\t\tenableDownload,\n\t\t\tcoverConfig,\n\t\t\tof,\n\t\t\tleafAspectRatio,\n\t\t\tcoverAspectRatio,\n\t\t\thandlers,\n\t\t\thistoryMapper,\n\t\t\ttocPageIndex,\n\t\t\tdownloadConfig,\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst [currentPageIndex, setCurrentPageIndex] = useState(() => {\n\t\t\t// Derive the initial page index from initialTurnedLeaves so the\n\t\t\t// leavesBuffer renders around the correct page on the very first\n\t\t\t// render — before the base flipbook's useEffect fires.\n\t\t\t// Must match the base flipbook's model: visible spread starts at\n\t\t\t// lastTurnedLeaf * 2 + 1 (back of the last turned leaf).\n\t\t\tif (initialTurnedLeaves && initialTurnedLeaves.length > 0) {\n\t\t\t\tconst lastTurnedLeaf = Math.max(...initialTurnedLeaves);\n\t\t\t\tconst firstVisiblePage = lastTurnedLeaf * 2 + 1;\n\t\t\t\tif (firstVisiblePage >= pages.length) {\n\t\t\t\t\tconst lastLeaf = Math.ceil(pages.length / 2) - 1;\n\t\t\t\t\treturn lastLeaf * 2;\n\t\t\t\t}\n\t\t\t\treturn firstVisiblePage;\n\t\t\t}\n\t\t\treturn 0;\n\t\t});\n\t\tconst setPageIndexRef = useRef(setCurrentPageIndex);\n\t\tconst [bookmarkSlots, setBookmarkSlots] = useState<BookmarkSlot[]>([]);\n\t\tsetPageIndexRef.current = setCurrentPageIndex;\n\t\tconst ofRef = useRef(of);\n\t\tofRef.current = of;\n\n\t\t// Debounce buffer-related re-renders during rapid consecutive page flips.\n\t\t// When leavesBuffer is set, each onPageChanged triggers a React re-render\n\t\t// that recalculates which pages to mount/unmount — expensive with complex\n\t\t// content (e.g. Hebrew text, perushim). By debouncing, rapid flips (>1 at\n\t\t// a time) batch into a single re-render after settling. The page indicator\n\t\t// reads directly from the imperative handle (flipBook.current) and is not\n\t\t// affected by this debounce.\n\t\tconst BUFFER_DEBOUNCE_MS = 80;\n\t\tconst pageChangedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\t\tconst onPageChangedRef = useRef((index: number) => {\n\t\t\tsetPageIndexRef.current?.(index);\n\t\t});\n\t\tonPageChangedRef.current = (index: number) => {\n\t\t\tif (pageChangedTimerRef.current != null) {\n\t\t\t\tclearTimeout(pageChangedTimerRef.current);\n\t\t\t}\n\t\t\tif (leavesBuffer == null) {\n\t\t\t\t// No buffer — update immediately; no expensive mount/unmount cycle.\n\t\t\t\tsetPageIndexRef.current?.(index);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpageChangedTimerRef.current = setTimeout(() => {\n\t\t\t\tpageChangedTimerRef.current = null;\n\t\t\t\tsetPageIndexRef.current?.(index);\n\t\t\t}, BUFFER_DEBOUNCE_MS);\n\t\t};\n\n\t\t// Clean up debounce timer on unmount.\n\t\tuseEffect(() => {\n\t\t\treturn () => {\n\t\t\t\tif (pageChangedTimerRef.current != null) {\n\t\t\t\t\tclearTimeout(pageChangedTimerRef.current);\n\t\t\t\t}\n\t\t\t};\n\t\t}, []);\n\n\t\tconst flipBook = useRef(\n\t\t\tnew FlipBookBase({\n\t\t\t\tpageSemantics: pageSemantics,\n\t\t\t\tenableBookmarks,\n\t\t\t\tpagesCount: pages.length,\n\t\t\t\tdirection: direction,\n\t\t\t\tmouseMode,\n\t\t\t\tinitialTurnedLeaves: initialTurnedLeaves,\n\t\t\t\tfastDeltaThreshold: fastDeltaThreshold,\n\t\t\t\tleavesBuffer: leavesBuffer,\n\t\t\t\tleafAspectRatio: leafAspectRatio,\n\t\t\t\tcoverAspectRatio: coverAspectRatio,\n\t\t\t\tcoverPageIndices: coverConfig?.coverIndices,\n\t\t\t\tonPageChanged: (index: number) => onPageChangedRef.current(index),\n\t\t\t\tonPageFlipping: handlers?.onPageFlipping,\n\t\t\t\tonPageFlipped: handlers?.onPageFlipped,\n\t\t\t\thistoryMapper,\n\t\t\t\ttocPageIndex: tocPageIndex ?? 4,\n\t\t\t\tdownloadConfig,\n\t\t\t\tpageShadow,\n\t\t\t\tsnapshotDuringFlip,\n\t\t\t\tenableHistory,\n\t\t\t\tenableDownload,\n\t\t\t}),\n\t\t);\n\n\t\t// Expose imperative handle: flipbook methods (called by commands) and getters (for UI)\n\t\tuseImperativeHandle(\n\t\t\tref,\n\t\t\t() => ({\n\t\t\t\tflipNext: () => flipBook.current.flipNext(),\n\t\t\t\tflipPrev: () => flipBook.current.flipPrev(),\n\t\t\t\tflipToPage: (pageIndex: number) => flipBook.current.flipToPage(pageIndex),\n\t\t\t\tjumpToPage: (pageIndex: number) => flipBook.current.jumpToPage(pageIndex),\n\t\t\t\trestorePage: (pageIndex: number) => flipBook.current.restorePage(pageIndex),\n\t\t\t\ttoggleDebugBar: () => {\n\t\t\t\t\tconst selectorClass = className.split(/\\s+/)[0];\n\t\t\t\t\tconst root = document.querySelector(`.${selectorClass}`);\n\t\t\t\t\tconst bar = root?.querySelector(\".flipbook-debug-bar\");\n\t\t\t\t\tif (bar) bar.classList.toggle(\"flipbook-debug-bar--hidden\");\n\t\t\t\t},\n\t\t\t\tgetCurrentPageIndex: () => flipBook.current.currentPageIndex,\n\t\t\t\tgetTotalPages: () => flipBook.current.totalPages,\n\t\t\t\tgetOf: () => (ofRef.current !== undefined ? ofRef.current : flipBook.current.totalPages),\n\t\t\t\tisFirstPage: () => flipBook.current.isFirstPage,\n\t\t\t\tisLastPage: () => flipBook.current.isLastPage,\n\t\t\t\tgetDownloadConfig: () => flipBook.current.getDownloadConfig(),\n\t\t\t\tgetTocPageIndex: () => flipBook.current.getTocPageIndex(),\n\t\t\t\tgetMouseMode: () => flipBook.current.getMouseMode(),\n\t\t\t\tsetMouseMode: (mode: MouseMode) => {\n\t\t\t\t\tflipBook.current.setMouseMode(mode);\n\t\t\t\t\tif (mouseModeStorageKey) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tlocalStorage.setItem(mouseModeStorageKey, mode);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// Private browsing may deny storage; the mode still works this session.\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}),\n\t\t\t[className, mouseModeStorageKey],\n\t\t);\n\n\t\tuseEffect(() => {\n\t\t\tconst currentFlipBook = flipBook.current;\n\t\t\tconst selectorClass = className.split(/\\s+/)[0];\n\t\t\tcurrentFlipBook.render(`.${selectorClass}`, debug);\n\t\t\tif (mouseModeStorageKey) {\n\t\t\t\ttry {\n\t\t\t\t\tconst savedMode = localStorage.getItem(mouseModeStorageKey);\n\t\t\t\t\tif (savedMode === \"turn\" || savedMode === \"select\")\n\t\t\t\t\t\tcurrentFlipBook.setMouseMode(savedMode);\n\t\t\t\t} catch {\n\t\t\t\t\t// Storage is optional.\n\t\t\t\t}\n\t\t\t}\n\t\t\tsetCurrentPageIndex(currentFlipBook.currentPageIndex);\n\n\t\t\t// Cleanup function to destroy Hammer instance and event listeners\n\t\t\treturn () => {\n\t\t\t\tcurrentFlipBook.destroy();\n\t\t\t};\n\t\t}, [className, debug, mouseModeStorageKey]);\n\n\t\tconst previousBookmarksEnabled = useRef(enableBookmarks);\n\t\tuseEffect(() => {\n\t\t\tif (previousBookmarksEnabled.current === enableBookmarks) return;\n\t\t\tpreviousBookmarksEnabled.current = enableBookmarks;\n\t\t\tflipBook.current.setBookmarksEnabled(enableBookmarks);\n\t\t}, [enableBookmarks]);\n\n\t\tuseEffect(() => {\n\t\t\tconst currentFlipBook = flipBook.current;\n\t\t\tif (!bookmarkProvider) {\n\t\t\t\tsetBookmarkSlots([]);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlet active = true;\n\t\t\tconst slots = new Map<string, BookmarkSlot>();\n\t\t\tconst renderSlot = (bookmark: Bookmark, expanded: boolean): HTMLElement => {\n\t\t\t\tconst key = `${expanded ? \"expanded\" : \"brief\"}:${bookmark.id}`;\n\t\t\t\tlet slot = slots.get(key);\n\t\t\t\tif (!slot) {\n\t\t\t\t\tslot = {\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tbookmark,\n\t\t\t\t\t\telement: document.createElement(\"span\"),\n\t\t\t\t\t\trenderer: expanded\n\t\t\t\t\t\t\t? bookmarkProvider.renderExpandedBookmark\n\t\t\t\t\t\t\t: bookmarkProvider.renderBookmark,\n\t\t\t\t\t};\n\t\t\t\t\tslots.set(key, slot);\n\t\t\t\t}\n\t\t\t\tslot.bookmark = bookmark;\n\t\t\t\treturn slot.element;\n\t\t\t};\n\t\t\tconst provider: BaseBookmarkProvider = {\n\t\t\t\t...bookmarkProvider,\n\t\t\t\tgetBookmarks: (context) => {\n\t\t\t\t\tconst bookmarks = bookmarkProvider.getBookmarks(context);\n\t\t\t\t\tconst ids = new Set(bookmarks.map((bookmark) => bookmark.id));\n\t\t\t\t\tfor (const [key, slot] of slots) {\n\t\t\t\t\t\tif (!ids.has(slot.bookmark.id)) slots.delete(key);\n\t\t\t\t\t}\n\t\t\t\t\t// The base renderer creates the slots synchronously after this query.\n\t\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t\tif (!active) return;\n\t\t\t\t\t\tfor (const [id, slot] of slots) {\n\t\t\t\t\t\t\tif (!slot.element.isConnected) slots.delete(id);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetBookmarkSlots([...slots.values()]);\n\t\t\t\t\t});\n\t\t\t\t\treturn bookmarks;\n\t\t\t\t},\n\t\t\t\trenderBookmark: (bookmark) => renderSlot(bookmark, false),\n\t\t\t\trenderExpandedBookmark: bookmarkProvider.renderExpandedBookmark\n\t\t\t\t\t? (bookmark) => renderSlot(bookmark, true)\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t\tcurrentFlipBook.setBookmarkProvider(provider);\n\t\t\treturn () => {\n\t\t\t\tactive = false;\n\t\t\t\tcurrentFlipBook.setBookmarkProvider(undefined);\n\t\t\t};\n\t\t}, [bookmarkProvider]);\n\n\t\t// Sync pageShadow to DOM when prop changes (base option is set at construct time).\n\t\tuseEffect(() => {\n\t\t\tconst selectorClass = className.split(/\\s+/)[0];\n\t\t\tconst el = document.querySelector(`.${selectorClass}`);\n\t\t\tif (!el) return;\n\t\t\tif (pageShadow) {\n\t\t\t\tel.classList.remove(\"flipbook--no-page-shadow\");\n\t\t\t} else {\n\t\t\t\tel.classList.add(\"flipbook--no-page-shadow\");\n\t\t\t}\n\t\t}, [className, pageShadow]);\n\n\t\t// Use Children.toArray to get stable keys for each page element\n\t\tconst pagesWithKeys = Children.toArray(pages);\n\t\tconst totalPages = pagesWithKeys.length;\n\n\t\t// Determine cover page indices\n\t\tconst coverIndicesSet = new Set(\n\t\t\tcoverConfig?.coverIndices === \"auto\"\n\t\t\t\t? [0, totalPages - 1]\n\t\t\t\t: (coverConfig?.coverIndices ?? [0]),\n\t\t);\n\t\tconst isCoverPage = (index: number) => coverIndicesSet.has(index);\n\n\t\t// Compute interior cover page indices (the other side of each cover leaf).\n\t\t// Leaf pairs: [0,1], [2,3], ... — interior is the paired page on the same leaf.\n\t\tconst interiorCoverMap = new Map<number, \"front\" | \"back\">();\n\t\tif (\n\t\t\tcoverConfig?.interiorCoverClassName ||\n\t\t\tcoverConfig?.frontInteriorCoverClassName ||\n\t\t\tcoverConfig?.backInteriorCoverClassName\n\t\t) {\n\t\t\tfor (const coverIdx of coverIndicesSet) {\n\t\t\t\tconst interiorIdx = coverIdx % 2 === 0 ? coverIdx + 1 : coverIdx - 1;\n\t\t\t\tif (interiorIdx >= 0 && interiorIdx < totalPages && !coverIndicesSet.has(interiorIdx)) {\n\t\t\t\t\t// First cover index = front, others = back\n\t\t\t\t\tconst role = coverIdx === Math.min(...coverIndicesSet) ? \"front\" : \"back\";\n\t\t\t\t\tinteriorCoverMap.set(interiorIdx, role);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst coverInset = coverConfig?.coverInset ?? \"5%\";\n\n\t\t// Build CSS class for a page\n\t\tconst getPageClassName = (index: number): string => {\n\t\t\tconst classes = [\"page\"];\n\t\t\tif (isCoverPage(index)) {\n\t\t\t\tclasses.push(\"page--cover\");\n\t\t\t\tif (coverConfig?.hardCovers) {\n\t\t\t\t\tclasses.push(\"page--hard\");\n\t\t\t\t}\n\t\t\t\tif (coverConfig?.noShadow) {\n\t\t\t\t\tclasses.push(\"page--no-shadow\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst interiorRole = interiorCoverMap.get(index);\n\t\t\tif (interiorRole) {\n\t\t\t\tclasses.push(\"page--cover-interior\");\n\t\t\t\tconst cls =\n\t\t\t\t\tinteriorRole === \"front\"\n\t\t\t\t\t\t? (coverConfig?.frontInteriorCoverClassName ?? coverConfig?.interiorCoverClassName)\n\t\t\t\t\t\t: (coverConfig?.backInteriorCoverClassName ?? coverConfig?.interiorCoverClassName);\n\t\t\t\tif (cls) classes.push(cls);\n\t\t\t}\n\t\t\treturn classes.join(\" \");\n\t\t};\n\n\t\t// When leavesBuffer is set, only mount content for pages within the buffer (keep .page wrappers for layout).\n\t\t// Use a small margin so content is ready before vanilla shows the leaf (avoids empty flash when flipping).\n\t\t// Cover pages are always mounted — they are cover-sized and sit behind leaf-sized pages,\n\t\t// acting as the physical book boards. Unmounting them would remove the realistic frame effect.\n\t\tconst contentByIndex =\n\t\t\tleavesBuffer != null && totalPages > 0\n\t\t\t\t? (() => {\n\t\t\t\t\t\tconst currentLeaf = Math.floor(currentPageIndex / 2);\n\t\t\t\t\t\tconst leavesCount = Math.ceil(totalPages / 2);\n\t\t\t\t\t\tconst margin = 2; // extra leaves each side so content exists when vanilla reveals them\n\t\t\t\t\t\tconst leafStart = Math.max(0, currentLeaf - leavesBuffer - margin);\n\t\t\t\t\t\tconst leafEnd = Math.min(leavesCount - 1, currentLeaf + leavesBuffer + margin);\n\t\t\t\t\t\tconst pageStart = leafStart * 2;\n\t\t\t\t\t\tconst pageEnd = Math.min(totalPages - 1, leafEnd * 2 + 1);\n\t\t\t\t\t\tconst inRange = new Set(\n\t\t\t\t\t\t\tArray.from({ length: pageEnd - pageStart + 1 }, (_, i) => pageStart + i),\n\t\t\t\t\t\t);\n\t\t\t\t\t\t// Always include cover leaf pages so the larger cover boards remain mounted.\n\t\t\t\t\t\tfor (const idx of coverIndicesSet) {\n\t\t\t\t\t\t\tinRange.add(idx);\n\t\t\t\t\t\t\t// Also include the other side of the cover leaf\n\t\t\t\t\t\t\tconst partner = idx % 2 === 0 ? idx + 1 : idx - 1;\n\t\t\t\t\t\t\tif (partner >= 0 && partner < totalPages) {\n\t\t\t\t\t\t\t\tinRange.add(partner);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn (index: number) => (inRange.has(index) ? pagesWithKeys[index] : null);\n\t\t\t\t\t})()\n\t\t\t\t: (index: number) => pagesWithKeys[index];\n\n\t\t/** Wrap interior cover pages with the endpaper inset frame (3-sided: no inset on spine). */\n\t\tconst renderPageContent = (index: number) => {\n\t\t\tconst content = contentByIndex(index);\n\t\t\tif (interiorCoverMap.has(index)) {\n\t\t\t\t// Determine spine side: even pages (engine convention: pageIndex%2===1) are on the\n\t\t\t\t// left in LTR / right in RTL. Their spine is on the opposite side.\n\t\t\t\tconst isEvenPage = index % 2 === 1; // engine: (pageIndex+1)%2===1 → odd; so %2===1 → even\n\t\t\t\tconst spineOnRight = isEvenPage !== (direction === \"rtl\");\n\t\t\t\tconst insetStyle = {\n\t\t\t\t\t\"--cover-inset\": coverInset,\n\t\t\t\t\t...(spineOnRight ? { \"--cover-inset-right\": \"0px\" } : { \"--cover-inset-left\": \"0px\" }),\n\t\t\t\t} as Record<string, string>;\n\t\t\t\treturn (\n\t\t\t\t\t<div className=\"page--cover-interior-inset\" style={insetStyle}>\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn content;\n\t\t};\n\n\t\treturn (\n\t\t\t<div className={className}>\n\t\t\t\t{pagesWithKeys.map((_, index) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: stable slot identity for buffer/mount correctness\n\t\t\t\t\t\tkey={`page-${index}`}\n\t\t\t\t\t\tclassName={getPageClassName(index)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"flipbook-page-scrollport\">\n\t\t\t\t\t\t\t<div className=\"flipbook-page-content\" dir={direction}>\n\t\t\t\t\t\t\t\t{renderPageContent(index)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t))}\n\t\t\t\t{bookmarkSlots.map(({ key, bookmark, element, renderer }) =>\n\t\t\t\t\tcreatePortal(renderer ? renderer(bookmark) : bookmark.label, element, key),\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t},\n);\n\nFlipBookReact.displayName = \"FlipBook\";\n\nexport { FlipBookReact as FlipBook };\nexport type {\n\tBookmark,\n\tBookmarkContext,\n\tBookmarkPlacement,\n\tFlipPageSemantic,\n\tHistoryMapper,\n\tMouseMode,\n\tPageFlipParams,\n\tPageSemantics,\n} from \"html-flip-book-vanilla\";\nexport type { TocEntry, TocPageProps } from \"./TocPage\";\nexport { TocPage } from \"./TocPage\";\n"],"names":["defaultFilter","entry","TocPage","onNavigate","totalPages","pageSemantics","heading","className","direction","filter","getHref","renderEntry","entries","i","title","semanticName","renderDefaultEntry","onClick","href","pageOrSemantic","content","jsxs","Fragment","jsx","event","FlipBookReact","forwardRef","pages","debug","mouseMode","mouseModeStorageKey","bookmarkProvider","enableBookmarks","initialTurnedLeaves","fastDeltaThreshold","leavesBuffer","pageShadow","snapshotDuringFlip","enableHistory","enableDownload","coverConfig","of","leafAspectRatio","coverAspectRatio","handlers","historyMapper","tocPageIndex","downloadConfig","ref","currentPageIndex","setCurrentPageIndex","useState","firstVisiblePage","setPageIndexRef","useRef","bookmarkSlots","setBookmarkSlots","ofRef","BUFFER_DEBOUNCE_MS","pageChangedTimerRef","onPageChangedRef","index","useEffect","flipBook","FlipBookBase","useImperativeHandle","pageIndex","selectorClass","bar","mode","currentFlipBook","savedMode","previousBookmarksEnabled","active","slots","renderSlot","bookmark","expanded","key","slot","provider","context","bookmarks","ids","id","el","pagesWithKeys","Children","coverIndicesSet","isCoverPage","interiorCoverMap","coverIdx","interiorIdx","role","coverInset","getPageClassName","classes","interiorRole","cls","contentByIndex","currentLeaf","leavesCount","margin","leafStart","leafEnd","pageStart","pageEnd","inRange","_","idx","partner","renderPageContent","spineOnRight","insetStyle","element","renderer","createPortal"],"mappings":";;;;AAiDA,MAAMA,KAAgB,CAACC,MAA6BA,EAAM,MAAM,SAAS,GAoBnEC,KAAkC,CAAC;AAAA,EACxC,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,QAAAC,IAAST;AAAA,EACT,SAAAU;AAAA,EACA,aAAAC;AACD,MAAM;AAEL,QAAMC,IAAsB,CAAA;AAC5B,WAASC,IAAI,GAAGA,IAAIT,GAAYS,KAAK;AACpC,UAAMC,IAAQT,GAAe,aAAaQ,CAAC,KAAK,IAC1CE,IAAeV,GAAe,oBAAoBQ,CAAC,KAAK,IACxDZ,IAAkB,EAAE,WAAWY,GAAG,OAAAC,GAAO,cAAAC,EAAA;AAE/C,IAAIN,EAAOR,GAAOY,CAAC,KAClBD,EAAQ,KAAKX,CAAK;AAAA,EAEpB;AAEA,QAAMe,IAAqB,CAACf,GAAiBgB,GAAqBC,MAAkB;AAEnF,UAAMJ,IAAQb,EAAM,SAASA,EAAM,gBAAgB,QAAQA,EAAM,YAAY,CAAC,IACxEkB,IAAiBlB,EAAM,gBAAgB,OAAOA,EAAM,YAAY,CAAC,GAEjEmB,IACL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B;AACA,aAAO,CAACjD,MAAmB8C,EAAQ,IAAI9C,CAAK,IAAIyB,EAAczB,CAAK,IAAI;AAAA,IACxE,OACC,CAACA,MAAkByB,EAAczB,CAAK,GAGpCkD,KAAoB,CAAClD,MAAkB;AAC5C,YAAMzC,IAAU+E,GAAetC,CAAK;AACpC,UAAI6B,EAAiB,IAAI7B,CAAK,GAAG;AAIhC,cAAMmD,IADanD,IAAQ,MAAM,OACIrD,MAAc,QAC7CyG,IAAa;AAAA,UAClB,iBAAiBnB;AAAA,UACjB,GAAIkB,IAAe,EAAE,uBAAuB,UAAU,EAAE,sBAAsB,MAAA;AAAA,QAAM;AAErF,iCACE,OAAA,EAAI,WAAU,8BAA6B,OAAOC,GACjD,UAAA7F,GACF;AAAA,MAEF;AACA,aAAOA;AAAA,IACR;AAEA,WACC,gBAAAC,EAAC,SAAI,WAAAd,GACH,UAAA;AAAA,MAAA+E,EAAc,IAAI,CAACsB,GAAG/C,MACtB,gBAAAtC;AAAA,QAAC;AAAA,QAAA;AAAA,UAGA,WAAWwE,GAAiBlC,CAAK;AAAA,UAEjC,UAAA,gBAAAtC,EAAC,OAAA,EAAI,WAAU,4BACd,UAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,yBAAwB,KAAKf,GAC1C,UAAAuG,GAAkBlD,CAAK,GACzB,EAAA,CACD;AAAA,QAAA;AAAA,QAPK,QAAQA,CAAK;AAAA,MAAA,CASnB;AAAA,MACAN,EAAc;AAAA,QAAI,CAAC,EAAE,KAAAuB,GAAK,UAAAF,GAAU,SAAAsC,GAAS,UAAAC,EAAA,MAC7CC,GAAaD,IAAWA,EAASvC,CAAQ,IAAIA,EAAS,OAAOsC,GAASpC,CAAG;AAAA,MAAA;AAAA,IAC1E,GACD;AAAA,EAEF;AACD;AAEArD,GAAc,cAAc;"}
|
|
1
|
+
{"version":3,"file":"flip-book.js","sources":["../src/TocPage.tsx","../src/FlipBook.tsx"],"sourcesContent":["import type { PageSemantics } from \"html-flip-book-vanilla\";\nimport type React from \"react\";\nimport \"./TocPage.css\";\n\n/**\n * Entry in the table of contents.\n */\nexport interface TocEntry {\n\t/** Page index to navigate to */\n\tpageIndex: number;\n\t/** Display title (from pageSemantics.indexToTitle or custom) */\n\ttitle: string;\n\t/** Semantic page name/number (from pageSemantics.indexToSemanticName) */\n\tsemanticName: string;\n}\n\n/**\n * Props for the TocPage component.\n */\nexport interface TocPageProps {\n\t/** Callback to navigate to a specific page */\n\tonNavigate: (pageIndex: number) => void;\n\t/** Total number of pages in the book */\n\ttotalPages: number;\n\t/** Page semantics for generating titles and page numbers */\n\tpageSemantics?: PageSemantics;\n\t/** Custom heading text. Default: \"Table of Contents\" */\n\theading?: string;\n\t/** Custom CSS class for the container */\n\tclassName?: string;\n\t/** Reading direction for RTL support */\n\tdirection?: \"ltr\" | \"rtl\";\n\t/**\n\t * Filter function to determine which pages appear in TOC.\n\t * By default, only pages with a title are included.\n\t */\n\tfilter?: (entry: TocEntry, pageIndex: number) => boolean;\n\t/** URL for an entry. When provided, modified clicks use native browser navigation. */\n\tgetHref?: (entry: TocEntry) => string | null | undefined;\n\t/**\n\t * Custom render function for TOC entries.\n\t * If not provided, uses default rendering.\n\t */\n\trenderEntry?: (entry: TocEntry, onClick: () => void, href?: string) => React.ReactNode;\n}\n\n/**\n * Default filter: include pages that have a non-empty title.\n */\nconst defaultFilter = (entry: TocEntry): boolean => entry.title.length > 0;\n\n/**\n * A table of contents page component for FlipBook.\n *\n * Automatically generates TOC entries from pageSemantics, showing pages\n * that have titles. Entries display title with fallback to semantic name,\n * then page index.\n *\n * @example\n * ```tsx\n * <TocPage\n * onNavigate={(pageIndex) => flipBookRef.current?.flipToPage(pageIndex)}\n * totalPages={20}\n * pageSemantics={mySemantics}\n * heading=\"Contents\"\n * direction=\"rtl\"\n * />\n * ```\n */\nconst TocPage: React.FC<TocPageProps> = ({\n\tonNavigate,\n\ttotalPages,\n\tpageSemantics,\n\theading = \"Table of Contents\",\n\tclassName,\n\tdirection = \"ltr\",\n\tfilter = defaultFilter,\n\tgetHref,\n\trenderEntry,\n}) => {\n\t// Generate TOC entries for all pages\n\tconst entries: TocEntry[] = [];\n\tfor (let i = 0; i < totalPages; i++) {\n\t\tconst title = pageSemantics?.indexToTitle(i) ?? \"\";\n\t\tconst semanticName = pageSemantics?.indexToSemanticName(i) ?? \"\";\n\t\tconst entry: TocEntry = { pageIndex: i, title, semanticName };\n\n\t\tif (filter(entry, i)) {\n\t\t\tentries.push(entry);\n\t\t}\n\t}\n\n\tconst renderDefaultEntry = (entry: TocEntry, onClick: () => void, href?: string) => {\n\t\t// Title on one side (left in LTR, right in RTL); semantic name or page index on the other\n\t\tconst title = entry.title || entry.semanticName || `Page ${entry.pageIndex + 1}`;\n\t\tconst pageOrSemantic = entry.semanticName || String(entry.pageIndex + 1);\n\n\t\tconst content = (\n\t\t\t<>\n\t\t\t\t<span className=\"toc-title\">{title}</span>\n\t\t\t\t<span className=\"toc-dots\" aria-hidden />\n\t\t\t\t<span className=\"toc-page-num\">{pageOrSemantic}</span>\n\t\t\t</>\n\t\t);\n\n\t\treturn (\n\t\t\t<li key={entry.pageIndex}>\n\t\t\t\t{href ? (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref={href}\n\t\t\t\t\t\tclassName=\"toc-link\"\n\t\t\t\t\t\tonClick={(event) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tevent.button !== 0 ||\n\t\t\t\t\t\t\t\tevent.ctrlKey ||\n\t\t\t\t\t\t\t\tevent.metaKey ||\n\t\t\t\t\t\t\t\tevent.shiftKey ||\n\t\t\t\t\t\t\t\tevent.altKey\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tonClick();\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\t<button type=\"button\" className=\"toc-link\" onClick={onClick}>\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</button>\n\t\t\t\t)}\n\t\t\t</li>\n\t\t);\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`toc-page ${className ?? \"\"}`.trim()}\n\t\t\tstyle={{ direction, textAlign: direction === \"rtl\" ? \"right\" : \"left\" }}\n\t\t>\n\t\t\t<div className=\"toc-page__scroll\">\n\t\t\t\t<h2 className=\"toc-heading\">{heading}</h2>\n\t\t\t\t<ul className=\"toc-list\">\n\t\t\t\t\t{entries.map((entry) => {\n\t\t\t\t\t\tconst onClick = () => onNavigate(entry.pageIndex);\n\t\t\t\t\t\tconst href = getHref?.(entry) ?? undefined;\n\t\t\t\t\t\treturn renderEntry\n\t\t\t\t\t\t\t? renderEntry(entry, onClick, href)\n\t\t\t\t\t\t\t: renderDefaultEntry(entry, onClick, href);\n\t\t\t\t\t})}\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport { TocPage };\n","import {\n\ttype BookmarkProvider as BaseBookmarkProvider,\n\ttype Bookmark,\n\tFlipBook as FlipBookBase,\n\ttype HistoryMapper,\n\ttype MouseMode,\n\ttype PageFlipParams,\n\ttype PageSemantics,\n} from \"html-flip-book-vanilla\";\nimport \"../../base/src/mouse-mode.scss\";\nimport type { DownloadConfig } from \"html-flip-book-vanilla/download\";\nimport type React from \"react\";\nimport { Children, forwardRef, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\n\n/** Bookmark content is rendered with React and keeps access to the consumer's contexts. */\nexport type BookmarkProvider = BaseBookmarkProvider<React.ReactNode>;\n\ninterface BookmarkSlot {\n\tkey: string;\n\tbookmark: Bookmark;\n\telement: HTMLElement;\n\trenderer: BookmarkProvider[\"renderBookmark\"];\n}\n\n/**\n * Imperative handle exposed via ref for programmatic control of the FlipBook.\n * Flipbook methods (flipNext, jumpToPage, etc.) are called internally by commands;\n * consumers interact through commands (execute) and getters (ref).\n *\n * @example\n * ```tsx\n * const ref = useRef<FlipBookHandle>(null);\n * const page = ref.current?.getCurrentPageIndex();\n * ```\n */\nexport interface FlipBookHandle {\n\t/** Animate flip to the next page */\n\tflipNext: () => Promise<void>;\n\t/** Animate flip to the previous page */\n\tflipPrev: () => Promise<void>;\n\t/** Animate flip to a specific page index */\n\tflipToPage: (pageIndex: number) => Promise<void>;\n\t/** Jump to a specific page instantly without animation */\n\tjumpToPage: (pageIndex: number) => void;\n\t/** Show a router-selected page without adding a browser history entry. */\n\trestorePage: (pageIndex: number) => void;\n\t/** Toggle debug toolbar visibility (when debug mode is enabled). Bound to Ctrl+Alt+D by default. */\n\ttoggleDebugBar?: () => void;\n\t/** Get the current (leftmost visible) page index */\n\tgetCurrentPageIndex: () => number;\n\t/** Get the total number of pages */\n\tgetTotalPages: () => number;\n\t/** Get the \"of\" value for the indicator (e.g. total label). Defaults to total pages when not set. */\n\tgetOf: () => string | number;\n\t/** Check if currently at the first page */\n\tisFirstPage: () => boolean;\n\t/** Check if currently at the last page */\n\tisLastPage: () => boolean;\n\t/** Get download configuration for the book. Undefined when no download is configured. */\n\tgetDownloadConfig: () => DownloadConfig | undefined;\n\t/** Get the configured table of contents page index. */\n\tgetTocPageIndex: () => number;\n\t/** Current mouse interaction mode. Touch gestures are unaffected. */\n\tgetMouseMode: () => MouseMode;\n\t/** Switch between continuous page turning and native text selection. */\n\tsetMouseMode: (mode: MouseMode, options?: { persist?: boolean }) => void;\n}\n\n/**\n * Configuration for book covers.\n */\nexport interface CoverConfig {\n\t/**\n\t * Make covers \"hard\" - no page curl effect on covers.\n\t * When true, cover pages appear flat without the soft page bend.\n\t * Default: false\n\t */\n\thardCovers?: boolean;\n\t/**\n\t * Disable shadow effects on cover pages.\n\t * Default: false\n\t */\n\tnoShadow?: boolean;\n\t/**\n\t * Page indices that are considered cover pages.\n\t * Default: [0] (front cover only). Use [0, totalPages-1] for front and back covers.\n\t * If \"auto\", uses first and last pages as covers.\n\t */\n\tcoverIndices?: number[] | \"auto\";\n\t/**\n\t * CSS class applied to interior sides of cover leaves (the endpaper).\n\t * Sets the page background to the cover color; the white endpaper inset\n\t * is created automatically by the infrastructure.\n\t */\n\tinteriorCoverClassName?: string;\n\t/**\n\t * Override interiorCoverClassName for the front cover interior specifically.\n\t */\n\tfrontInteriorCoverClassName?: string;\n\t/**\n\t * Override interiorCoverClassName for the back cover interior specifically.\n\t */\n\tbackInteriorCoverClassName?: string;\n\t/**\n\t * Inset size for the interior endpaper frame.\n\t * Any valid CSS length (e.g. \"5%\", \"12px\"). Default: \"5%\".\n\t */\n\tcoverInset?: string;\n}\n\n/**\n * Handlers for FlipBook events. Pass via the `handlers` prop.\n */\nexport interface FlipBookHandlers {\n\t/** Fired when a flip animation starts. Params: leaf index, page indices, semantics, direction. */\n\tonPageFlipping?: (params: PageFlipParams) => void;\n\t/** Fired when a flip completes. Params: leaf index, page indices, semantics, direction. */\n\tonPageFlipped?: (params: PageFlipParams) => void;\n}\n\n/**\n * Props for the FlipBook React component.\n */\nexport interface FlipBookProps {\n\t/** Array of React elements to render as pages */\n\tpages: React.ReactNode[];\n\t/** CSS class name for the flipbook container */\n\tclassName: string;\n\t/** Define which pages are covers for special styling */\n\tpageSemantics?: PageSemantics;\n\t/** Page bookmark content, placement, ordering, and optional click behavior. */\n\tbookmarkProvider?: BookmarkProvider;\n\t/** Opt in to bookmarks. Without a custom provider, use the TOC and its chapter entries. Default: false. */\n\tenableBookmarks?: boolean;\n\t/** Enable debug mode */\n\tdebug?: boolean;\n\t/** Reading direction: 'ltr' (left-to-right) or 'rtl' (right-to-left) */\n\tdirection?: \"rtl\" | \"ltr\";\n\t/** Initial mouse interaction mode. Default: 'turn'. */\n\tmouseMode?: MouseMode;\n\t/** Optional localStorage key used to remember the user's mouse mode. */\n\tmouseModeStorageKey?: string;\n\t/** Indices of leaves that should start in the turned (flipped) state */\n\tinitialTurnedLeaves?: number[];\n\t/** Velocity threshold (px/s) for fast swipe to complete flip. Default: 500 */\n\tfastDeltaThreshold?: number;\n\t/**\n\t * Number of leaves to keep rendered before and after the current position.\n\t * When set, only leaves within the buffer range are visible for performance.\n\t * Default: undefined (all leaves are always rendered)\n\t */\n\tleavesBuffer?: number;\n\t/**\n\t * Configuration for cover pages (front and back covers).\n\t */\n\tcoverConfig?: CoverConfig;\n\t/**\n\t * Override for the \"of\" part of the page indicator (e.g. a gematria letter for the total, like \"נ\" for 50 in Hebrew books).\n\t * Defaults to total pages count when not set.\n\t */\n\tof?: string | number;\n\t/**\n\t * Aspect ratio for inner pages (text block leaves).\n\t * Default: { width: 2, height: 3 }\n\t */\n\tleafAspectRatio?: { width: number; height: number };\n\t/**\n\t * Aspect ratio for cover boards (slightly larger than leaf).\n\t * The delta between cover and leaf aspect ratios determines the visible frame.\n\t * Default: { width: 2.15, height: 3.15 }\n\t */\n\tcoverAspectRatio?: { width: number; height: number };\n\t/**\n\t * Event handlers. Use this to pass callbacks (e.g. onPageFlipped) instead of top-level props.\n\t */\n\thandlers?: FlipBookHandlers;\n\t/**\n\t * When set, syncs the flip-book with browser history: pushState on flip, restore page on back/forward,\n\t * and adopt the page named by the current URL on mount.\n\t * When omitted and enableHistory is not false, the built-in `#page/{name}` hash mapper is used.\n\t */\n\thistoryMapper?: HistoryMapper;\n\t/**\n\t * Table of contents page index (book-level). Populates the store used by goToToc command and TocButton.\n\t * Default: 4.\n\t */\n\ttocPageIndex?: number;\n\t/**\n\t * Download configuration: entire book and page-range handlers plus filename hints.\n\t * Toolbar's DownloadDropdown reads this from the flipbook ref.\n\t * When omitted and enableDownload is not false, the built-in JSON page-index default is used.\n\t */\n\tdownloadConfig?: DownloadConfig;\n\t/**\n\t * When false, disables the inner page shadow/highlight (e.g. to avoid flicker with multiple books).\n\t * Default: true.\n\t */\n\tpageShadow?: boolean;\n\t/**\n\t * When true, uses aggressive containment on pages during flip animations\n\t * so the browser can operate on a cached GPU texture rather than\n\t * re-rendering content every frame. Reduces jank when flipping rapidly.\n\t * Default: true.\n\t */\n\tsnapshotDuringFlip?: boolean;\n\t/**\n\t * When false, history integration is disabled entirely. When true or omitted, the provided\n\t * historyMapper is used, or the built-in hash-based default when none is provided.\n\t */\n\tenableHistory?: boolean;\n\t/**\n\t * When false, download is disabled entirely (getDownloadConfig returns undefined). When true or\n\t * omitted, the provided downloadConfig is used, or the built-in JSON page-index default when none\n\t * is provided.\n\t */\n\tenableDownload?: boolean;\n}\n\n/**\n * A React component for creating realistic page-flip animations.\n *\n * @example\n * ```tsx\n * import { FlipBook } from 'html-flip-book-react';\n *\n * function App() {\n * const ref = useRef<FlipBookHandle>(null);\n * return (\n * <FlipBook\n * ref={ref}\n * pages={[<div>Page 1</div>, <div>Page 2</div>]}\n * className=\"my-book\"\n * direction=\"ltr\"\n * />\n * );\n * }\n * ```\n */\nconst FlipBookReact = forwardRef<FlipBookHandle, FlipBookProps>(\n\t(\n\t\t{\n\t\t\tpages,\n\t\t\tclassName,\n\t\t\tdebug = false,\n\t\t\tdirection = \"ltr\",\n\t\t\tmouseMode = \"turn\",\n\t\t\tmouseModeStorageKey,\n\t\t\tpageSemantics = undefined,\n\t\t\tbookmarkProvider,\n\t\t\tenableBookmarks = false,\n\t\t\tinitialTurnedLeaves = [],\n\t\t\tfastDeltaThreshold,\n\t\t\tleavesBuffer,\n\t\t\tpageShadow = true,\n\t\t\tsnapshotDuringFlip = true,\n\t\t\tenableHistory,\n\t\t\tenableDownload,\n\t\t\tcoverConfig,\n\t\t\tof,\n\t\t\tleafAspectRatio,\n\t\t\tcoverAspectRatio,\n\t\t\thandlers,\n\t\t\thistoryMapper,\n\t\t\ttocPageIndex,\n\t\t\tdownloadConfig,\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst [currentPageIndex, setCurrentPageIndex] = useState(() => {\n\t\t\t// Derive the initial page index from initialTurnedLeaves so the\n\t\t\t// leavesBuffer renders around the correct page on the very first\n\t\t\t// render — before the base flipbook's useEffect fires.\n\t\t\t// Must match the base flipbook's model: visible spread starts at\n\t\t\t// lastTurnedLeaf * 2 + 1 (back of the last turned leaf).\n\t\t\tif (initialTurnedLeaves && initialTurnedLeaves.length > 0) {\n\t\t\t\tconst lastTurnedLeaf = Math.max(...initialTurnedLeaves);\n\t\t\t\tconst firstVisiblePage = lastTurnedLeaf * 2 + 1;\n\t\t\t\tif (firstVisiblePage >= pages.length) {\n\t\t\t\t\tconst lastLeaf = Math.ceil(pages.length / 2) - 1;\n\t\t\t\t\treturn lastLeaf * 2;\n\t\t\t\t}\n\t\t\t\treturn firstVisiblePage;\n\t\t\t}\n\t\t\treturn 0;\n\t\t});\n\t\tconst setPageIndexRef = useRef(setCurrentPageIndex);\n\t\tconst [bookmarkSlots, setBookmarkSlots] = useState<BookmarkSlot[]>([]);\n\t\tsetPageIndexRef.current = setCurrentPageIndex;\n\t\tconst ofRef = useRef(of);\n\t\tofRef.current = of;\n\n\t\t// Debounce buffer-related re-renders during rapid consecutive page flips.\n\t\t// When leavesBuffer is set, each onPageChanged triggers a React re-render\n\t\t// that recalculates which pages to mount/unmount — expensive with complex\n\t\t// content (e.g. Hebrew text, perushim). By debouncing, rapid flips (>1 at\n\t\t// a time) batch into a single re-render after settling. The page indicator\n\t\t// reads directly from the imperative handle (flipBook.current) and is not\n\t\t// affected by this debounce.\n\t\tconst BUFFER_DEBOUNCE_MS = 80;\n\t\tconst pageChangedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\t\tconst onPageChangedRef = useRef((index: number) => {\n\t\t\tsetPageIndexRef.current?.(index);\n\t\t});\n\t\tonPageChangedRef.current = (index: number) => {\n\t\t\tif (pageChangedTimerRef.current != null) {\n\t\t\t\tclearTimeout(pageChangedTimerRef.current);\n\t\t\t}\n\t\t\tif (leavesBuffer == null) {\n\t\t\t\t// No buffer — update immediately; no expensive mount/unmount cycle.\n\t\t\t\tsetPageIndexRef.current?.(index);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpageChangedTimerRef.current = setTimeout(() => {\n\t\t\t\tpageChangedTimerRef.current = null;\n\t\t\t\tsetPageIndexRef.current?.(index);\n\t\t\t}, BUFFER_DEBOUNCE_MS);\n\t\t};\n\n\t\t// Clean up debounce timer on unmount.\n\t\tuseEffect(() => {\n\t\t\treturn () => {\n\t\t\t\tif (pageChangedTimerRef.current != null) {\n\t\t\t\t\tclearTimeout(pageChangedTimerRef.current);\n\t\t\t\t}\n\t\t\t};\n\t\t}, []);\n\n\t\tconst flipBook = useRef(\n\t\t\tnew FlipBookBase({\n\t\t\t\tpageSemantics: pageSemantics,\n\t\t\t\tenableBookmarks,\n\t\t\t\tpagesCount: pages.length,\n\t\t\t\tdirection: direction,\n\t\t\t\tmouseMode,\n\t\t\t\tinitialTurnedLeaves: initialTurnedLeaves,\n\t\t\t\tfastDeltaThreshold: fastDeltaThreshold,\n\t\t\t\tleavesBuffer: leavesBuffer,\n\t\t\t\tleafAspectRatio: leafAspectRatio,\n\t\t\t\tcoverAspectRatio: coverAspectRatio,\n\t\t\t\tcoverPageIndices: coverConfig?.coverIndices,\n\t\t\t\tonPageChanged: (index: number) => onPageChangedRef.current(index),\n\t\t\t\tonPageFlipping: handlers?.onPageFlipping,\n\t\t\t\tonPageFlipped: handlers?.onPageFlipped,\n\t\t\t\thistoryMapper,\n\t\t\t\ttocPageIndex: tocPageIndex ?? 4,\n\t\t\t\tdownloadConfig,\n\t\t\t\tpageShadow,\n\t\t\t\tsnapshotDuringFlip,\n\t\t\t\tenableHistory,\n\t\t\t\tenableDownload,\n\t\t\t}),\n\t\t);\n\n\t\t// Expose imperative handle: flipbook methods (called by commands) and getters (for UI)\n\t\tuseImperativeHandle(\n\t\t\tref,\n\t\t\t() => ({\n\t\t\t\tflipNext: () => flipBook.current.flipNext(),\n\t\t\t\tflipPrev: () => flipBook.current.flipPrev(),\n\t\t\t\tflipToPage: (pageIndex: number) => flipBook.current.flipToPage(pageIndex),\n\t\t\t\tjumpToPage: (pageIndex: number) => flipBook.current.jumpToPage(pageIndex),\n\t\t\t\trestorePage: (pageIndex: number) => flipBook.current.restorePage(pageIndex),\n\t\t\t\ttoggleDebugBar: () => {\n\t\t\t\t\tconst selectorClass = className.split(/\\s+/)[0];\n\t\t\t\t\tconst root = document.querySelector(`.${selectorClass}`);\n\t\t\t\t\tconst bar = root?.querySelector(\".flipbook-debug-bar\");\n\t\t\t\t\tif (bar) bar.classList.toggle(\"flipbook-debug-bar--hidden\");\n\t\t\t\t},\n\t\t\t\tgetCurrentPageIndex: () => flipBook.current.currentPageIndex,\n\t\t\t\tgetTotalPages: () => flipBook.current.totalPages,\n\t\t\t\tgetOf: () => (ofRef.current !== undefined ? ofRef.current : flipBook.current.totalPages),\n\t\t\t\tisFirstPage: () => flipBook.current.isFirstPage,\n\t\t\t\tisLastPage: () => flipBook.current.isLastPage,\n\t\t\t\tgetDownloadConfig: () => flipBook.current.getDownloadConfig(),\n\t\t\t\tgetTocPageIndex: () => flipBook.current.getTocPageIndex(),\n\t\t\t\tgetMouseMode: () => flipBook.current.getMouseMode(),\n\t\t\t\tsetMouseMode: (mode: MouseMode, options?: { persist?: boolean }) => {\n\t\t\t\t\tflipBook.current.setMouseMode(mode);\n\t\t\t\t\tif (mouseModeStorageKey && options?.persist !== false) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tlocalStorage.setItem(mouseModeStorageKey, mode);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// Private browsing may deny storage; the mode still works this session.\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}),\n\t\t\t[className, mouseModeStorageKey],\n\t\t);\n\n\t\tuseEffect(() => {\n\t\t\tconst currentFlipBook = flipBook.current;\n\t\t\tconst selectorClass = className.split(/\\s+/)[0];\n\t\t\tcurrentFlipBook.render(`.${selectorClass}`, debug);\n\t\t\tif (mouseModeStorageKey) {\n\t\t\t\ttry {\n\t\t\t\t\tconst savedMode = localStorage.getItem(mouseModeStorageKey);\n\t\t\t\t\tif (savedMode === \"turn\" || savedMode === \"select\")\n\t\t\t\t\t\tcurrentFlipBook.setMouseMode(savedMode);\n\t\t\t\t} catch {\n\t\t\t\t\t// Storage is optional.\n\t\t\t\t}\n\t\t\t}\n\t\t\tsetCurrentPageIndex(currentFlipBook.currentPageIndex);\n\n\t\t\t// Cleanup function to destroy Hammer instance and event listeners\n\t\t\treturn () => {\n\t\t\t\tcurrentFlipBook.destroy();\n\t\t\t};\n\t\t}, [className, debug, mouseModeStorageKey]);\n\n\t\tconst previousBookmarksEnabled = useRef(enableBookmarks);\n\t\tuseEffect(() => {\n\t\t\tif (previousBookmarksEnabled.current === enableBookmarks) return;\n\t\t\tpreviousBookmarksEnabled.current = enableBookmarks;\n\t\t\tflipBook.current.setBookmarksEnabled(enableBookmarks);\n\t\t}, [enableBookmarks]);\n\n\t\tuseEffect(() => {\n\t\t\tconst currentFlipBook = flipBook.current;\n\t\t\tif (!bookmarkProvider) {\n\t\t\t\tsetBookmarkSlots([]);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlet active = true;\n\t\t\tconst slots = new Map<string, BookmarkSlot>();\n\t\t\tconst renderSlot = (bookmark: Bookmark, expanded: boolean): HTMLElement => {\n\t\t\t\tconst key = `${expanded ? \"expanded\" : \"brief\"}:${bookmark.id}`;\n\t\t\t\tlet slot = slots.get(key);\n\t\t\t\tif (!slot) {\n\t\t\t\t\tslot = {\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tbookmark,\n\t\t\t\t\t\telement: document.createElement(\"span\"),\n\t\t\t\t\t\trenderer: expanded\n\t\t\t\t\t\t\t? bookmarkProvider.renderExpandedBookmark\n\t\t\t\t\t\t\t: bookmarkProvider.renderBookmark,\n\t\t\t\t\t};\n\t\t\t\t\tslots.set(key, slot);\n\t\t\t\t}\n\t\t\t\tslot.bookmark = bookmark;\n\t\t\t\treturn slot.element;\n\t\t\t};\n\t\t\tconst provider: BaseBookmarkProvider = {\n\t\t\t\t...bookmarkProvider,\n\t\t\t\tgetBookmarks: (context) => {\n\t\t\t\t\tconst bookmarks = bookmarkProvider.getBookmarks(context);\n\t\t\t\t\tconst ids = new Set(bookmarks.map((bookmark) => bookmark.id));\n\t\t\t\t\tfor (const [key, slot] of slots) {\n\t\t\t\t\t\tif (!ids.has(slot.bookmark.id)) slots.delete(key);\n\t\t\t\t\t}\n\t\t\t\t\t// The base renderer creates the slots synchronously after this query.\n\t\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t\tif (!active) return;\n\t\t\t\t\t\tfor (const [id, slot] of slots) {\n\t\t\t\t\t\t\tif (!slot.element.isConnected) slots.delete(id);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetBookmarkSlots([...slots.values()]);\n\t\t\t\t\t});\n\t\t\t\t\treturn bookmarks;\n\t\t\t\t},\n\t\t\t\trenderBookmark: (bookmark) => renderSlot(bookmark, false),\n\t\t\t\trenderExpandedBookmark: bookmarkProvider.renderExpandedBookmark\n\t\t\t\t\t? (bookmark) => renderSlot(bookmark, true)\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t\tcurrentFlipBook.setBookmarkProvider(provider);\n\t\t\treturn () => {\n\t\t\t\tactive = false;\n\t\t\t\tcurrentFlipBook.setBookmarkProvider(undefined);\n\t\t\t};\n\t\t}, [bookmarkProvider]);\n\n\t\t// Sync pageShadow to DOM when prop changes (base option is set at construct time).\n\t\tuseEffect(() => {\n\t\t\tconst selectorClass = className.split(/\\s+/)[0];\n\t\t\tconst el = document.querySelector(`.${selectorClass}`);\n\t\t\tif (!el) return;\n\t\t\tif (pageShadow) {\n\t\t\t\tel.classList.remove(\"flipbook--no-page-shadow\");\n\t\t\t} else {\n\t\t\t\tel.classList.add(\"flipbook--no-page-shadow\");\n\t\t\t}\n\t\t}, [className, pageShadow]);\n\n\t\t// Use Children.toArray to get stable keys for each page element\n\t\tconst pagesWithKeys = Children.toArray(pages);\n\t\tconst totalPages = pagesWithKeys.length;\n\n\t\t// Determine cover page indices\n\t\tconst coverIndicesSet = new Set(\n\t\t\tcoverConfig?.coverIndices === \"auto\"\n\t\t\t\t? [0, totalPages - 1]\n\t\t\t\t: (coverConfig?.coverIndices ?? [0]),\n\t\t);\n\t\tconst isCoverPage = (index: number) => coverIndicesSet.has(index);\n\n\t\t// Compute interior cover page indices (the other side of each cover leaf).\n\t\t// Leaf pairs: [0,1], [2,3], ... — interior is the paired page on the same leaf.\n\t\tconst interiorCoverMap = new Map<number, \"front\" | \"back\">();\n\t\tif (\n\t\t\tcoverConfig?.interiorCoverClassName ||\n\t\t\tcoverConfig?.frontInteriorCoverClassName ||\n\t\t\tcoverConfig?.backInteriorCoverClassName\n\t\t) {\n\t\t\tfor (const coverIdx of coverIndicesSet) {\n\t\t\t\tconst interiorIdx = coverIdx % 2 === 0 ? coverIdx + 1 : coverIdx - 1;\n\t\t\t\tif (interiorIdx >= 0 && interiorIdx < totalPages && !coverIndicesSet.has(interiorIdx)) {\n\t\t\t\t\t// First cover index = front, others = back\n\t\t\t\t\tconst role = coverIdx === Math.min(...coverIndicesSet) ? \"front\" : \"back\";\n\t\t\t\t\tinteriorCoverMap.set(interiorIdx, role);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst coverInset = coverConfig?.coverInset ?? \"5%\";\n\n\t\t// Build CSS class for a page\n\t\tconst getPageClassName = (index: number): string => {\n\t\t\tconst classes = [\"page\"];\n\t\t\tif (isCoverPage(index)) {\n\t\t\t\tclasses.push(\"page--cover\");\n\t\t\t\tif (coverConfig?.hardCovers) {\n\t\t\t\t\tclasses.push(\"page--hard\");\n\t\t\t\t}\n\t\t\t\tif (coverConfig?.noShadow) {\n\t\t\t\t\tclasses.push(\"page--no-shadow\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst interiorRole = interiorCoverMap.get(index);\n\t\t\tif (interiorRole) {\n\t\t\t\tclasses.push(\"page--cover-interior\");\n\t\t\t\tconst cls =\n\t\t\t\t\tinteriorRole === \"front\"\n\t\t\t\t\t\t? (coverConfig?.frontInteriorCoverClassName ?? coverConfig?.interiorCoverClassName)\n\t\t\t\t\t\t: (coverConfig?.backInteriorCoverClassName ?? coverConfig?.interiorCoverClassName);\n\t\t\t\tif (cls) classes.push(cls);\n\t\t\t}\n\t\t\treturn classes.join(\" \");\n\t\t};\n\n\t\t// When leavesBuffer is set, only mount content for pages within the buffer (keep .page wrappers for layout).\n\t\t// Use a small margin so content is ready before vanilla shows the leaf (avoids empty flash when flipping).\n\t\t// Cover pages are always mounted — they are cover-sized and sit behind leaf-sized pages,\n\t\t// acting as the physical book boards. Unmounting them would remove the realistic frame effect.\n\t\tconst contentByIndex =\n\t\t\tleavesBuffer != null && totalPages > 0\n\t\t\t\t? (() => {\n\t\t\t\t\t\tconst currentLeaf = Math.floor(currentPageIndex / 2);\n\t\t\t\t\t\tconst leavesCount = Math.ceil(totalPages / 2);\n\t\t\t\t\t\tconst margin = 2; // extra leaves each side so content exists when vanilla reveals them\n\t\t\t\t\t\tconst leafStart = Math.max(0, currentLeaf - leavesBuffer - margin);\n\t\t\t\t\t\tconst leafEnd = Math.min(leavesCount - 1, currentLeaf + leavesBuffer + margin);\n\t\t\t\t\t\tconst pageStart = leafStart * 2;\n\t\t\t\t\t\tconst pageEnd = Math.min(totalPages - 1, leafEnd * 2 + 1);\n\t\t\t\t\t\tconst inRange = new Set(\n\t\t\t\t\t\t\tArray.from({ length: pageEnd - pageStart + 1 }, (_, i) => pageStart + i),\n\t\t\t\t\t\t);\n\t\t\t\t\t\t// Always include cover leaf pages so the larger cover boards remain mounted.\n\t\t\t\t\t\tfor (const idx of coverIndicesSet) {\n\t\t\t\t\t\t\tinRange.add(idx);\n\t\t\t\t\t\t\t// Also include the other side of the cover leaf\n\t\t\t\t\t\t\tconst partner = idx % 2 === 0 ? idx + 1 : idx - 1;\n\t\t\t\t\t\t\tif (partner >= 0 && partner < totalPages) {\n\t\t\t\t\t\t\t\tinRange.add(partner);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn (index: number) => (inRange.has(index) ? pagesWithKeys[index] : null);\n\t\t\t\t\t})()\n\t\t\t\t: (index: number) => pagesWithKeys[index];\n\n\t\t/** Wrap interior cover pages with the endpaper inset frame (3-sided: no inset on spine). */\n\t\tconst renderPageContent = (index: number) => {\n\t\t\tconst content = contentByIndex(index);\n\t\t\tif (interiorCoverMap.has(index)) {\n\t\t\t\t// Determine spine side: even pages (engine convention: pageIndex%2===1) are on the\n\t\t\t\t// left in LTR / right in RTL. Their spine is on the opposite side.\n\t\t\t\tconst isEvenPage = index % 2 === 1; // engine: (pageIndex+1)%2===1 → odd; so %2===1 → even\n\t\t\t\tconst spineOnRight = isEvenPage !== (direction === \"rtl\");\n\t\t\t\tconst insetStyle = {\n\t\t\t\t\t\"--cover-inset\": coverInset,\n\t\t\t\t\t...(spineOnRight ? { \"--cover-inset-right\": \"0px\" } : { \"--cover-inset-left\": \"0px\" }),\n\t\t\t\t} as Record<string, string>;\n\t\t\t\treturn (\n\t\t\t\t\t<div className=\"page--cover-interior-inset\" style={insetStyle}>\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn content;\n\t\t};\n\n\t\treturn (\n\t\t\t<div className={className}>\n\t\t\t\t{pagesWithKeys.map((_, index) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: stable slot identity for buffer/mount correctness\n\t\t\t\t\t\tkey={`page-${index}`}\n\t\t\t\t\t\tclassName={getPageClassName(index)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"flipbook-page-scrollport\">\n\t\t\t\t\t\t\t<div className=\"flipbook-page-content\" dir={direction}>\n\t\t\t\t\t\t\t\t{renderPageContent(index)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t))}\n\t\t\t\t{bookmarkSlots.map(({ key, bookmark, element, renderer }) =>\n\t\t\t\t\tcreatePortal(renderer ? renderer(bookmark) : bookmark.label, element, key),\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t},\n);\n\nFlipBookReact.displayName = \"FlipBook\";\n\nexport { FlipBookReact as FlipBook };\nexport type {\n\tBookmark,\n\tBookmarkContext,\n\tBookmarkPlacement,\n\tFlipPageSemantic,\n\tHistoryMapper,\n\tMouseMode,\n\tPageFlipParams,\n\tPageSemantics,\n} from \"html-flip-book-vanilla\";\nexport { createDefaultHistoryMapper } from \"html-flip-book-vanilla\";\nexport type { TocEntry, TocPageProps } from \"./TocPage\";\nexport { TocPage } from \"./TocPage\";\n"],"names":["defaultFilter","entry","TocPage","onNavigate","totalPages","pageSemantics","heading","className","direction","filter","getHref","renderEntry","entries","i","title","semanticName","renderDefaultEntry","onClick","href","pageOrSemantic","content","jsxs","Fragment","jsx","event","FlipBookReact","forwardRef","pages","debug","mouseMode","mouseModeStorageKey","bookmarkProvider","enableBookmarks","initialTurnedLeaves","fastDeltaThreshold","leavesBuffer","pageShadow","snapshotDuringFlip","enableHistory","enableDownload","coverConfig","of","leafAspectRatio","coverAspectRatio","handlers","historyMapper","tocPageIndex","downloadConfig","ref","currentPageIndex","setCurrentPageIndex","useState","firstVisiblePage","setPageIndexRef","useRef","bookmarkSlots","setBookmarkSlots","ofRef","BUFFER_DEBOUNCE_MS","pageChangedTimerRef","onPageChangedRef","index","useEffect","flipBook","FlipBookBase","useImperativeHandle","pageIndex","selectorClass","bar","mode","options","currentFlipBook","savedMode","previousBookmarksEnabled","active","slots","renderSlot","bookmark","expanded","key","slot","provider","context","bookmarks","ids","id","el","pagesWithKeys","Children","coverIndicesSet","isCoverPage","interiorCoverMap","coverIdx","interiorIdx","role","coverInset","getPageClassName","classes","interiorRole","cls","contentByIndex","currentLeaf","leavesCount","margin","leafStart","leafEnd","pageStart","pageEnd","inRange","_","idx","partner","renderPageContent","spineOnRight","insetStyle","element","renderer","createPortal"],"mappings":";;;;;AAiDA,MAAMA,KAAgB,CAACC,MAA6BA,EAAM,MAAM,SAAS,GAoBnEC,KAAkC,CAAC;AAAA,EACxC,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AAC,EAAC,SAAI,WAAAd,GACH,UAAA;AAAA,MAAAgF,EAAc,IAAI,CAACsB,GAAGhD,MACtB,gBAAAtC;AAAA,QAAC;AAAA,QAAA;AAAA,UAGA,WAAWyE,GAAiBnC,CAAK;AAAA,UAEjC,UAAA,gBAAAtC,EAAC,OAAA,EAAI,WAAU,4BACd,UAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,yBAAwB,KAAKf,GAC1C,UAAAwG,GAAkBnD,CAAK,GACzB,EAAA,CACD;AAAA,QAAA;AAAA,QAPK,QAAQA,CAAK;AAAA,MAAA,CASnB;AAAA,MACAN,EAAc;AAAA,QAAI,CAAC,EAAE,KAAAwB,GAAK,UAAAF,GAAU,SAAAsC,GAAS,UAAAC,EAAA,MAC7CC,GAAaD,IAAWA,EAASvC,CAAQ,IAAIA,EAAS,OAAOsC,GAASpC,CAAG;AAAA,MAAA;AAAA,IAC1E,GACD;AAAA,EAEF;AACD;AAEAtD,GAAc,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FullscreenButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/FullscreenButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FullscreenButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/FullscreenButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,UAAU,qBAAqB;IAE9B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAEhD,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAQD,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAkErD,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MouseModeButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/MouseModeButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MouseModeButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/MouseModeButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,WAAW,oBAAoB;IAEpC,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAmB1D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import { type ToggleCommandDefinition } from "../commands";
|
|
3
|
+
export interface ToggleButtonProps {
|
|
4
|
+
command: ToggleCommandDefinition;
|
|
5
|
+
ariaLabel: string;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const ToggleButton: React.FC<ToggleButtonProps>;
|
|
11
|
+
//# sourceMappingURL=ToggleButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToggleButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/ToggleButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,O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CAAC,CAAC;CAC1D;AAOD,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/toolbar/Toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGrE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAsC,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAE1E,OAAO,eAAe,CAAC;AAEvB,UAAU,YAAY;IAErB,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAEpD,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAE1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAE/B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAEhD,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC1D;AAOD,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA0HnC,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,YAAY,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/toolbar/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export type { Command, CommandDefinition, CommandOptions, HotkeyBinding } from "../commands";
|
|
2
|
-
export { defaultCommands, downloadCommand, flipNextCommand, flipPrevCommand, goToFirstCommand, goToLastCommand, goToTocCommand, toggleDebugCommand, toggleFullscreenCommand, useCommands, } from "../commands";
|
|
1
|
+
export type { ActionCommandDefinition, Command, CommandDefinition, CommandOptions, HotkeyBinding, ToggleCommandDefinition, } from "../commands";
|
|
2
|
+
export { canUseFullscreen, defaultCommands, downloadCommand, exitFullscreen, flipNextCommand, flipPrevCommand, fullscreenStateEvents, getFullscreenElement, goToFirstCommand, goToLastCommand, goToTocCommand, requestFullscreen, toggleDebugCommand, toggleFullscreenCommand, toggleTextSelectionCommand, useCommands, } from "../commands";
|
|
3
3
|
export type { DownloadConfig, DownloadResult, PageRangesDownloadContext, PageRangesDownloadHandler, SeferDownloadHandler, SemanticPageInfo, } from "../download/types";
|
|
4
|
+
export { createDefaultDownloadConfig } from "../download/types";
|
|
4
5
|
export type { IconProps } from "../icons";
|
|
5
6
|
export { BookshelfIcon, ChevronFirstIcon, ChevronLastIcon, ChevronLeftIcon, ChevronRightIcon, DownloadIcon, MaximizeIcon, MinimizeIcon, TableOfContentsIcon, } from "../icons";
|
|
6
7
|
export type { ActionButtonProps } from "./ActionButton";
|
|
@@ -25,6 +26,8 @@ export type { PrevButtonProps } from "./PrevButton";
|
|
|
25
26
|
export { PrevButton } from "./PrevButton";
|
|
26
27
|
export type { TocButtonProps } from "./TocButton";
|
|
27
28
|
export { TocButton } from "./TocButton";
|
|
29
|
+
export type { ToggleButtonProps } from "./ToggleButton";
|
|
30
|
+
export { ToggleButton } from "./ToggleButton";
|
|
28
31
|
export type { ToolbarProps } from "./Toolbar";
|
|
29
32
|
export { Toolbar } from "./Toolbar";
|
|
30
33
|
export type { ToolbarButtonProps } from "./ToolbarButton";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/toolbar/index.ts"],"names":[],"mappings":"AAEA,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","source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