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