html-flip-book-react 0.0.0-alpha.35 → 0.0.0-alpha.37
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 +7 -2
- package/dist/FlipBook.d.ts.map +1 -1
- package/dist/assets/html-flip-book.css +1 -1
- package/dist/flip-book.js +133 -116
- package/dist/flip-book.js.map +1 -1
- package/dist/toolbar/DownloadDropdown.d.ts.map +1 -1
- package/dist/toolbar/MouseModeButton.d.ts +8 -0
- package/dist/toolbar/MouseModeButton.d.ts.map +1 -0
- package/dist/toolbar/Toolbar.d.ts.map +1 -1
- package/dist/toolbar/ToolbarButton.d.ts +1 -0
- package/dist/toolbar/ToolbarButton.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 +2 -0
- package/dist/toolbar/index.d.ts.map +1 -1
- package/dist/toolbar/index.js +339 -305
- package/dist/toolbar/index.js.map +1 -1
- package/package.json +2 -2
package/dist/toolbar/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { createContext as ce, useContext as ie, useMemo as Q, useCallback as
|
|
3
|
-
let
|
|
1
|
+
import { jsx as t, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as ce, useContext as ie, useMemo as Q, useCallback as v, useEffect as z, useState as I, useRef as J, useLayoutEffect as he } from "react";
|
|
3
|
+
let pe = 4;
|
|
4
4
|
function re() {
|
|
5
|
-
return
|
|
5
|
+
return pe;
|
|
6
6
|
}
|
|
7
|
-
const
|
|
7
|
+
const fe = {
|
|
8
8
|
id: "download",
|
|
9
9
|
enName: "Download",
|
|
10
10
|
enDescription: "Download entire book or page range",
|
|
@@ -17,7 +17,7 @@ const pe = {
|
|
|
17
17
|
);
|
|
18
18
|
},
|
|
19
19
|
canExecute: (e) => typeof e.data?.onDownload == "function"
|
|
20
|
-
},
|
|
20
|
+
}, be = [
|
|
21
21
|
{ key: "ArrowRight" },
|
|
22
22
|
{ key: "PageDown" },
|
|
23
23
|
{ key: " " }
|
|
@@ -28,40 +28,40 @@ const pe = {
|
|
|
28
28
|
enName: "Next Page",
|
|
29
29
|
enDescription: "Flip to the next page",
|
|
30
30
|
nameKey: "command.jumpToNextPage",
|
|
31
|
-
hotkeys:
|
|
31
|
+
hotkeys: be,
|
|
32
32
|
execute: (e) => {
|
|
33
33
|
e.handle?.flipNext();
|
|
34
34
|
},
|
|
35
35
|
canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) < (e.handle?.getTotalPages() ?? 0) - 1
|
|
36
|
-
},
|
|
36
|
+
}, we = [{ key: "ArrowLeft" }, { key: "PageUp" }], Z = {
|
|
37
37
|
id: "flipPrev",
|
|
38
38
|
navKind: "flip",
|
|
39
39
|
enName: "Previous Page",
|
|
40
40
|
enDescription: "Flip to the previous page",
|
|
41
41
|
nameKey: "command.jumpToPrevPage",
|
|
42
|
-
hotkeys:
|
|
42
|
+
hotkeys: we,
|
|
43
43
|
execute: (e) => {
|
|
44
44
|
e.handle?.flipPrev();
|
|
45
45
|
},
|
|
46
46
|
canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) > 0
|
|
47
|
-
},
|
|
47
|
+
}, xe = [{ key: "Home" }, { key: "ArrowLeft", modifiers: { ctrl: !0 } }], ee = {
|
|
48
48
|
id: "goToFirst",
|
|
49
49
|
navKind: "jump",
|
|
50
50
|
enName: "First Page",
|
|
51
51
|
enDescription: "Jump to the first page",
|
|
52
52
|
nameKey: "command.jumpToFirstPage",
|
|
53
|
-
hotkeys:
|
|
53
|
+
hotkeys: xe,
|
|
54
54
|
execute: (e) => {
|
|
55
55
|
e.handle?.jumpToPage(0);
|
|
56
56
|
},
|
|
57
57
|
canExecute: (e) => e.handle?.getCurrentPageIndex() !== 0
|
|
58
|
-
},
|
|
58
|
+
}, ke = [{ key: "End" }, { key: "ArrowRight", modifiers: { ctrl: !0 } }], oe = {
|
|
59
59
|
id: "goToLast",
|
|
60
60
|
navKind: "jump",
|
|
61
61
|
enName: "Last Page",
|
|
62
62
|
enDescription: "Jump to the last page",
|
|
63
63
|
nameKey: "command.jumpToLastPage",
|
|
64
|
-
hotkeys:
|
|
64
|
+
hotkeys: ke,
|
|
65
65
|
execute: (e) => {
|
|
66
66
|
const o = e.handle?.getTotalPages() ?? 0;
|
|
67
67
|
e.handle?.jumpToPage(o - 1);
|
|
@@ -70,13 +70,13 @@ const pe = {
|
|
|
70
70
|
const o = e.handle?.getCurrentPageIndex() ?? 0, a = e.handle?.getTotalPages() ?? 0;
|
|
71
71
|
return o !== a - 1;
|
|
72
72
|
}
|
|
73
|
-
},
|
|
73
|
+
}, ve = [{ key: "t" }], te = {
|
|
74
74
|
id: "goToToc",
|
|
75
75
|
navKind: "jump",
|
|
76
76
|
enName: "Table of Contents",
|
|
77
77
|
enDescription: "Jump to the table of contents",
|
|
78
78
|
nameKey: "command.jumpToToc",
|
|
79
|
-
hotkeys:
|
|
79
|
+
hotkeys: ve,
|
|
80
80
|
execute: (e) => {
|
|
81
81
|
const o = e.handle?.getTocPageIndex?.() ?? re();
|
|
82
82
|
e.handle?.jumpToPage(o);
|
|
@@ -85,17 +85,17 @@ const pe = {
|
|
|
85
85
|
const o = e.handle?.getTocPageIndex?.() ?? re();
|
|
86
86
|
return e.handle?.getCurrentPageIndex() !== o;
|
|
87
87
|
}
|
|
88
|
-
},
|
|
88
|
+
}, Pe = [{ key: "d", modifiers: { ctrl: !0, alt: !0 } }], Te = {
|
|
89
89
|
id: "toggleDebug",
|
|
90
90
|
enName: "Toggle Debug Toolbar",
|
|
91
91
|
enDescription: "Show or hide the debug toolbar (Ctrl+Alt+D)",
|
|
92
92
|
nameKey: "command.toggleDebug",
|
|
93
93
|
descriptionKey: "command.toggleDebugDesc",
|
|
94
|
-
hotkeys:
|
|
94
|
+
hotkeys: Pe,
|
|
95
95
|
execute: (e) => {
|
|
96
96
|
e.handle?.toggleDebugBar?.();
|
|
97
97
|
}
|
|
98
|
-
}, ye = [{ key: "F11" }],
|
|
98
|
+
}, ye = [{ key: "F11" }], Ce = {
|
|
99
99
|
id: "toggleFullscreen",
|
|
100
100
|
enName: "Toggle Fullscreen",
|
|
101
101
|
enDescription: "Enter or exit fullscreen mode",
|
|
@@ -106,80 +106,80 @@ const pe = {
|
|
|
106
106
|
const o = e.data;
|
|
107
107
|
document.fullscreenElement ? document.exitFullscreen().catch(console.warn) : (o?.getFullscreenTarget?.() ?? document.documentElement).requestFullscreen().catch(console.warn);
|
|
108
108
|
}
|
|
109
|
-
},
|
|
109
|
+
}, Ie = [
|
|
110
110
|
Y,
|
|
111
111
|
Z,
|
|
112
112
|
ee,
|
|
113
113
|
oe,
|
|
114
114
|
te,
|
|
115
|
+
Ce,
|
|
115
116
|
Te,
|
|
116
|
-
|
|
117
|
-
pe
|
|
117
|
+
fe
|
|
118
118
|
];
|
|
119
|
-
function
|
|
119
|
+
function De(e, o) {
|
|
120
120
|
return o !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
if (
|
|
122
|
+
function Ne(e, o, a) {
|
|
123
|
+
if (De(o.key, a) !== e.key) return !1;
|
|
124
124
|
const n = e.modifiers ?? {};
|
|
125
125
|
return !(!!n.ctrl !== o.ctrlKey || !!n.shift !== o.shiftKey || !!n.alt !== o.altKey || !!n.meta !== o.metaKey);
|
|
126
126
|
}
|
|
127
|
-
const
|
|
127
|
+
const de = ce(null), Le = ({
|
|
128
128
|
flipBookRef: e,
|
|
129
129
|
currentPage: o,
|
|
130
130
|
totalPages: a,
|
|
131
131
|
direction: n = "ltr",
|
|
132
|
-
commands:
|
|
133
|
-
commandOptions:
|
|
132
|
+
commands: r = [],
|
|
133
|
+
commandOptions: c = {},
|
|
134
134
|
disableHotkeys: s = !1,
|
|
135
|
-
children:
|
|
135
|
+
children: i
|
|
136
136
|
}) => {
|
|
137
137
|
const h = Q(() => {
|
|
138
138
|
const d = {};
|
|
139
|
-
for (const u of
|
|
139
|
+
for (const u of Ie)
|
|
140
140
|
d[u.id] = {
|
|
141
141
|
command: u,
|
|
142
|
-
options:
|
|
142
|
+
options: c[u.id] ?? {}
|
|
143
143
|
};
|
|
144
|
-
for (const u of
|
|
144
|
+
for (const u of r)
|
|
145
145
|
d[u.id] = {
|
|
146
146
|
command: u,
|
|
147
|
-
options:
|
|
147
|
+
options: c[u.id] ?? {}
|
|
148
148
|
};
|
|
149
149
|
return d;
|
|
150
|
-
}, [
|
|
150
|
+
}, [r, c]), f = v(
|
|
151
151
|
(d, u) => {
|
|
152
|
-
const b = h[d.id]?.options ?? {},
|
|
152
|
+
const b = h[d.id]?.options ?? {}, F = u ? { ...b.data, ...u } : b.data;
|
|
153
153
|
return {
|
|
154
154
|
handle: e.current,
|
|
155
|
-
data:
|
|
155
|
+
data: F
|
|
156
156
|
};
|
|
157
157
|
},
|
|
158
158
|
[e, h]
|
|
159
|
-
), m =
|
|
159
|
+
), m = v(
|
|
160
160
|
(d, u) => {
|
|
161
161
|
const b = f(d, u);
|
|
162
162
|
d.canExecute && !d.canExecute(b) || d.execute(b);
|
|
163
163
|
},
|
|
164
164
|
[f]
|
|
165
|
-
), y =
|
|
165
|
+
), y = v(
|
|
166
166
|
(d) => {
|
|
167
167
|
const u = f(d);
|
|
168
168
|
return d.canExecute ? d.canExecute(u) : !0;
|
|
169
169
|
},
|
|
170
170
|
[f]
|
|
171
|
-
),
|
|
171
|
+
), D = v(
|
|
172
172
|
() => Object.values(h).map((d) => d.command),
|
|
173
173
|
[h]
|
|
174
|
-
),
|
|
174
|
+
), P = v(
|
|
175
175
|
(d) => {
|
|
176
176
|
const u = d.target;
|
|
177
177
|
if (!(u.tagName === "INPUT" || u.tagName === "TEXTAREA" || u.isContentEditable))
|
|
178
178
|
for (const b of Object.values(h)) {
|
|
179
179
|
if (b.options.disableHotkeys) continue;
|
|
180
|
-
const
|
|
181
|
-
for (const
|
|
182
|
-
if (
|
|
180
|
+
const F = b.options.hotkeys ?? b.command.hotkeys ?? [];
|
|
181
|
+
for (const M of F)
|
|
182
|
+
if (Ne(M, d, n)) {
|
|
183
183
|
d.preventDefault(), m(b.command);
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
@@ -187,25 +187,25 @@ const se = ce(null), Ne = ({
|
|
|
187
187
|
},
|
|
188
188
|
[h, m, n]
|
|
189
189
|
);
|
|
190
|
-
|
|
190
|
+
z(() => {
|
|
191
191
|
if (!s)
|
|
192
|
-
return document.addEventListener("keydown",
|
|
193
|
-
}, [s,
|
|
194
|
-
const
|
|
192
|
+
return document.addEventListener("keydown", P), () => document.removeEventListener("keydown", P);
|
|
193
|
+
}, [s, P]);
|
|
194
|
+
const C = Q(
|
|
195
195
|
() => ({
|
|
196
196
|
execute: m,
|
|
197
197
|
canExecute: y,
|
|
198
|
-
getAllCommands:
|
|
198
|
+
getAllCommands: D
|
|
199
199
|
}),
|
|
200
|
-
[m, y,
|
|
200
|
+
[m, y, D]
|
|
201
201
|
);
|
|
202
|
-
return /* @__PURE__ */ t(
|
|
202
|
+
return /* @__PURE__ */ t(de.Provider, { value: C, children: i });
|
|
203
203
|
}, _ = () => {
|
|
204
|
-
const e = ie(
|
|
204
|
+
const e = ie(de);
|
|
205
205
|
if (!e)
|
|
206
206
|
throw new Error("useCommands must be used within a CommandProvider");
|
|
207
207
|
return e;
|
|
208
|
-
}, S = { size: 24 },
|
|
208
|
+
}, S = { size: 24 }, Fe = ({ size: e = S.size, className: o }) => /* @__PURE__ */ t(
|
|
209
209
|
"svg",
|
|
210
210
|
{
|
|
211
211
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -237,7 +237,7 @@ const se = ce(null), Ne = ({
|
|
|
237
237
|
"aria-hidden": "true",
|
|
238
238
|
children: /* @__PURE__ */ t("path", { d: "m9 18 6-6-6-6" })
|
|
239
239
|
}
|
|
240
|
-
),
|
|
240
|
+
), je = ({ size: e = S.size, className: o }) => /* @__PURE__ */ T(
|
|
241
241
|
"svg",
|
|
242
242
|
{
|
|
243
243
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -256,7 +256,7 @@ const se = ce(null), Ne = ({
|
|
|
256
256
|
/* @__PURE__ */ t("path", { d: "M7 6v12" })
|
|
257
257
|
]
|
|
258
258
|
}
|
|
259
|
-
),
|
|
259
|
+
), Me = ({ size: e = S.size, className: o }) => /* @__PURE__ */ T(
|
|
260
260
|
"svg",
|
|
261
261
|
{
|
|
262
262
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -275,7 +275,7 @@ const se = ce(null), Ne = ({
|
|
|
275
275
|
/* @__PURE__ */ t("path", { d: "M17 6v12" })
|
|
276
276
|
]
|
|
277
277
|
}
|
|
278
|
-
), $e = ({ size: e = S.size, className: o }) => /* @__PURE__ */
|
|
278
|
+
), $e = ({ size: e = S.size, className: o }) => /* @__PURE__ */ T(
|
|
279
279
|
"svg",
|
|
280
280
|
{
|
|
281
281
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -296,7 +296,7 @@ const se = ce(null), Ne = ({
|
|
|
296
296
|
/* @__PURE__ */ t("path", { d: "M16 21h3a2 2 0 0 0 2-2v-3" })
|
|
297
297
|
]
|
|
298
298
|
}
|
|
299
|
-
), Be = ({ size: e = S.size, className: o }) => /* @__PURE__ */
|
|
299
|
+
), Be = ({ size: e = S.size, className: o }) => /* @__PURE__ */ T(
|
|
300
300
|
"svg",
|
|
301
301
|
{
|
|
302
302
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -320,7 +320,7 @@ const se = ce(null), Ne = ({
|
|
|
320
320
|
), Re = ({
|
|
321
321
|
size: e = S.size,
|
|
322
322
|
className: o
|
|
323
|
-
}) => /* @__PURE__ */
|
|
323
|
+
}) => /* @__PURE__ */ T(
|
|
324
324
|
"svg",
|
|
325
325
|
{
|
|
326
326
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -343,7 +343,7 @@ const se = ce(null), Ne = ({
|
|
|
343
343
|
/* @__PURE__ */ t("path", { d: "M21 19h.01" })
|
|
344
344
|
]
|
|
345
345
|
}
|
|
346
|
-
),
|
|
346
|
+
), Ve = ({ size: e = S.size, className: o }) => /* @__PURE__ */ T(
|
|
347
347
|
"svg",
|
|
348
348
|
{
|
|
349
349
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -365,7 +365,7 @@ const se = ce(null), Ne = ({
|
|
|
365
365
|
/* @__PURE__ */ t("rect", { x: "16", y: "6", width: "4", height: "15", rx: "0.5" })
|
|
366
366
|
]
|
|
367
367
|
}
|
|
368
|
-
),
|
|
368
|
+
), Se = ({ size: e = S.size, className: o }) => /* @__PURE__ */ T(
|
|
369
369
|
"svg",
|
|
370
370
|
{
|
|
371
371
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -388,37 +388,39 @@ const se = ce(null), Ne = ({
|
|
|
388
388
|
), U = ({
|
|
389
389
|
onClick: e,
|
|
390
390
|
ariaLabel: o,
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
391
|
+
ariaPressed: a,
|
|
392
|
+
disabled: n = !1,
|
|
393
|
+
children: r,
|
|
394
|
+
className: c = "",
|
|
395
|
+
title: s
|
|
395
396
|
}) => /* @__PURE__ */ t(
|
|
396
397
|
"button",
|
|
397
398
|
{
|
|
398
399
|
type: "button",
|
|
399
400
|
onClick: e,
|
|
400
401
|
"aria-label": o,
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
402
|
+
"aria-pressed": a,
|
|
403
|
+
disabled: n,
|
|
404
|
+
title: s ?? o,
|
|
405
|
+
className: `flipbook-toolbar-button ${c}`.trim(),
|
|
406
|
+
children: r
|
|
405
407
|
}
|
|
406
|
-
),
|
|
408
|
+
), Ge = ({
|
|
407
409
|
onClick: e,
|
|
408
410
|
ariaLabel: o,
|
|
409
411
|
children: a,
|
|
410
412
|
disabled: n = !1,
|
|
411
|
-
className:
|
|
413
|
+
className: r
|
|
412
414
|
}) => /* @__PURE__ */ t(
|
|
413
415
|
U,
|
|
414
416
|
{
|
|
415
417
|
onClick: e,
|
|
416
418
|
ariaLabel: o,
|
|
417
419
|
disabled: n,
|
|
418
|
-
className: `flipbook-toolbar-action ${
|
|
420
|
+
className: `flipbook-toolbar-action ${r ?? ""}`.trim(),
|
|
419
421
|
children: a
|
|
420
422
|
}
|
|
421
|
-
),
|
|
423
|
+
), Ke = {
|
|
422
424
|
align: "left",
|
|
423
425
|
direction: "ltr",
|
|
424
426
|
translations: {
|
|
@@ -437,9 +439,11 @@ const se = ce(null), Ne = ({
|
|
|
437
439
|
"command.toggleFullscreenDesc": "Enter or exit fullscreen mode",
|
|
438
440
|
"command.toggleDebug": "Toggle debug toolbar",
|
|
439
441
|
"command.toggleDebugDesc": "Show or hide the debug toolbar (Ctrl+Alt+D)",
|
|
440
|
-
"toolbarItem.goToPage": "Go to page"
|
|
442
|
+
"toolbarItem.goToPage": "Go to page",
|
|
443
|
+
"toolbarItem.selectText": "Select text with mouse",
|
|
444
|
+
"toolbarItem.selectionLetters": "Aa"
|
|
441
445
|
}
|
|
442
|
-
},
|
|
446
|
+
}, Ae = {
|
|
443
447
|
align: "right",
|
|
444
448
|
direction: "rtl",
|
|
445
449
|
translations: {
|
|
@@ -458,12 +462,14 @@ const se = ce(null), Ne = ({
|
|
|
458
462
|
"command.toggleFullscreenDesc": "כניסה או יציאה ממסך מלא",
|
|
459
463
|
"command.toggleDebug": "סרגל כלים לדיבוג",
|
|
460
464
|
"command.toggleDebugDesc": "הצג או הסתר סרגל הדיבוג (Ctrl+Alt+D)",
|
|
461
|
-
"toolbarItem.goToPage": "מעבר לעמוד"
|
|
465
|
+
"toolbarItem.goToPage": "מעבר לעמוד",
|
|
466
|
+
"toolbarItem.selectText": "בחירת טקסט עם העכבר",
|
|
467
|
+
"toolbarItem.selectionLetters": "אב"
|
|
462
468
|
}
|
|
463
469
|
}, ne = {
|
|
464
|
-
"en-US":
|
|
465
|
-
"he-IL":
|
|
466
|
-
}, ae = "en-US",
|
|
470
|
+
"en-US": Ke,
|
|
471
|
+
"he-IL": Ae
|
|
472
|
+
}, ae = "en-US", Oe = {
|
|
467
473
|
"toolbarItem.download": "Download",
|
|
468
474
|
"toolbarItem.downloadPageRange": "Download page range…",
|
|
469
475
|
"toolbarItem.download.from": "From",
|
|
@@ -481,35 +487,38 @@ const se = ce(null), Ne = ({
|
|
|
481
487
|
"command.toggleDebugDesc": "Show or hide the debug toolbar (Ctrl+Alt+D)",
|
|
482
488
|
"toolbarItem.goToPage": "Go to page"
|
|
483
489
|
};
|
|
484
|
-
function
|
|
490
|
+
function ue(e) {
|
|
485
491
|
return ne[e] ?? ne[ae];
|
|
486
492
|
}
|
|
487
|
-
function
|
|
488
|
-
return
|
|
493
|
+
function me(e) {
|
|
494
|
+
return ue(e).direction === "rtl";
|
|
489
495
|
}
|
|
490
|
-
function
|
|
491
|
-
return
|
|
496
|
+
function ze(e) {
|
|
497
|
+
return me(e) ? "rtl" : "ltr";
|
|
492
498
|
}
|
|
493
|
-
function
|
|
494
|
-
const a =
|
|
499
|
+
function L(e, o) {
|
|
500
|
+
const a = ue(o).translations[e];
|
|
495
501
|
if (a !== void 0 && a !== "") return a;
|
|
496
502
|
const n = ne[ae].translations[e];
|
|
497
|
-
return n !== void 0 && n !== "" ? n :
|
|
503
|
+
return n !== void 0 && n !== "" ? n : Oe[e] ?? e;
|
|
498
504
|
}
|
|
499
|
-
const
|
|
500
|
-
function
|
|
501
|
-
const e = ie(
|
|
505
|
+
const ge = ce(null);
|
|
506
|
+
function K() {
|
|
507
|
+
const e = ie(ge);
|
|
502
508
|
if (!e)
|
|
503
509
|
throw new Error("Toolbar components must be used within a Toolbar");
|
|
504
510
|
return e;
|
|
505
511
|
}
|
|
506
|
-
function le(e
|
|
512
|
+
function le(e) {
|
|
513
|
+
return e.replace(/[׳'״"]/g, "");
|
|
514
|
+
}
|
|
515
|
+
function se(e, o) {
|
|
507
516
|
try {
|
|
508
517
|
const a = atob(e.data), n = new Uint8Array(a.length);
|
|
509
|
-
for (let
|
|
510
|
-
n[
|
|
511
|
-
const
|
|
512
|
-
s.href =
|
|
518
|
+
for (let i = 0; i < a.length; i++)
|
|
519
|
+
n[i] = a.charCodeAt(i);
|
|
520
|
+
const r = new Blob([n]), c = URL.createObjectURL(r), s = document.createElement("a");
|
|
521
|
+
s.href = c, s.download = `${o}.${e.ext}`, s.click(), URL.revokeObjectURL(c);
|
|
513
522
|
} catch (a) {
|
|
514
523
|
console.error("Download failed:", a);
|
|
515
524
|
}
|
|
@@ -517,134 +526,136 @@ function le(e, o) {
|
|
|
517
526
|
function Ue(e, o) {
|
|
518
527
|
const a = [];
|
|
519
528
|
for (let n = 0; n < e; n++) {
|
|
520
|
-
const
|
|
521
|
-
if (!
|
|
529
|
+
const r = o?.indexToSemanticName(n) ?? "", c = o?.indexToTitle(n) ?? "";
|
|
530
|
+
if (!r && !c) {
|
|
522
531
|
o || a.push({ pageIndex: n, semanticName: String(n + 1), title: `Page ${n + 1}` });
|
|
523
532
|
continue;
|
|
524
533
|
}
|
|
525
534
|
a.push({
|
|
526
535
|
pageIndex: n,
|
|
527
|
-
semanticName:
|
|
528
|
-
title:
|
|
536
|
+
semanticName: r || String(n + 1),
|
|
537
|
+
title: c || r
|
|
529
538
|
});
|
|
530
539
|
}
|
|
531
540
|
return a;
|
|
532
541
|
}
|
|
533
|
-
const
|
|
542
|
+
const Je = ({
|
|
534
543
|
ariaLabel: e = "Download",
|
|
535
544
|
className: o
|
|
536
545
|
}) => {
|
|
537
546
|
const {
|
|
538
547
|
totalPages: a,
|
|
539
548
|
pageSemantics: n,
|
|
540
|
-
locale:
|
|
541
|
-
openDownloadMenuRef:
|
|
549
|
+
locale: r,
|
|
550
|
+
openDownloadMenuRef: c,
|
|
542
551
|
downloadExecutorRef: s,
|
|
543
|
-
flipBookRef:
|
|
544
|
-
} =
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
}), [
|
|
548
|
-
const [y,
|
|
552
|
+
flipBookRef: i
|
|
553
|
+
} = K(), h = i.current?.getDownloadConfig?.() ?? void 0, [f, m] = I(!1);
|
|
554
|
+
z(() => (c.current = () => m(!0), () => {
|
|
555
|
+
c.current = null;
|
|
556
|
+
}), [c]);
|
|
557
|
+
const [y, D] = I("entire"), [P, C] = I(0), [d, u] = I(0), [b, F] = I(null), [M, q] = I(!1), B = J(null), A = J(null), j = Q(
|
|
549
558
|
() => Ue(a, n),
|
|
550
559
|
[a, n]
|
|
551
|
-
),
|
|
552
|
-
|
|
553
|
-
f && (
|
|
554
|
-
}, [f,
|
|
555
|
-
const
|
|
560
|
+
), $ = !!h?.onDownloadSefer, R = !!h?.onDownloadPageRange, V = $ || R, O = j[0]?.pageIndex ?? 0, H = j[j.length - 1]?.pageIndex ?? 0;
|
|
561
|
+
z(() => {
|
|
562
|
+
f && (D($ ? "entire" : "range"), C(O), u(H));
|
|
563
|
+
}, [f, $, O, H]);
|
|
564
|
+
const N = v(() => {
|
|
556
565
|
m(!1);
|
|
557
566
|
}, []);
|
|
558
|
-
|
|
559
|
-
if (!f || !
|
|
560
|
-
const
|
|
567
|
+
he(() => {
|
|
568
|
+
if (!f || !A.current || !B.current) return;
|
|
569
|
+
const l = A.current, w = B.current.querySelector(".flipbook-toolbar-download-trigger"), E = () => {
|
|
561
570
|
const p = w?.getBoundingClientRect();
|
|
562
571
|
if (!p) return;
|
|
563
|
-
const
|
|
564
|
-
|
|
572
|
+
const k = l.getBoundingClientRect().height, G = window.innerHeight - p.bottom;
|
|
573
|
+
q(G < k + 8);
|
|
565
574
|
};
|
|
566
575
|
E();
|
|
567
576
|
const g = new ResizeObserver(E);
|
|
568
|
-
return g.observe(
|
|
569
|
-
}, [f]),
|
|
577
|
+
return g.observe(l), () => g.disconnect();
|
|
578
|
+
}, [f]), z(() => {
|
|
570
579
|
if (!f) return;
|
|
571
|
-
const
|
|
572
|
-
|
|
580
|
+
const l = (w) => {
|
|
581
|
+
B.current && !B.current.contains(w.target) && N();
|
|
573
582
|
};
|
|
574
|
-
return document.addEventListener("mousedown",
|
|
575
|
-
}, [f,
|
|
576
|
-
const
|
|
577
|
-
const
|
|
578
|
-
if (
|
|
579
|
-
|
|
583
|
+
return document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l);
|
|
584
|
+
}, [f, N]);
|
|
585
|
+
const x = v(async () => {
|
|
586
|
+
const l = i.current?.getDownloadConfig?.();
|
|
587
|
+
if (l?.onDownloadSefer) {
|
|
588
|
+
F("sefer");
|
|
580
589
|
try {
|
|
581
|
-
const w = await
|
|
582
|
-
w &&
|
|
590
|
+
const w = await l.onDownloadSefer();
|
|
591
|
+
w && se(w, l.entireBookFilename ?? "book"), N();
|
|
583
592
|
} finally {
|
|
584
|
-
|
|
593
|
+
F(null);
|
|
585
594
|
}
|
|
586
595
|
}
|
|
587
|
-
}, [
|
|
588
|
-
async (
|
|
589
|
-
const E =
|
|
596
|
+
}, [i, N]), W = v(
|
|
597
|
+
async (l, w) => {
|
|
598
|
+
const E = i.current?.getDownloadConfig?.();
|
|
590
599
|
if (!E?.onDownloadPageRange) return;
|
|
591
600
|
const g = [], p = [];
|
|
592
|
-
for (let
|
|
593
|
-
g.push(
|
|
594
|
-
const
|
|
595
|
-
|
|
601
|
+
for (let k = l; k <= w; k++) {
|
|
602
|
+
g.push(k);
|
|
603
|
+
const G = j.find((X) => X.pageIndex === k);
|
|
604
|
+
G && p.push(G);
|
|
596
605
|
}
|
|
597
|
-
|
|
606
|
+
F("range");
|
|
598
607
|
try {
|
|
599
|
-
const
|
|
608
|
+
const k = await E.onDownloadPageRange(
|
|
600
609
|
g,
|
|
601
610
|
p,
|
|
602
611
|
E.downloadContext
|
|
603
612
|
);
|
|
604
|
-
if (
|
|
605
|
-
const
|
|
606
|
-
|
|
613
|
+
if (k) {
|
|
614
|
+
const G = le(p[0]?.semanticName ?? String(l)), X = le(
|
|
615
|
+
p[p.length - 1]?.semanticName ?? String(w)
|
|
616
|
+
);
|
|
617
|
+
se(k, `${E.rangeFilename ?? "pages"}-${G}-${X}`);
|
|
607
618
|
}
|
|
608
|
-
|
|
619
|
+
N();
|
|
609
620
|
} finally {
|
|
610
|
-
|
|
621
|
+
F(null);
|
|
611
622
|
}
|
|
612
623
|
},
|
|
613
|
-
[
|
|
624
|
+
[i, j, N]
|
|
614
625
|
);
|
|
615
|
-
return
|
|
616
|
-
|
|
626
|
+
return z(() => (s.current = (l, w) => {
|
|
627
|
+
l === void 0 && w === void 0 ? x() : l !== void 0 && w !== void 0 && W(l, w);
|
|
617
628
|
}, () => {
|
|
618
629
|
s.current = null;
|
|
619
|
-
}), [s,
|
|
630
|
+
}), [s, x, W]), V ? /* @__PURE__ */ T("div", { className: `flipbook-toolbar-download-wrap ${o ?? ""}`.trim(), ref: B, children: [
|
|
620
631
|
/* @__PURE__ */ t(
|
|
621
632
|
"button",
|
|
622
633
|
{
|
|
623
634
|
type: "button",
|
|
624
635
|
className: "flipbook-toolbar-button flipbook-toolbar-download-trigger",
|
|
625
|
-
onClick: () => m((
|
|
626
|
-
"aria-label": e ??
|
|
636
|
+
onClick: () => m((l) => !l),
|
|
637
|
+
"aria-label": e ?? L("toolbarItem.download", r),
|
|
627
638
|
"aria-expanded": f,
|
|
628
639
|
"aria-haspopup": "true",
|
|
629
640
|
disabled: b !== null,
|
|
630
|
-
children: /* @__PURE__ */ t(
|
|
641
|
+
children: /* @__PURE__ */ t(Se, { size: 18 })
|
|
631
642
|
}
|
|
632
643
|
),
|
|
633
|
-
f && /* @__PURE__ */
|
|
644
|
+
f && /* @__PURE__ */ T(
|
|
634
645
|
"div",
|
|
635
646
|
{
|
|
636
|
-
ref:
|
|
637
|
-
className: `flipbook-toolbar-download-menu ${
|
|
647
|
+
ref: A,
|
|
648
|
+
className: `flipbook-toolbar-download-menu ${M ? "flipbook-toolbar-download-menu--open-up" : ""}`.trim(),
|
|
638
649
|
role: "menu",
|
|
639
|
-
dir:
|
|
650
|
+
dir: me(r) ? "rtl" : "ltr",
|
|
640
651
|
children: [
|
|
641
|
-
/* @__PURE__ */
|
|
652
|
+
/* @__PURE__ */ T(
|
|
642
653
|
"fieldset",
|
|
643
654
|
{
|
|
644
655
|
className: "flipbook-toolbar-download-mode",
|
|
645
|
-
"aria-label":
|
|
656
|
+
"aria-label": L("toolbarItem.download", r),
|
|
646
657
|
children: [
|
|
647
|
-
|
|
658
|
+
$ && /* @__PURE__ */ T("label", { className: "flipbook-toolbar-download-radio-label", children: [
|
|
648
659
|
/* @__PURE__ */ t(
|
|
649
660
|
"input",
|
|
650
661
|
{
|
|
@@ -652,12 +663,12 @@ const Ge = ({
|
|
|
652
663
|
name: "download-mode",
|
|
653
664
|
className: "flipbook-toolbar-download-radio",
|
|
654
665
|
checked: y === "entire",
|
|
655
|
-
onChange: () =>
|
|
666
|
+
onChange: () => D("entire")
|
|
656
667
|
}
|
|
657
668
|
),
|
|
658
|
-
/* @__PURE__ */ t("span", { children:
|
|
669
|
+
/* @__PURE__ */ t("span", { children: L("command.downloadEntireBook", r) })
|
|
659
670
|
] }),
|
|
660
|
-
R && /* @__PURE__ */
|
|
671
|
+
R && /* @__PURE__ */ T("label", { className: "flipbook-toolbar-download-radio-label", children: [
|
|
661
672
|
/* @__PURE__ */ t(
|
|
662
673
|
"input",
|
|
663
674
|
{
|
|
@@ -665,36 +676,36 @@ const Ge = ({
|
|
|
665
676
|
name: "download-mode",
|
|
666
677
|
className: "flipbook-toolbar-download-radio",
|
|
667
678
|
checked: y === "range",
|
|
668
|
-
onChange: () =>
|
|
679
|
+
onChange: () => D("range")
|
|
669
680
|
}
|
|
670
681
|
),
|
|
671
|
-
/* @__PURE__ */ t("span", { children:
|
|
682
|
+
/* @__PURE__ */ t("span", { children: L("toolbarItem.downloadPageRange", r) })
|
|
672
683
|
] })
|
|
673
684
|
]
|
|
674
685
|
}
|
|
675
686
|
),
|
|
676
|
-
y === "range" && /* @__PURE__ */
|
|
677
|
-
/* @__PURE__ */
|
|
678
|
-
|
|
687
|
+
y === "range" && /* @__PURE__ */ T("div", { className: "flipbook-toolbar-download-range", children: [
|
|
688
|
+
/* @__PURE__ */ T("label", { className: "flipbook-toolbar-download-range-label", children: [
|
|
689
|
+
L("toolbarItem.download.from", r),
|
|
679
690
|
/* @__PURE__ */ t(
|
|
680
691
|
"select",
|
|
681
692
|
{
|
|
682
|
-
value:
|
|
683
|
-
onChange: (
|
|
693
|
+
value: P,
|
|
694
|
+
onChange: (l) => C(Number(l.target.value)),
|
|
684
695
|
className: "flipbook-toolbar-download-range-select",
|
|
685
|
-
children:
|
|
696
|
+
children: j.map((l) => /* @__PURE__ */ t("option", { value: l.pageIndex, children: l.semanticName || l.title || `Page ${l.pageIndex + 1}` }, l.pageIndex))
|
|
686
697
|
}
|
|
687
698
|
)
|
|
688
699
|
] }),
|
|
689
|
-
/* @__PURE__ */
|
|
690
|
-
|
|
700
|
+
/* @__PURE__ */ T("label", { className: "flipbook-toolbar-download-range-label", children: [
|
|
701
|
+
L("toolbarItem.download.to", r),
|
|
691
702
|
/* @__PURE__ */ t(
|
|
692
703
|
"select",
|
|
693
704
|
{
|
|
694
705
|
value: d,
|
|
695
|
-
onChange: (
|
|
706
|
+
onChange: (l) => u(Number(l.target.value)),
|
|
696
707
|
className: "flipbook-toolbar-download-range-select",
|
|
697
|
-
children:
|
|
708
|
+
children: j.map((l) => /* @__PURE__ */ t("option", { value: l.pageIndex, children: l.semanticName || l.title || `Page ${l.pageIndex + 1}` }, l.pageIndex))
|
|
698
709
|
}
|
|
699
710
|
)
|
|
700
711
|
] })
|
|
@@ -707,198 +718,219 @@ const Ge = ({
|
|
|
707
718
|
className: "flipbook-toolbar-download-menuitem flipbook-toolbar-download-primary",
|
|
708
719
|
onClick: () => {
|
|
709
720
|
if (y === "entire")
|
|
710
|
-
|
|
721
|
+
x();
|
|
711
722
|
else {
|
|
712
|
-
const
|
|
713
|
-
let E = Math.max(
|
|
714
|
-
if (
|
|
715
|
-
|
|
723
|
+
const l = i.current?.getTotalPages?.() ?? a, w = Math.min(P, d);
|
|
724
|
+
let E = Math.max(P, d);
|
|
725
|
+
if (l > 0 && E >= l && (E = l - 1), E < w) return;
|
|
726
|
+
W(w, E);
|
|
716
727
|
}
|
|
717
728
|
},
|
|
718
729
|
disabled: b !== null,
|
|
719
|
-
children: b === "sefer" || b === "range" ? "…" :
|
|
730
|
+
children: b === "sefer" || b === "range" ? "…" : L("toolbarItem.download.download", r)
|
|
720
731
|
}
|
|
721
732
|
)
|
|
722
733
|
]
|
|
723
734
|
}
|
|
724
735
|
)
|
|
725
736
|
] }) : null;
|
|
726
|
-
},
|
|
727
|
-
const { locale: a } =
|
|
737
|
+
}, _e = ({ children: e, className: o }) => {
|
|
738
|
+
const { locale: a } = K(), { execute: n, canExecute: r } = _(), c = () => {
|
|
728
739
|
n(ee);
|
|
729
|
-
}, s = /* @__PURE__ */ t(
|
|
740
|
+
}, s = /* @__PURE__ */ t(je, { size: 18 }), i = L("command.jumpToFirstPage", a);
|
|
730
741
|
return /* @__PURE__ */ t(
|
|
731
742
|
U,
|
|
732
743
|
{
|
|
733
|
-
onClick:
|
|
734
|
-
ariaLabel:
|
|
735
|
-
title:
|
|
736
|
-
disabled: !
|
|
744
|
+
onClick: c,
|
|
745
|
+
ariaLabel: i,
|
|
746
|
+
title: i,
|
|
747
|
+
disabled: !r(ee),
|
|
737
748
|
className: `flipbook-toolbar-first ${o ?? ""}`.trim(),
|
|
738
749
|
children: e ?? s
|
|
739
750
|
}
|
|
740
751
|
);
|
|
741
|
-
},
|
|
752
|
+
}, Xe = ({
|
|
742
753
|
targetRef: e,
|
|
743
754
|
enterIcon: o,
|
|
744
755
|
exitIcon: a,
|
|
745
756
|
ariaLabelEnter: n = "Enter fullscreen",
|
|
746
|
-
ariaLabelExit:
|
|
747
|
-
className:
|
|
757
|
+
ariaLabelExit: r = "Exit fullscreen",
|
|
758
|
+
className: c
|
|
748
759
|
}) => {
|
|
749
|
-
const [s,
|
|
750
|
-
|
|
760
|
+
const [s, i] = I(!1), h = K(), f = e ?? h.fullscreenTargetRef, m = v(() => {
|
|
761
|
+
i(!!document.fullscreenElement);
|
|
751
762
|
}, []);
|
|
752
|
-
|
|
763
|
+
z(() => (document.addEventListener("fullscreenchange", m), () => {
|
|
753
764
|
document.removeEventListener("fullscreenchange", m);
|
|
754
765
|
}), [m]);
|
|
755
766
|
const y = async () => {
|
|
756
767
|
try {
|
|
757
768
|
s ? await document.exitFullscreen() : await (f?.current ?? document.documentElement).requestFullscreen();
|
|
758
|
-
} catch (
|
|
759
|
-
console.warn("Fullscreen request failed:",
|
|
769
|
+
} catch (C) {
|
|
770
|
+
console.warn("Fullscreen request failed:", C);
|
|
760
771
|
}
|
|
761
|
-
},
|
|
772
|
+
}, D = s ? r : n, P = s ? a ?? /* @__PURE__ */ t(Be, { size: 18 }) : o ?? /* @__PURE__ */ t($e, { size: 18 });
|
|
762
773
|
return /* @__PURE__ */ t(
|
|
763
774
|
U,
|
|
764
775
|
{
|
|
765
776
|
onClick: y,
|
|
766
|
-
ariaLabel:
|
|
767
|
-
className: `flipbook-toolbar-fullscreen ${s ? "flipbook-toolbar-fullscreen--active" : ""} ${
|
|
768
|
-
children:
|
|
777
|
+
ariaLabel: D,
|
|
778
|
+
className: `flipbook-toolbar-fullscreen ${s ? "flipbook-toolbar-fullscreen--active" : ""} ${c ?? ""}`.trim(),
|
|
779
|
+
children: P
|
|
769
780
|
}
|
|
770
781
|
);
|
|
771
|
-
},
|
|
772
|
-
const { locale: a } =
|
|
782
|
+
}, Qe = ({ children: e, className: o }) => {
|
|
783
|
+
const { locale: a } = K(), { execute: n, canExecute: r } = _(), c = () => {
|
|
773
784
|
n(oe);
|
|
774
|
-
}, s = /* @__PURE__ */ t(
|
|
785
|
+
}, s = /* @__PURE__ */ t(Me, { size: 18 }), i = L("command.jumpToLastPage", a);
|
|
775
786
|
return /* @__PURE__ */ t(
|
|
776
787
|
U,
|
|
777
788
|
{
|
|
778
|
-
onClick:
|
|
779
|
-
ariaLabel:
|
|
780
|
-
title:
|
|
781
|
-
disabled: !
|
|
789
|
+
onClick: c,
|
|
790
|
+
ariaLabel: i,
|
|
791
|
+
title: i,
|
|
792
|
+
disabled: !r(oe),
|
|
782
793
|
className: `flipbook-toolbar-last ${o ?? ""}`.trim(),
|
|
783
794
|
children: e ?? s
|
|
784
795
|
}
|
|
785
796
|
);
|
|
786
|
-
},
|
|
787
|
-
|
|
797
|
+
}, Ye = ({
|
|
798
|
+
letters: e,
|
|
799
|
+
ariaLabel: o,
|
|
800
|
+
className: a
|
|
801
|
+
}) => {
|
|
802
|
+
const { flipBookRef: n, locale: r, mouseMode: c } = K(), s = o ?? L("toolbarItem.selectText", r);
|
|
803
|
+
return /* @__PURE__ */ t(
|
|
804
|
+
U,
|
|
805
|
+
{
|
|
806
|
+
onClick: () => {
|
|
807
|
+
n.current?.setMouseMode(c === "turn" ? "select" : "turn"), window.getSelection()?.removeAllRanges();
|
|
808
|
+
},
|
|
809
|
+
ariaLabel: s,
|
|
810
|
+
ariaPressed: c === "select",
|
|
811
|
+
className: `flipbook-toolbar-mouse-mode ${a ?? ""}`.trim(),
|
|
812
|
+
children: /* @__PURE__ */ T("span", { className: "flipbook-toolbar-mouse-mode-icon", "aria-hidden": "true", children: [
|
|
813
|
+
/* @__PURE__ */ t("span", { className: "flipbook-toolbar-mouse-mode-caret" }),
|
|
814
|
+
/* @__PURE__ */ t("span", { children: e ?? L("toolbarItem.selectionLetters", r) })
|
|
815
|
+
] })
|
|
816
|
+
}
|
|
817
|
+
);
|
|
818
|
+
}, Ze = ({ children: e, className: o }) => {
|
|
819
|
+
const { locale: a } = K(), { execute: n, canExecute: r } = _(), c = () => {
|
|
788
820
|
n(Y);
|
|
789
|
-
}, s =
|
|
821
|
+
}, s = L("command.jumpToNextPage", a), i = /* @__PURE__ */ t(Ee, { size: 20 });
|
|
790
822
|
return /* @__PURE__ */ t(
|
|
791
823
|
U,
|
|
792
824
|
{
|
|
793
|
-
onClick:
|
|
825
|
+
onClick: c,
|
|
794
826
|
ariaLabel: s,
|
|
795
827
|
title: s,
|
|
796
|
-
disabled: !
|
|
828
|
+
disabled: !r(Y),
|
|
797
829
|
className: `flipbook-toolbar-next ${o ?? ""}`.trim(),
|
|
798
|
-
children: e ??
|
|
830
|
+
children: e ?? i
|
|
799
831
|
}
|
|
800
832
|
);
|
|
801
|
-
},
|
|
833
|
+
}, eo = ({
|
|
802
834
|
mode: e,
|
|
803
835
|
showTotal: o = !0,
|
|
804
836
|
placeholder: a = "—",
|
|
805
837
|
editable: n,
|
|
806
|
-
className:
|
|
807
|
-
ariaLabel:
|
|
838
|
+
className: r,
|
|
839
|
+
ariaLabel: c = "Go to page",
|
|
808
840
|
maxLength: s = 10
|
|
809
841
|
}) => {
|
|
810
|
-
const { flipBookRef:
|
|
811
|
-
(g) =>
|
|
812
|
-
[
|
|
813
|
-
),
|
|
814
|
-
const g =
|
|
815
|
-
let
|
|
816
|
-
return !g && !p ?
|
|
817
|
-
}, [
|
|
818
|
-
|
|
819
|
-
const g = m !==
|
|
820
|
-
|
|
821
|
-
}, [
|
|
822
|
-
const
|
|
842
|
+
const { flipBookRef: i, pageSemantics: h, direction: f, currentPage: m, totalPages: y, of: D } = K(), P = e ?? (h ? "semantic" : "index"), C = n ?? (P === "semantic" && !!h), [d, u] = I(""), [b, F] = I(!1), M = J(!1), q = J(m), B = m, A = m + 1 < y ? m + 1 : null, j = v(
|
|
843
|
+
(g) => P === "semantic" && h ? h.indexToSemanticName(g) || "" : String(g + 1),
|
|
844
|
+
[P, h]
|
|
845
|
+
), $ = j(B), R = A != null ? j(A) : "", V = v(() => String(D), [D]), O = v(() => {
|
|
846
|
+
const g = $, p = R;
|
|
847
|
+
let k;
|
|
848
|
+
return !g && !p ? k = a : g ? p ? g === p ? k = g : k = `${g} - ${p}` : k = g : k = p, o ? `${k} / ${V()}` : k;
|
|
849
|
+
}, [$, R, a, o, V]), H = f === "rtl" ? R || $ : $ || R, N = O();
|
|
850
|
+
z(() => {
|
|
851
|
+
const g = m !== q.current;
|
|
852
|
+
q.current = m, g && (M.current = !1), !b && !M.current && u(N);
|
|
853
|
+
}, [N, b, m]);
|
|
854
|
+
const x = v(
|
|
823
855
|
(g) => {
|
|
824
|
-
if (
|
|
825
|
-
|
|
856
|
+
if (C) {
|
|
857
|
+
F(!0), u(H), M.current = !1;
|
|
826
858
|
const p = () => g.target.select();
|
|
827
859
|
typeof requestAnimationFrame < "u" ? requestAnimationFrame(p) : p();
|
|
828
860
|
}
|
|
829
861
|
},
|
|
830
|
-
[
|
|
831
|
-
),
|
|
832
|
-
|
|
833
|
-
}, [
|
|
862
|
+
[C, H]
|
|
863
|
+
), W = v(() => {
|
|
864
|
+
F(!1), M.current || u(N);
|
|
865
|
+
}, [N]), l = v(
|
|
834
866
|
(g) => {
|
|
835
867
|
if (g.key === "Enter") {
|
|
836
868
|
if (h && d.trim()) {
|
|
837
869
|
const p = h.semanticNameToIndex(d.trim());
|
|
838
|
-
p != null && p >= 0 && p < y && (
|
|
870
|
+
p != null && p >= 0 && p < y && (i.current?.jumpToPage(p), M.current = !0);
|
|
839
871
|
}
|
|
840
872
|
g.currentTarget.blur();
|
|
841
873
|
} else g.key === "Escape" && g.currentTarget.blur();
|
|
842
874
|
},
|
|
843
|
-
[d, h, y,
|
|
844
|
-
), w =
|
|
875
|
+
[d, h, y, i]
|
|
876
|
+
), w = v((g) => {
|
|
845
877
|
u(g.target.value);
|
|
846
878
|
}, []);
|
|
847
|
-
return
|
|
879
|
+
return C ? /* @__PURE__ */ t(
|
|
848
880
|
"input",
|
|
849
881
|
{
|
|
850
882
|
type: "text",
|
|
851
|
-
className: `flipbook-toolbar-indicator ${b ? "flipbook-toolbar-indicator--editing" : ""} ${
|
|
883
|
+
className: `flipbook-toolbar-indicator ${b ? "flipbook-toolbar-indicator--editing" : ""} ${r ?? ""}`.trim(),
|
|
852
884
|
value: d,
|
|
853
|
-
onFocus:
|
|
854
|
-
onBlur:
|
|
855
|
-
onKeyDown:
|
|
885
|
+
onFocus: x,
|
|
886
|
+
onBlur: W,
|
|
887
|
+
onKeyDown: l,
|
|
856
888
|
onChange: w,
|
|
857
|
-
"aria-label":
|
|
889
|
+
"aria-label": c,
|
|
858
890
|
"aria-live": "polite",
|
|
859
891
|
"aria-atomic": "true",
|
|
860
892
|
maxLength: s,
|
|
861
|
-
readOnly: !
|
|
893
|
+
readOnly: !C
|
|
862
894
|
}
|
|
863
895
|
) : /* @__PURE__ */ t(
|
|
864
896
|
"span",
|
|
865
897
|
{
|
|
866
|
-
className: `flipbook-toolbar-indicator ${
|
|
898
|
+
className: `flipbook-toolbar-indicator ${r ?? ""}`.trim(),
|
|
867
899
|
"aria-live": "polite",
|
|
868
900
|
"aria-atomic": "true",
|
|
869
|
-
children:
|
|
901
|
+
children: N
|
|
870
902
|
}
|
|
871
903
|
);
|
|
872
|
-
},
|
|
873
|
-
const { locale: a } =
|
|
904
|
+
}, oo = ({ children: e, className: o }) => {
|
|
905
|
+
const { locale: a } = K(), { execute: n, canExecute: r } = _(), c = () => {
|
|
874
906
|
n(Z);
|
|
875
|
-
}, s =
|
|
907
|
+
}, s = L("command.jumpToPrevPage", a), i = /* @__PURE__ */ t(Fe, { size: 20 });
|
|
876
908
|
return /* @__PURE__ */ t(
|
|
877
909
|
U,
|
|
878
910
|
{
|
|
879
|
-
onClick:
|
|
911
|
+
onClick: c,
|
|
880
912
|
ariaLabel: s,
|
|
881
913
|
title: s,
|
|
882
|
-
disabled: !
|
|
914
|
+
disabled: !r(Z),
|
|
883
915
|
className: `flipbook-toolbar-prev ${o ?? ""}`.trim(),
|
|
884
|
-
children: e ??
|
|
916
|
+
children: e ?? i
|
|
885
917
|
}
|
|
886
918
|
);
|
|
887
|
-
},
|
|
888
|
-
const { locale: n } =
|
|
889
|
-
|
|
890
|
-
}, h = !
|
|
919
|
+
}, to = ({ children: e, ariaLabel: o, className: a }) => {
|
|
920
|
+
const { locale: n } = K(), { execute: r, canExecute: c } = _(), s = o ?? L("command.jumpToToc", n), i = () => {
|
|
921
|
+
r(te);
|
|
922
|
+
}, h = !c(te);
|
|
891
923
|
return /* @__PURE__ */ t(
|
|
892
924
|
U,
|
|
893
925
|
{
|
|
894
|
-
onClick:
|
|
926
|
+
onClick: i,
|
|
895
927
|
ariaLabel: s,
|
|
896
928
|
disabled: h,
|
|
897
929
|
className: `flipbook-toolbar-toc ${a ?? ""}`.trim(),
|
|
898
930
|
children: e ?? /* @__PURE__ */ t(Re, { size: 18 })
|
|
899
931
|
}
|
|
900
932
|
);
|
|
901
|
-
},
|
|
933
|
+
}, He = {
|
|
902
934
|
id: "openDownloadMenu",
|
|
903
935
|
enName: "Open download menu",
|
|
904
936
|
enDescription: "Open the download menu",
|
|
@@ -908,19 +940,19 @@ const Ge = ({
|
|
|
908
940
|
e.data?.open?.();
|
|
909
941
|
},
|
|
910
942
|
canExecute: (e) => typeof e.data?.open == "function"
|
|
911
|
-
},
|
|
943
|
+
}, no = ({
|
|
912
944
|
flipBookRef: e,
|
|
913
945
|
direction: o,
|
|
914
946
|
locale: a,
|
|
915
947
|
pageSemantics: n,
|
|
916
|
-
className:
|
|
917
|
-
children:
|
|
948
|
+
className: r = "",
|
|
949
|
+
children: c,
|
|
918
950
|
enableHotkeys: s = !0,
|
|
919
|
-
commands:
|
|
951
|
+
commands: i,
|
|
920
952
|
commandOptions: h,
|
|
921
953
|
fullscreenTargetRef: f
|
|
922
954
|
}) => {
|
|
923
|
-
const m = o ??
|
|
955
|
+
const m = o ?? ze(a ?? ae), y = a ?? (m === "rtl" ? "he-IL" : "en-US"), D = J(null), P = J(null), [C, d] = I(0), [u, b] = I(0), [F, M] = I(0), [q, B] = I(!0), [A, j] = I(!1), [$, R] = I("turn"), V = {
|
|
924
956
|
...f ? {
|
|
925
957
|
toggleFullscreen: {
|
|
926
958
|
data: {
|
|
@@ -929,98 +961,100 @@ const Ge = ({
|
|
|
929
961
|
}
|
|
930
962
|
} : {},
|
|
931
963
|
openDownloadMenu: {
|
|
932
|
-
data: { open: () =>
|
|
964
|
+
data: { open: () => D.current?.() }
|
|
933
965
|
},
|
|
934
966
|
download: {
|
|
935
967
|
data: {
|
|
936
|
-
onDownload: (
|
|
968
|
+
onDownload: (x, W) => P.current?.(x, W)
|
|
937
969
|
}
|
|
938
970
|
},
|
|
939
971
|
...h
|
|
940
|
-
},
|
|
941
|
-
const
|
|
942
|
-
|
|
972
|
+
}, O = v(() => {
|
|
973
|
+
const x = e.current;
|
|
974
|
+
x && (d(x.getCurrentPageIndex()), b(x.getTotalPages()), M(x.getOf()), B(x.isFirstPage()), j(x.isLastPage()), R(x.getMouseMode?.() ?? "turn"));
|
|
943
975
|
}, [e]);
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
const
|
|
947
|
-
return () => clearInterval(
|
|
948
|
-
}, [
|
|
976
|
+
z(() => {
|
|
977
|
+
O();
|
|
978
|
+
const x = setInterval(O, 200);
|
|
979
|
+
return () => clearInterval(x);
|
|
980
|
+
}, [O]);
|
|
949
981
|
const H = /* @__PURE__ */ t(
|
|
950
|
-
|
|
982
|
+
ge.Provider,
|
|
951
983
|
{
|
|
952
984
|
value: {
|
|
953
985
|
flipBookRef: e,
|
|
954
986
|
direction: m,
|
|
955
987
|
locale: y,
|
|
956
988
|
pageSemantics: n,
|
|
957
|
-
currentPage:
|
|
989
|
+
currentPage: C,
|
|
958
990
|
totalPages: u,
|
|
959
|
-
of:
|
|
960
|
-
isFirstPage:
|
|
961
|
-
isLastPage:
|
|
962
|
-
|
|
963
|
-
|
|
991
|
+
of: F,
|
|
992
|
+
isFirstPage: q,
|
|
993
|
+
isLastPage: A,
|
|
994
|
+
mouseMode: $,
|
|
995
|
+
openDownloadMenuRef: D,
|
|
996
|
+
downloadExecutorRef: P,
|
|
964
997
|
fullscreenTargetRef: f
|
|
965
998
|
},
|
|
966
999
|
children: /* @__PURE__ */ t(
|
|
967
1000
|
"div",
|
|
968
1001
|
{
|
|
969
|
-
className: `flipbook-toolbar ${m === "rtl" ? "flipbook-toolbar--rtl" : ""} ${
|
|
1002
|
+
className: `flipbook-toolbar ${m === "rtl" ? "flipbook-toolbar--rtl" : ""} ${r}`.trim(),
|
|
970
1003
|
role: "toolbar",
|
|
971
1004
|
"aria-label": "FlipBook navigation",
|
|
972
1005
|
dir: m,
|
|
973
|
-
children:
|
|
1006
|
+
children: c
|
|
974
1007
|
}
|
|
975
1008
|
)
|
|
976
1009
|
}
|
|
977
|
-
),
|
|
1010
|
+
), N = [He, ...i ?? []];
|
|
978
1011
|
return /* @__PURE__ */ t(
|
|
979
|
-
|
|
1012
|
+
Le,
|
|
980
1013
|
{
|
|
981
1014
|
flipBookRef: e,
|
|
982
|
-
currentPage:
|
|
1015
|
+
currentPage: C,
|
|
983
1016
|
totalPages: u,
|
|
984
1017
|
direction: m,
|
|
985
|
-
commands:
|
|
986
|
-
commandOptions:
|
|
1018
|
+
commands: N,
|
|
1019
|
+
commandOptions: V,
|
|
987
1020
|
disableHotkeys: !s,
|
|
988
1021
|
children: H
|
|
989
1022
|
}
|
|
990
1023
|
);
|
|
991
1024
|
};
|
|
992
1025
|
export {
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1026
|
+
Ge as ActionButton,
|
|
1027
|
+
Ve as BookshelfIcon,
|
|
1028
|
+
je as ChevronFirstIcon,
|
|
1029
|
+
Me as ChevronLastIcon,
|
|
1030
|
+
Fe as ChevronLeftIcon,
|
|
998
1031
|
Ee as ChevronRightIcon,
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1032
|
+
Je as DownloadDropdown,
|
|
1033
|
+
Se as DownloadIcon,
|
|
1034
|
+
_e as FirstPageButton,
|
|
1035
|
+
Xe as FullscreenButton,
|
|
1036
|
+
Qe as LastPageButton,
|
|
1004
1037
|
$e as MaximizeIcon,
|
|
1005
1038
|
Be as MinimizeIcon,
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1039
|
+
Ye as MouseModeButton,
|
|
1040
|
+
Ze as NextButton,
|
|
1041
|
+
eo as PageIndicator,
|
|
1042
|
+
oo as PrevButton,
|
|
1043
|
+
eo as SemanticPageIndicator,
|
|
1010
1044
|
Re as TableOfContentsIcon,
|
|
1011
|
-
|
|
1012
|
-
|
|
1045
|
+
to as TocButton,
|
|
1046
|
+
no as Toolbar,
|
|
1013
1047
|
U as ToolbarButton,
|
|
1014
|
-
|
|
1015
|
-
|
|
1048
|
+
Ie as defaultCommands,
|
|
1049
|
+
fe as downloadCommand,
|
|
1016
1050
|
Y as flipNextCommand,
|
|
1017
1051
|
Z as flipPrevCommand,
|
|
1018
1052
|
ee as goToFirstCommand,
|
|
1019
1053
|
oe as goToLastCommand,
|
|
1020
1054
|
te as goToTocCommand,
|
|
1021
|
-
|
|
1022
|
-
|
|
1055
|
+
Te as toggleDebugCommand,
|
|
1056
|
+
Ce as toggleFullscreenCommand,
|
|
1023
1057
|
_ as useCommands,
|
|
1024
|
-
|
|
1058
|
+
K as useToolbar
|
|
1025
1059
|
};
|
|
1026
1060
|
//# sourceMappingURL=index.js.map
|