@edrlab/thorium-web 1.5.4 → 1.5.6
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-B3a-f5v-.d.mts → ThPreferencesAdapter-GepvYoaL.d.mts} +4 -3
- package/dist/{ThSettingsWrapper-D4WIzlXA.d.mts → ThSettingsWrapper-DyYC678Q.d.mts} +1 -1
- package/dist/{actions-C33UN3Ji.d.mts → actions-CTg9C4C-.d.mts} +1 -1
- package/dist/{actionsReducer-Bzcj3wk3.d.mts → actionsReducer-Cnd7Cdh9.d.mts} +1 -1
- package/dist/{chunk-VYSDLACR.mjs → chunk-3R5JARA2.mjs} +3 -3
- package/dist/{chunk-VYSDLACR.mjs.map → chunk-3R5JARA2.mjs.map} +1 -1
- package/dist/{chunk-X6Z4WZLX.mjs → chunk-5IT53TCU.mjs} +55 -35
- package/dist/chunk-5IT53TCU.mjs.map +1 -0
- package/dist/{chunk-7WGC22F3.mjs → chunk-6DR4EAK3.mjs} +42 -49
- package/dist/chunk-6DR4EAK3.mjs.map +1 -0
- package/dist/chunk-7SMOXFAF.mjs +121 -0
- package/dist/chunk-7SMOXFAF.mjs.map +1 -0
- package/dist/{chunk-AEEGHJVM.mjs → chunk-CXKDZVAV.mjs} +113 -258
- package/dist/chunk-CXKDZVAV.mjs.map +1 -0
- package/dist/{chunk-MD5LZNDG.mjs → chunk-DKF53WEQ.mjs} +39 -16
- package/dist/chunk-DKF53WEQ.mjs.map +1 -0
- package/dist/{chunk-GFSLVQIG.mjs → chunk-EREFYF5J.mjs} +3 -3
- package/dist/{chunk-GFSLVQIG.mjs.map → chunk-EREFYF5J.mjs.map} +1 -1
- package/dist/{chunk-YE5QOQUT.mjs → chunk-I765HTBI.mjs} +15 -109
- package/dist/chunk-I765HTBI.mjs.map +1 -0
- package/dist/{chunk-G4T4RXFB.mjs → chunk-LF6IMH7J.mjs} +83 -70
- package/dist/chunk-LF6IMH7J.mjs.map +1 -0
- package/dist/{chunk-NQ2ZSGCX.mjs → chunk-MFVZ5AEN.mjs} +7 -3
- package/dist/chunk-MFVZ5AEN.mjs.map +1 -0
- package/dist/{chunk-2YRT7RNW.mjs → chunk-QOU3R5ZT.mjs} +9 -3
- package/dist/chunk-QOU3R5ZT.mjs.map +1 -0
- package/dist/{chunk-G35H3K32.mjs → chunk-VWKUZP5V.mjs} +43 -48
- package/dist/chunk-VWKUZP5V.mjs.map +1 -0
- package/dist/{chunk-IVCUCIYN.mjs → chunk-WOJR6ALR.mjs} +41 -18
- package/dist/chunk-WOJR6ALR.mjs.map +1 -0
- package/dist/components/Audio/index.css +1 -0
- package/dist/components/Audio/index.css.map +1 -1
- package/dist/components/Audio/index.d.mts +13 -13
- package/dist/components/Audio/index.mjs +10 -11
- package/dist/components/Epub/index.d.mts +13 -13
- package/dist/components/Epub/index.mjs +11 -12
- package/dist/components/Reader/index.css +1 -0
- package/dist/components/Reader/index.css.map +1 -1
- package/dist/components/Reader/index.d.mts +12 -12
- package/dist/components/Reader/index.mjs +18 -18
- package/dist/components/Reader/index.mjs.map +1 -1
- package/dist/components/WebPub/index.d.mts +13 -13
- package/dist/components/WebPub/index.mjs +11 -12
- package/dist/core/Components/index.d.mts +6 -6
- package/dist/core/Helpers/index.d.mts +4 -4
- package/dist/core/Helpers/index.mjs +2 -2
- package/dist/core/Hooks/index.d.mts +14 -9
- package/dist/core/Hooks/index.mjs +4 -4
- package/dist/lib/index.d.mts +43 -33
- package/dist/lib/index.mjs +3 -4
- package/dist/locales/ar/thorium-shared.json +39 -0
- package/dist/locales/bg/thorium-web.json +23 -0
- package/dist/locales/brh/thorium-shared.json +1 -0
- package/dist/locales/brh/thorium-web.json +1 -0
- package/dist/locales/da/thorium-shared.json +3 -0
- package/dist/locales/el/thorium-web.json +41 -6
- package/dist/locales/en/thorium-shared.json +3 -0
- package/dist/locales/es/thorium-shared.json +3 -0
- package/dist/locales/et/thorium-shared.json +3 -0
- package/dist/locales/fi/thorium-shared.json +3 -0
- package/dist/locales/fi/thorium-web.json +4 -4
- package/dist/locales/he/thorium-shared.json +3 -1
- package/dist/locales/it/thorium-shared.json +3 -0
- package/dist/locales/lt/thorium-shared.json +30 -4
- package/dist/locales/pt-PT/thorium-shared.json +8 -5
- package/dist/locales/sv/thorium-shared.json +3 -3
- package/dist/locales/sv/thorium-web.json +7 -7
- package/dist/locales/tr/thorium-shared.json +80 -0
- package/dist/preferences/index.d.mts +10 -10
- package/dist/preferences/index.mjs +4 -5
- package/dist/{settingsReducer-Pp9aoiiC.d.mts → settingsReducer-DRWEq8Cm.d.mts} +1 -1
- package/dist/{ui-DnZZhozX.d.mts → ui-DHQ_zvWn.d.mts} +7 -1
- package/dist/{useAudioNavigator-9RuOpLGB.d.mts → useAudioNavigator-B4NBPvmZ.d.mts} +4 -5
- package/dist/{useContrast-Bl08zDTU.d.mts → useContrast-Unp3534Z.d.mts} +1 -1
- package/dist/{usePreferences-Cy7-JN2x.d.mts → usePreferences-Bi-ptif0.d.mts} +6 -9
- package/dist/usePublicationProgress-DT-X5ZLf.d.mts +44 -0
- package/dist/{useReaderTransitions-BsTdWZDK.d.mts → useReaderTransitions-B9fOF61y.d.mts} +10 -14
- package/package.json +13 -10
- package/dist/chunk-2YRT7RNW.mjs.map +0 -1
- package/dist/chunk-7WGC22F3.mjs.map +0 -1
- package/dist/chunk-A575ZW4A.mjs +0 -10
- package/dist/chunk-A575ZW4A.mjs.map +0 -1
- package/dist/chunk-AEEGHJVM.mjs.map +0 -1
- package/dist/chunk-G35H3K32.mjs.map +0 -1
- package/dist/chunk-G4T4RXFB.mjs.map +0 -1
- package/dist/chunk-IVCUCIYN.mjs.map +0 -1
- package/dist/chunk-MD5LZNDG.mjs.map +0 -1
- package/dist/chunk-NQ2ZSGCX.mjs.map +0 -1
- package/dist/chunk-TEZB4ULX.mjs +0 -57
- package/dist/chunk-TEZB4ULX.mjs.map +0 -1
- package/dist/chunk-X6Z4WZLX.mjs.map +0 -1
- package/dist/chunk-YE5QOQUT.mjs.map +0 -1
- package/dist/useTimeline-DCZ1qoCO.d.mts +0 -55
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { makeBreakpointsMap, isKeyboardTriggered, isActiveElement } from './chunk-
|
|
2
|
-
import { useFullscreen, useLocalStorage, useEpubNavigator } from './chunk-
|
|
3
|
-
import { setFullscreen, setReaderProfile,
|
|
4
|
-
import {
|
|
5
|
-
import { useSharedPreferences, useActionsPreferences, prefixString, ThDockingTypes, ThSheetTypes, useAudioPreferences, usePreferences, useFilteredPreferenceKeys, defaultSpacingSettingsSubpanel, defaultSpacingSettingsMain, defaultTextSettingsSubpanel, defaultTextSettingsMain, ThTextSettingsKeys, ThSpacingSettingsKeys, buildThemeObject, defaultAudioSkipBackwardInterval, defaultAudioSkipForwardInterval, defaultAudioSkipInterval, defaultPreferences, ThPreferencesProvider, ThGlobalPreferencesProvider } from './chunk-
|
|
6
|
-
import { useAppDispatch, useAppSelector } from './chunk-A575ZW4A.mjs';
|
|
1
|
+
import { makeBreakpointsMap, isKeyboardTriggered, isActiveElement } from './chunk-3R5JARA2.mjs';
|
|
2
|
+
import { useFullscreen, useLocalStorage, useEpubNavigator } from './chunk-CXKDZVAV.mjs';
|
|
3
|
+
import { setFullscreen, setReaderProfile, setActionOpen, dockAction, setHovering, setSettingsContainer, debounce, setColumnCount, initialWebPubSettingsState, initialSettingsState, 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, setWebPubLigatures, setLigatures, setWebPubNoRuby, setNoRuby, setTheme, setWebPubZoom, setFontSize, setSkipBackwardInterval, setSkipForwardInterval, setSkipInterval, setAutoPlay, toggleActionOpen, setVolume, setPlaybackRate, setSleepTimerRemainingSeconds, setSleepTimerOnTrackEnd, setSleepTimerOnFragmentEnd, setRemotePlaybackState, ThReduxPreferencesAdapter, ThReduxGlobalPreferencesAdapter, setImmersive, setOverflow, setUserNavigated, collapseDockPanel, expandDockPanel, activateDockPanel, deactivateDockPanel, setDockPanelWidth } from './chunk-I765HTBI.mjs';
|
|
4
|
+
import { setPositionsList, setScriptMode, setRTL, setFXL, setHasDisplayTransformability, setTocTree, buildTocTreeFromTimeline, setTocEntry, findTocItemByHref, findTocItemById } from './chunk-7SMOXFAF.mjs';
|
|
5
|
+
import { useSharedPreferences, useActionsPreferences, prefixString, ThDockingTypes, ThSheetTypes, useAudioPreferences, usePreferences, useFilteredPreferenceKeys, defaultSpacingSettingsSubpanel, defaultSpacingSettingsMain, defaultTextSettingsSubpanel, defaultTextSettingsMain, ThTextSettingsKeys, ThSpacingSettingsKeys, buildThemeObject, defaultAudioSkipBackwardInterval, defaultAudioSkipForwardInterval, defaultAudioSkipInterval, defaultPreferences, ThPreferencesProvider, ThGlobalPreferencesProvider } from './chunk-6DR4EAK3.mjs';
|
|
7
6
|
import { metaKeys } from './chunk-X63WSMOH.mjs';
|
|
7
|
+
import { useAppDispatch, useAppSelector } from './chunk-MFVZ5AEN.mjs';
|
|
8
8
|
import { isIOSish } from './chunk-KQ3KS5O5.mjs';
|
|
9
9
|
import { ErrorHandler } from './chunk-RRDEPGBK.mjs';
|
|
10
10
|
import { ThMenuItem, ThActionButton, ThMenu, ThCollapsibleActionsBar, ThPopover, ThContainerHeader, ThNavigationButton, ThContainerBody, ThModal, ThBottomSheet, ThCloseButton, ThDockedPanel, useFirstFocusable, ThTypedComponentRenderer, useActions, ThForm, ThFormNumberField, ThSettingsWrapper, ThRadioGroup, ThDropdown, ThSwitch, ThNumberField, ThSlider, ThSliderWithPresets, ThLink, ThLibrary, ThHome, ThBackArrow, ThFormSearchField } from './chunk-ES2Y5MC7.mjs';
|
|
@@ -15,7 +15,7 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
|
15
15
|
import { Text, Popover, Dialog, ListBox, ListBoxItem, Radio, Button, Keyboard, Toolbar, useFilter, Tree, TreeItem, TreeItemContent, Collection } from 'react-aria-components';
|
|
16
16
|
import { useObjectRef, useNumberFormatter, FocusScope, useLocale, useFocusWithin } from 'react-aria';
|
|
17
17
|
import classNames4 from 'classnames';
|
|
18
|
-
import { Link, HttpFetcher, Manifest, Publication, ReadingProgression, Layout, Feature, Profile } from '@readium/shared';
|
|
18
|
+
import { Link, HttpFetcher, Manifest, Publication, ReadingProgression, Layout, Feature, Locator, Profile } from '@readium/shared';
|
|
19
19
|
import { getScriptMode, lineHeightRangeConfig, TextAlignment } from '@readium/navigator';
|
|
20
20
|
import i18nData from '@readium/css/css/vars/i18n.json';
|
|
21
21
|
import { useStore } from 'react-redux';
|
|
@@ -460,18 +460,6 @@ var useNavigator = () => {
|
|
|
460
460
|
return navigator.goLink(link, animated, callback);
|
|
461
461
|
},
|
|
462
462
|
currentLocator: () => navigator.currentLocator(),
|
|
463
|
-
previousLocator: () => {
|
|
464
|
-
if (isVisual && navigator.previousLocator) {
|
|
465
|
-
return navigator.previousLocator() || null;
|
|
466
|
-
}
|
|
467
|
-
return null;
|
|
468
|
-
},
|
|
469
|
-
nextLocator: () => {
|
|
470
|
-
if (isVisual && navigator.nextLocator) {
|
|
471
|
-
return navigator.nextLocator() || null;
|
|
472
|
-
}
|
|
473
|
-
return null;
|
|
474
|
-
},
|
|
475
463
|
goForward: (animated, callback) => {
|
|
476
464
|
if (navigator.goForward) {
|
|
477
465
|
return navigator.goForward(animated, callback);
|
|
@@ -572,17 +560,9 @@ var useReaderTransitions = () => {
|
|
|
572
560
|
};
|
|
573
561
|
};
|
|
574
562
|
|
|
575
|
-
// src/helpers/
|
|
576
|
-
var
|
|
577
|
-
return positionsList?.map((locator) => (
|
|
578
|
-
href: locator.href,
|
|
579
|
-
type: locator.type,
|
|
580
|
-
locations: {
|
|
581
|
-
position: locator.locations.position,
|
|
582
|
-
progression: locator.locations.progression,
|
|
583
|
-
totalProgression: locator.locations.totalProgression
|
|
584
|
-
}
|
|
585
|
-
}));
|
|
563
|
+
// src/helpers/serializePositions.ts
|
|
564
|
+
var serializePositions = (positionsList) => {
|
|
565
|
+
return positionsList?.map((locator) => locator.serialize());
|
|
586
566
|
};
|
|
587
567
|
|
|
588
568
|
// src/hooks/usePublication.ts
|
|
@@ -663,20 +643,13 @@ var usePublication = ({
|
|
|
663
643
|
if (detectedProfile === "epub") {
|
|
664
644
|
try {
|
|
665
645
|
const rawPositions = await pub.positionsFromManifest();
|
|
666
|
-
const positionsList =
|
|
667
|
-
dispatch(setPositionsList(positionsList));
|
|
646
|
+
const positionsList = serializePositions(rawPositions);
|
|
647
|
+
dispatch(setPositionsList(positionsList ?? []));
|
|
668
648
|
} catch (error2) {
|
|
669
649
|
console.error("Failed to fetch positions:", error2);
|
|
670
650
|
dispatch(setPositionsList([]));
|
|
671
651
|
}
|
|
672
652
|
}
|
|
673
|
-
if (detectedProfile === "audio") {
|
|
674
|
-
const tocLinks = manifestObj.toc?.items && manifestObj.toc.items.length > 0 ? manifestObj.toc.items : manifestObj.readingOrder?.items || [];
|
|
675
|
-
const publicationTitle = manifestObj.metadata.title.getTranslation("en");
|
|
676
|
-
let idCounter = 0;
|
|
677
|
-
const idGenerator = () => `toc-${++idCounter}`;
|
|
678
|
-
dispatch(setTocTree(buildTocTree(tocLinks, idGenerator, void 0, publicationTitle)));
|
|
679
|
-
}
|
|
680
653
|
setPublication(pub);
|
|
681
654
|
setIsLoading(false);
|
|
682
655
|
}
|
|
@@ -709,8 +682,8 @@ var usePublication = ({
|
|
|
709
682
|
const fetchPositions = async () => {
|
|
710
683
|
try {
|
|
711
684
|
const positionsList = await publication.positionsFromManifest();
|
|
712
|
-
const deserializedPositionsList =
|
|
713
|
-
dispatch(setPositionsList(deserializedPositionsList));
|
|
685
|
+
const deserializedPositionsList = serializePositions(positionsList);
|
|
686
|
+
dispatch(setPositionsList(deserializedPositionsList ?? []));
|
|
714
687
|
} catch (error2) {
|
|
715
688
|
console.error("Failed to fetch positions:", error2);
|
|
716
689
|
dispatch(setPositionsList([]));
|
|
@@ -2044,7 +2017,7 @@ var StatefulJumpToPositionContainer = ({
|
|
|
2044
2017
|
const profile = useAppSelector((state) => state.reader.profile);
|
|
2045
2018
|
const actionState = useAppSelector((state) => profile ? state.actions.keys[profile]["jumpToPosition" /* jumpToPosition */] : void 0);
|
|
2046
2019
|
const positionsList = useAppSelector((state) => state.publication.positionsList);
|
|
2047
|
-
const positionNumbers = useAppSelector((state) => state.publication.
|
|
2020
|
+
const positionNumbers = useAppSelector((state) => state.publication.progress?.progression?.currentPositions);
|
|
2048
2021
|
const reducedMotion = useAppSelector((state) => state.theming.prefersReducedMotion);
|
|
2049
2022
|
const dispatch = useAppDispatch();
|
|
2050
2023
|
const docking = useDocking("jumpToPosition" /* jumpToPosition */);
|
|
@@ -2074,18 +2047,23 @@ var StatefulJumpToPositionContainer = ({
|
|
|
2074
2047
|
e.preventDefault();
|
|
2075
2048
|
if (!positionsList) return;
|
|
2076
2049
|
setErrorMessage(void 0);
|
|
2077
|
-
const item = positionsList.find((item2) => item2.locations
|
|
2050
|
+
const item = positionsList.find((item2) => item2.locations?.position === position);
|
|
2078
2051
|
if (!item) {
|
|
2079
2052
|
setErrorMessage(t("reader.jumpToPosition.error.notFound"));
|
|
2080
2053
|
return;
|
|
2081
2054
|
}
|
|
2055
|
+
const locator = Locator.deserialize(item);
|
|
2056
|
+
if (!locator) {
|
|
2057
|
+
setErrorMessage(t("reader.jumpToPosition.error.notFound"));
|
|
2058
|
+
return;
|
|
2059
|
+
}
|
|
2082
2060
|
if (positionInRange()) return setOpen(false);
|
|
2083
2061
|
const cb = () => {
|
|
2084
2062
|
setOpen(false);
|
|
2085
2063
|
dispatch(setImmersive(true));
|
|
2086
2064
|
dispatch(setUserNavigated(true));
|
|
2087
2065
|
};
|
|
2088
|
-
go(
|
|
2066
|
+
go(locator, !reducedMotion, cb);
|
|
2089
2067
|
}, [position, positionsList, reducedMotion, t, positionInRange, go, setOpen, dispatch]);
|
|
2090
2068
|
useEffect(() => {
|
|
2091
2069
|
positionNumbers && setPosition(positionNumbers[0]);
|
|
@@ -2643,7 +2621,7 @@ function filterTocTree(items, query, contains) {
|
|
|
2643
2621
|
if (item.children) acc.push(...recursiveFilter(item.children));
|
|
2644
2622
|
return acc;
|
|
2645
2623
|
}, []);
|
|
2646
|
-
return recursiveFilter(items)
|
|
2624
|
+
return recursiveFilter(items);
|
|
2647
2625
|
}
|
|
2648
2626
|
function useTocContent({ isOpen, tocTree, tocEntry }) {
|
|
2649
2627
|
const [expandedKeys, setExpandedKeys] = useState(/* @__PURE__ */ new Set());
|
|
@@ -2751,7 +2729,6 @@ var TocContent = ({
|
|
|
2751
2729
|
return /* @__PURE__ */ jsxs(
|
|
2752
2730
|
TreeItem,
|
|
2753
2731
|
{
|
|
2754
|
-
"data-href": item.href,
|
|
2755
2732
|
className: thorium_web_toc_default.treeItem,
|
|
2756
2733
|
textValue: item.title || "",
|
|
2757
2734
|
children: [
|
|
@@ -2781,10 +2758,10 @@ var TocContent = ({
|
|
|
2781
2758
|
};
|
|
2782
2759
|
var StatefulTocContainer = ({ triggerRef }) => {
|
|
2783
2760
|
const { t } = useI18n();
|
|
2784
|
-
const
|
|
2785
|
-
const tocEntry =
|
|
2761
|
+
const toc = useAppSelector((state) => state.publication.toc);
|
|
2762
|
+
const tocEntry = toc?.currentEntry ?? void 0;
|
|
2786
2763
|
const tocEntryId = tocEntry?.id;
|
|
2787
|
-
const tocTree =
|
|
2764
|
+
const tocTree = toc?.tree;
|
|
2788
2765
|
const { goLink, getScriptMode: getScriptMode2 } = useNavigator().unified;
|
|
2789
2766
|
const isRTL = getScriptMode2() === "rtl";
|
|
2790
2767
|
const profile = useAppSelector((state) => state.reader.profile);
|
|
@@ -2801,17 +2778,15 @@ var StatefulTocContainer = ({ triggerRef }) => {
|
|
|
2801
2778
|
const handleAction = (keys) => {
|
|
2802
2779
|
if (keys === "all" || !keys || keys.size === 0) return;
|
|
2803
2780
|
const key = [...keys][0];
|
|
2804
|
-
const el = document.querySelector(`[data-key=${key}]`);
|
|
2805
|
-
const href = el?.getAttribute("data-href");
|
|
2806
|
-
if (!href) return;
|
|
2807
|
-
const link = new Link({ href });
|
|
2808
2781
|
const matched = findTocItemById(tocTree || [], key);
|
|
2782
|
+
if (!matched) return;
|
|
2783
|
+
const link = new Link({ href: matched.href });
|
|
2809
2784
|
const cb = actionState?.isOpen && (sheetType === "docked start" /* dockedStart */ || sheetType === "docked end" /* dockedEnd */) ? () => {
|
|
2810
|
-
dispatch(setTocEntry(matched
|
|
2785
|
+
dispatch(setTocEntry(matched));
|
|
2811
2786
|
dispatch(setImmersive(true));
|
|
2812
2787
|
dispatch(setUserNavigated(true));
|
|
2813
2788
|
} : () => {
|
|
2814
|
-
dispatch(setTocEntry(matched
|
|
2789
|
+
dispatch(setTocEntry(matched));
|
|
2815
2790
|
dispatch(setImmersive(true));
|
|
2816
2791
|
dispatch(setUserNavigated(true));
|
|
2817
2792
|
setOpen(false);
|
|
@@ -4663,7 +4638,7 @@ var StatefulTheme = () => {
|
|
|
4663
4638
|
const themeObject = useAppSelector((state) => state.theming.theme);
|
|
4664
4639
|
const theme = profile === "audio" ? themeObject.audio ?? "auto" : isFXL ? themeObject.fxl ?? "auto" : themeObject.reflow ?? "auto";
|
|
4665
4640
|
const colorScheme = useAppSelector((state) => state.theming.colorScheme);
|
|
4666
|
-
const coverTheme = useAppSelector((state) => state.
|
|
4641
|
+
const coverTheme = useAppSelector((state) => state.publication.coverTheme);
|
|
4667
4642
|
const themeItems = useRef(
|
|
4668
4643
|
themeArray.filter((theme2) => {
|
|
4669
4644
|
if (theme2 === "auto") {
|
|
@@ -4921,7 +4896,7 @@ var createDefaultPlugin = () => {
|
|
|
4921
4896
|
id: "core",
|
|
4922
4897
|
name: "Core Components",
|
|
4923
4898
|
description: "Default components for Thorium Web Epub StatefulReader",
|
|
4924
|
-
version: "1.5.
|
|
4899
|
+
version: "1.5.6",
|
|
4925
4900
|
components: {
|
|
4926
4901
|
actions: {
|
|
4927
4902
|
["fullscreen" /* fullscreen */]: {
|
|
@@ -5770,10 +5745,10 @@ var StatefulAudioTocContainer = ({ triggerRef }) => {
|
|
|
5770
5745
|
const { goLink } = useNavigator().unified;
|
|
5771
5746
|
const dispatch = useAppDispatch();
|
|
5772
5747
|
const isOpen = useAppSelector((state) => profile ? state.actions.keys[profile]["audio.toc" /* toc */]?.isOpen ?? false : false);
|
|
5773
|
-
const
|
|
5774
|
-
const tocEntry =
|
|
5748
|
+
const toc = useAppSelector((state) => state.publication.toc);
|
|
5749
|
+
const tocEntry = toc?.currentEntry ?? void 0;
|
|
5775
5750
|
const tocEntryId = tocEntry?.id;
|
|
5776
|
-
const tocTree =
|
|
5751
|
+
const tocTree = toc?.tree;
|
|
5777
5752
|
const isRTL = useAppSelector((state) => state.publication.isRTL);
|
|
5778
5753
|
const docking = useDocking("audio.toc" /* toc */);
|
|
5779
5754
|
const sheetType = docking.sheetType;
|
|
@@ -5797,21 +5772,19 @@ var StatefulAudioTocContainer = ({ triggerRef }) => {
|
|
|
5797
5772
|
const handleAction = (keys) => {
|
|
5798
5773
|
if (keys === "all" || !keys || keys.size === 0) return;
|
|
5799
5774
|
const key = [...keys][0];
|
|
5800
|
-
const el = document.querySelector(`[data-key=${key}]`);
|
|
5801
|
-
const href = el?.getAttribute("data-href");
|
|
5802
|
-
if (!href) return;
|
|
5803
5775
|
const matched = findTocItemById(tocTree || [], key);
|
|
5776
|
+
if (!matched) return;
|
|
5804
5777
|
const cb = isOpen && (sheetType === "docked start" /* dockedStart */ || sheetType === "docked end" /* dockedEnd */) ? () => {
|
|
5805
|
-
dispatch(setTocEntry(matched
|
|
5778
|
+
dispatch(setTocEntry(matched));
|
|
5806
5779
|
dispatch(setImmersive(true));
|
|
5807
5780
|
dispatch(setUserNavigated(true));
|
|
5808
5781
|
} : () => {
|
|
5809
|
-
dispatch(setTocEntry(matched
|
|
5782
|
+
dispatch(setTocEntry(matched));
|
|
5810
5783
|
dispatch(setImmersive(true));
|
|
5811
5784
|
dispatch(setUserNavigated(true));
|
|
5812
5785
|
setOpen(false);
|
|
5813
5786
|
};
|
|
5814
|
-
goLink(new Link({ href }), true, cb);
|
|
5787
|
+
goLink(new Link({ href: matched.href }), true, cb);
|
|
5815
5788
|
};
|
|
5816
5789
|
return /* @__PURE__ */ jsx(
|
|
5817
5790
|
StatefulSheetWrapper,
|
|
@@ -6197,7 +6170,7 @@ var createAudioDefaultPlugin = () => {
|
|
|
6197
6170
|
id: "audio-core",
|
|
6198
6171
|
name: "Audio Core Components",
|
|
6199
6172
|
description: "Default components for Thorium Web Audio StatefulReader",
|
|
6200
|
-
version: "1.5.
|
|
6173
|
+
version: "1.5.6",
|
|
6201
6174
|
components: {
|
|
6202
6175
|
actions: {
|
|
6203
6176
|
["settings" /* settings */]: {
|
|
@@ -6631,6 +6604,46 @@ var useFocusedDockableKey = () => {
|
|
|
6631
6604
|
return null;
|
|
6632
6605
|
}, [actionsKeys]);
|
|
6633
6606
|
};
|
|
6607
|
+
var useTocTreeBuilder = (publication, navigatorReady, getNavigatorTimeline) => {
|
|
6608
|
+
const dispatch = useAppDispatch();
|
|
6609
|
+
useEffect(() => {
|
|
6610
|
+
if (!navigatorReady || !publication) return;
|
|
6611
|
+
const navigatorTimeline = getNavigatorTimeline();
|
|
6612
|
+
if (!navigatorTimeline) return;
|
|
6613
|
+
const publicationTitle = publication.metadata.title.getTranslation("en");
|
|
6614
|
+
dispatch(setTocTree(buildTocTreeFromTimeline(navigatorTimeline, publicationTitle)));
|
|
6615
|
+
}, [navigatorReady, publication, getNavigatorTimeline, dispatch]);
|
|
6616
|
+
};
|
|
6617
|
+
var useTocEntryTracking = (getNavigatorTimeline, tocTree) => {
|
|
6618
|
+
const dispatch = useAppDispatch();
|
|
6619
|
+
const tocTreeRef = useRef(tocTree);
|
|
6620
|
+
const lastItemRef = useRef(void 0);
|
|
6621
|
+
const resolve = useCallback((item) => {
|
|
6622
|
+
const tl = getNavigatorTimeline();
|
|
6623
|
+
if (!item || !tl) {
|
|
6624
|
+
dispatch(setTocEntry(null));
|
|
6625
|
+
return;
|
|
6626
|
+
}
|
|
6627
|
+
const entry = tl.tocEntryFor(item);
|
|
6628
|
+
const matched = entry ? findTocItemByHref(tocTreeRef.current || [], entry.link.href) : void 0;
|
|
6629
|
+
dispatch(setTocEntry(matched || null));
|
|
6630
|
+
}, [dispatch, getNavigatorTimeline]);
|
|
6631
|
+
useEffect(() => {
|
|
6632
|
+
tocTreeRef.current = tocTree;
|
|
6633
|
+
if (tocTree && lastItemRef.current) {
|
|
6634
|
+
resolve(lastItemRef.current);
|
|
6635
|
+
}
|
|
6636
|
+
}, [tocTree, resolve]);
|
|
6637
|
+
const updateCurrentTocEntry = useCallback((item) => {
|
|
6638
|
+
lastItemRef.current = item;
|
|
6639
|
+
resolve(item);
|
|
6640
|
+
}, [resolve]);
|
|
6641
|
+
const clearCurrentTocEntry = useCallback(() => {
|
|
6642
|
+
lastItemRef.current = void 0;
|
|
6643
|
+
dispatch(setTocEntry(null));
|
|
6644
|
+
}, [dispatch]);
|
|
6645
|
+
return { updateCurrentTocEntry, clearCurrentTocEntry };
|
|
6646
|
+
};
|
|
6634
6647
|
|
|
6635
6648
|
// src/components/assets/styles/thorium-web.reader.header.module.css
|
|
6636
6649
|
var thorium_web_reader_header_default = {
|
|
@@ -6819,6 +6832,6 @@ var useReaderHeaderBase = (actionKeys) => {
|
|
|
6819
6832
|
};
|
|
6820
6833
|
};
|
|
6821
6834
|
|
|
6822
|
-
export { NavPeripheralType, NavigatorProvider, ORDERED_LINE_HEIGHT_OPTIONS, StatefulActionIcon, StatefulAudioAutoPlay, StatefulAudioPlaybackRateContainer, StatefulAudioPlaybackRateTrigger, StatefulAudioRemotePlaybackTrigger, StatefulAudioSettingsContainer, StatefulAudioSkipBackwardInterval, StatefulAudioSkipForwardInterval, StatefulAudioSkipInterval, StatefulAudioSleepTimerContainer, StatefulAudioSleepTimerTrigger, StatefulAudioTocContainer, StatefulAudioTocTrigger, StatefulAudioVolumeContainer, StatefulAudioVolumeTrigger, StatefulBackLink, StatefulBottomSheet, StatefulCollapsibleActionsBar, StatefulColumns, StatefulCompactPopoverSheet, StatefulDockedSheet, StatefulDockingWrapper, StatefulDropdown, StatefulFontFamily, StatefulFullScreenSheet, StatefulFullscreenTrigger, StatefulGlobalPreferencesProvider, StatefulGroupWrapper, StatefulHyphens, StatefulJumpToPositionContainer, StatefulJumpToPositionTrigger, StatefulLayout, StatefulLetterSpacing, StatefulLigatures, StatefulLineHeight, StatefulModalBase, StatefulModalSheet, StatefulNoRuby, StatefulNumberField, StatefulOverflowMenu, StatefulOverflowMenuItem, StatefulParagraphIndent, StatefulParagraphSpacing, StatefulPopoverSheet, StatefulPreferencesProvider, StatefulPublisherStyles, StatefulRadioGroup, StatefulSettingsTrigger, StatefulSettingsWrapper, StatefulSheetWrapper, StatefulSlider, StatefulSliderWithPresets, StatefulSpacingGroup, StatefulSpacingGroupContainer, StatefulSpacingPresets, StatefulSwitch, StatefulTextAlign, StatefulTextGroup, StatefulTextGroupContainer, StatefulTextNormalize, StatefulTheme, StatefulTocContainer, StatefulTocTrigger, StatefulVisualSettingsContainer, StatefulWordSpacing, StatefulZoom, ThPluginProvider, ThPluginRegistry, UnstableStatefulFontWeight, ZOOM_IN_KEY_COMBOS, ZOOM_OUT_KEY_COMBOS, createAudioDefaultPlugin, createDefaultPlugin, fromActionPeripheralType, fromDockingPeripheralType, thorium_web_button_default, thorium_web_overflow_default, thorium_web_reader_app_default, thorium_web_reader_header_default, toActionPeripheralType, toDockingPeripheralType, useActionComponentStatus, useDocking, useEffectiveRange, useFocusedDockableKey, useGridNavigation, useGridTemplate, useIsScroll, useLineHeight, useNavigator, usePlaceholder, usePlugins, usePositionStorage, usePublication, useReaderHeaderBase, useReaderSetting, useReaderTransitions, useSettingsComponentStatus, useSpacingPresets };
|
|
6823
|
-
//# sourceMappingURL=chunk-
|
|
6824
|
-
//# sourceMappingURL=chunk-
|
|
6835
|
+
export { NavPeripheralType, NavigatorProvider, ORDERED_LINE_HEIGHT_OPTIONS, StatefulActionIcon, StatefulAudioAutoPlay, StatefulAudioPlaybackRateContainer, StatefulAudioPlaybackRateTrigger, StatefulAudioRemotePlaybackTrigger, StatefulAudioSettingsContainer, StatefulAudioSkipBackwardInterval, StatefulAudioSkipForwardInterval, StatefulAudioSkipInterval, StatefulAudioSleepTimerContainer, StatefulAudioSleepTimerTrigger, StatefulAudioTocContainer, StatefulAudioTocTrigger, StatefulAudioVolumeContainer, StatefulAudioVolumeTrigger, StatefulBackLink, StatefulBottomSheet, StatefulCollapsibleActionsBar, StatefulColumns, StatefulCompactPopoverSheet, StatefulDockedSheet, StatefulDockingWrapper, StatefulDropdown, StatefulFontFamily, StatefulFullScreenSheet, StatefulFullscreenTrigger, StatefulGlobalPreferencesProvider, StatefulGroupWrapper, StatefulHyphens, StatefulJumpToPositionContainer, StatefulJumpToPositionTrigger, StatefulLayout, StatefulLetterSpacing, StatefulLigatures, StatefulLineHeight, StatefulModalBase, StatefulModalSheet, StatefulNoRuby, StatefulNumberField, StatefulOverflowMenu, StatefulOverflowMenuItem, StatefulParagraphIndent, StatefulParagraphSpacing, StatefulPopoverSheet, StatefulPreferencesProvider, StatefulPublisherStyles, StatefulRadioGroup, StatefulSettingsTrigger, StatefulSettingsWrapper, StatefulSheetWrapper, StatefulSlider, StatefulSliderWithPresets, StatefulSpacingGroup, StatefulSpacingGroupContainer, StatefulSpacingPresets, StatefulSwitch, StatefulTextAlign, StatefulTextGroup, StatefulTextGroupContainer, StatefulTextNormalize, StatefulTheme, StatefulTocContainer, StatefulTocTrigger, StatefulVisualSettingsContainer, StatefulWordSpacing, StatefulZoom, ThPluginProvider, ThPluginRegistry, UnstableStatefulFontWeight, ZOOM_IN_KEY_COMBOS, ZOOM_OUT_KEY_COMBOS, createAudioDefaultPlugin, createDefaultPlugin, fromActionPeripheralType, fromDockingPeripheralType, thorium_web_button_default, thorium_web_overflow_default, thorium_web_reader_app_default, thorium_web_reader_header_default, toActionPeripheralType, toDockingPeripheralType, useActionComponentStatus, useDocking, useEffectiveRange, useFocusedDockableKey, useGridNavigation, useGridTemplate, useIsScroll, useLineHeight, useNavigator, usePlaceholder, usePlugins, usePositionStorage, usePublication, useReaderHeaderBase, useReaderSetting, useReaderTransitions, useSettingsComponentStatus, useSpacingPresets, useTocEntryTracking, useTocTreeBuilder };
|
|
6836
|
+
//# sourceMappingURL=chunk-LF6IMH7J.mjs.map
|
|
6837
|
+
//# sourceMappingURL=chunk-LF6IMH7J.mjs.map
|