@edrlab/thorium-web 1.1.6 → 1.2.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.
Files changed (77) hide show
  1. package/dist/{ThPreferencesAdapter-B8AYujCA.d.mts → ThPreferencesAdapter-DrZ5_6Dv.d.mts} +4 -139
  2. package/dist/{ThSettingsWrapper-BlmAxcWF.d.mts → ThSettingsWrapper-8Kx0SnH4.d.mts} +1 -1
  3. package/dist/{actions-BRtHsxpm.d.mts → actions-D2CHvCHu.d.mts} +2 -2
  4. package/dist/{actionsReducer-bT0pfxLJ.d.mts → actionsReducer-kc-S130w.d.mts} +3 -24
  5. package/dist/chunk-34MVY33F.mjs +913 -0
  6. package/dist/chunk-34MVY33F.mjs.map +1 -0
  7. package/dist/{chunk-KJXHAJYK.mjs → chunk-4VHEHMJN.mjs} +128 -11
  8. package/dist/chunk-4VHEHMJN.mjs.map +1 -0
  9. package/dist/{chunk-QNYZCQKO.mjs → chunk-72XCX5TD.mjs} +4 -4
  10. package/dist/chunk-72XCX5TD.mjs.map +1 -0
  11. package/dist/{chunk-SMK7A7VF.mjs → chunk-7NEQAW7J.mjs} +3 -3
  12. package/dist/chunk-7NEQAW7J.mjs.map +1 -0
  13. package/dist/{chunk-SFHOVH6R.mjs → chunk-H4J2VY7Z.mjs} +201 -35
  14. package/dist/chunk-H4J2VY7Z.mjs.map +1 -0
  15. package/dist/{chunk-COQXDRKD.mjs → chunk-K3K7TUWM.mjs} +2 -2
  16. package/dist/chunk-K3K7TUWM.mjs.map +1 -0
  17. package/dist/{chunk-KTPIH35Y.mjs → chunk-NYZBHYW2.mjs} +5 -3
  18. package/dist/chunk-NYZBHYW2.mjs.map +1 -0
  19. package/dist/chunk-RRDEPGBK.mjs +75 -0
  20. package/dist/chunk-RRDEPGBK.mjs.map +1 -0
  21. package/dist/chunk-S4M7ED5Q.mjs +407 -0
  22. package/dist/chunk-S4M7ED5Q.mjs.map +1 -0
  23. package/dist/components/Epub/index.d.mts +17 -11
  24. package/dist/components/Epub/index.mjs +12 -831
  25. package/dist/components/Epub/index.mjs.map +1 -1
  26. package/dist/components/Misc/index.css +23 -0
  27. package/dist/components/Misc/index.css.map +1 -1
  28. package/dist/components/Misc/index.d.mts +10 -1
  29. package/dist/components/Misc/index.mjs +30 -2
  30. package/dist/components/Misc/index.mjs.map +1 -1
  31. package/dist/components/Reader/index.css +1283 -0
  32. package/dist/components/Reader/index.css.map +1 -0
  33. package/dist/components/Reader/index.d.mts +30 -0
  34. package/dist/components/Reader/index.mjs +79 -0
  35. package/dist/components/Reader/index.mjs.map +1 -0
  36. package/dist/components/WebPub/index.d.mts +15 -31
  37. package/dist/components/WebPub/index.mjs +11 -374
  38. package/dist/components/WebPub/index.mjs.map +1 -1
  39. package/dist/core/Components/index.d.mts +11 -8
  40. package/dist/core/Components/index.mjs +1 -1
  41. package/dist/core/Helpers/index.d.mts +1 -1
  42. package/dist/core/Hooks/index.d.mts +54 -5
  43. package/dist/core/Hooks/index.mjs +1 -1
  44. package/dist/errorHandler-CL2YIfQY.d.mts +26 -0
  45. package/dist/i18n/index.mjs +4 -4
  46. package/dist/immer.d-CoRThNOF.d.mts +23 -0
  47. package/dist/lib/index.d.mts +12 -162
  48. package/dist/lib/index.mjs +2 -2
  49. package/dist/locales/el/thorium-web.json +31 -0
  50. package/dist/locales/en/thorium-web.json +14 -2
  51. package/dist/locales/et/thorium-web.json +6 -2
  52. package/dist/locales/fi/thorium-shared.json +14 -8
  53. package/dist/locales/fi/thorium-web.json +2 -1
  54. package/dist/locales/fr/thorium-shared.json +100 -0
  55. package/dist/locales/it/thorium-shared.json +9 -0
  56. package/dist/locales/lt/thorium-shared.json +22 -13
  57. package/dist/locales/lt/thorium-web.json +2 -1
  58. package/dist/locales/pt-PT/thorium-shared.json +64 -1
  59. package/dist/locales/pt-PT/thorium-web.json +4 -3
  60. package/dist/locales/sv/thorium-shared.json +61 -3
  61. package/dist/locales/sv/thorium-web.json +4 -3
  62. package/dist/preferences/index.d.mts +8 -7
  63. package/dist/preferences/index.mjs +3 -3
  64. package/dist/settingsReducer-C1wwCAMv.d.mts +159 -0
  65. package/dist/{ui-BVlJcPL_.d.mts → ui-CamWuqOo.d.mts} +1 -1
  66. package/dist/useContrast-D6sjPjxy.d.mts +152 -0
  67. package/dist/{useEpubNavigator-CsraD65e.d.mts → useEpubNavigator-CwHJfoiV.d.mts} +1 -1
  68. package/dist/{usePreferences-rfT368__.d.mts → usePreferences-BXFJbval.d.mts} +1 -1
  69. package/dist/{StatefulReader-CjgFzHoO.d.mts → useReaderTransitions-guT-eA-Q.d.mts} +50 -50
  70. package/package.json +5 -3
  71. package/dist/chunk-COQXDRKD.mjs.map +0 -1
  72. package/dist/chunk-KJXHAJYK.mjs.map +0 -1
  73. package/dist/chunk-KTPIH35Y.mjs.map +0 -1
  74. package/dist/chunk-QNYZCQKO.mjs.map +0 -1
  75. package/dist/chunk-SFHOVH6R.mjs.map +0 -1
  76. package/dist/chunk-SMK7A7VF.mjs.map +0 -1
  77. package/dist/useContrast-Cgsrl7GS.d.mts +0 -15
@@ -1,838 +1,19 @@
1
- import { ThPluginRegistry, createDefaultPlugin, ThPluginProvider, useSpacingPresets, useFonts, useSettingsComponentStatus, useLineHeight, Peripherals, NavigatorProvider, thorium_web_reader_app_default, StatefulDockingWrapper, getReaderClassNames, StatefulReaderHeader, StatefulReaderFooter, useReaderTransitions, thorium_web_button_default } from '../../chunk-SFHOVH6R.mjs';
2
- export { StatefulActionIcon, StatefulBottomSheet, StatefulCollapsibleActionsBar, StatefulColumns, StatefulDockedSheet, StatefulDropdown, StatefulFontFamily, StatefulFullScreenSheet, StatefulFullscreenTrigger, StatefulGroupWrapper, StatefulHyphens, StatefulJumpToPositionContainer, StatefulJumpToPositionTrigger, StatefulLayout, StatefulLetterSpacing, StatefulLineHeight, StatefulNumberField, StatefulOverflowMenu, StatefulOverflowMenuItem, StatefulParagraphIndent, StatefulParagraphSpacing, StatefulPopoverSheet, StatefulPreferencesProvider, StatefulPublisherStyles, StatefulRadioGroup, StatefulSettingsContainer, StatefulSettingsTrigger, StatefulSheetWrapper, StatefulSlider, StatefulSpacingGroup, StatefulSpacingGroupContainer, StatefulSpacingPresets, StatefulSwitch, StatefulTextAlign, StatefulTextGroup, StatefulTextGroupContainer, StatefulTextNormalize, StatefulTheme, StatefulTocContainer, StatefulTocTrigger, StatefulWordSpacing, StatefulZoom, UnstableStatefulFontWeight, createDefaultPlugin, useDocking, useGridNavigation, useGridTemplate, useLineHeight, useNavigator, usePublication, useReaderTransitions, useSpacingPresets } from '../../chunk-SFHOVH6R.mjs';
3
- import { useFullscreen, useEpubNavigator, useLocalStorage, useTimeline, useDocumentTitle } from '../../chunk-KJXHAJYK.mjs';
4
- export { useEpubNavigator } from '../../chunk-KJXHAJYK.mjs';
5
- export { ThI18nProvider, Trans } from '../../chunk-QNYZCQKO.mjs';
6
- import { useAppSelector, useAppDispatch, setReducedTransparency, setReducedMotion, setMonochrome, setForcedColors, setContrast, setColorScheme, setBreakpoint, setFullscreen, setTimeline, setImmersive, setHovering, toggleImmersive, useAppStore, toggleActionOpen, setDirection, setPlatformModifier, setReaderProfile, setRTL, setFXL, setFontLanguage, setHasDisplayTransformability, setUserNavigated, setScrollAffordance, debounce, setPublicationStart, setPublicationEnd, setTheme, setPositionsList, setLoading, setHasArrows } from '../../chunk-COQXDRKD.mjs';
7
- export { ThReduxPreferencesAdapter, ThStoreProvider, actionsSlice, activateDockPanel, collapseDockPanel, deactivateDockPanel, dockAction, expandDockPanel, handleSpacingSetting, initialSettingsState, initialWebPubSettingsState, makeStore, preferencesSlice, publicationSlice, readerSlice, setActionOpen, setBreakpoint, setColorScheme, setColumnCount, setContrast, setDirection, setDockPanelWidth, setFXL, setFontFamily, setFontLanguage, setFontSize, setFontWeight, setForcedColors, setFullscreen, setHasArrows, setHasDisplayTransformability, setHovering, setHyphens, setImmersive, setL10n, setLetterSpacing, setLineHeight, setLineLength, setLoading, setMonochrome, setOverflow, setPaginatedAffordance, setParagraphIndent, setParagraphSpacing, setPlatformModifier, setPositionsList, setProgressionFormat, setPublicationEnd, setPublicationStart, setPublisherStyles, setRTL, setReaderProfile, setReducedMotion, setReducedTransparency, setRunningHeadFormat, setScroll, setScrollAffordance, setScrollAffordances, setSettingsContainer, setSpacingPreset, setTextAlign, setTextNormalization, setTheme, setTimeline, setTocEntry, setTocTree, setUI, setUserNavigated, setWebPubFontFamily, setWebPubFontWeight, setWebPubHyphens, setWebPubLetterSpacing, setWebPubLineHeight, setWebPubParagraphIndent, setWebPubParagraphSpacing, setWebPubPublisherStyles, setWebPubSpacingPreset, setWebPubTextAlign, setWebPubTextNormalization, setWebPubWordSpacing, setWebPubZoom, setWordSpacing, settingsSlice, themeSlice, toggleActionOpen, toggleImmersive, updateFromPreferences, useAppDispatch, useAppSelector, useAppStore, webPubSettingsSlice } from '../../chunk-COQXDRKD.mjs';
8
- import { usePreferenceKeys, usePreferences, useTheming, prefixString, buildThemeObject, resolveContentProtectionConfig } from '../../chunk-SMK7A7VF.mjs';
9
- export { ThPreferencesProvider, usePreferences, useTheming } from '../../chunk-SMK7A7VF.mjs';
1
+ export { StatefulReader } from '../../chunk-34MVY33F.mjs';
2
+ export { StatefulActionIcon, StatefulBottomSheet, StatefulCollapsibleActionsBar, StatefulColumns, StatefulDockedSheet, StatefulDropdown, StatefulFontFamily, StatefulFullScreenSheet, StatefulFullscreenTrigger, StatefulGroupWrapper, StatefulHyphens, StatefulJumpToPositionContainer, StatefulJumpToPositionTrigger, StatefulLayout, StatefulLetterSpacing, StatefulLineHeight, StatefulNumberField, StatefulOverflowMenu, StatefulOverflowMenuItem, StatefulParagraphIndent, StatefulParagraphSpacing, StatefulPopoverSheet, StatefulPreferencesProvider, StatefulPublisherStyles, StatefulRadioGroup, StatefulSettingsContainer, StatefulSettingsTrigger, StatefulSheetWrapper, StatefulSlider, StatefulSpacingGroup, StatefulSpacingGroupContainer, StatefulSpacingPresets, StatefulSwitch, StatefulTextAlign, StatefulTextGroup, StatefulTextGroupContainer, StatefulTextNormalize, StatefulTheme, StatefulTocContainer, StatefulTocTrigger, StatefulWordSpacing, StatefulZoom, UnstableStatefulFontWeight, createDefaultPlugin, useDocking, useGridNavigation, useGridTemplate, useLineHeight, useNavigator, usePublication, useReaderTransitions, useSpacingPresets } from '../../chunk-H4J2VY7Z.mjs';
3
+ export { canRenderProgressionFormat, getBestMatchingProgressionFormat, getSupportedProgressionFormats, isActiveElement, isInteractiveElement, isKeyboardTriggered, makeBreakpointsMap } from '../../chunk-47AIIJFO.mjs';
4
+ export { useEpubNavigator } from '../../chunk-4VHEHMJN.mjs';
5
+ export { ThI18nProvider, Trans } from '../../chunk-72XCX5TD.mjs';
6
+ export { ThReduxPreferencesAdapter, ThStoreProvider, actionsSlice, activateDockPanel, collapseDockPanel, deactivateDockPanel, dockAction, expandDockPanel, handleSpacingSetting, initialSettingsState, initialWebPubSettingsState, makeStore, preferencesSlice, publicationSlice, readerSlice, setActionOpen, setBreakpoint, setColorScheme, setColumnCount, setContrast, setDirection, setDockPanelWidth, setFXL, setFontFamily, setFontLanguage, setFontSize, setFontWeight, setForcedColors, setFullscreen, setHasArrows, setHasDisplayTransformability, setHovering, setHyphens, setImmersive, setL10n, setLetterSpacing, setLineHeight, setLineLength, setLoading, setMonochrome, setOverflow, setPaginatedAffordance, setParagraphIndent, setParagraphSpacing, setPlatformModifier, setPositionsList, setProgressionFormat, setPublicationEnd, setPublicationStart, setPublisherStyles, setRTL, setReaderProfile, setReducedMotion, setReducedTransparency, setRunningHeadFormat, setScroll, setScrollAffordance, setScrollAffordances, setSettingsContainer, setSpacingPreset, setTextAlign, setTextNormalization, setTheme, setTimeline, setTocEntry, setTocTree, setUI, setUserNavigated, setWebPubFontFamily, setWebPubFontWeight, setWebPubHyphens, setWebPubLetterSpacing, setWebPubLineHeight, setWebPubParagraphIndent, setWebPubParagraphSpacing, setWebPubPublisherStyles, setWebPubSpacingPreset, setWebPubTextAlign, setWebPubTextNormalization, setWebPubWordSpacing, setWebPubZoom, setWordSpacing, settingsSlice, themeSlice, toggleActionOpen, toggleImmersive, updateFromPreferences, useAppDispatch, useAppSelector, useAppStore, webPubSettingsSlice } from '../../chunk-K3K7TUWM.mjs';
7
+ export { ThPreferencesProvider, usePreferences, useTheming } from '../../chunk-7NEQAW7J.mjs';
8
+ export { propsToCSSVars } from '../../chunk-XVSFXHYB.mjs';
10
9
  import '../../chunk-GFSLVQIG.mjs';
10
+ export { UnstableShortcutMetaKeywords, UnstableShortcutRepresentation, buildShortcut, defaultPlatformModifier, getPlatform, getPlatformModifier, isIOSish, isIpadOS, isMacish, metaKeys } from '../../chunk-5LUMM7FW.mjs';
11
11
  import '../../chunk-NQ2ZSGCX.mjs';
12
- import { ThNavigationButton } from '../../chunk-KTPIH35Y.mjs';
13
- import { usePrevious } from '../../chunk-YZ73DHRU.mjs';
14
- import { useI18n } from '../../chunk-IYAFKTPL.mjs';
12
+ import '../../chunk-RRDEPGBK.mjs';
13
+ import '../../chunk-NYZBHYW2.mjs';
14
+ import '../../chunk-YZ73DHRU.mjs';
15
15
  export { DEFAULT_CONFIG, i18n, initI18n, useI18n } from '../../chunk-IYAFKTPL.mjs';
16
16
  import '../../chunk-B3WDMWCT.mjs';
17
17
  import '../../chunk-MLEYTQGK.mjs';
18
- import { makeBreakpointsMap, isActiveElement } from '../../chunk-47AIIJFO.mjs';
19
- export { canRenderProgressionFormat, getBestMatchingProgressionFormat, getSupportedProgressionFormats, isActiveElement, isInteractiveElement, isKeyboardTriggered, makeBreakpointsMap } from '../../chunk-47AIIJFO.mjs';
20
- import { propsToCSSVars, ThArrowVariant } from '../../chunk-XVSFXHYB.mjs';
21
- export { propsToCSSVars } from '../../chunk-XVSFXHYB.mjs';
22
- import { getPlatformModifier } from '../../chunk-5LUMM7FW.mjs';
23
- export { UnstableShortcutMetaKeywords, UnstableShortcutRepresentation, buildShortcut, defaultPlatformModifier, getPlatform, getPlatformModifier, isIOSish, isIpadOS, isMacish, metaKeys } from '../../chunk-5LUMM7FW.mjs';
24
- import { useState, useEffect, useRef, useCallback, useMemo } from 'react';
25
- import { I18nProvider } from 'react-aria';
26
- import { HttpFetcher, Manifest, Publication, ReadingProgression, Layout, Feature, Locator } from '@readium/shared';
27
- import classNames2 from 'classnames';
28
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
29
-
30
- var usePaginatedArrows = () => {
31
- const { preferences } = usePreferences();
32
- const hasArrows = useAppSelector((state) => state.reader.hasArrows);
33
- const isFXL = useAppSelector((state) => state.publication.isFXL);
34
- const breakpoint = useAppSelector((state) => state.theming.breakpoint);
35
- const {
36
- isScroll,
37
- fromImmersive,
38
- toImmersive,
39
- fromFullscreen,
40
- toFullscreen,
41
- fromScroll,
42
- toUserNavigation
43
- } = useReaderTransitions();
44
- const dispatch = useAppDispatch();
45
- const prefs = useMemo(
46
- () => isFXL ? preferences.affordances.paginated.fxl : preferences.affordances.paginated.reflow,
47
- [isFXL, preferences.affordances.paginated.fxl, preferences.affordances.paginated.reflow]
48
- );
49
- const prefsMap = useMemo(
50
- () => makeBreakpointsMap({
51
- defaultValue: prefs.default,
52
- fromEnum: ThArrowVariant,
53
- pref: prefs.breakpoints,
54
- validateKey: "variant"
55
- }),
56
- [prefs.default, prefs.breakpoints]
57
- );
58
- const { variant, discard, hint } = useMemo(() => {
59
- const result = prefsMap[breakpoint] || prefs.default;
60
- if (isFXL) {
61
- return {
62
- ...result,
63
- variant: "layered" /* layered */
64
- };
65
- }
66
- return result;
67
- }, [breakpoint, prefsMap, isFXL, prefs.default]);
68
- const prevVariant = usePrevious(variant);
69
- const prevDiscard = usePrevious(discard);
70
- useEffect(() => {
71
- if (!prevDiscard?.includes("navigation") && discard?.includes("navigation")) {
72
- dispatch(setUserNavigated(false));
73
- return;
74
- }
75
- if (discard === "none" && prevDiscard !== "none") {
76
- dispatch(setHasArrows(true));
77
- dispatch(setUserNavigated(false));
78
- return;
79
- }
80
- if (prevVariant === "none" /* none */ && variant !== "none" /* none */) {
81
- dispatch(setHasArrows(true));
82
- dispatch(setUserNavigated(false));
83
- return;
84
- }
85
- const shouldHide = discard?.includes("immersive") && toImmersive || discard?.includes("fullscreen") && toFullscreen || discard?.includes("navigation") && toUserNavigation;
86
- const shouldShow = hint?.includes("immersiveChange") && fromImmersive || hint?.includes("fullscreenChange") && fromFullscreen || hint?.includes("layoutChange") && fromScroll;
87
- if (shouldHide) {
88
- dispatch(setHasArrows(false));
89
- if (discard?.includes("navigation") && toUserNavigation) {
90
- dispatch(setUserNavigated(false));
91
- }
92
- } else if (shouldShow) {
93
- dispatch(setHasArrows(true));
94
- }
95
- }, [toImmersive, toFullscreen, toUserNavigation, fromImmersive, fromFullscreen, fromScroll, discard, hint, prevVariant, variant, prevDiscard, dispatch]);
96
- if (variant === "none" /* none */ || isScroll) {
97
- return {
98
- isVisible: false,
99
- occupySpace: false,
100
- shouldTrackNavigation: false,
101
- supportsVariant: !isFXL
102
- };
103
- }
104
- return {
105
- isVisible: hasArrows,
106
- occupySpace: variant === "stacked" /* stacked */,
107
- shouldTrackNavigation: Array.isArray(discard) && discard.includes("navigation"),
108
- supportsVariant: !isFXL
109
- };
110
- };
111
-
112
- // src/components/assets/styles/thorium-web.reader.paginatedArrow.module.css
113
- var thorium_web_reader_paginatedArrow_default = {
114
- container: "thorium_web_reader_paginatedArrow_container",
115
- leftContainer: "thorium_web_reader_paginatedArrow_leftContainer",
116
- rightContainer: "thorium_web_reader_paginatedArrow_rightContainer",
117
- occupiesSpace: "thorium_web_reader_paginatedArrow_occupiesSpace",
118
- visuallyHidden: "thorium_web_reader_paginatedArrow_visuallyHidden"
119
- };
120
- var StatefulReaderArrowButton = ({
121
- direction,
122
- className,
123
- isDisabled,
124
- onPress,
125
- ...props
126
- }) => {
127
- const { preferences } = usePreferences();
128
- const { t } = useI18n();
129
- const buttonRef = useRef(null);
130
- const isRTL = useAppSelector((state) => state.publication.isRTL);
131
- const hasArrows = useAppSelector((state) => state.reader.hasArrows);
132
- const {
133
- isVisible,
134
- occupySpace
135
- } = usePaginatedArrows();
136
- const [isHovering, setIsHovering] = useState(false);
137
- const label = direction === "right" && !isRTL || direction === "left" && isRTL ? t("reader.actions.goForward") : t("reader.actions.goBackward");
138
- const handleClassNameFromState = () => {
139
- let className2 = "";
140
- if (!isVisible) {
141
- className2 = thorium_web_reader_paginatedArrow_default.visuallyHidden;
142
- }
143
- return className2;
144
- };
145
- const handleClassNameFromSpaceProp = () => {
146
- let className2 = "";
147
- if (occupySpace) {
148
- className2 = thorium_web_reader_paginatedArrow_default.occupiesSpace;
149
- }
150
- return className2;
151
- };
152
- useEffect(() => {
153
- if ((isDisabled || !hasArrows && !isHovering) && isActiveElement(buttonRef.current)) {
154
- buttonRef.current.blur();
155
- }
156
- });
157
- const blurOnEsc = (event) => {
158
- if (isActiveElement(buttonRef.current) && event.code === "Escape") {
159
- buttonRef.current.blur();
160
- }
161
- };
162
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
163
- ThNavigationButton,
164
- {
165
- direction,
166
- ref: buttonRef,
167
- "aria-label": label,
168
- onPress,
169
- onHoverChange: (isHovering2) => setIsHovering(isHovering2),
170
- onKeyDown: blurOnEsc,
171
- className: classNames2(className, handleClassNameFromSpaceProp(), handleClassNameFromState()),
172
- isDisabled,
173
- preventFocusOnPress: true,
174
- ...props,
175
- compounds: {
176
- tooltipTrigger: {
177
- delay: preferences.theming.arrow.tooltipDelay,
178
- closeDelay: preferences.theming.arrow.tooltipDelay
179
- },
180
- tooltip: {
181
- placement: direction === "left" ? "right" : "left",
182
- className: thorium_web_button_default.tooltip
183
- },
184
- label
185
- }
186
- }
187
- ) });
188
- };
189
-
190
- // src/helpers/deserializePositions.ts
191
- var deserializePositions = (positionsList) => {
192
- return positionsList?.map((locator) => ({
193
- href: locator.href,
194
- type: locator.type,
195
- locations: {
196
- position: locator.locations.position,
197
- progression: locator.locations.progression,
198
- totalProgression: locator.locations.totalProgression
199
- }
200
- }));
201
- };
202
- var StatefulReader = ({
203
- rawManifest,
204
- selfHref,
205
- plugins
206
- }) => {
207
- const [pluginsRegistered, setPluginsRegistered] = useState(false);
208
- useEffect(() => {
209
- if (plugins && plugins.length > 0) {
210
- plugins.forEach((plugin) => {
211
- ThPluginRegistry.register(plugin);
212
- });
213
- } else {
214
- ThPluginRegistry.register(createDefaultPlugin());
215
- }
216
- setPluginsRegistered(true);
217
- }, [plugins]);
218
- if (!pluginsRegistered) {
219
- return null;
220
- }
221
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ThPluginProvider, { children: /* @__PURE__ */ jsx(StatefulReaderInner, { rawManifest, selfHref }) }) });
222
- };
223
- var StatefulReaderInner = ({ rawManifest, selfHref }) => {
224
- const { fxlActionKeys, fxlThemeKeys, reflowActionKeys, reflowThemeKeys } = usePreferenceKeys();
225
- const { preferences, resolveFontLanguage, getFontMetadata, getFontInjectables } = usePreferences();
226
- const { t } = useI18n();
227
- const { getEffectiveSpacingValue } = useSpacingPresets();
228
- const { occupySpace: arrowsOccupySpace } = usePaginatedArrows();
229
- const { injectFontResources, removeFontResources, getAndroidFXLPatch } = useFonts();
230
- const [publication, setPublication] = useState(null);
231
- const container = useRef(null);
232
- const localDataKey = useRef(`${selfHref}-current-location`);
233
- const arrowsWidth = useRef(2 * ((preferences.theming.arrow.size || 40) + (preferences.theming.arrow.offset || 0)));
234
- const isFXL = useAppSelector((state) => state.publication.isFXL);
235
- const positionsList = useAppSelector((state) => state.publication.positionsList);
236
- const { isComponentUsed: isFontFamilyUsed } = useSettingsComponentStatus({
237
- settingsKey: "fontFamily" /* fontFamily */,
238
- publicationType: isFXL ? "fxl" : "reflow",
239
- componentType: "text"
240
- });
241
- const textAlign = useAppSelector((state) => state.settings.textAlign);
242
- const columnCount = useAppSelector((state) => state.settings.columnCount);
243
- const fontFamily = useAppSelector((state) => state.settings.fontFamily);
244
- const fontSize = useAppSelector((state) => state.settings.fontSize);
245
- const fontWeight = useAppSelector((state) => state.settings.fontWeight);
246
- const hyphens = useAppSelector((state) => state.settings.hyphens);
247
- const letterSpacing = getEffectiveSpacingValue("letterSpacing" /* letterSpacing */);
248
- const lineLength = useAppSelector((state) => state.settings.lineLength);
249
- const lineHeight = getEffectiveSpacingValue("lineHeight" /* lineHeight */);
250
- const paragraphIndent = getEffectiveSpacingValue("paragraphIndent" /* paragraphIndent */);
251
- const paragraphSpacing = getEffectiveSpacingValue("paragraphSpacing" /* paragraphSpacing */);
252
- const publisherStyles = useAppSelector((state) => state.settings.publisherStyles);
253
- const scroll = useAppSelector((state) => state.settings.scroll);
254
- const isScroll = scroll && !isFXL;
255
- const textNormalization = useAppSelector((state) => state.settings.textNormalization);
256
- const wordSpacing = getEffectiveSpacingValue("wordSpacing" /* wordSpacing */);
257
- const themeObject = useAppSelector((state) => state.theming.theme);
258
- const theme = isFXL ? themeObject.fxl : themeObject.reflow;
259
- const previousTheme = usePrevious(theme);
260
- const colorScheme = useAppSelector((state) => state.theming.colorScheme);
261
- const reducedMotion = useAppSelector((state) => state.theming.prefersReducedMotion);
262
- const breakpoint = useAppSelector((state) => state.theming.breakpoint);
263
- const isImmersive = useAppSelector((state) => state.reader.isImmersive);
264
- const isHovering = useAppSelector((state) => state.reader.isHovering);
265
- const layoutUI = isFXL ? preferences.theming.layout.ui?.fxl || "layered-ui" /* layered */ : isScroll ? preferences.theming.layout.ui?.reflow || "layered-ui" /* layered */ : "stacked-ui" /* stacked */;
266
- useTheming({
267
- theme,
268
- themeKeys: preferences.theming.themes.keys,
269
- systemKeys: preferences.theming.themes.systemThemes,
270
- breakpointsMap: preferences.theming.breakpoints,
271
- initProps: {
272
- ...propsToCSSVars(preferences.theming.arrow, { prefix: prefixString("arrow") }),
273
- ...propsToCSSVars(preferences.theming.icon, { prefix: prefixString("icon") }),
274
- ...propsToCSSVars(preferences.theming.layout, {
275
- prefix: prefixString("layout"),
276
- exclude: ["ui"]
277
- })
278
- },
279
- onBreakpointChange: (breakpoint2) => dispatch(setBreakpoint(breakpoint2)),
280
- onColorSchemeChange: (colorScheme2) => dispatch(setColorScheme(colorScheme2)),
281
- onContrastChange: (contrast) => dispatch(setContrast(contrast)),
282
- onForcedColorsChange: (forcedColors) => dispatch(setForcedColors(forcedColors)),
283
- onMonochromeChange: (isMonochrome) => dispatch(setMonochrome(isMonochrome)),
284
- onReducedMotionChange: (reducedMotion2) => dispatch(setReducedMotion(reducedMotion2)),
285
- onReducedTransparencyChange: (reducedTransparency) => dispatch(setReducedTransparency(reducedTransparency))
286
- });
287
- const atPublicationStart = useAppSelector((state) => state.publication.atPublicationStart);
288
- const atPublicationEnd = useAppSelector((state) => state.publication.atPublicationEnd);
289
- const dispatch = useAppDispatch();
290
- const onFsChange = useCallback((isFullscreen) => {
291
- dispatch(setFullscreen(isFullscreen));
292
- }, [dispatch]);
293
- const fs = useFullscreen(onFsChange);
294
- const epubNavigator = useEpubNavigator();
295
- const {
296
- EpubNavigatorLoad,
297
- EpubNavigatorDestroy,
298
- goLeft,
299
- goRight,
300
- goBackward,
301
- goForward,
302
- navLayout,
303
- currentLocator,
304
- currentPositions,
305
- canGoBackward,
306
- canGoForward,
307
- isScrollStart,
308
- isScrollEnd,
309
- getCframes,
310
- onFXLPositionChange,
311
- submitPreferences
312
- } = epubNavigator;
313
- const { setLocalData, getLocalData, localData } = useLocalStorage(localDataKey.current);
314
- const timeline = useTimeline({
315
- publication,
316
- currentLocation: localData,
317
- currentPositions: currentPositions() || [],
318
- positionsList,
319
- onChange: (timeline2) => {
320
- dispatch(setTimeline(timeline2));
321
- }
322
- });
323
- const lineHeightOptions = useLineHeight();
324
- const documentTitleFormat = preferences.metadata?.documentTitle?.format;
325
- let documentTitle;
326
- if (documentTitleFormat) {
327
- if (typeof documentTitleFormat === "object" && "key" in documentTitleFormat) {
328
- const translatedTitle = t(documentTitleFormat.key);
329
- documentTitle = translatedTitle !== documentTitleFormat.key ? translatedTitle : documentTitleFormat.fallback;
330
- } else {
331
- switch (documentTitleFormat) {
332
- case "title" /* title */:
333
- documentTitle = timeline?.title;
334
- break;
335
- case "chapter" /* chapter */:
336
- documentTitle = timeline?.progression?.currentChapter;
337
- break;
338
- case "titleAndChapter" /* titleAndChapter */:
339
- if (timeline?.title && timeline?.progression?.currentChapter) {
340
- documentTitle = `${timeline.title} \u2013 ${timeline.progression.currentChapter}`;
341
- }
342
- break;
343
- case "none" /* none */:
344
- documentTitle = void 0;
345
- break;
346
- default:
347
- documentTitle = documentTitleFormat;
348
- break;
349
- }
350
- }
351
- }
352
- useDocumentTitle(documentTitle);
353
- const cache = useRef({
354
- layoutUI,
355
- isImmersive,
356
- isHovering,
357
- arrowsOccupySpace: arrowsOccupySpace || false,
358
- settings: {
359
- columnCount,
360
- fontFamily,
361
- fontSize,
362
- fontWeight,
363
- hyphens,
364
- letterSpacing,
365
- lineHeight,
366
- lineLength,
367
- paragraphIndent,
368
- paragraphSpacing,
369
- publisherStyles,
370
- scroll: isScroll,
371
- textAlign,
372
- textNormalization,
373
- theme,
374
- wordSpacing
375
- },
376
- positionsList: positionsList || [],
377
- colorScheme,
378
- reducedMotion
379
- });
380
- const activateImmersiveOnAction = useCallback(() => {
381
- if (!cache.current.isImmersive) dispatch(setImmersive(true));
382
- }, [dispatch]);
383
- const toggleIsImmersive = useCallback(() => {
384
- dispatch(setHovering(false));
385
- dispatch(toggleImmersive());
386
- }, [dispatch]);
387
- const handleTap = (event) => {
388
- const _cframes = getCframes();
389
- if (_cframes) {
390
- if (!cache.current.settings.scroll) {
391
- const oneQuarter = (_cframes.length === 2 ? _cframes[0].window.innerWidth + _cframes[1].window.innerWidth : _cframes[0].window.innerWidth) * window.devicePixelRatio / 4;
392
- const navigationCallback = () => {
393
- dispatch(setUserNavigated(true));
394
- activateImmersiveOnAction();
395
- };
396
- if (event.x < oneQuarter) {
397
- goLeft(!cache.current.reducedMotion, navigationCallback);
398
- } else if (event.x > oneQuarter * 3) {
399
- goRight(!cache.current.reducedMotion, navigationCallback);
400
- } else if (oneQuarter <= event.x && event.x <= oneQuarter * 3) {
401
- toggleIsImmersive();
402
- }
403
- } else {
404
- if (preferences.affordances.scroll.toggleOnMiddlePointer.includes("tap")) {
405
- toggleIsImmersive();
406
- }
407
- }
408
- }
409
- };
410
- const handleClick = (event) => {
411
- if (cache.current.layoutUI === "layered-ui" /* layered */ && (!cache.current.settings.scroll || preferences.affordances.scroll.toggleOnMiddlePointer.includes("click"))) {
412
- toggleIsImmersive();
413
- }
414
- };
415
- const handleFXLProgression = useCallback((locator) => {
416
- setLocalData(locator);
417
- }, [setLocalData]);
418
- onFXLPositionChange(handleFXLProgression);
419
- const initReadingEnv = async () => {
420
- if (navLayout() === Layout.fixed) {
421
- const cLoc = currentLocator();
422
- if (cLoc) {
423
- handleFXLProgression(cLoc);
424
- }
425
- }
426
- };
427
- const p = new Peripherals(useAppStore(), preferences.actions, {
428
- moveTo: (direction) => {
429
- const navigationCallback = () => {
430
- dispatch(setUserNavigated(true));
431
- activateImmersiveOnAction();
432
- };
433
- switch (direction) {
434
- case "right":
435
- if (!cache.current.settings.scroll) {
436
- goRight(!cache.current.reducedMotion, navigationCallback);
437
- }
438
- break;
439
- case "left":
440
- if (!cache.current.settings.scroll) {
441
- goLeft(!cache.current.reducedMotion, navigationCallback);
442
- }
443
- break;
444
- }
445
- },
446
- goProgression: (shiftKey) => {
447
- if (!cache.current.settings?.scroll) {
448
- const callback = () => {
449
- dispatch(setUserNavigated(true));
450
- activateImmersiveOnAction();
451
- };
452
- shiftKey ? goBackward(!cache.current.reducedMotion, callback) : goForward(!cache.current.reducedMotion, callback);
453
- }
454
- },
455
- toggleAction: (actionKey) => {
456
- switch (actionKey) {
457
- case "fullscreen" /* fullscreen */:
458
- fs.handleFullscreen();
459
- break;
460
- case "settings" /* settings */:
461
- case "toc" /* toc */:
462
- dispatch(toggleActionOpen({
463
- key: actionKey
464
- }));
465
- break;
466
- }
467
- }
468
- });
469
- const listeners = {
470
- frameLoaded: async function(_wnd) {
471
- await initReadingEnv();
472
- const _cframes = getCframes();
473
- _cframes?.forEach(
474
- (frameManager) => {
475
- if (frameManager) p.observe(frameManager.window);
476
- }
477
- );
478
- p.observe(window);
479
- },
480
- positionChanged: async function(locator) {
481
- if (navLayout() !== Layout.fixed) {
482
- const debouncedHandleProgression = debounce(
483
- async () => {
484
- setLocalData(locator);
485
- },
486
- 250
487
- );
488
- debouncedHandleProgression();
489
- }
490
- if (canGoBackward()) {
491
- dispatch(setPublicationStart(false));
492
- } else {
493
- dispatch(setPublicationStart(true));
494
- }
495
- if (canGoForward()) {
496
- dispatch(setPublicationEnd(false));
497
- } else {
498
- dispatch(setPublicationEnd(true));
499
- }
500
- },
501
- tap: function(_e) {
502
- handleTap(_e);
503
- return true;
504
- },
505
- click: function(_e) {
506
- handleClick();
507
- return true;
508
- },
509
- zoom: function(_scale) {
510
- },
511
- miscPointer: function(_amount) {
512
- },
513
- scroll: function(_delta) {
514
- if (cache.current.settings.scroll && navLayout() !== Layout.fixed) {
515
- if (isScrollStart() || isScrollEnd()) {
516
- if (
517
- // Keep consistent with pagination behavior
518
- cache.current.layoutUI === "layered-ui" /* layered */
519
- ) {
520
- dispatch(setScrollAffordance(true));
521
- }
522
- } else if (!cache.current.isImmersive && _delta > 20) {
523
- if (preferences.affordances.scroll.hideOnForwardScroll) {
524
- dispatch(setImmersive(true));
525
- }
526
- } else if (cache.current.isImmersive && _delta < -20) {
527
- if (
528
- // Keep consistent with pagination behavior
529
- cache.current.layoutUI === "layered-ui" /* layered */ && preferences.affordances.scroll.showOnBackwardScroll
530
- ) {
531
- dispatch(setImmersive(false));
532
- }
533
- }
534
- }
535
- },
536
- customEvent: function(_key, _data) {
537
- },
538
- handleLocator: function(locator) {
539
- const href = locator.href;
540
- if (href.startsWith("http://") || href.startsWith("https://") || href.startsWith("mailto:") || href.startsWith("tel:")) {
541
- if (confirm(`Open "${href}" ?`)) window.open(href, "_blank");
542
- } else {
543
- console.warn("Unhandled locator", locator);
544
- }
545
- return false;
546
- },
547
- textSelected: function(_selection) {
548
- },
549
- contentProtection: function(_type, _data) {
550
- },
551
- contextMenu: function(_data) {
552
- },
553
- peripheral: function(_data) {
554
- }
555
- };
556
- const applyConstraint = useCallback(async (value) => {
557
- await submitPreferences({
558
- constraint: value
559
- });
560
- }, [submitPreferences]);
561
- useEffect(() => {
562
- cache.current.isImmersive = isImmersive;
563
- }, [isImmersive]);
564
- useEffect(() => {
565
- cache.current.isHovering = isHovering;
566
- }, [isHovering]);
567
- useEffect(() => {
568
- cache.current.layoutUI = layoutUI;
569
- }, [layoutUI]);
570
- useEffect(() => {
571
- cache.current.settings.scroll = isScroll;
572
- dispatch(setImmersive(false));
573
- }, [isScroll, dispatch]);
574
- useEffect(() => {
575
- cache.current.settings.columnCount = columnCount;
576
- }, [columnCount]);
577
- useEffect(() => {
578
- cache.current.settings.fontFamily = fontFamily;
579
- }, [fontFamily]);
580
- useEffect(() => {
581
- cache.current.settings.fontSize = fontSize;
582
- }, [fontSize]);
583
- useEffect(() => {
584
- cache.current.settings.fontWeight = fontWeight;
585
- }, [fontWeight]);
586
- useEffect(() => {
587
- cache.current.settings.hyphens = hyphens;
588
- }, [hyphens]);
589
- useEffect(() => {
590
- cache.current.settings.letterSpacing = letterSpacing;
591
- }, [letterSpacing]);
592
- useEffect(() => {
593
- cache.current.settings.lineHeight = lineHeight;
594
- }, [lineHeight]);
595
- useEffect(() => {
596
- cache.current.settings.lineLength = lineLength;
597
- }, [lineLength]);
598
- useEffect(() => {
599
- cache.current.settings.paragraphIndent = paragraphIndent;
600
- }, [paragraphIndent]);
601
- useEffect(() => {
602
- cache.current.settings.paragraphSpacing = paragraphSpacing;
603
- }, [paragraphSpacing]);
604
- useEffect(() => {
605
- cache.current.settings.textAlign = textAlign;
606
- }, [textAlign]);
607
- useEffect(() => {
608
- cache.current.settings.textNormalization = textNormalization;
609
- }, [textNormalization]);
610
- useEffect(() => {
611
- cache.current.settings.theme = theme;
612
- }, [theme]);
613
- useEffect(() => {
614
- cache.current.settings.wordSpacing = wordSpacing;
615
- }, [wordSpacing]);
616
- useEffect(() => {
617
- cache.current.positionsList = positionsList || [];
618
- }, [positionsList]);
619
- useEffect(() => {
620
- cache.current.arrowsOccupySpace = arrowsOccupySpace || false;
621
- const handleConstraint = async () => {
622
- await applyConstraint(arrowsOccupySpace ? arrowsWidth.current : 0);
623
- };
624
- handleConstraint().catch(console.error);
625
- }, [arrowsOccupySpace, applyConstraint]);
626
- useEffect(() => {
627
- cache.current.reducedMotion = reducedMotion;
628
- }, [reducedMotion]);
629
- useEffect(() => {
630
- if (cache.current.colorScheme !== colorScheme) {
631
- cache.current.colorScheme = colorScheme;
632
- }
633
- const theme2 = isFXL ? themeObject.fxl : themeObject.reflow;
634
- if (theme2 !== "auto" && previousTheme !== theme2) return;
635
- const applyCurrentTheme = async () => {
636
- const themeKeys = isFXL ? fxlThemeKeys : reflowThemeKeys;
637
- const themeKey = themeKeys.includes(theme2) ? theme2 : "auto";
638
- const themeProps = buildThemeObject({
639
- theme: themeKey,
640
- themeKeys: preferences.theming.themes.keys,
641
- systemThemes: preferences.theming.themes.systemThemes,
642
- colorScheme
643
- });
644
- await submitPreferences(themeProps);
645
- dispatch(setTheme({
646
- key: isFXL ? "fxl" : "reflow",
647
- value: themeKey
648
- }));
649
- };
650
- applyCurrentTheme().catch(console.error);
651
- }, [themeObject, previousTheme, preferences.theming.themes, fxlThemeKeys, reflowThemeKeys, colorScheme, isFXL, submitPreferences, dispatch]);
652
- useEffect(() => {
653
- preferences.direction && dispatch(setDirection(preferences.direction));
654
- dispatch(setPlatformModifier(getPlatformModifier()));
655
- }, [preferences.direction, dispatch]);
656
- useEffect(() => {
657
- const fetcher = new HttpFetcher(void 0, selfHref);
658
- const manifest = Manifest.deserialize(rawManifest);
659
- manifest.setSelfLink(selfHref);
660
- setPublication(new Publication({
661
- manifest,
662
- fetcher
663
- }));
664
- dispatch(setReaderProfile("epub"));
665
- }, [rawManifest, selfHref, dispatch]);
666
- useEffect(() => {
667
- if (!publication) return;
668
- dispatch(setRTL(publication.metadata.effectiveReadingProgression === ReadingProgression.rtl));
669
- const isFXLPublication = publication.metadata.effectiveLayout === Layout.fixed;
670
- dispatch(setFXL(isFXLPublication));
671
- const resolvedFontLanguage = resolveFontLanguage(publication.metadata.languages?.[0], publication.metadata.effectiveReadingProgression);
672
- dispatch(setFontLanguage(resolvedFontLanguage));
673
- const displayTransformability = publication.metadata.accessibility?.feature?.some((feature) => feature && feature.value === Feature.DISPLAY_TRANSFORMABILITY.value);
674
- dispatch(setHasDisplayTransformability(displayTransformability));
675
- let positionsList2;
676
- const fetchPositions = async () => {
677
- positionsList2 = await publication.positionsFromManifest();
678
- const deserializedPositionsList = deserializePositions(positionsList2);
679
- dispatch(setPositionsList(deserializedPositionsList));
680
- };
681
- fetchPositions().catch(console.error).then(() => {
682
- const initialPosition = getLocalData();
683
- const initialConstraint = cache.current.arrowsOccupySpace ? arrowsWidth.current : 0;
684
- const themeKeys = isFXLPublication ? fxlThemeKeys : reflowThemeKeys;
685
- const theme2 = themeKeys.includes(cache.current.settings.theme) ? cache.current.settings.theme : "auto";
686
- const themeProps = buildThemeObject({
687
- theme: theme2,
688
- themeKeys: preferences.theming.themes.keys,
689
- systemThemes: preferences.theming.themes.systemThemes,
690
- colorScheme: cache.current.colorScheme
691
- });
692
- const epubPreferences = isFXLPublication ? {} : {
693
- columnCount: cache.current.settings.columnCount === "auto" ? null : Number(cache.current.settings.columnCount),
694
- constraint: initialConstraint,
695
- fontFamily: getFontMetadata(cache.current.settings.fontFamily[resolvedFontLanguage] ?? "")?.fontStack || null,
696
- fontSize: cache.current.settings.fontSize,
697
- fontWeight: cache.current.settings.fontWeight,
698
- hyphens: cache.current.settings.hyphens,
699
- letterSpacing: cache.current.settings.publisherStyles ? void 0 : cache.current.settings.letterSpacing,
700
- lineHeight: cache.current.settings.publisherStyles ? void 0 : cache.current.settings.lineHeight === null ? null : lineHeightOptions[cache.current.settings.lineHeight],
701
- optimalLineLength: cache.current.settings.lineLength?.optimal != null ? cache.current.settings.lineLength.optimal : void 0,
702
- maximalLineLength: cache.current.settings.lineLength?.max?.isDisabled ? null : cache.current.settings.lineLength?.max?.chars != null ? cache.current.settings.lineLength.max.chars : void 0,
703
- minimalLineLength: cache.current.settings.lineLength?.min?.isDisabled ? null : cache.current.settings.lineLength?.min?.chars != null ? cache.current.settings.lineLength.min.chars : void 0,
704
- paragraphIndent: cache.current.settings.publisherStyles ? void 0 : cache.current.settings.paragraphIndent,
705
- paragraphSpacing: cache.current.settings.publisherStyles ? void 0 : cache.current.settings.paragraphSpacing,
706
- scroll: cache.current.settings.scroll,
707
- textAlign: cache.current.settings.textAlign,
708
- textNormalization: cache.current.settings.textNormalization,
709
- wordSpacing: cache.current.settings.publisherStyles ? void 0 : cache.current.settings.wordSpacing,
710
- ...themeProps
711
- };
712
- const defaults = isFXLPublication ? {} : {
713
- maximalLineLength: preferences.typography.maximalLineLength,
714
- minimalLineLength: preferences.typography.minimalLineLength,
715
- optimalLineLength: preferences.typography.optimalLineLength,
716
- pageGutter: preferences.typography.pageGutter,
717
- scrollPaddingTop: preferences.theming.layout.ui?.reflow === "layered-ui" /* layered */ ? (preferences.theming.icon.size || 24) * 3 : preferences.theming.icon.size || 24,
718
- scrollPaddingBottom: preferences.theming.layout.ui?.reflow === "layered-ui" /* layered */ ? (preferences.theming.icon.size || 24) * 5 : preferences.theming.icon.size || 24,
719
- scrollPaddingLeft: preferences.typography.pageGutter,
720
- scrollPaddingRight: preferences.typography.pageGutter,
721
- experiments: preferences.experiments?.reflow || null
722
- };
723
- let injectables;
724
- if (isFXLPublication) {
725
- const androidPatch = getAndroidFXLPatch();
726
- if (androidPatch) {
727
- injectables = {
728
- allowedDomains: [window.location.origin],
729
- rules: [{
730
- resources: [/\.xhtml$/, /\.html$/],
731
- prepend: [androidPatch]
732
- }]
733
- };
734
- }
735
- }
736
- if (!isFXLPublication && isFontFamilyUsed) {
737
- const fontResources = getFontInjectables({ language: resolvedFontLanguage });
738
- if (fontResources) {
739
- injectFontResources(getFontInjectables(void 0, true));
740
- injectables = {
741
- allowedDomains: fontResources.allowedDomains,
742
- rules: [{
743
- resources: [/\.xhtml$/, /\.html$/],
744
- prepend: fontResources.prepend,
745
- append: fontResources.append
746
- }]
747
- };
748
- }
749
- }
750
- EpubNavigatorLoad({
751
- container: container.current,
752
- publication,
753
- listeners,
754
- positionsList: positionsList2,
755
- initialPosition: initialPosition ? new Locator(initialPosition) : void 0,
756
- preferences: epubPreferences,
757
- defaults,
758
- injectables,
759
- contentProtection: resolveContentProtectionConfig(preferences.contentProtection, t)
760
- }, () => p.observe(window));
761
- }).finally(() => {
762
- const setLoadingThunk = (dispatch2) => {
763
- dispatch2(setLoading(false));
764
- };
765
- dispatch(setLoadingThunk);
766
- });
767
- return () => {
768
- EpubNavigatorDestroy(() => p.destroy());
769
- if (!isFXL) removeFontResources();
770
- };
771
- }, [publication, preferences, fxlThemeKeys, reflowThemeKeys, isFontFamilyUsed, injectFontResources, removeFontResources]);
772
- if (!breakpoint) return null;
773
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(I18nProvider, { locale: preferences.locale, children: /* @__PURE__ */ jsx(NavigatorProvider, { navigator: epubNavigator, children: /* @__PURE__ */ jsx("main", { className: thorium_web_reader_app_default.main, children: /* @__PURE__ */ jsx(StatefulDockingWrapper, { children: /* @__PURE__ */ jsxs(
774
- "div",
775
- {
776
- className: getReaderClassNames({
777
- isScroll,
778
- isImmersive,
779
- isHovering,
780
- isFXL,
781
- layoutUI,
782
- breakpoint
783
- }),
784
- children: [
785
- /* @__PURE__ */ jsx(
786
- StatefulReaderHeader,
787
- {
788
- actionKeys: isFXL ? fxlActionKeys : reflowActionKeys,
789
- actionsOrder: isFXL ? preferences.actions.fxlOrder : preferences.actions.reflowOrder,
790
- layout: layoutUI,
791
- runningHeadFormatPref: isFXL ? preferences.theming.header?.runningHead?.format?.fxl : preferences.theming.header?.runningHead?.format?.reflow
792
- }
793
- ),
794
- !isScroll ? /* @__PURE__ */ jsx("nav", { className: classNames2(thorium_web_reader_paginatedArrow_default.container, thorium_web_reader_paginatedArrow_default.leftContainer), children: /* @__PURE__ */ jsx(
795
- StatefulReaderArrowButton,
796
- {
797
- direction: "left",
798
- isDisabled: atPublicationStart,
799
- onPress: () => {
800
- const navigationCallback = () => {
801
- dispatch(setUserNavigated(true));
802
- activateImmersiveOnAction();
803
- };
804
- goLeft(!reducedMotion, navigationCallback);
805
- }
806
- }
807
- ) }) : /* @__PURE__ */ jsx(Fragment, {}),
808
- /* @__PURE__ */ jsx("article", { className: thorium_web_reader_app_default.wrapper, "aria-label": t("reader.app.publicationWrapper"), children: /* @__PURE__ */ jsx("div", { id: "thorium-web-container", className: thorium_web_reader_app_default.iframeContainer, ref: container }) }),
809
- !isScroll ? /* @__PURE__ */ jsx("nav", { className: classNames2(thorium_web_reader_paginatedArrow_default.container, thorium_web_reader_paginatedArrow_default.rightContainer), children: /* @__PURE__ */ jsx(
810
- StatefulReaderArrowButton,
811
- {
812
- direction: "right",
813
- isDisabled: atPublicationEnd,
814
- onPress: () => {
815
- const navigationCallback = () => {
816
- dispatch(setUserNavigated(true));
817
- activateImmersiveOnAction();
818
- };
819
- goRight(!reducedMotion, navigationCallback);
820
- }
821
- }
822
- ) }) : /* @__PURE__ */ jsx(Fragment, {}),
823
- /* @__PURE__ */ jsx(
824
- StatefulReaderFooter,
825
- {
826
- layout: layoutUI,
827
- progressionFormatPref: isFXL ? preferences.theming.progression?.format?.fxl : preferences.theming.progression?.format?.reflow,
828
- progressionFormatFallback: isFXL ? "readingOrderIndex" /* readingOrderIndex */ : "resourceProgression" /* resourceProgression */
829
- }
830
- )
831
- ]
832
- }
833
- ) }) }) }) }) });
834
- };
835
-
836
- export { StatefulReader };
837
18
  //# sourceMappingURL=index.mjs.map
838
19
  //# sourceMappingURL=index.mjs.map