@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.
- package/dist/{ThPreferencesAdapter-B8AYujCA.d.mts → ThPreferencesAdapter-DrZ5_6Dv.d.mts} +4 -139
- package/dist/{ThSettingsWrapper-BlmAxcWF.d.mts → ThSettingsWrapper-8Kx0SnH4.d.mts} +1 -1
- package/dist/{actions-BRtHsxpm.d.mts → actions-D2CHvCHu.d.mts} +2 -2
- package/dist/{actionsReducer-bT0pfxLJ.d.mts → actionsReducer-kc-S130w.d.mts} +3 -24
- package/dist/chunk-34MVY33F.mjs +913 -0
- package/dist/chunk-34MVY33F.mjs.map +1 -0
- package/dist/{chunk-KJXHAJYK.mjs → chunk-4VHEHMJN.mjs} +128 -11
- package/dist/chunk-4VHEHMJN.mjs.map +1 -0
- package/dist/{chunk-QNYZCQKO.mjs → chunk-72XCX5TD.mjs} +4 -4
- package/dist/chunk-72XCX5TD.mjs.map +1 -0
- package/dist/{chunk-SMK7A7VF.mjs → chunk-7NEQAW7J.mjs} +3 -3
- package/dist/chunk-7NEQAW7J.mjs.map +1 -0
- package/dist/{chunk-SFHOVH6R.mjs → chunk-H4J2VY7Z.mjs} +201 -35
- package/dist/chunk-H4J2VY7Z.mjs.map +1 -0
- package/dist/{chunk-COQXDRKD.mjs → chunk-K3K7TUWM.mjs} +2 -2
- package/dist/chunk-K3K7TUWM.mjs.map +1 -0
- package/dist/{chunk-KTPIH35Y.mjs → chunk-NYZBHYW2.mjs} +5 -3
- package/dist/chunk-NYZBHYW2.mjs.map +1 -0
- package/dist/chunk-RRDEPGBK.mjs +75 -0
- package/dist/chunk-RRDEPGBK.mjs.map +1 -0
- package/dist/chunk-S4M7ED5Q.mjs +407 -0
- package/dist/chunk-S4M7ED5Q.mjs.map +1 -0
- package/dist/components/Epub/index.d.mts +17 -11
- package/dist/components/Epub/index.mjs +12 -831
- package/dist/components/Epub/index.mjs.map +1 -1
- package/dist/components/Misc/index.css +23 -0
- package/dist/components/Misc/index.css.map +1 -1
- package/dist/components/Misc/index.d.mts +10 -1
- package/dist/components/Misc/index.mjs +30 -2
- package/dist/components/Misc/index.mjs.map +1 -1
- package/dist/components/Reader/index.css +1283 -0
- package/dist/components/Reader/index.css.map +1 -0
- package/dist/components/Reader/index.d.mts +30 -0
- package/dist/components/Reader/index.mjs +79 -0
- package/dist/components/Reader/index.mjs.map +1 -0
- package/dist/components/WebPub/index.d.mts +15 -31
- package/dist/components/WebPub/index.mjs +11 -374
- package/dist/components/WebPub/index.mjs.map +1 -1
- package/dist/core/Components/index.d.mts +11 -8
- package/dist/core/Components/index.mjs +1 -1
- package/dist/core/Helpers/index.d.mts +1 -1
- package/dist/core/Hooks/index.d.mts +54 -5
- package/dist/core/Hooks/index.mjs +1 -1
- package/dist/errorHandler-CL2YIfQY.d.mts +26 -0
- package/dist/i18n/index.mjs +4 -4
- package/dist/immer.d-CoRThNOF.d.mts +23 -0
- package/dist/lib/index.d.mts +12 -162
- package/dist/lib/index.mjs +2 -2
- package/dist/locales/el/thorium-web.json +31 -0
- package/dist/locales/en/thorium-web.json +14 -2
- package/dist/locales/et/thorium-web.json +6 -2
- package/dist/locales/fi/thorium-shared.json +14 -8
- package/dist/locales/fi/thorium-web.json +2 -1
- package/dist/locales/fr/thorium-shared.json +100 -0
- package/dist/locales/it/thorium-shared.json +9 -0
- package/dist/locales/lt/thorium-shared.json +22 -13
- package/dist/locales/lt/thorium-web.json +2 -1
- package/dist/locales/pt-PT/thorium-shared.json +64 -1
- package/dist/locales/pt-PT/thorium-web.json +4 -3
- package/dist/locales/sv/thorium-shared.json +61 -3
- package/dist/locales/sv/thorium-web.json +4 -3
- package/dist/preferences/index.d.mts +8 -7
- package/dist/preferences/index.mjs +3 -3
- package/dist/settingsReducer-C1wwCAMv.d.mts +159 -0
- package/dist/{ui-BVlJcPL_.d.mts → ui-CamWuqOo.d.mts} +1 -1
- package/dist/useContrast-D6sjPjxy.d.mts +152 -0
- package/dist/{useEpubNavigator-CsraD65e.d.mts → useEpubNavigator-CwHJfoiV.d.mts} +1 -1
- package/dist/{usePreferences-rfT368__.d.mts → usePreferences-BXFJbval.d.mts} +1 -1
- package/dist/{StatefulReader-CjgFzHoO.d.mts → useReaderTransitions-guT-eA-Q.d.mts} +50 -50
- package/package.json +5 -3
- package/dist/chunk-COQXDRKD.mjs.map +0 -1
- package/dist/chunk-KJXHAJYK.mjs.map +0 -1
- package/dist/chunk-KTPIH35Y.mjs.map +0 -1
- package/dist/chunk-QNYZCQKO.mjs.map +0 -1
- package/dist/chunk-SFHOVH6R.mjs.map +0 -1
- package/dist/chunk-SMK7A7VF.mjs.map +0 -1
- package/dist/useContrast-Cgsrl7GS.d.mts +0 -15
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { useFullscreen, useEpubNavigator } from './chunk-KJXHAJYK.mjs';
|
|
2
|
-
import { useAppDispatch, setFullscreen, useAppSelector, setActionOpen, dockAction, setSettingsContainer, debounce, setColumnCount, setWebPubFontFamily, setFontFamily, setWebPubFontWeight, setFontWeight, setWebPubHyphens, setHyphens, setScroll, setWebPubLetterSpacing, setLetterSpacing, setWebPubLineHeight, setLineHeight, setWebPubParagraphIndent, setParagraphIndent, setWebPubParagraphSpacing, setParagraphSpacing, setWebPubWordSpacing, setWordSpacing, setWebPubSpacingPreset, setWebPubPublisherStyles, setSpacingPreset, setPublisherStyles, setWebPubTextAlign, setTextAlign, setWebPubTextNormalization, setTextNormalization, setTheme, setWebPubZoom, setFontSize, ThReduxPreferencesAdapter, setHovering, setImmersive, setOverflow, setUserNavigated, setTocEntry, collapseDockPanel, expandDockPanel, activateDockPanel, deactivateDockPanel, setDockPanelWidth } from './chunk-COQXDRKD.mjs';
|
|
3
|
-
import { usePreferences, prefixString, ThDockingTypes, ThSheetTypes, defaultSpacingSettingsSubpanel, defaultSpacingSettingsMain, defaultTextSettingsSubpanel, defaultTextSettingsMain, usePreferenceKeys, ThTextSettingsKeys, ThSpacingSettingsKeys, buildThemeObject, defaultPreferences, ThPreferencesProvider } from './chunk-SMK7A7VF.mjs';
|
|
4
|
-
import { ThMenuItem, ThActionButton, ThMenu, ThCollapsibleActionsBar, ThPopover, ThContainerHeader, ThNavigationButton, ThContainerBody, ThBottomSheet, ThCloseButton, ThModal, ThDockedPanel, ThTypedComponentRenderer, useActions, ThForm, ThFormNumberField, ThSettingsWrapper, ThFormSearchField, ThRadioGroup, ThDropdown, ThSwitch, ThNumberField, ThSlider, ThInteractiveOverlay, ThHeader, ThFooter, ThLink, ThLibrary, ThHome, ThBackArrow, ThRunningHead, ThPagination, ThProgression } from './chunk-KTPIH35Y.mjs';
|
|
5
|
-
import { usePrevious } from './chunk-YZ73DHRU.mjs';
|
|
6
|
-
import { useI18n } from './chunk-IYAFKTPL.mjs';
|
|
7
1
|
import { makeBreakpointsMap, isInteractiveElement, isKeyboardTriggered, isActiveElement, getBestMatchingProgressionFormat } from './chunk-47AIIJFO.mjs';
|
|
2
|
+
import { useFullscreen, useEpubNavigator, useLocalStorage } from './chunk-4VHEHMJN.mjs';
|
|
3
|
+
import { useAppDispatch, setFullscreen, useAppSelector, setActionOpen, dockAction, setSettingsContainer, debounce, setColumnCount, setWebPubFontFamily, setFontFamily, setWebPubFontWeight, setFontWeight, setWebPubHyphens, setHyphens, setScroll, setWebPubLetterSpacing, setLetterSpacing, setWebPubLineHeight, setLineHeight, setWebPubParagraphIndent, setParagraphIndent, setWebPubParagraphSpacing, setParagraphSpacing, setWebPubWordSpacing, setWordSpacing, setWebPubSpacingPreset, setWebPubPublisherStyles, setSpacingPreset, setPublisherStyles, setWebPubTextAlign, setTextAlign, setWebPubTextNormalization, setTextNormalization, setTheme, setWebPubZoom, setFontSize, ThReduxPreferencesAdapter, setReaderProfile, setPositionsList, setRTL, setFXL, setFontLanguage, setHasDisplayTransformability, setHovering, setImmersive, setOverflow, setUserNavigated, setTocEntry, collapseDockPanel, expandDockPanel, activateDockPanel, deactivateDockPanel, setDockPanelWidth } from './chunk-K3K7TUWM.mjs';
|
|
4
|
+
import { usePreferences, prefixString, ThDockingTypes, ThSheetTypes, defaultSpacingSettingsSubpanel, defaultSpacingSettingsMain, defaultTextSettingsSubpanel, defaultTextSettingsMain, usePreferenceKeys, ThTextSettingsKeys, ThSpacingSettingsKeys, buildThemeObject, defaultPreferences, ThPreferencesProvider } from './chunk-7NEQAW7J.mjs';
|
|
8
5
|
import { ThRunningHeadFormat, ThProgressionFormat } from './chunk-XVSFXHYB.mjs';
|
|
9
6
|
import { isIOSish, getPlatform, buildShortcut, metaKeys } from './chunk-5LUMM7FW.mjs';
|
|
7
|
+
import { ErrorHandler } from './chunk-RRDEPGBK.mjs';
|
|
8
|
+
import { ThMenuItem, ThActionButton, ThMenu, ThCollapsibleActionsBar, ThPopover, ThContainerHeader, ThNavigationButton, ThContainerBody, ThBottomSheet, ThCloseButton, ThModal, ThDockedPanel, ThTypedComponentRenderer, useActions, ThForm, ThFormNumberField, ThSettingsWrapper, ThFormSearchField, ThRadioGroup, ThDropdown, ThSwitch, ThNumberField, ThSlider, ThInteractiveOverlay, ThHeader, ThFooter, ThLink, ThLibrary, ThHome, ThBackArrow, ThRunningHead, ThPagination, ThProgression } from './chunk-NYZBHYW2.mjs';
|
|
9
|
+
import { usePrevious } from './chunk-YZ73DHRU.mjs';
|
|
10
|
+
import { useI18n } from './chunk-IYAFKTPL.mjs';
|
|
10
11
|
import { Text, useFilter, Tree, TreeItem, TreeItemContent, Button, Collection, ListBox, ListBoxItem, Radio, Keyboard, Toolbar } from 'react-aria-components';
|
|
11
12
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
12
13
|
import React18, { createContext, useRef, useCallback, useEffect, useMemo, useState, useContext } from 'react';
|
|
13
14
|
import classNames3 from 'classnames';
|
|
14
|
-
import { Link, HttpFetcher } from '@readium/shared';
|
|
15
|
+
import { Link, HttpFetcher, Manifest, Publication, ReadingProgression, Layout, Feature, Profile } from '@readium/shared';
|
|
15
16
|
import { TextAlignment } from '@readium/navigator';
|
|
16
17
|
import { useStore } from 'react-redux';
|
|
17
18
|
import { PanelGroup, Panel, PanelResizeHandle } from 'react-resizable-panels';
|
|
@@ -1387,6 +1388,11 @@ var thorium_web_jumpToPosition_default = {
|
|
|
1387
1388
|
button: "thorium_web_jumpToPosition_button",
|
|
1388
1389
|
numberField: "thorium_web_jumpToPosition_numberField"
|
|
1389
1390
|
};
|
|
1391
|
+
|
|
1392
|
+
// src/components/Actions/JumpToPosition/helpers/utils.ts
|
|
1393
|
+
var isPositionsListValid = (positionsList) => {
|
|
1394
|
+
return !!(positionsList && positionsList.length > 0 && positionsList.some((item) => item.locations?.position));
|
|
1395
|
+
};
|
|
1390
1396
|
var StatefulJumpToPositionContainer = ({
|
|
1391
1397
|
triggerRef
|
|
1392
1398
|
}) => {
|
|
@@ -1400,6 +1406,7 @@ var StatefulJumpToPositionContainer = ({
|
|
|
1400
1406
|
const sheetType = docking.sheetType;
|
|
1401
1407
|
const { go } = useEpubNavigator();
|
|
1402
1408
|
const [position, setPosition] = useState(0);
|
|
1409
|
+
const [errorMessage, setErrorMessage] = useState();
|
|
1403
1410
|
const positionInRange = useCallback(() => {
|
|
1404
1411
|
if (!positionNumbers) return false;
|
|
1405
1412
|
return positionNumbers.length === 2 ? position >= positionNumbers[0] && position <= positionNumbers[1] : position === positionNumbers[0];
|
|
@@ -1418,19 +1425,24 @@ var StatefulJumpToPositionContainer = ({
|
|
|
1418
1425
|
const handleAction = useCallback((e) => {
|
|
1419
1426
|
e.preventDefault();
|
|
1420
1427
|
if (!positionsList) return;
|
|
1428
|
+
setErrorMessage(void 0);
|
|
1421
1429
|
const item = positionsList.find((item2) => item2.locations.position === position);
|
|
1422
|
-
if (!item
|
|
1430
|
+
if (!item) {
|
|
1431
|
+
setErrorMessage(t("reader.jumpToPosition.error.notFound"));
|
|
1432
|
+
return;
|
|
1433
|
+
}
|
|
1434
|
+
if (positionInRange()) return setOpen(false);
|
|
1423
1435
|
const cb = () => {
|
|
1424
1436
|
setOpen(false);
|
|
1425
1437
|
dispatch(setImmersive(true));
|
|
1426
1438
|
dispatch(setUserNavigated(true));
|
|
1427
1439
|
};
|
|
1428
1440
|
go(item, !reducedMotion, cb);
|
|
1429
|
-
}, [position, positionsList, reducedMotion, positionInRange, go, setOpen, dispatch]);
|
|
1441
|
+
}, [position, positionsList, reducedMotion, t, positionInRange, go, setOpen, dispatch]);
|
|
1430
1442
|
useEffect(() => {
|
|
1431
1443
|
positionNumbers && setPosition(positionNumbers[0]);
|
|
1432
1444
|
}, [positionNumbers]);
|
|
1433
|
-
if (!positionsList) return null;
|
|
1445
|
+
if (!isPositionsListValid(positionsList)) return null;
|
|
1434
1446
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1435
1447
|
StatefulSheetWrapper,
|
|
1436
1448
|
{
|
|
@@ -1472,6 +1484,7 @@ var StatefulJumpToPositionContainer = ({
|
|
|
1472
1484
|
step: 1,
|
|
1473
1485
|
formatOptions: { style: "decimal" },
|
|
1474
1486
|
isWheelDisabled: true,
|
|
1487
|
+
errorMessage,
|
|
1475
1488
|
compounds: {
|
|
1476
1489
|
label: {
|
|
1477
1490
|
className: thorium_web_jumpToPosition_default.label
|
|
@@ -1502,7 +1515,7 @@ var StatefulJumpToPositionTrigger = ({ variant }) => {
|
|
|
1502
1515
|
isOpen: value
|
|
1503
1516
|
}));
|
|
1504
1517
|
};
|
|
1505
|
-
if (!positionsList) return null;
|
|
1518
|
+
if (!isPositionsListValid(positionsList)) return null;
|
|
1506
1519
|
return /* @__PURE__ */ jsx(Fragment, { children: variant && variant === "menuItem" /* menu */ ? /* @__PURE__ */ jsx(
|
|
1507
1520
|
StatefulOverflowMenuItem,
|
|
1508
1521
|
{
|
|
@@ -3949,7 +3962,7 @@ var createDefaultPlugin = () => {
|
|
|
3949
3962
|
id: "core",
|
|
3950
3963
|
name: "Core Components",
|
|
3951
3964
|
description: "Default components for Thorium Web Epub StatefulReader",
|
|
3952
|
-
version: "1.
|
|
3965
|
+
version: "1.2.0",
|
|
3953
3966
|
components: {
|
|
3954
3967
|
actions: {
|
|
3955
3968
|
["fullscreen" /* fullscreen */]: {
|
|
@@ -4092,49 +4105,193 @@ var useReaderTransitions = () => {
|
|
|
4092
4105
|
toUserNavigation
|
|
4093
4106
|
};
|
|
4094
4107
|
};
|
|
4108
|
+
|
|
4109
|
+
// src/helpers/deserializePositions.ts
|
|
4110
|
+
var deserializePositions = (positionsList) => {
|
|
4111
|
+
return positionsList?.map((locator) => ({
|
|
4112
|
+
href: locator.href,
|
|
4113
|
+
type: locator.type,
|
|
4114
|
+
locations: {
|
|
4115
|
+
position: locator.locations.position,
|
|
4116
|
+
progression: locator.locations.progression,
|
|
4117
|
+
totalProgression: locator.locations.totalProgression
|
|
4118
|
+
}
|
|
4119
|
+
}));
|
|
4120
|
+
};
|
|
4121
|
+
|
|
4122
|
+
// src/hooks/usePublication.ts
|
|
4123
|
+
var detectProfile = (manifest) => {
|
|
4124
|
+
const metadata = manifest.metadata;
|
|
4125
|
+
if (!metadata) return "webPub";
|
|
4126
|
+
const conformsTo = metadata.conformsTo;
|
|
4127
|
+
if (!conformsTo) return "webPub";
|
|
4128
|
+
const profiles = Array.isArray(conformsTo) ? conformsTo : [conformsTo];
|
|
4129
|
+
if (profiles.some(
|
|
4130
|
+
(profile) => profile === Profile.AUDIOBOOK
|
|
4131
|
+
)) {
|
|
4132
|
+
return "audio";
|
|
4133
|
+
}
|
|
4134
|
+
if (profiles.some(
|
|
4135
|
+
(profile) => profile === Profile.EPUB
|
|
4136
|
+
)) {
|
|
4137
|
+
return "epub";
|
|
4138
|
+
}
|
|
4139
|
+
return "webPub";
|
|
4140
|
+
};
|
|
4095
4141
|
var usePublication = ({
|
|
4096
4142
|
url,
|
|
4097
4143
|
onError = () => {
|
|
4098
|
-
}
|
|
4144
|
+
},
|
|
4145
|
+
fetcher: customFetcher
|
|
4099
4146
|
}) => {
|
|
4100
|
-
const
|
|
4101
|
-
const
|
|
4102
|
-
const [
|
|
4147
|
+
const dispatch = useAppDispatch();
|
|
4148
|
+
const { resolveFontLanguage } = usePreferences();
|
|
4149
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
4150
|
+
const [error, setError] = useState(null);
|
|
4151
|
+
const [manifest, setManifest] = useState(null);
|
|
4152
|
+
const [selfLink, setSelfLink] = useState(null);
|
|
4153
|
+
const [localDataKey, setLocalDataKey] = useState(null);
|
|
4154
|
+
const [publication, setPublication] = useState(null);
|
|
4155
|
+
const [profile, setProfile] = useState(null);
|
|
4156
|
+
const [isRTL, setIsRTL] = useState(false);
|
|
4157
|
+
const [isFXL, setIsFXL] = useState(false);
|
|
4158
|
+
const [fontLanguage, setFontLanguageState] = useState("");
|
|
4159
|
+
const [hasDisplayTransformability, setHasDisplayTransformabilityState] = useState(false);
|
|
4160
|
+
const handleManifestError = (error2, context) => {
|
|
4161
|
+
console.error(`${context}:`, error2);
|
|
4162
|
+
const processedError = ErrorHandler.process(error2, context);
|
|
4163
|
+
setError(processedError);
|
|
4164
|
+
setIsLoading(false);
|
|
4165
|
+
};
|
|
4103
4166
|
useEffect(() => {
|
|
4104
4167
|
if (!url) {
|
|
4105
|
-
|
|
4168
|
+
const validationError = ErrorHandler.process(new Error("Manifest URL is required"), "Validation");
|
|
4169
|
+
setError(validationError);
|
|
4170
|
+
setIsLoading(false);
|
|
4106
4171
|
return;
|
|
4107
4172
|
}
|
|
4173
|
+
setIsLoading(true);
|
|
4174
|
+
setError(null);
|
|
4108
4175
|
const decodedUrl = decodeURIComponent(url);
|
|
4109
4176
|
const manifestLink = new Link({ href: decodedUrl });
|
|
4110
|
-
const fetcher = new HttpFetcher(void 0);
|
|
4177
|
+
const fetcher = customFetcher || new HttpFetcher(void 0);
|
|
4111
4178
|
try {
|
|
4112
4179
|
const fetched = fetcher.get(manifestLink);
|
|
4113
|
-
fetched.link().then((link) => {
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4180
|
+
fetched.link().then(async (link) => {
|
|
4181
|
+
try {
|
|
4182
|
+
const selfHref = link.toURL(decodedUrl);
|
|
4183
|
+
setSelfLink(selfHref || null);
|
|
4184
|
+
if (selfHref) {
|
|
4185
|
+
setLocalDataKey(`${selfHref}-current-location`);
|
|
4186
|
+
const manifestFetcher = customFetcher || new HttpFetcher(void 0, selfHref);
|
|
4187
|
+
const manifestFetched = manifestFetcher.get(manifestLink);
|
|
4188
|
+
const manifestData = await manifestFetched.readAsJSON();
|
|
4189
|
+
setManifest(manifestData);
|
|
4190
|
+
const manifestObj = Manifest.deserialize(manifestData);
|
|
4191
|
+
manifestObj.setSelfLink(selfHref);
|
|
4192
|
+
const detectedProfile = detectProfile(manifestObj);
|
|
4193
|
+
setProfile(detectedProfile);
|
|
4194
|
+
dispatch(setReaderProfile(detectedProfile));
|
|
4195
|
+
const pub = new Publication({
|
|
4196
|
+
manifest: manifestObj,
|
|
4197
|
+
fetcher: manifestFetcher
|
|
4198
|
+
});
|
|
4199
|
+
if (detectedProfile === "epub") {
|
|
4200
|
+
try {
|
|
4201
|
+
const rawPositions = await pub.positionsFromManifest();
|
|
4202
|
+
const positionsList = deserializePositions(rawPositions);
|
|
4203
|
+
dispatch(setPositionsList(positionsList));
|
|
4204
|
+
} catch (error2) {
|
|
4205
|
+
console.error("Failed to fetch positions:", error2);
|
|
4206
|
+
dispatch(setPositionsList([]));
|
|
4207
|
+
}
|
|
4208
|
+
}
|
|
4209
|
+
setPublication(pub);
|
|
4210
|
+
setIsLoading(false);
|
|
4211
|
+
}
|
|
4212
|
+
} catch (error2) {
|
|
4213
|
+
handleManifestError(error2, "Error loading manifest");
|
|
4214
|
+
}
|
|
4121
4215
|
});
|
|
4122
4216
|
} catch (error2) {
|
|
4123
|
-
|
|
4124
|
-
|
|
4217
|
+
handleManifestError(error2, "Error loading manifest");
|
|
4218
|
+
}
|
|
4219
|
+
}, [url, customFetcher, dispatch]);
|
|
4220
|
+
useEffect(() => {
|
|
4221
|
+
if (!publication) return;
|
|
4222
|
+
const rtl = publication.metadata.effectiveReadingProgression === ReadingProgression.rtl;
|
|
4223
|
+
setIsRTL(rtl);
|
|
4224
|
+
dispatch(setRTL(rtl));
|
|
4225
|
+
if (profile === "epub") {
|
|
4226
|
+
const fxl = publication.metadata.effectiveLayout === Layout.fixed;
|
|
4227
|
+
setIsFXL(fxl);
|
|
4228
|
+
dispatch(setFXL(fxl));
|
|
4229
|
+
}
|
|
4230
|
+
const resolvedLang = resolveFontLanguage(
|
|
4231
|
+
publication.metadata.languages?.[0],
|
|
4232
|
+
publication.metadata.effectiveReadingProgression
|
|
4233
|
+
);
|
|
4234
|
+
setFontLanguageState(resolvedLang);
|
|
4235
|
+
dispatch(setFontLanguage(resolvedLang));
|
|
4236
|
+
const displayTransformability = publication.metadata.accessibility?.feature?.some(
|
|
4237
|
+
(feature) => feature && feature.value === Feature.DISPLAY_TRANSFORMABILITY.value
|
|
4238
|
+
) || false;
|
|
4239
|
+
setHasDisplayTransformabilityState(displayTransformability);
|
|
4240
|
+
dispatch(setHasDisplayTransformability(displayTransformability));
|
|
4241
|
+
if (profile === "epub" && publication) {
|
|
4242
|
+
const fetchPositions = async () => {
|
|
4243
|
+
try {
|
|
4244
|
+
const positionsList = await publication.positionsFromManifest();
|
|
4245
|
+
const deserializedPositionsList = deserializePositions(positionsList);
|
|
4246
|
+
dispatch(setPositionsList(deserializedPositionsList));
|
|
4247
|
+
} catch (error2) {
|
|
4248
|
+
console.error("Failed to fetch positions:", error2);
|
|
4249
|
+
dispatch(setPositionsList([]));
|
|
4250
|
+
}
|
|
4251
|
+
};
|
|
4252
|
+
fetchPositions();
|
|
4125
4253
|
}
|
|
4126
|
-
}, [
|
|
4254
|
+
}, [publication, profile, resolveFontLanguage, dispatch]);
|
|
4127
4255
|
useEffect(() => {
|
|
4128
4256
|
if (error) {
|
|
4129
4257
|
onError(error);
|
|
4130
4258
|
}
|
|
4131
4259
|
}, [error, onError]);
|
|
4132
4260
|
return {
|
|
4261
|
+
isLoading,
|
|
4133
4262
|
error,
|
|
4263
|
+
publication,
|
|
4134
4264
|
manifest,
|
|
4135
|
-
selfLink
|
|
4265
|
+
selfLink,
|
|
4266
|
+
localDataKey,
|
|
4267
|
+
profile,
|
|
4268
|
+
isRTL,
|
|
4269
|
+
isFXL,
|
|
4270
|
+
fontLanguage,
|
|
4271
|
+
hasDisplayTransformability
|
|
4136
4272
|
};
|
|
4137
4273
|
};
|
|
4274
|
+
var usePositionStorage = (key, customStorage) => {
|
|
4275
|
+
const localStorageData = useLocalStorage(key);
|
|
4276
|
+
const [customData, setCustomData] = useState(
|
|
4277
|
+
() => customStorage ? customStorage.get() || null : null
|
|
4278
|
+
);
|
|
4279
|
+
if (customStorage) {
|
|
4280
|
+
const set = (newValue) => {
|
|
4281
|
+
if (newValue) {
|
|
4282
|
+
customStorage.set(newValue);
|
|
4283
|
+
}
|
|
4284
|
+
setCustomData(newValue);
|
|
4285
|
+
};
|
|
4286
|
+
const get = () => customData;
|
|
4287
|
+
return {
|
|
4288
|
+
setLocalData: set,
|
|
4289
|
+
getLocalData: get,
|
|
4290
|
+
localData: customData
|
|
4291
|
+
};
|
|
4292
|
+
}
|
|
4293
|
+
return localStorageData;
|
|
4294
|
+
};
|
|
4138
4295
|
|
|
4139
4296
|
// src/components/assets/styles/thorium-web.reader.app.module.css
|
|
4140
4297
|
var thorium_web_reader_app_default = {
|
|
@@ -4582,6 +4739,7 @@ var StatefulReaderHeader = ({
|
|
|
4582
4739
|
const isImmersive = useAppSelector((state) => state.reader.isImmersive);
|
|
4583
4740
|
const isHovering = useAppSelector((state) => state.reader.isHovering);
|
|
4584
4741
|
const hasScrollAffordance = useAppSelector((state) => state.reader.hasScrollAffordance);
|
|
4742
|
+
const positionsList = useAppSelector((state) => state.publication.positionsList);
|
|
4585
4743
|
const actions = useActions({ ...actionsMap, ...overflowMap });
|
|
4586
4744
|
const dispatch = useAppDispatch();
|
|
4587
4745
|
const { focusWithinProps } = useFocusWithin({
|
|
@@ -4619,8 +4777,16 @@ var StatefulReaderHeader = ({
|
|
|
4619
4777
|
}
|
|
4620
4778
|
});
|
|
4621
4779
|
}
|
|
4622
|
-
return actionsItems
|
|
4623
|
-
|
|
4780
|
+
return actionsItems.filter((item) => {
|
|
4781
|
+
if (item.key === "jumpToPosition" /* jumpToPosition */) {
|
|
4782
|
+
return isPositionsListValid(positionsList);
|
|
4783
|
+
}
|
|
4784
|
+
if (item.key === "fullscreen" /* fullscreen */) {
|
|
4785
|
+
return document.fullscreenEnabled && !isIOSish();
|
|
4786
|
+
}
|
|
4787
|
+
return true;
|
|
4788
|
+
});
|
|
4789
|
+
}, [actionKeys, actionsComponentsMap, positionsList]);
|
|
4624
4790
|
useEffect(() => {
|
|
4625
4791
|
if (isImmersive) {
|
|
4626
4792
|
const focusElement = document.activeElement;
|
|
@@ -5363,6 +5529,6 @@ function getReaderClassNames(options) {
|
|
|
5363
5529
|
);
|
|
5364
5530
|
}
|
|
5365
5531
|
|
|
5366
|
-
export { NavigatorProvider, Peripherals, StatefulActionIcon, StatefulBottomSheet, StatefulCollapsibleActionsBar, StatefulColumns, StatefulDockedSheet, StatefulDockingWrapper, StatefulDropdown, StatefulFontFamily, StatefulFullScreenSheet, StatefulFullscreenTrigger, StatefulGroupWrapper, StatefulHyphens, StatefulJumpToPositionContainer, StatefulJumpToPositionTrigger, StatefulLayout, StatefulLetterSpacing, StatefulLineHeight, StatefulNumberField, StatefulOverflowMenu, StatefulOverflowMenuItem, StatefulParagraphIndent, StatefulParagraphSpacing, StatefulPopoverSheet, StatefulPreferencesProvider, StatefulPublisherStyles, StatefulRadioGroup, StatefulReaderFooter, StatefulReaderHeader, StatefulSettingsContainer, StatefulSettingsTrigger, StatefulSheetWrapper, StatefulSlider, StatefulSpacingGroup, StatefulSpacingGroupContainer, StatefulSpacingPresets, StatefulSwitch, StatefulTextAlign, StatefulTextGroup, StatefulTextGroupContainer, StatefulTextNormalize, StatefulTheme, StatefulTocContainer, StatefulTocTrigger, StatefulWordSpacing, StatefulZoom, ThPluginProvider, ThPluginRegistry, UnstableStatefulFontWeight, createDefaultPlugin, getReaderClassNames, thorium_web_button_default, thorium_web_reader_app_default, useDocking, useFonts, useGridNavigation, useGridTemplate, useLineHeight, useNavigator, usePublication, useReaderTransitions, useSettingsComponentStatus, useSpacingPresets };
|
|
5367
|
-
//# sourceMappingURL=chunk-
|
|
5368
|
-
//# sourceMappingURL=chunk-
|
|
5532
|
+
export { NavigatorProvider, Peripherals, StatefulActionIcon, StatefulBottomSheet, StatefulCollapsibleActionsBar, StatefulColumns, StatefulDockedSheet, StatefulDockingWrapper, StatefulDropdown, StatefulFontFamily, StatefulFullScreenSheet, StatefulFullscreenTrigger, StatefulGroupWrapper, StatefulHyphens, StatefulJumpToPositionContainer, StatefulJumpToPositionTrigger, StatefulLayout, StatefulLetterSpacing, StatefulLineHeight, StatefulNumberField, StatefulOverflowMenu, StatefulOverflowMenuItem, StatefulParagraphIndent, StatefulParagraphSpacing, StatefulPopoverSheet, StatefulPreferencesProvider, StatefulPublisherStyles, StatefulRadioGroup, StatefulReaderFooter, StatefulReaderHeader, StatefulSettingsContainer, StatefulSettingsTrigger, StatefulSheetWrapper, StatefulSlider, StatefulSpacingGroup, StatefulSpacingGroupContainer, StatefulSpacingPresets, StatefulSwitch, StatefulTextAlign, StatefulTextGroup, StatefulTextGroupContainer, StatefulTextNormalize, StatefulTheme, StatefulTocContainer, StatefulTocTrigger, StatefulWordSpacing, StatefulZoom, ThPluginProvider, ThPluginRegistry, UnstableStatefulFontWeight, createDefaultPlugin, getReaderClassNames, thorium_web_button_default, thorium_web_reader_app_default, useDocking, useFonts, useGridNavigation, useGridTemplate, useLineHeight, useNavigator, usePositionStorage, usePublication, useReaderTransitions, useSettingsComponentStatus, useSpacingPresets };
|
|
5533
|
+
//# sourceMappingURL=chunk-H4J2VY7Z.mjs.map
|
|
5534
|
+
//# sourceMappingURL=chunk-H4J2VY7Z.mjs.map
|