html-flip-book-react 0.0.0-alpha.19 → 0.0.0-alpha.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FlipBook.d.ts +8 -0
- package/dist/FlipBook.d.ts.map +1 -1
- package/dist/TocPage.d.ts +21 -0
- package/dist/TocPage.d.ts.map +1 -0
- package/dist/assets/html-flip-book.css +1 -1
- package/dist/commands/CommandContext.d.ts +23 -0
- package/dist/commands/CommandContext.d.ts.map +1 -0
- package/dist/commands/defaultCommands.d.ts +4 -0
- package/dist/commands/defaultCommands.d.ts.map +1 -0
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/types.d.ts +36 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/flip-book.js +99 -40
- package/dist/flip-book.js.map +1 -1
- package/dist/icons/index.d.ts +15 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/toolbar/ActionButton.d.ts +12 -0
- package/dist/toolbar/ActionButton.d.ts.map +1 -0
- package/dist/toolbar/FirstPageButton.d.ts.map +1 -1
- package/dist/toolbar/FullscreenButton.d.ts +2 -0
- package/dist/toolbar/FullscreenButton.d.ts.map +1 -1
- package/dist/toolbar/LastPageButton.d.ts.map +1 -1
- package/dist/toolbar/NextButton.d.ts.map +1 -1
- package/dist/toolbar/PageIndicator.d.ts +8 -2
- package/dist/toolbar/PageIndicator.d.ts.map +1 -1
- package/dist/toolbar/PrevButton.d.ts.map +1 -1
- package/dist/toolbar/TocButton.d.ts +11 -0
- package/dist/toolbar/TocButton.d.ts.map +1 -0
- package/dist/toolbar/Toolbar.d.ts +6 -1
- package/dist/toolbar/Toolbar.d.ts.map +1 -1
- package/dist/toolbar/ToolbarContext.d.ts +2 -1
- package/dist/toolbar/ToolbarContext.d.ts.map +1 -1
- package/dist/toolbar/index.d.ts +10 -2
- package/dist/toolbar/index.d.ts.map +1 -1
- package/dist/toolbar/index.js +560 -96
- package/dist/toolbar/index.js.map +1 -1
- package/package.json +2 -2
package/dist/FlipBook.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ export interface FlipBookHandle {
|
|
|
10
10
|
isFirstPage: () => boolean;
|
|
11
11
|
isLastPage: () => boolean;
|
|
12
12
|
}
|
|
13
|
+
export interface CoverConfig {
|
|
14
|
+
hardCovers?: boolean;
|
|
15
|
+
noShadow?: boolean;
|
|
16
|
+
coverIndices?: number[] | "auto";
|
|
17
|
+
}
|
|
13
18
|
export interface FlipBookProps {
|
|
14
19
|
pages: React.ReactNode[];
|
|
15
20
|
className: string;
|
|
@@ -19,8 +24,11 @@ export interface FlipBookProps {
|
|
|
19
24
|
initialTurnedLeaves?: number[];
|
|
20
25
|
fastDeltaThreshold?: number;
|
|
21
26
|
leavesBuffer?: number;
|
|
27
|
+
coverConfig?: CoverConfig;
|
|
22
28
|
}
|
|
23
29
|
declare const FlipBookReact: React.ForwardRefExoticComponent<FlipBookProps & React.RefAttributes<FlipBookHandle>>;
|
|
24
30
|
export { FlipBookReact as FlipBook };
|
|
25
31
|
export type { PageSemantics };
|
|
32
|
+
export type { TocEntry, TocPageProps } from "./TocPage";
|
|
33
|
+
export { TocPage } from "./TocPage";
|
|
26
34
|
//# sourceMappingURL=FlipBook.d.ts.map
|
package/dist/FlipBook.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlipBook.d.ts","sourceRoot":"","sources":["../src/FlipBook.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,MAAM,WAAW,cAAc;IAE9B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IA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3B,UAAU,CAAC,EAAE,OAAO,CAAC;IAKrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAMnB,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;CACjC;AAKD,MAAM,WAAW,aAAa;IAE7B,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IAEzB,SAAS,EAAE,MAAM,CAAC;IAElB,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAE1B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE/B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAM5B,YAAY,CAAC,EAAE,MAAM,CAAC;IAItB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC1B;AAsBD,QAAA,MAAM,aAAa,sFAsHlB,CAAC;AAIF,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,CAAC;AACrC,YAAY,EAAE,aAAa,EAAE,CAAC;AAC9B,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PageSemantics } from "html-flip-book-vanilla";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import "./TocPage.css";
|
|
4
|
+
export interface TocEntry {
|
|
5
|
+
pageIndex: number;
|
|
6
|
+
title: string;
|
|
7
|
+
semanticName: string;
|
|
8
|
+
}
|
|
9
|
+
export interface TocPageProps {
|
|
10
|
+
onNavigate: (pageIndex: number) => void;
|
|
11
|
+
totalPages: number;
|
|
12
|
+
pageSemantics?: PageSemantics;
|
|
13
|
+
heading?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
direction?: "ltr" | "rtl";
|
|
16
|
+
filter?: (entry: TocEntry, pageIndex: number) => boolean;
|
|
17
|
+
renderEntry?: (entry: TocEntry, onClick: () => void) => React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
declare const TocPage: React.FC<TocPageProps>;
|
|
20
|
+
export { TocPage };
|
|
21
|
+
//# sourceMappingURL=TocPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TocPage.d.ts","sourceRoot":"","sources":["../src/TocPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,eAAe,CAAC;AAKvB,MAAM,WAAW,QAAQ;IAExB,SAAS,EAAE,MAAM,CAAC;IAElB,KAAK,EAAE,MAAM,CAAC;IAEd,YAAY,EAAE,MAAM,CAAC;CACrB;AAKD,MAAM,WAAW,YAAY;IAE5B,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAExC,UAAU,EAAE,MAAM,CAAC;IAEnB,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAK1B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IAKzD,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK,KAAK,CAAC,SAAS,CAAC;CACxE;AAyBD,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAoDnC,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.flipbook-toolbar{display:flex;align-items:center;justify-content:center;gap:8px;padding:8px 16px;background-color:#000000b3;border-radius:8px;-webkit-user-select:none;user-select:none}.flipbook-toolbar--rtl{flex-direction:row-reverse}.flipbook-toolbar-button{display:flex;align-items:center;justify-content:center;width:40px;height:40px;padding:0;border:none;border-radius:6px;background-color:transparent;color:#fff;font-size:20px;cursor:pointer;transition:background-color .2s ease,opacity .2s ease}.flipbook-toolbar-button:hover:not(:disabled){background-color:#ffffff26}.flipbook-toolbar-button:active:not(:disabled){background-color:#ffffff40}.flipbook-toolbar-button:focus-visible{outline:2px solid #fff;outline-offset:2px}.flipbook-toolbar-button:disabled{opacity:.4;cursor:not-allowed}.flipbook-toolbar-prev,.flipbook-toolbar-next{font-size:28px;font-weight:700}.flipbook-toolbar-first,.flipbook-toolbar-last{font-size:16px}.flipbook-toolbar-fullscreen{font-size:18px}.flipbook-toolbar-fullscreen--active{background-color:#ffffff1a}.flipbook-toolbar-indicator{color
|
|
1
|
+
.toc-page{background-color:#fffef8;padding:8% 6%;font-family:Georgia,Times New Roman,serif;line-height:1.6;height:100%;box-sizing:border-box;overflow-y:auto}.toc-heading{text-align:center;margin-bottom:24px;color:#2c1810;font-size:1.4rem;border-bottom:none}.toc-list{list-style:none;padding:0;margin:0}.toc-list li{margin-bottom:8px}.toc-link{display:flex;align-items:baseline;width:100%;padding:8px 4px;background:none;border:none;cursor:pointer;font-family:inherit;font-size:inherit;text-align:inherit;color:inherit;transition:background-color .15s ease}.toc-link:hover{background-color:#0000000d}.toc-link:focus{outline:2px solid #1a3a5c;outline-offset:2px}.toc-title{flex-shrink:0}.toc-dots{flex-grow:1;border-bottom:1px dotted #999;margin:0 8px;min-width:20px}.toc-page-num{flex-shrink:0;font-weight:600;color:#1a3a5c}.flipbook-toolbar{display:flex;align-items:center;justify-content:center;gap:8px;padding:8px 16px;background-color:#000000b3;border-radius:8px;-webkit-user-select:none;user-select:none}.flipbook-toolbar--rtl{flex-direction:row-reverse}.flipbook-toolbar-button{display:flex;align-items:center;justify-content:center;width:40px;height:40px;padding:0;border:none;border-radius:6px;background-color:transparent;color:#fff;font-size:20px;cursor:pointer;transition:background-color .2s ease,opacity .2s ease}.flipbook-toolbar-button:hover:not(:disabled){background-color:#ffffff26}.flipbook-toolbar-button:active:not(:disabled){background-color:#ffffff40}.flipbook-toolbar-button:focus-visible{outline:2px solid #fff;outline-offset:2px}.flipbook-toolbar-button:disabled{opacity:.4;cursor:not-allowed}.flipbook-toolbar-prev,.flipbook-toolbar-next{font-size:28px;font-weight:700}.flipbook-toolbar-first,.flipbook-toolbar-last{font-size:16px}.flipbook-toolbar-fullscreen{font-size:18px}.flipbook-toolbar-fullscreen--active{background-color:#ffffff1a}span.flipbook-toolbar-indicator{display:inline-flex;align-items:center;justify-content:center;color:inherit;font-size:14px;font-weight:500;text-align:center;padding:0 4px;white-space:nowrap}input.flipbook-toolbar-indicator{display:inline-block;font-family:inherit;font-size:14px;font-weight:500;text-align:center;box-sizing:border-box;border:1px solid transparent;border-radius:4px;padding:4px 8px;min-width:3ch;color:inherit;white-space:nowrap;transition:background-color .2s ease,color .2s ease}input.flipbook-toolbar-indicator--editing{background:#fff;color:#1a1a1a}input.flipbook-toolbar-indicator:focus{outline:2px solid currentColor;outline-offset:2px}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { FlipBookHandle } from "../FlipBook";
|
|
3
|
+
import type { Command, CommandOptions } from "./types";
|
|
4
|
+
interface CommandProviderProps {
|
|
5
|
+
flipBookRef: React.RefObject<FlipBookHandle | null>;
|
|
6
|
+
currentPage: number;
|
|
7
|
+
totalPages: number;
|
|
8
|
+
direction?: "rtl" | "ltr";
|
|
9
|
+
commands?: Command[];
|
|
10
|
+
commandOptions?: Record<string, CommandOptions>;
|
|
11
|
+
disableHotkeys?: boolean;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
interface CommandsContextValue {
|
|
15
|
+
executeCommand: (commandId: string) => void;
|
|
16
|
+
canExecute: (commandId: string) => boolean;
|
|
17
|
+
getCommand: (commandId: string) => Command | undefined;
|
|
18
|
+
getAllCommands: () => Command[];
|
|
19
|
+
}
|
|
20
|
+
export declare const CommandProvider: React.FC<CommandProviderProps>;
|
|
21
|
+
export declare const useCommands: () => CommandsContextValue;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=CommandContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandContext.d.ts","sourceRoot":"","sources":["../../src/commands/CommandContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,KAAK,EACX,OAAO,EAEP,cAAc,EAGd,MAAM,SAAS,CAAC;AAEjB,UAAU,oBAAoB;IAE7B,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAEpD,WAAW,EAAE,MAAM,CAAC;IAEpB,UAAU,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAE1B,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IAErB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAEhD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAED,UAAU,oBAAoB;IAE7B,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAE5C,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IAE3C,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,CAAC;IAEvD,cAAc,EAAE,MAAM,OAAO,EAAE,CAAC;CAChC;AAsBD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAyI1D,CAAC;AAKF,eAAO,MAAM,WAAW,QAAO,oBAM9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultCommands.d.ts","sourceRoot":"","sources":["../../src/commands/defaultCommands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAKtD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,CAW3D,CAAC;AAKF,eAAO,MAAM,eAAe,EAAE,OAAO,EAwEpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACrE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { FlipBookHandle } from "../FlipBook";
|
|
2
|
+
export interface Command {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
execute: (context: CommandContext) => boolean | undefined;
|
|
7
|
+
canExecute?: (context: CommandContext) => boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface CommandContext {
|
|
10
|
+
flipBookRef: React.RefObject<FlipBookHandle | null>;
|
|
11
|
+
currentPage: number;
|
|
12
|
+
totalPages: number;
|
|
13
|
+
direction: "rtl" | "ltr";
|
|
14
|
+
data?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export interface HotkeyBinding {
|
|
17
|
+
key: string;
|
|
18
|
+
modifiers?: {
|
|
19
|
+
ctrl?: boolean;
|
|
20
|
+
shift?: boolean;
|
|
21
|
+
alt?: boolean;
|
|
22
|
+
meta?: boolean;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface CommandOptions {
|
|
26
|
+
hotkeys?: HotkeyBinding[];
|
|
27
|
+
disableHotkeys?: boolean;
|
|
28
|
+
data?: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
export interface CommandRegistry {
|
|
31
|
+
[commandId: string]: {
|
|
32
|
+
command: Command;
|
|
33
|
+
options: CommandOptions;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/commands/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD,MAAM,WAAW,OAAO;IAEvB,EAAE,EAAE,MAAM,CAAC;IAEX,IAAI,EAAE,MAAM,CAAC;IAEb,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,GAAG,SAAS,CAAC;IAE1D,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC;CAClD;AAKD,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;IAEzB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAKD,MAAM,WAAW,aAAa;IAE7B,GAAG,EAAE,MAAM,CAAC;IAEZ,SAAS,CAAC,EAAE;QACX,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,GAAG,CAAC,EAAE,OAAO,CAAC;QACd,IAAI,CAAC,EAAE,OAAO,CAAC;KACf,CAAC;CACF;AAKD,MAAM,WAAW,cAAc;IAE9B,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAE1B,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAKD,MAAM,WAAW,eAAe;IAC/B,CAAC,SAAS,EAAE,MAAM,GAAG;QACpB,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,cAAc,CAAC;KACxB,CAAC;CACF"}
|
package/dist/flip-book.js
CHANGED
|
@@ -1,52 +1,111 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { FlipBook as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
const
|
|
1
|
+
import { jsxs as k, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { FlipBook as $ } from "html-flip-book-vanilla";
|
|
3
|
+
import { forwardRef as b, useState as A, useRef as v, useImperativeHandle as E, useEffect as L, Children as _ } from "react";
|
|
4
|
+
const D = (l) => l.title.length > 0, z = ({
|
|
5
|
+
onNavigate: l,
|
|
6
|
+
totalPages: g,
|
|
7
|
+
pageSemantics: p,
|
|
8
|
+
heading: m = "Table of Contents",
|
|
9
|
+
className: P,
|
|
10
|
+
direction: d = "ltr",
|
|
11
|
+
filter: f = D,
|
|
12
|
+
renderEntry: r
|
|
13
|
+
}) => {
|
|
14
|
+
const c = [];
|
|
15
|
+
for (let e = 0; e < g; e++) {
|
|
16
|
+
const a = p?.indexToTitle(e) ?? "", i = p?.indexToSemanticName(e) ?? "", n = { pageIndex: e, title: a, semanticName: i };
|
|
17
|
+
f(n, e) && c.push(n);
|
|
18
|
+
}
|
|
19
|
+
const x = (e, a) => {
|
|
20
|
+
const i = e.title || e.semanticName || `Page ${e.pageIndex}`, n = e.semanticName || String(e.pageIndex);
|
|
21
|
+
return /* @__PURE__ */ o("li", { children: /* @__PURE__ */ k("button", { type: "button", className: "toc-link", onClick: a, children: [
|
|
22
|
+
/* @__PURE__ */ o("span", { className: "toc-title", children: i }),
|
|
23
|
+
/* @__PURE__ */ o("span", { className: "toc-dots" }),
|
|
24
|
+
/* @__PURE__ */ o("span", { className: "toc-page-num", children: n })
|
|
25
|
+
] }) }, e.pageIndex);
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ k(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
className: `toc-page ${P ?? ""}`.trim(),
|
|
31
|
+
style: { direction: d, textAlign: d === "rtl" ? "right" : "left" },
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ o("h2", { className: "toc-heading", children: m }),
|
|
34
|
+
/* @__PURE__ */ o("ul", { className: "toc-list", children: c.map((e) => {
|
|
35
|
+
const a = () => l(e.pageIndex);
|
|
36
|
+
return r ? r(e, a) : x(e, a);
|
|
37
|
+
}) })
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}, H = b(
|
|
5
42
|
({
|
|
6
|
-
pages:
|
|
7
|
-
className:
|
|
8
|
-
debug:
|
|
9
|
-
direction:
|
|
10
|
-
pageSemantics:
|
|
11
|
-
initialTurnedLeaves:
|
|
12
|
-
fastDeltaThreshold:
|
|
13
|
-
leavesBuffer:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
43
|
+
pages: l,
|
|
44
|
+
className: g,
|
|
45
|
+
debug: p = !1,
|
|
46
|
+
direction: m = "ltr",
|
|
47
|
+
pageSemantics: P = void 0,
|
|
48
|
+
initialTurnedLeaves: d = [],
|
|
49
|
+
fastDeltaThreshold: f,
|
|
50
|
+
leavesBuffer: r,
|
|
51
|
+
coverConfig: c
|
|
52
|
+
}, x) => {
|
|
53
|
+
const [e, a] = A(0), i = v(a);
|
|
54
|
+
i.current = a;
|
|
55
|
+
const n = v(
|
|
56
|
+
new $({
|
|
57
|
+
pageSemantics: P,
|
|
58
|
+
pagesCount: l.length,
|
|
59
|
+
direction: m,
|
|
60
|
+
initialTurnedLeaves: d,
|
|
61
|
+
fastDeltaThreshold: f,
|
|
62
|
+
leavesBuffer: r,
|
|
63
|
+
onPageChanged: (t) => i.current?.(t)
|
|
23
64
|
})
|
|
24
65
|
);
|
|
25
|
-
|
|
26
|
-
|
|
66
|
+
E(
|
|
67
|
+
x,
|
|
27
68
|
() => ({
|
|
28
|
-
flipNext: () =>
|
|
29
|
-
flipPrev: () =>
|
|
30
|
-
goToPage: (
|
|
31
|
-
jumpToPage: (
|
|
32
|
-
getCurrentPageIndex: () =>
|
|
33
|
-
getTotalPages: () =>
|
|
34
|
-
isFirstPage: () =>
|
|
35
|
-
isLastPage: () =>
|
|
69
|
+
flipNext: () => n.current.flipNext(),
|
|
70
|
+
flipPrev: () => n.current.flipPrev(),
|
|
71
|
+
goToPage: (t) => n.current.goToPage(t),
|
|
72
|
+
jumpToPage: (t) => n.current.jumpToPage(t),
|
|
73
|
+
getCurrentPageIndex: () => n.current.currentPageIndex,
|
|
74
|
+
getTotalPages: () => n.current.totalPages,
|
|
75
|
+
isFirstPage: () => n.current.isFirstPage,
|
|
76
|
+
isLastPage: () => n.current.isLastPage
|
|
36
77
|
}),
|
|
37
78
|
[]
|
|
38
|
-
),
|
|
39
|
-
const
|
|
40
|
-
return
|
|
41
|
-
|
|
79
|
+
), L(() => {
|
|
80
|
+
const t = n.current;
|
|
81
|
+
return t.render(`.${g}`, p), a(t.currentPageIndex), () => {
|
|
82
|
+
t.destroy();
|
|
42
83
|
};
|
|
43
|
-
}, [
|
|
44
|
-
const
|
|
45
|
-
|
|
84
|
+
}, [g, p]);
|
|
85
|
+
const u = _.toArray(l), h = u.length, C = new Set(
|
|
86
|
+
c?.coverIndices === "auto" ? [0, h - 1] : c?.coverIndices ?? [0]
|
|
87
|
+
), F = (t) => C.has(t), S = (t) => {
|
|
88
|
+
const s = ["page"];
|
|
89
|
+
return F(t) && (s.push("page--cover"), c?.hardCovers && s.push("page--hard"), c?.noShadow && s.push("page--no-shadow")), s.join(" ");
|
|
90
|
+
}, w = r != null && h > 0 ? (() => {
|
|
91
|
+
const t = Math.floor(e / 2), s = Math.ceil(h / 2), N = 2, j = Math.max(0, t - r - N), M = Math.min(s - 1, t + r + N), T = j * 2, R = Math.min(h - 1, M * 2 + 1), y = new Set(
|
|
92
|
+
Array.from({ length: R - T + 1 }, (I, B) => T + B)
|
|
93
|
+
);
|
|
94
|
+
return (I) => y.has(I) ? u[I] : null;
|
|
95
|
+
})() : (t) => u[t];
|
|
96
|
+
return /* @__PURE__ */ o("div", { className: g, children: u.map((t, s) => /* @__PURE__ */ o(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
className: S(s),
|
|
100
|
+
children: w(s)
|
|
101
|
+
},
|
|
102
|
+
`page-${s}`
|
|
103
|
+
)) });
|
|
46
104
|
}
|
|
47
105
|
);
|
|
48
|
-
|
|
106
|
+
H.displayName = "FlipBook";
|
|
49
107
|
export {
|
|
50
|
-
|
|
108
|
+
H as FlipBook,
|
|
109
|
+
z as TocPage
|
|
51
110
|
};
|
|
52
111
|
//# sourceMappingURL=flip-book.js.map
|
package/dist/flip-book.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flip-book.js","sources":["../src/FlipBook.tsx"],"sourcesContent":["import { FlipBook as FlipBookBase, type PageSemantics } from \"html-flip-book-vanilla\";\nimport type React from \"react\";\nimport { Children, forwardRef, useEffect, useImperativeHandle, useRef } from \"react\";\n\n/**\n * Imperative handle exposed via ref for programmatic control of the FlipBook.\n *\n * @example\n * ```tsx\n * const ref = useRef<FlipBookHandle>(null);\n * // Later:\n * await ref.current?.flipNext();\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 to a specific page index */\n\tgoToPage: (pageIndex: number) => Promise<void>;\n\t/** Jump to a specific page instantly without animation */\n\tjumpToPage: (pageIndex: number) => 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/** Check if currently at the first page */\n\tisFirstPage: () => boolean;\n\t/** Check if currently at the last page */\n\tisLastPage: () => boolean;\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}\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},\n\t\tref,\n\t) => {\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}),\n\t\t);\n\n\t\t// Expose imperative methods via ref\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\tgoToPage: (pageIndex: number) => flipBook.current.goToPage(pageIndex),\n\t\t\t\tjumpToPage: (pageIndex: number) => flipBook.current.jumpToPage(pageIndex),\n\t\t\t\tgetCurrentPageIndex: () => flipBook.current.currentPageIndex,\n\t\t\t\tgetTotalPages: () => flipBook.current.totalPages,\n\t\t\t\tisFirstPage: () => flipBook.current.isFirstPage,\n\t\t\t\tisLastPage: () => flipBook.current.isLastPage,\n\t\t\t}),\n\t\t\t[],\n\t\t);\n\n\t\tuseEffect(() => {\n\t\t\tconst currentFlipBook = flipBook.current;\n\t\t\tcurrentFlipBook.render(`.${className}`, debug);\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// Use Children.toArray to get stable keys for each page element\n\t\tconst pagesWithKeys = Children.toArray(pages);\n\n\t\treturn (\n\t\t\t<div className={className}>\n\t\t\t\t{pagesWithKeys.map((page) => (\n\t\t\t\t\t<div key={(page as React.ReactElement).key} className=\"page\">\n\t\t\t\t\t\t{page}\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 { PageSemantics };\n"],"names":["FlipBookReact","forwardRef","pages","className","debug","direction","pageSemantics","initialTurnedLeaves","fastDeltaThreshold","leavesBuffer","ref","flipBook","useRef","FlipBookBase","useImperativeHandle","pageIndex","useEffect","currentFlipBook","pagesWithKeys","Children","jsx","page"],"mappings":";;;AA+EA,MAAMA,IAAgBC;AAAA,EACrB,CACC;AAAA,IACC,OAAAC;AAAA,IACA,WAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,WAAAC,IAAY;AAAA,IACZ,eAAAC,IAAgB;AAAA,IAChB,qBAAAC,IAAsB,CAAA;AAAA,IACtB,oBAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,GAEDC,MACI;AACJ,UAAMC,IAAWC;AAAA,MAChB,IAAIC,EAAa;AAAA,QAChB,eAAAP;AAAA,QACA,YAAYJ,EAAM;AAAA,QAClB,WAAAG;AAAA,QACA,qBAAAE;AAAA,QACA,oBAAAC;AAAA,QACA,cAAAC;AAAA,MAAA,CACA;AAAA,IAAA;AAIF,IAAAK;AAAA,MACCJ;AAAA,MACA,OAAO;AAAA,QACN,UAAU,MAAMC,EAAS,QAAQ,SAAA;AAAA,QACjC,UAAU,MAAMA,EAAS,QAAQ,SAAA;AAAA,QACjC,UAAU,CAACI,MAAsBJ,EAAS,QAAQ,SAASI,CAAS;AAAA,QACpE,YAAY,CAACA,MAAsBJ,EAAS,QAAQ,WAAWI,CAAS;AAAA,QACxE,qBAAqB,MAAMJ,EAAS,QAAQ;AAAA,QAC5C,eAAe,MAAMA,EAAS,QAAQ;AAAA,QACtC,aAAa,MAAMA,EAAS,QAAQ;AAAA,QACpC,YAAY,MAAMA,EAAS,QAAQ;AAAA,MAAA;AAAA,MAEpC,CAAA;AAAA,IAAC,GAGFK,EAAU,MAAM;AACf,YAAMC,IAAkBN,EAAS;AACjC,aAAAM,EAAgB,OAAO,IAAId,CAAS,IAAIC,CAAK,GAGtC,MAAM;AACZ,QAAAa,EAAgB,QAAA;AAAA,MACjB;AAAA,IACD,GAAG,CAACd,GAAWC,CAAK,CAAC;AAGrB,UAAMc,IAAgBC,EAAS,QAAQjB,CAAK;AAE5C,WACC,gBAAAkB,EAAC,OAAA,EAAI,WAAAjB,GACH,UAAAe,EAAc,IAAI,CAACG,MACnB,gBAAAD,EAAC,OAAA,EAA2C,WAAU,QACpD,UAAAC,EAAA,GADSA,EAA4B,GAEvC,CACA,GACF;AAAA,EAEF;AACD;AAEArB,EAAc,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?.goToPage(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// Display: title (with semantic name or index as fallback for page number)\n\t\tconst displayText = entry.title || entry.semanticName || `Page ${entry.pageIndex}`;\n\t\tconst displayNumber = entry.semanticName || String(entry.pageIndex);\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\">{displayText}</span>\n\t\t\t\t\t<span className=\"toc-dots\" />\n\t\t\t\t\t<span className=\"toc-page-num\">{displayNumber}</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<h2 className=\"toc-heading\">{heading}</h2>\n\t\t\t<ul className=\"toc-list\">\n\t\t\t\t{entries.map((entry) => {\n\t\t\t\t\tconst onClick = () => onNavigate(entry.pageIndex);\n\t\t\t\t\treturn renderEntry ? renderEntry(entry, onClick) : renderDefaultEntry(entry, onClick);\n\t\t\t\t})}\n\t\t\t</ul>\n\t\t</div>\n\t);\n};\n\nexport { TocPage };\n","import { FlipBook as FlipBookBase, type PageSemantics } from \"html-flip-book-vanilla\";\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 *\n * @example\n * ```tsx\n * const ref = useRef<FlipBookHandle>(null);\n * // Later:\n * await ref.current?.flipNext();\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 to a specific page index */\n\tgoToPage: (pageIndex: number) => Promise<void>;\n\t/** Jump to a specific page instantly without animation */\n\tjumpToPage: (pageIndex: number) => 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/** Check if currently at the first page */\n\tisFirstPage: () => boolean;\n\t/** Check if currently at the last page */\n\tisLastPage: () => boolean;\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}\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}\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\tcoverConfig,\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\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\tonPageChanged: (index: number) => setPageIndexRef.current?.(index),\n\t\t\t}),\n\t\t);\n\n\t\t// Expose imperative methods via ref\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\tgoToPage: (pageIndex: number) => flipBook.current.goToPage(pageIndex),\n\t\t\t\tjumpToPage: (pageIndex: number) => flipBook.current.jumpToPage(pageIndex),\n\t\t\t\tgetCurrentPageIndex: () => flipBook.current.currentPageIndex,\n\t\t\t\tgetTotalPages: () => flipBook.current.totalPages,\n\t\t\t\tisFirstPage: () => flipBook.current.isFirstPage,\n\t\t\t\tisLastPage: () => flipBook.current.isLastPage,\n\t\t\t}),\n\t\t\t[],\n\t\t);\n\n\t\tuseEffect(() => {\n\t\t\tconst currentFlipBook = flipBook.current;\n\t\t\tcurrentFlipBook.render(`.${className}`, 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// 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// 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\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\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\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\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{contentByIndex(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 { PageSemantics };\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","displayText","displayNumber","jsx","jsxs","FlipBookReact","forwardRef","pages","debug","initialTurnedLeaves","fastDeltaThreshold","leavesBuffer","coverConfig","ref","currentPageIndex","setCurrentPageIndex","useState","setPageIndexRef","useRef","flipBook","FlipBookBase","index","useImperativeHandle","pageIndex","useEffect","currentFlipBook","pagesWithKeys","Children","coverIndicesSet","isCoverPage","getPageClassName","classes","contentByIndex","currentLeaf","leavesCount","margin","leafStart","leafEnd","pageStart","pageEnd","inRange","_"],"mappings":";;;AA+CA,MAAMA,IAAgB,CAACC,MAA6BA,EAAM,MAAM,SAAS,GAoBnEC,IAAkC,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,MAA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
|
|
2
|
+
interface IconProps {
|
|
3
|
+
size?: number;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const ChevronLeftIcon: React.FC<IconProps>;
|
|
7
|
+
export declare const ChevronRightIcon: React.FC<IconProps>;
|
|
8
|
+
export declare const ChevronFirstIcon: React.FC<IconProps>;
|
|
9
|
+
export declare const ChevronLastIcon: React.FC<IconProps>;
|
|
10
|
+
export declare const MaximizeIcon: React.FC<IconProps>;
|
|
11
|
+
export declare const MinimizeIcon: React.FC<IconProps>;
|
|
12
|
+
export declare const TableOfContentsIcon: React.FC<IconProps>;
|
|
13
|
+
export declare const BookshelfIcon: React.FC<IconProps>;
|
|
14
|
+
export type { IconProps };
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/icons/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,UAAU,SAAS;IAElB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAID,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAgB/C,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAgBhD,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAiBhD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAiB/C,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAmB5C,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAmB5C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAwBnD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAsB7C,CAAC;AAEF,YAAY,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface ActionButtonProps {
|
|
3
|
+
onClick: () => void;
|
|
4
|
+
ariaLabel: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const ActionButton: React.FC<ActionButtonProps>;
|
|
10
|
+
export { ActionButton };
|
|
11
|
+
export type { ActionButtonProps };
|
|
12
|
+
//# sourceMappingURL=ActionButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/ActionButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,UAAU,iBAAiB;IAE1B,OAAO,EAAE,MAAM,IAAI,CAAC;IAEpB,SAAS,EAAE,MAAM,CAAC;IAElB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAiB7C,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirstPageButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/FirstPageButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FirstPageButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/FirstPageButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,UAAU,oBAAoB;IAE7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAqBnD,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -3,6 +3,8 @@ interface FullscreenButtonProps {
|
|
|
3
3
|
targetRef?: React.RefObject<HTMLElement | null>;
|
|
4
4
|
enterIcon?: React.ReactNode;
|
|
5
5
|
exitIcon?: React.ReactNode;
|
|
6
|
+
ariaLabelEnter?: string;
|
|
7
|
+
ariaLabelExit?: string;
|
|
6
8
|
className?: string;
|
|
7
9
|
}
|
|
8
10
|
declare const FullscreenButton: React.FC<FullscreenButtonProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FullscreenButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/FullscreenButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FullscreenButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/FullscreenButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,UAAU,qBAAqB;IAE9B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAEhD,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAiDrD,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LastPageButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/LastPageButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LastPageButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/LastPageButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,UAAU,mBAAmB;IAE5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAqBjD,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/NextButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NextButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/NextButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,UAAU,eAAe;IAExB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAwBzC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
+
type PageIndicatorMode = "semantic" | "index";
|
|
2
3
|
interface PageIndicatorProps {
|
|
3
|
-
|
|
4
|
+
mode?: PageIndicatorMode;
|
|
5
|
+
showTotal?: boolean;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
editable?: boolean;
|
|
4
8
|
className?: string;
|
|
9
|
+
ariaLabel?: string;
|
|
10
|
+
maxLength?: number;
|
|
5
11
|
}
|
|
6
12
|
declare const PageIndicator: React.FC<PageIndicatorProps>;
|
|
7
13
|
export { PageIndicator };
|
|
8
|
-
export type { PageIndicatorProps };
|
|
14
|
+
export type { PageIndicatorProps, PageIndicatorMode };
|
|
9
15
|
//# sourceMappingURL=PageIndicator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageIndicator.d.ts","sourceRoot":"","sources":["../../src/toolbar/PageIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PageIndicator.d.ts","sourceRoot":"","sources":["../../src/toolbar/PageIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,KAAK,iBAAiB,GAAG,UAAU,GAAG,OAAO,CAAC;AAE9C,UAAU,kBAAkB;IAO3B,IAAI,CAAC,EAAE,iBAAiB,CAAC;IAEzB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAQD,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAqL/C,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrevButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/PrevButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PrevButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/PrevButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,UAAU,eAAe;IAExB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAwBzC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface TocButtonProps {
|
|
3
|
+
tocPageIndex?: number;
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
ariaLabel?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const TocButton: React.FC<TocButtonProps>;
|
|
9
|
+
export { TocButton };
|
|
10
|
+
export type { TocButtonProps };
|
|
11
|
+
//# sourceMappingURL=TocButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TocButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/TocButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,UAAU,cAAc;IAEvB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAwBvC,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Command, CommandOptions } from "../commands/types";
|
|
3
|
+
import type { FlipBookHandle, PageSemantics } from "../FlipBook";
|
|
3
4
|
import "./Toolbar.css";
|
|
4
5
|
interface ToolbarProps {
|
|
5
6
|
flipBookRef: React.RefObject<FlipBookHandle | null>;
|
|
6
7
|
direction?: "ltr" | "rtl";
|
|
8
|
+
pageSemantics?: PageSemantics;
|
|
7
9
|
className?: string;
|
|
8
10
|
children: React.ReactNode;
|
|
11
|
+
enableHotkeys?: boolean;
|
|
12
|
+
commands?: Command[];
|
|
13
|
+
commandOptions?: Record<string, CommandOptions>;
|
|
9
14
|
}
|
|
10
15
|
declare const Toolbar: React.FC<ToolbarProps>;
|
|
11
16
|
export { Toolbar };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/toolbar/Toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/toolbar/Toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,eAAe,CAAC;AAEvB,UAAU,YAAY;IAErB,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAEpD,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAE1B,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IAErB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAChD;AAOD,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAsEnC,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,YAAY,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
-
import type { FlipBookHandle } from "../FlipBook";
|
|
2
|
+
import type { FlipBookHandle, PageSemantics } from "../FlipBook";
|
|
3
3
|
interface ToolbarContextValue {
|
|
4
4
|
flipBookRef: React.RefObject<FlipBookHandle | null>;
|
|
5
5
|
direction: "ltr" | "rtl";
|
|
6
|
+
pageSemantics?: PageSemantics;
|
|
6
7
|
currentPage: number;
|
|
7
8
|
totalPages: number;
|
|
8
9
|
isFirstPage: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarContext.d.ts","sourceRoot":"","sources":["../../src/toolbar/ToolbarContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ToolbarContext.d.ts","sourceRoot":"","sources":["../../src/toolbar/ToolbarContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,UAAU,mBAAmB;IAC5B,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACpD,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;IACzB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,cAAc,2CAAkD,CAAC;AAEvE,wBAAgB,UAAU,IAAI,mBAAmB,CAMhD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
|
package/dist/toolbar/index.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export type { Command, CommandOptions, HotkeyBinding } from "../commands";
|
|
2
|
+
export { DEFAULT_HOTKEYS, defaultCommands, useCommands } from "../commands";
|
|
3
|
+
export type { IconProps } from "../icons";
|
|
4
|
+
export { BookshelfIcon, ChevronFirstIcon, ChevronLastIcon, ChevronLeftIcon, ChevronRightIcon, MaximizeIcon, MinimizeIcon, TableOfContentsIcon, } from "../icons";
|
|
5
|
+
export type { ActionButtonProps } from "./ActionButton";
|
|
6
|
+
export { ActionButton } from "./ActionButton";
|
|
1
7
|
export type { FirstPageButtonProps } from "./FirstPageButton";
|
|
2
8
|
export { FirstPageButton } from "./FirstPageButton";
|
|
3
9
|
export type { FullscreenButtonProps } from "./FullscreenButton";
|
|
@@ -6,10 +12,12 @@ export type { LastPageButtonProps } from "./LastPageButton";
|
|
|
6
12
|
export { LastPageButton } from "./LastPageButton";
|
|
7
13
|
export type { NextButtonProps } from "./NextButton";
|
|
8
14
|
export { NextButton } from "./NextButton";
|
|
9
|
-
export type { PageIndicatorProps } from "./PageIndicator";
|
|
10
|
-
export { PageIndicator } from "./PageIndicator";
|
|
15
|
+
export type { PageIndicatorMode, PageIndicatorProps, PageIndicatorProps as SemanticPageIndicatorProps, } from "./PageIndicator";
|
|
16
|
+
export { PageIndicator, PageIndicator as SemanticPageIndicator } from "./PageIndicator";
|
|
11
17
|
export type { PrevButtonProps } from "./PrevButton";
|
|
12
18
|
export { PrevButton } from "./PrevButton";
|
|
19
|
+
export type { TocButtonProps } from "./TocButton";
|
|
20
|
+
export { TocButton } from "./TocButton";
|
|
13
21
|
export type { ToolbarProps } from "./Toolbar";
|
|
14
22
|
export { Toolbar } from "./Toolbar";
|
|
15
23
|
export type { ToolbarButtonProps } from "./ToolbarButton";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/toolbar/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/toolbar/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5E,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EACN,aAAa,EACb,gBAAgB,EAChB,e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