@edrlab/thorium-web 1.4.0 → 1.5.0
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-L1H6gzmu.d.mts → ThPreferencesAdapter-B3a-f5v-.d.mts} +25 -18
- package/dist/{ThSettingsWrapper-DWEA4hYF.d.mts → ThSettingsWrapper-DtzcwzYX.d.mts} +4 -4
- package/dist/{actions-BjeRjaJU.d.mts → actions-C33UN3Ji.d.mts} +18 -4
- package/dist/{actionsReducer-B32cq2mB.d.mts → actionsReducer-Bzcj3wk3.d.mts} +1 -1
- package/dist/{chunk-NUXGQWED.mjs → chunk-2NCN2AG2.mjs} +3 -3
- package/dist/{chunk-NUXGQWED.mjs.map → chunk-2NCN2AG2.mjs.map} +1 -1
- package/dist/{chunk-IVXRCKWR.mjs → chunk-2T65MDBR.mjs} +4 -4
- package/dist/{chunk-IVXRCKWR.mjs.map → chunk-2T65MDBR.mjs.map} +1 -1
- package/dist/{chunk-KVUG6BNI.mjs → chunk-63LKYJFG.mjs} +62 -56
- package/dist/chunk-63LKYJFG.mjs.map +1 -0
- package/dist/chunk-AQSJDL63.mjs +193 -0
- package/dist/chunk-AQSJDL63.mjs.map +1 -0
- package/dist/{chunk-TSLTLQ6O.mjs → chunk-BBCSLDQT.mjs} +144 -86
- package/dist/chunk-BBCSLDQT.mjs.map +1 -0
- package/dist/{chunk-QUSGPT5M.mjs → chunk-BCXKBHU3.mjs} +34 -15
- package/dist/chunk-BCXKBHU3.mjs.map +1 -0
- package/dist/{chunk-T5ENYSDJ.mjs → chunk-DQDOOTCE.mjs} +3 -3
- package/dist/{chunk-T5ENYSDJ.mjs.map → chunk-DQDOOTCE.mjs.map} +1 -1
- package/dist/chunk-GNROODJB.mjs +9 -0
- package/dist/chunk-GNROODJB.mjs.map +1 -0
- package/dist/{chunk-SZAVAQ6S.mjs → chunk-GRYEOCGD.mjs} +8 -5
- package/dist/chunk-GRYEOCGD.mjs.map +1 -0
- package/dist/{chunk-PXXWEMNL.mjs → chunk-KJ55Q63A.mjs} +220 -106
- package/dist/chunk-KJ55Q63A.mjs.map +1 -0
- package/dist/{chunk-5LUMM7FW.mjs → chunk-KOR74F6M.mjs} +9 -41
- package/dist/chunk-KOR74F6M.mjs.map +1 -0
- package/dist/{chunk-WLVE3WNW.mjs → chunk-PAFJZH7O.mjs} +12 -7
- package/dist/chunk-PAFJZH7O.mjs.map +1 -0
- package/dist/{chunk-XRFLDNAY.mjs → chunk-PRQBFBJ7.mjs} +123 -56
- package/dist/chunk-PRQBFBJ7.mjs.map +1 -0
- package/dist/{chunk-6MONB2DN.mjs → chunk-Y5X74VW7.mjs} +52 -146
- package/dist/chunk-Y5X74VW7.mjs.map +1 -0
- package/dist/{chunk-P6ILEQ5P.mjs → chunk-ZD4LTF6G.mjs} +17 -9
- package/dist/chunk-ZD4LTF6G.mjs.map +1 -0
- package/dist/components/Audio/index.css +12 -1
- package/dist/components/Audio/index.css.map +1 -1
- package/dist/components/Audio/index.d.mts +17 -15
- package/dist/components/Audio/index.mjs +11 -11
- package/dist/components/Epub/index.css +12 -1
- package/dist/components/Epub/index.css.map +1 -1
- package/dist/components/Epub/index.d.mts +14 -13
- package/dist/components/Epub/index.mjs +12 -12
- package/dist/components/Misc/index.mjs +5 -5
- package/dist/components/Reader/index.css +12 -1
- package/dist/components/Reader/index.css.map +1 -1
- package/dist/components/Reader/index.d.mts +12 -11
- package/dist/components/Reader/index.mjs +26 -24
- package/dist/components/Reader/index.mjs.map +1 -1
- package/dist/components/WebPub/index.css +12 -1
- package/dist/components/WebPub/index.css.map +1 -1
- package/dist/components/WebPub/index.d.mts +14 -13
- package/dist/components/WebPub/index.mjs +12 -12
- package/dist/core/Components/index.d.mts +7 -6
- package/dist/core/Components/index.mjs +2 -2
- package/dist/core/Helpers/index.d.mts +1 -1
- package/dist/core/Helpers/index.mjs +1 -1
- package/dist/core/Hooks/index.d.mts +6 -5
- package/dist/core/Hooks/index.mjs +1 -1
- package/dist/i18n/index.mjs +3 -3
- package/dist/keyboardUtilities-BCP3UcLb.d.mts +30 -0
- package/dist/lib/index.d.mts +17 -9
- package/dist/lib/index.mjs +2 -2
- package/dist/locales/da/thorium-web.json +37 -2
- package/dist/locales/fi/thorium-web.json +1 -1
- package/dist/locales/fr/thorium-web.json +1 -1
- package/dist/locales/he/thorium-web.json +9 -0
- package/dist/locales/it/thorium-web.json +22 -0
- package/dist/locales/lt/thorium-web.json +26 -1
- package/dist/locales/sv/thorium-web.json +22 -0
- package/dist/next-lib/index.mjs +1 -1
- package/dist/next-lib/index.mjs.map +1 -1
- package/dist/preferences/index.d.mts +14 -23
- package/dist/preferences/index.mjs +4 -4
- package/dist/{settingsReducer-DLaT2wUB.d.mts → settingsReducer-Pp9aoiiC.d.mts} +1 -1
- package/dist/{useAudioNavigator-CWXyNWq1.d.mts → useAudioNavigator-pGwxhXLj.d.mts} +4 -1
- package/dist/{useContrast-Bo7cDw_X.d.mts → useContrast-Bl08zDTU.d.mts} +2 -7
- package/dist/{usePreferences-D8NU1yhP.d.mts → usePreferences-Cy7-JN2x.d.mts} +4 -8
- package/dist/{useReaderTransitions-BQGzKeY2.d.mts → useReaderTransitions-Zvomj9RQ.d.mts} +30 -21
- package/package.json +7 -7
- package/dist/chunk-5LUMM7FW.mjs.map +0 -1
- package/dist/chunk-6MONB2DN.mjs.map +0 -1
- package/dist/chunk-B3WDMWCT.mjs +0 -9
- package/dist/chunk-B3WDMWCT.mjs.map +0 -1
- package/dist/chunk-KVUG6BNI.mjs.map +0 -1
- package/dist/chunk-MLEYTQGK.mjs +0 -60
- package/dist/chunk-MLEYTQGK.mjs.map +0 -1
- package/dist/chunk-P6ILEQ5P.mjs.map +0 -1
- package/dist/chunk-PXXWEMNL.mjs.map +0 -1
- package/dist/chunk-QUSGPT5M.mjs.map +0 -1
- package/dist/chunk-SZAVAQ6S.mjs.map +0 -1
- package/dist/chunk-TSLTLQ6O.mjs.map +0 -1
- package/dist/chunk-WLVE3WNW.mjs.map +0 -1
- package/dist/chunk-XRFLDNAY.mjs.map +0 -1
- package/dist/keyboardUtilities-BWAyLS_D.d.mts +0 -56
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { useFonts,
|
|
2
|
-
import { createDefaultPlugin, useSpacingPresets, useSettingsComponentStatus, useIsScroll, usePositionStorage,
|
|
3
|
-
import { makeBreakpointsMap, isActiveElement } from './chunk-VENFFPK2.mjs';
|
|
4
|
-
import { useFullscreen, useEpubNavigator, useTimeline, useDocumentTitle, useEpubSettingsCache } from './chunk-
|
|
5
|
-
import { setImmersive, setFullscreen, setTimeline, setHovering, toggleImmersive, setPublicationStart, setPublicationEnd, toggleActionOpen, setScrollAffordance, debounce, setDirection, setPlatformModifier, setUserNavigated, setTheme, setHasArrows, setLoading } from './chunk-
|
|
6
|
-
import { useFilteredPreferenceKeys, usePreferences, resolveContentProtectionConfig, buildThemeObject } from './chunk-
|
|
1
|
+
import { useFonts, useZoomCallbacks, getReaderClassNames, StatefulReaderHeader, StatefulReaderFooter } from './chunk-Y5X74VW7.mjs';
|
|
2
|
+
import { createDefaultPlugin, useSpacingPresets, useSettingsComponentStatus, useIsScroll, usePositionStorage, fromActionPeripheralType, NavPeripheralType, NavigatorProvider, thorium_web_reader_app_default, StatefulDockingWrapper, useReaderTransitions, thorium_web_button_default, useLineHeight, ZOOM_IN_KEY_COMBOS, ZOOM_OUT_KEY_COMBOS, toActionPeripheralType } from './chunk-KJ55Q63A.mjs';
|
|
3
|
+
import { makeBreakpointsMap, isActiveElement, isKeyboardTriggered } from './chunk-VENFFPK2.mjs';
|
|
4
|
+
import { useFullscreen, useEpubNavigator, useTimeline, useDocumentTitle, useEpubSettingsCache } from './chunk-GRYEOCGD.mjs';
|
|
5
|
+
import { setImmersive, setFullscreen, setTimeline, setHovering, toggleImmersive, setPublicationStart, setPublicationEnd, toggleActionOpen, setScrollAffordance, debounce, setDirection, setPlatformModifier, setUserNavigated, setTheme, setHasArrows, setLoading } from './chunk-PAFJZH7O.mjs';
|
|
6
|
+
import { useFilteredPreferenceKeys, usePreferences, resolveContentProtectionConfig, buildThemeObject, useActionsPreferences } from './chunk-PRQBFBJ7.mjs';
|
|
7
7
|
import { ThArrowVariant } from './chunk-2YRT7RNW.mjs';
|
|
8
|
-
import { useAppSelector, useAppDispatch
|
|
9
|
-
import { getPlatformModifier } from './chunk-
|
|
10
|
-
import { ThPluginRegistry, ThPluginProvider, ThNavigationButton } from './chunk-
|
|
8
|
+
import { useAppSelector, useAppDispatch } from './chunk-A575ZW4A.mjs';
|
|
9
|
+
import { getPlatformModifier } from './chunk-KOR74F6M.mjs';
|
|
10
|
+
import { ThPluginRegistry, ThPluginProvider, ThNavigationButton } from './chunk-ZD4LTF6G.mjs';
|
|
11
11
|
import { usePrevious } from './chunk-YZ73DHRU.mjs';
|
|
12
|
-
import { useI18n } from './chunk-
|
|
12
|
+
import { useI18n } from './chunk-2NCN2AG2.mjs';
|
|
13
13
|
import { useState, useLayoutEffect, useRef, useEffect, useCallback, useMemo } from 'react';
|
|
14
14
|
import { useLocale } from 'react-aria';
|
|
15
15
|
import { Layout, Locator } from '@readium/shared';
|
|
@@ -28,7 +28,7 @@ var usePaginatedArrows = () => {
|
|
|
28
28
|
const { preferences } = usePreferences();
|
|
29
29
|
const hasArrows = useAppSelector((state) => state.reader.hasArrows);
|
|
30
30
|
const isFXL = useAppSelector((state) => state.publication.isFXL);
|
|
31
|
-
const breakpoint = useAppSelector((state) => state.theming.
|
|
31
|
+
const breakpoint = useAppSelector((state) => state.theming.containerBreakpoint);
|
|
32
32
|
const {
|
|
33
33
|
isScroll,
|
|
34
34
|
fromImmersive,
|
|
@@ -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,57 @@ var useEpubStatelessCache = (textAlign, columnCount, fontFamily, fontSize, fontW
|
|
|
215
216
|
cache.current.reducedMotion = reducedMotion;
|
|
216
217
|
return cache;
|
|
217
218
|
};
|
|
219
|
+
var useObservableCondition = (value) => {
|
|
220
|
+
const listeners = useRef(/* @__PURE__ */ new Set());
|
|
221
|
+
const current = useRef(value);
|
|
222
|
+
const condition = useRef({
|
|
223
|
+
subscribe(cb) {
|
|
224
|
+
listeners.current.add(cb);
|
|
225
|
+
cb(current.current);
|
|
226
|
+
return () => listeners.current.delete(cb);
|
|
227
|
+
}
|
|
228
|
+
}).current;
|
|
229
|
+
useEffect(() => {
|
|
230
|
+
if (current.current === value) return;
|
|
231
|
+
current.current = value;
|
|
232
|
+
listeners.current.forEach((cb) => cb(value));
|
|
233
|
+
}, [value]);
|
|
234
|
+
return condition;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
// src/components/Epub/Hooks/useEpubKeyboardPeripherals.ts
|
|
238
|
+
var useEpubKeyboardPeripherals = () => {
|
|
239
|
+
const isScroll = useIsScroll();
|
|
240
|
+
const isFXL = useAppSelector((state) => state.publication.isFXL);
|
|
241
|
+
const noScroll = useObservableCondition(!isScroll);
|
|
242
|
+
const zoomActive = useObservableCondition(!isFXL);
|
|
243
|
+
const { actionsKeys } = useActionsPreferences();
|
|
244
|
+
return useMemo(() => {
|
|
245
|
+
const config = [
|
|
246
|
+
{ type: NavPeripheralType.progressForward, keyCombos: [{ keyCode: 32, suppressOnInteractiveElement: true, condition: noScroll }] },
|
|
247
|
+
{ type: NavPeripheralType.progressBackward, keyCombos: [{ keyCode: 32, shift: true, suppressOnInteractiveElement: true, condition: noScroll }] },
|
|
248
|
+
{ type: NavPeripheralType.moveRight, keyCombos: [{ keyCode: 39, suppressOnInteractiveElement: true, condition: noScroll }] },
|
|
249
|
+
{ type: NavPeripheralType.moveLeft, keyCombos: [{ keyCode: 37, suppressOnInteractiveElement: true, condition: noScroll }] },
|
|
250
|
+
{ type: NavPeripheralType.moveUp, keyCombos: [
|
|
251
|
+
{ keyCode: 38, suppressOnInteractiveElement: true, condition: noScroll },
|
|
252
|
+
{ keyCode: 33, suppressOnInteractiveElement: true, condition: noScroll }
|
|
253
|
+
] },
|
|
254
|
+
{ type: NavPeripheralType.moveDown, keyCombos: [
|
|
255
|
+
{ keyCode: 40, suppressOnInteractiveElement: true, condition: noScroll },
|
|
256
|
+
{ keyCode: 34, suppressOnInteractiveElement: true, condition: noScroll }
|
|
257
|
+
] },
|
|
258
|
+
{ type: NavPeripheralType.moveHome, keyCombos: [{ keyCode: 36, suppressOnInteractiveElement: true, condition: noScroll }] },
|
|
259
|
+
{ type: NavPeripheralType.moveEnd, keyCombos: [{ keyCode: 35, suppressOnInteractiveElement: true, condition: noScroll }] },
|
|
260
|
+
{ type: NavPeripheralType.zoomIn, keyCombos: ZOOM_IN_KEY_COMBOS.map((c) => ({ ...c, condition: zoomActive })) },
|
|
261
|
+
{ type: NavPeripheralType.zoomOut, keyCombos: ZOOM_OUT_KEY_COMBOS.map((c) => ({ ...c, condition: zoomActive })) }
|
|
262
|
+
];
|
|
263
|
+
for (const [key, tokens] of Object.entries(actionsKeys)) {
|
|
264
|
+
const shortcut = tokens?.shortcut;
|
|
265
|
+
if (shortcut) config.push({ type: toActionPeripheralType(key), keyCombos: shortcut.keyCombos });
|
|
266
|
+
}
|
|
267
|
+
return config;
|
|
268
|
+
}, [noScroll, zoomActive, actionsKeys]);
|
|
269
|
+
};
|
|
218
270
|
var useEpubPreferencesConfig = ({
|
|
219
271
|
isFXL,
|
|
220
272
|
settings,
|
|
@@ -224,10 +276,10 @@ var useEpubPreferencesConfig = ({
|
|
|
224
276
|
arrowsWidth,
|
|
225
277
|
preferences,
|
|
226
278
|
getFontMetadata,
|
|
227
|
-
lineHeightOptions,
|
|
228
279
|
fxlThemeKeys,
|
|
229
280
|
reflowThemeKeys
|
|
230
281
|
}) => {
|
|
282
|
+
const { processedValues: lineHeightOptions } = useLineHeight();
|
|
231
283
|
const scriptMode = useAppSelector((state) => state.publication.scriptMode);
|
|
232
284
|
const isVerticalScript = scriptMode === "cjk-vertical" || scriptMode === "mongolian-vertical";
|
|
233
285
|
const { isComponentUsed: isFontFamilyUsed } = useSettingsComponentStatus({
|
|
@@ -307,7 +359,6 @@ var useEpubPreferencesConfig = ({
|
|
|
307
359
|
fontFamily: isFontFamilyUsed ? getFontMetadata(settings.fontFamily[fontLanguage] ?? "")?.fontStack || null : void 0,
|
|
308
360
|
fontSize: isFontSizeUsed ? settings.fontSize : void 0,
|
|
309
361
|
fontWeight: isFontWeightUsed ? settings.fontWeight : void 0,
|
|
310
|
-
hyphens: isHyphensUsed ? settings.hyphens : void 0,
|
|
311
362
|
ligatures: isLigaturesUsed ? settings.ligatures : void 0,
|
|
312
363
|
noRuby: isNoRubyUsed ? settings.noRuby : void 0,
|
|
313
364
|
letterSpacing: !isLetterSpacingUsed || settings.publisherStyles ? void 0 : settings.letterSpacing,
|
|
@@ -319,6 +370,7 @@ var useEpubPreferencesConfig = ({
|
|
|
319
370
|
paragraphSpacing: !isParagraphSpacingUsed || settings.publisherStyles ? void 0 : settings.paragraphSpacing,
|
|
320
371
|
scroll: isVerticalScript ? true : !isLayoutUsed ? void 0 : settings.scroll,
|
|
321
372
|
textAlign: isTextAlignUsed ? settings.textAlign : void 0,
|
|
373
|
+
hyphens: isHyphensUsed && settings.textAlign !== "publisher" ? settings.hyphens : void 0,
|
|
322
374
|
textNormalization: isTextNormalizeUsed ? settings.textNormalization : void 0,
|
|
323
375
|
wordSpacing: !isWordSpacingUsed || settings.publisherStyles ? void 0 : settings.wordSpacing,
|
|
324
376
|
...themeProps
|
|
@@ -333,7 +385,6 @@ var useEpubPreferencesConfig = ({
|
|
|
333
385
|
preferences.theming.themes.keys,
|
|
334
386
|
preferences.theming.themes.systemThemes,
|
|
335
387
|
getFontMetadata,
|
|
336
|
-
lineHeightOptions,
|
|
337
388
|
fxlThemeKeys,
|
|
338
389
|
reflowThemeKeys,
|
|
339
390
|
isVerticalScript,
|
|
@@ -351,7 +402,8 @@ var useEpubPreferencesConfig = ({
|
|
|
351
402
|
isParagraphSpacingUsed,
|
|
352
403
|
isTextAlignUsed,
|
|
353
404
|
isTextNormalizeUsed,
|
|
354
|
-
isWordSpacingUsed
|
|
405
|
+
isWordSpacingUsed,
|
|
406
|
+
lineHeightOptions
|
|
355
407
|
]);
|
|
356
408
|
const epubDefaults = useMemo(() => {
|
|
357
409
|
if (isFXL) return {};
|
|
@@ -426,7 +478,6 @@ var useEpubReaderInit = ({
|
|
|
426
478
|
getFontInjectables,
|
|
427
479
|
fxlThemeKeys,
|
|
428
480
|
reflowThemeKeys,
|
|
429
|
-
lineHeightOptions,
|
|
430
481
|
arrowsOccupySpace,
|
|
431
482
|
arrowsWidth,
|
|
432
483
|
colorScheme,
|
|
@@ -447,7 +498,6 @@ var useEpubReaderInit = ({
|
|
|
447
498
|
arrowsWidth,
|
|
448
499
|
preferences,
|
|
449
500
|
getFontMetadata,
|
|
450
|
-
lineHeightOptions,
|
|
451
501
|
fxlThemeKeys,
|
|
452
502
|
reflowThemeKeys
|
|
453
503
|
});
|
|
@@ -462,6 +512,7 @@ var useEpubReaderInit = ({
|
|
|
462
512
|
if (!isFXL) removeFontResources();
|
|
463
513
|
onCleanup?.();
|
|
464
514
|
}, [isFXL, removeFontResources, onCleanup]);
|
|
515
|
+
const keyboardPeripherals = useEpubKeyboardPeripherals();
|
|
465
516
|
const { EpubNavigatorLoad, EpubNavigatorDestroy } = useEpubNavigator();
|
|
466
517
|
const isNavigatorLoadedEpub = useRef(false);
|
|
467
518
|
useEffect(() => {
|
|
@@ -479,7 +530,8 @@ var useEpubReaderInit = ({
|
|
|
479
530
|
preferences: epubPreferences,
|
|
480
531
|
defaults: epubDefaults,
|
|
481
532
|
injectables: injectables || void 0,
|
|
482
|
-
contentProtection: contentProtectionConfig
|
|
533
|
+
contentProtection: contentProtectionConfig,
|
|
534
|
+
keyboardPeripherals
|
|
483
535
|
};
|
|
484
536
|
isNavigatorLoadedEpub.current = true;
|
|
485
537
|
onNavigatorReady?.();
|
|
@@ -514,7 +566,8 @@ var StatefulReader = ({
|
|
|
514
566
|
publication,
|
|
515
567
|
localDataKey,
|
|
516
568
|
plugins,
|
|
517
|
-
positionStorage
|
|
569
|
+
positionStorage,
|
|
570
|
+
containerRefSetter
|
|
518
571
|
}) => {
|
|
519
572
|
const [pluginsRegistered, setPluginsRegistered] = useState(false);
|
|
520
573
|
useLayoutEffect(() => {
|
|
@@ -530,9 +583,9 @@ var StatefulReader = ({
|
|
|
530
583
|
if (!pluginsRegistered) {
|
|
531
584
|
return null;
|
|
532
585
|
}
|
|
533
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ThPluginProvider, { children: /* @__PURE__ */ jsx(StatefulReaderInner, { publication, localDataKey, positionStorage }) }) });
|
|
586
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ThPluginProvider, { children: /* @__PURE__ */ jsx(StatefulReaderInner, { publication, localDataKey, positionStorage, containerRefSetter }) }) });
|
|
534
587
|
};
|
|
535
|
-
var StatefulReaderInner = ({ publication, localDataKey, positionStorage }) => {
|
|
588
|
+
var StatefulReaderInner = ({ publication, localDataKey, positionStorage, containerRefSetter }) => {
|
|
536
589
|
const { fxlActionKeys, fxlThemeKeys, reflowActionKeys, reflowThemeKeys } = useFilteredPreferenceKeys();
|
|
537
590
|
const { preferences, getFontMetadata, getFontInjectables } = usePreferences();
|
|
538
591
|
const { direction: uiDirection } = useLocale();
|
|
@@ -542,6 +595,7 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage }) => {
|
|
|
542
595
|
const { injectFontResources, removeFontResources, getAndroidFXLPatch } = useFonts();
|
|
543
596
|
const container = useRef(null);
|
|
544
597
|
const arrowsWidth = useRef(2 * ((preferences.theming.arrow.size || 40) + (preferences.theming.arrow.offset || 0)));
|
|
598
|
+
const profile = useAppSelector((state) => state.reader.profile);
|
|
545
599
|
const isFXL = useAppSelector((state) => state.publication.isFXL);
|
|
546
600
|
const isRTL = useAppSelector((state) => state.publication.isRTL);
|
|
547
601
|
const positionsList = useAppSelector((state) => state.publication.positionsList);
|
|
@@ -573,6 +627,7 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage }) => {
|
|
|
573
627
|
const colorScheme = useAppSelector((state) => state.theming.colorScheme);
|
|
574
628
|
const reducedMotion = useAppSelector((state) => state.theming.prefersReducedMotion);
|
|
575
629
|
const breakpoint = useAppSelector((state) => state.theming.breakpoint);
|
|
630
|
+
const containerBreakpoint = useAppSelector((state) => state.theming.containerBreakpoint);
|
|
576
631
|
const isImmersive = useAppSelector((state) => state.reader.isImmersive);
|
|
577
632
|
const isHovering = useAppSelector((state) => state.reader.isHovering);
|
|
578
633
|
const layoutUI = isFXL ? preferences.theming.layout.ui?.fxl || "layered-ui" /* layered */ : isScroll ? preferences.theming.layout.ui?.reflow || "layered-ui" /* layered */ : "stacked-ui" /* stacked */;
|
|
@@ -612,7 +667,7 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage }) => {
|
|
|
612
667
|
const onFsChange = useCallback((isFullscreen) => {
|
|
613
668
|
dispatch(setFullscreen(isFullscreen));
|
|
614
669
|
}, [dispatch]);
|
|
615
|
-
|
|
670
|
+
useFullscreen(onFsChange);
|
|
616
671
|
const epubNavigator = useEpubNavigator();
|
|
617
672
|
const {
|
|
618
673
|
goLeft,
|
|
@@ -639,7 +694,6 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage }) => {
|
|
|
639
694
|
dispatch(setTimeline(timeline2));
|
|
640
695
|
}
|
|
641
696
|
});
|
|
642
|
-
const lineHeightOptions = useLineHeight();
|
|
643
697
|
const documentTitleFormat = preferences.metadata?.documentTitle?.format;
|
|
644
698
|
let documentTitle;
|
|
645
699
|
if (documentTitleFormat) {
|
|
@@ -699,7 +753,7 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage }) => {
|
|
|
699
753
|
}
|
|
700
754
|
}
|
|
701
755
|
}, [getCframes, cache, preferences.affordances.scroll, goLeft, goRight, dispatch, activateImmersiveOnAction, toggleIsImmersive]);
|
|
702
|
-
const handleClick = useCallback((
|
|
756
|
+
const handleClick = useCallback((_event) => {
|
|
703
757
|
if (cache.current.layoutUI === "layered-ui" /* layered */ && (!cache.current.settings.scroll || preferences.affordances.scroll.toggleOnMiddlePointer.includes("click"))) {
|
|
704
758
|
toggleIsImmersive();
|
|
705
759
|
}
|
|
@@ -728,60 +782,33 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage }) => {
|
|
|
728
782
|
}
|
|
729
783
|
}
|
|
730
784
|
}, [navLayout, currentLocator, handleFXLProgression]);
|
|
731
|
-
const
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
785
|
+
const moveTo = useCallback((direction) => {
|
|
786
|
+
const navigationCallback = () => {
|
|
787
|
+
dispatch(setUserNavigated(true));
|
|
788
|
+
activateImmersiveOnAction();
|
|
789
|
+
};
|
|
790
|
+
switch (direction) {
|
|
791
|
+
case "right":
|
|
792
|
+
!cache.current.settings.scroll && goRight(!cache.current.reducedMotion, navigationCallback);
|
|
793
|
+
break;
|
|
794
|
+
case "left":
|
|
795
|
+
!cache.current.settings.scroll && goLeft(!cache.current.reducedMotion, navigationCallback);
|
|
796
|
+
break;
|
|
797
|
+
}
|
|
798
|
+
}, [dispatch, activateImmersiveOnAction, cache, goRight, goLeft]);
|
|
799
|
+
const { zoomIn, zoomOut } = useZoomCallbacks(epubNavigator);
|
|
800
|
+
const goProgression = useCallback((shiftKey) => {
|
|
801
|
+
if (!cache.current.settings?.scroll) {
|
|
802
|
+
const cb = () => {
|
|
735
803
|
dispatch(setUserNavigated(true));
|
|
736
804
|
activateImmersiveOnAction();
|
|
737
805
|
};
|
|
738
|
-
|
|
739
|
-
case "right":
|
|
740
|
-
if (!cache.current.settings.scroll) {
|
|
741
|
-
goRight(!cache.current.reducedMotion, navigationCallback);
|
|
742
|
-
}
|
|
743
|
-
break;
|
|
744
|
-
case "left":
|
|
745
|
-
if (!cache.current.settings.scroll) {
|
|
746
|
-
goLeft(!cache.current.reducedMotion, navigationCallback);
|
|
747
|
-
}
|
|
748
|
-
break;
|
|
749
|
-
}
|
|
750
|
-
},
|
|
751
|
-
goProgression: (shiftKey) => {
|
|
752
|
-
if (!cache.current.settings?.scroll) {
|
|
753
|
-
const callback = () => {
|
|
754
|
-
dispatch(setUserNavigated(true));
|
|
755
|
-
activateImmersiveOnAction();
|
|
756
|
-
};
|
|
757
|
-
shiftKey ? goBackward(!cache.current.reducedMotion, callback) : goForward(!cache.current.reducedMotion, callback);
|
|
758
|
-
}
|
|
759
|
-
},
|
|
760
|
-
toggleAction: (actionKey) => {
|
|
761
|
-
switch (actionKey) {
|
|
762
|
-
case "fullscreen" /* fullscreen */:
|
|
763
|
-
fs.handleFullscreen();
|
|
764
|
-
break;
|
|
765
|
-
case "settings" /* settings */:
|
|
766
|
-
case "toc" /* toc */:
|
|
767
|
-
dispatch(toggleActionOpen({
|
|
768
|
-
key: actionKey,
|
|
769
|
-
profile: "epub"
|
|
770
|
-
}));
|
|
771
|
-
break;
|
|
772
|
-
}
|
|
806
|
+
shiftKey ? goBackward(!cache.current.reducedMotion, cb) : goForward(!cache.current.reducedMotion, cb);
|
|
773
807
|
}
|
|
774
|
-
}
|
|
808
|
+
}, [dispatch, activateImmersiveOnAction, cache, goBackward, goForward]);
|
|
775
809
|
const listeners = useMemo(() => ({
|
|
776
810
|
frameLoaded: async function(_wnd) {
|
|
777
811
|
await initReadingEnv();
|
|
778
|
-
const _cframes = getCframes();
|
|
779
|
-
_cframes?.forEach(
|
|
780
|
-
(frameManager) => {
|
|
781
|
-
if (frameManager) p.observe(frameManager.window);
|
|
782
|
-
}
|
|
783
|
-
);
|
|
784
|
-
p.observe(window);
|
|
785
812
|
},
|
|
786
813
|
positionChanged: async function(locator) {
|
|
787
814
|
if (navLayout() !== Layout.fixed) {
|
|
@@ -847,9 +874,45 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage }) => {
|
|
|
847
874
|
},
|
|
848
875
|
contextMenu: function(_data) {
|
|
849
876
|
},
|
|
850
|
-
peripheral: function(
|
|
877
|
+
peripheral: function(data) {
|
|
878
|
+
switch (data.type) {
|
|
879
|
+
case NavPeripheralType.progressForward:
|
|
880
|
+
goProgression(false);
|
|
881
|
+
break;
|
|
882
|
+
case NavPeripheralType.progressBackward:
|
|
883
|
+
goProgression(true);
|
|
884
|
+
break;
|
|
885
|
+
case NavPeripheralType.moveRight:
|
|
886
|
+
moveTo("right");
|
|
887
|
+
break;
|
|
888
|
+
case NavPeripheralType.moveLeft:
|
|
889
|
+
moveTo("left");
|
|
890
|
+
break;
|
|
891
|
+
case NavPeripheralType.moveUp:
|
|
892
|
+
moveTo("up");
|
|
893
|
+
break;
|
|
894
|
+
case NavPeripheralType.moveDown:
|
|
895
|
+
moveTo("down");
|
|
896
|
+
break;
|
|
897
|
+
case NavPeripheralType.moveHome:
|
|
898
|
+
moveTo("home");
|
|
899
|
+
break;
|
|
900
|
+
case NavPeripheralType.moveEnd:
|
|
901
|
+
moveTo("end");
|
|
902
|
+
break;
|
|
903
|
+
case NavPeripheralType.zoomIn:
|
|
904
|
+
zoomIn();
|
|
905
|
+
break;
|
|
906
|
+
case NavPeripheralType.zoomOut:
|
|
907
|
+
zoomOut();
|
|
908
|
+
break;
|
|
909
|
+
default: {
|
|
910
|
+
const actionKey = fromActionPeripheralType(data.type);
|
|
911
|
+
if (actionKey && profile) dispatch(toggleActionOpen({ key: actionKey, profile }));
|
|
912
|
+
}
|
|
913
|
+
}
|
|
851
914
|
}
|
|
852
|
-
}), [
|
|
915
|
+
}), [initReadingEnv, navLayout, setLocalData, dispatch, handleTap, handleClick, cache, preferences.affordances.scroll, isScrollStart, isScrollEnd, updatePublicationNavigationState, moveTo, goProgression, zoomIn, zoomOut, profile]);
|
|
853
916
|
const initialPosition = useMemo(() => getLocalData(), [getLocalData]);
|
|
854
917
|
const { navigatorReady } = useEpubReaderInit({
|
|
855
918
|
container,
|
|
@@ -868,7 +931,6 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage }) => {
|
|
|
868
931
|
getFontInjectables,
|
|
869
932
|
fxlThemeKeys,
|
|
870
933
|
reflowThemeKeys,
|
|
871
|
-
lineHeightOptions,
|
|
872
934
|
arrowsOccupySpace,
|
|
873
935
|
arrowsWidth,
|
|
874
936
|
colorScheme,
|
|
@@ -877,12 +939,6 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage }) => {
|
|
|
877
939
|
onNavigatorReady: () => {
|
|
878
940
|
dispatch(setLoading(false));
|
|
879
941
|
},
|
|
880
|
-
onNavigatorLoaded: () => {
|
|
881
|
-
p.observe(window);
|
|
882
|
-
},
|
|
883
|
-
onCleanup: () => {
|
|
884
|
-
p.destroy();
|
|
885
|
-
},
|
|
886
942
|
fxlProgressionCallback: handleFXLProgression
|
|
887
943
|
});
|
|
888
944
|
const applyConstraint = useCallback(async (value) => {
|
|
@@ -925,13 +981,15 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage }) => {
|
|
|
925
981
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(NavigatorProvider, { visualNavigator: epubNavigator, children: /* @__PURE__ */ jsx("main", { className: thorium_web_reader_app_default.main, children: /* @__PURE__ */ jsx(StatefulDockingWrapper, { children: /* @__PURE__ */ jsxs(
|
|
926
982
|
"div",
|
|
927
983
|
{
|
|
984
|
+
ref: containerRefSetter,
|
|
928
985
|
className: getReaderClassNames({
|
|
929
986
|
isScroll,
|
|
930
987
|
isImmersive,
|
|
931
988
|
isHovering,
|
|
932
989
|
isFXL,
|
|
933
990
|
layoutUI,
|
|
934
|
-
breakpoint
|
|
991
|
+
breakpoint,
|
|
992
|
+
containerBreakpoint
|
|
935
993
|
}),
|
|
936
994
|
children: [
|
|
937
995
|
/* @__PURE__ */ jsx(
|
|
@@ -986,5 +1044,5 @@ var StatefulReaderInner = ({ publication, localDataKey, positionStorage }) => {
|
|
|
986
1044
|
};
|
|
987
1045
|
|
|
988
1046
|
export { StatefulReader };
|
|
989
|
-
//# sourceMappingURL=chunk-
|
|
990
|
-
//# sourceMappingURL=chunk-
|
|
1047
|
+
//# sourceMappingURL=chunk-BBCSLDQT.mjs.map
|
|
1048
|
+
//# sourceMappingURL=chunk-BBCSLDQT.mjs.map
|