@edrlab/thorium-web 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/{ThPreferencesAdapter-L1H6gzmu.d.mts → ThPreferencesAdapter-B3a-f5v-.d.mts} +25 -18
  2. package/dist/{ThSettingsWrapper-DWEA4hYF.d.mts → ThSettingsWrapper-DtzcwzYX.d.mts} +4 -4
  3. package/dist/{actions-BjeRjaJU.d.mts → actions-C33UN3Ji.d.mts} +18 -4
  4. package/dist/{actionsReducer-B32cq2mB.d.mts → actionsReducer-Bzcj3wk3.d.mts} +1 -1
  5. package/dist/{chunk-NUXGQWED.mjs → chunk-2NCN2AG2.mjs} +3 -3
  6. package/dist/{chunk-NUXGQWED.mjs.map → chunk-2NCN2AG2.mjs.map} +1 -1
  7. package/dist/{chunk-IVXRCKWR.mjs → chunk-2T65MDBR.mjs} +4 -4
  8. package/dist/{chunk-IVXRCKWR.mjs.map → chunk-2T65MDBR.mjs.map} +1 -1
  9. package/dist/{chunk-KVUG6BNI.mjs → chunk-63LKYJFG.mjs} +62 -56
  10. package/dist/chunk-63LKYJFG.mjs.map +1 -0
  11. package/dist/chunk-AQSJDL63.mjs +193 -0
  12. package/dist/chunk-AQSJDL63.mjs.map +1 -0
  13. package/dist/{chunk-TSLTLQ6O.mjs → chunk-BBCSLDQT.mjs} +144 -86
  14. package/dist/chunk-BBCSLDQT.mjs.map +1 -0
  15. package/dist/{chunk-QUSGPT5M.mjs → chunk-BCXKBHU3.mjs} +34 -15
  16. package/dist/chunk-BCXKBHU3.mjs.map +1 -0
  17. package/dist/{chunk-T5ENYSDJ.mjs → chunk-DQDOOTCE.mjs} +3 -3
  18. package/dist/{chunk-T5ENYSDJ.mjs.map → chunk-DQDOOTCE.mjs.map} +1 -1
  19. package/dist/chunk-GNROODJB.mjs +9 -0
  20. package/dist/chunk-GNROODJB.mjs.map +1 -0
  21. package/dist/{chunk-SZAVAQ6S.mjs → chunk-GRYEOCGD.mjs} +8 -5
  22. package/dist/chunk-GRYEOCGD.mjs.map +1 -0
  23. package/dist/{chunk-PXXWEMNL.mjs → chunk-KJ55Q63A.mjs} +220 -106
  24. package/dist/chunk-KJ55Q63A.mjs.map +1 -0
  25. package/dist/{chunk-5LUMM7FW.mjs → chunk-KOR74F6M.mjs} +9 -41
  26. package/dist/chunk-KOR74F6M.mjs.map +1 -0
  27. package/dist/{chunk-WLVE3WNW.mjs → chunk-PAFJZH7O.mjs} +12 -7
  28. package/dist/chunk-PAFJZH7O.mjs.map +1 -0
  29. package/dist/{chunk-XRFLDNAY.mjs → chunk-PRQBFBJ7.mjs} +123 -56
  30. package/dist/chunk-PRQBFBJ7.mjs.map +1 -0
  31. package/dist/{chunk-6MONB2DN.mjs → chunk-Y5X74VW7.mjs} +52 -146
  32. package/dist/chunk-Y5X74VW7.mjs.map +1 -0
  33. package/dist/{chunk-P6ILEQ5P.mjs → chunk-ZD4LTF6G.mjs} +17 -9
  34. package/dist/chunk-ZD4LTF6G.mjs.map +1 -0
  35. package/dist/components/Audio/index.css +12 -1
  36. package/dist/components/Audio/index.css.map +1 -1
  37. package/dist/components/Audio/index.d.mts +17 -15
  38. package/dist/components/Audio/index.mjs +11 -11
  39. package/dist/components/Epub/index.css +12 -1
  40. package/dist/components/Epub/index.css.map +1 -1
  41. package/dist/components/Epub/index.d.mts +14 -13
  42. package/dist/components/Epub/index.mjs +12 -12
  43. package/dist/components/Misc/index.mjs +5 -5
  44. package/dist/components/Reader/index.css +12 -1
  45. package/dist/components/Reader/index.css.map +1 -1
  46. package/dist/components/Reader/index.d.mts +12 -11
  47. package/dist/components/Reader/index.mjs +26 -24
  48. package/dist/components/Reader/index.mjs.map +1 -1
  49. package/dist/components/WebPub/index.css +12 -1
  50. package/dist/components/WebPub/index.css.map +1 -1
  51. package/dist/components/WebPub/index.d.mts +14 -13
  52. package/dist/components/WebPub/index.mjs +12 -12
  53. package/dist/core/Components/index.d.mts +7 -6
  54. package/dist/core/Components/index.mjs +2 -2
  55. package/dist/core/Helpers/index.d.mts +1 -1
  56. package/dist/core/Helpers/index.mjs +1 -1
  57. package/dist/core/Hooks/index.d.mts +6 -5
  58. package/dist/core/Hooks/index.mjs +1 -1
  59. package/dist/i18n/index.mjs +3 -3
  60. package/dist/keyboardUtilities-BCP3UcLb.d.mts +30 -0
  61. package/dist/lib/index.d.mts +17 -9
  62. package/dist/lib/index.mjs +2 -2
  63. package/dist/locales/da/thorium-web.json +37 -2
  64. package/dist/locales/fi/thorium-web.json +1 -1
  65. package/dist/locales/fr/thorium-web.json +1 -1
  66. package/dist/locales/he/thorium-web.json +9 -0
  67. package/dist/locales/it/thorium-web.json +22 -0
  68. package/dist/locales/lt/thorium-web.json +26 -1
  69. package/dist/locales/sv/thorium-web.json +22 -0
  70. package/dist/next-lib/index.mjs +1 -1
  71. package/dist/next-lib/index.mjs.map +1 -1
  72. package/dist/preferences/index.d.mts +14 -23
  73. package/dist/preferences/index.mjs +4 -4
  74. package/dist/{settingsReducer-DLaT2wUB.d.mts → settingsReducer-Pp9aoiiC.d.mts} +1 -1
  75. package/dist/{useAudioNavigator-CWXyNWq1.d.mts → useAudioNavigator-pGwxhXLj.d.mts} +4 -1
  76. package/dist/{useContrast-Bo7cDw_X.d.mts → useContrast-Bl08zDTU.d.mts} +2 -7
  77. package/dist/{usePreferences-D8NU1yhP.d.mts → usePreferences-Cy7-JN2x.d.mts} +4 -8
  78. package/dist/{useReaderTransitions-BQGzKeY2.d.mts → useReaderTransitions-Zvomj9RQ.d.mts} +30 -21
  79. package/package.json +7 -7
  80. package/dist/chunk-5LUMM7FW.mjs.map +0 -1
  81. package/dist/chunk-6MONB2DN.mjs.map +0 -1
  82. package/dist/chunk-B3WDMWCT.mjs +0 -9
  83. package/dist/chunk-B3WDMWCT.mjs.map +0 -1
  84. package/dist/chunk-KVUG6BNI.mjs.map +0 -1
  85. package/dist/chunk-MLEYTQGK.mjs +0 -60
  86. package/dist/chunk-MLEYTQGK.mjs.map +0 -1
  87. package/dist/chunk-P6ILEQ5P.mjs.map +0 -1
  88. package/dist/chunk-PXXWEMNL.mjs.map +0 -1
  89. package/dist/chunk-QUSGPT5M.mjs.map +0 -1
  90. package/dist/chunk-SZAVAQ6S.mjs.map +0 -1
  91. package/dist/chunk-TSLTLQ6O.mjs.map +0 -1
  92. package/dist/chunk-WLVE3WNW.mjs.map +0 -1
  93. package/dist/chunk-XRFLDNAY.mjs.map +0 -1
  94. package/dist/keyboardUtilities-BWAyLS_D.d.mts +0 -56
@@ -1,20 +1,20 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React__default, { RefObject, ReactNode } from 'react';
3
- import { t as ThActionsTriggerVariant, a as ThSheetHeaderVariant, s as ThCollapsibilityVisibility, h as ThActionEntry, g as ThActionsKeys, T as ThDockingKeys, e as ThSheetTypes } from './actions-BjeRjaJU.mjs';
3
+ import { w as ThActionsTriggerVariant, a as ThSheetHeaderVariant, u as ThCollapsibilityVisibility, j as ThShortcutConfig, h as ThActionEntry, g as ThActionsKeys, T as ThDockingKeys, e as ThSheetTypes } from './actions-C33UN3Ji.mjs';
4
4
  import { TooltipProps, Heading, HeadingProps, PopoverProps } from 'react-aria-components';
5
- import { T as ThActionButtonProps, f as ThMenuItemProps, a as ThCollapsibleActionsBarProps, v as ThSettingsEntry, W as WithRef, t as ThDropdownProps, h as ThNumberFieldProps, k as ThRadioGroupProps, m as ThSliderProps, o as ThSliderWithPresetsProps, q as ThSwitchProps } from './ThSettingsWrapper-DWEA4hYF.mjs';
6
- import { h as ThTextSettingsKeys, b as ThSpacingSettingsKeys, j as ThSettingsGroupPref, o as ThSettingsRangePlaceholder, g as ThSettingsKeys, a as ThSpacingPresetKeys, T as ThLineHeightOptions } from './useContrast-Bo7cDw_X.mjs';
5
+ import { T as ThActionButtonProps, f as ThMenuItemProps, a as ThCollapsibleActionsBarProps, v as ThSettingsEntry, W as WithRef, t as ThDropdownProps, h as ThNumberFieldProps, k as ThRadioGroupProps, m as ThSliderProps, o as ThSliderWithPresetsProps, q as ThSwitchProps } from './ThSettingsWrapper-DtzcwzYX.mjs';
6
+ import { h as ThTextSettingsKeys, b as ThSpacingSettingsKeys, j as ThSettingsGroupPref, o as ThSettingsRangePlaceholder, g as ThSettingsKeys, T as ThLineHeightOptions, a as ThSpacingPresetKeys } from './useContrast-Bl08zDTU.mjs';
7
7
  import { PressEvent } from 'react-aria';
8
- import { f as SettingsReducerState } from './settingsReducer-DLaT2wUB.mjs';
8
+ import { f as SettingsReducerState } from './settingsReducer-Pp9aoiiC.mjs';
9
9
  import { WebPubSettingsReducerState, ReaderProfile } from './lib/index.mjs';
10
- import { A as ActionsStateKeys } from './actionsReducer-B32cq2mB.mjs';
11
- import { d as ThPreferences, D as DefaultKeys, e as ThGlobalPreferences, C as CustomizableKeys, c as ThPreferencesAdapter } from './ThPreferencesAdapter-L1H6gzmu.mjs';
10
+ import { A as ActionsStateKeys } from './actionsReducer-Bzcj3wk3.mjs';
11
+ import { e as ThPreferences, D as DefaultKeys, f as ThGlobalPreferences, C as CustomizableKeys, d as ThPreferencesAdapter } from './ThPreferencesAdapter-B3a-f5v-.mjs';
12
12
  import * as _readium_navigator from '@readium/navigator';
13
13
  import { EpubSettings, WebPubSettings, FXLFrameManager, FrameManager, ScriptMode, WebPubFrameManager } from '@readium/navigator';
14
14
  import * as _readium_shared from '@readium/shared';
15
15
  import { Locator, Link, Publication, Fetcher } from '@readium/shared';
16
- import { E as EpubNavigatorLoadProps, W as WebPubNavigatorLoadProps, A as AudioNavigatorLoadProps, c as AudioSettings, a as useEpubNavigator, b as useWebPubNavigator, u as useAudioNavigator } from './useAudioNavigator-CWXyNWq1.mjs';
17
- import { a as ThAudioPreferences, c as ThAudioPreferencesAdapter } from './usePreferences-D8NU1yhP.mjs';
16
+ import { E as EpubNavigatorLoadProps, W as WebPubNavigatorLoadProps, A as AudioNavigatorLoadProps, c as AudioSettings, a as useEpubNavigator, b as useWebPubNavigator, u as useAudioNavigator } from './useAudioNavigator-pGwxhXLj.mjs';
17
+ import { a as ThAudioPreferences, c as ThAudioPreferencesAdapter } from './usePreferences-Cy7-JN2x.mjs';
18
18
  import { InitOptions } from 'i18next';
19
19
  import { P as ProcessedError } from './errorHandler-CL2YIfQY.mjs';
20
20
 
@@ -63,11 +63,12 @@ interface StatefulActionIconProps extends ThActionButtonProps {
63
63
  visibility?: ThCollapsibilityVisibility;
64
64
  placement?: TooltipProps["placement"];
65
65
  tooltipLabel?: string;
66
+ shortcut?: ThShortcutConfig | null;
66
67
  }
67
- declare const StatefulActionIcon: ({ ref: externalRef, visibility, placement, tooltipLabel, children, ...props }: StatefulActionIconProps) => react_jsx_runtime.JSX.Element;
68
+ declare const StatefulActionIcon: ({ ref: externalRef, visibility, placement, tooltipLabel, shortcut, children, ...props }: StatefulActionIconProps) => react_jsx_runtime.JSX.Element;
68
69
 
69
70
  interface StatefulOverflowMenuItemProps extends Omit<ThMenuItemProps, "shortcut"> {
70
- shortcut?: string | null;
71
+ shortcut?: ThShortcutConfig | null;
71
72
  }
72
73
  declare const StatefulOverflowMenuItem: ({ id, label, SVGIcon, shortcut, ...props }: StatefulOverflowMenuItemProps) => react_jsx_runtime.JSX.Element;
73
74
 
@@ -261,15 +262,22 @@ declare const StatefulSpacingPresets: ({ standalone }: StatefulSettingsItemProps
261
262
 
262
263
  declare const StatefulWordSpacing: ({ standalone }: StatefulSettingsItemProps) => react_jsx_runtime.JSX.Element;
263
264
 
264
- /**
265
- * Hook that returns a mapping of line height options to their actual numeric values
266
- * This eliminates code duplication across spacing components
267
- */
265
+ declare const ORDERED_LINE_HEIGHT_OPTIONS: readonly [ThLineHeightOptions.small, ThLineHeightOptions.medium, ThLineHeightOptions.large];
268
266
  declare const useLineHeight: () => {
269
- publisher: null;
270
- small: any;
271
- medium: any;
272
- large: any;
267
+ values: {
268
+ publisher: null;
269
+ small: any;
270
+ medium: any;
271
+ large: any;
272
+ };
273
+ compensatedValues: {
274
+ publisher: null;
275
+ small: number | null;
276
+ medium: number | null;
277
+ large: number | null;
278
+ };
279
+ processedValues: Record<ThLineHeightOptions.small | ThLineHeightOptions.medium | ThLineHeightOptions.large, number>;
280
+ compensate: (v: number | null) => number | null;
273
281
  };
274
282
 
275
283
  /**
@@ -366,12 +374,12 @@ declare const StatefulBottomSheet: ({ id, heading, headerVariant, className, isO
366
374
  interface StatefulCompactPopoverSheetProps extends StatefulSheet {
367
375
  placement?: PopoverProps["placement"];
368
376
  }
369
- declare const StatefulCompactPopoverSheet: ({ id, triggerRef, heading, className, isOpen, onOpenChange, placement, children, resetFocus, focusWithinRef, focusSelector, scrollTopOnFocus, dismissEscapeKeyClose }: StatefulCompactPopoverSheetProps) => react_jsx_runtime.JSX.Element | undefined;
377
+ declare const StatefulCompactPopoverSheet: ({ triggerRef, heading, className, isOpen, onOpenChange, placement, children, resetFocus, focusWithinRef, focusSelector, scrollTopOnFocus, dismissEscapeKeyClose }: StatefulCompactPopoverSheetProps) => react_jsx_runtime.JSX.Element | undefined;
370
378
 
371
379
  interface StatefulDockedSheetProps extends StatefulSheet {
372
380
  flow: ThDockingKeys.start | ThDockingKeys.end | null;
373
381
  }
374
- declare const StatefulDockedSheet: ({ id, heading, headerVariant, className, isOpen, onClosePress, docker, flow, children, resetFocus, focusSelector, focusWithinRef, scrollTopOnFocus }: StatefulDockedSheetProps) => react_jsx_runtime.JSX.Element | undefined;
382
+ declare const StatefulDockedSheet: ({ id, heading, headerVariant, className, isOpen, onClosePress, docker, flow, children, resetFocus, focusSelector, focusWithinRef }: StatefulDockedSheetProps) => react_jsx_runtime.JSX.Element | undefined;
375
383
 
376
384
  interface StatefulFullScreenSheetProps extends StatefulSheet {
377
385
  }
@@ -514,6 +522,7 @@ interface StatefulReaderProps {
514
522
  localDataKey: string | null;
515
523
  plugins?: ThPlugin[];
516
524
  positionStorage?: PositionStorage;
525
+ containerRefSetter?: (el: Element | null) => void;
517
526
  }
518
527
  type ThPluginFactory = () => ThPlugin[] | Promise<ThPlugin[]>;
519
528
  interface ReaderPlugins {
@@ -578,4 +587,4 @@ interface ReaderTransitions {
578
587
  }
579
588
  declare const useReaderTransitions: () => ReaderTransitions;
580
589
 
581
- export { StatefulSpacingGroup as $, StatefulGroupWrapper as A, type StatefulDropdownProps as B, StatefulDropdown as C, type StatefulNumberFieldProps as D, StatefulNumberField as E, type StatefulRadioGroupProps as F, StatefulRadioGroup as G, type StatefulSliderProps as H, StatefulSlider as I, type StatefulSliderWithPresetsProps as J, StatefulSliderWithPresets as K, type StatefulSwitchProps as L, StatefulSwitch as M, useEffectiveRange as N, type useGridNavigationProps as O, useGridNavigation as P, useGridTemplate as Q, usePlaceholder as R, type StatefulActionsMapObject as S, type ThPlugin as T, useReaderSetting as U, useSettingsComponentStatus as V, type StatefulSettingsItemProps as W, StatefulLetterSpacing as X, StatefulLineHeight as Y, StatefulParagraphIndent as Z, StatefulParagraphSpacing as _, usePublication as a, StatefulSpacingGroupContainer as a0, StatefulSpacingPresets as a1, StatefulWordSpacing as a2, useLineHeight as a3, useSpacingPresets as a4, StatefulFontFamily as a5, UnstableStatefulFontWeight as a6, StatefulHyphens as a7, StatefulTextAlign as a8, StatefulTextGroup as a9, type PositionStorage as aA, type StatefulReaderProps as aB, type ThPluginFactory as aC, type ReaderPlugins as aD, type ReaderComponentProps as aE, StatefulReaderWrapper as aF, StatefulTextGroupContainer as aa, StatefulTextNormalize as ab, StatefulLigatures as ac, StatefulNoRuby as ad, StatefulPublisherStyles as ae, StatefulTheme as af, StatefulZoom as ag, type StatefulBottomSheetProps as ah, type ScrimPref as ai, StatefulBottomSheet as aj, type StatefulCompactPopoverSheetProps as ak, StatefulCompactPopoverSheet as al, type StatefulDockedSheetProps as am, StatefulDockedSheet as an, type StatefulFullScreenSheetProps as ao, StatefulFullScreenSheet as ap, type StatefulModalSheetProps as aq, StatefulModalSheet as ar, type StatefulPopoverSheetProps as as, StatefulPopoverSheet as at, type StatefulModalBaseProps as au, StatefulModalBase as av, StatefulSheetWrapper as aw, type StatefulSheet as ax, StatefulPreferencesProvider as ay, StatefulGlobalPreferencesProvider as az, useReaderTransitions as b, type StatefulActionTriggerProps as c, type StatefulActionContainerProps as d, StatefulFullscreenTrigger as e, StatefulJumpToPositionContainer as f, StatefulJumpToPositionTrigger as g, StatefulSettingsWrapper as h, StatefulAudioSettingsContainer as i, StatefulVisualSettingsContainer as j, StatefulSettingsTrigger as k, StatefulTocContainer as l, StatefulTocTrigger as m, type StatefulActionIconProps as n, StatefulActionIcon as o, type StatefulOverflowMenuItemProps as p, StatefulOverflowMenuItem as q, type StatefulCollapsibleActionsBarProps as r, StatefulCollapsibleActionsBar as s, type StatefulOverflowMenuProps as t, useNavigator as u, StatefulOverflowMenu as v, useDocking as w, createDefaultPlugin as x, createAudioDefaultPlugin as y, type StatefulGroupWrapperProps as z };
590
+ export { StatefulSpacingGroup as $, StatefulGroupWrapper as A, type StatefulDropdownProps as B, StatefulDropdown as C, type StatefulNumberFieldProps as D, StatefulNumberField as E, type StatefulRadioGroupProps as F, StatefulRadioGroup as G, type StatefulSliderProps as H, StatefulSlider as I, type StatefulSliderWithPresetsProps as J, StatefulSliderWithPresets as K, type StatefulSwitchProps as L, StatefulSwitch as M, useEffectiveRange as N, type useGridNavigationProps as O, useGridNavigation as P, useGridTemplate as Q, usePlaceholder as R, type StatefulActionsMapObject as S, type ThPlugin as T, useReaderSetting as U, useSettingsComponentStatus as V, type StatefulSettingsItemProps as W, StatefulLetterSpacing as X, StatefulLineHeight as Y, StatefulParagraphIndent as Z, StatefulParagraphSpacing as _, usePublication as a, StatefulSpacingGroupContainer as a0, StatefulSpacingPresets as a1, StatefulWordSpacing as a2, ORDERED_LINE_HEIGHT_OPTIONS as a3, useLineHeight as a4, useSpacingPresets as a5, StatefulFontFamily as a6, UnstableStatefulFontWeight as a7, StatefulHyphens as a8, StatefulTextAlign as a9, StatefulGlobalPreferencesProvider as aA, type PositionStorage as aB, type StatefulReaderProps as aC, type ThPluginFactory as aD, type ReaderPlugins as aE, type ReaderComponentProps as aF, StatefulReaderWrapper as aG, StatefulTextGroup as aa, StatefulTextGroupContainer as ab, StatefulTextNormalize as ac, StatefulLigatures as ad, StatefulNoRuby as ae, StatefulPublisherStyles as af, StatefulTheme as ag, StatefulZoom as ah, type StatefulBottomSheetProps as ai, type ScrimPref as aj, StatefulBottomSheet as ak, type StatefulCompactPopoverSheetProps as al, StatefulCompactPopoverSheet as am, type StatefulDockedSheetProps as an, StatefulDockedSheet as ao, type StatefulFullScreenSheetProps as ap, StatefulFullScreenSheet as aq, type StatefulModalSheetProps as ar, StatefulModalSheet as as, type StatefulPopoverSheetProps as at, StatefulPopoverSheet as au, type StatefulModalBaseProps as av, StatefulModalBase as aw, StatefulSheetWrapper as ax, type StatefulSheet as ay, StatefulPreferencesProvider as az, useReaderTransitions as b, type StatefulActionTriggerProps as c, type StatefulActionContainerProps as d, StatefulFullscreenTrigger as e, StatefulJumpToPositionContainer as f, StatefulJumpToPositionTrigger as g, StatefulSettingsWrapper as h, StatefulAudioSettingsContainer as i, StatefulVisualSettingsContainer as j, StatefulSettingsTrigger as k, StatefulTocContainer as l, StatefulTocTrigger as m, type StatefulActionIconProps as n, StatefulActionIcon as o, type StatefulOverflowMenuItemProps as p, StatefulOverflowMenuItem as q, type StatefulCollapsibleActionsBarProps as r, StatefulCollapsibleActionsBar as s, type StatefulOverflowMenuProps as t, useNavigator as u, StatefulOverflowMenu as v, useDocking as w, createDefaultPlugin as x, createAudioDefaultPlugin as y, type StatefulGroupWrapperProps as z };
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "bugs": {
21
21
  "url": "https://github.com/edrlab/thorium-web/issues"
22
22
  },
23
- "version": "1.4.0",
23
+ "version": "1.5.0",
24
24
  "private": false,
25
25
  "files": [
26
26
  "./dist"
@@ -64,9 +64,9 @@
64
64
  "increment": "node scripts/increment.mjs"
65
65
  },
66
66
  "peerDependencies": {
67
- "@readium/css": "^2.0.2",
68
- "@readium/navigator": "^2.5.0",
69
- "@readium/navigator-html-injectables": "^2.4.0",
67
+ "@readium/css": "^2.0.4",
68
+ "@readium/navigator": "^2.5.3",
69
+ "@readium/navigator-html-injectables": "^2.4.2",
70
70
  "@readium/shared": "^2.2.0",
71
71
  "@reduxjs/toolkit": "^2.11.2",
72
72
  "i18next": "^25.8.13",
@@ -85,9 +85,9 @@
85
85
  },
86
86
  "dependencies": {
87
87
  "@edrlab/thorium-locales": "github:edrlab/thorium-locales",
88
- "@readium/css": "^2.0.2",
89
- "@readium/navigator": "^2.5.0",
90
- "@readium/navigator-html-injectables": "^2.4.0",
88
+ "@readium/css": "^2.0.4",
89
+ "@readium/navigator": "^2.5.3",
90
+ "@readium/navigator-html-injectables": "^2.4.2",
91
91
  "@readium/shared": "^2.2.0",
92
92
  "@reduxjs/toolkit": "^2.11.2",
93
93
  "classnames": "^2.5.1",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/Helpers/getPlatform.ts","../src/core/Helpers/keyboardUtilities.ts"],"names":["UnstableShortcutMetaKeywords","UnstableShortcutRepresentation"],"mappings":";AAcO,IAAM,cAAc,MAAM;AAC/B,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACjC,IAAA,MAAM,MAAM,MAAA,CAAO,SAAA;AAEnB,IAAA,IAAI,IAAI,aAAA,EAAe;AACrB,MAAA,OAAO,GAAA,CAAI,aAAA,CAAc,QAAA,CAAS,WAAA,EAAY;AAAA,IAChD;AAGA,IAAA,IAAI,OAAO,GAAA,CAAI,QAAA,KAAa,WAAA,EAAa;AAEvC,MAAA,IAAI,OAAO,GAAA,CAAI,SAAA,KAAc,WAAA,IAAe,SAAA,CAAU,KAAK,GAAA,CAAI,SAAA,CAAU,WAAA,EAAa,CAAA,EAAG;AACvF,QAAA,OAAO,SAAA;AAAA,MACT;AACA,MAAA,OAAO,GAAA,CAAI,SAAS,WAAA,EAAY;AAAA,IAClC;AAAA,EACF;AAEA,EAAA,OAAO,SAAA;AACT;AAEO,IAAM,WA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AAS,KAAA;AAAA,MACT,WAAA,EAAa,KAAA;AAAA,MACb,QAAA,EAAU;AAAA;AACZ,GACF;AAEA,EAAA,MAAM,aAAA,GAAgB,GAAA,CAAI,KAAA,CAAM,cAAc,CAAA;AAE9C,EAAA,aAAA,CAAc,MAAA,CAAO,CAAC,GAAA,KAAQ;AAC5B,IAAA,IAAK,OAAO,MAAA,CAAO,4BAA4B,CAAA,CAAe,QAAA,CAAS,GAAG,CAAA,EAAG;AAC3E,MAAA,MAAM,UAAA,GAAa,IAAI,IAAA,EAAK;AAC5B,MAAA,WAAA,CAAY,SAAA,CAAU,UAAU,CAAA,GAAI,IAAA;AAAA,IACtC,CAAA,MAAO;AACL,MAAA,WAAA,CAAY,IAAA,GAAO,GAAA,CAAI,IAAA,EAAK,CAAE,WAAA,EAAY;AAC1C,MAAA,WAAA,CAAY,MAAM,CAAA,GAAA,EAAO,GAAA,CAAI,IAAA,EAAK,CAAE,aAAc,CAAA,CAAA;AAAA,IACpD;AAAA,EACF,CAAC,CAAA;AAED,EAAA,OAAO,WAAA,CAAY,MAAM,WAAA,GAAc,IAAA;AACzC","file":"chunk-5LUMM7FW.mjs","sourcesContent":["\"use client\";\n\n// Extend Navigator interface to include userAgentData\ndeclare global {\n interface Navigator {\n userAgentData?: {\n brands: Array<{brand: string; version: string}>;\n mobile: boolean;\n platform: string;\n };\n }\n}\n\n// See https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgentData\nexport const getPlatform = () => {\n if (typeof window !== \"undefined\") {\n const nav = window.navigator;\n\n if (nav.userAgentData) {\n return nav.userAgentData.platform.toLowerCase();\n }\n\n // Deprecated but userAgentData still experimental…\n if (typeof nav.platform !== \"undefined\") {\n // android navigator.platform is often set as \"linux\", so we have to check userAgent\n if (typeof nav.userAgent !== \"undefined\" && /android/.test(nav.userAgent.toLowerCase())) {\n return \"android\";\n }\n return nav.platform.toLowerCase();\n }\n }\n\n return \"unknown\";\n};\n\nexport const isMacish = () => {\n const MacOSPattern = /mac|ipod|iphone|ipad/i;\n const platform = getPlatform();\n return MacOSPattern.test(platform);\n}\n\n// “Desktop-class” iPadOS\nexport const isIpadOS = () => {\n return !!(navigator.maxTouchPoints \n && navigator.maxTouchPoints > 2 \n && navigator.userAgent.includes(\"Intel\"));\n}\n\n// Stopgap measure for fullscreen on iPadOS, do not use elsewhere\nexport const isIOSish = () => {\n const AppleMobilePattern = /ipod|iphone|ipad/i;\n const platform = getPlatform();\n if (AppleMobilePattern.test(platform)) {\n return true;\n } else {\n return isIpadOS();\n }\n}","\"use client\";\n\nimport { isMacish } from \"./getPlatform\";\n\nexport interface UnstableKey {\n [key: string]: string;\n longform: string;\n shortform: string;\n}\n\nexport interface UnstableMetaKey extends UnstableKey {\n modifier: \"altKey\" | \"ctrlKey\" | \"metaKey\" | \"shiftKey\";\n symbol: \"⌥\" | \"^\" | \"⌘\" | \"⊞\" | \"⇧\";\n}\n\nexport interface UnstablePlatformModifier extends UnstableKey {\n modifier: \"ctrlKey\" | \"metaKey\";\n symbol: \"^\" | \"⌘\";\n}\n\nexport interface UnstableMetaKeys {\n [key: string]: UnstableMetaKey;\n altKey: UnstableMetaKey;\n ctrlKey: UnstableMetaKey;\n metaKey: UnstableMetaKey;\n shiftKey: UnstableMetaKey;\n}\n\nexport enum UnstableShortcutMetaKeywords {\n alt = \"altKey\",\n ctrl = \"ctrlKey\",\n meta = \"metaKey\",\n platform = \"platformKey\",\n shift = \"shiftKey\"\n}\n\nexport enum UnstableShortcutRepresentation {\n symbol = \"symbol\",\n short = \"shortform\",\n long = \"longform\"\n};\n\nexport interface UnstableShortcut {\n className?: string;\n rawForm: string;\n representation?: UnstableShortcutRepresentation; \n joiner?: string;\n}\n\nexport interface UnstablePShortcut {\n key?: string;\n char?: string;\n modifiers: {\n [key: string]: boolean;\n altKey: boolean;\n ctrlKey: boolean;\n metaKey: boolean;\n platformKey: boolean;\n shiftKey: boolean;\n }\n}\n\nconst altModifier: UnstableMetaKey = {\n longform: \"Option\",\n shortform: \"Alt\",\n modifier: \"altKey\",\n symbol: \"⌥\"\n}\n\nconst ctrlModifier: UnstableMetaKey & UnstablePlatformModifier = {\n longform: \"Control\",\n shortform: \"Ctrl\",\n modifier: \"ctrlKey\",\n symbol: \"^\"\n}\n\nconst metaModifierMac: UnstableMetaKey & UnstablePlatformModifier = {\n longform: \"Command\",\n shortform: \"Cmd\",\n modifier: \"metaKey\",\n symbol: \"⌘\" \n}\n\nconst metaModifierWin: UnstableMetaKey = {\n longform: \"Windows\",\n shortform: \"Win\",\n modifier: \"metaKey\",\n symbol: \"⊞\"\n}\n\nconst shiftModifier: UnstableMetaKey = {\n longform: \"Shift\",\n shortform: \"Shift\",\n modifier: \"shiftKey\",\n symbol: \"⇧\"\n}\n\nexport const metaKeys: UnstableMetaKeys = {\n altKey: altModifier,\n ctrlKey: ctrlModifier,\n metaKey: isMacish() ? metaModifierMac : metaModifierWin,\n shiftKey: shiftModifier\n}\n\n// Platform modifier differs from Mac to Windows so we have to get it dynamically\n\nexport const defaultPlatformModifier = ctrlModifier;\n\nexport const getPlatformModifier = (): UnstablePlatformModifier => {\n if (isMacish()) {\n return metaModifierMac;\n } else {\n return ctrlModifier;\n }\n}\n\nexport const buildShortcut = (str: string) => {\n let shortcutObj: UnstablePShortcut = {\n key: \"\",\n char: \"\",\n modifiers: {\n altKey: false,\n ctrlKey: false,\n metaKey: false,\n platformKey: false,\n shiftKey: false\n }\n }\n \n const shortcutArray = str.split(/\\s*?[+-]\\s*?/);\n\n shortcutArray.filter((val) => {\n if ((Object.values(UnstableShortcutMetaKeywords) as string[]).includes(val)) {\n const trimmedKey = val.trim();\n shortcutObj.modifiers[trimmedKey] = true;\n } else {\n shortcutObj.char = val.trim().toUpperCase();\n shortcutObj.key = `Key${ val.trim().toUpperCase() }`;\n }\n });\n\n return shortcutObj.key ? shortcutObj : null;\n}"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/StatefulReaderRunningHead.tsx","../src/components/StatefulReaderHeader.tsx","../src/components/assets/styles/thorium-web.reader.pagination.module.css","../src/components/assets/styles/thorium-web.reader.progression.module.css","../src/core/Components/Reader/ThProgression.tsx","../src/components/StatefulReaderProgression.tsx","../src/components/StatefulReaderPagination.tsx","../src/components/StatefulReaderFooter.tsx","../src/core/Hooks/fonts/androidPatchCss.ts","../src/core/Hooks/fonts/useFonts.ts","../src/helpers/peripherals.ts","../src/components/Helpers/getReaderClassNames.ts"],"names":["Fragment","jsx","wrapper","listItem","leftButton","progression","rightButton","label","useMemo","classNames","useRef","jsxs","useCallback","useEffect"],"mappings":";;;;;;;;;;;;;;AAcO,IAAM,4BAA4B,CAAC;AAAA,EACxC;AACF,CAAA,KAEM;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,OAAA,EAAQ;AAEtB,EAAA,MAAM,gBAAA,GAAmB,cAAA,CAAe,CAAA,KAAA,KAAS,KAAA,CAAM,YAAY,gBAAgB,CAAA;AACnF,EAAA,MAAM,WAAA,GAAc,cAAA,CAAe,CAAA,KAAA,KAAS,KAAA,CAAM,OAAO,WAAW,CAAA;AACpE,EAAA,MAAM,UAAA,GAAa,cAAA,CAAe,CAAA,KAAA,KAAS,KAAA,CAAM,OAAO,UAAU,CAAA;AAClE,EAAA,MAAM,YAAA,GAAe,cAAA,CAAe,CAAA,KAAA,KAAS,KAAA,CAAM,OAAO,YAAY,CAAA;AACtE,EAAA,MAAM,UAAA,GAAa,cAAA,CAAe,CAAA,KAAA,KAAS,KAAA,CAAM,QAAQ,UAAU,CAAA;AAGnE,EAAA,MAAM,cAAA,GAAiB,QAAgD,OAAO;AAAA,IAC5E,QAAA,EAAA,OAAA;AAAA,IACA,kBAAA,EAAoB,IAAA;AAAA,IACpB,mBAAA,EAAqB;AAAA,GACvB,CAAA,EAAI,EAAE,CAAA;AAEN,EAAA,MAAM,cAAA,GAAiB,QAAQ,MAAM;AACnC,IAAA,OAAO,kBAAA,CAA2D;AAAA,MAChE,YAAA,EAAc,YAAY,OAAA,IAAW,cA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GACF,GAAI,OAAA;AAEJ,EAAA,OAAOJ,UAAAA;AAAA,IACL,8BAAA,CAAa,KAAA;AAAA,IACb,WAAW,sBAAA,GAAyB,qBAAA;AAAA,IACpC,WAAA,IAAe,yBAAA;AAAA,IACf,UAAA,IAAc,wBAAA;AAAA,IACd,QAAQ,mBAAA,GAAsB,sBAAA;AAAA,IAC9B,eAAe,QAAQ,CAAA;AAAA,IACvB,UAAA,GAAa,CAAA,cAAA,EAAkB,UAAA,CAAW,MAAA,CAAO,CAAC,CAAA,CAAE,WAAA,EAAY,GAAI,UAAA,CAAW,KAAA,CAAM,CAAC,CAAE,CAAA,CAAA,GAAK;AAAA,GAC/F;AACF","file":"chunk-6MONB2DN.mjs","sourcesContent":["\"use client\";\n\nimport { useMemo } from \"react\";\n\nimport { ThRunningHeadFormat } from \"@/preferences/models\";\nimport { ThFormatPref, ThFormatPrefValue } from \"@/preferences\";\n\nimport { ThRunningHead } from \"@/core/Components\";\n\nimport { useI18n } from \"@/i18n/useI18n\";\n\nimport { useAppSelector } from \"@/lib/hooks\";\nimport { makeBreakpointsMap } from \"@/core/Helpers/breakpointsMap\";\n\nexport const StatefulReaderRunningHead = ({ \n formatPref\n}: {\n formatPref?: ThFormatPref<ThRunningHeadFormat>;\n}) => {\n const { t } = useI18n();\n \n const unstableTimeline = useAppSelector(state => state.publication.unstableTimeline);\n const isImmersive = useAppSelector(state => state.reader.isImmersive);\n const isHovering = useAppSelector(state => state.reader.isHovering);\n const isFullscreen = useAppSelector(state => state.reader.isFullscreen);\n const breakpoint = useAppSelector(state => state.theming.breakpoint);\n\n // Get the fallback format based on isFXL\n const fallbackFormat = useMemo<ThFormatPrefValue<ThRunningHeadFormat>>(() => ({\n variants: ThRunningHeadFormat.title,\n displayInImmersive: true,\n displayInFullscreen: true\n }), []);\n\n const breakpointsMap = useMemo(() => {\n return makeBreakpointsMap<ThFormatPrefValue<ThRunningHeadFormat>>({\n defaultValue: formatPref?.default || fallbackFormat,\n fromEnum: ThRunningHeadFormat,\n pref: formatPref?.breakpoints,\n validateKey: \"variants\"\n });\n }, [formatPref, fallbackFormat]);\n \n // Get current preferences with proper fallback\n const currentPrefs = useMemo(() => {\n if (!breakpoint) return formatPref?.default || fallbackFormat;\n return breakpointsMap[breakpoint] || formatPref?.default || fallbackFormat;\n }, [breakpoint, breakpointsMap, formatPref?.default, fallbackFormat]);\n\n const { variants, displayInImmersive, displayInFullscreen } = currentPrefs;\n\n const displayFormat = useMemo(() => {\n if (!variants) return ThRunningHeadFormat.title;\n \n // Check if we should hide in immersive mode\n if (isImmersive && displayInImmersive === false && !isHovering) {\n return ThRunningHeadFormat.none;\n }\n \n // Check if we should hide in fullscreen mode\n if (isImmersive && isFullscreen && displayInFullscreen === false && !isHovering) {\n return ThRunningHeadFormat.none;\n }\n \n return variants;\n }, [variants, isImmersive, displayInImmersive, isHovering, isFullscreen, displayInFullscreen]);\n\n const runningHead = useMemo(() => {\n if (displayFormat === ThRunningHeadFormat.title) {\n return unstableTimeline?.title || \"\";\n } else if (displayFormat === ThRunningHeadFormat.chapter) {\n return unstableTimeline?.progression?.currentChapter || unstableTimeline?.title || \"\";\n }\n return \"\";\n }, [displayFormat, unstableTimeline]);\n\n if (!runningHead || displayFormat === ThRunningHeadFormat.none) return null;\n \n return (\n <>\n <ThRunningHead \n label={ runningHead } \n aria-label={ t(\"reader.app.header.runningHead\") }\n />\n </>\n );\n}","\"use client\";\n\nimport React from \"react\";\n\nimport { ActionKeyType } from \"@/preferences\";\nimport { ThLayoutUI, ThRunningHeadFormat } from \"@/preferences/models\";\nimport { ThFormatPref } from \"@/preferences\";\n\nimport readerStyles from \"./assets/styles/thorium-web.reader.app.module.css\";\nimport readerHeaderStyles from \"./assets/styles/thorium-web.reader.header.module.css\";\nimport overflowMenuStyles from \"./Actions/assets/styles/thorium-web.overflow.module.css\";\n\nimport { ThHeader } from \"@/core/Components/Reader/ThHeader\";\nimport { StatefulBackLink } from \"./StatefulBackLink\";\nimport { StatefulReaderRunningHead } from \"./StatefulReaderRunningHead\";\nimport { ThInteractiveOverlay } from \"../core/Components/Reader/ThInteractiveOverlay\";\nimport { StatefulCollapsibleActionsBar } from \"./Actions/StatefulCollapsibleActionsBar\";\n\nimport { useReaderHeaderBase } from \"./hooks/useReaderHeaderBase\";\nimport { usePreferences } from \"@/preferences/hooks\";\n\nimport classNames from \"classnames\";\n\nexport const StatefulReaderHeader = ({\n actionKeys,\n actionsOrder,\n layout,\n runningHeadFormatPref\n}: {\n actionKeys: ActionKeyType[];\n actionsOrder: ActionKeyType[];\n layout: ThLayoutUI;\n runningHeadFormatPref?: ThFormatPref<ThRunningHeadFormat>;\n}) => {\n const {\n headerRef, focusWithinProps, setHover, removeHover,\n listActionItems, isImmersive, isHovering, isScroll, t,\n } = useReaderHeaderBase(actionKeys);\n\n const { preferences } = usePreferences();\n\n return (\n <>\n <ThInteractiveOverlay\n className={ classNames(readerStyles.barOverlay, readerStyles.headerOverlay) }\n isActive={ layout === ThLayoutUI.layered && isImmersive && !isHovering }\n onMouseEnter={ setHover }\n onMouseLeave={ removeHover }\n />\n\n <ThHeader\n ref={ headerRef }\n className={ classNames(readerStyles.topBar, readerHeaderStyles.header) }\n aria-label={ t(\"reader.app.header.label\") }\n onMouseEnter={ setHover }\n onMouseLeave={ removeHover }\n { ...focusWithinProps }\n >\n { preferences.theming.header?.backLink && <StatefulBackLink className={ readerHeaderStyles.backlinkWrapper } /> }\n\n <StatefulReaderRunningHead formatPref={ runningHeadFormatPref } />\n\n <StatefulCollapsibleActionsBar\n id=\"reader-header-overflowMenu\"\n items={ listActionItems() }\n prefs={{ ...preferences.actions, displayOrder: actionsOrder }}\n className={ readerHeaderStyles.actionsWrapper }\n aria-label={ t(\"reader.app.header.actions\") }\n overflowMenuClassName={\n (!isScroll || preferences.affordances.scroll.hintInImmersive)\n ? overflowMenuStyles.hint\n : undefined\n }\n />\n </ThHeader>\n </>\n );\n};\n",".wrapper {\n box-sizing: border-box;\n display: grid;\n gap: calc(var(--th-layout-spacing) / 2);\n grid-template-areas: \"pagination-start pagination-center pagination-end\";\n grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);\n background-color: var(--th-theme-background);\n color: var(--th-theme-text);\n align-items: center;\n width: 100%;\n max-width: var(--th-layout-constraints-pagination, 100%);\n}\n\n.listItem {\n box-sizing: border-box;\n list-style: none;\n}\n\n.listItem:has(.leftButton) {\n grid-area: pagination-start;\n justify-self: start;\n}\n\n.listItem:has(.progression) {\n grid-area: pagination-center;\n justify-self: center;\n}\n\n.listItem:has(.rightButton) {\n grid-area: pagination-end;\n justify-self: end;\n}\n\n\n.listItem button {\n box-sizing: border-box;\n padding: calc(var(--th-icon-size, 24px) * (1/4)) calc(var(--th-layout-spacing) / 2);\n gap: calc(var(--th-layout-spacing) / 2);\n max-height: calc(var(--th-icon-size, 24px) * 2);\n max-width: 100%;\n border-radius: var(--th-layout-radius);\n display: flex;\n align-items: center;\n}\n\n.rightButton {\n margin-inline-start: auto;\n text-align: end;\n}\n\n.listItem button[data-hovered] {\n background-color: var(--th-theme-hover);\n color: var(--th-theme-onHover);\n}\n\n.listItem button[data-focus-visible] {\n outline: 2px solid var(--th-theme-focus);\n}\n\n.listItem button[data-disabled] {\n color: var(--th-theme-disable);\n}\n\n.listItem button .label {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n overflow: hidden;\n white-space: normal;\n -webkit-line-clamp: 1;\n line-clamp: 1;\n}\n\n.listItem button svg {\n flex: none;\n width: var(--th-icon-size, 24px);\n height: var(--th-icon-size, 24px);\n fill: currentColor;\n}",".wrapper {\n color: var(--th-theme-text);\n font-variant-numeric: lining-nums tabular-nums;\n text-align: center;\n}","\"use client\";\n\nimport React from \"react\";\n\nexport interface ThProgressionProps extends React.HTMLAttributes<HTMLDivElement> {\n ref?: React.RefObject<HTMLDivElement>\n}\n\nexport const ThProgression = ({ \n ref,\n children, \n ...props\n}: ThProgressionProps) => {\n return (\n <>\n <div \n ref={ ref } \n {...props }\n >\n { children }\n </div>\n </>\n )\n}","\"use client\";\n\nimport { useMemo } from \"react\";\n\nimport progressionStyles from \"./assets/styles/thorium-web.reader.progression.module.css\";\n\nimport { ThProgressionFormat } from \"@/preferences/models\";\nimport { ThFormatPref, ThFormatPrefValue } from \"@/preferences\";\n\nimport { ThProgression } from \"@/core/Components/Reader/ThProgression\";\n\nimport { useI18n } from \"@/i18n/useI18n\";\n\nimport { useAppSelector } from \"@/lib/hooks\";\n\nimport { makeBreakpointsMap } from \"@/core/Helpers/breakpointsMap\";\nimport { getBestMatchingProgressionFormat } from \"@/core/Helpers/progressionFormat\";\n\nimport classNames from \"classnames\";\n\nexport const StatefulReaderProgression = ({ \n className,\n formatPref,\n fallbackVariant\n}: { \n className?: string,\n formatPref?: ThFormatPref<ThProgressionFormat | ThProgressionFormat[]>,\n fallbackVariant: ThProgressionFormat | Array<ThProgressionFormat>\n}) => {\n const { t } = useI18n();\n \n const unstableTimeline = useAppSelector(state => state.publication.unstableTimeline);\n const isImmersive = useAppSelector(state => state.reader.isImmersive);\n const isFullscreen = useAppSelector(state => state.reader.isFullscreen);\n const isHovering = useAppSelector(state => state.reader.isHovering);\n const breakpoint = useAppSelector(state => state.theming.breakpoint);\n\n \n // Create a stable string representation of progression data to prevent infinite loops\n const progressionKey = useMemo(() => {\n if (!unstableTimeline?.progression) return \"\";\n const { \n currentPositions = [],\n totalPositions,\n relativeProgression,\n totalProgression,\n currentChapter,\n positionsLeft,\n totalItems,\n currentIndex\n } = unstableTimeline.progression;\n return JSON.stringify({\n currentPositions,\n totalPositions,\n relativeProgression,\n totalProgression,\n currentChapter,\n positionsLeft,\n totalItems,\n currentIndex\n });\n }, [unstableTimeline?.progression]);\n \n const fallbackFormat = useMemo(() => {\n return {\n variants: fallbackVariant,\n displayInImmersive: true,\n displayInFullscreen: true\n };\n }, [fallbackVariant]);\n \n const breakpointsMap = useMemo(() => {\n return makeBreakpointsMap<ThFormatPrefValue<ThProgressionFormat | ThProgressionFormat[]>>({\n defaultValue: formatPref?.default || fallbackFormat,\n fromEnum: ThProgressionFormat,\n pref: formatPref?.breakpoints,\n validateKey: \"variants\"\n });\n }, [formatPref, fallbackFormat]);\n \n // Get current preferences with proper fallback\n const currentPrefs = useMemo(() => {\n if (!breakpoint) return formatPref?.default || fallbackFormat;\n return breakpointsMap[breakpoint] || formatPref?.default || fallbackFormat;\n }, [breakpoint, breakpointsMap, formatPref?.default, fallbackFormat]);\n\n const { variants, displayInImmersive, displayInFullscreen } = currentPrefs;\n \n // Get the display format, handling both single format and array of formats\n const displayFormat = useMemo(() => {\n if (!variants) return fallbackFormat.variants;\n \n // Check if we should hide in immersive mode\n if (isImmersive && displayInImmersive === false && !isHovering) {\n return ThProgressionFormat.none;\n }\n \n // Check if we should hide in fullscreen mode\n if (isImmersive && isFullscreen && displayInFullscreen === false && !isHovering) {\n return ThProgressionFormat.none;\n }\n \n if (Array.isArray(variants)) {\n return getBestMatchingProgressionFormat(variants, unstableTimeline?.progression) || \n fallbackFormat.variants;\n }\n \n return variants;\n }, [variants, unstableTimeline?.progression, fallbackFormat, isImmersive, isHovering, isFullscreen, displayInImmersive, displayInFullscreen]);\n\n // Compute display text based on current position and timeline\n const displayText = useMemo(() => {\n if (displayFormat === ThProgressionFormat.none || !unstableTimeline?.progression) {\n return \"\";\n }\n\n const { \n currentPositions = [],\n totalPositions,\n relativeProgression,\n totalProgression,\n currentChapter,\n positionsLeft,\n totalItems,\n currentIndex\n } = unstableTimeline.progression;\n \n let text = \"\";\n \n // Format positions for display (handle array of two positions with a dash)\n const formatPositions = (positions: number[]) => {\n if (positions.length === 2) {\n return positions.join(\"–\");\n }\n return positions[0]?.toString() || \"\";\n };\n \n switch (displayFormat) {\n case ThProgressionFormat.positions:\n if (currentPositions.length > 0) {\n text = formatPositions(currentPositions);\n }\n break;\n \n case ThProgressionFormat.positionsOfTotal:\n if (currentPositions.length > 0 && totalPositions) {\n text = t(\"reader.progression.xOfY.compact\", { \n x: formatPositions(currentPositions),\n y: totalPositions\n });\n }\n break;\n\n case ThProgressionFormat.positionsPercentOfTotal:\n if (currentPositions.length > 0 && totalPositions) {\n const percentage = Math.round((totalProgression || 0) * 100);\n text = t(\"reader.progression.xOfY.descriptive\", { \n x: formatPositions(currentPositions),\n y: totalPositions,\n z: `${ percentage }%`\n });\n }\n break;\n \n case ThProgressionFormat.positionsLeft:\n if (positionsLeft !== undefined) {\n text = t(`reader.progression.positionsLeftInChapter.descriptive`, { \n count: positionsLeft\n });\n }\n break;\n \n case ThProgressionFormat.overallProgression:\n if (totalProgression !== undefined) {\n const percentage = Math.round(totalProgression * 100);\n text = `${ percentage }%`;\n }\n break;\n \n case ThProgressionFormat.resourceProgression:\n if (relativeProgression !== undefined) {\n const percentage = Math.round(relativeProgression * 100);\n text = `${ percentage }%`;\n }\n break;\n \n case ThProgressionFormat.progressionOfResource:\n if (relativeProgression !== undefined) {\n const percentage = Math.round(relativeProgression * 100);\n text = t(\"reader.progression.xOfY.compact\", {\n x: `${ percentage }%`,\n y: currentChapter || t(\"reader.app.progression.referenceFallback\")\n });\n }\n break;\n\n case ThProgressionFormat.readingOrderIndex:\n if (currentIndex !== undefined && totalItems !== undefined) {\n text = t(\"reader.progression.xOfY.compact\", {\n x: currentIndex,\n y: totalItems\n });\n }\n break;\n }\n \n return text;\n }, [displayFormat, unstableTimeline, t]);\n\n if (!displayText || displayFormat === ThProgressionFormat.none) {\n return null;\n }\n\n return (\n <ThProgression \n id=\"current-progression\" \n className={ classNames(progressionStyles.wrapper, className) }\n aria-label={ t(\"reader.app.progression.wrapper\") }\n >\n { displayText }\n </ThProgression>\n );\n};","\"use client\";\n\nimport { useRef, KeyboardEvent } from \"react\";\n\nimport { ThPagination, ThPaginationProps } from \"@/core/Components/Reader/ThPagination\";\n\nimport readerPaginationStyles from \"./assets/styles/thorium-web.reader.pagination.module.css\";\n\nexport const StatefulReaderPagination = ({\n ref,\n links,\n compounds,\n children,\n dir,\n ...props\n}: ThPaginationProps) => {\n const leftButtonRef = useRef<HTMLButtonElement>(null);\n const rightButtonRef = useRef<HTMLButtonElement>(null);\n\n const updatedCompounds = {\n ...compounds,\n leftButton: {\n ...compounds?.leftButton,\n ref: leftButtonRef,\n onKeyDown: (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n leftButtonRef.current?.blur();\n }\n }\n },\n rightButton: {\n ...compounds?.rightButton,\n ref: rightButtonRef,\n onKeyDown: (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n rightButtonRef.current?.blur();\n }\n }\n }\n };\n\n return (\n <ThPagination\n ref={ ref }\n className={ readerPaginationStyles.wrapper }\n links={ links }\n compounds={ updatedCompounds }\n { ...props }\n >\n { children }\n </ThPagination>\n )\n}\n","\"use client\";\n\nimport { useCallback, useEffect, useRef } from \"react\";\n\nimport readerStyles from \"./assets/styles/thorium-web.reader.app.module.css\";\nimport readerPaginationStyles from \"./assets/styles/thorium-web.reader.pagination.module.css\";\n\nimport { ThBreakpoints, ThLayoutUI, ThFormatPref, ThProgressionFormat } from \"@/preferences/models\";\n\nimport { ThFooter } from \"@/core/Components/Reader/ThFooter\";\nimport { StatefulReaderProgression } from \"./StatefulReaderProgression\";\nimport { ThInteractiveOverlay } from \"../core/Components/Reader/ThInteractiveOverlay\";\nimport { StatefulReaderPagination } from \"./StatefulReaderPagination\";\nimport { ThPaginationLinkProps } from \"@/core/Components/Reader/ThPagination\";\n\nimport { useNavigator } from \"@/core/Navigator\";\nimport { useFocusWithin, useLocale } from \"react-aria\";\nimport { useI18n } from \"@/i18n/useI18n\";\n\nimport { setHovering } from \"@/lib/readerReducer\";\nimport { useAppDispatch, useAppSelector } from \"@/lib/hooks\";\nimport { useIsScroll } from \"@/hooks\";\n\nimport classNames from \"classnames\";\n\nexport const StatefulReaderFooter = ({\n layout,\n progressionFormatPref,\n progressionFormatFallback\n}: {\n layout: ThLayoutUI;\n progressionFormatPref?: ThFormatPref<ThProgressionFormat | ThProgressionFormat[]>;\n progressionFormatFallback: ThProgressionFormat | ThProgressionFormat[];\n}) => {\n const { t } = useI18n();\n const { direction } = useLocale();\n const footerRef = useRef<HTMLDivElement>(null);\n const readerProfile = useAppSelector(state => state.reader.profile);\n const isImmersive = useAppSelector(state => state.reader.isImmersive);\n const isHovering = useAppSelector(state => state.reader.isHovering);\n const hasScrollAffordance = useAppSelector(state => state.reader.hasScrollAffordance);\n const isRTL = useAppSelector(state => state.publication.isRTL);\n const isFXL = useAppSelector(state => state.publication.isFXL);\n const isScroll = useIsScroll();\n const breakpoint = useAppSelector(state => state.theming.breakpoint);\n const reducedMotion = useAppSelector(state => state.theming.prefersReducedMotion);\n const timeline = useAppSelector(state => state.publication.unstableTimeline);\n\n const dispatch = useAppDispatch();\n\n const { focusWithinProps } = useFocusWithin({\n onFocusWithin() {\n dispatch(setHovering(true));\n },\n onBlurWithin() {\n dispatch(setHovering(false));\n }\n });\n\n const setHover = () => {\n if (!hasScrollAffordance) {\n dispatch(setHovering(true));\n }\n };\n\n const removeHover = () => {\n if (!hasScrollAffordance) {\n dispatch(setHovering(false));\n }\n };\n\n const { previousLocator, nextLocator, go } = useNavigator().unified;\n\n const buildNode = useCallback((\n locator: ReturnType<typeof previousLocator>,\n title: string | undefined,\n compactKey: string,\n descriptiveKey: string\n ) => {\n if (!locator) return undefined;\n\n return breakpoint !== ThBreakpoints.compact && breakpoint !== ThBreakpoints.medium ? (\n <>\n <span className={ readerStyles.srOnly }>{ t(descriptiveKey) }</span>\n <span className={ readerPaginationStyles.label }>{ title || locator.title || t(compactKey) }</span>\n </>\n ) : (\n <span className={ readerPaginationStyles.label }>{ t(compactKey) }</span>\n );\n }, [t, breakpoint]);\n\n const updateLinks = useCallback(() => {\n const previous = previousLocator();\n const next = nextLocator();\n\n const previousLink: ThPaginationLinkProps | undefined = previous ? {\n node: buildNode(\n previous,\n timeline?.previousItem?.title,\n isFXL ? \"reader.actions.goToPreviousPage.compact\" : \"reader.actions.goToPreviousChapter.compact\",\n isFXL ? \"reader.actions.goToPreviousPage.descriptive\" : \"reader.actions.goToPreviousChapter.descriptive\"\n ),\n onPress: () => go(previous, !reducedMotion, () => {})\n } : undefined;\n\n const nextLink: ThPaginationLinkProps | undefined = next ? {\n node: buildNode(\n next,\n timeline?.nextItem?.title,\n isFXL ? \"reader.actions.goToNextPage.compact\" : \"reader.actions.goToNextChapter.compact\",\n isFXL ? \"reader.actions.goToNextPage.descriptive\" : \"reader.actions.goToNextChapter.descriptive\"\n ),\n onPress: () => go(next, !reducedMotion, () => {})\n } : undefined;\n\n return isRTL\n ? { left: nextLink, right: previousLink }\n : { left: previousLink, right: nextLink };\n }, [go, previousLocator, nextLocator, buildNode, timeline, reducedMotion, isFXL, isRTL]);\n\n useEffect(() => {\n updateLinks();\n }, [timeline, updateLinks]);\n\n useEffect(() => {\n // Blur any focused element when entering immersive mode\n if (isImmersive) {\n const focusElement = document.activeElement;\n if (focusElement && footerRef.current?.contains(focusElement)) {\n (focusElement as HTMLElement).blur();\n }\n }\n }, [isImmersive]);\n\n return(\n <>\n <ThInteractiveOverlay\n className={ classNames(readerStyles.barOverlay, readerStyles.footerOverlay) }\n isActive={ layout === ThLayoutUI.layered && isImmersive && !isHovering }\n onMouseEnter={ setHover }\n onMouseLeave={ removeHover }\n />\n\n <ThFooter\n ref={ footerRef }\n className={ readerStyles.bottomBar }\n aria-label={ t(\"reader.app.footer.label\") }\n onMouseEnter={ setHover }\n onMouseLeave={ removeHover }\n { ...focusWithinProps }\n >\n { (isScroll)\n ? <StatefulReaderPagination\n aria-label={ t(\"reader.navigation.scroll.wrapper\") }\n links={ updateLinks() }\n dir={ direction }\n compounds={ {\n listItem: {\n className: readerPaginationStyles.listItem\n },\n leftButton: {\n className: readerPaginationStyles.leftButton,\n preventFocusOnPress: true\n },\n rightButton: {\n className: readerPaginationStyles.rightButton,\n preventFocusOnPress: true\n }\n } }\n >\n <StatefulReaderProgression\n className={ readerPaginationStyles.progression }\n formatPref={ progressionFormatPref }\n fallbackVariant={ progressionFormatFallback }\n />\n </StatefulReaderPagination>\n : <StatefulReaderProgression\n formatPref={ progressionFormatPref }\n fallbackVariant={ progressionFormatFallback }\n /> }\n </ThFooter>\n </>\n )\n}\n","export const getAndroidPatchCss = () => {\n if (typeof window === \"undefined\") {\n return \"\";\n }\n \n const origin = window.location.origin;\n \n return `/* Readium CSS\n Android Fonts Patch module\n\n A stylesheet aligning Android generic serif and sans-serif fonts on other platforms\n\n Repo: https://github.com/readium/css */\n\n/* Android resolves sans-serif to Roboto, and serif to Droid Serif \n This created issues for FXL EPUBs relying on Times (New Roman),\n Helvetica or Arial while not embedding the font files in the package.\n\n See https://github.com/readium/css/issues/149\n\n Unfortunately it is no possible to target generic family using @font-face,\n we have to target specific font-family names e.g. Times, Arial, etc.\n\n This stylesheet/patch should be loaded only for this case i.e.\n a Fixed-Layout EPUB with text but no embedded font on an Android device.\n The logic for checking these conditions are up to implementers.\n*/\n\n/* Serif (Times + Times New Roman) */\n\n@font-face {\n font-family: Times;\n src: url(\"${ new URL(\"/fonts/AndroidPatch/serif/NimbusRoman.woff\", origin).toString() }\") format(\"woff\");\n font-weight: normal;\n font-style: normal;\n}\n\n@font-face {\n font-family: \"Times New Roman\";\n src: url(\"${ new URL(\"/fonts/AndroidPatch/serif/NimbusRoman.woff\", origin).toString() }\") format(\"woff\");\n font-weight: normal;\n font-style: normal;\n}\n\n@font-face {\n font-family: Times;\n src: url(\"${ new URL(\"/fonts/AndroidPatch/serif/NimbusRoman-Italic.woff\", origin).toString() }\") format(\"woff\");\n font-weight: normal;\n font-style: italic;\n}\n\n@font-face {\n font-family: \"Times New Roman\";\n src: url(\"${ new URL(\"/fonts/AndroidPatch/serif/NimbusRoman-Italic.woff\", origin).toString() }\") format(\"woff\");\n font-weight: normal;\n font-style: italic;\n}\n\n@font-face {\n font-family: Times;\n src: url(\"${ new URL(\"/fonts/AndroidPatch/serif/NimbusRoman-Bold.woff\", origin).toString() }\") format(\"woff\");\n font-weight: bold;\n font-style: normal;\n}\n\n@font-face {\n font-family: \"Times New Roman\";\n src: url(\"${ new URL(\"/fonts/AndroidPatch/serif/NimbusRoman-Bold.woff\", origin).toString() }\") format(\"woff\");\n font-weight: bold;\n font-style: normal;\n}\n\n@font-face {\n font-family: Times;\n src: url(\"${ new URL(\"/fonts/AndroidPatch/serif/NimbusRoman-BoldItalic.woff\", origin).toString() }\") format(\"woff\");\n font-weight: bold;\n font-style: italic;\n}\n\n@font-face {\n font-family: \"Times New Roman\";\n src: url(\"${ new URL(\"/fonts/AndroidPatch/serif/NimbusRoman-BoldItalic.woff\", origin).toString() }\") format(\"woff\");\n font-weight: bold;\n font-style: italic;\n}\n\n/* Sans-serif (Helvetica + Arial) */\n\n@font-face {\n font-family: Helvetica;\n src: url(\"${ new URL(\"/fonts/AndroidPatch/sans-serif/NimbusSans.woff\", origin).toString() }\") format(\"woff\");\n font-weight: normal;\n font-style: normal;\n}\n\n@font-face {\n font-family: Arial;\n src: url(\"${ new URL(\"/fonts/AndroidPatch/sans-serif/NimbusSans.woff\", origin).toString() }\") format(\"woff\");\n font-weight: normal;\n font-style: normal;\n}\n\n@font-face {\n font-family: Helvetica;\n src: url(\"${ new URL(\"/fonts/AndroidPatch/sans-serif/NimbusSans-Italic.woff\", origin).toString() }\") format(\"woff\");\n font-weight: normal;\n font-style: italic;\n}\n\n@font-face {\n font-family: Arial;\n src: url(\"${ new URL(\"/fonts/AndroidPatch/sans-serif/NimbusSans-Italic.woff\", origin).toString() }\") format(\"woff\");\n font-weight: normal;\n font-style: italic;\n}\n\n@font-face {\n font-family: Helvetica;\n src: url(\"${ new URL(\"/fonts/AndroidPatch/sans-serif/NimbusSans-Bold.woff\", origin).toString() }\") format(\"woff\");\n font-weight: bold;\n font-style: normal;\n}\n\n@font-face {\n font-family: Arial;\n src: url(\"${ new URL(\"/fonts/AndroidPatch/sans-serif/NimbusSans-Bold.woff\", origin).toString() }\") format(\"woff\");\n font-weight: bold;\n font-style: normal;\n}\n\n@font-face {\n font-family: Helvetica;\n src: url(\"${ new URL(\"/fonts/AndroidPatch/sans-serif/NimbusSans-BoldItalic.woff\", origin).toString() }\") format(\"woff\");\n font-weight: bold;\n font-style: italic;\n}\n\n@font-face {\n font-family: Arial;\n src: url(\"${ new URL(\"/fonts/AndroidPatch/sans-serif/NimbusSans-BoldItalic.woff\", origin).toString() }\") format(\"woff\");\n font-weight: bold;\n font-style: italic;\n}`;\n};\n","\"use client\";\n\nimport { useCallback, useEffect, useRef } from \"react\";\n\nimport { InjectableFontResources } from \"@/preferences/services/fonts\";\nimport { ILinkInjectable, IUrlInjectable, IBlobInjectable } from \"@readium/navigator\";\n\nimport { getPlatform } from \"@/core/Helpers/getPlatform\";\nimport { getAndroidPatchCss } from \"./androidPatchCss\";\n\ntype FontResource = (ILinkInjectable & IUrlInjectable) | (ILinkInjectable & IBlobInjectable);\n\nexport const useFonts = (fontResources?: InjectableFontResources | null) => {\n const injectedElementsRef = useRef<{\n prepend: HTMLElement[];\n append: HTMLElement[];\n }>({\n prepend: [],\n append: []\n });\n\n const createLinkElement = useCallback((resource: FontResource): HTMLLinkElement => {\n const link = document.createElement(\"link\");\n \n // Set all custom attributes first to make sure they are\n // overridden by the core attributes\n if (\"attributes\" in resource && resource.attributes) {\n Object.entries(resource.attributes).forEach(([key, value]) => {\n link.setAttribute(key, value as string);\n });\n }\n \n link.rel = resource.rel;\n link.as = resource.as;\n \n if (\"url\" in resource) {\n link.href = resource.url;\n } else if (\"blob\" in resource && resource.blob) {\n link.href = URL.createObjectURL(resource.blob);\n }\n \n return link;\n }, []);\n\n const removeInjectedElements = useCallback(() => {\n const { prepend, append } = injectedElementsRef.current;\n \n [...prepend, ...append].forEach(element => {\n if (element.parentNode) {\n element.parentNode.removeChild(element);\n }\n // Revoke blob URLs to prevent memory leaks\n if (element instanceof HTMLLinkElement && element.href.startsWith(\"blob:\")) {\n URL.revokeObjectURL(element.href);\n }\n });\n \n injectedElementsRef.current = {\n prepend: [],\n append: []\n };\n }, []);\n\n const injectFontResources = useCallback((resources: InjectableFontResources | null) => {\n if (typeof document === \"undefined\") return;\n \n removeInjectedElements();\n \n if (!resources) return;\n \n const { prepend, append } = resources;\n const injectedElements = injectedElementsRef.current;\n \n prepend.forEach(resource => {\n const element = createLinkElement(resource);\n document.head.insertBefore(element, document.head.firstChild);\n injectedElements.prepend.push(element);\n });\n \n append.forEach(resource => {\n const element = createLinkElement(resource);\n document.head.appendChild(element);\n injectedElements.append.push(element);\n });\n }, [createLinkElement, removeInjectedElements]);\n\n const getAndroidFXLPatch = useCallback((): (ILinkInjectable & IBlobInjectable) | null => {\n const platform = getPlatform();\n const isAndroid = platform === \"android\";\n \n if (!isAndroid) {\n return null;\n }\n \n const cssContent = getAndroidPatchCss();\n const blob = new Blob([cssContent], { type: \"text/css\" });\n \n return {\n as: \"link\",\n rel: \"stylesheet\",\n blob\n };\n }, []);\n\n useEffect(() => {\n injectFontResources(fontResources || null);\n \n return () => {\n removeInjectedElements();\n };\n }, [fontResources, injectFontResources, removeInjectedElements]);\n\n return {\n injectFontResources,\n removeFontResources: removeInjectedElements,\n getAndroidFXLPatch\n };\n};","// Peripherals based on XBReader\nimport { ThActionsPref, DefaultKeys } from \"@/preferences\";\n\nimport { ThActionsKeys } from \"@/preferences/models\";\n\nimport { buildShortcut, UnstablePShortcut } from \"@/core/Helpers/keyboardUtilities\";\nimport { isInteractiveElement } from \"@/core/Helpers/focusUtilities\";\n\nimport { useAppStore } from \"@/lib/hooks\";\n\nexport interface PCallbacks {\n moveTo: (direction: \"left\" | \"right\" | \"up\" | \"down\" | \"home\" | \"end\") => void;\n goProgression: (shiftKey?: boolean) => void;\n toggleAction: (action: ThActionsKeys) => void;\n}\n\nexport interface PShortcuts {\n [key: string]: {\n actionKey: ThActionsKeys;\n modifiers: UnstablePShortcut[\"modifiers\"];\n }\n}\n\nexport default class Peripherals {\n private readonly observers = [\"keydown\"];\n private targets: EventTarget[] = [];\n private readonly callbacks: PCallbacks;\n private readonly store: ReturnType<typeof useAppStore>;\n private readonly actionsPref: ThActionsPref<DefaultKeys> | undefined;\n private readonly shortcuts: PShortcuts;\n\n constructor(store: ReturnType<typeof useAppStore>, actionsPref: ThActionsPref<DefaultKeys> | undefined, callbacks: PCallbacks) {\n this.observers.forEach((method) => {\n (this as any)[\"on\" + method] = (this as any)[\"on\" + method].bind(this);\n });\n this.store = store;\n this.actionsPref = actionsPref;\n this.callbacks = callbacks;\n this.shortcuts = this.retrieveShortcuts();\n }\n\n private getPlatformModifier(): \"ctrlKey\" | \"metaKey\" {\n return this.store.getState().reader.platformModifier.modifier;\n }\n\n private retrieveShortcuts() {\n if (!this.actionsPref) return {};\n\n const shortcutsObj: PShortcuts = {};\n\n const displayOrder = this.store.getState().publication.isFXL\n ? this.actionsPref.fxlOrder\n : this.actionsPref.reflowOrder;\n\n for (const actionKey of displayOrder) {\n const shortcutString = this.actionsPref.keys[actionKey].shortcut;\n \n if (shortcutString) {\n const shortcutObj = buildShortcut(shortcutString);\n\n if (shortcutObj?.key) {\n Object.defineProperty(shortcutsObj, shortcutObj.key, {\n value: {\n actionKey: actionKey,\n modifiers: shortcutObj.modifiers\n },\n writable: false,\n enumerable: true\n });\n }\n }\n };\n \n return shortcutsObj;\n }\n\n destroy() {\n this.targets.forEach((t) => this.unobserve(t));\n }\n\n unobserve(item: EventTarget) {\n if (!item) return;\n this.observers.forEach((EventName) => {\n item.removeEventListener(\n EventName,\n (this as any)[\"on\" + EventName],\n false\n );\n });\n this.targets = this.targets.filter((t) => t !== item);\n }\n\n observe(item: EventTarget) {\n if (!item) return;\n if (this.targets.includes(item)) return;\n this.observers.forEach((EventName) => {\n item.addEventListener(EventName, (this as any)[\"on\" + EventName], false);\n });\n this.targets.push(item);\n }\n\n onkeydown(e: KeyboardEvent) {\n const focusIsSafe = !isInteractiveElement(document.activeElement);\n \n switch(e.code) {\n case \"Space\":\n focusIsSafe && this.callbacks.goProgression(e.shiftKey);\n break;\n case \"ArrowRight\":\n focusIsSafe && this.callbacks.moveTo(\"right\");\n break;\n case \"ArrowLeft\":\n focusIsSafe && this.callbacks.moveTo(\"left\");\n break;\n case \"ArrowUp\":\n case \"PageUp\":\n focusIsSafe && this.callbacks.moveTo(\"up\");\n break;\n case \"ArrowDown\":\n case \"PageDown\":\n focusIsSafe && this.callbacks.moveTo(\"down\");\n break;\n case \"Home\":\n focusIsSafe && this.callbacks.moveTo(\"home\");\n break;\n case \"End\":\n focusIsSafe && this.callbacks.moveTo(\"end\");\n break;\n default:\n if (this.shortcuts.hasOwnProperty(e.code)) {\n const customShortcutObj = this.shortcuts[e.code];\n const sendCallback = Object.entries(customShortcutObj.modifiers).every(( [modifier, value] ) => {\n if (modifier === \"platformKey\") {\n return e[this.getPlatformModifier()] === value;\n } else {\n return e[modifier as \"altKey\" | \"ctrlKey\" | \"metaKey\" | \"shiftKey\"] === value;\n }\n })\n \n if (sendCallback) {\n e.preventDefault();\n this.callbacks.toggleAction(customShortcutObj.actionKey)\n };\n }\n break;\n }\n }\n}","import { ThLayoutUI } from \"@/preferences\";\nimport readerStyles from \"../assets/styles/thorium-web.reader.app.module.css\";\nimport classNames from \"classnames\";\n\ninterface ReaderStyleOptions {\n layoutUI: ThLayoutUI;\n isScroll: boolean;\n isImmersive?: boolean;\n isHovering?: boolean;\n isFXL?: boolean;\n breakpoint?: string;\n}\n\nconst LAYOUT_CLASSES = {\n [ThLayoutUI.stacked]: \"thorium_web_stackedUI\",\n [ThLayoutUI.layered]: \"thorium_web_layeredUI\",\n} as const;\n\nexport function getReaderClassNames(options: ReaderStyleOptions): string {\n const {\n layoutUI,\n isScroll,\n isImmersive = false,\n isHovering = false,\n isFXL = false,\n breakpoint,\n } = options;\n\n return classNames(\n readerStyles.shell,\n isScroll ? \"thorium_web_isScroll\" : \"thorium_web_isPaged\",\n isImmersive && \"thorium_web_isImmersive\",\n isHovering && \"thorium_web_isHovering\",\n isFXL ? \"thorium_web_isFXL\" : \"thorium_web_isReflow\",\n LAYOUT_CLASSES[layoutUI],\n breakpoint ? `thorium_web_is${ breakpoint.charAt(0).toUpperCase() + breakpoint.slice(1) }` : undefined\n );\n}"]}
@@ -1,9 +0,0 @@
1
- // src/i18n/supported-locales.ts
2
- var supportedLocales = ["da", "en", "fi", "fr", "it", "lt", "pl", "pt", "sv", "ta"];
3
- function isSupportedLocale(locale) {
4
- return supportedLocales.includes(locale);
5
- }
6
-
7
- export { isSupportedLocale, supportedLocales };
8
- //# sourceMappingURL=chunk-B3WDMWCT.mjs.map
9
- //# sourceMappingURL=chunk-B3WDMWCT.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/i18n/supported-locales.ts"],"names":[],"mappings":";AAIO,IAAM,gBAAA,GAAmB,CAAC,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,IAAI;AASpF,SAAS,kBAAkB,MAAA,EAA2C;AAC3E,EAAA,OAAO,gBAAA,CAAiB,SAAS,MAAyB,CAAA;AAC5D","file":"chunk-B3WDMWCT.mjs","sourcesContent":["/**\n * List of supported locales in the application.\n * These locales are used for i18n configuration and language selection.\n */\nexport const supportedLocales = [\"da\", \"en\", \"fi\", \"fr\", \"it\", \"lt\", \"pl\", \"pt\", \"sv\", \"ta\"] as const;\n\nexport type SupportedLocale = typeof supportedLocales[number];\n\n/**\n * Type guard to check if a string is a supported locale\n * @param locale The locale string to check\n * @returns boolean indicating if the locale is supported\n */\nexport function isSupportedLocale(locale: string): locale is SupportedLocale {\n return supportedLocales.includes(locale as SupportedLocale);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/WebPub/Hooks/usePreferencesConfig.ts","../src/components/WebPub/Hooks/useInjectablesConfig.ts","../src/components/WebPub/Hooks/useReaderInit.ts","../src/components/WebPub/StatefulReader.tsx"],"names":["useMemo","useState","useRef","useCallback","timeline"],"mappings":";;;;;;;;;;;;;AAkBO,IAAM,6BAA6B,CAAC;AAAA,EACzC,QAAA;AAAA,EACA,YAAA;AAAA,EACA,0BAAA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;AAAA,YACT,qBAAA,EAAwB,WAAA,CAAY,OAAA,CAAQ,WAAA,EAAa,MAAA,EAAQ,MAAA;AAAA,YACjE,yBAAA,EAAA,mBAAA;AAAA;AAAA;AACF;AAAA;AAAA,GACF,EACF,CAAA,EACF,CAAA,EACF,CAAA,EACA,CAAA;AACD,CAAA","file":"chunk-KVUG6BNI.mjs","sourcesContent":["\"use client\";\n\nimport { useMemo } from \"react\";\n\nimport { IWebPubPreferences, TextAlignment } from \"@readium/navigator\";\nimport { ThLineHeightOptions, ThSettingsKeys } from \"@/preferences/models\";\nimport { FontMetadata } from \"@/preferences/services/fonts\";\nimport { WebPubCSSSettings } from \"@/core/Hooks/WebPub/useWebPubSettingsCache\";\nimport { useSettingsComponentStatus } from \"@/components/Settings/hooks/useSettingsComponentStatus\";\n\ninterface UseWebPubPreferencesConfigProps {\n settings: WebPubCSSSettings;\n fontLanguage: string;\n hasDisplayTransformability: boolean;\n getFontMetadata: (fontFamily: string) => FontMetadata;\n lineHeightOptions: Record<ThLineHeightOptions, number | null>;\n}\n\nexport const useWebPubPreferencesConfig = ({\n settings,\n fontLanguage,\n hasDisplayTransformability,\n getFontMetadata,\n lineHeightOptions,\n}: UseWebPubPreferencesConfigProps) => {\n const { isComponentUsed: isFontFamilyUsed } = useSettingsComponentStatus({\n settingsKey: ThSettingsKeys.fontFamily,\n publicationType: \"webpub\",\n });\n\n const { isComponentUsed: isFontWeightUsed } = useSettingsComponentStatus({\n settingsKey: ThSettingsKeys.fontWeight,\n publicationType: \"webpub\",\n });\n\n const { isComponentUsed: isHyphensUsed } = useSettingsComponentStatus({\n settingsKey: ThSettingsKeys.hyphens,\n publicationType: \"webpub\",\n });\n\n const { isComponentUsed: isLigaturesUsed } = useSettingsComponentStatus({\n settingsKey: ThSettingsKeys.ligatures,\n publicationType: \"webpub\",\n });\n\n const { isComponentUsed: isNoRubyUsed } = useSettingsComponentStatus({\n settingsKey: ThSettingsKeys.noRuby,\n publicationType: \"webpub\",\n });\n\n const { isComponentUsed: isLetterSpacingUsed } = useSettingsComponentStatus({\n settingsKey: ThSettingsKeys.letterSpacing,\n publicationType: \"webpub\",\n });\n\n const { isComponentUsed: isLineHeightUsed } = useSettingsComponentStatus({\n settingsKey: ThSettingsKeys.lineHeight,\n publicationType: \"webpub\",\n });\n\n const { isComponentUsed: isParagraphIndentUsed } = useSettingsComponentStatus({\n settingsKey: ThSettingsKeys.paragraphIndent,\n publicationType: \"webpub\",\n });\n\n const { isComponentUsed: isParagraphSpacingUsed } = useSettingsComponentStatus({\n settingsKey: ThSettingsKeys.paragraphSpacing,\n publicationType: \"webpub\",\n });\n\n const { isComponentUsed: isTextAlignUsed } = useSettingsComponentStatus({\n settingsKey: ThSettingsKeys.textAlign,\n publicationType: \"webpub\",\n });\n\n const { isComponentUsed: isTextNormalizeUsed } = useSettingsComponentStatus({\n settingsKey: ThSettingsKeys.textNormalize,\n publicationType: \"webpub\",\n });\n\n const { isComponentUsed: isWordSpacingUsed } = useSettingsComponentStatus({\n settingsKey: ThSettingsKeys.wordSpacing,\n publicationType: \"webpub\",\n });\n\n const webPubPreferences = useMemo(() => {\n const preferences: IWebPubPreferences = {\n zoom: settings.zoom\n };\n\n if (hasDisplayTransformability) {\n if (isFontFamilyUsed) preferences.fontFamily = getFontMetadata(settings.fontFamily[fontLanguage] ?? \"\")?.fontStack || null;\n if (isFontWeightUsed) preferences.fontWeight = settings.fontWeight;\n if (isHyphensUsed) preferences.hyphens = settings.hyphens;\n if (isLigaturesUsed) preferences.ligatures = settings.ligatures;\n if (isNoRubyUsed) preferences.noRuby = settings.noRuby;\n if (isLetterSpacingUsed) preferences.letterSpacing = settings.letterSpacing;\n if (isLineHeightUsed) preferences.lineHeight = settings.lineHeight === null\n ? null\n : lineHeightOptions[settings.lineHeight];\n if (isParagraphIndentUsed) preferences.paragraphIndent = settings.paragraphIndent;\n if (isParagraphSpacingUsed) preferences.paragraphSpacing = settings.paragraphSpacing;\n if (isTextAlignUsed) preferences.textAlign = settings.textAlign as TextAlignment | null | undefined;\n if (isTextNormalizeUsed) preferences.textNormalization = settings.textNormalization;\n if (isWordSpacingUsed) preferences.wordSpacing = settings.wordSpacing;\n }\n\n return preferences;\n }, [\n settings,\n fontLanguage,\n hasDisplayTransformability,\n getFontMetadata,\n lineHeightOptions,\n isFontFamilyUsed,\n isFontWeightUsed,\n isHyphensUsed,\n isLigaturesUsed,\n isNoRubyUsed,\n isLetterSpacingUsed,\n isLineHeightUsed,\n isParagraphIndentUsed,\n isParagraphSpacingUsed,\n isTextAlignUsed,\n isTextNormalizeUsed,\n isWordSpacingUsed,\n ]);\n\n return { webPubPreferences };\n};\n","\"use client\";\n\nimport { useMemo } from \"react\";\n\nimport { IInjectablesConfig } from \"@readium/navigator\";\nimport { InjectableFontResources } from \"@/preferences/services/fonts\";\n\ninterface UseWebPubInjectablesConfigProps {\n isFontFamilyUsed: boolean;\n fontLanguage: string;\n getFontInjectables: (options?: { language?: string } | { key?: string }, optimize?: boolean) => InjectableFontResources | null;\n}\n\nexport const useWebPubInjectablesConfig = ({\n isFontFamilyUsed,\n fontLanguage,\n getFontInjectables,\n}: UseWebPubInjectablesConfigProps) => {\n const injectables = useMemo(() => {\n let injectablesConfig: IInjectablesConfig | undefined;\n\n if (isFontFamilyUsed) {\n const fontResources = getFontInjectables({ language: fontLanguage });\n if (fontResources) {\n injectablesConfig = {\n allowedDomains: fontResources.allowedDomains,\n rules: [{\n resources: [/\\.xhtml$/, /\\.html$/],\n prepend: fontResources.prepend,\n append: fontResources.append\n }]\n };\n }\n }\n\n return injectablesConfig;\n }, [isFontFamilyUsed, fontLanguage, getFontInjectables]);\n\n return { injectables };\n};\n","\"use client\";\n\nimport { useCallback, useEffect, useState, useRef } from \"react\";\n\nimport { Locator, Publication } from \"@readium/shared\";\nimport { ThLineHeightOptions } from \"@/preferences/models\";\nimport { WebPubNavigatorListeners, IContentProtectionConfig } from \"@readium/navigator\";\nimport { ThPreferences } from \"@/preferences\";\nimport { FontMetadata, InjectableFontResources } from \"@/preferences/services/fonts\";\nimport { WebPubStatelessCache } from \"@/core/Hooks/WebPub/useWebPubSettingsCache\";\n\nimport { useWebPubPreferencesConfig } from \"./usePreferencesConfig\";\nimport { useWebPubInjectablesConfig } from \"./useInjectablesConfig\";\nimport { useWebPubNavigator, WebPubNavigatorLoadProps } from \"@/core/Hooks/WebPub/useWebPubNavigator\";\n\ninterface UseWebPubReaderInitProps {\n container: React.RefObject<HTMLDivElement | null>;\n publication: Publication | null;\n initialPosition: Locator | null;\n listeners: WebPubNavigatorListeners;\n preferences: ThPreferences;\n cache: React.RefObject<WebPubStatelessCache>;\n isFontFamilyUsed: boolean;\n fontLanguage: string;\n hasDisplayTransformability: boolean;\n getFontMetadata: (fontId: string) => FontMetadata;\n injectFontResources: (resources: InjectableFontResources | null) => void;\n removeFontResources: () => void;\n getFontInjectables: (options?: { language?: string } | { key?: string }, optimize?: boolean) => InjectableFontResources | null;\n lineHeightOptions: Record<ThLineHeightOptions, number | null>;\n contentProtectionConfig?: IContentProtectionConfig;\n onNavigatorReady?: () => void;\n onNavigatorLoaded?: () => void;\n onCleanup?: () => void;\n}\n\nexport const useWebPubReaderInit = ({\n container,\n publication,\n initialPosition,\n listeners,\n preferences,\n cache,\n isFontFamilyUsed,\n fontLanguage,\n hasDisplayTransformability,\n getFontMetadata,\n injectFontResources,\n removeFontResources,\n getFontInjectables,\n lineHeightOptions,\n contentProtectionConfig,\n onNavigatorReady,\n onNavigatorLoaded,\n onCleanup,\n}: UseWebPubReaderInitProps) => {\n const [navigatorReady, setNavigatorReady] = useState(false);\n\n const { webPubPreferences } = useWebPubPreferencesConfig({\n settings: cache.current.settings,\n fontLanguage,\n hasDisplayTransformability,\n getFontMetadata,\n lineHeightOptions,\n });\n\n const { injectables } = useWebPubInjectablesConfig({\n isFontFamilyUsed,\n fontLanguage,\n getFontInjectables,\n });\n\n const handleCleanup = useCallback(() => {\n removeFontResources();\n onCleanup?.();\n }, [removeFontResources, onCleanup]);\n\n const { WebPubNavigatorLoad, WebPubNavigatorDestroy } = useWebPubNavigator();\n const isNavigatorLoadedWebPub = useRef(false);\n \n useEffect(() => {\n // Only initialize once, never re-render\n if (!publication || isNavigatorLoadedWebPub.current) return;\n\n // Add container protection\n if (!container.current) {\n console.error(\"Container ref is not available for navigator initialization\");\n return;\n }\n\n const config: WebPubNavigatorLoadProps = {\n container: container.current,\n publication,\n listeners,\n initialPosition: initialPosition ? new Locator(initialPosition) : undefined,\n preferences: webPubPreferences,\n defaults: {\n experiments: preferences.experiments?.webPub || null\n },\n injectables,\n contentProtection: contentProtectionConfig,\n };\n\n isNavigatorLoadedWebPub.current = true;\n \n // Call onNavigatorReady outside of navigator load\n onNavigatorReady?.();\n \n // Pass onNavigatorLoaded as the callback to WebPubNavigatorLoad\n WebPubNavigatorLoad(config, () => {\n // Set navigatorReady to true only after navigator actually loads\n setNavigatorReady(true);\n onNavigatorLoaded?.();\n });\n\n return () => {\n if (isNavigatorLoadedWebPub.current) {\n setNavigatorReady(false);\n WebPubNavigatorDestroy(() => {\n isNavigatorLoadedWebPub.current = false;\n handleCleanup();\n });\n }\n };\n }, []);\n\n // Handle font resource injection\n useEffect(() => {\n if (isFontFamilyUsed) {\n const fontResources = getFontInjectables({ language: fontLanguage });\n if (fontResources) {\n injectFontResources(getFontInjectables(undefined, true));\n }\n }\n }, [isFontFamilyUsed, fontLanguage, getFontInjectables, injectFontResources]);\n\n return {\n navigatorReady,\n };\n};\n","\"use client\";\n\nimport { useState, useRef, useCallback, useMemo, useLayoutEffect } from \"react\";\n\nimport readerStyles from \"../assets/styles/thorium-web.reader.app.module.css\";\n\nimport { StatefulReaderProps } from \"../Reader/StatefulReaderWrapper\";\n\nimport { \n ThActionsKeys, \n ThLayoutUI,\n ThDocumentTitleFormat,\n ThProgressionFormat, \n ThSpacingSettingsKeys,\n ThSettingsKeys\n} from \"@/preferences/models\";\n\nimport { ThPluginRegistry } from \"../Plugins/PluginRegistry\";\n\nimport { ThPluginProvider } from \"../Plugins/PluginProvider\";\nimport { NavigatorProvider } from \"@/core/Navigator\";\n\nimport {\n BasicTextSelection,\n ContextMenuEvent,\n FrameClickEvent,\n KeyboardEventData,\n SuspiciousActivityEvent,\n} from \"@readium/navigator-html-injectables\";\nimport { WebPubNavigatorListeners } from \"@readium/navigator\";\nimport {\n Locator,\n Publication\n} from \"@readium/shared\";\n\nimport { StatefulDockingWrapper } from \"../Docking/StatefulDockingWrapper\";\nimport { StatefulReaderHeader } from \"../StatefulReaderHeader\";\nimport { StatefulReaderFooter } from \"../StatefulReaderFooter\";\nimport { PositionStorage } from \"../Reader/StatefulReaderWrapper\";\n\nimport { usePreferences } from \"@/preferences/hooks/usePreferences\";\nimport { useSettingsComponentStatus } from \"@/components/Settings/hooks/useSettingsComponentStatus\";\nimport { useWebPubNavigator } from \"@/core/Hooks/WebPub\";\nimport { useWebPubSettingsCache } from \"@/core/Hooks/WebPub/useWebPubSettingsCache\";\nimport { useWebPubReaderInit } from \"./Hooks/useReaderInit\";\nimport { useFullscreen } from \"@/core/Hooks/useFullscreen\";\nimport { useI18n } from \"@/i18n/useI18n\";\nimport { useTimeline } from \"@/core/Hooks/useTimeline\";\nimport { usePositionStorage } from \"@/hooks/usePositionStorage\";\nimport { useDocumentTitle } from \"@/core/Hooks/useDocumentTitle\";\nimport { useSpacingPresets } from \"../Settings/Spacing/hooks/useSpacingPresets\";\nimport { useLineHeight } from \"../Settings/Spacing/hooks/useLineHeight\";\nimport { useFonts } from \"@/core/Hooks/fonts/useFonts\";\n\nimport { toggleActionOpen } from \"@/lib/actionsReducer\";\nimport { useAppSelector, useAppDispatch, useAppStore } from \"@/lib/hooks\";\nimport { \n setLoading,\n setHovering, \n toggleImmersive, \n setFullscreen,\n} from \"@/lib/readerReducer\";\nimport { \n setTimeline,\n setPublicationStart,\n setPublicationEnd\n} from \"@/lib/publicationReducer\";\n\nimport classNames from \"classnames\";\nimport { createDefaultPlugin } from \"../Plugins/helpers/createDefaultPlugin\";\nimport Peripherals from \"../../helpers/peripherals\";\nimport { getReaderClassNames } from \"../Helpers/getReaderClassNames\";\nimport { resolveContentProtectionConfig } from \"@/preferences/models/protection\";\n\nexport const ExperimentalWebPubStatefulReader = ({\n publication,\n localDataKey,\n plugins,\n positionStorage\n}: StatefulReaderProps) => {\n const [pluginsRegistered, setPluginsRegistered] = useState(false);\n\n useLayoutEffect(() => {\n if (plugins && plugins.length > 0) {\n plugins.forEach(plugin => {\n ThPluginRegistry.register(plugin);\n });\n } else {\n ThPluginRegistry.register(createDefaultPlugin());\n }\n setPluginsRegistered(true);\n }, [plugins]);\n\n if (!pluginsRegistered) {\n return null;\n }\n\n return (\n <>\n <ThPluginProvider>\n <StatefulReaderInner publication={ publication } localDataKey={ localDataKey } positionStorage={ positionStorage } />\n </ThPluginProvider>\n </>\n );\n};\n\nconst StatefulReaderInner = ({ publication, localDataKey, positionStorage }: { publication: Publication; localDataKey: string | null; positionStorage?: PositionStorage }) => {\n const { preferences, getFontMetadata, getFontInjectables } = usePreferences();\n const { t } = useI18n();\n const { getEffectiveSpacingValue } = useSpacingPresets();\n const { injectFontResources, removeFontResources } = useFonts();\n\n // Check if font family component is being used\n const { isComponentUsed: isFontFamilyUsed } = useSettingsComponentStatus({\n settingsKey: ThSettingsKeys.fontFamily,\n publicationType: \"webpub\",\n });\n\n const container = useRef<HTMLDivElement>(null);\n\n const textAlign = useAppSelector(state => state.webPubSettings.textAlign);\n const fontFamily = useAppSelector(state => state.webPubSettings.fontFamily);\n const fontWeight = useAppSelector(state => state.webPubSettings.fontWeight);\n const hyphens = useAppSelector(state => state.webPubSettings.hyphens);\n const ligatures = useAppSelector(state => state.webPubSettings.ligatures);\n const noRuby = useAppSelector(state => state.webPubSettings.noRuby);\n const letterSpacing = getEffectiveSpacingValue(ThSpacingSettingsKeys.letterSpacing);\n const lineHeight = getEffectiveSpacingValue(ThSpacingSettingsKeys.lineHeight);\n const paragraphIndent = getEffectiveSpacingValue(ThSpacingSettingsKeys.paragraphIndent);\n const paragraphSpacing = getEffectiveSpacingValue(ThSpacingSettingsKeys.paragraphSpacing);\n const publisherStyles = useAppSelector(state => state.webPubSettings.publisherStyles);\n const textNormalization = useAppSelector(state => state.webPubSettings.textNormalization);\n const wordSpacing = getEffectiveSpacingValue(ThSpacingSettingsKeys.wordSpacing);\n const zoom = useAppSelector(state => state.webPubSettings.zoom);\n const fontLanguage = useAppSelector(state => state.publication.fontLanguage);\n const hasDisplayTransformability = useAppSelector(state => state.publication.hasDisplayTransformability);\n const isImmersive = useAppSelector(state => state.reader.isImmersive);\n const isHovering = useAppSelector(state => state.reader.isHovering);\n\n const cache = useWebPubSettingsCache(\n fontFamily,\n fontWeight,\n hyphens,\n letterSpacing,\n ligatures,\n lineHeight,\n noRuby,\n paragraphIndent,\n paragraphSpacing,\n publisherStyles,\n textAlign,\n textNormalization,\n wordSpacing,\n zoom\n );\n\n const layoutUI = preferences.theming.layout.ui?.webPub || ThLayoutUI.stacked;\n\n const dispatch = useAppDispatch();\n\n const onFsChange = useCallback((isFullscreen: boolean) => {\n dispatch(setFullscreen(isFullscreen));\n }, [dispatch]);\n const fs = useFullscreen(onFsChange);\n\n const webPubNavigator = useWebPubNavigator();\n const { \n currentPositions,\n canGoBackward,\n canGoForward,\n } = webPubNavigator;\n\n const { setLocalData, getLocalData, localData } = usePositionStorage(localDataKey, positionStorage);\n\n const timeline = useTimeline({\n publication: publication,\n currentLocation: localData,\n currentPositions: currentPositions() || [],\n positionsList: undefined,\n onChange: (timeline) => {\n dispatch(setTimeline(timeline));\n }\n });\n\n const lineHeightOptions = useLineHeight();\n\n const documentTitleFormat = preferences.metadata?.documentTitle?.format;\n\n let documentTitle: string | undefined;\n\n if (documentTitleFormat) {\n if (typeof documentTitleFormat === \"object\" && \"key\" in documentTitleFormat) {\n const translatedTitle = t(documentTitleFormat.key);\n documentTitle = translatedTitle !== documentTitleFormat.key \n ? translatedTitle \n : documentTitleFormat.fallback;\n } else {\n switch (documentTitleFormat) {\n case ThDocumentTitleFormat.title:\n documentTitle = timeline?.title;\n break;\n case ThDocumentTitleFormat.chapter:\n documentTitle = timeline?.progression?.currentChapter;\n break;\n case ThDocumentTitleFormat.titleAndChapter:\n if (timeline?.title && timeline?.progression?.currentChapter) {\n documentTitle = `${ timeline.title } – ${ timeline.progression.currentChapter }`;\n }\n break;\n case ThDocumentTitleFormat.none:\n documentTitle = undefined;\n break;\n default: \n documentTitle = documentTitleFormat;\n break;\n }\n }\n }\n\n useDocumentTitle(documentTitle);\n\n const toggleIsImmersive = useCallback(() => {\n // If tap/click in iframe, then header/footer no longer hoovering \n dispatch(setHovering(false));\n dispatch(toggleImmersive());\n }, [dispatch]);\n\n const appStore = useAppStore();\n\n const p = useMemo(() => new Peripherals(appStore, preferences.actions, {\n moveTo: () => {},\n goProgression: () => {},\n toggleAction: (actionKey) => {\n switch (actionKey) {\n case ThActionsKeys.fullscreen:\n fs.handleFullscreen();\n break;\n case ThActionsKeys.settings:\n case ThActionsKeys.toc:\n dispatch(toggleActionOpen({\n key: actionKey,\n profile: \"webPub\"\n }))\n break;\n default:\n break\n }\n }\n }), [appStore, preferences.actions, fs, dispatch]);\n\n const listeners: WebPubNavigatorListeners = useMemo(() => ({\n frameLoaded: async function (_wnd: Window): Promise<void> {\n p.observe(window);\n },\n positionChanged: async function (locator: Locator): Promise<void> {\n setLocalData(locator);\n\n if (canGoBackward()) {\n dispatch(setPublicationStart(false));\n } else {\n dispatch(setPublicationStart(true));\n }\n\n if (canGoForward()) {\n dispatch(setPublicationEnd(false));\n } else {\n dispatch(setPublicationEnd(true));\n }\n },\n tap: function (_e: FrameClickEvent): boolean {\n toggleIsImmersive();\n return true;\n },\n click: function (_e: FrameClickEvent): boolean {\n return false;\n },\n zoom: function (_scale: number): void { },\n scroll: function (_delta: number): void { },\n customEvent: function (_key: string, _data: unknown): void { },\n handleLocator: function (locator: Locator): boolean {\n const href = locator.href;\n\n if (\n href.startsWith(\"http://\") ||\n href.startsWith(\"https://\") ||\n href.startsWith(\"mailto:\") ||\n href.startsWith(\"tel:\")\n ) {\n if (confirm(`Open \"${href}\" ?`)) window.open(href, \"_blank\");\n } else {\n console.warn(\"Unhandled locator\", locator);\n }\n return false;\n },\n textSelected: function (_selection: BasicTextSelection): void {},\n contentProtection: function (_type: string, _data: SuspiciousActivityEvent): void {},\n contextMenu: function (_data: ContextMenuEvent): void {},\n peripheral: function (_data: KeyboardEventData): void {},\n }), [p, setLocalData, canGoBackward, canGoForward, dispatch, toggleIsImmersive]);\n\n const initialPosition = useMemo(() => getLocalData(), [getLocalData]);\n\n // Initialize reader using the new composite hook\n const { navigatorReady } = useWebPubReaderInit({\n container,\n publication,\n initialPosition,\n listeners,\n preferences,\n cache,\n isFontFamilyUsed,\n fontLanguage,\n hasDisplayTransformability,\n getFontMetadata,\n injectFontResources,\n removeFontResources,\n getFontInjectables,\n lineHeightOptions,\n contentProtectionConfig: resolveContentProtectionConfig(preferences.contentProtection, t),\n onNavigatorReady: () => {\n dispatch(setLoading(false));\n },\n onNavigatorLoaded: () => {\n p.observe(window);\n },\n onCleanup: () => {\n p.destroy();\n },\n });\n\n return (\n <>\n <NavigatorProvider visualNavigator={ webPubNavigator }>\n <main className={ readerStyles.main }>\n <StatefulDockingWrapper>\n <div \n className={ \n classNames(\n getReaderClassNames({\n isScroll: true,\n isImmersive,\n isHovering,\n layoutUI\n })\n )\n }\n >\n <StatefulReaderHeader \n actionKeys={ preferences.actions.webPubOrder }\n actionsOrder={ preferences.actions.webPubOrder }\n layout={ layoutUI } \n runningHeadFormatPref={ preferences.theming.header?.runningHead?.format?.webPub }\n />\n\n <article className={ readerStyles.wrapper } aria-label={ t(\"reader.app.publicationWrapper\") }>\n <div id=\"thorium-web-container\" className={ readerStyles.iframeContainer } ref={ container }></div>\n </article>\n\n <StatefulReaderFooter \n layout={ layoutUI } \n progressionFormatPref={ preferences.theming.progression?.format?.webPub }\n progressionFormatFallback={ ThProgressionFormat.readingOrderIndex }\n />\n </div>\n </StatefulDockingWrapper>\n </main>\n </NavigatorProvider>\n </>\n)};"]}
@@ -1,60 +0,0 @@
1
- import { useMemo } from 'react';
2
-
3
- // src/core/Components/Actions/hooks/useCollapsibility.ts
4
- var ThCollapsibilityVisibility = /* @__PURE__ */ ((ThCollapsibilityVisibility2) => {
5
- ThCollapsibilityVisibility2["always"] = "always";
6
- ThCollapsibilityVisibility2["partially"] = "partially";
7
- ThCollapsibilityVisibility2["overflow"] = "overflow";
8
- return ThCollapsibilityVisibility2;
9
- })(ThCollapsibilityVisibility || {});
10
- var useCollapsibility = (items, prefs, breakpoint) => {
11
- const [actionIcons, menuItems] = useMemo(() => {
12
- const actionIcons2 = [];
13
- const menuItems2 = [];
14
- let countdown = 0;
15
- if (prefs.collapse) {
16
- if (typeof prefs.collapse === "object" && !(prefs.collapse instanceof Boolean)) {
17
- if (breakpoint) {
18
- const prefForBreakpoint = prefs.collapse[breakpoint];
19
- if (prefForBreakpoint) {
20
- if (prefForBreakpoint === "all") {
21
- countdown = 0;
22
- } else if (!isNaN(prefForBreakpoint)) {
23
- if (prefForBreakpoint === items.length) {
24
- countdown = 0;
25
- } else if (prefForBreakpoint < items.length) {
26
- countdown = items.length - (prefForBreakpoint - 1);
27
- }
28
- }
29
- }
30
- }
31
- }
32
- [...items].slice().reverse().map((item) => {
33
- const actionPref = prefs.keys[item.key];
34
- if (actionPref.visibility === "overflow" /* overflow */) {
35
- menuItems2.unshift(item);
36
- --countdown;
37
- } else if (actionPref.visibility === "partially" /* partially */) {
38
- if (countdown > 0) {
39
- menuItems2.unshift(item);
40
- --countdown;
41
- } else {
42
- actionIcons2.unshift(item);
43
- }
44
- } else {
45
- actionIcons2.unshift(item);
46
- }
47
- });
48
- } else {
49
- items.map((item) => {
50
- actionIcons2.push(item);
51
- });
52
- }
53
- return [actionIcons2, menuItems2];
54
- }, [items, prefs, breakpoint]);
55
- return { ActionIcons: actionIcons, MenuItems: menuItems };
56
- };
57
-
58
- export { ThCollapsibilityVisibility, useCollapsibility };
59
- //# sourceMappingURL=chunk-MLEYTQGK.mjs.map
60
- //# sourceMappingURL=chunk-MLEYTQGK.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/Components/Actions/hooks/useCollapsibility.ts"],"names":["ThCollapsibilityVisibility","actionIcons","menuItems"],"mappings":";;;AAQO,IAAK,0BAAA,qBAAAA,2BAAAA,KAAL;AACL,EAAAA,4BAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,4BAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,4BAAA,UAAA,CAAA,GAAW,UAAA;AAHD,EAAA,OAAAA,2BAAAA;AAAA,CAAA,EAAA,0BAAA,IAAA,EAAA;AAiBL,IAAM,iBAAA,GAAoB,CAAC,KAAA,EAAgC,KAAA,EAAwB,UAAA,KAAwB;AAChH,EAAA,MAAM,CAAC,WAAA,EAAa,SAAS,CAAA,GAAI,QAAQ,MAAM;AAC7C,IAAA,MAAMC,eAAuC,EAAC;AAC9C,IAAA,MAAMC,aAAqC,EAAC;AAE5C,IAAA,IAAI,SAAA,GAAoB,CAAA;AAExB,IAAA,IAAI,MAAM,QAAA,EAAU;AAElB,MAAA,IAAI,OAAO,KAAA,CAAM,QAAA,KAAa,YAAY,EAAE,KAAA,CAAM,oBAAoB,OAAA,CAAA,EAAU;AAC9E,QAAA,IAAI,UAAA,EAAY;AACd,UAAA,MAAM,iBAAA,GAAoB,KAAA,CAAM,QAAA,CAAS,UAAU,CAAA;AACnD,UAAA,IAAI,iBAAA,EAAmB;AACrB,YAAA,IAAI,sBAAsB,KAAA,EAAO;AAC/B,cAAA,SAAA,GAAY,CAAA;AAAA,YACd,CAAA,MAAA,IAAW,CAAC,KAAA,CAAM,iBAAiB,CAAA,EAAG;AACpC,cAAA,IAAI,iBAAA,KAAsB,MAAM,MAAA,EAAQ;AACtC,gBAAA,SAAA,GAAY,CAAA;AAAA,cACd,CAAA,MAAA,IAAW,iBAAA,GAAoB,KAAA,CAAM,MAAA,EAAQ;AAG3C,gBAAA,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ThCollapsibility = boolean | Record<string, number | \"all\">;\n\nexport enum ThCollapsibilityVisibility {\n always = \"always\",\n partially = \"partially\",\n overflow = \"overflow\"\n}\n\nexport interface CollapsiblePref {\n displayOrder: string[];\n collapse: ThCollapsibility;\n keys: {\n [key: string]: {\n [key: string]: any;\n visibility: ThCollapsibilityVisibility;\n };\n }\n}\n\nexport const useCollapsibility = (items: ThActionEntry<string>[], prefs: CollapsiblePref, breakpoint?: string) => {\n const [actionIcons, menuItems] = useMemo(() => {\n const actionIcons: ThActionEntry<string>[] = [];\n const menuItems: ThActionEntry<string>[] = [];\n\n let countdown: number = 0;\n\n if (prefs.collapse) {\n // Handling number of items to collapse\n if (typeof prefs.collapse === \"object\" && !(prefs.collapse instanceof Boolean)) {\n if (breakpoint) {\n const prefForBreakpoint = prefs.collapse[breakpoint];\n if (prefForBreakpoint) {\n if (prefForBreakpoint === \"all\") {\n countdown = 0;\n } else if (!isNaN(prefForBreakpoint)) {\n if (prefForBreakpoint === items.length) {\n countdown = 0;\n } else if (prefForBreakpoint < items.length) {\n // We must take the overflow icon into account so that\n // it doesn’t contain only one partially visible item \n countdown = items.length - (prefForBreakpoint - 1);\n }\n }\n }\n }\n }\n\n // Creating a shallow copy so that actionsOrder doesn’t mutate between rerenders\n [...items].slice().reverse().map((item) => {\n const actionPref = prefs.keys[item.key];\n if (actionPref.visibility === ThCollapsibilityVisibility.overflow) {\n menuItems.unshift(item);\n --countdown;\n } else if (actionPref.visibility === ThCollapsibilityVisibility.partially) {\n if (countdown > 0) {\n menuItems.unshift(item);\n --countdown;\n } else {\n actionIcons.unshift(item);\n }\n } else {\n actionIcons.unshift(item);\n }\n });\n } else {\n // collapse set to false so we ignore visibility and don’t triage\n items.map((item) => {\n actionIcons.push(item);\n });\n }\n\n return [actionIcons, menuItems];\n }, [items, prefs, breakpoint]);\n\n return { ActionIcons: actionIcons, MenuItems: menuItems };\n}"]}