html-flip-book-react 0.0.0-alpha.68 → 0.0.0-alpha.71

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.
@@ -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,MAAM,MAAM,GAAG,MAAM,CAAC;IAE7B,WAAW,EAAE,MAAM,OAAO,CAAC;IAE3B,UAAU,EAAE,MAAM,OAAO,CAAC;IAE1B,iBAAiB,EAAE,MAAM,cAAc,GAAG,SAAS,CAAC;IAEpD,eAAe,EAAE,MAAM,MAAM,CAA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AAC,EAAE,OAAO,CAAC;IAMxB,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAsBD,QAAA,MAAM,aAAa,sFAqZlB,CAAC;AAIF,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;AACpC,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,CAAC"}
package/dist/flip-book.js CHANGED
@@ -6,24 +6,24 @@ import { createPortal as fe } from "react-dom";
6
6
  const he = (k) => k.title.length > 0, Ce = ({
7
7
  onNavigate: k,
8
8
  totalPages: d,
9
- pageSemantics: T,
10
- heading: b = "Table of Contents",
9
+ pageSemantics: b,
10
+ heading: T = "Table of Contents",
11
11
  className: L,
12
12
  direction: g = "ltr",
13
- filter: $ = he,
13
+ filter: _ = he,
14
14
  getHref: p,
15
15
  renderEntry: f
16
16
  }) => {
17
17
  const C = [];
18
- for (let r = 0; r < d; r++) {
19
- const u = T?.indexToTitle(r) ?? "", h = T?.indexToSemanticName(r) ?? "", M = { pageIndex: r, title: u, semanticName: h };
20
- $(M, r) && C.push(M);
18
+ for (let n = 0; n < d; n++) {
19
+ const u = b?.indexToTitle(n) ?? "", h = b?.indexToSemanticName(n) ?? "", M = { pageIndex: n, title: u, semanticName: h };
20
+ _(M, n) && C.push(M);
21
21
  }
22
- const D = (r, u, h) => {
23
- const M = r.title || r.semanticName || `Page ${r.pageIndex + 1}`, _ = r.semanticName || String(r.pageIndex + 1), c = /* @__PURE__ */ U(ie, { children: [
22
+ const $ = (n, u, h) => {
23
+ const M = n.title || n.semanticName || `Page ${n.pageIndex + 1}`, D = n.semanticName || String(n.pageIndex + 1), c = /* @__PURE__ */ U(ie, { children: [
24
24
  /* @__PURE__ */ l("span", { className: "toc-title", children: M }),
25
25
  /* @__PURE__ */ l("span", { className: "toc-dots", "aria-hidden": !0 }),
26
- /* @__PURE__ */ l("span", { className: "toc-page-num", children: _ })
26
+ /* @__PURE__ */ l("span", { className: "toc-page-num", children: D })
27
27
  ] });
28
28
  return /* @__PURE__ */ l("li", { children: h ? /* @__PURE__ */ l(
29
29
  "a",
@@ -35,7 +35,7 @@ const he = (k) => k.title.length > 0, Ce = ({
35
35
  },
36
36
  children: c
37
37
  }
38
- ) : /* @__PURE__ */ l("button", { type: "button", className: "toc-link", onClick: u, children: c }) }, r.pageIndex);
38
+ ) : /* @__PURE__ */ l("button", { type: "button", className: "toc-link", onClick: u, children: c }) }, n.pageIndex);
39
39
  };
40
40
  return /* @__PURE__ */ l(
41
41
  "div",
@@ -43,10 +43,10 @@ const he = (k) => k.title.length > 0, Ce = ({
43
43
  className: `toc-page ${L ?? ""}`.trim(),
44
44
  style: { direction: g, textAlign: g === "rtl" ? "right" : "left" },
45
45
  children: /* @__PURE__ */ U("div", { className: "toc-page__scroll", children: [
46
- /* @__PURE__ */ l("h2", { className: "toc-heading", children: b }),
47
- /* @__PURE__ */ l("ul", { className: "toc-list", children: C.map((r) => {
48
- const u = () => k(r.pageIndex), h = p?.(r) ?? void 0;
49
- return f ? f(r, u, h) : D(r, u, h);
46
+ /* @__PURE__ */ l("h2", { className: "toc-heading", children: T }),
47
+ /* @__PURE__ */ l("ul", { className: "toc-list", children: C.map((n) => {
48
+ const u = () => k(n.pageIndex), h = p?.(n) ?? void 0;
49
+ return f ? f(n, u, h) : $(n, u, h);
50
50
  }) })
51
51
  ] })
52
52
  }
@@ -55,20 +55,20 @@ const he = (k) => k.title.length > 0, Ce = ({
55
55
  ({
56
56
  pages: k,
57
57
  className: d,
58
- debug: T = !1,
59
- direction: b = "ltr",
58
+ debug: b = !1,
59
+ direction: T = "ltr",
60
60
  mouseMode: L = "turn",
61
61
  mouseModeStorageKey: g,
62
- pageSemantics: $ = void 0,
62
+ pageSemantics: _ = void 0,
63
63
  bookmarkProvider: p,
64
64
  enableBookmarks: f = !1,
65
65
  initialTurnedLeaves: C = [],
66
- fastDeltaThreshold: D,
67
- leavesBuffer: r,
66
+ fastDeltaThreshold: $,
67
+ leavesBuffer: n,
68
68
  pageShadow: u = !0,
69
69
  snapshotDuringFlip: h = !0,
70
70
  enableHistory: M,
71
- enableDownload: _,
71
+ enableDownload: D,
72
72
  coverConfig: c,
73
73
  of: m,
74
74
  leafAspectRatio: J,
@@ -78,35 +78,35 @@ const he = (k) => k.title.length > 0, Ce = ({
78
78
  tocPageIndex: X,
79
79
  downloadConfig: Y
80
80
  }, Z) => {
81
- const [ee, q] = H(() => {
81
+ const [ee, O] = H(() => {
82
82
  if (C && C.length > 0) {
83
83
  const t = Math.max(...C) * 2 + 1;
84
84
  return t >= k.length ? (Math.ceil(k.length / 2) - 1) * 2 : t;
85
85
  }
86
86
  return 0;
87
- }), B = x(q), [te, V] = H([]);
88
- B.current = q;
89
- const O = x(m);
90
- O.current = m;
91
- const ne = 80, v = x(null), R = x(/* @__PURE__ */ new Set()), [, re] = H(0), W = x((e) => {
87
+ }), B = x(O), [te, V] = H([]);
88
+ B.current = O;
89
+ const q = x(m);
90
+ q.current = m;
91
+ const re = 80, v = x(null), R = x(/* @__PURE__ */ new Set()), [, ne] = H(0), W = x((e) => {
92
92
  B.current?.(e);
93
93
  });
94
94
  W.current = (e) => {
95
- if (v.current != null && clearTimeout(v.current), r == null) {
95
+ if (v.current != null && clearTimeout(v.current), n == null) {
96
96
  B.current?.(e);
97
97
  return;
98
98
  }
99
99
  v.current = setTimeout(() => {
100
100
  v.current = null, R.current.clear(), B.current?.(e);
101
- }, ne);
101
+ }, re);
102
102
  };
103
103
  const z = x((e) => {
104
104
  j?.onPageFlipping?.(e);
105
105
  });
106
106
  z.current = (e) => {
107
- if (r != null) {
108
- const t = e.direction === "backward" ? e.pageIndices[1] : e.pageIndices[0], n = Math.floor(t / 2);
109
- R.current.has(n) || (R.current.add(n), re((a) => a + 1));
107
+ if (n != null) {
108
+ const t = e.direction === "backward" ? e.pageIndices[1] : e.pageIndices[0], r = Math.floor(t / 2);
109
+ R.current.has(r) || (R.current.add(r), ne((a) => a + 1));
110
110
  }
111
111
  j?.onPageFlipping?.(e);
112
112
  }, w(() => () => {
@@ -114,14 +114,14 @@ const he = (k) => k.title.length > 0, Ce = ({
114
114
  }, []);
115
115
  const s = x(
116
116
  new ue({
117
- pageSemantics: $,
117
+ pageSemantics: _,
118
118
  enableBookmarks: f,
119
119
  pagesCount: k.length,
120
- direction: b,
120
+ direction: T,
121
121
  mouseMode: L,
122
122
  initialTurnedLeaves: C,
123
- fastDeltaThreshold: D,
124
- leavesBuffer: r,
123
+ fastDeltaThreshold: $,
124
+ leavesBuffer: n,
125
125
  leafAspectRatio: J,
126
126
  coverAspectRatio: K,
127
127
  coverPageIndices: c?.coverIndices,
@@ -134,7 +134,7 @@ const he = (k) => k.title.length > 0, Ce = ({
134
134
  pageShadow: u,
135
135
  snapshotDuringFlip: h,
136
136
  enableHistory: M,
137
- enableDownload: _
137
+ enableDownload: D
138
138
  })
139
139
  );
140
140
  ge(
@@ -146,12 +146,12 @@ const he = (k) => k.title.length > 0, Ce = ({
146
146
  jumpToPage: (e) => s.current.jumpToPage(e),
147
147
  restorePage: (e) => s.current.restorePage(e),
148
148
  toggleDebugBar: () => {
149
- const e = d.split(/\s+/)[0], n = document.querySelector(`.${e}`)?.querySelector(".flipbook-debug-bar");
150
- n && n.classList.toggle("flipbook-debug-bar--hidden");
149
+ const e = d.split(/\s+/)[0], r = document.querySelector(`.${e}`)?.querySelector(".flipbook-debug-bar");
150
+ r && r.classList.toggle("flipbook-debug-bar--hidden");
151
151
  },
152
152
  getCurrentPageIndex: () => s.current.currentPageIndex,
153
153
  getTotalPages: () => s.current.totalPages,
154
- getOf: () => O.current !== void 0 ? O.current : s.current.totalPages,
154
+ getOf: () => q.current !== void 0 ? q.current : s.current.totalPages,
155
155
  isFirstPage: () => s.current.isFirstPage,
156
156
  isLastPage: () => s.current.isLastPage,
157
157
  getDownloadConfig: () => s.current.getDownloadConfig(),
@@ -168,16 +168,16 @@ const he = (k) => k.title.length > 0, Ce = ({
168
168
  [d, g]
169
169
  ), w(() => {
170
170
  const e = s.current, t = d.split(/\s+/)[0];
171
- if (e.render(`.${t}`, T), g)
171
+ if (e.render(`.${t}`, b), g)
172
172
  try {
173
- const n = localStorage.getItem(g);
174
- (n === "turn" || n === "select") && e.setMouseMode(n);
173
+ const r = localStorage.getItem(g);
174
+ (r === "turn" || r === "select") && e.setMouseMode(r);
175
175
  } catch {
176
176
  }
177
- return q(e.currentPageIndex), () => {
177
+ return O(e.currentPageIndex), () => {
178
178
  e.destroy();
179
179
  };
180
- }, [d, T, g]);
180
+ }, [d, b, g]);
181
181
  const G = x(f);
182
182
  w(() => {
183
183
  G.current !== f && (G.current = f, s.current.setBookmarksEnabled(f));
@@ -188,26 +188,28 @@ const he = (k) => k.title.length > 0, Ce = ({
188
188
  return;
189
189
  }
190
190
  let t = !0;
191
- const n = /* @__PURE__ */ new Map(), a = (i, N) => {
191
+ const r = /* @__PURE__ */ new Map(), a = (i, N) => {
192
192
  const P = `${N ? "expanded" : "brief"}:${i.id}`;
193
- let o = n.get(P);
193
+ let o = r.get(P);
194
194
  return o || (o = {
195
195
  key: P,
196
196
  bookmark: i,
197
- element: document.createElement("span"),
197
+ element: Object.assign(document.createElement("span"), {
198
+ className: "flipbook-bookmark__renderer"
199
+ }),
198
200
  renderer: N ? p.renderExpandedBookmark : p.renderBookmark
199
- }, n.set(P, o)), o.bookmark = i, o.element;
201
+ }, r.set(P, o)), o.bookmark = i, o.element;
200
202
  }, S = {
201
203
  ...p,
202
204
  getBookmarks: (i) => {
203
205
  const N = p.getBookmarks(i), P = new Set(N.map((o) => o.id));
204
- for (const [o, I] of n)
205
- P.has(I.bookmark.id) || n.delete(o);
206
+ for (const [o, I] of r)
207
+ P.has(I.bookmark.id) || r.delete(o);
206
208
  return queueMicrotask(() => {
207
209
  if (t) {
208
- for (const [o, I] of n)
209
- I.element.isConnected || n.delete(o);
210
- V([...n.values()]);
210
+ for (const [o, I] of r)
211
+ I.element.isConnected || r.delete(o);
212
+ V([...r.values()]);
211
213
  }
212
214
  }), N;
213
215
  },
@@ -228,22 +230,22 @@ const he = (k) => k.title.length > 0, Ce = ({
228
230
  for (const e of E) {
229
231
  const t = e % 2 === 0 ? e + 1 : e - 1;
230
232
  if (t >= 0 && t < F && !E.has(t)) {
231
- const n = e === Math.min(...E) ? "front" : "back";
232
- A.set(t, n);
233
+ const r = e === Math.min(...E) ? "front" : "back";
234
+ A.set(t, r);
233
235
  }
234
236
  }
235
237
  const se = c?.coverInset ?? "5%", ce = (e) => {
236
238
  const t = ["page"];
237
239
  oe(e) && (t.push("page--cover"), c?.hardCovers && t.push("page--hard"), c?.noShadow && t.push("page--no-shadow"));
238
- const n = A.get(e);
239
- if (n) {
240
+ const r = A.get(e);
241
+ if (r) {
240
242
  t.push("page--cover-interior");
241
- const a = n === "front" ? c?.frontInteriorCoverClassName ?? c?.interiorCoverClassName : c?.backInteriorCoverClassName ?? c?.interiorCoverClassName;
243
+ const a = r === "front" ? c?.frontInteriorCoverClassName ?? c?.interiorCoverClassName : c?.backInteriorCoverClassName ?? c?.interiorCoverClassName;
242
244
  a && t.push(a);
243
245
  }
244
246
  return t.join(" ");
245
- }, ae = r != null && F > 0 ? (() => {
246
- const e = Math.floor(ee / 2), t = Math.ceil(F / 2), n = 2, a = Math.max(0, e - r - n), S = Math.min(t - 1, e + r + n), i = a * 2, N = Math.min(F - 1, S * 2 + 1), P = new Set(
247
+ }, ae = n != null && F > 0 ? (() => {
248
+ const e = Math.floor(ee / 2), t = Math.ceil(F / 2), r = 2, a = Math.max(0, e - n - r), S = Math.min(t - 1, e + n + r), i = a * 2, N = Math.min(F - 1, S * 2 + 1), P = new Set(
247
249
  Array.from({ length: N - i + 1 }, (o, I) => i + I)
248
250
  );
249
251
  for (const o of E) {
@@ -255,7 +257,7 @@ const he = (k) => k.title.length > 0, Ce = ({
255
257
  })() : (e) => y.at(e) ?? null, le = (e) => {
256
258
  const t = ae(e);
257
259
  if (A.has(e)) {
258
- const a = e % 2 === 1 !== (b === "rtl"), S = {
260
+ const a = e % 2 === 1 !== (T === "rtl"), S = {
259
261
  "--cover-inset": se,
260
262
  ...a ? { "--cover-inset-right": "0px" } : { "--cover-inset-left": "0px" }
261
263
  };
@@ -268,12 +270,12 @@ const he = (k) => k.title.length > 0, Ce = ({
268
270
  "div",
269
271
  {
270
272
  className: ce(t),
271
- children: /* @__PURE__ */ l("div", { className: "flipbook-page-scrollport", children: /* @__PURE__ */ l("div", { className: "flipbook-page-content", dir: b, children: le(t) }) })
273
+ children: /* @__PURE__ */ l("div", { className: "flipbook-page-scrollport", children: /* @__PURE__ */ l("div", { className: "flipbook-page-content", dir: T, children: le(t) }) })
272
274
  },
273
275
  `page-${t}`
274
276
  )),
275
277
  te.map(
276
- ({ key: e, bookmark: t, element: n, renderer: a }) => fe(a ? a(t) : t.label, n, e)
278
+ ({ key: e, bookmark: t, element: r, renderer: a }) => fe(a ? a(t) : t.label, r, e)
277
279
  )
278
280
  ] });
279
281
  }
@@ -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, 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\t// Leaves whose flip animation is in flight. The base keeps their page\n\t\t// wrappers visible even outside the leavesBuffer window, so their content\n\t\t// must stay mounted too — otherwise a revealed flipping page renders blank\n\t\t// (issue #167). Cleared once flips settle and the buffer window recenters.\n\t\tconst inflightLeavesRef = useRef<Set<number>>(new Set());\n\t\tconst [, setInflightVersion] = useState(0);\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\tinflightLeavesRef.current.clear();\n\t\t\t\tsetPageIndexRef.current?.(index);\n\t\t\t}, BUFFER_DEBOUNCE_MS);\n\t\t};\n\t\tconst onPageFlippingRef = useRef((params: PageFlipParams) => {\n\t\t\thandlers?.onPageFlipping?.(params);\n\t\t});\n\t\tonPageFlippingRef.current = (params) => {\n\t\t\tif (leavesBuffer != null) {\n\t\t\t\t// The flipping leaf holds the page on the trailing edge of the target\n\t\t\t\t// spread: backward flips carry pageIndices[1] on their back, forward\n\t\t\t\t// flips carry pageIndices[0] on their front.\n\t\t\t\tconst edgePage =\n\t\t\t\t\tparams.direction === \"backward\" ? params.pageIndices[1] : params.pageIndices[0];\n\t\t\t\tconst flippingLeaf = Math.floor(edgePage / 2);\n\t\t\t\tif (!inflightLeavesRef.current.has(flippingLeaf)) {\n\t\t\t\t\tinflightLeavesRef.current.add(flippingLeaf);\n\t\t\t\t\tsetInflightVersion((v) => v + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\thandlers?.onPageFlipping?.(params);\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: (params) => onPageFlippingRef.current(params),\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) =>\n\t\t\t\t\t\t\tinRange.has(index) || inflightLeavesRef.current.has(Math.floor(index / 2))\n\t\t\t\t\t\t\t\t? (pagesWithKeys.at(index) ?? null)\n\t\t\t\t\t\t\t\t: null;\n\t\t\t\t\t})()\n\t\t\t\t: (index: number) => pagesWithKeys.at(index) ?? null;\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 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\";\nexport { FlipBookReact as FlipBook };\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","inflightLeavesRef","setInflightVersion","onPageChangedRef","index","onPageFlippingRef","params","edgePage","flippingLeaf","v","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,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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AA6B,OAAOC,GACjD,UAAArG,GACF;AAAA,MAEF;AACA,aAAOA;AAAA,IACR;AAEA,WACC,gBAAAC,EAAC,SAAI,WAAAd,GACH,UAAA;AAAA,MAAAuF,EAAc,IAAI,CAACsB,GAAGrD,MACtB,gBAAAxC;AAAA,QAAC;AAAA,QAAA;AAAA,UAGA,WAAWgF,GAAiBxC,CAAK;AAAA,UAEjC,UAAA,gBAAAxC,EAAC,OAAA,EAAI,WAAU,4BACd,UAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,yBAAwB,KAAKf,GAC1C,UAAA+G,GAAkBxD,CAAK,GACzB,EAAA,CACD;AAAA,QAAA;AAAA,QAPK,QAAQA,CAAK;AAAA,MAAA,CASnB;AAAA,MACAR,GAAc;AAAA,QAAI,CAAC,EAAE,KAAA+B,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;AAEA7D,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\t// Leaves whose flip animation is in flight. The base keeps their page\n\t\t// wrappers visible even outside the leavesBuffer window, so their content\n\t\t// must stay mounted too — otherwise a revealed flipping page renders blank\n\t\t// (issue #167). Cleared once flips settle and the buffer window recenters.\n\t\tconst inflightLeavesRef = useRef<Set<number>>(new Set());\n\t\tconst [, setInflightVersion] = useState(0);\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\tinflightLeavesRef.current.clear();\n\t\t\t\tsetPageIndexRef.current?.(index);\n\t\t\t}, BUFFER_DEBOUNCE_MS);\n\t\t};\n\t\tconst onPageFlippingRef = useRef((params: PageFlipParams) => {\n\t\t\thandlers?.onPageFlipping?.(params);\n\t\t});\n\t\tonPageFlippingRef.current = (params) => {\n\t\t\tif (leavesBuffer != null) {\n\t\t\t\t// The flipping leaf holds the page on the trailing edge of the target\n\t\t\t\t// spread: backward flips carry pageIndices[1] on their back, forward\n\t\t\t\t// flips carry pageIndices[0] on their front.\n\t\t\t\tconst edgePage =\n\t\t\t\t\tparams.direction === \"backward\" ? params.pageIndices[1] : params.pageIndices[0];\n\t\t\t\tconst flippingLeaf = Math.floor(edgePage / 2);\n\t\t\t\tif (!inflightLeavesRef.current.has(flippingLeaf)) {\n\t\t\t\t\tinflightLeavesRef.current.add(flippingLeaf);\n\t\t\t\t\tsetInflightVersion((v) => v + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\thandlers?.onPageFlipping?.(params);\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: (params) => onPageFlippingRef.current(params),\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: Object.assign(document.createElement(\"span\"), {\n\t\t\t\t\t\t\tclassName: \"flipbook-bookmark__renderer\",\n\t\t\t\t\t\t}),\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) =>\n\t\t\t\t\t\t\tinRange.has(index) || inflightLeavesRef.current.has(Math.floor(index / 2))\n\t\t\t\t\t\t\t\t? (pagesWithKeys.at(index) ?? null)\n\t\t\t\t\t\t\t\t: null;\n\t\t\t\t\t})()\n\t\t\t\t: (index: number) => pagesWithKeys.at(index) ?? null;\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 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\";\nexport { FlipBookReact as FlipBook };\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","inflightLeavesRef","setInflightVersion","onPageChangedRef","index","onPageFlippingRef","params","edgePage","flippingLeaf","v","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,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,gBAAg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WAAU,8BAA6B,OAAOC,GACjD,UAAArG,GACF;AAAA,MAEF;AACA,aAAOA;AAAA,IACR;AAEA,WACC,gBAAAC,EAAC,SAAI,WAAAd,GACH,UAAA;AAAA,MAAAuF,EAAc,IAAI,CAACsB,GAAGrD,MACtB,gBAAAxC;AAAA,QAAC;AAAA,QAAA;AAAA,UAGA,WAAWgF,GAAiBxC,CAAK;AAAA,UAEjC,UAAA,gBAAAxC,EAAC,OAAA,EAAI,WAAU,4BACd,UAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,yBAAwB,KAAKf,GAC1C,UAAA+G,GAAkBxD,CAAK,GACzB,EAAA,CACD;AAAA,QAAA;AAAA,QAPK,QAAQA,CAAK;AAAA,MAAA,CASnB;AAAA,MACAR,GAAc;AAAA,QAAI,CAAC,EAAE,KAAA+B,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;AAEA7D,GAAc,cAAc;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "html-flip-book-react",
3
3
  "description": "Flip Book React Component",
4
- "version": "0.0.0-alpha.68",
4
+ "version": "0.0.0-alpha.71",
5
5
  "type": "module",
6
6
  "author": "DoradSoft",
7
7
  "main": "./dist/flip-book.js",
@@ -39,7 +39,7 @@
39
39
  "react-dom": "^18.0.0 || ^19.0.0"
40
40
  },
41
41
  "dependencies": {
42
- "html-flip-book-vanilla": "0.0.0-alpha.68"
42
+ "html-flip-book-vanilla": "0.0.0-alpha.71"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/react": "^19.2.13",