@edrlab/thorium-web 1.4.1 → 1.5.1
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/{ThPreferencesAdapter-_5AePKHa.d.mts → ThPreferencesAdapter-B3a-f5v-.d.mts} +22 -17
- package/dist/{ThSettingsWrapper-B_9klYXH.d.mts → ThSettingsWrapper-DtzcwzYX.d.mts} +4 -4
- package/dist/{actions-CuRRM3rp.d.mts → actions-C33UN3Ji.d.mts} +14 -3
- package/dist/{actionsReducer-VFR42qgL.d.mts → actionsReducer-Bzcj3wk3.d.mts} +1 -1
- package/dist/{chunk-SZAVAQ6S.mjs → chunk-2B3HE57E.mjs} +42 -52
- package/dist/chunk-2B3HE57E.mjs.map +1 -0
- package/dist/{chunk-SI4FBFHM.mjs → chunk-3ITHCTDL.mjs} +157 -108
- package/dist/chunk-3ITHCTDL.mjs.map +1 -0
- package/dist/{chunk-OD75GC5N.mjs → chunk-3VB756GR.mjs} +89 -51
- package/dist/chunk-3VB756GR.mjs.map +1 -0
- package/dist/{chunk-ETLIGONP.mjs → chunk-AXX4U2FW.mjs} +25 -133
- package/dist/chunk-AXX4U2FW.mjs.map +1 -0
- package/dist/{chunk-WF2UOYO7.mjs → chunk-CCHCCVSF.mjs} +3 -3
- package/dist/{chunk-WF2UOYO7.mjs.map → chunk-CCHCCVSF.mjs.map} +1 -1
- package/dist/{chunk-RBEPH5E5.mjs → chunk-J6XDICU2.mjs} +80 -50
- package/dist/chunk-J6XDICU2.mjs.map +1 -0
- package/dist/chunk-KQ3KS5O5.mjs +37 -0
- package/dist/chunk-KQ3KS5O5.mjs.map +1 -0
- package/dist/{chunk-DQDOOTCE.mjs → chunk-KT2QY5QU.mjs} +3 -3
- package/dist/{chunk-DQDOOTCE.mjs.map → chunk-KT2QY5QU.mjs.map} +1 -1
- package/dist/{chunk-KGSFTRCH.mjs → chunk-KXOIN35D.mjs} +45 -117
- package/dist/chunk-KXOIN35D.mjs.map +1 -0
- package/dist/{chunk-E2JEGVVE.mjs → chunk-MTH2RF6V.mjs} +45 -12
- package/dist/chunk-MTH2RF6V.mjs.map +1 -0
- package/dist/{chunk-MSHUPSBI.mjs → chunk-THOJRBVD.mjs} +337 -90
- package/dist/chunk-THOJRBVD.mjs.map +1 -0
- package/dist/{chunk-VENFFPK2.mjs → chunk-VYSDLACR.mjs} +2 -2
- package/dist/{chunk-VENFFPK2.mjs.map → chunk-VYSDLACR.mjs.map} +1 -1
- package/dist/chunk-X63WSMOH.mjs +57 -0
- package/dist/chunk-X63WSMOH.mjs.map +1 -0
- package/dist/{chunk-YEVLT3AV.mjs → chunk-YE5QOQUT.mjs} +3 -3
- package/dist/{chunk-YEVLT3AV.mjs.map → chunk-YE5QOQUT.mjs.map} +1 -1
- package/dist/components/Audio/index.css +10 -0
- package/dist/components/Audio/index.css.map +1 -1
- package/dist/components/Audio/index.d.mts +12 -11
- package/dist/components/Audio/index.mjs +13 -12
- package/dist/components/Epub/index.css +10 -0
- package/dist/components/Epub/index.css.map +1 -1
- package/dist/components/Epub/index.d.mts +12 -11
- package/dist/components/Epub/index.mjs +14 -13
- package/dist/components/Misc/index.mjs +4 -4
- package/dist/components/Reader/index.css +10 -0
- package/dist/components/Reader/index.css.map +1 -1
- package/dist/components/Reader/index.d.mts +11 -10
- package/dist/components/Reader/index.mjs +21 -20
- package/dist/components/Reader/index.mjs.map +1 -1
- package/dist/components/WebPub/index.css +10 -0
- package/dist/components/WebPub/index.css.map +1 -1
- package/dist/components/WebPub/index.d.mts +12 -11
- package/dist/components/WebPub/index.mjs +14 -13
- package/dist/core/Components/index.d.mts +10 -25
- package/dist/core/Components/index.mjs +1 -1
- package/dist/core/Helpers/index.d.mts +1 -1
- package/dist/core/Helpers/index.mjs +3 -2
- package/dist/core/Hooks/index.d.mts +14 -7
- package/dist/core/Hooks/index.mjs +2 -1
- package/dist/i18n/index.mjs +2 -2
- package/dist/keyboardUtilities-BCP3UcLb.d.mts +30 -0
- package/dist/lib/index.d.mts +9 -8
- package/dist/lib/index.mjs +3 -2
- package/dist/locales/da/thorium-shared.json +217 -10
- package/dist/locales/he/thorium-shared.json +8 -0
- package/dist/locales/he/thorium-web.json +9 -0
- package/dist/locales/it/thorium-shared.json +2 -2
- package/dist/locales/it/thorium-web.json +24 -2
- package/dist/locales/lt/thorium-shared.json +85 -1
- package/dist/locales/sv/thorium-shared.json +5 -5
- package/dist/locales/sv/thorium-web.json +22 -0
- package/dist/preferences/index.d.mts +16 -23
- package/dist/preferences/index.mjs +4 -3
- package/dist/{settingsReducer-VqBhLq50.d.mts → settingsReducer-Pp9aoiiC.d.mts} +1 -1
- package/dist/{useAudioNavigator-CWXyNWq1.d.mts → useAudioNavigator-9RuOpLGB.d.mts} +8 -5
- package/dist/{useContrast-Cbso7N1l.d.mts → useContrast-Bl08zDTU.d.mts} +2 -7
- package/dist/{usePreferences-9ZvbcbLW.d.mts → usePreferences-Cy7-JN2x.d.mts} +4 -8
- package/dist/{useReaderTransitions-0hKGCvMm.d.mts → useReaderTransitions-CpgrXS5g.d.mts} +50 -23
- package/package.json +7 -7
- package/dist/chunk-44PEO3DS.mjs +0 -121
- package/dist/chunk-44PEO3DS.mjs.map +0 -1
- package/dist/chunk-E2JEGVVE.mjs.map +0 -1
- package/dist/chunk-ETLIGONP.mjs.map +0 -1
- package/dist/chunk-KGSFTRCH.mjs.map +0 -1
- package/dist/chunk-MSHUPSBI.mjs.map +0 -1
- package/dist/chunk-OD75GC5N.mjs.map +0 -1
- package/dist/chunk-RBEPH5E5.mjs.map +0 -1
- package/dist/chunk-SI4FBFHM.mjs.map +0 -1
- package/dist/chunk-SZAVAQ6S.mjs.map +0 -1
- package/dist/keyboardUtilities-BWAyLS_D.d.mts +0 -56
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { useFonts,
|
|
2
|
-
import { createDefaultPlugin, useSpacingPresets, useSettingsComponentStatus, useIsScroll, usePositionStorage,
|
|
3
|
-
import { makeBreakpointsMap, isActiveElement } from './chunk-
|
|
4
|
-
import { useFullscreen, useEpubNavigator, useTimeline, useDocumentTitle, useEpubSettingsCache } from './chunk-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { useFonts, useZoomCallbacks, getReaderClassNames, StatefulReaderHeader, StatefulReaderFooter } from './chunk-KXOIN35D.mjs';
|
|
2
|
+
import { ThPluginRegistry, createDefaultPlugin, ThPluginProvider, useSpacingPresets, useSettingsComponentStatus, useIsScroll, useFocusedDockableKey, usePositionStorage, fromActionPeripheralType, fromDockingPeripheralType, NavPeripheralType, NavigatorProvider, thorium_web_reader_app_default, StatefulDockingWrapper, useReaderTransitions, thorium_web_button_default, useLineHeight, useActionComponentStatus, ZOOM_IN_KEY_COMBOS, ZOOM_OUT_KEY_COMBOS, toActionPeripheralType, toDockingPeripheralType } from './chunk-THOJRBVD.mjs';
|
|
3
|
+
import { makeBreakpointsMap, isActiveElement, isKeyboardTriggered } from './chunk-VYSDLACR.mjs';
|
|
4
|
+
import { useFullscreen, useEpubNavigator, useTimeline, useDocumentTitle, useEpubSettingsCache, useObservableCondition } from './chunk-2B3HE57E.mjs';
|
|
5
|
+
import { useI18n } from './chunk-2NCN2AG2.mjs';
|
|
6
|
+
import { setImmersive, setFullscreen, setTimeline, setHovering, toggleImmersive, setPublicationStart, setPublicationEnd, toggleActionOpen, dockAction, setScrollAffordance, debounce, setDirection, setPlatformModifier, setUserNavigated, setTheme, setHasArrows, setLoading } from './chunk-YE5QOQUT.mjs';
|
|
7
|
+
import { useFilteredPreferenceKeys, usePreferences, resolveContentProtectionConfig, buildThemeObject, useActionsPreferences } from './chunk-3VB756GR.mjs';
|
|
7
8
|
import { ThArrowVariant } from './chunk-2YRT7RNW.mjs';
|
|
8
|
-
import { useAppSelector, useAppDispatch
|
|
9
|
-
import { getPlatformModifier } from './chunk-
|
|
10
|
-
import {
|
|
9
|
+
import { useAppSelector, useAppDispatch } from './chunk-A575ZW4A.mjs';
|
|
10
|
+
import { getPlatformModifier } from './chunk-X63WSMOH.mjs';
|
|
11
|
+
import { ThNavigationButton } from './chunk-AXX4U2FW.mjs';
|
|
11
12
|
import { usePrevious } from './chunk-YZ73DHRU.mjs';
|
|
12
|
-
import { useI18n } from './chunk-2NCN2AG2.mjs';
|
|
13
13
|
import { useState, useLayoutEffect, useRef, useEffect, useCallback, useMemo } from 'react';
|
|
14
|
-
import { useLocale } from 'react-aria';
|
|
15
14
|
import { Layout, Locator } from '@readium/shared';
|
|
16
15
|
import classNames2 from 'classnames';
|
|
17
16
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
17
|
+
import { useLocale } from 'react-aria';
|
|
18
18
|
|
|
19
19
|
// src/components/assets/styles/thorium-web.reader.paginatedArrow.module.css
|
|
20
20
|
var thorium_web_reader_paginatedArrow_default = {
|
|
@@ -138,8 +138,10 @@ var StatefulReaderArrowButton = ({
|
|
|
138
138
|
return className2;
|
|
139
139
|
};
|
|
140
140
|
useEffect(() => {
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
const el = buttonRef.current;
|
|
142
|
+
if (!el || !isActiveElement(el)) return;
|
|
143
|
+
if (isDisabled || !hasArrows && !isHovering && !isKeyboardTriggered(el)) {
|
|
144
|
+
el.blur();
|
|
143
145
|
}
|
|
144
146
|
});
|
|
145
147
|
const blurOnEsc = (event) => {
|
|
@@ -158,7 +160,6 @@ var StatefulReaderArrowButton = ({
|
|
|
158
160
|
onKeyDown: blurOnEsc,
|
|
159
161
|
className: classNames2(className, handleClassNameFromSpaceProp(), handleClassNameFromState()),
|
|
160
162
|
isDisabled,
|
|
161
|
-
preventFocusOnPress: true,
|
|
162
163
|
...props,
|
|
163
164
|
compounds: {
|
|
164
165
|
tooltipTrigger: {
|
|
@@ -215,6 +216,55 @@ var useEpubStatelessCache = (textAlign, columnCount, fontFamily, fontSize, fontW
|
|
|
215
216
|
cache.current.reducedMotion = reducedMotion;
|
|
216
217
|
return cache;
|
|
217
218
|
};
|
|
219
|
+
var useEpubKeyboardPeripherals = () => {
|
|
220
|
+
const isScroll = useIsScroll();
|
|
221
|
+
const isFXL = useAppSelector((state) => state.publication.isFXL);
|
|
222
|
+
const noScroll = useObservableCondition(!isScroll);
|
|
223
|
+
const zoomActive = useObservableCondition(!isFXL);
|
|
224
|
+
const { actionsKeys, docking } = useActionsPreferences();
|
|
225
|
+
const { isSupported: isFullscreenSupported } = useFullscreen();
|
|
226
|
+
const { reflowActionKeys, fxlActionKeys } = useFilteredPreferenceKeys();
|
|
227
|
+
const orderArray = isFXL ? fxlActionKeys : reflowActionKeys;
|
|
228
|
+
const { isComponentAvailable: isFullscreenAvailable } = useActionComponentStatus({ actionKey: "fullscreen" /* fullscreen */, orderArray, additionalCondition: isFullscreenSupported });
|
|
229
|
+
const { isComponentAvailable: isTocAvailable } = useActionComponentStatus({ actionKey: "toc" /* toc */, orderArray });
|
|
230
|
+
const { isComponentAvailable: isSettingsAvailable } = useActionComponentStatus({ actionKey: "settings" /* settings */, orderArray });
|
|
231
|
+
const { isComponentAvailable: isJumpToPositionAvailable } = useActionComponentStatus({ actionKey: "jumpToPosition" /* jumpToPosition */, orderArray });
|
|
232
|
+
return useMemo(() => {
|
|
233
|
+
const actionAvailability = {
|
|
234
|
+
["fullscreen" /* fullscreen */]: isFullscreenAvailable,
|
|
235
|
+
["toc" /* toc */]: isTocAvailable,
|
|
236
|
+
["settings" /* settings */]: isSettingsAvailable,
|
|
237
|
+
["jumpToPosition" /* jumpToPosition */]: isJumpToPositionAvailable
|
|
238
|
+
};
|
|
239
|
+
const config = [
|
|
240
|
+
{ type: NavPeripheralType.progressForward, keyCombos: [{ keyCode: 32, suppressOnInteractiveElement: true, condition: noScroll }] },
|
|
241
|
+
{ type: NavPeripheralType.progressBackward, keyCombos: [{ keyCode: 32, shift: true, suppressOnInteractiveElement: true, condition: noScroll }] },
|
|
242
|
+
{ type: NavPeripheralType.moveRight, keyCombos: [{ keyCode: 39, suppressOnInteractiveElement: true, condition: noScroll }] },
|
|
243
|
+
{ type: NavPeripheralType.moveLeft, keyCombos: [{ keyCode: 37, suppressOnInteractiveElement: true, condition: noScroll }] },
|
|
244
|
+
{ type: NavPeripheralType.moveUp, keyCombos: [
|
|
245
|
+
{ keyCode: 38, suppressOnInteractiveElement: true, condition: noScroll },
|
|
246
|
+
{ keyCode: 33, suppressOnInteractiveElement: true, condition: noScroll }
|
|
247
|
+
] },
|
|
248
|
+
{ type: NavPeripheralType.moveDown, keyCombos: [
|
|
249
|
+
{ keyCode: 40, suppressOnInteractiveElement: true, condition: noScroll },
|
|
250
|
+
{ keyCode: 34, suppressOnInteractiveElement: true, condition: noScroll }
|
|
251
|
+
] },
|
|
252
|
+
{ type: NavPeripheralType.moveHome, keyCombos: [{ keyCode: 36, suppressOnInteractiveElement: true, condition: noScroll }] },
|
|
253
|
+
{ type: NavPeripheralType.moveEnd, keyCombos: [{ keyCode: 35, suppressOnInteractiveElement: true, condition: noScroll }] },
|
|
254
|
+
{ type: NavPeripheralType.zoomIn, keyCombos: ZOOM_IN_KEY_COMBOS.map((c) => ({ ...c, condition: zoomActive })) },
|
|
255
|
+
{ type: NavPeripheralType.zoomOut, keyCombos: ZOOM_OUT_KEY_COMBOS.map((c) => ({ ...c, condition: zoomActive })) }
|
|
256
|
+
];
|
|
257
|
+
for (const [key, tokens] of Object.entries(actionsKeys)) {
|
|
258
|
+
const shortcut = tokens?.shortcut;
|
|
259
|
+
const isAvailable = actionAvailability[key] ?? true;
|
|
260
|
+
if (shortcut && isAvailable) config.push({ type: toActionPeripheralType(key), keyCombos: shortcut.keyCombos });
|
|
261
|
+
}
|
|
262
|
+
for (const [key, tokens] of Object.entries(docking.keys)) {
|
|
263
|
+
if (tokens?.shortcut) config.push({ type: toDockingPeripheralType(key), keyCombos: tokens.shortcut.keyCombos });
|
|
264
|
+
}
|
|
265
|
+
return config;
|
|
266
|
+
}, [noScroll, zoomActive, actionsKeys, docking.keys, isFullscreenAvailable, isTocAvailable, isSettingsAvailable, isJumpToPositionAvailable]);
|
|
267
|
+
};
|
|
218
268
|
var useEpubPreferencesConfig = ({
|
|
219
269
|
isFXL,
|
|
220
270
|
settings,
|
|
@@ -224,10 +274,10 @@ var useEpubPreferencesConfig = ({
|
|
|
224
274
|
arrowsWidth,
|
|
225
275
|
preferences,
|
|
226
276
|
getFontMetadata,
|
|
227
|
-
lineHeightOptions,
|
|
228
277
|
fxlThemeKeys,
|
|
229
278
|
reflowThemeKeys
|
|
230
279
|
}) => {
|
|
280
|
+
const { processedValues: lineHeightOptions } = useLineHeight();
|
|
231
281
|
const scriptMode = useAppSelector((state) => state.publication.scriptMode);
|
|
232
282
|
const isVerticalScript = scriptMode === "cjk-vertical" || scriptMode === "mongolian-vertical";
|
|
233
283
|
const { isComponentUsed: isFontFamilyUsed } = useSettingsComponentStatus({
|
|
@@ -333,7 +383,6 @@ var useEpubPreferencesConfig = ({
|
|
|
333
383
|
preferences.theming.themes.keys,
|
|
334
384
|
preferences.theming.themes.systemThemes,
|
|
335
385
|
getFontMetadata,
|
|
336
|
-
lineHeightOptions,
|
|
337
386
|
fxlThemeKeys,
|
|
338
387
|
reflowThemeKeys,
|
|
339
388
|
isVerticalScript,
|
|
@@ -351,7 +400,8 @@ var useEpubPreferencesConfig = ({
|
|
|
351
400
|
isParagraphSpacingUsed,
|
|
352
401
|
isTextAlignUsed,
|
|
353
402
|
isTextNormalizeUsed,
|
|
354
|
-
isWordSpacingUsed
|
|
403
|
+
isWordSpacingUsed,
|
|
404
|
+
lineHeightOptions
|
|
355
405
|
]);
|
|
356
406
|
const epubDefaults = useMemo(() => {
|
|
357
407
|
if (isFXL) return {};
|
|
@@ -426,7 +476,6 @@ var useEpubReaderInit = ({
|
|
|
426
476
|
getFontInjectables,
|
|
427
477
|
fxlThemeKeys,
|
|
428
478
|
reflowThemeKeys,
|
|
429
|
-
lineHeightOptions,
|
|
430
479
|
arrowsOccupySpace,
|
|
431
480
|
arrowsWidth,
|
|
432
481
|
colorScheme,
|
|
@@ -434,8 +483,7 @@ var useEpubReaderInit = ({
|
|
|
434
483
|
contentProtectionConfig,
|
|
435
484
|
onNavigatorReady,
|
|
436
485
|
onNavigatorLoaded,
|
|
437
|
-
onCleanup
|
|
438
|
-
fxlProgressionCallback
|
|
486
|
+
onCleanup
|
|
439
487
|
}) => {
|
|
440
488
|
const [navigatorReady, setNavigatorReady] = useState(false);
|
|
441
489
|
const { epubPreferences, epubDefaults } = useEpubPreferencesConfig({
|
|
@@ -447,7 +495,6 @@ var useEpubReaderInit = ({
|
|
|
447
495
|
arrowsWidth,
|
|
448
496
|
preferences,
|
|
449
497
|
getFontMetadata,
|
|
450
|
-
lineHeightOptions,
|
|
451
498
|
fxlThemeKeys,
|
|
452
499
|
reflowThemeKeys
|
|
453
500
|
});
|
|
@@ -462,6 +509,7 @@ var useEpubReaderInit = ({
|
|
|
462
509
|
if (!isFXL) removeFontResources();
|
|
463
510
|
onCleanup?.();
|
|
464
511
|
}, [isFXL, removeFontResources, onCleanup]);
|
|
512
|
+
const keyboardPeripherals = useEpubKeyboardPeripherals();
|
|
465
513
|
const { EpubNavigatorLoad, EpubNavigatorDestroy } = useEpubNavigator();
|
|
466
514
|
const isNavigatorLoadedEpub = useRef(false);
|
|
467
515
|
useEffect(() => {
|
|
@@ -479,14 +527,15 @@ var useEpubReaderInit = ({
|
|
|
479
527
|
preferences: epubPreferences,
|
|
480
528
|
defaults: epubDefaults,
|
|
481
529
|
injectables: injectables || void 0,
|
|
482
|
-
contentProtection: contentProtectionConfig
|
|
530
|
+
contentProtection: contentProtectionConfig,
|
|
531
|
+
keyboardPeripherals
|
|
483
532
|
};
|
|
484
533
|
isNavigatorLoadedEpub.current = true;
|
|
485
534
|
onNavigatorReady?.();
|
|
486
535
|
EpubNavigatorLoad(config, () => {
|
|
487
536
|
setNavigatorReady(true);
|
|
488
537
|
onNavigatorLoaded?.();
|
|
489
|
-
}
|
|
538
|
+
});
|
|
490
539
|
return () => {
|
|
491
540
|
if (isNavigatorLoadedEpub.current) {
|
|
492
541
|
setNavigatorReady(false);
|
|
@@ -543,6 +592,7 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage, contain
|
|
|
543
592
|
const { injectFontResources, removeFontResources, getAndroidFXLPatch } = useFonts();
|
|
544
593
|
const container = useRef(null);
|
|
545
594
|
const arrowsWidth = useRef(2 * ((preferences.theming.arrow.size || 40) + (preferences.theming.arrow.offset || 0)));
|
|
595
|
+
const profile = useAppSelector((state) => state.reader.profile);
|
|
546
596
|
const isFXL = useAppSelector((state) => state.publication.isFXL);
|
|
547
597
|
const isRTL = useAppSelector((state) => state.publication.isRTL);
|
|
548
598
|
const positionsList = useAppSelector((state) => state.publication.positionsList);
|
|
@@ -608,13 +658,14 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage, contain
|
|
|
608
658
|
const atPublicationStart = useAppSelector((state) => state.publication.atPublicationStart);
|
|
609
659
|
const atPublicationEnd = useAppSelector((state) => state.publication.atPublicationEnd);
|
|
610
660
|
const dispatch = useAppDispatch();
|
|
661
|
+
const getFocusedDockableKey = useFocusedDockableKey();
|
|
611
662
|
useEffect(() => {
|
|
612
663
|
dispatch(setImmersive(false));
|
|
613
664
|
}, [isScroll, dispatch]);
|
|
614
665
|
const onFsChange = useCallback((isFullscreen) => {
|
|
615
666
|
dispatch(setFullscreen(isFullscreen));
|
|
616
667
|
}, [dispatch]);
|
|
617
|
-
const
|
|
668
|
+
const { handleFullscreen } = useFullscreen(onFsChange);
|
|
618
669
|
const epubNavigator = useEpubNavigator();
|
|
619
670
|
const {
|
|
620
671
|
goLeft,
|
|
@@ -622,7 +673,6 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage, contain
|
|
|
622
673
|
goBackward,
|
|
623
674
|
goForward,
|
|
624
675
|
navLayout,
|
|
625
|
-
currentLocator,
|
|
626
676
|
currentPositions,
|
|
627
677
|
canGoBackward,
|
|
628
678
|
canGoForward,
|
|
@@ -641,7 +691,6 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage, contain
|
|
|
641
691
|
dispatch(setTimeline(timeline2));
|
|
642
692
|
}
|
|
643
693
|
});
|
|
644
|
-
const lineHeightOptions = useLineHeight();
|
|
645
694
|
const documentTitleFormat = preferences.metadata?.documentTitle?.format;
|
|
646
695
|
let documentTitle;
|
|
647
696
|
if (documentTitleFormat) {
|
|
@@ -718,84 +767,42 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage, contain
|
|
|
718
767
|
dispatch(setPublicationEnd(true));
|
|
719
768
|
}
|
|
720
769
|
}, [canGoBackward, canGoForward, dispatch]);
|
|
721
|
-
const
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
770
|
+
const moveTo = useCallback((direction) => {
|
|
771
|
+
const navigationCallback = () => {
|
|
772
|
+
dispatch(setUserNavigated(true));
|
|
773
|
+
activateImmersiveOnAction();
|
|
774
|
+
};
|
|
775
|
+
switch (direction) {
|
|
776
|
+
case "right":
|
|
777
|
+
!cache.current.settings.scroll && goRight(!cache.current.reducedMotion, navigationCallback);
|
|
778
|
+
break;
|
|
779
|
+
case "left":
|
|
780
|
+
!cache.current.settings.scroll && goLeft(!cache.current.reducedMotion, navigationCallback);
|
|
781
|
+
break;
|
|
731
782
|
}
|
|
732
|
-
}, [
|
|
733
|
-
const
|
|
734
|
-
const
|
|
735
|
-
|
|
736
|
-
const
|
|
783
|
+
}, [dispatch, activateImmersiveOnAction, cache, goRight, goLeft]);
|
|
784
|
+
const { zoomIn, zoomOut } = useZoomCallbacks(epubNavigator);
|
|
785
|
+
const goProgression = useCallback((shiftKey) => {
|
|
786
|
+
if (!cache.current.settings?.scroll) {
|
|
787
|
+
const cb = () => {
|
|
737
788
|
dispatch(setUserNavigated(true));
|
|
738
789
|
activateImmersiveOnAction();
|
|
739
790
|
};
|
|
740
|
-
|
|
741
|
-
case "right":
|
|
742
|
-
if (!cache.current.settings.scroll) {
|
|
743
|
-
goRight(!cache.current.reducedMotion, navigationCallback);
|
|
744
|
-
}
|
|
745
|
-
break;
|
|
746
|
-
case "left":
|
|
747
|
-
if (!cache.current.settings.scroll) {
|
|
748
|
-
goLeft(!cache.current.reducedMotion, navigationCallback);
|
|
749
|
-
}
|
|
750
|
-
break;
|
|
751
|
-
}
|
|
752
|
-
},
|
|
753
|
-
goProgression: (shiftKey) => {
|
|
754
|
-
if (!cache.current.settings?.scroll) {
|
|
755
|
-
const callback = () => {
|
|
756
|
-
dispatch(setUserNavigated(true));
|
|
757
|
-
activateImmersiveOnAction();
|
|
758
|
-
};
|
|
759
|
-
shiftKey ? goBackward(!cache.current.reducedMotion, callback) : goForward(!cache.current.reducedMotion, callback);
|
|
760
|
-
}
|
|
761
|
-
},
|
|
762
|
-
toggleAction: (actionKey) => {
|
|
763
|
-
switch (actionKey) {
|
|
764
|
-
case "fullscreen" /* fullscreen */:
|
|
765
|
-
fs.handleFullscreen();
|
|
766
|
-
break;
|
|
767
|
-
case "settings" /* settings */:
|
|
768
|
-
case "toc" /* toc */:
|
|
769
|
-
dispatch(toggleActionOpen({
|
|
770
|
-
key: actionKey,
|
|
771
|
-
profile: "epub"
|
|
772
|
-
}));
|
|
773
|
-
break;
|
|
774
|
-
}
|
|
791
|
+
shiftKey ? goBackward(!cache.current.reducedMotion, cb) : goForward(!cache.current.reducedMotion, cb);
|
|
775
792
|
}
|
|
776
|
-
}
|
|
793
|
+
}, [dispatch, activateImmersiveOnAction, cache, goBackward, goForward]);
|
|
777
794
|
const listeners = useMemo(() => ({
|
|
778
795
|
frameLoaded: async function(_wnd) {
|
|
779
|
-
await initReadingEnv();
|
|
780
|
-
const _cframes = getCframes();
|
|
781
|
-
_cframes?.forEach(
|
|
782
|
-
(frameManager) => {
|
|
783
|
-
if (frameManager) p.observe(frameManager.window);
|
|
784
|
-
}
|
|
785
|
-
);
|
|
786
|
-
p.observe(window);
|
|
787
796
|
},
|
|
788
797
|
positionChanged: async function(locator) {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
debouncedHandleProgression();
|
|
798
|
-
}
|
|
798
|
+
const debouncedHandleProgression = debounce(
|
|
799
|
+
async () => {
|
|
800
|
+
setLocalData(locator);
|
|
801
|
+
updatePublicationNavigationState();
|
|
802
|
+
},
|
|
803
|
+
250
|
|
804
|
+
);
|
|
805
|
+
debouncedHandleProgression();
|
|
799
806
|
},
|
|
800
807
|
tap: function(_e) {
|
|
801
808
|
handleTap(_e);
|
|
@@ -849,9 +856,59 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage, contain
|
|
|
849
856
|
},
|
|
850
857
|
contextMenu: function(_data) {
|
|
851
858
|
},
|
|
852
|
-
peripheral: function(
|
|
859
|
+
peripheral: function(data) {
|
|
860
|
+
switch (data.type) {
|
|
861
|
+
case NavPeripheralType.progressForward:
|
|
862
|
+
goProgression(false);
|
|
863
|
+
break;
|
|
864
|
+
case NavPeripheralType.progressBackward:
|
|
865
|
+
goProgression(true);
|
|
866
|
+
break;
|
|
867
|
+
case NavPeripheralType.moveRight:
|
|
868
|
+
moveTo("right");
|
|
869
|
+
break;
|
|
870
|
+
case NavPeripheralType.moveLeft:
|
|
871
|
+
moveTo("left");
|
|
872
|
+
break;
|
|
873
|
+
case NavPeripheralType.moveUp:
|
|
874
|
+
moveTo("up");
|
|
875
|
+
break;
|
|
876
|
+
case NavPeripheralType.moveDown:
|
|
877
|
+
moveTo("down");
|
|
878
|
+
break;
|
|
879
|
+
case NavPeripheralType.moveHome:
|
|
880
|
+
moveTo("home");
|
|
881
|
+
break;
|
|
882
|
+
case NavPeripheralType.moveEnd:
|
|
883
|
+
moveTo("end");
|
|
884
|
+
break;
|
|
885
|
+
case NavPeripheralType.zoomIn:
|
|
886
|
+
zoomIn();
|
|
887
|
+
break;
|
|
888
|
+
case NavPeripheralType.zoomOut:
|
|
889
|
+
zoomOut();
|
|
890
|
+
break;
|
|
891
|
+
default: {
|
|
892
|
+
const actionKey = fromActionPeripheralType(data.type);
|
|
893
|
+
if (actionKey === "fullscreen" /* fullscreen */) {
|
|
894
|
+
handleFullscreen();
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
if (actionKey && profile) {
|
|
898
|
+
dispatch(toggleActionOpen({ key: actionKey, profile }));
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
901
|
+
const dockingKey = fromDockingPeripheralType(data.type);
|
|
902
|
+
if (dockingKey && profile) {
|
|
903
|
+
const actionKey2 = getFocusedDockableKey(dockingKey);
|
|
904
|
+
if (actionKey2) {
|
|
905
|
+
dispatch(dockAction({ key: actionKey2, dockingKey, profile }));
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
853
910
|
}
|
|
854
|
-
}), [
|
|
911
|
+
}), [navLayout, setLocalData, dispatch, handleTap, handleClick, cache, preferences.affordances.scroll, isScrollStart, isScrollEnd, updatePublicationNavigationState, moveTo, goProgression, zoomIn, zoomOut, profile, handleFullscreen, getFocusedDockableKey]);
|
|
855
912
|
const initialPosition = useMemo(() => getLocalData(), [getLocalData]);
|
|
856
913
|
const { navigatorReady } = useEpubReaderInit({
|
|
857
914
|
container,
|
|
@@ -870,7 +927,6 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage, contain
|
|
|
870
927
|
getFontInjectables,
|
|
871
928
|
fxlThemeKeys,
|
|
872
929
|
reflowThemeKeys,
|
|
873
|
-
lineHeightOptions,
|
|
874
930
|
arrowsOccupySpace,
|
|
875
931
|
arrowsWidth,
|
|
876
932
|
colorScheme,
|
|
@@ -878,14 +934,7 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage, contain
|
|
|
878
934
|
contentProtectionConfig: resolveContentProtectionConfig(preferences.contentProtection, t),
|
|
879
935
|
onNavigatorReady: () => {
|
|
880
936
|
dispatch(setLoading(false));
|
|
881
|
-
}
|
|
882
|
-
onNavigatorLoaded: () => {
|
|
883
|
-
p.observe(window);
|
|
884
|
-
},
|
|
885
|
-
onCleanup: () => {
|
|
886
|
-
p.destroy();
|
|
887
|
-
},
|
|
888
|
-
fxlProgressionCallback: handleFXLProgression
|
|
937
|
+
}
|
|
889
938
|
});
|
|
890
939
|
const applyConstraint = useCallback(async (value) => {
|
|
891
940
|
await submitPreferences({
|
|
@@ -990,5 +1039,5 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage, contain
|
|
|
990
1039
|
};
|
|
991
1040
|
|
|
992
1041
|
export { StatefulReader };
|
|
993
|
-
//# sourceMappingURL=chunk-
|
|
994
|
-
//# sourceMappingURL=chunk-
|
|
1042
|
+
//# sourceMappingURL=chunk-3ITHCTDL.mjs.map
|
|
1043
|
+
//# sourceMappingURL=chunk-3ITHCTDL.mjs.map
|