html-flip-book-react 0.0.0-alpha.51 → 0.0.0-alpha.52
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 +1 -0
- package/dist/FlipBook.d.ts.map +1 -1
- package/dist/download/types.d.ts +1 -0
- package/dist/download/types.d.ts.map +1 -1
- package/dist/flip-book.js +31 -29
- package/dist/flip-book.js.map +1 -1
- package/dist/toolbar/index.d.ts +1 -0
- package/dist/toolbar/index.d.ts.map +1 -1
- package/dist/toolbar/index.js +308 -280
- package/dist/toolbar/index.js.map +1 -1
- package/package.json +2 -2
package/dist/toolbar/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as t, jsxs as y } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as
|
|
3
|
-
let
|
|
2
|
+
import { createContext as pe, useContext as fe, useMemo as ee, useCallback as P, useEffect as W, useState as D, useRef as _, useLayoutEffect as Pe } from "react";
|
|
3
|
+
let Te = 4;
|
|
4
4
|
function ue() {
|
|
5
|
-
return
|
|
5
|
+
return Te;
|
|
6
6
|
}
|
|
7
|
-
const
|
|
7
|
+
const ye = {
|
|
8
8
|
id: "download",
|
|
9
9
|
enName: "Download",
|
|
10
10
|
enDescription: "Download entire book or page range",
|
|
@@ -17,7 +17,7 @@ const Te = {
|
|
|
17
17
|
);
|
|
18
18
|
},
|
|
19
19
|
canExecute: (e) => typeof e.data?.onDownload == "function"
|
|
20
|
-
},
|
|
20
|
+
}, Ce = [
|
|
21
21
|
{ key: "ArrowRight" },
|
|
22
22
|
{ key: "PageDown" },
|
|
23
23
|
{ key: " " }
|
|
@@ -28,40 +28,40 @@ const Te = {
|
|
|
28
28
|
enName: "Next Page",
|
|
29
29
|
enDescription: "Flip to the next page",
|
|
30
30
|
nameKey: "command.jumpToNextPage",
|
|
31
|
-
hotkeys:
|
|
31
|
+
hotkeys: Ce,
|
|
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
|
+
}, Ie = [{ key: "ArrowLeft" }, { key: "PageUp" }], te = {
|
|
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: Ie,
|
|
43
43
|
execute: (e) => {
|
|
44
44
|
e.handle?.flipPrev();
|
|
45
45
|
},
|
|
46
46
|
canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) > 0
|
|
47
|
-
},
|
|
47
|
+
}, De = [{ key: "Home" }, { key: "ArrowLeft", modifiers: { ctrl: !0 } }], ne = {
|
|
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: De,
|
|
54
54
|
execute: (e) => {
|
|
55
55
|
e.handle?.jumpToPage(0);
|
|
56
56
|
},
|
|
57
57
|
canExecute: (e) => e.handle?.getCurrentPageIndex() !== 0
|
|
58
|
-
},
|
|
58
|
+
}, Ne = [{ key: "End" }, { key: "ArrowRight", modifiers: { ctrl: !0 } }], ae = {
|
|
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: Ne,
|
|
65
65
|
execute: (e) => {
|
|
66
66
|
const o = e.handle?.getTotalPages() ?? 0;
|
|
67
67
|
e.handle?.jumpToPage(o - 1);
|
|
@@ -70,13 +70,13 @@ const Te = {
|
|
|
70
70
|
const o = e.handle?.getCurrentPageIndex() ?? 0, a = e.handle?.getTotalPages() ?? 0;
|
|
71
71
|
return o !== a - 1;
|
|
72
72
|
}
|
|
73
|
-
},
|
|
73
|
+
}, Le = [{ key: "t" }], re = {
|
|
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: Le,
|
|
80
80
|
execute: (e) => {
|
|
81
81
|
const o = e.handle?.getTocPageIndex?.() ?? ue();
|
|
82
82
|
e.handle?.jumpToPage(o);
|
|
@@ -85,69 +85,69 @@ const Te = {
|
|
|
85
85
|
const o = e.handle?.getTocPageIndex?.() ?? ue();
|
|
86
86
|
return e.handle?.getCurrentPageIndex() !== o;
|
|
87
87
|
}
|
|
88
|
-
},
|
|
88
|
+
}, Ee = [{ key: "d", modifiers: { ctrl: !0, alt: !0 } }], Fe = {
|
|
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: Ee,
|
|
95
95
|
execute: (e) => {
|
|
96
96
|
e.handle?.toggleDebugBar?.();
|
|
97
97
|
}
|
|
98
|
-
},
|
|
98
|
+
}, je = [{ key: "F11" }], Me = {
|
|
99
99
|
id: "toggleFullscreen",
|
|
100
100
|
enName: "Toggle Fullscreen",
|
|
101
101
|
enDescription: "Enter or exit fullscreen mode",
|
|
102
102
|
nameKey: "command.toggleFullscreen",
|
|
103
103
|
descriptionKey: "command.toggleFullscreenDesc",
|
|
104
|
-
hotkeys:
|
|
104
|
+
hotkeys: je,
|
|
105
105
|
execute: (e) => {
|
|
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
|
+
}, $e = [
|
|
110
110
|
oe,
|
|
111
111
|
te,
|
|
112
112
|
ne,
|
|
113
113
|
ae,
|
|
114
114
|
re,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
Me,
|
|
116
|
+
Fe,
|
|
117
|
+
ye
|
|
118
118
|
];
|
|
119
|
-
function
|
|
119
|
+
function Be(e, o) {
|
|
120
120
|
return o !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
if (
|
|
124
|
-
const
|
|
125
|
-
return !(!!
|
|
122
|
+
function Se(e, o, a) {
|
|
123
|
+
if (Be(o.key, a) !== e.key) return !1;
|
|
124
|
+
const r = e.modifiers ?? {};
|
|
125
|
+
return !(!!r.ctrl !== o.ctrlKey || !!r.shift !== o.shiftKey || !!r.alt !== o.altKey || !!r.meta !== o.metaKey);
|
|
126
126
|
}
|
|
127
|
-
const
|
|
127
|
+
const be = pe(null), Re = ({
|
|
128
128
|
flipBookRef: e,
|
|
129
129
|
currentPage: o,
|
|
130
130
|
totalPages: a,
|
|
131
|
-
direction:
|
|
132
|
-
commands:
|
|
133
|
-
commandOptions:
|
|
134
|
-
disableHotkeys:
|
|
131
|
+
direction: r = "ltr",
|
|
132
|
+
commands: n = [],
|
|
133
|
+
commandOptions: s = {},
|
|
134
|
+
disableHotkeys: i = !1,
|
|
135
135
|
children: c
|
|
136
136
|
}) => {
|
|
137
137
|
const h = ee(() => {
|
|
138
138
|
const d = {};
|
|
139
|
-
for (const u of
|
|
139
|
+
for (const u of $e)
|
|
140
140
|
d[u.id] = {
|
|
141
141
|
command: u,
|
|
142
|
-
options:
|
|
142
|
+
options: s[u.id] ?? {}
|
|
143
143
|
};
|
|
144
|
-
for (const u of
|
|
144
|
+
for (const u of n)
|
|
145
145
|
d[u.id] = {
|
|
146
146
|
command: u,
|
|
147
|
-
options:
|
|
147
|
+
options: s[u.id] ?? {}
|
|
148
148
|
};
|
|
149
149
|
return d;
|
|
150
|
-
}, [
|
|
150
|
+
}, [n, s]), b = P(
|
|
151
151
|
(d, u) => {
|
|
152
152
|
const w = h[d.id]?.options ?? {}, F = u ? { ...w.data, ...u } : w.data;
|
|
153
153
|
return {
|
|
@@ -179,18 +179,18 @@ const fe = he(null), Re = ({
|
|
|
179
179
|
if (w.options.disableHotkeys) continue;
|
|
180
180
|
const F = w.options.hotkeys ?? w.command.hotkeys ?? [];
|
|
181
181
|
for (const M of F)
|
|
182
|
-
if (
|
|
182
|
+
if (Se(M, d, r)) {
|
|
183
183
|
d.preventDefault(), g(w.command);
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
},
|
|
188
|
-
[h, g,
|
|
188
|
+
[h, g, r]
|
|
189
189
|
);
|
|
190
190
|
W(() => {
|
|
191
|
-
if (!
|
|
191
|
+
if (!i)
|
|
192
192
|
return document.addEventListener("keydown", T), () => document.removeEventListener("keydown", T);
|
|
193
|
-
}, [
|
|
193
|
+
}, [i, T]);
|
|
194
194
|
const I = ee(
|
|
195
195
|
() => ({
|
|
196
196
|
execute: g,
|
|
@@ -199,13 +199,40 @@ const fe = he(null), Re = ({
|
|
|
199
199
|
}),
|
|
200
200
|
[g, C, N]
|
|
201
201
|
);
|
|
202
|
-
return /* @__PURE__ */ t(
|
|
202
|
+
return /* @__PURE__ */ t(be.Provider, { value: I, children: c });
|
|
203
203
|
}, X = () => {
|
|
204
|
-
const e =
|
|
204
|
+
const e = fe(be);
|
|
205
205
|
if (!e)
|
|
206
206
|
throw new Error("useCommands must be used within a CommandProvider");
|
|
207
207
|
return e;
|
|
208
|
-
}
|
|
208
|
+
};
|
|
209
|
+
function Ke(e) {
|
|
210
|
+
let o = "";
|
|
211
|
+
for (const a of new TextEncoder().encode(e))
|
|
212
|
+
o += String.fromCharCode(a);
|
|
213
|
+
return btoa(o);
|
|
214
|
+
}
|
|
215
|
+
function me(e) {
|
|
216
|
+
return { ext: "json", data: Ke(JSON.stringify(e, null, " ")) };
|
|
217
|
+
}
|
|
218
|
+
function oo(e) {
|
|
219
|
+
const { pagesCount: o, pageSemantics: a } = e, r = (n) => {
|
|
220
|
+
const s = a?.indexToSemanticName(n) ?? "", i = a?.indexToTitle(n) ?? "";
|
|
221
|
+
return a ? { pageIndex: n, semanticName: s, title: i } : { pageIndex: n, semanticName: String(n + 1), title: `Page ${n + 1}` };
|
|
222
|
+
};
|
|
223
|
+
return {
|
|
224
|
+
onDownloadSefer: () => {
|
|
225
|
+
const n = [];
|
|
226
|
+
for (let s = 0; s < o; s++) {
|
|
227
|
+
const i = r(s);
|
|
228
|
+
(i.semanticName || i.title) && n.push(i);
|
|
229
|
+
}
|
|
230
|
+
return Promise.resolve(me(n));
|
|
231
|
+
},
|
|
232
|
+
onDownloadPageRange: (n) => Promise.resolve(me(n.map(r)))
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
const K = { size: 24 }, Ae = ({ size: e = K.size, className: o }) => /* @__PURE__ */ t(
|
|
209
236
|
"svg",
|
|
210
237
|
{
|
|
211
238
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -221,7 +248,7 @@ const fe = he(null), Re = ({
|
|
|
221
248
|
"aria-hidden": "true",
|
|
222
249
|
children: /* @__PURE__ */ t("path", { d: "m15 18-6-6 6-6" })
|
|
223
250
|
}
|
|
224
|
-
),
|
|
251
|
+
), ze = ({ size: e = K.size, className: o }) => /* @__PURE__ */ t(
|
|
225
252
|
"svg",
|
|
226
253
|
{
|
|
227
254
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -237,7 +264,7 @@ const fe = he(null), Re = ({
|
|
|
237
264
|
"aria-hidden": "true",
|
|
238
265
|
children: /* @__PURE__ */ t("path", { d: "m9 18 6-6-6-6" })
|
|
239
266
|
}
|
|
240
|
-
),
|
|
267
|
+
), He = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
|
|
241
268
|
"svg",
|
|
242
269
|
{
|
|
243
270
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -256,7 +283,7 @@ const fe = he(null), Re = ({
|
|
|
256
283
|
/* @__PURE__ */ t("path", { d: "M7 6v12" })
|
|
257
284
|
]
|
|
258
285
|
}
|
|
259
|
-
),
|
|
286
|
+
), Oe = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
|
|
260
287
|
"svg",
|
|
261
288
|
{
|
|
262
289
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -275,7 +302,7 @@ const fe = he(null), Re = ({
|
|
|
275
302
|
/* @__PURE__ */ t("path", { d: "M17 6v12" })
|
|
276
303
|
]
|
|
277
304
|
}
|
|
278
|
-
),
|
|
305
|
+
), Ue = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
|
|
279
306
|
"svg",
|
|
280
307
|
{
|
|
281
308
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -296,7 +323,7 @@ const fe = he(null), Re = ({
|
|
|
296
323
|
/* @__PURE__ */ t("path", { d: "M16 21h3a2 2 0 0 0 2-2v-3" })
|
|
297
324
|
]
|
|
298
325
|
}
|
|
299
|
-
),
|
|
326
|
+
), We = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
|
|
300
327
|
"svg",
|
|
301
328
|
{
|
|
302
329
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -317,7 +344,7 @@ const fe = he(null), Re = ({
|
|
|
317
344
|
/* @__PURE__ */ t("path", { d: "M16 21v-3a2 2 0 0 1 2-2h3" })
|
|
318
345
|
]
|
|
319
346
|
}
|
|
320
|
-
),
|
|
347
|
+
), qe = ({
|
|
321
348
|
size: e = K.size,
|
|
322
349
|
className: o
|
|
323
350
|
}) => /* @__PURE__ */ y(
|
|
@@ -343,7 +370,7 @@ const fe = he(null), Re = ({
|
|
|
343
370
|
/* @__PURE__ */ t("path", { d: "M21 19h.01" })
|
|
344
371
|
]
|
|
345
372
|
}
|
|
346
|
-
),
|
|
373
|
+
), to = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
|
|
347
374
|
"svg",
|
|
348
375
|
{
|
|
349
376
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -365,7 +392,7 @@ const fe = he(null), Re = ({
|
|
|
365
392
|
/* @__PURE__ */ t("rect", { x: "16", y: "6", width: "4", height: "15", rx: "0.5" })
|
|
366
393
|
]
|
|
367
394
|
}
|
|
368
|
-
),
|
|
395
|
+
), Je = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
|
|
369
396
|
"svg",
|
|
370
397
|
{
|
|
371
398
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -389,10 +416,10 @@ const fe = he(null), Re = ({
|
|
|
389
416
|
onClick: e,
|
|
390
417
|
ariaLabel: o,
|
|
391
418
|
ariaPressed: a,
|
|
392
|
-
disabled:
|
|
393
|
-
children:
|
|
394
|
-
className:
|
|
395
|
-
title:
|
|
419
|
+
disabled: r = !1,
|
|
420
|
+
children: n,
|
|
421
|
+
className: s = "",
|
|
422
|
+
title: i
|
|
396
423
|
}) => /* @__PURE__ */ t(
|
|
397
424
|
"button",
|
|
398
425
|
{
|
|
@@ -400,38 +427,38 @@ const fe = he(null), Re = ({
|
|
|
400
427
|
onClick: e,
|
|
401
428
|
"aria-label": o,
|
|
402
429
|
"aria-pressed": a,
|
|
403
|
-
disabled:
|
|
404
|
-
title:
|
|
405
|
-
className: `flipbook-toolbar-button ${
|
|
406
|
-
children:
|
|
430
|
+
disabled: r,
|
|
431
|
+
title: i ?? o,
|
|
432
|
+
className: `flipbook-toolbar-button ${s}`.trim(),
|
|
433
|
+
children: n
|
|
407
434
|
}
|
|
408
|
-
),
|
|
435
|
+
), no = ({
|
|
409
436
|
onClick: e,
|
|
410
437
|
ariaLabel: o,
|
|
411
438
|
children: a,
|
|
412
|
-
disabled:
|
|
413
|
-
className:
|
|
439
|
+
disabled: r = !1,
|
|
440
|
+
className: n
|
|
414
441
|
}) => /* @__PURE__ */ t(
|
|
415
442
|
A,
|
|
416
443
|
{
|
|
417
444
|
onClick: e,
|
|
418
445
|
ariaLabel: o,
|
|
419
|
-
disabled:
|
|
420
|
-
className: `flipbook-toolbar-action ${
|
|
446
|
+
disabled: r,
|
|
447
|
+
className: `flipbook-toolbar-action ${n ?? ""}`.trim(),
|
|
421
448
|
children: a
|
|
422
449
|
}
|
|
423
|
-
),
|
|
450
|
+
), ao = ({
|
|
424
451
|
enabled: e,
|
|
425
452
|
onChange: o,
|
|
426
453
|
ariaLabel: a,
|
|
427
|
-
className:
|
|
454
|
+
className: r
|
|
428
455
|
}) => /* @__PURE__ */ t(
|
|
429
456
|
A,
|
|
430
457
|
{
|
|
431
458
|
onClick: () => o(!e),
|
|
432
459
|
ariaLabel: a ?? (e ? "Hide bookmarks" : "Show bookmarks"),
|
|
433
460
|
ariaPressed: e,
|
|
434
|
-
className: `flipbook-toolbar-bookmarks ${
|
|
461
|
+
className: `flipbook-toolbar-bookmarks ${r ?? ""}`.trim(),
|
|
435
462
|
children: /* @__PURE__ */ t("svg", { width: "18", height: "18", viewBox: "0 0 20 20", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ t(
|
|
436
463
|
"path",
|
|
437
464
|
{
|
|
@@ -443,7 +470,7 @@ const fe = he(null), Re = ({
|
|
|
443
470
|
}
|
|
444
471
|
) })
|
|
445
472
|
}
|
|
446
|
-
),
|
|
473
|
+
), Ve = {
|
|
447
474
|
align: "left",
|
|
448
475
|
direction: "ltr",
|
|
449
476
|
translations: {
|
|
@@ -466,7 +493,7 @@ const fe = he(null), Re = ({
|
|
|
466
493
|
"toolbarItem.selectText": "Select text with mouse",
|
|
467
494
|
"toolbarItem.selectionLetters": "Aa"
|
|
468
495
|
}
|
|
469
|
-
},
|
|
496
|
+
}, Ge = {
|
|
470
497
|
align: "right",
|
|
471
498
|
direction: "rtl",
|
|
472
499
|
translations: {
|
|
@@ -490,9 +517,9 @@ const fe = he(null), Re = ({
|
|
|
490
517
|
"toolbarItem.selectionLetters": "אב"
|
|
491
518
|
}
|
|
492
519
|
}, le = {
|
|
493
|
-
"en-US":
|
|
494
|
-
"he-IL":
|
|
495
|
-
},
|
|
520
|
+
"en-US": Ve,
|
|
521
|
+
"he-IL": Ge
|
|
522
|
+
}, se = "en-US", _e = {
|
|
496
523
|
"toolbarItem.download": "Download",
|
|
497
524
|
"toolbarItem.downloadPageRange": "Download page range…",
|
|
498
525
|
"toolbarItem.download.from": "From",
|
|
@@ -510,126 +537,126 @@ const fe = he(null), Re = ({
|
|
|
510
537
|
"command.toggleDebugDesc": "Show or hide the debug toolbar (Ctrl+Alt+D)",
|
|
511
538
|
"toolbarItem.goToPage": "Go to page"
|
|
512
539
|
};
|
|
513
|
-
function
|
|
514
|
-
return le[e] ?? le[
|
|
540
|
+
function we(e) {
|
|
541
|
+
return le[e] ?? le[se];
|
|
515
542
|
}
|
|
516
|
-
function
|
|
517
|
-
return
|
|
543
|
+
function ie(e) {
|
|
544
|
+
return we(e).direction === "rtl";
|
|
518
545
|
}
|
|
519
|
-
function
|
|
520
|
-
return
|
|
546
|
+
function Xe(e) {
|
|
547
|
+
return ie(e) ? "rtl" : "ltr";
|
|
521
548
|
}
|
|
522
549
|
function E(e, o) {
|
|
523
|
-
const a =
|
|
550
|
+
const a = we(o).translations[e];
|
|
524
551
|
if (a !== void 0 && a !== "") return a;
|
|
525
|
-
const
|
|
526
|
-
return
|
|
552
|
+
const r = le[se].translations[e];
|
|
553
|
+
return r !== void 0 && r !== "" ? r : _e[e] ?? e;
|
|
527
554
|
}
|
|
528
|
-
const
|
|
555
|
+
const xe = pe(null);
|
|
529
556
|
function z() {
|
|
530
|
-
const e =
|
|
557
|
+
const e = fe(xe);
|
|
531
558
|
if (!e)
|
|
532
559
|
throw new Error("Toolbar components must be used within a Toolbar");
|
|
533
560
|
return e;
|
|
534
561
|
}
|
|
535
|
-
function
|
|
562
|
+
function ge(e) {
|
|
536
563
|
return e.replace(/[׳'״"]/g, "");
|
|
537
564
|
}
|
|
538
|
-
function
|
|
565
|
+
function he(e, o) {
|
|
539
566
|
try {
|
|
540
|
-
const a = atob(e.data),
|
|
567
|
+
const a = atob(e.data), r = new Uint8Array(a.length);
|
|
541
568
|
for (let c = 0; c < a.length; c++)
|
|
542
|
-
|
|
543
|
-
const
|
|
544
|
-
|
|
569
|
+
r[c] = a.charCodeAt(c);
|
|
570
|
+
const n = new Blob([r]), s = URL.createObjectURL(n), i = document.createElement("a");
|
|
571
|
+
i.href = s, i.download = `${o}.${e.ext}`, i.click(), URL.revokeObjectURL(s);
|
|
545
572
|
} catch (a) {
|
|
546
573
|
console.error("Download failed:", a);
|
|
547
574
|
}
|
|
548
575
|
}
|
|
549
|
-
function
|
|
576
|
+
function Qe(e, o) {
|
|
550
577
|
const a = [];
|
|
551
|
-
for (let
|
|
552
|
-
const
|
|
553
|
-
if (!
|
|
554
|
-
o || a.push({ pageIndex:
|
|
578
|
+
for (let r = 0; r < e; r++) {
|
|
579
|
+
const n = o?.indexToSemanticName(r) ?? "", s = o?.indexToTitle(r) ?? "";
|
|
580
|
+
if (!n && !s) {
|
|
581
|
+
o || a.push({ pageIndex: r, semanticName: String(r + 1), title: `Page ${r + 1}` });
|
|
555
582
|
continue;
|
|
556
583
|
}
|
|
557
584
|
a.push({
|
|
558
|
-
pageIndex:
|
|
559
|
-
semanticName:
|
|
560
|
-
title:
|
|
585
|
+
pageIndex: r,
|
|
586
|
+
semanticName: n || String(r + 1),
|
|
587
|
+
title: s || n
|
|
561
588
|
});
|
|
562
589
|
}
|
|
563
590
|
return a;
|
|
564
591
|
}
|
|
565
|
-
const
|
|
592
|
+
const ro = ({
|
|
566
593
|
ariaLabel: e = "Download",
|
|
567
594
|
className: o
|
|
568
595
|
}) => {
|
|
569
596
|
const {
|
|
570
597
|
totalPages: a,
|
|
571
|
-
pageSemantics:
|
|
572
|
-
locale:
|
|
573
|
-
openDownloadMenuRef:
|
|
574
|
-
downloadExecutorRef:
|
|
598
|
+
pageSemantics: r,
|
|
599
|
+
locale: n,
|
|
600
|
+
openDownloadMenuRef: s,
|
|
601
|
+
downloadExecutorRef: i,
|
|
575
602
|
flipBookRef: c
|
|
576
603
|
} = z(), h = c.current?.getDownloadConfig?.() ?? void 0, [b, g] = D(!1);
|
|
577
|
-
W(() => (
|
|
578
|
-
|
|
579
|
-
}), [
|
|
580
|
-
const [C, N] = D("entire"), [T, I] = D(0), [d, u] = D(0), [w, F] = D(null), [M,
|
|
581
|
-
() =>
|
|
582
|
-
[a,
|
|
583
|
-
), $ = !!h?.onDownloadSefer,
|
|
604
|
+
W(() => (s.current = () => g(!0), () => {
|
|
605
|
+
s.current = null;
|
|
606
|
+
}), [s]);
|
|
607
|
+
const [C, N] = D("entire"), [T, I] = D(0), [d, u] = D(0), [w, F] = D(null), [M, V] = D(!1), S = _(null), H = _(null), j = ee(
|
|
608
|
+
() => Qe(a, r),
|
|
609
|
+
[a, r]
|
|
610
|
+
), $ = !!h?.onDownloadSefer, R = !!h?.onDownloadPageRange, G = $ || R, O = j[0]?.pageIndex ?? 0, q = j[j.length - 1]?.pageIndex ?? 0;
|
|
584
611
|
W(() => {
|
|
585
612
|
b && (N($ ? "entire" : "range"), I(O), u(q));
|
|
586
613
|
}, [b, $, O, q]);
|
|
587
614
|
const L = P(() => {
|
|
588
615
|
g(!1);
|
|
589
616
|
}, []);
|
|
590
|
-
|
|
591
|
-
if (!b || !H.current || !
|
|
592
|
-
const
|
|
593
|
-
const p =
|
|
617
|
+
Pe(() => {
|
|
618
|
+
if (!b || !H.current || !S.current) return;
|
|
619
|
+
const l = H.current, x = S.current.querySelector(".flipbook-toolbar-download-trigger"), v = () => {
|
|
620
|
+
const p = x?.getBoundingClientRect();
|
|
594
621
|
if (!p) return;
|
|
595
|
-
const B = 8, U = 6, Y = window.innerHeight - p.bottom - U - B, ce = p.top - U - B, de = Math.min(
|
|
596
|
-
|
|
597
|
-
const Q =
|
|
598
|
-
|
|
599
|
-
const
|
|
600
|
-
|
|
622
|
+
const B = 8, U = 6, Y = window.innerHeight - p.bottom - U - B, ce = p.top - U - B, de = Math.min(l.scrollHeight, window.innerHeight * 0.7, 480), Z = Y < de && ce > Y;
|
|
623
|
+
l.style.maxHeight = `${Math.max(0, Math.min(de, Z ? ce : Y))}px`;
|
|
624
|
+
const Q = l.getBoundingClientRect(), ke = ie(n) ? p.left : p.right - Q.width;
|
|
625
|
+
l.style.left = `${Math.max(B, Math.min(ke, window.innerWidth - Q.width - B))}px`;
|
|
626
|
+
const ve = Z ? p.top - U - Q.height : p.bottom + U;
|
|
627
|
+
l.style.top = `${Math.max(B, Math.min(ve, window.innerHeight - Q.height - B))}px`, V(Z);
|
|
601
628
|
};
|
|
602
629
|
v();
|
|
603
630
|
const m = new ResizeObserver(v);
|
|
604
|
-
m.observe(
|
|
605
|
-
const f =
|
|
631
|
+
m.observe(l);
|
|
632
|
+
const f = S.current.closest('[role="toolbar"]');
|
|
606
633
|
return f && m.observe(f), window.addEventListener("resize", v), window.addEventListener("scroll", v, !0), () => {
|
|
607
634
|
m.disconnect(), window.removeEventListener("resize", v), window.removeEventListener("scroll", v, !0);
|
|
608
635
|
};
|
|
609
|
-
}, [b,
|
|
636
|
+
}, [b, n]), W(() => {
|
|
610
637
|
if (!b) return;
|
|
611
|
-
const
|
|
612
|
-
|
|
638
|
+
const l = (x) => {
|
|
639
|
+
S.current && !S.current.contains(x.target) && L();
|
|
613
640
|
};
|
|
614
|
-
return document.addEventListener("mousedown",
|
|
641
|
+
return document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l);
|
|
615
642
|
}, [b, L]);
|
|
616
|
-
const
|
|
617
|
-
const
|
|
618
|
-
if (
|
|
643
|
+
const k = P(async () => {
|
|
644
|
+
const l = c.current?.getDownloadConfig?.();
|
|
645
|
+
if (l?.onDownloadSefer) {
|
|
619
646
|
F("sefer");
|
|
620
647
|
try {
|
|
621
|
-
const
|
|
622
|
-
|
|
648
|
+
const x = await l.onDownloadSefer();
|
|
649
|
+
x && he(x, l.entireBookFilename ?? "book"), L();
|
|
623
650
|
} finally {
|
|
624
651
|
F(null);
|
|
625
652
|
}
|
|
626
653
|
}
|
|
627
|
-
}, [c, L]),
|
|
628
|
-
async (
|
|
654
|
+
}, [c, L]), J = P(
|
|
655
|
+
async (l, x) => {
|
|
629
656
|
const v = c.current?.getDownloadConfig?.();
|
|
630
657
|
if (!v?.onDownloadPageRange) return;
|
|
631
658
|
const m = [], f = [];
|
|
632
|
-
for (let p =
|
|
659
|
+
for (let p = l; p <= x; p++) {
|
|
633
660
|
m.push(p);
|
|
634
661
|
const B = j.find((U) => U.pageIndex === p);
|
|
635
662
|
B && f.push(B);
|
|
@@ -642,10 +669,10 @@ const to = ({
|
|
|
642
669
|
v.downloadContext
|
|
643
670
|
);
|
|
644
671
|
if (p) {
|
|
645
|
-
const B =
|
|
646
|
-
f[f.length - 1]?.semanticName ?? String(
|
|
672
|
+
const B = ge(f[0]?.semanticName ?? String(l)), U = ge(
|
|
673
|
+
f[f.length - 1]?.semanticName ?? String(x)
|
|
647
674
|
);
|
|
648
|
-
|
|
675
|
+
he(p, `${v.rangeFilename ?? "pages"}-${B}-${U}`);
|
|
649
676
|
}
|
|
650
677
|
L();
|
|
651
678
|
} finally {
|
|
@@ -654,22 +681,22 @@ const to = ({
|
|
|
654
681
|
},
|
|
655
682
|
[c, j, L]
|
|
656
683
|
);
|
|
657
|
-
return W(() => (
|
|
658
|
-
|
|
684
|
+
return W(() => (i.current = (l, x) => {
|
|
685
|
+
l === void 0 && x === void 0 ? k() : l !== void 0 && x !== void 0 && J(l, x);
|
|
659
686
|
}, () => {
|
|
660
|
-
|
|
661
|
-
}), [
|
|
687
|
+
i.current = null;
|
|
688
|
+
}), [i, k, J]), G ? /* @__PURE__ */ y("div", { className: `flipbook-toolbar-download-wrap ${o ?? ""}`.trim(), ref: S, children: [
|
|
662
689
|
/* @__PURE__ */ t(
|
|
663
690
|
"button",
|
|
664
691
|
{
|
|
665
692
|
type: "button",
|
|
666
693
|
className: "flipbook-toolbar-button flipbook-toolbar-download-trigger",
|
|
667
|
-
onClick: () => g((
|
|
668
|
-
"aria-label": e ?? E("toolbarItem.download",
|
|
694
|
+
onClick: () => g((l) => !l),
|
|
695
|
+
"aria-label": e ?? E("toolbarItem.download", n),
|
|
669
696
|
"aria-expanded": b,
|
|
670
697
|
"aria-haspopup": "true",
|
|
671
698
|
disabled: w !== null,
|
|
672
|
-
children: /* @__PURE__ */ t(
|
|
699
|
+
children: /* @__PURE__ */ t(Je, { size: 18 })
|
|
673
700
|
}
|
|
674
701
|
),
|
|
675
702
|
b && /* @__PURE__ */ y(
|
|
@@ -678,13 +705,13 @@ const to = ({
|
|
|
678
705
|
ref: H,
|
|
679
706
|
className: `flipbook-toolbar-download-menu ${M ? "flipbook-toolbar-download-menu--open-up" : ""}`.trim(),
|
|
680
707
|
role: "menu",
|
|
681
|
-
dir:
|
|
708
|
+
dir: ie(n) ? "rtl" : "ltr",
|
|
682
709
|
children: [
|
|
683
710
|
/* @__PURE__ */ y(
|
|
684
711
|
"fieldset",
|
|
685
712
|
{
|
|
686
713
|
className: "flipbook-toolbar-download-mode",
|
|
687
|
-
"aria-label": E("toolbarItem.download",
|
|
714
|
+
"aria-label": E("toolbarItem.download", n),
|
|
688
715
|
children: [
|
|
689
716
|
$ && /* @__PURE__ */ y("label", { className: "flipbook-toolbar-download-radio-label", children: [
|
|
690
717
|
/* @__PURE__ */ t(
|
|
@@ -697,9 +724,9 @@ const to = ({
|
|
|
697
724
|
onChange: () => N("entire")
|
|
698
725
|
}
|
|
699
726
|
),
|
|
700
|
-
/* @__PURE__ */ t("span", { children: E("command.downloadEntireBook",
|
|
727
|
+
/* @__PURE__ */ t("span", { children: E("command.downloadEntireBook", n) })
|
|
701
728
|
] }),
|
|
702
|
-
|
|
729
|
+
R && /* @__PURE__ */ y("label", { className: "flipbook-toolbar-download-radio-label", children: [
|
|
703
730
|
/* @__PURE__ */ t(
|
|
704
731
|
"input",
|
|
705
732
|
{
|
|
@@ -710,33 +737,33 @@ const to = ({
|
|
|
710
737
|
onChange: () => N("range")
|
|
711
738
|
}
|
|
712
739
|
),
|
|
713
|
-
/* @__PURE__ */ t("span", { children: E("toolbarItem.downloadPageRange",
|
|
740
|
+
/* @__PURE__ */ t("span", { children: E("toolbarItem.downloadPageRange", n) })
|
|
714
741
|
] })
|
|
715
742
|
]
|
|
716
743
|
}
|
|
717
744
|
),
|
|
718
745
|
C === "range" && /* @__PURE__ */ y("div", { className: "flipbook-toolbar-download-range", children: [
|
|
719
746
|
/* @__PURE__ */ y("label", { className: "flipbook-toolbar-download-range-label", children: [
|
|
720
|
-
E("toolbarItem.download.from",
|
|
747
|
+
E("toolbarItem.download.from", n),
|
|
721
748
|
/* @__PURE__ */ t(
|
|
722
749
|
"select",
|
|
723
750
|
{
|
|
724
751
|
value: T,
|
|
725
|
-
onChange: (
|
|
752
|
+
onChange: (l) => I(Number(l.target.value)),
|
|
726
753
|
className: "flipbook-toolbar-download-range-select",
|
|
727
|
-
children: j.map((
|
|
754
|
+
children: j.map((l) => /* @__PURE__ */ t("option", { value: l.pageIndex, children: l.semanticName || l.title || `Page ${l.pageIndex + 1}` }, l.pageIndex))
|
|
728
755
|
}
|
|
729
756
|
)
|
|
730
757
|
] }),
|
|
731
758
|
/* @__PURE__ */ y("label", { className: "flipbook-toolbar-download-range-label", children: [
|
|
732
|
-
E("toolbarItem.download.to",
|
|
759
|
+
E("toolbarItem.download.to", n),
|
|
733
760
|
/* @__PURE__ */ t(
|
|
734
761
|
"select",
|
|
735
762
|
{
|
|
736
763
|
value: d,
|
|
737
|
-
onChange: (
|
|
764
|
+
onChange: (l) => u(Number(l.target.value)),
|
|
738
765
|
className: "flipbook-toolbar-download-range-select",
|
|
739
|
-
children: j.map((
|
|
766
|
+
children: j.map((l) => /* @__PURE__ */ t("option", { value: l.pageIndex, children: l.semanticName || l.title || `Page ${l.pageIndex + 1}` }, l.pageIndex))
|
|
740
767
|
}
|
|
741
768
|
)
|
|
742
769
|
] })
|
|
@@ -749,46 +776,46 @@ const to = ({
|
|
|
749
776
|
className: "flipbook-toolbar-download-menuitem flipbook-toolbar-download-primary",
|
|
750
777
|
onClick: () => {
|
|
751
778
|
if (C === "entire")
|
|
752
|
-
|
|
779
|
+
k();
|
|
753
780
|
else {
|
|
754
|
-
const
|
|
781
|
+
const l = c.current?.getTotalPages?.() ?? a, x = Math.min(T, d);
|
|
755
782
|
let v = Math.max(T, d);
|
|
756
|
-
if (
|
|
757
|
-
|
|
783
|
+
if (l > 0 && v >= l && (v = l - 1), v < x) return;
|
|
784
|
+
J(x, v);
|
|
758
785
|
}
|
|
759
786
|
},
|
|
760
787
|
disabled: w !== null,
|
|
761
|
-
children: w === "sefer" || w === "range" ? "…" : E("toolbarItem.download.download",
|
|
788
|
+
children: w === "sefer" || w === "range" ? "…" : E("toolbarItem.download.download", n)
|
|
762
789
|
}
|
|
763
790
|
)
|
|
764
791
|
]
|
|
765
792
|
}
|
|
766
793
|
)
|
|
767
794
|
] }) : null;
|
|
768
|
-
},
|
|
769
|
-
const { locale: a } = z(), { execute:
|
|
770
|
-
|
|
771
|
-
},
|
|
795
|
+
}, lo = ({ children: e, className: o }) => {
|
|
796
|
+
const { locale: a } = z(), { execute: r, canExecute: n } = X(), s = () => {
|
|
797
|
+
r(ne);
|
|
798
|
+
}, i = /* @__PURE__ */ t(He, { size: 18 }), c = E("command.jumpToFirstPage", a);
|
|
772
799
|
return /* @__PURE__ */ t(
|
|
773
800
|
A,
|
|
774
801
|
{
|
|
775
|
-
onClick:
|
|
802
|
+
onClick: s,
|
|
776
803
|
ariaLabel: c,
|
|
777
804
|
title: c,
|
|
778
|
-
disabled: !
|
|
805
|
+
disabled: !n(ne),
|
|
779
806
|
className: `flipbook-toolbar-first ${o ?? ""}`.trim(),
|
|
780
|
-
children: e ??
|
|
807
|
+
children: e ?? i
|
|
781
808
|
}
|
|
782
809
|
);
|
|
783
|
-
},
|
|
810
|
+
}, io = ({
|
|
784
811
|
targetRef: e,
|
|
785
812
|
enterIcon: o,
|
|
786
813
|
exitIcon: a,
|
|
787
|
-
ariaLabelEnter:
|
|
788
|
-
ariaLabelExit:
|
|
789
|
-
className:
|
|
814
|
+
ariaLabelEnter: r = "Enter fullscreen",
|
|
815
|
+
ariaLabelExit: n = "Exit fullscreen",
|
|
816
|
+
className: s
|
|
790
817
|
}) => {
|
|
791
|
-
const [
|
|
818
|
+
const [i, c] = D(!1), h = z(), b = e ?? h.fullscreenTargetRef, g = P(() => {
|
|
792
819
|
c(!!document.fullscreenElement);
|
|
793
820
|
}, []);
|
|
794
821
|
W(() => (document.addEventListener("fullscreenchange", g), () => {
|
|
@@ -796,93 +823,93 @@ const to = ({
|
|
|
796
823
|
}), [g]);
|
|
797
824
|
const C = async () => {
|
|
798
825
|
try {
|
|
799
|
-
|
|
826
|
+
i ? await document.exitFullscreen() : await (b?.current ?? document.documentElement).requestFullscreen();
|
|
800
827
|
} catch (I) {
|
|
801
828
|
console.warn("Fullscreen request failed:", I);
|
|
802
829
|
}
|
|
803
|
-
}, N =
|
|
830
|
+
}, N = i ? n : r, T = i ? a ?? /* @__PURE__ */ t(We, { size: 18 }) : o ?? /* @__PURE__ */ t(Ue, { size: 18 });
|
|
804
831
|
return /* @__PURE__ */ t(
|
|
805
832
|
A,
|
|
806
833
|
{
|
|
807
834
|
onClick: C,
|
|
808
835
|
ariaLabel: N,
|
|
809
|
-
className: `flipbook-toolbar-fullscreen ${
|
|
836
|
+
className: `flipbook-toolbar-fullscreen ${i ? "flipbook-toolbar-fullscreen--active" : ""} ${s ?? ""}`.trim(),
|
|
810
837
|
children: T
|
|
811
838
|
}
|
|
812
839
|
);
|
|
813
|
-
},
|
|
814
|
-
const { locale: a } = z(), { execute:
|
|
815
|
-
|
|
816
|
-
},
|
|
840
|
+
}, so = ({ children: e, className: o }) => {
|
|
841
|
+
const { locale: a } = z(), { execute: r, canExecute: n } = X(), s = () => {
|
|
842
|
+
r(ae);
|
|
843
|
+
}, i = /* @__PURE__ */ t(Oe, { size: 18 }), c = E("command.jumpToLastPage", a);
|
|
817
844
|
return /* @__PURE__ */ t(
|
|
818
845
|
A,
|
|
819
846
|
{
|
|
820
|
-
onClick:
|
|
847
|
+
onClick: s,
|
|
821
848
|
ariaLabel: c,
|
|
822
849
|
title: c,
|
|
823
|
-
disabled: !
|
|
850
|
+
disabled: !n(ae),
|
|
824
851
|
className: `flipbook-toolbar-last ${o ?? ""}`.trim(),
|
|
825
|
-
children: e ??
|
|
852
|
+
children: e ?? i
|
|
826
853
|
}
|
|
827
854
|
);
|
|
828
|
-
},
|
|
855
|
+
}, co = ({
|
|
829
856
|
letters: e,
|
|
830
857
|
ariaLabel: o,
|
|
831
858
|
className: a
|
|
832
859
|
}) => {
|
|
833
|
-
const { flipBookRef:
|
|
860
|
+
const { flipBookRef: r, locale: n, mouseMode: s } = z(), i = o ?? E("toolbarItem.selectText", n);
|
|
834
861
|
return /* @__PURE__ */ t(
|
|
835
862
|
A,
|
|
836
863
|
{
|
|
837
864
|
onClick: () => {
|
|
838
|
-
|
|
865
|
+
r.current?.setMouseMode(s === "turn" ? "select" : "turn"), window.getSelection()?.removeAllRanges();
|
|
839
866
|
},
|
|
840
|
-
ariaLabel:
|
|
841
|
-
ariaPressed:
|
|
867
|
+
ariaLabel: i,
|
|
868
|
+
ariaPressed: s === "select",
|
|
842
869
|
className: `flipbook-toolbar-mouse-mode ${a ?? ""}`.trim(),
|
|
843
870
|
children: /* @__PURE__ */ y("span", { className: "flipbook-toolbar-mouse-mode-icon", "aria-hidden": "true", children: [
|
|
844
871
|
/* @__PURE__ */ t("span", { className: "flipbook-toolbar-mouse-mode-caret" }),
|
|
845
|
-
/* @__PURE__ */ t("span", { children: e ?? E("toolbarItem.selectionLetters",
|
|
872
|
+
/* @__PURE__ */ t("span", { children: e ?? E("toolbarItem.selectionLetters", n) })
|
|
846
873
|
] })
|
|
847
874
|
}
|
|
848
875
|
);
|
|
849
|
-
},
|
|
850
|
-
const { locale: a } = z(), { execute:
|
|
851
|
-
|
|
852
|
-
},
|
|
876
|
+
}, uo = ({ children: e, className: o }) => {
|
|
877
|
+
const { locale: a } = z(), { execute: r, canExecute: n } = X(), s = () => {
|
|
878
|
+
r(oe);
|
|
879
|
+
}, i = E("command.jumpToNextPage", a), c = /* @__PURE__ */ t(ze, { size: 20 });
|
|
853
880
|
return /* @__PURE__ */ t(
|
|
854
881
|
A,
|
|
855
882
|
{
|
|
856
|
-
onClick:
|
|
857
|
-
ariaLabel:
|
|
858
|
-
title:
|
|
859
|
-
disabled: !
|
|
883
|
+
onClick: s,
|
|
884
|
+
ariaLabel: i,
|
|
885
|
+
title: i,
|
|
886
|
+
disabled: !n(oe),
|
|
860
887
|
className: `flipbook-toolbar-next ${o ?? ""}`.trim(),
|
|
861
888
|
children: e ?? c
|
|
862
889
|
}
|
|
863
890
|
);
|
|
864
|
-
},
|
|
891
|
+
}, mo = ({
|
|
865
892
|
mode: e,
|
|
866
893
|
showTotal: o = !0,
|
|
867
894
|
placeholder: a = "—",
|
|
868
|
-
editable:
|
|
869
|
-
className:
|
|
870
|
-
ariaLabel:
|
|
871
|
-
maxLength:
|
|
895
|
+
editable: r,
|
|
896
|
+
className: n,
|
|
897
|
+
ariaLabel: s = "Go to page",
|
|
898
|
+
maxLength: i = 10
|
|
872
899
|
}) => {
|
|
873
|
-
const { flipBookRef: c, pageSemantics: h, direction: b, currentPage: g, totalPages: C, of: N } = z(), T = e ?? (h ? "semantic" : "index"), I =
|
|
900
|
+
const { flipBookRef: c, pageSemantics: h, direction: b, currentPage: g, totalPages: C, of: N } = z(), T = e ?? (h ? "semantic" : "index"), I = r ?? (T === "semantic" && !!h), [d, u] = D(""), [w, F] = D(!1), M = _(!1), V = _(g), S = g, H = g + 1 < C ? g + 1 : null, j = P(
|
|
874
901
|
(m) => T === "semantic" && h ? h.indexToSemanticName(m) || "" : String(m + 1),
|
|
875
902
|
[T, h]
|
|
876
|
-
), $ = j(
|
|
877
|
-
const m = $, f =
|
|
903
|
+
), $ = j(S), R = H != null ? j(H) : "", G = P(() => String(N), [N]), O = P(() => {
|
|
904
|
+
const m = $, f = R;
|
|
878
905
|
let p;
|
|
879
|
-
return !m && !f ? p = a : m ? f ? m === f ? p = m : p = `${m} - ${f}` : p = m : p = f, o ? `${p} / ${
|
|
880
|
-
}, [$,
|
|
906
|
+
return !m && !f ? p = a : m ? f ? m === f ? p = m : p = `${m} - ${f}` : p = m : p = f, o ? `${p} / ${G()}` : p;
|
|
907
|
+
}, [$, R, a, o, G]), q = b === "rtl" ? R || $ : $ || R, L = O();
|
|
881
908
|
W(() => {
|
|
882
|
-
const m = g !==
|
|
883
|
-
|
|
909
|
+
const m = g !== V.current;
|
|
910
|
+
V.current = g, m && (M.current = !1), !w && !M.current && u(L);
|
|
884
911
|
}, [L, w, g]);
|
|
885
|
-
const
|
|
912
|
+
const k = P(
|
|
886
913
|
(m) => {
|
|
887
914
|
if (I) {
|
|
888
915
|
F(!0), u(q), M.current = !1;
|
|
@@ -891,9 +918,9 @@ const to = ({
|
|
|
891
918
|
}
|
|
892
919
|
},
|
|
893
920
|
[I, q]
|
|
894
|
-
),
|
|
921
|
+
), J = P(() => {
|
|
895
922
|
F(!1), M.current || u(L);
|
|
896
|
-
}, [L]),
|
|
923
|
+
}, [L]), l = P(
|
|
897
924
|
(m) => {
|
|
898
925
|
if (m.key === "Enter") {
|
|
899
926
|
if (h && d.trim()) {
|
|
@@ -904,64 +931,64 @@ const to = ({
|
|
|
904
931
|
} else m.key === "Escape" && m.currentTarget.blur();
|
|
905
932
|
},
|
|
906
933
|
[d, h, C, c]
|
|
907
|
-
),
|
|
934
|
+
), x = P((m) => {
|
|
908
935
|
u(m.target.value);
|
|
909
936
|
}, []);
|
|
910
937
|
return I ? /* @__PURE__ */ t(
|
|
911
938
|
"input",
|
|
912
939
|
{
|
|
913
940
|
type: "text",
|
|
914
|
-
className: `flipbook-toolbar-indicator ${w ? "flipbook-toolbar-indicator--editing" : ""} ${
|
|
941
|
+
className: `flipbook-toolbar-indicator ${w ? "flipbook-toolbar-indicator--editing" : ""} ${n ?? ""}`.trim(),
|
|
915
942
|
value: d,
|
|
916
|
-
onFocus:
|
|
917
|
-
onBlur:
|
|
918
|
-
onKeyDown:
|
|
919
|
-
onChange:
|
|
920
|
-
"aria-label":
|
|
943
|
+
onFocus: k,
|
|
944
|
+
onBlur: J,
|
|
945
|
+
onKeyDown: l,
|
|
946
|
+
onChange: x,
|
|
947
|
+
"aria-label": s,
|
|
921
948
|
"aria-live": "polite",
|
|
922
949
|
"aria-atomic": "true",
|
|
923
|
-
maxLength:
|
|
950
|
+
maxLength: i,
|
|
924
951
|
readOnly: !I
|
|
925
952
|
}
|
|
926
953
|
) : /* @__PURE__ */ t(
|
|
927
954
|
"span",
|
|
928
955
|
{
|
|
929
|
-
className: `flipbook-toolbar-indicator ${
|
|
956
|
+
className: `flipbook-toolbar-indicator ${n ?? ""}`.trim(),
|
|
930
957
|
"aria-live": "polite",
|
|
931
958
|
"aria-atomic": "true",
|
|
932
959
|
children: L
|
|
933
960
|
}
|
|
934
961
|
);
|
|
935
|
-
},
|
|
936
|
-
const { locale: a } = z(), { execute:
|
|
937
|
-
|
|
938
|
-
},
|
|
962
|
+
}, go = ({ children: e, className: o }) => {
|
|
963
|
+
const { locale: a } = z(), { execute: r, canExecute: n } = X(), s = () => {
|
|
964
|
+
r(te);
|
|
965
|
+
}, i = E("command.jumpToPrevPage", a), c = /* @__PURE__ */ t(Ae, { size: 20 });
|
|
939
966
|
return /* @__PURE__ */ t(
|
|
940
967
|
A,
|
|
941
968
|
{
|
|
942
|
-
onClick:
|
|
943
|
-
ariaLabel:
|
|
944
|
-
title:
|
|
945
|
-
disabled: !
|
|
969
|
+
onClick: s,
|
|
970
|
+
ariaLabel: i,
|
|
971
|
+
title: i,
|
|
972
|
+
disabled: !n(te),
|
|
946
973
|
className: `flipbook-toolbar-prev ${o ?? ""}`.trim(),
|
|
947
974
|
children: e ?? c
|
|
948
975
|
}
|
|
949
976
|
);
|
|
950
|
-
},
|
|
951
|
-
const { locale:
|
|
952
|
-
|
|
953
|
-
}, h = !
|
|
977
|
+
}, ho = ({ children: e, ariaLabel: o, className: a }) => {
|
|
978
|
+
const { locale: r } = z(), { execute: n, canExecute: s } = X(), i = o ?? E("command.jumpToToc", r), c = () => {
|
|
979
|
+
n(re);
|
|
980
|
+
}, h = !s(re);
|
|
954
981
|
return /* @__PURE__ */ t(
|
|
955
982
|
A,
|
|
956
983
|
{
|
|
957
984
|
onClick: c,
|
|
958
|
-
ariaLabel:
|
|
985
|
+
ariaLabel: i,
|
|
959
986
|
disabled: h,
|
|
960
987
|
className: `flipbook-toolbar-toc ${a ?? ""}`.trim(),
|
|
961
|
-
children: e ?? /* @__PURE__ */ t(
|
|
988
|
+
children: e ?? /* @__PURE__ */ t(qe, { size: 18 })
|
|
962
989
|
}
|
|
963
990
|
);
|
|
964
|
-
},
|
|
991
|
+
}, Ye = {
|
|
965
992
|
id: "openDownloadMenu",
|
|
966
993
|
enName: "Open download menu",
|
|
967
994
|
enDescription: "Open the download menu",
|
|
@@ -971,19 +998,19 @@ const to = ({
|
|
|
971
998
|
e.data?.open?.();
|
|
972
999
|
},
|
|
973
1000
|
canExecute: (e) => typeof e.data?.open == "function"
|
|
974
|
-
},
|
|
1001
|
+
}, po = ({
|
|
975
1002
|
flipBookRef: e,
|
|
976
1003
|
direction: o,
|
|
977
1004
|
locale: a,
|
|
978
|
-
pageSemantics:
|
|
979
|
-
className:
|
|
980
|
-
children:
|
|
981
|
-
enableHotkeys:
|
|
1005
|
+
pageSemantics: r,
|
|
1006
|
+
className: n = "",
|
|
1007
|
+
children: s,
|
|
1008
|
+
enableHotkeys: i = !0,
|
|
982
1009
|
commands: c,
|
|
983
1010
|
commandOptions: h,
|
|
984
1011
|
fullscreenTargetRef: b
|
|
985
1012
|
}) => {
|
|
986
|
-
const g = o ??
|
|
1013
|
+
const g = o ?? Xe(a ?? se), C = a ?? (g === "rtl" ? "he-IL" : "en-US"), N = _(null), T = _(null), [I, d] = D(0), [u, w] = D(0), [F, M] = D(0), [V, S] = D(!0), [H, j] = D(!1), [$, R] = D("turn"), G = {
|
|
987
1014
|
...b ? {
|
|
988
1015
|
toggleFullscreen: {
|
|
989
1016
|
data: {
|
|
@@ -996,31 +1023,31 @@ const to = ({
|
|
|
996
1023
|
},
|
|
997
1024
|
download: {
|
|
998
1025
|
data: {
|
|
999
|
-
onDownload: (
|
|
1026
|
+
onDownload: (k, J) => T.current?.(k, J)
|
|
1000
1027
|
}
|
|
1001
1028
|
},
|
|
1002
1029
|
...h
|
|
1003
1030
|
}, O = P(() => {
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1031
|
+
const k = e.current;
|
|
1032
|
+
k && (d(k.getCurrentPageIndex()), w(k.getTotalPages()), M(k.getOf()), S(k.isFirstPage()), j(k.isLastPage()), R(k.getMouseMode?.() ?? "turn"));
|
|
1006
1033
|
}, [e]);
|
|
1007
1034
|
W(() => {
|
|
1008
1035
|
O();
|
|
1009
|
-
const
|
|
1010
|
-
return () => clearInterval(
|
|
1036
|
+
const k = setInterval(O, 200);
|
|
1037
|
+
return () => clearInterval(k);
|
|
1011
1038
|
}, [O]);
|
|
1012
1039
|
const q = /* @__PURE__ */ t(
|
|
1013
|
-
|
|
1040
|
+
xe.Provider,
|
|
1014
1041
|
{
|
|
1015
1042
|
value: {
|
|
1016
1043
|
flipBookRef: e,
|
|
1017
1044
|
direction: g,
|
|
1018
1045
|
locale: C,
|
|
1019
|
-
pageSemantics:
|
|
1046
|
+
pageSemantics: r,
|
|
1020
1047
|
currentPage: I,
|
|
1021
1048
|
totalPages: u,
|
|
1022
1049
|
of: F,
|
|
1023
|
-
isFirstPage:
|
|
1050
|
+
isFirstPage: V,
|
|
1024
1051
|
isLastPage: H,
|
|
1025
1052
|
mouseMode: $,
|
|
1026
1053
|
openDownloadMenuRef: N,
|
|
@@ -1030,15 +1057,15 @@ const to = ({
|
|
|
1030
1057
|
children: /* @__PURE__ */ t(
|
|
1031
1058
|
"div",
|
|
1032
1059
|
{
|
|
1033
|
-
className: `flipbook-toolbar ${g === "rtl" ? "flipbook-toolbar--rtl" : ""} ${
|
|
1060
|
+
className: `flipbook-toolbar ${g === "rtl" ? "flipbook-toolbar--rtl" : ""} ${n}`.trim(),
|
|
1034
1061
|
role: "toolbar",
|
|
1035
1062
|
"aria-label": "FlipBook navigation",
|
|
1036
1063
|
dir: g,
|
|
1037
|
-
children:
|
|
1064
|
+
children: s
|
|
1038
1065
|
}
|
|
1039
1066
|
)
|
|
1040
1067
|
}
|
|
1041
|
-
), L = [
|
|
1068
|
+
), L = [Ye, ...c ?? []];
|
|
1042
1069
|
return /* @__PURE__ */ t(
|
|
1043
1070
|
Re,
|
|
1044
1071
|
{
|
|
@@ -1047,45 +1074,46 @@ const to = ({
|
|
|
1047
1074
|
totalPages: u,
|
|
1048
1075
|
direction: g,
|
|
1049
1076
|
commands: L,
|
|
1050
|
-
commandOptions:
|
|
1051
|
-
disableHotkeys: !
|
|
1077
|
+
commandOptions: G,
|
|
1078
|
+
disableHotkeys: !i,
|
|
1052
1079
|
children: q
|
|
1053
1080
|
}
|
|
1054
1081
|
);
|
|
1055
1082
|
};
|
|
1056
1083
|
export {
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1084
|
+
no as ActionButton,
|
|
1085
|
+
ao as BookmarkToggleButton,
|
|
1086
|
+
to as BookshelfIcon,
|
|
1087
|
+
He as ChevronFirstIcon,
|
|
1088
|
+
Oe as ChevronLastIcon,
|
|
1089
|
+
Ae as ChevronLeftIcon,
|
|
1090
|
+
ze as ChevronRightIcon,
|
|
1091
|
+
ro as DownloadDropdown,
|
|
1092
|
+
Je as DownloadIcon,
|
|
1093
|
+
lo as FirstPageButton,
|
|
1094
|
+
io as FullscreenButton,
|
|
1095
|
+
so as LastPageButton,
|
|
1096
|
+
Ue as MaximizeIcon,
|
|
1097
|
+
We as MinimizeIcon,
|
|
1098
|
+
co as MouseModeButton,
|
|
1099
|
+
uo as NextButton,
|
|
1100
|
+
mo as PageIndicator,
|
|
1101
|
+
go as PrevButton,
|
|
1102
|
+
mo as SemanticPageIndicator,
|
|
1103
|
+
qe as TableOfContentsIcon,
|
|
1104
|
+
ho as TocButton,
|
|
1105
|
+
po as Toolbar,
|
|
1079
1106
|
A as ToolbarButton,
|
|
1080
|
-
|
|
1081
|
-
|
|
1107
|
+
oo as createDefaultDownloadConfig,
|
|
1108
|
+
$e as defaultCommands,
|
|
1109
|
+
ye as downloadCommand,
|
|
1082
1110
|
oe as flipNextCommand,
|
|
1083
1111
|
te as flipPrevCommand,
|
|
1084
1112
|
ne as goToFirstCommand,
|
|
1085
1113
|
ae as goToLastCommand,
|
|
1086
1114
|
re as goToTocCommand,
|
|
1087
|
-
|
|
1088
|
-
|
|
1115
|
+
Fe as toggleDebugCommand,
|
|
1116
|
+
Me as toggleFullscreenCommand,
|
|
1089
1117
|
X as useCommands,
|
|
1090
1118
|
z as useToolbar
|
|
1091
1119
|
};
|