html-flip-book-react 0.0.0-alpha.28 → 0.0.0-alpha.31

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,EAEN,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,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,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;CACpD;AAKD,MAAM,WAAW,WAAW;IAM3B,UAAU,CAAC,EAAE,OAAO,CAAC;IAKrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAMnB,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAMjC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAIhC,2BAA2B,CAAC,EAAE,MAAM,CAAC;IAIrC,0BAA0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AC;AAIF,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,CAAC;AACrC,YAAY,EACX,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,aAAa,GACb,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
package/dist/flip-book.js CHANGED
@@ -1,155 +1,161 @@
1
1
  import { jsx as a, jsxs as j } from "react/jsx-runtime";
2
- import { FlipBook as Q } from "html-flip-book-vanilla";
3
- import { forwardRef as U, useState as V, useRef as R, useImperativeHandle as X, useEffect as B, Children as Y } from "react";
4
- const Z = (p) => p.title.length > 0, re = ({
5
- onNavigate: p,
2
+ import { FlipBook as J } from "html-flip-book-vanilla";
3
+ import { forwardRef as Q, useState as U, useRef as y, useImperativeHandle as X, useEffect as B, Children as Y } from "react";
4
+ const Z = (i) => i.title.length > 0, se = ({
5
+ onNavigate: i,
6
6
  totalPages: c,
7
- pageSemantics: f,
7
+ pageSemantics: P,
8
8
  heading: v = "Table of Contents",
9
9
  className: N,
10
- direction: x = "ltr",
10
+ direction: g = "ltr",
11
11
  filter: b = Z,
12
- renderEntry: l
12
+ renderEntry: p
13
13
  }) => {
14
- const g = [];
15
- for (let o = 0; o < c; o++) {
16
- const n = f?.indexToTitle(o) ?? "", d = f?.indexToSemanticName(o) ?? "", u = { pageIndex: o, title: n, semanticName: d };
17
- b(u, o) && g.push(u);
14
+ const d = [];
15
+ for (let r = 0; r < c; r++) {
16
+ const n = P?.indexToTitle(r) ?? "", u = P?.indexToSemanticName(r) ?? "", h = { pageIndex: r, title: n, semanticName: u };
17
+ b(h, r) && d.push(h);
18
18
  }
19
- const k = (o, n) => {
20
- const d = o.title || o.semanticName || `Page ${o.pageIndex + 1}`, u = o.semanticName || String(o.pageIndex + 1);
19
+ const k = (r, n) => {
20
+ const u = r.title || r.semanticName || `Page ${r.pageIndex + 1}`, h = r.semanticName || String(r.pageIndex + 1);
21
21
  return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ j("button", { type: "button", className: "toc-link", onClick: n, children: [
22
- /* @__PURE__ */ a("span", { className: "toc-title", children: d }),
22
+ /* @__PURE__ */ a("span", { className: "toc-title", children: u }),
23
23
  /* @__PURE__ */ a("span", { className: "toc-dots", "aria-hidden": !0 }),
24
- /* @__PURE__ */ a("span", { className: "toc-page-num", children: u })
25
- ] }) }, o.pageIndex);
24
+ /* @__PURE__ */ a("span", { className: "toc-page-num", children: h })
25
+ ] }) }, r.pageIndex);
26
26
  };
27
27
  return /* @__PURE__ */ a(
28
28
  "div",
29
29
  {
30
30
  className: `toc-page ${N ?? ""}`.trim(),
31
- style: { direction: x, textAlign: x === "rtl" ? "right" : "left" },
31
+ style: { direction: g, textAlign: g === "rtl" ? "right" : "left" },
32
32
  children: /* @__PURE__ */ j("div", { className: "toc-page__scroll", children: [
33
33
  /* @__PURE__ */ a("h2", { className: "toc-heading", children: v }),
34
- /* @__PURE__ */ a("ul", { className: "toc-list", children: g.map((o) => {
35
- const n = () => p(o.pageIndex);
36
- return l ? l(o, n) : k(o, n);
34
+ /* @__PURE__ */ a("ul", { className: "toc-list", children: d.map((r) => {
35
+ const n = () => i(r.pageIndex);
36
+ return p ? p(r, n) : k(r, n);
37
37
  }) })
38
38
  ] })
39
39
  }
40
40
  );
41
- }, ee = U(
41
+ }, ee = Q(
42
42
  ({
43
- pages: p,
43
+ pages: i,
44
44
  className: c,
45
- debug: f = !1,
45
+ debug: P = !1,
46
46
  direction: v = "ltr",
47
47
  pageSemantics: N = void 0,
48
- initialTurnedLeaves: x = [],
48
+ initialTurnedLeaves: g = [],
49
49
  fastDeltaThreshold: b,
50
- leavesBuffer: l,
51
- pageShadow: g = !0,
50
+ leavesBuffer: p,
51
+ pageShadow: d = !0,
52
52
  enableHistory: k,
53
- enableDownload: o,
53
+ enableDownload: r,
54
54
  coverConfig: n,
55
- of: d,
56
- leafAspectRatio: u,
55
+ of: u,
56
+ leafAspectRatio: h,
57
57
  coverAspectRatio: E,
58
- handlers: y,
58
+ handlers: L,
59
59
  historyMapper: D,
60
60
  tocPageIndex: _,
61
61
  downloadConfig: q
62
62
  }, A) => {
63
- const [O, F] = V(0), L = R(F);
64
- L.current = F;
65
- const S = R(d);
66
- S.current = d;
67
- const r = R(
68
- new Q({
63
+ const [O, F] = U(() => {
64
+ if (g && g.length > 0) {
65
+ const t = (Math.max(...g) + 1) * 2;
66
+ return t >= i.length ? (Math.ceil(i.length / 2) - 1) * 2 : t;
67
+ }
68
+ return 0;
69
+ }), T = y(F);
70
+ T.current = F;
71
+ const S = y(u);
72
+ S.current = u;
73
+ const o = y(
74
+ new J({
69
75
  pageSemantics: N,
70
- pagesCount: p.length,
76
+ pagesCount: i.length,
71
77
  direction: v,
72
- initialTurnedLeaves: x,
78
+ initialTurnedLeaves: g,
73
79
  fastDeltaThreshold: b,
74
- leavesBuffer: l,
75
- leafAspectRatio: u,
80
+ leavesBuffer: p,
81
+ leafAspectRatio: h,
76
82
  coverAspectRatio: E,
77
83
  coverPageIndices: n?.coverIndices,
78
- onPageChanged: (e) => L.current?.(e),
79
- onPageFlipping: y?.onPageFlipping,
80
- onPageFlipped: y?.onPageFlipped,
84
+ onPageChanged: (e) => T.current?.(e),
85
+ onPageFlipping: L?.onPageFlipping,
86
+ onPageFlipped: L?.onPageFlipped,
81
87
  historyMapper: D,
82
88
  tocPageIndex: _ ?? 4,
83
89
  downloadConfig: q,
84
- pageShadow: g,
90
+ pageShadow: d,
85
91
  enableHistory: k,
86
- enableDownload: o
92
+ enableDownload: r
87
93
  })
88
94
  );
89
95
  X(
90
96
  A,
91
97
  () => ({
92
- flipNext: () => r.current.flipNext(),
93
- flipPrev: () => r.current.flipPrev(),
94
- flipToPage: (e) => r.current.flipToPage(e),
95
- jumpToPage: (e) => r.current.jumpToPage(e),
98
+ flipNext: () => o.current.flipNext(),
99
+ flipPrev: () => o.current.flipPrev(),
100
+ flipToPage: (e) => o.current.flipToPage(e),
101
+ jumpToPage: (e) => o.current.jumpToPage(e),
96
102
  toggleDebugBar: () => {
97
103
  const e = c.split(/\s+/)[0], s = document.querySelector(`.${e}`)?.querySelector(".flipbook-debug-bar");
98
104
  s && s.classList.toggle("flipbook-debug-bar--hidden");
99
105
  },
100
- getCurrentPageIndex: () => r.current.currentPageIndex,
101
- getTotalPages: () => r.current.totalPages,
102
- getOf: () => S.current !== void 0 ? S.current : r.current.totalPages,
103
- isFirstPage: () => r.current.isFirstPage,
104
- isLastPage: () => r.current.isLastPage,
105
- getDownloadConfig: () => r.current.getDownloadConfig()
106
+ getCurrentPageIndex: () => o.current.currentPageIndex,
107
+ getTotalPages: () => o.current.totalPages,
108
+ getOf: () => S.current !== void 0 ? S.current : o.current.totalPages,
109
+ isFirstPage: () => o.current.isFirstPage,
110
+ isLastPage: () => o.current.isLastPage,
111
+ getDownloadConfig: () => o.current.getDownloadConfig()
106
112
  }),
107
113
  [c]
108
114
  ), B(() => {
109
- const e = r.current, t = c.split(/\s+/)[0];
110
- return e.render(`.${t}`, f), F(e.currentPageIndex), () => {
115
+ const e = o.current, t = c.split(/\s+/)[0];
116
+ return e.render(`.${t}`, P), F(e.currentPageIndex), () => {
111
117
  e.destroy();
112
118
  };
113
- }, [c, f]), B(() => {
119
+ }, [c, P]), B(() => {
114
120
  const e = c.split(/\s+/)[0], t = document.querySelector(`.${e}`);
115
- t && (g ? t.classList.remove("flipbook--no-page-shadow") : t.classList.add("flipbook--no-page-shadow"));
116
- }, [c, g]);
117
- const C = Y.toArray(p), h = C.length, P = new Set(
118
- n?.coverIndices === "auto" ? [0, h - 1] : n?.coverIndices ?? [0]
119
- ), H = (e) => P.has(e), T = /* @__PURE__ */ new Map();
121
+ t && (d ? t.classList.remove("flipbook--no-page-shadow") : t.classList.add("flipbook--no-page-shadow"));
122
+ }, [c, d]);
123
+ const C = Y.toArray(i), f = C.length, I = new Set(
124
+ n?.coverIndices === "auto" ? [0, f - 1] : n?.coverIndices ?? [0]
125
+ ), V = (e) => I.has(e), M = /* @__PURE__ */ new Map();
120
126
  if (n?.interiorCoverClassName || n?.frontInteriorCoverClassName || n?.backInteriorCoverClassName)
121
- for (const e of P) {
127
+ for (const e of I) {
122
128
  const t = e % 2 === 0 ? e + 1 : e - 1;
123
- if (t >= 0 && t < h && !P.has(t)) {
124
- const s = e === Math.min(...P) ? "front" : "back";
125
- T.set(t, s);
129
+ if (t >= 0 && t < f && !I.has(t)) {
130
+ const s = e === Math.min(...I) ? "front" : "back";
131
+ M.set(t, s);
126
132
  }
127
133
  }
128
- const K = n?.coverInset ?? "5%", W = (e) => {
134
+ const H = n?.coverInset ?? "5%", K = (e) => {
129
135
  const t = ["page"];
130
- H(e) && (t.push("page--cover"), n?.hardCovers && t.push("page--hard"), n?.noShadow && t.push("page--no-shadow"));
131
- const s = T.get(e);
136
+ V(e) && (t.push("page--cover"), n?.hardCovers && t.push("page--hard"), n?.noShadow && t.push("page--no-shadow"));
137
+ const s = M.get(e);
132
138
  if (s) {
133
139
  t.push("page--cover-interior");
134
140
  const m = s === "front" ? n?.frontInteriorCoverClassName ?? n?.interiorCoverClassName : n?.backInteriorCoverClassName ?? n?.interiorCoverClassName;
135
141
  m && t.push(m);
136
142
  }
137
143
  return t.join(" ");
138
- }, z = l != null && h > 0 ? (() => {
139
- const e = Math.floor(O / 2), t = Math.ceil(h / 2), s = 2, m = Math.max(0, e - l - s), w = Math.min(t - 1, e + l + s), $ = m * 2, J = Math.min(h - 1, w * 2 + 1), M = new Set(
140
- Array.from({ length: J - $ + 1 }, (i, I) => $ + I)
144
+ }, W = p != null && f > 0 ? (() => {
145
+ const e = Math.floor(O / 2), t = Math.ceil(f / 2), s = 2, m = Math.max(0, e - p - s), w = Math.min(t - 1, e + p + s), $ = m * 2, G = Math.min(f - 1, w * 2 + 1), R = new Set(
146
+ Array.from({ length: G - $ + 1 }, (l, x) => $ + x)
141
147
  );
142
- for (const i of P) {
143
- M.add(i);
144
- const I = i % 2 === 0 ? i + 1 : i - 1;
145
- I >= 0 && I < h && M.add(I);
148
+ for (const l of I) {
149
+ R.add(l);
150
+ const x = l % 2 === 0 ? l + 1 : l - 1;
151
+ x >= 0 && x < f && R.add(x);
146
152
  }
147
- return (i) => M.has(i) ? C[i] : null;
148
- })() : (e) => C[e], G = (e) => {
149
- const t = z(e);
150
- if (T.has(e)) {
153
+ return (l) => R.has(l) ? C[l] : null;
154
+ })() : (e) => C[e], z = (e) => {
155
+ const t = W(e);
156
+ if (M.has(e)) {
151
157
  const m = e % 2 === 1 !== (v === "rtl"), w = {
152
- "--cover-inset": K,
158
+ "--cover-inset": H,
153
159
  ...m ? { "--cover-inset-right": "0px" } : { "--cover-inset-left": "0px" }
154
160
  };
155
161
  return /* @__PURE__ */ a("div", { className: "page--cover-interior-inset", style: w, children: t });
@@ -159,8 +165,8 @@ const Z = (p) => p.title.length > 0, re = ({
159
165
  return /* @__PURE__ */ a("div", { className: c, children: C.map((e, t) => /* @__PURE__ */ a(
160
166
  "div",
161
167
  {
162
- className: W(t),
163
- children: G(t)
168
+ className: K(t),
169
+ children: z(t)
164
170
  },
165
171
  `page-${t}`
166
172
  )) });
@@ -169,6 +175,6 @@ const Z = (p) => p.title.length > 0, re = ({
169
175
  ee.displayName = "FlipBook";
170
176
  export {
171
177
  ee as FlipBook,
172
- re as TocPage
178
+ se as TocPage
173
179
  };
174
180
  //# sourceMappingURL=flip-book.js.map
@@ -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/**\n\t * Custom render function for TOC entries.\n\t * If not provided, uses default rendering.\n\t */\n\trenderEntry?: (entry: TocEntry, onClick: () => void) => 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\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) => {\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\treturn (\n\t\t\t<li key={entry.pageIndex}>\n\t\t\t\t<button type=\"button\" className=\"toc-link\" onClick={onClick}>\n\t\t\t\t\t<span className=\"toc-title\">{title}</span>\n\t\t\t\t\t<span className=\"toc-dots\" aria-hidden />\n\t\t\t\t\t<span className=\"toc-page-num\">{pageOrSemantic}</span>\n\t\t\t\t</button>\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\treturn renderEntry ? renderEntry(entry, onClick) : renderDefaultEntry(entry, onClick);\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\tFlipBook as FlipBookBase,\n\ttype HistoryMapper,\n\ttype PageFlipParams,\n\ttype PageSemantics,\n} from \"html-flip-book-vanilla\";\nimport type { DownloadConfig } from \"html-flip-book-vanilla/download\";\nimport type React from \"react\";\nimport { Children, forwardRef, useEffect, useImperativeHandle, useRef, useState } from \"react\";\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/** 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}\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/** 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/** 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 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\tpageSemantics = undefined,\n\t\t\tinitialTurnedLeaves = [],\n\t\t\tfastDeltaThreshold,\n\t\t\tleavesBuffer,\n\t\t\tpageShadow = 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(0);\n\t\tconst setPageIndexRef = useRef(setCurrentPageIndex);\n\t\tsetPageIndexRef.current = setCurrentPageIndex;\n\t\tconst ofRef = useRef(of);\n\t\tofRef.current = of;\n\n\t\tconst flipBook = useRef(\n\t\t\tnew FlipBookBase({\n\t\t\t\tpageSemantics: pageSemantics,\n\t\t\t\tpagesCount: pages.length,\n\t\t\t\tdirection: direction,\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) => setPageIndexRef.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\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\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}),\n\t\t\t[className],\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\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]);\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{renderPageContent(index)}\n\t\t\t\t\t</div>\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\tFlipPageSemantic,\n\tHistoryMapper,\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","renderEntry","entries","i","title","semanticName","renderDefaultEntry","onClick","pageOrSemantic","jsx","jsxs","FlipBookReact","forwardRef","pages","debug","initialTurnedLeaves","fastDeltaThreshold","leavesBuffer","pageShadow","enableHistory","enableDownload","coverConfig","of","leafAspectRatio","coverAspectRatio","handlers","historyMapper","tocPageIndex","downloadConfig","ref","currentPageIndex","setCurrentPageIndex","useState","setPageIndexRef","useRef","ofRef","flipBook","FlipBookBase","index","useImperativeHandle","pageIndex","selectorClass","bar","useEffect","currentFlipBook","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","content","spineOnRight","insetStyle"],"mappings":";;;AA+CA,MAAMA,IAAgB,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,aAAAU;AACD,MAAM;AAEL,QAAMC,IAAsB,CAAA;AAC5B,WAASC,IAAI,GAAGA,IAAIR,GAAYQ,KAAK;AACpC,UAAMC,IAAQR,GAAe,aAAaO,CAAC,KAAK,IAC1CE,IAAeT,GAAe,oBAAoBO,CAAC,KAAK,IACxDX,IAAkB,EAAE,WAAWW,GAAG,OAAAC,GAAO,cAAAC,EAAA;AAE/C,IAAIL,EAAOR,GAAOW,CAAC,KAClBD,EAAQ,KAAKV,CAAK;AAAA,EAEpB;AAEA,QAAMc,IAAqB,CAACd,GAAiBe,MAAwB;AAEpE,UAAMH,IAAQZ,EAAM,SAASA,EAAM,gBAAgB,QA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,GAClDG,IAAU,IAAI;AAAA,QACnB,MAAM,KAAK,EAAE,QAAQD,IAAUD,IAAY,EAAA,GAAK,CAACG,GAAGjE,MAAM8D,IAAY9D,CAAC;AAAA,MAAA;AAGxE,iBAAWkE,KAAOrB,GAAiB;AAClC,QAAAmB,EAAQ,IAAIE,CAAG;AAEf,cAAMC,IAAUD,IAAM,MAAM,IAAIA,IAAM,IAAIA,IAAM;AAChD,QAAIC,KAAW,KAAKA,IAAU3E,KAC7BwE,EAAQ,IAAIG,CAAO;AAAA,MAErB;AACA,aAAO,CAAChC,MAAmB6B,EAAQ,IAAI7B,CAAK,IAAIQ,EAAcR,CAAK,IAAI;AAAA,IACxE,OACC,CAACA,MAAkBQ,EAAcR,CAAK,GAGpCiC,IAAoB,CAACjC,MAAkB;AAC5C,YAAMkC,IAAUb,EAAerB,CAAK;AACpC,UAAIY,EAAiB,IAAIZ,CAAK,GAAG;AAIhC,cAAMmC,IADanC,IAAQ,MAAM,OACIvC,MAAc,QAC7C2E,IAAa;AAAA,UAClB,iBAAiBpB;AAAA,UACjB,GAAImB,IAAe,EAAE,uBAAuB,UAAU,EAAE,sBAAsB,MAAA;AAAA,QAAM;AAErF,iCACE,OAAA,EAAI,WAAU,8BAA6B,OAAOC,GACjD,UAAAF,GACF;AAAA,MAEF;AACA,aAAOA;AAAA,IACR;AAEA,6BACE,OAAA,EAAI,WAAA1E,GACH,YAAc,IAAI,CAACsE,GAAG9B,MACtB,gBAAA7B;AAAA,MAAC;AAAA,MAAA;AAAA,QAGA,WAAW8C,EAAiBjB,CAAK;AAAA,QAEhC,YAAkBA,CAAK;AAAA,MAAA;AAAA,MAHnB,QAAQA,CAAK;AAAA,IAAA,CAKnB,GACF;AAAA,EAEF;AACD;AAEA3B,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/**\n\t * Custom render function for TOC entries.\n\t * If not provided, uses default rendering.\n\t */\n\trenderEntry?: (entry: TocEntry, onClick: () => void) => 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\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) => {\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\treturn (\n\t\t\t<li key={entry.pageIndex}>\n\t\t\t\t<button type=\"button\" className=\"toc-link\" onClick={onClick}>\n\t\t\t\t\t<span className=\"toc-title\">{title}</span>\n\t\t\t\t\t<span className=\"toc-dots\" aria-hidden />\n\t\t\t\t\t<span className=\"toc-page-num\">{pageOrSemantic}</span>\n\t\t\t\t</button>\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\treturn renderEntry ? renderEntry(entry, onClick) : renderDefaultEntry(entry, onClick);\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\tFlipBook as FlipBookBase,\n\ttype HistoryMapper,\n\ttype PageFlipParams,\n\ttype PageSemantics,\n} from \"html-flip-book-vanilla\";\nimport type { DownloadConfig } from \"html-flip-book-vanilla/download\";\nimport type React from \"react\";\nimport { Children, forwardRef, useEffect, useImperativeHandle, useRef, useState } from \"react\";\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/** 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}\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/** 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/** 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 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\tpageSemantics = undefined,\n\t\t\tinitialTurnedLeaves = [],\n\t\t\tfastDeltaThreshold,\n\t\t\tleavesBuffer,\n\t\t\tpageShadow = 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\tif (initialTurnedLeaves && initialTurnedLeaves.length > 0) {\n\t\t\t\tconst firstVisibleLeaf = Math.max(...initialTurnedLeaves) + 1;\n\t\t\t\tconst firstVisiblePage = firstVisibleLeaf * 2;\n\t\t\t\tif (firstVisiblePage >= pages.length) {\n\t\t\t\t\t// All leaves turned – show last leaf\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\tsetPageIndexRef.current = setCurrentPageIndex;\n\t\tconst ofRef = useRef(of);\n\t\tofRef.current = of;\n\n\t\tconst flipBook = useRef(\n\t\t\tnew FlipBookBase({\n\t\t\t\tpageSemantics: pageSemantics,\n\t\t\t\tpagesCount: pages.length,\n\t\t\t\tdirection: direction,\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) => setPageIndexRef.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\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\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}),\n\t\t\t[className],\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\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]);\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{renderPageContent(index)}\n\t\t\t\t\t</div>\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\tFlipPageSemantic,\n\tHistoryMapper,\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","renderEntry","entries","i","title","semanticName","renderDefaultEntry","onClick","pageOrSemantic","jsx","jsxs","FlipBookReact","forwardRef","pages","debug","initialTurnedLeaves","fastDeltaThreshold","leavesBuffer","pageShadow","enableHistory","enableDownload","coverConfig","of","leafAspectRatio","coverAspectRatio","handlers","historyMapper","tocPageIndex","downloadConfig","ref","currentPageIndex","setCurrentPageIndex","useState","firstVisiblePage","setPageIndexRef","useRef","ofRef","flipBook","FlipBookBase","index","useImperativeHandle","pageIndex","selectorClass","bar","useEffect","currentFlipBook","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","content","sp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AAA,MAErB;AACA,aAAO,CAAChC,MAAmB6B,EAAQ,IAAI7B,CAAK,IAAIQ,EAAcR,CAAK,IAAI;AAAA,IACxE,OACC,CAACA,MAAkBQ,EAAcR,CAAK,GAGpCiC,IAAoB,CAACjC,MAAkB;AAC5C,YAAMkC,IAAUb,EAAerB,CAAK;AACpC,UAAIY,EAAiB,IAAIZ,CAAK,GAAG;AAIhC,cAAMmC,IADanC,IAAQ,MAAM,OACIxC,MAAc,QAC7C4E,IAAa;AAAA,UAClB,iBAAiBpB;AAAA,UACjB,GAAImB,IAAe,EAAE,uBAAuB,UAAU,EAAE,sBAAsB,MAAA;AAAA,QAAM;AAErF,iCACE,OAAA,EAAI,WAAU,8BAA6B,OAAOC,GACjD,UAAAF,GACF;AAAA,MAEF;AACA,aAAOA;AAAA,IACR;AAEA,6BACE,OAAA,EAAI,WAAA3E,GACH,YAAc,IAAI,CAACuE,GAAG9B,MACtB,gBAAA9B;AAAA,MAAC;AAAA,MAAA;AAAA,QAGA,WAAW+C,EAAiBjB,CAAK;AAAA,QAEhC,YAAkBA,CAAK;AAAA,MAAA;AAAA,MAHnB,QAAQA,CAAK;AAAA,IAAA,CAKnB,GACF;AAAA,EAEF;AACD;AAEA5B,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.28",
4
+ "version": "0.0.0-alpha.31",
5
5
  "type": "module",
6
6
  "author": "DoradSoft",
7
7
  "main": "./dist/flip-book.js",
@@ -38,7 +38,7 @@
38
38
  "react-dom": "^18.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "html-flip-book-vanilla": "0.0.0-alpha.28"
41
+ "html-flip-book-vanilla": "0.0.0-alpha.31"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/react": "^19.2.13",