@edrlab/thorium-web 1.1.7 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ThPreferencesAdapter-B8AYujCA.d.mts → ThPreferencesAdapter-DrZ5_6Dv.d.mts} +4 -139
- package/dist/{ThSettingsWrapper-BlmAxcWF.d.mts → ThSettingsWrapper-8Kx0SnH4.d.mts} +1 -1
- package/dist/{actions-BRtHsxpm.d.mts → actions-D2CHvCHu.d.mts} +2 -2
- package/dist/{actionsReducer-bT0pfxLJ.d.mts → actionsReducer-kc-S130w.d.mts} +3 -24
- package/dist/{chunk-KJXHAJYK.mjs → chunk-4VHEHMJN.mjs} +128 -11
- package/dist/chunk-4VHEHMJN.mjs.map +1 -0
- package/dist/{chunk-6V3O7FCS.mjs → chunk-72XCX5TD.mjs} +3 -3
- package/dist/{chunk-6V3O7FCS.mjs.map → chunk-72XCX5TD.mjs.map} +1 -1
- package/dist/{chunk-YIW2OOMW.mjs → chunk-7NEQAW7J.mjs} +2 -2
- package/dist/chunk-7NEQAW7J.mjs.map +1 -0
- package/dist/{chunk-COQXDRKD.mjs → chunk-K3K7TUWM.mjs} +2 -2
- package/dist/chunk-K3K7TUWM.mjs.map +1 -0
- package/dist/chunk-P4V3LA5R.mjs +407 -0
- package/dist/chunk-P4V3LA5R.mjs.map +1 -0
- package/dist/{chunk-4C3UOTX4.mjs → chunk-PXAUQJEU.mjs} +172 -27
- package/dist/chunk-PXAUQJEU.mjs.map +1 -0
- package/dist/chunk-QPE574OW.mjs +913 -0
- package/dist/chunk-QPE574OW.mjs.map +1 -0
- package/dist/chunk-RRDEPGBK.mjs +75 -0
- package/dist/chunk-RRDEPGBK.mjs.map +1 -0
- package/dist/components/Epub/index.css +7 -0
- package/dist/components/Epub/index.css.map +1 -1
- package/dist/components/Epub/index.d.mts +17 -11
- package/dist/components/Epub/index.mjs +9 -828
- package/dist/components/Epub/index.mjs.map +1 -1
- package/dist/components/Misc/index.css +23 -0
- package/dist/components/Misc/index.css.map +1 -1
- package/dist/components/Misc/index.d.mts +10 -1
- package/dist/components/Misc/index.mjs +31 -3
- package/dist/components/Misc/index.mjs.map +1 -1
- package/dist/components/Reader/index.css +1290 -0
- package/dist/components/Reader/index.css.map +1 -0
- package/dist/components/Reader/index.d.mts +30 -0
- package/dist/components/Reader/index.mjs +79 -0
- package/dist/components/Reader/index.mjs.map +1 -0
- package/dist/components/WebPub/index.css +7 -0
- package/dist/components/WebPub/index.css.map +1 -1
- package/dist/components/WebPub/index.d.mts +16 -32
- package/dist/components/WebPub/index.mjs +9 -372
- package/dist/components/WebPub/index.mjs.map +1 -1
- package/dist/core/Components/index.d.mts +7 -6
- package/dist/core/Helpers/index.d.mts +1 -1
- package/dist/core/Hooks/index.d.mts +55 -6
- package/dist/core/Hooks/index.mjs +1 -1
- package/dist/errorHandler-CL2YIfQY.d.mts +26 -0
- package/dist/i18n/index.mjs +2 -2
- package/dist/immer.d-CoRThNOF.d.mts +23 -0
- package/dist/lib/index.d.mts +12 -162
- package/dist/lib/index.mjs +1 -1
- package/dist/locales/el/thorium-web.json +31 -0
- package/dist/locales/en/thorium-shared.json +84 -0
- package/dist/locales/en/thorium-web.json +10 -1
- package/dist/locales/et/thorium-shared.json +93 -2
- package/dist/locales/et/thorium-web.json +6 -2
- package/dist/locales/fi/thorium-shared.json +82 -8
- package/dist/locales/fi/thorium-web.json +2 -1
- package/dist/locales/fr/thorium-shared.json +100 -0
- package/dist/locales/it/thorium-shared.json +9 -0
- package/dist/locales/lt/thorium-shared.json +22 -13
- package/dist/locales/lt/thorium-web.json +2 -1
- package/dist/locales/pt-PT/thorium-shared.json +64 -1
- package/dist/locales/pt-PT/thorium-web.json +4 -3
- package/dist/locales/sv/thorium-shared.json +61 -3
- package/dist/locales/sv/thorium-web.json +4 -3
- package/dist/preferences/index.d.mts +8 -7
- package/dist/preferences/index.mjs +1 -1
- package/dist/settingsReducer-C1wwCAMv.d.mts +159 -0
- package/dist/{ui-BVlJcPL_.d.mts → ui-CamWuqOo.d.mts} +1 -1
- package/dist/useContrast-D6sjPjxy.d.mts +152 -0
- package/dist/{useEpubNavigator-CsraD65e.d.mts → useEpubNavigator-CwHJfoiV.d.mts} +1 -1
- package/dist/{usePreferences-rfT368__.d.mts → usePreferences-BXFJbval.d.mts} +1 -1
- package/dist/{StatefulReader-CjgFzHoO.d.mts → useReaderTransitions-guT-eA-Q.d.mts} +50 -50
- package/dist/{useWebPubNavigator-Che8r5Wg.d.mts → useWebPubNavigator-CuSNQKMw.d.mts} +1 -1
- package/package.json +5 -3
- package/dist/chunk-4C3UOTX4.mjs.map +0 -1
- package/dist/chunk-COQXDRKD.mjs.map +0 -1
- package/dist/chunk-KJXHAJYK.mjs.map +0 -1
- package/dist/chunk-YIW2OOMW.mjs.map +0 -1
- package/dist/useContrast-Cgsrl7GS.d.mts +0 -15
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { e as UnstableShortcutRepresentation } from './keyboardUtilities-BWAyLS_D.mjs';
|
|
2
|
-
import { B as BreakpointsMap,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { B as BreakpointsMap, T as ThBreakpoints, a as ThBreakpointsObject, b as ThLayoutDirection, c as ThDocumentTitleFormat, d as ThBackLinkPref, e as ThFormatPref, f as ThRunningHeadFormat, g as ThProgressionFormat, h as ThLayoutUI, i as ThPaginatedAffordancePref } from './ui-CamWuqOo.mjs';
|
|
3
|
+
import { I as I18nValue, d as ThColorScheme, e as ThContrast, f as ThSettingsKeys, g as ThTextSettingsKeys, b as ThSpacingSettingsKeys, h as ThSettingsRangePref, i as ThSettingsRadioPref, T as ThLineHeightOptions, j as ThSettingsGroupPref, a as ThSpacingPresetKeys } from './useContrast-D6sjPjxy.mjs';
|
|
4
|
+
import { b as ThSheetTypes, c as ThActionsKeys, d as ThCollapsibility, e as ThActionsTokens, f as ThDockingPref, T as ThDockingKeys } from './actions-D2CHvCHu.mjs';
|
|
5
5
|
import { IContentProtectionConfig, ExperimentKey } from '@readium/navigator';
|
|
6
6
|
|
|
7
7
|
type CSSValueUnitless = `${number}`;
|
|
@@ -22,11 +22,6 @@ type CSSTime = CSSValueWithUnit<"ms" | "s">;
|
|
|
22
22
|
type CSSViewport = CSSDefaultViewport | CSSDynamicViewport | CSSLargeViewport | CSSSmallViewport;
|
|
23
23
|
type CSSColor = string | `#${string}` | `rgb(${string})` | `rgba(${string})` | `hsl(${string})` | `hsla(${string})` | `hwb(${string})` | `lab(${string})` | `lch(${string})` | `oklab(${string})` | `oklch(${string})` | `color(${string})` | `color-mix(${string})` | `light-dark(${string})`;
|
|
24
24
|
|
|
25
|
-
type I18nValue<T> = T | string | {
|
|
26
|
-
key: string;
|
|
27
|
-
fallback?: string;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
25
|
interface SystemFontSource {
|
|
31
26
|
type: "system";
|
|
32
27
|
}
|
|
@@ -165,136 +160,6 @@ declare const defaultContentProtectionConfig: ContentProtectionConfig;
|
|
|
165
160
|
*/
|
|
166
161
|
declare const devContentProtectionConfig: ContentProtectionConfig;
|
|
167
162
|
|
|
168
|
-
interface ThSettingsGroupPref<T> {
|
|
169
|
-
main: T[];
|
|
170
|
-
subPanel: T[] | null;
|
|
171
|
-
header?: ThSheetHeaderVariant;
|
|
172
|
-
}
|
|
173
|
-
interface ThSettingsRangePref {
|
|
174
|
-
variant?: ThSettingsRangeVariant;
|
|
175
|
-
placeholder?: I18nValue<ThSettingsRangePlaceholder>;
|
|
176
|
-
range?: [number, number];
|
|
177
|
-
step?: number;
|
|
178
|
-
}
|
|
179
|
-
interface ThSettingsRadioPref<T extends string> {
|
|
180
|
-
allowUnset?: boolean;
|
|
181
|
-
keys: {
|
|
182
|
-
[key in T]: number;
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
declare enum ThSettingsKeys {
|
|
186
|
-
columns = "columns",
|
|
187
|
-
fontFamily = "fontFamily",
|
|
188
|
-
fontWeight = "fontWeight",
|
|
189
|
-
hyphens = "hyphens",
|
|
190
|
-
layout = "layout",
|
|
191
|
-
letterSpacing = "letterSpacing",
|
|
192
|
-
lineHeight = "lineHeight",
|
|
193
|
-
paragraphIndent = "paragraphIndent",
|
|
194
|
-
paragraphSpacing = "paragraphSpacing",
|
|
195
|
-
publisherStyles = "publisherStyles",
|
|
196
|
-
spacingGroup = "spacingGroup",
|
|
197
|
-
spacingPresets = "spacingPresets",
|
|
198
|
-
textAlign = "textAlign",
|
|
199
|
-
textGroup = "textGroup",
|
|
200
|
-
textNormalize = "textNormalize",
|
|
201
|
-
theme = "theme",
|
|
202
|
-
wordSpacing = "wordSpacing",
|
|
203
|
-
zoom = "zoom"
|
|
204
|
-
}
|
|
205
|
-
declare enum ThTextSettingsKeys {
|
|
206
|
-
fontFamily = "fontFamily",
|
|
207
|
-
fontWeight = "fontWeight",
|
|
208
|
-
hyphens = "hyphens",
|
|
209
|
-
textAlign = "textAlign",
|
|
210
|
-
textNormalize = "textNormalize"
|
|
211
|
-
}
|
|
212
|
-
declare enum ThSpacingSettingsKeys {
|
|
213
|
-
letterSpacing = "letterSpacing",
|
|
214
|
-
lineHeight = "lineHeight",
|
|
215
|
-
paragraphIndent = "paragraphIndent",
|
|
216
|
-
paragraphSpacing = "paragraphSpacing",
|
|
217
|
-
publisherStyles = "publisherStyles",
|
|
218
|
-
spacingPresets = "spacingPresets",
|
|
219
|
-
wordSpacing = "wordSpacing"
|
|
220
|
-
}
|
|
221
|
-
declare enum ThSettingsContainerKeys {
|
|
222
|
-
initial = "initial",
|
|
223
|
-
text = "text",
|
|
224
|
-
spacing = "spacing"
|
|
225
|
-
}
|
|
226
|
-
declare enum ThSettingsRangeVariant {
|
|
227
|
-
slider = "slider",
|
|
228
|
-
incrementedSlider = "incrementedSlider",
|
|
229
|
-
numberField = "numberField"
|
|
230
|
-
}
|
|
231
|
-
declare enum ThSettingsRangePlaceholder {
|
|
232
|
-
range = "range",
|
|
233
|
-
none = "none"
|
|
234
|
-
}
|
|
235
|
-
declare enum ThSpacingPresetKeys {
|
|
236
|
-
publisher = "publisher",
|
|
237
|
-
tight = "tight",
|
|
238
|
-
balanced = "balanced",
|
|
239
|
-
loose = "loose",
|
|
240
|
-
accessible = "accessible",
|
|
241
|
-
custom = "custom"
|
|
242
|
-
}
|
|
243
|
-
declare enum ThLayoutOptions {
|
|
244
|
-
scroll = "scroll_option",
|
|
245
|
-
paginated = "page_option"
|
|
246
|
-
}
|
|
247
|
-
declare enum ThTextAlignOptions {
|
|
248
|
-
publisher = "publisher",
|
|
249
|
-
start = "start",
|
|
250
|
-
justify = "justify"
|
|
251
|
-
}
|
|
252
|
-
declare enum ThLineHeightOptions {
|
|
253
|
-
publisher = "publisher",
|
|
254
|
-
small = "small",
|
|
255
|
-
medium = "medium",
|
|
256
|
-
large = "large"
|
|
257
|
-
}
|
|
258
|
-
declare const defaultTextSettingsMain: ThTextSettingsKeys[];
|
|
259
|
-
declare const defaultTextSettingsSubpanel: ThTextSettingsKeys[];
|
|
260
|
-
declare const defaultSpacingSettingsMain: ThSpacingSettingsKeys[];
|
|
261
|
-
declare const defaultSpacingSettingsSubpanel: ThSpacingSettingsKeys[];
|
|
262
|
-
declare const defaultSpacingPresetsOrder: ThSpacingPresetKeys[];
|
|
263
|
-
declare const defaultParagraphSpacing: Required<ThSettingsRangePref>;
|
|
264
|
-
declare const defaultParagraphIndent: Required<ThSettingsRangePref>;
|
|
265
|
-
declare const defaultWordSpacing: Required<ThSettingsRangePref>;
|
|
266
|
-
declare const defaultLetterSpacing: Required<ThSettingsRangePref>;
|
|
267
|
-
declare const defaultLineHeights: {
|
|
268
|
-
small: number;
|
|
269
|
-
medium: number;
|
|
270
|
-
large: number;
|
|
271
|
-
};
|
|
272
|
-
declare const defaultZoom: Required<ThSettingsRangePref>;
|
|
273
|
-
declare const defaultSpacingPresets: {
|
|
274
|
-
tight: {
|
|
275
|
-
lineHeight: ThLineHeightOptions;
|
|
276
|
-
paragraphSpacing: number;
|
|
277
|
-
paragraphIndent: number;
|
|
278
|
-
};
|
|
279
|
-
balanced: {
|
|
280
|
-
lineHeight: ThLineHeightOptions;
|
|
281
|
-
paragraphSpacing: number;
|
|
282
|
-
paragraphIndent: number;
|
|
283
|
-
};
|
|
284
|
-
loose: {
|
|
285
|
-
lineHeight: ThLineHeightOptions;
|
|
286
|
-
paragraphSpacing: number;
|
|
287
|
-
paragraphIndent: number;
|
|
288
|
-
};
|
|
289
|
-
accessible: {
|
|
290
|
-
lineHeight: ThLineHeightOptions;
|
|
291
|
-
paragraphSpacing: number;
|
|
292
|
-
paragraphIndent: number;
|
|
293
|
-
letterSpacing: number;
|
|
294
|
-
wordSpacing: number;
|
|
295
|
-
};
|
|
296
|
-
};
|
|
297
|
-
|
|
298
163
|
declare enum ThThemeKeys {
|
|
299
164
|
light = "light",
|
|
300
165
|
sepia = "sepia",
|
|
@@ -646,4 +511,4 @@ interface ThPreferencesAdapter<T extends CustomizableKeys = CustomizableKeys> {
|
|
|
646
511
|
unsubscribe(callback: (prefs: ThPreferences<T>) => void): void;
|
|
647
512
|
}
|
|
648
513
|
|
|
649
|
-
export { type
|
|
514
|
+
export { type FontSource as $, type ActionKey as A, type CSSFrequency as B, type CustomizableKeys as C, type DefaultKeys as D, type CSSFontRelativeLength as E, type FontCollection as F, type CSSLargeViewport as G, type CSSPhysicalLength as H, type CSSRelativeLength as I, type CSSResolution as J, type CSSRootFontRelativeLength as K, type LocalStaticFontFile as L, type CSSSmallViewport as M, type CSSTime as N, type CSSViewport as O, type CSSColor as P, type SystemFontSource as Q, type BunnyFontSource as R, type SettingsKey as S, type ThPreferencesAdapter as T, type GoogleFontSource as U, type VariableFontRangeConfig as V, type WeightConfig as W, type LocalVariableFontFile as X, type LocalStaticFontSource as Y, type LocalVariableFontSource as Z, type LocalFontSource as _, type ThPreferences as a, type FontSpec as a0, type ValidatedLanguageCollection as a1, type ThFontFamilyPref as a2, readiumCSSFontCollection as a3, defaultFontCollection as a4, tamilCollection as a5, type CopyProtectionConfig as a6, type PrintProtectionConfig as a7, type ContentProtectionConfig as a8, resolveContentProtectionConfig as a9, defaultContentProtectionConfig as aa, devContentProtectionConfig as ab, lightTheme as ac, darkTheme as ad, paperTheme as ae, sepiaTheme as af, contrast1Theme as ag, contrast2Theme as ah, contrast3Theme as ai, type ThemeTokens as b, type FontDefinition as c, ThThemeKeys as d, type ThemeKey as e, type TextSettingsKey as f, type SpacingSettingsKey as g, type ThSettingsSpacingPresets as h, type ThSpacingPreset as i, type ThActionsPref as j, type ThSettingsKeyTypes as k, type ThConstraintKeys as l, createPreferences as m, type ActionKeyType as n, type ThemeKeyType as o, type SettingsKeyType as p, type TextSettingsKeyType as q, type SpacingSettingsKeyType as r, type useThemingProps as s, type CSSValueUnitless as t, useTheming as u, type CSSValueWithUnit as v, type CSSAbsoluteLength as w, type CSSAngle as x, type CSSDefaultViewport as y, type CSSDynamicViewport as z };
|
|
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import React__default, { ComponentType, SVGProps } from 'react';
|
|
3
3
|
import { TooltipTriggerProps, KeyboardProps } from 'react-aria';
|
|
4
4
|
import { ButtonProps, TooltipProps, MenuItemProps, LabelProps, MenuProps, MenuTriggerProps, PopoverProps, NumberFieldProps, GroupProps, InputProps, RadioGroupProps, RadioProps, SliderProps, SliderOutputProps, SliderTrackProps, SliderThumbProps, SwitchProps, HeadingProps, SelectProps, Button, ListBoxProps, ListBox, ListBoxItemProps, Heading } from 'react-aria-components';
|
|
5
|
-
import { p as ThActionEntry, q as ThActionsBarProps, C as CollapsiblePref } from './actions-
|
|
5
|
+
import { p as ThActionEntry, q as ThActionsBarProps, C as CollapsiblePref } from './actions-D2CHvCHu.mjs';
|
|
6
6
|
|
|
7
7
|
interface HTMLAttributesWithRef<T> extends React.HTMLAttributes<T> {
|
|
8
8
|
ref?: React.ForwardedRef<T>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ToolbarProps } from 'react-aria-components';
|
|
3
|
-
import { B as BreakpointsMap } from './ui-
|
|
3
|
+
import { B as BreakpointsMap } from './ui-CamWuqOo.mjs';
|
|
4
4
|
|
|
5
5
|
declare enum ThActionsTriggerVariant {
|
|
6
6
|
button = "iconButton",
|
|
@@ -105,4 +105,4 @@ declare const defaultFullscreenAction: ThActionsTokens;
|
|
|
105
105
|
declare const defaultTocAction: ThActionsTokens;
|
|
106
106
|
declare const defaultJumpToPositionAction: ThActionsTokens;
|
|
107
107
|
|
|
108
|
-
export { type CollapsiblePref as C, ThDockingKeys as T,
|
|
108
|
+
export { type CollapsiblePref as C, ThDockingKeys as T, ThSheetHeaderVariant as a, ThSheetTypes as b, ThActionsKeys as c, type ThCollapsibility as d, type ThActionsTokens as e, type ThDockingPref as f, type ThBottomSheetDetent as g, type ThActionsDockedPref as h, type ThActionsSnappedPref as i, ThDockingTypes as j, defaultActionKeysObject as k, defaultSettingsAction as l, defaultFullscreenAction as m, defaultTocAction as n, defaultJumpToPositionAction as o, type ThActionEntry as p, type ThActionsBarProps as q, ThCollapsibilityVisibility as r, ThActionsTriggerVariant as s, ThActionsBar as t, useCollapsibility as u };
|
|
@@ -1,27 +1,6 @@
|
|
|
1
1
|
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type PrimitiveType = number | string | boolean;
|
|
5
|
-
/** Object types that should never be mapped */
|
|
6
|
-
type AtomicObject = Function | Promise<any> | Date | RegExp;
|
|
7
|
-
/**
|
|
8
|
-
* If the lib "ES2015.Collection" is not included in tsconfig.json,
|
|
9
|
-
* types like ReadonlyArray, WeakMap etc. fall back to `any` (specified nowhere)
|
|
10
|
-
* or `{}` (from the node types), in both cases entering an infinite recursion in
|
|
11
|
-
* pattern matching type mappings
|
|
12
|
-
* This type can be used to cast these types to `void` in these cases.
|
|
13
|
-
*/
|
|
14
|
-
type IfAvailable<T, Fallback = void> = true | false extends (T extends never ? true : false) ? Fallback : keyof T extends never ? Fallback : T;
|
|
15
|
-
/**
|
|
16
|
-
* These should also never be mapped but must be tested after regular Map and
|
|
17
|
-
* Set
|
|
18
|
-
*/
|
|
19
|
-
type WeakReferences = IfAvailable<WeakMap<any, any>> | IfAvailable<WeakSet<any>>;
|
|
20
|
-
type WritableDraft<T> = {
|
|
21
|
-
-readonly [K in keyof T]: Draft<T[K]>;
|
|
22
|
-
};
|
|
23
|
-
/** Convert a readonly type into a mutable type, if possible */
|
|
24
|
-
type Draft<T> = T extends PrimitiveType ? T : T extends AtomicObject ? T : T extends ReadonlyMap<infer K, infer V> ? Map<Draft<K>, Draft<V>> : T extends ReadonlySet<infer V> ? Set<Draft<V>> : T extends WeakReferences ? T : T extends object ? WritableDraft<T> : T;
|
|
2
|
+
import { W as WritableDraft } from './immer.d-CoRThNOF.mjs';
|
|
3
|
+
import { T as ThDockingKeys } from './actions-D2CHvCHu.mjs';
|
|
25
4
|
|
|
26
5
|
type ActionsStateKeys = string;
|
|
27
6
|
type OverflowStateKeys = string;
|
|
@@ -132,4 +111,4 @@ declare const setDockPanelWidth: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
|
132
111
|
width: number;
|
|
133
112
|
}, "actions/setDockPanelWidth">;
|
|
134
113
|
|
|
135
|
-
export { type ActionsStateKeys as A, type DockStateObject as D, type OverflowStateKeys as O, type
|
|
114
|
+
export { type ActionsStateKeys as A, type DockStateObject as D, type OverflowStateKeys as O, type ActionStateObject as a, type OverflowStateObject as b, type ActionStateDockPayload as c, type ActionStateOpenPayload as d, type ActionStateTogglePayload as e, type ActionOverflowOpenPayload as f, type ActionStateDockedPayload as g, type ActionStateSlotPayload as h, type ActionStateSlotWidthPayload as i, type DockState as j, type ActionsReducerState as k, actionsSlice as l, dockAction as m, setOverflow as n, activateDockPanel as o, deactivateDockPanel as p, collapseDockPanel as q, expandDockPanel as r, setActionOpen as s, toggleActionOpen as t, setDockPanelWidth as u };
|
|
@@ -48,26 +48,30 @@ var useLocalStorage = (key) => {
|
|
|
48
48
|
const [localData, setLocalData] = useState(null);
|
|
49
49
|
const cachedLocalData = useRef(null);
|
|
50
50
|
const setValue = (newValue) => {
|
|
51
|
+
if (!key) return;
|
|
51
52
|
setLocalData(newValue);
|
|
52
53
|
localStorage.setItem(key, JSON.stringify(newValue));
|
|
53
54
|
};
|
|
54
55
|
const getValue = () => {
|
|
56
|
+
if (!key) return null;
|
|
55
57
|
if (localData !== null) return localData;
|
|
56
58
|
const value = localStorage.getItem(key);
|
|
57
59
|
return value ? JSON.parse(value) : null;
|
|
58
60
|
};
|
|
59
61
|
const clearValue = () => {
|
|
62
|
+
if (!key) return;
|
|
60
63
|
setLocalData(null);
|
|
61
64
|
localStorage.removeItem(key);
|
|
62
65
|
};
|
|
63
66
|
useEffect(() => {
|
|
67
|
+
if (!key) return;
|
|
64
68
|
cachedLocalData.current = localData;
|
|
65
|
-
}, [localData]);
|
|
69
|
+
}, [localData, key]);
|
|
66
70
|
return {
|
|
67
71
|
setLocalData: setValue,
|
|
68
72
|
getLocalData: getValue,
|
|
69
73
|
clearLocalData: clearValue,
|
|
70
|
-
localData,
|
|
74
|
+
localData: key ? localData : null,
|
|
71
75
|
cachedLocalData
|
|
72
76
|
};
|
|
73
77
|
};
|
|
@@ -321,7 +325,7 @@ var useEpubNavigator = () => {
|
|
|
321
325
|
const getSetting = useCallback((settingKey) => {
|
|
322
326
|
return navigatorInstance?.settings[settingKey];
|
|
323
327
|
}, []);
|
|
324
|
-
|
|
328
|
+
const FXLPositionChangedCallbackRef = useRef(void 0);
|
|
325
329
|
const FXLPositionChanged = useMemo(() => {
|
|
326
330
|
return new MutationObserver((mutationsList) => {
|
|
327
331
|
for (const mutation of mutationsList) {
|
|
@@ -330,18 +334,21 @@ var useEpubNavigator = () => {
|
|
|
330
334
|
const oldVal = mutation.oldValue;
|
|
331
335
|
if (newVal?.split(re)[1] !== oldVal?.split(re)[1]) {
|
|
332
336
|
const locator = navigatorInstance?.currentLocator;
|
|
333
|
-
if (locator) {
|
|
334
|
-
|
|
337
|
+
if (locator && FXLPositionChangedCallbackRef.current) {
|
|
338
|
+
FXLPositionChangedCallbackRef.current(locator);
|
|
335
339
|
}
|
|
336
340
|
}
|
|
337
341
|
}
|
|
338
342
|
});
|
|
339
|
-
}, [
|
|
340
|
-
const EpubNavigatorLoad = useCallback((config, cb) => {
|
|
343
|
+
}, []);
|
|
344
|
+
const EpubNavigatorLoad = useCallback((config, cb, fxlCallback) => {
|
|
341
345
|
if (config.container) {
|
|
342
346
|
container.current = config.container;
|
|
343
347
|
containerParent.current = container.current ? container.current.parentElement : null;
|
|
344
348
|
publication.current = config.publication;
|
|
349
|
+
if (fxlCallback) {
|
|
350
|
+
FXLPositionChangedCallbackRef.current = fxlCallback;
|
|
351
|
+
}
|
|
345
352
|
navigatorInstance = new EpubNavigator(
|
|
346
353
|
config.container,
|
|
347
354
|
config.publication,
|
|
@@ -461,10 +468,71 @@ var useEpubNavigator = () => {
|
|
|
461
468
|
submitPreferences,
|
|
462
469
|
getCframes,
|
|
463
470
|
onFXLPositionChange: (cb) => {
|
|
464
|
-
|
|
471
|
+
FXLPositionChangedCallbackRef.current = cb;
|
|
465
472
|
}
|
|
466
473
|
};
|
|
467
474
|
};
|
|
475
|
+
var useEpubSettingsCache = (textAlign, columnCount, fontFamily, fontSize, fontWeight, hyphens, letterSpacing, lineLength, lineHeight, paragraphIndent, paragraphSpacing, publisherStyles, scroll, textNormalization, wordSpacing, theme) => {
|
|
476
|
+
const cache = useRef({
|
|
477
|
+
settings: {
|
|
478
|
+
columnCount,
|
|
479
|
+
fontFamily,
|
|
480
|
+
fontSize,
|
|
481
|
+
fontWeight,
|
|
482
|
+
hyphens,
|
|
483
|
+
letterSpacing,
|
|
484
|
+
lineHeight,
|
|
485
|
+
lineLength,
|
|
486
|
+
paragraphIndent,
|
|
487
|
+
paragraphSpacing,
|
|
488
|
+
publisherStyles,
|
|
489
|
+
scroll,
|
|
490
|
+
textAlign,
|
|
491
|
+
textNormalization,
|
|
492
|
+
theme,
|
|
493
|
+
wordSpacing
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
const memoizedCache = useMemo(() => ({
|
|
497
|
+
settings: {
|
|
498
|
+
columnCount,
|
|
499
|
+
fontFamily,
|
|
500
|
+
fontSize,
|
|
501
|
+
fontWeight,
|
|
502
|
+
hyphens,
|
|
503
|
+
letterSpacing,
|
|
504
|
+
lineHeight,
|
|
505
|
+
lineLength,
|
|
506
|
+
paragraphIndent,
|
|
507
|
+
paragraphSpacing,
|
|
508
|
+
publisherStyles,
|
|
509
|
+
scroll,
|
|
510
|
+
textAlign,
|
|
511
|
+
textNormalization,
|
|
512
|
+
theme,
|
|
513
|
+
wordSpacing
|
|
514
|
+
}
|
|
515
|
+
}), [
|
|
516
|
+
columnCount,
|
|
517
|
+
fontFamily,
|
|
518
|
+
fontSize,
|
|
519
|
+
fontWeight,
|
|
520
|
+
hyphens,
|
|
521
|
+
letterSpacing,
|
|
522
|
+
lineHeight,
|
|
523
|
+
lineLength,
|
|
524
|
+
paragraphIndent,
|
|
525
|
+
paragraphSpacing,
|
|
526
|
+
publisherStyles,
|
|
527
|
+
scroll,
|
|
528
|
+
textAlign,
|
|
529
|
+
textNormalization,
|
|
530
|
+
theme,
|
|
531
|
+
wordSpacing
|
|
532
|
+
]);
|
|
533
|
+
cache.current = memoizedCache;
|
|
534
|
+
return cache;
|
|
535
|
+
};
|
|
468
536
|
var navigatorInstance2 = null;
|
|
469
537
|
var useWebPubNavigator = () => {
|
|
470
538
|
const container = useRef(null);
|
|
@@ -587,7 +655,56 @@ var useWebPubNavigator = () => {
|
|
|
587
655
|
getCframes
|
|
588
656
|
};
|
|
589
657
|
};
|
|
658
|
+
var useWebPubSettingsCache = (fontFamily, fontWeight, hyphens, letterSpacing, lineHeight, paragraphIndent, paragraphSpacing, publisherStyles, textAlign, textNormalization, wordSpacing, zoom) => {
|
|
659
|
+
const cache = useRef({
|
|
660
|
+
settings: {
|
|
661
|
+
fontFamily,
|
|
662
|
+
fontWeight,
|
|
663
|
+
hyphens,
|
|
664
|
+
letterSpacing,
|
|
665
|
+
lineHeight,
|
|
666
|
+
paragraphIndent,
|
|
667
|
+
paragraphSpacing,
|
|
668
|
+
publisherStyles,
|
|
669
|
+
textAlign,
|
|
670
|
+
textNormalization,
|
|
671
|
+
wordSpacing,
|
|
672
|
+
zoom
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
const memoizedCache = useMemo(() => ({
|
|
676
|
+
settings: {
|
|
677
|
+
fontFamily,
|
|
678
|
+
fontWeight,
|
|
679
|
+
hyphens,
|
|
680
|
+
letterSpacing,
|
|
681
|
+
lineHeight,
|
|
682
|
+
paragraphIndent,
|
|
683
|
+
paragraphSpacing,
|
|
684
|
+
publisherStyles,
|
|
685
|
+
textAlign,
|
|
686
|
+
textNormalization,
|
|
687
|
+
wordSpacing,
|
|
688
|
+
zoom
|
|
689
|
+
}
|
|
690
|
+
}), [
|
|
691
|
+
fontFamily,
|
|
692
|
+
fontWeight,
|
|
693
|
+
hyphens,
|
|
694
|
+
letterSpacing,
|
|
695
|
+
lineHeight,
|
|
696
|
+
paragraphIndent,
|
|
697
|
+
paragraphSpacing,
|
|
698
|
+
publisherStyles,
|
|
699
|
+
textAlign,
|
|
700
|
+
textNormalization,
|
|
701
|
+
wordSpacing,
|
|
702
|
+
zoom
|
|
703
|
+
]);
|
|
704
|
+
cache.current = memoizedCache;
|
|
705
|
+
return cache;
|
|
706
|
+
};
|
|
590
707
|
|
|
591
|
-
export { timelineInstance, useDocumentTitle, useEpubNavigator, useFullscreen, useIsClient, useLocalStorage, useTimeline, useWebPubNavigator };
|
|
592
|
-
//# sourceMappingURL=chunk-
|
|
593
|
-
//# sourceMappingURL=chunk-
|
|
708
|
+
export { timelineInstance, useDocumentTitle, useEpubNavigator, useEpubSettingsCache, useFullscreen, useIsClient, useLocalStorage, useTimeline, useWebPubNavigator, useWebPubSettingsCache };
|
|
709
|
+
//# sourceMappingURL=chunk-4VHEHMJN.mjs.map
|
|
710
|
+
//# sourceMappingURL=chunk-4VHEHMJN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/Hooks/useDocumentTitle.ts","../src/core/Hooks/useIsClient.ts","../src/core/Hooks/useFullscreen.ts","../src/core/Hooks/useLocalStorage.ts","../src/core/Hooks/useTimeline.ts","../src/core/Hooks/Epub/useEpubNavigator.ts","../src/core/Hooks/Epub/useEpubSettingsCache.ts","../src/core/Hooks/WebPub/useWebPubNavigator.ts","../src/core/Hooks/WebPub/useWebPubSettingsCache.ts"],"names":["useState","useEffect","useRef","useCallback","positionsList","timelineItems","currentItem","useMemo","Layout","currentLocator","navigatorInstance"],"mappings":";;;;;AAIO,IAAM,gBAAA,GAAmB,CAAC,KAAA,KAAmB;AAClD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,KAAA,WAAgB,KAAA,GAAQ,KAAA;AAAA,EAC9B,CAAA,EAAG,CAAC,KAAK,CAAC,CAAA;AACZ;ACJO,IAAM,cAAc,MAAM;AAC/B,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAS,KAAK,CAAA;AAE9C,EAAA,eAAA,CAAgB,MAAM;AACpB,IAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,WAAA,CAAY,IAAI,CAAA;AAAA,EACrD,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,QAAA;AACT;;;ACPO,IAAM,aAAA,GAAgB,CAAC,QAAA,KAA+C;AAC3E,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAIA,SAAS,KAAK,CAAA;AACtD,EAAA,MAAM,WAAW,WAAA,EAAY;AAE7B,EAAA,MAAM,gBAAA,GAAmB,YAAY,MAAM;AACzC,IAAA,IAAI,CAAC,QAAA,EAAU;AAEf,IAAA,IAAI,CAAC,SAAS,iBAAA,EAAmB;AAC/B,MAAA,QA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MACR,UAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAA;AAAA,MACA,aAAA;AAAA,MACA,UAAA;AAAA,MACA,eAAA;AAAA,MACA,gBAAA;AAAA,MACA,eAAA;AAAA,MACA,SAAA;AAAA,MACA,iBAAA;AAAA,MACA,WAAA;AAAA,MACA;AAAA;AACF,GACD,CAAA;AAED,EAAA,MAAM,aAAA,GAAgBK,QAAQ,OAAO;AAAA,IACnC,QAAA,EAAU;AAAA,MACR,UAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAA;AAAA,MACA,aAAA;AAAA,MACA,UAAA;AAAA,MACA,eAAA;AAAA,MACA,gBAAA;AAAA,MACA,eAAA;AAAA,MACA,SAAA;AAAA,MACA,iBAAA;AAAA,MACA,WAAA;AAAA,MACA;AAAA;AACF,GACF,CAAA,EAAI;AAAA,IACF,UAAA;AAAA,IACA,UAAA;AAAA,IACA,OAAA;AAAA,IACA,aAAA;AAAA,IACA,UAAA;AAAA,IACA,eAAA;AAAA,IACA,gBAAA;AAAA,IACA,eAAA;AAAA,IACA,SAAA;AAAA,IACA,iBAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACD,CAAA;AAGD,EAAA,KAAA,CAAM,OAAA,GAAU,aAAA;AAEhB,EAAA,OAAO,KAAA;AACT","file":"chunk-4VHEHMJN.mjs","sourcesContent":["\"use client\";\n\nimport { useEffect } from \"react\";\n\nexport const useDocumentTitle = (title?: string) => {\n useEffect(() => {\n if (title) document.title = title;\n }, [title]);\n};","\"use client\";\n\nimport { useLayoutEffect, useState } from \"react\";\n\nexport const useIsClient = () => {\n const [isClient, setIsClient] = useState(false);\n\n useLayoutEffect(() => {\n if (typeof window !== \"undefined\") setIsClient(true);\n }, []);\n\n return isClient;\n}","\"use client\";\n\nimport { useCallback, useEffect, useState } from \"react\";\nimport { useIsClient } from \"./useIsClient\";\n\nexport const useFullscreen = (onChange?: (isFullscreen: boolean) => void) => {\n const [isFullscreen, setIsFullscreen] = useState(false);\n const isClient = useIsClient();\n\n const handleFullscreen = useCallback(() => {\n if (!isClient) return;\n\n if (!document.fullscreenElement) {\n document.documentElement.requestFullscreen();\n } else if (document.exitFullscreen) {\n document.exitFullscreen();\n }\n }, [isClient]);\n\n useEffect(() => {\n const onFSchange = () => {\n const isFs = Boolean(document.fullscreenElement);\n setIsFullscreen(isFs);\n onChange && onChange(isFs);\n }\n document.addEventListener(\"fullscreenchange\", onFSchange);\n\n return () => {\n document.removeEventListener(\"fullscreenchange\", onFSchange);\n }\n }, [onChange]);\n\n return {\n isFullscreen,\n handleFullscreen\n }\n}","\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\n\nexport const useLocalStorage = (key: string | null) => {\n const [localData, setLocalData] = useState<any>(null);\n const cachedLocalData = useRef<any>(null);\n\n const setValue = (newValue: any) => {\n if (!key) return;\n setLocalData(newValue);\n localStorage.setItem(key, JSON.stringify(newValue));\n };\n\n const getValue = () => {\n if (!key) return null;\n if (localData !== null) return localData;\n const value = localStorage.getItem(key);\n return value ? JSON.parse(value) : null;\n };\n\n const clearValue = () => {\n if (!key) return;\n setLocalData(null);\n localStorage.removeItem(key);\n };\n\n useEffect(() => {\n if (!key) return;\n cachedLocalData.current = localData;\n }, [localData, key]);\n\n return {\n setLocalData: setValue,\n getLocalData: getValue,\n clearLocalData: clearValue,\n localData: key ? localData : null,\n cachedLocalData\n };\n};","import { useCallback, useEffect, useRef, useState, useMemo } from \"react\";\n\nimport { Layout, Link, Locator, Publication } from \"@readium/shared\";\n\nexport interface TocItem {\n id: string;\n href: string;\n title?: string;\n children?: TocItem[];\n position?: number;\n}\n\nexport interface TimelineItem {\n href: string;\n readingOrderIndex?: number;\n title?: string;\n fragments?: string[];\n positionRange?: [number, number?];\n progressionRange?: [number, number?];\n totalProgressionRange?: [number, number?];\n children?: TimelineItem[];\n}\n\nexport interface TimelineProgression {\n totalItems?: number;\n currentIndex?: number;\n totalPositions?: number;\n currentPositions?: number[];\n relativeProgression?: number;\n totalProgression?: number;\n currentChapter?: string;\n positionsLeft?: number;\n}\n\nexport interface UnstableTimeline {\n title?: string;\n items?: {\n [href: string]: TimelineItem;\n };\n toc?: {\n tree?: TocItem[];\n currentEntry?: string | null;\n };\n currentItem?: TimelineItem | null;\n previousItem?: TimelineItem | null;\n nextItem?: TimelineItem | null;\n progression?: TimelineProgression;\n}\n\nexport let timelineInstance: UnstableTimeline | undefined;\n\nexport const useTimeline = ({\n publication, \n currentLocation, \n currentPositions,\n positionsList,\n onChange\n}: {\n publication: Publication | null, \n currentLocation?: Locator, \n currentPositions?: number[],\n positionsList?: Locator[],\n onChange?: (timeline: UnstableTimeline) => void\n}): UnstableTimeline => {\n const layout = publication?.metadata.effectiveLayout || Layout.reflowable;\n\n const [timelineItems, setTimelineItems] = useState<{ [href: string]: TimelineItem }>({});\n const [tocTree, setTocTree] = useState<TocItem[]>([]);\n const [currentTocEntry, setCurrentTocEntry] = useState<string | null>(null);\n const [currentItem, setCurrentItem] = useState<TimelineItem | null>(null);\n const [previousItem, setPreviousItem] = useState<TimelineItem | null>(null);\n const [nextItem, setNextItem] = useState<TimelineItem | null>(null);\n\n const [relativeProgression, setRelativeProgression] = useState<number | undefined>(undefined);\n const [totalProgression, setTotalProgression] = useState<number | undefined>(undefined);\n\n const idCounterRef = useRef(0);\n\n // Create the timeline object\n const timeline = useMemo(() => ({\n title: publication?.metadata.title.getTranslation(\"en\"),\n items: timelineItems,\n toc: {\n tree: tocTree,\n currentEntry: currentTocEntry\n },\n currentItem,\n previousItem,\n nextItem,\n progression: {\n totalItems: publication?.readingOrder.items.length,\n currentIndex: currentItem?.readingOrderIndex !== undefined ? currentItem.readingOrderIndex + 1 : undefined,\n totalPositions: positionsList?.length,\n currentPositions: currentPositions || [],\n relativeProgression: relativeProgression,\n totalProgression: totalProgression,\n currentChapter: currentItem?.title,\n positionsLeft: (() => {\n const endPosition = currentItem?.positionRange?.[1];\n const currentPosition = currentPositions?.[0];\n \n // Only calculate positionsLeft if we have all required position data\n if (!positionsList?.length || endPosition === undefined || currentPosition === undefined) {\n return undefined;\n }\n \n return Math.max(0, endPosition - currentPosition);\n })()\n }\n }), [\n publication?.metadata.title,\n publication?.readingOrder.items,\n timelineItems,\n tocTree,\n currentTocEntry,\n currentItem,\n previousItem,\n nextItem,\n positionsList,\n currentPositions,\n relativeProgression,\n totalProgression\n ]);\n\n const buildTocTree = useCallback((\n links: Link[],\n idGenerator: () => string,\n positionsList?: Locator[],\n publicationTitle?: string\n ): TocItem[] => {\n return links.map((link) => {\n // Generate a new ID for the current Link\n const newId = idGenerator();\n \n // Create a plain object for compatibility with Tree components\n let href = link.href;\n const fragmentIndex = href.indexOf(\"#\");\n if (fragmentIndex !== -1) {\n const baseHref = href.substring(0, fragmentIndex);\n const duplicateLink = links.find((l) => l.href.startsWith(baseHref) && l.href !== href);\n if (!duplicateLink) {\n href = baseHref;\n }\n }\n \n const treeNode: TocItem = {\n id: newId,\n href: href,\n title: link.title || (\n publicationTitle \n ? `${ publicationTitle } ${ idCounterRef.current }` \n : newId\n ),\n position: positionsList?.find((position) => position.href === href)?.locations.position\n };\n \n // Recursively process children if they exist\n if (link.children) {\n treeNode.children = buildTocTree(link.children.items, idGenerator, positionsList, publicationTitle);\n }\n \n return treeNode;\n });\n }, []);\n\n const handleTocEntryOnNav = useCallback((locator?: Locator, currentPos?: number[]) => {\n if (!locator || !tocTree.length) return;\n\n const findMatch = (items: TocItem[], link?: Link): TocItem | undefined => {\n for (const item of items) {\n if (item.href === link?.href) {\n return item;\n }\n if (item.children) {\n const match = findMatch(item.children, link);\n if (match) return match;\n }\n }\n return undefined;\n };\n\n const currentMatch = findMatch(tocTree, new Link(locator));\n if (currentMatch) {\n setCurrentTocEntry(currentMatch.id);\n return;\n }\n\n // If we're in FXL and didn't find a match, try to find a match for the other position in the spread\n if (layout === Layout.fixed) {\n if (currentPos && currentPos.length === 2) {\n const otherPosition = currentPos[0] === locator.locations.position ? currentPos[1] : currentPos[0];\n const otherPositionInList = positionsList?.find((pos: Locator) => pos.locations.position === otherPosition);\n if (otherPositionInList) {\n const match = findMatch(tocTree, new Link(otherPositionInList));\n if (match) {\n setCurrentTocEntry(match.id);\n return;\n }\n }\n }\n }\n\n // If no match, try to find a match for other positions\n const otherPositions = currentPos?.filter(pos => pos !== locator.locations.position) || [];\n for (const otherPosition of otherPositions) {\n const otherPositionInList = positionsList?.find((pos: Locator) => pos.locations.position === otherPosition);\n if (otherPositionInList) {\n const match = findMatch(tocTree, new Link(otherPositionInList));\n if (match) {\n setCurrentTocEntry(match.id);\n return;\n }\n }\n }\n }, [tocTree, layout, positionsList]);\n\n const buildTimelineItems = useCallback(() => {\n const timelineItems: { [href: string]: TimelineItem } = {};\n const readingOrder = publication?.readingOrder?.items || [];\n const toc = publication?.toc?.items && publication?.toc?.items.length > 0\n ? publication.toc.items\n : publication?.readingOrder?.items || [];\n const flatToc = toc.flatMap(t => [t, ...(t.children?.items || [])]);\n \n // Helper function to get URL base (without params and fragment)\n const getBaseUrl = (url: string): string => {\n const [base] = url.split(\"#\");\n const [path] = base.split(\"?\");\n return path;\n };\n\n // Function to find the first non-empty title by searching backward \n // in flatToc from the current item\"s position\n // The issue with this fallback is that for progressionOfResource\n // the progression is effectively scoped to the reading order item\n // so we have to differentiate using the index \n const findNearestTitle = (currentHref: string): string => {\n const currentIndex = readingOrder.findIndex(item => getBaseUrl(item.href) === getBaseUrl(currentHref));\n \n if (currentIndex === -1) return \"\";\n \n for (let i = currentIndex; i >= 0; i--) {\n const item = readingOrder[i];\n // Find matching TOC items for this reading order item\n const matchingTocItems = flatToc.filter(t => \n getBaseUrl(t.href) === getBaseUrl(item.href)\n );\n \n // If we have a matching TOC item with a title, return it with the difference in indices\n const title = matchingTocItems[0]?.title?.trim();\n if (title) {\n const diff = currentIndex - i;\n return diff > 0 ? `${ title } (${ diff + 1 })` : title;\n }\n }\n \n return \"\";\n };\n\n // Process reading order items\n readingOrder.forEach((item, index) => {\n // Find all matching TOC items (with or without fragment)\n const matchingTocItems = flatToc.filter(t => {\n const baseHref = getBaseUrl(t.href);\n const baseItemHref = getBaseUrl(item.href);\n return baseHref === baseItemHref;\n });\n\n // Create timeline item with all matching titles\n const timelineItem: TimelineItem = {\n href: item.href,\n readingOrderIndex: index,\n title: item.title || matchingTocItems[0]?.title || findNearestTitle(item.href),\n fragments: matchingTocItems\n .map(t => t.href.split(\"#\")[1])\n .filter(Boolean),\n children: matchingTocItems[0]?.children?.items?.map(child => ({\n // We do not care about index for children\n // since currentLocation is guaranteed to be in the reading order\n title: child.title,\n href: child.href\n })) || []\n };\n\n timelineItems[item.href] = timelineItem;\n });\n \n // Then add position and progression information from positionsList\n for (const item of readingOrder) {\n const timelineItem = timelineItems[item.href];\n if (!timelineItem) continue;\n\n const positions = positionsList\n ? positionsList\n .filter(p => p.href === item.href)\n .sort((a, b) => (a.locations.position || 0) - (b.locations.position || 0))\n : [];\n \n if (positions.length > 0) {\n const start = positions[0].locations;\n // For single position, use the same location for start and end\n const end = positions.length > 1 \n ? positions[positions.length - 1].locations \n : start; // Use start as end for single position\n \n timelineItem.positionRange = start.position !== undefined \n ? [start.position, end.position]\n : undefined;\n \n timelineItem.progressionRange = start.progression !== undefined \n ? [start.progression, end.progression]\n : undefined;\n \n timelineItem.totalProgressionRange = start.totalProgression !== undefined \n ? [start.totalProgression, end.totalProgression]\n : undefined;\n }\n }\n\n return timelineItems;\n }, [publication?.readingOrder?.items, publication?.toc?.items, positionsList]);\n\n const updateTimelineItems = useCallback((currentLoc?: Locator) => {\n if (!currentLoc || !timelineItems) {\n setPreviousItem(null);\n setNextItem(null);\n setCurrentItem(null);\n return;\n }\n\n const currentItem = timelineItems[currentLoc.href];\n if (!currentItem) {\n setPreviousItem(null);\n setNextItem(null);\n setCurrentItem(null);\n return;\n }\n\n setCurrentItem(currentItem);\n\n const timelineItemsArray = Object.values(timelineItems);\n const currentIndex = timelineItemsArray.findIndex(item => item.href === currentLoc.href);\n\n if (currentIndex === -1) {\n setPreviousItem(null);\n setNextItem(null);\n } else {\n setPreviousItem(currentIndex > 0 ? timelineItemsArray[currentIndex - 1] : null);\n setNextItem(currentIndex < timelineItemsArray.length - 1 ? timelineItemsArray[currentIndex + 1] : null);\n }\n }, [timelineItems]);\n\n useEffect(() => {\n if (!publication) return;\n\n const idGenerator = () => `toc-${ ++idCounterRef.current }`;\n const tocItems = publication.toc?.items && publication.toc.items.length > 0\n ? publication.toc.items\n : publication.readingOrder?.items || [];\n const publicationTitle = publication?.metadata.title.getTranslation(\"en\");\n setTocTree(buildTocTree(tocItems, idGenerator, positionsList, publicationTitle));\n setTimelineItems(buildTimelineItems());\n }, [publication, positionsList, buildTocTree, buildTimelineItems]);\n\n useEffect(() => {\n if (!tocTree.length || !timelineItems) return;\n\n // If we have a current location, use it\n if (currentLocation) {\n handleTocEntryOnNav(currentLocation, currentPositions);\n }\n // Otherwise, use the first TOC entry\n else if (tocTree.length > 0) {\n handleTocEntryOnNav(new Locator({ href: tocTree[0].href, type: \"\" }), currentPositions);\n }\n\n updateTimelineItems(currentLocation);\n\n // Update progression state when location changes\n setRelativeProgression(currentLocation?.locations.progression);\n setTotalProgression(currentLocation?.locations.totalProgression);\n }, [currentLocation, currentPositions, tocTree, timelineItems, handleTocEntryOnNav, updateTimelineItems]);\n\n // Update the singleton and call onChange\n useEffect(() => {\n timelineInstance = timeline;\n if (onChange) {\n onChange(timeline);\n }\n }, [timeline, onChange]);\n\n return timeline;\n};","\"use client\";\n\nimport { useCallback, useMemo, useRef } from \"react\";\n\nimport { \n Layout, \n Link, \n Locator, \n Publication \n} from \"@readium/shared\";\nimport { \n EpubNavigator, \n EpubNavigatorListeners, \n EpubPreferences, \n EpubSettings, \n IContentProtectionConfig, \n IEpubDefaults, \n IEpubPreferences,\n IInjectablesConfig\n} from \"@readium/navigator\";\n\ntype cbb = (ok: boolean) => void;\n\n// Module scoped, singleton instance of navigator\nlet navigatorInstance: EpubNavigator | null = null;\n\nexport interface EpubNavigatorLoadProps {\n container: HTMLDivElement | null;\n publication: Publication;\n listeners: EpubNavigatorListeners;\n positionsList?: Locator[];\n initialPosition?: Locator;\n preferences?: IEpubPreferences;\n defaults?: IEpubDefaults;\n injectables?: IInjectablesConfig;\n contentProtection?: IContentProtectionConfig;\n}\n\nexport const useEpubNavigator = () => {\n const container = useRef<HTMLDivElement | null>(null);\n const containerParent = useRef<HTMLElement | null>(null);\n const publication = useRef<Publication | null>(null);\n\n const submitPreferences = useCallback(async (preferences: IEpubPreferences) => {\n await navigatorInstance?.submitPreferences(new EpubPreferences(preferences));\n }, []);\n\n const getSetting = useCallback(<K extends keyof EpubSettings>(settingKey: K) => {\n return navigatorInstance?.settings[settingKey] as EpubSettings[K];\n }, []);\n\n // [TMP] Working around positionChanged not firing consistently for FXL\n // We’re observing the FXLFramePoolManager spine div element’s style\n // and checking whether its translate3d has changed.\n // Sure IntersectionObserver should be the obvious one to use here,\n // observing iframes instead of the style attribute on the spine element\n // but there’s additional complexity to handle as a spread = 2 iframes\n // And keeping in sync while the FramePool is re-aligning on resize can be suboptimal\n const FXLPositionChangedCallbackRef = useRef<((locator: Locator) => void) | undefined>(undefined);\n const FXLPositionChanged = useMemo(() => { \n return new MutationObserver((mutationsList: MutationRecord[]) => {\n for (const mutation of mutationsList) {\n const re = /translate3d\\(([^)]+)\\)/;\n const newVal = (mutation.target as HTMLElement).getAttribute(mutation.attributeName as string);\n const oldVal = mutation.oldValue;\n if (newVal?.split(re)[1] !== oldVal?.split(re)[1]) {\n const locator = navigatorInstance?.currentLocator;\n if (locator && FXLPositionChangedCallbackRef.current) {\n FXLPositionChangedCallbackRef.current(locator);\n }\n }\n }\n });\n }, []);\n\n const EpubNavigatorLoad = useCallback((config: EpubNavigatorLoadProps, cb: Function, fxlCallback?: (locator: Locator) => void) => {\n if (config.container) {\n container.current = config.container;\n containerParent.current = container.current? container.current.parentElement : null;\n \n publication.current = config.publication;\n\n // Register FXL callback immediately if provided\n if (fxlCallback) {\n FXLPositionChangedCallbackRef.current = fxlCallback;\n }\n\n navigatorInstance = new EpubNavigator(\n config.container, \n config.publication, \n config.listeners, \n config.positionsList, \n config.initialPosition, \n { \n preferences: config.preferences || {}, \n defaults: config.defaults || {}, \n injectables: config.injectables || undefined,\n contentProtection: config.contentProtection || undefined\n }\n );\n\n navigatorInstance.load().then(() => {\n cb();\n\n if (navigatorInstance?.layout === Layout.fixed) {\n // @ts-ignore\n FXLPositionChanged.observe((navigatorInstance?.pool.spineElement as HTMLElement), {\n attributeFilter: [\"style\"], \n attributeOldValue: true\n });\n }\n });\n }\n }, [FXLPositionChanged]);\n\n const EpubNavigatorDestroy = useCallback((cb: Function) => {\n cb();\n\n if (navigatorInstance?.layout === Layout.fixed) {\n FXLPositionChanged.disconnect();\n }\n navigatorInstance?.destroy().then(() => {\n navigatorInstance = null; // Clear the singleton reference\n });\n }, [FXLPositionChanged]);\n\n const goRight = useCallback((animated: boolean, callback: cbb) => {\n navigatorInstance?.goRight(animated, callback);\n }, []);\n\n const goLeft = useCallback((animated: boolean, callback: cbb) => {\n navigatorInstance?.goLeft(animated, callback)\n }, []);\n\n const goBackward = useCallback((animated: boolean, callback: cbb) => {\n navigatorInstance?.goBackward(animated, callback);\n }, []);\n\n const goForward = useCallback((animated: boolean, callback: cbb) => {\n navigatorInstance?.goForward(animated, callback);\n }, []);\n\n const goLink = useCallback((link: Link, animated: boolean, callback: cbb) => {\n navigatorInstance?.goLink(link, animated, callback);\n }, []);\n\n const go = useCallback((locator: Locator, animated: boolean, callback: cbb) => {\n navigatorInstance?.go(locator, animated, callback);\n }, []);\n\n const navLayout = useCallback(() => {\n return navigatorInstance?.layout;\n }, []);\n\n const currentLocator = useCallback(() => {\n return navigatorInstance?.currentLocator;\n }, []);\n\n const getLocatorAtOffset = useCallback((offset: number) => {\n const readingOrder = navigatorInstance?.publication?.readingOrder;\n if (!readingOrder) return null;\n\n const currentLocator = navigatorInstance?.currentLocator;\n if (!currentLocator) return null;\n\n const currentLocatorIndex = readingOrder.findIndexWithHref(currentLocator.href);\n if (currentLocatorIndex === -1) return null;\n \n const newIndex = currentLocatorIndex + offset;\n if (newIndex < 0 || newIndex >= readingOrder.items.length) return null;\n \n return readingOrder.items[newIndex];\n }, []);\n\n const previousLocator = useCallback(() => {\n const link = getLocatorAtOffset(-1);\n if (!link) return null;\n return navigatorInstance?.publication?.manifest?.locatorFromLink(link);\n }, [getLocatorAtOffset]);\n\n const nextLocator = useCallback(() => {\n const link = getLocatorAtOffset(1);\n if (!link) return null;\n return navigatorInstance?.publication?.manifest?.locatorFromLink(link);\n }, [getLocatorAtOffset]);\n\n const currentPositions = useCallback(() => {\n return navigatorInstance?.viewport?.positions;\n }, []);\n\n const canGoBackward = useCallback(() => {\n return navigatorInstance?.canGoBackward;\n }, []);\n\n const canGoForward = useCallback(() => {\n return navigatorInstance?.canGoForward;\n }, []);\n\n const isScrollStart = useCallback(() => {\n return navigatorInstance?.isScrollStart;\n }, []);\n\n const isScrollEnd = useCallback(() => {\n return navigatorInstance?.isScrollEnd;\n }, []);\n\n // Warning: this is an internal member that will become private, do not rely on it\n // See https://github.com/edrlab/thorium-web/issues/25\n const getCframes = useCallback(() => {\n return navigatorInstance?._cframes;\n }, []);\n\n return { \n EpubNavigatorLoad, \n EpubNavigatorDestroy, \n goRight, \n goLeft, \n goBackward, \n goForward,\n goLink, \n go, \n navLayout, \n currentLocator,\n previousLocator,\n nextLocator,\n currentPositions,\n canGoBackward,\n canGoForward,\n isScrollStart,\n isScrollEnd,\n preferencesEditor: navigatorInstance?.preferencesEditor,\n getSetting,\n submitPreferences,\n getCframes,\n onFXLPositionChange: (cb: (locator: Locator) => void) => {\n FXLPositionChangedCallbackRef.current = cb;\n }\n }\n}","\"use client\";\n\nimport { useRef, useMemo } from \"react\";\nimport { ThTextAlignOptions, ThLineHeightOptions } from \"@/preferences/models\";\nimport { LineLengthStateObject, FontFamilyStateObject } from \"@/lib/settingsReducer\";\n\nexport interface ReadiumCSSSettings {\n columnCount: string;\n fontFamily: FontFamilyStateObject;\n fontSize: number;\n fontWeight: number;\n hyphens: boolean | null;\n letterSpacing: number | null;\n lineLength: LineLengthStateObject | null;\n lineHeight: ThLineHeightOptions | null;\n paragraphIndent: number | null;\n paragraphSpacing: number | null;\n publisherStyles: boolean;\n scroll: boolean;\n textAlign: ThTextAlignOptions | null;\n textNormalization: boolean;\n theme?: string;\n wordSpacing: number | null;\n}\n\nexport interface EPubSettingsCache {\n settings: ReadiumCSSSettings;\n}\n\nexport const useEpubSettingsCache = (\n textAlign: ThTextAlignOptions | null,\n columnCount: string,\n fontFamily: FontFamilyStateObject,\n fontSize: number,\n fontWeight: number,\n hyphens: boolean | null,\n letterSpacing: number | null,\n lineLength: LineLengthStateObject | null,\n lineHeight: ThLineHeightOptions | null,\n paragraphIndent: number | null,\n paragraphSpacing: number | null,\n publisherStyles: boolean,\n scroll: boolean,\n textNormalization: boolean,\n wordSpacing: number | null,\n theme: string | undefined\n) => {\n const cache = useRef<EPubSettingsCache>({\n settings: {\n columnCount,\n fontFamily,\n fontSize,\n fontWeight,\n hyphens,\n letterSpacing,\n lineHeight,\n lineLength,\n paragraphIndent,\n paragraphSpacing,\n publisherStyles,\n scroll: scroll,\n textAlign,\n textNormalization,\n theme,\n wordSpacing,\n },\n });\n\n const memoizedCache = useMemo(() => ({\n settings: {\n columnCount,\n fontFamily,\n fontSize,\n fontWeight,\n hyphens,\n letterSpacing,\n lineHeight,\n lineLength,\n paragraphIndent,\n paragraphSpacing,\n publisherStyles,\n scroll: scroll,\n textAlign,\n textNormalization,\n theme,\n wordSpacing,\n },\n }), [\n columnCount,\n fontFamily,\n fontSize,\n fontWeight,\n hyphens,\n letterSpacing,\n lineHeight,\n lineLength,\n paragraphIndent,\n paragraphSpacing,\n publisherStyles,\n scroll,\n textAlign,\n textNormalization,\n theme,\n wordSpacing,\n ]);\n\n // Update synchronously to match original behavior\n cache.current = memoizedCache;\n\n return cache;\n};\n","\"use client\";\n\nimport { useCallback, useRef } from \"react\";\n\nimport {\n Link,\n Locator,\n Publication\n} from \"@readium/shared\";\nimport {\n ExperimentalWebPubNavigator,\n WebPubNavigatorListeners,\n WebPubPreferences,\n WebPubSettings,\n IWebPubDefaults,\n IWebPubPreferences,\n IInjectablesConfig,\n IContentProtectionConfig\n} from \"@readium/navigator\";\n\ntype cbb = (ok: boolean) => void;\n\n// Module scoped, singleton instance of navigator\nlet navigatorInstance: InstanceType<typeof ExperimentalWebPubNavigator> | null = null;\n\nexport interface WebPubNavigatorLoadProps {\n container: HTMLDivElement | null;\n publication: Publication;\n listeners: WebPubNavigatorListeners;\n initialPosition?: Locator;\n preferences?: IWebPubPreferences;\n defaults?: IWebPubDefaults;\n injectables?: IInjectablesConfig;\n contentProtection?: IContentProtectionConfig;\n}\n\nexport const useWebPubNavigator = () => {\n const container = useRef<HTMLDivElement | null>(null);\n const containerParent = useRef<HTMLElement | null>(null);\n const publication = useRef<Publication | null>(null);\n\n const submitPreferences = useCallback(async (preferences: IWebPubPreferences) => {\n await navigatorInstance?.submitPreferences(new WebPubPreferences(preferences));\n }, []);\n \n const getSetting = useCallback(<K extends keyof WebPubSettings>(settingKey: K) => {\n return navigatorInstance?.settings[settingKey] as WebPubSettings[K];\n }, []);\n\n const WebPubNavigatorLoad = useCallback((config: WebPubNavigatorLoadProps, cb: Function) => {\n if (config.container) {\n container.current = config.container;\n containerParent.current = container.current?.parentElement || null;\n\n publication.current = config.publication;\n\n navigatorInstance = new ExperimentalWebPubNavigator(\n config.container, \n config.publication, \n config.listeners, \n config.initialPosition, \n { \n preferences: config.preferences || {}, \n defaults: config.defaults || {}, \n injectables: config.injectables || undefined,\n contentProtection: config.contentProtection || undefined\n }\n );\n\n navigatorInstance.load().then(() => {\n cb();\n });\n }\n }, []);\n\n const WebPubNavigatorDestroy = useCallback((cb: Function) => {\n cb();\n navigatorInstance?.destroy().then(() => {\n navigatorInstance = null; // Clear the singleton reference\n });\n }, []);\n\n const goRight = useCallback((animated: boolean, callback: cbb) => {\n navigatorInstance?.goRight(animated, callback);\n }, []);\n\n const goLeft = useCallback((animated: boolean, callback: cbb) => {\n navigatorInstance?.goLeft(animated, callback);\n }, []);\n\n const goBackward = useCallback((animated: boolean, callback: cbb) => {\n navigatorInstance?.goBackward(animated, callback);\n }, []);\n\n const goForward = useCallback((animated: boolean, callback: cbb) => {\n navigatorInstance?.goForward(animated, callback);\n }, []);\n\n const goLink = useCallback((link: Link, animated: boolean, callback: cbb) => {\n navigatorInstance?.goLink(link, animated, callback);\n }, []);\n\n const go = useCallback((locator: Locator, animated: boolean, callback: cbb) => {\n navigatorInstance?.go(locator, animated, callback);\n }, []);\n\n const currentLocator = useCallback(() => {\n return navigatorInstance?.currentLocator;\n }, []);\n\n const getLocatorAtOffset = useCallback((offset: number) => {\n const readingOrder = navigatorInstance?.publication?.readingOrder;\n if (!readingOrder) return null;\n\n const currentLocator = navigatorInstance?.currentLocator;\n if (!currentLocator) return null;\n\n const currentLocatorIndex = readingOrder.findIndexWithHref(currentLocator.href);\n if (currentLocatorIndex === -1) return null;\n\n const newIndex = currentLocatorIndex + offset;\n if (newIndex < 0 || newIndex >= readingOrder.items.length) return null;\n\n return readingOrder.items[newIndex];\n }, []);\n\n const previousLocator = useCallback(() => {\n const link = getLocatorAtOffset(-1);\n if (!link) return null;\n return navigatorInstance?.publication?.manifest?.locatorFromLink(link);\n }, [getLocatorAtOffset]);\n\n const nextLocator = useCallback(() => {\n const link = getLocatorAtOffset(1);\n if (!link) return null;\n return navigatorInstance?.publication?.manifest?.locatorFromLink(link);\n }, [getLocatorAtOffset]);\n\n const currentPositions = useCallback(() => {\n return navigatorInstance?.viewport?.positions;\n }, []);\n\n const canGoBackward = useCallback(() => {\n return navigatorInstance?.canGoBackward;\n }, []);\n\n const canGoForward = useCallback(() => {\n return navigatorInstance?.canGoForward;\n }, []);\n\n const isScrollStart = useCallback(() => {\n return navigatorInstance?.isScrollStart;\n }, []);\n\n const isScrollEnd = useCallback(() => {\n return navigatorInstance?.isScrollEnd;\n }, []);\n\n const getCframes = useCallback(() => {\n return navigatorInstance?._cframes;\n }, []);\n\n return {\n WebPubNavigatorLoad, \n WebPubNavigatorDestroy, \n goRight, \n goLeft, \n goBackward, \n goForward,\n goLink, \n go, \n currentLocator,\n previousLocator,\n nextLocator,\n currentPositions,\n canGoBackward,\n canGoForward,\n isScrollStart,\n isScrollEnd,\n preferencesEditor: navigatorInstance?.preferencesEditor,\n getSetting,\n submitPreferences,\n getCframes\n }\n}","\"use client\";\n\nimport { useRef, useMemo } from \"react\";\nimport { ThTextAlignOptions, ThLineHeightOptions } from \"@/preferences/models\";\nimport { FontFamilyStateObject } from \"@/lib/settingsReducer\";\n\nexport interface WebPubCSSSettings {\n fontFamily: FontFamilyStateObject;\n fontWeight: number;\n hyphens: boolean | null;\n letterSpacing: number | null;\n lineHeight: ThLineHeightOptions | null;\n paragraphIndent: number | null;\n paragraphSpacing: number | null;\n publisherStyles: boolean;\n textAlign: ThTextAlignOptions | null;\n textNormalization: boolean;\n wordSpacing: number | null;\n zoom: number;\n}\n\nexport interface WebPubStatelessCache {\n settings: WebPubCSSSettings;\n}\n\nexport const useWebPubSettingsCache = (\n fontFamily: FontFamilyStateObject,\n fontWeight: number,\n hyphens: boolean | null,\n letterSpacing: number | null,\n lineHeight: ThLineHeightOptions | null,\n paragraphIndent: number | null,\n paragraphSpacing: number | null,\n publisherStyles: boolean,\n textAlign: ThTextAlignOptions | null,\n textNormalization: boolean,\n wordSpacing: number | null,\n zoom: number\n) => {\n const cache = useRef<WebPubStatelessCache>({\n settings: {\n fontFamily,\n fontWeight,\n hyphens,\n letterSpacing,\n lineHeight,\n paragraphIndent,\n paragraphSpacing,\n publisherStyles,\n textAlign,\n textNormalization,\n wordSpacing,\n zoom,\n },\n });\n\n const memoizedCache = useMemo(() => ({\n settings: {\n fontFamily,\n fontWeight,\n hyphens,\n letterSpacing,\n lineHeight,\n paragraphIndent,\n paragraphSpacing,\n publisherStyles,\n textAlign,\n textNormalization,\n wordSpacing,\n zoom,\n },\n }), [\n fontFamily,\n fontWeight,\n hyphens,\n letterSpacing,\n lineHeight,\n paragraphIndent,\n paragraphSpacing,\n publisherStyles,\n textAlign,\n textNormalization,\n wordSpacing,\n zoom,\n ]);\n\n // Update synchronously to match original behavior\n cache.current = memoizedCache;\n\n return cache;\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { usePreferences } from './chunk-
|
|
1
|
+
import { usePreferences } from './chunk-7NEQAW7J.mjs';
|
|
2
2
|
import { i18n, initI18n } from './chunk-IYAFKTPL.mjs';
|
|
3
3
|
import { I18nextProvider } from 'react-i18next';
|
|
4
4
|
export { Trans } from 'react-i18next';
|
|
@@ -31,5 +31,5 @@ var ThI18nProvider = ({
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export { ThI18nProvider };
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-72XCX5TD.mjs.map
|
|
35
|
+
//# sourceMappingURL=chunk-72XCX5TD.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/i18n/ThI18nProvider.tsx"],"names":[],"mappings":";;;;;;;AAYO,IAAM,iBAAiB,CAAC;AAAA,EAC7B,QAAA;AAAA,EACA,GAAG;AACL,CAAA,KAA2B;AACzB,EAAA,MAAM,EAAE,WAAA,EAAY,GAAI,cAAA,EAAe;AACvC,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAI,QAAA,CAAS,KAAK,aAAa,CAAA;AAErE,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,KAAK,aAAA,EAAe;AACvB,MAAA,QAAA,CAAS;AAAA,QACP,GAAG,OAAA;AAAA,QACH,GAAA,EAAK,WAAA,EAAa,MAAA,IAAU,OAAA,CAAQ;AAAA,OACrC,CAAA,CAAE,IAAA,CAAK,MAAM,gBAAA,CAAiB,IAAI,CAAC,CAAA;AAAA,IACtC;AAAA,EACF,CAAC,CAAA;A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AAO,IAAA;AAAA,EACT;AAEA,EAAA,uBAAO,GAAA,CAAC,eAAA,EAAA,EAAgB,IAAA,EAAgB,QAAA,EAAU,CAAA;AACpD","file":"chunk-72XCX5TD.mjs","sourcesContent":["\"use client\";\n\nimport React, { ReactNode, useEffect, useState } from \"react\";\nimport { I18nextProvider } from \"react-i18next\";\nimport { i18n, initI18n } from \"./config\";\nimport { InitOptions } from \"i18next\";\nimport { usePreferences } from \"@/preferences\";\n\nexport type ThI18nProviderProps = {\n children: ReactNode;\n} & Partial<InitOptions>;\n\nexport const ThI18nProvider = ({\n children,\n ...options\n}: ThI18nProviderProps) => {\n const { preferences } = usePreferences();\n const [isInitialized, setIsInitialized] = useState(i18n.isInitialized);\n \n useEffect(() => {\n if (!i18n.isInitialized) { \n initI18n({\n ...options,\n lng: preferences?.locale || options.lng,\n }).then(() => setIsInitialized(true));\n }\n });\n\n useEffect(() => {\n if (isInitialized && preferences?.locale) {\n i18n.changeLanguage(preferences.locale);\n }\n }, [preferences?.locale, isInitialized]);\n\n if (!isInitialized) {\n return null;\n }\n\n return <I18nextProvider i18n={ i18n }>{ children }</I18nextProvider>;\n};\n\nexport default ThI18nProvider;\n"]}
|
|
@@ -1982,5 +1982,5 @@ var useTheming = ({
|
|
|
1982
1982
|
};
|
|
1983
1983
|
|
|
1984
1984
|
export { ThActionsKeys, ThDockingKeys, ThDockingTypes, ThLayoutOptions, ThLineHeightOptions, ThMemoryPreferencesAdapter, ThPreferencesContext, ThPreferencesProvider, ThSettingsContainerKeys, ThSettingsKeys, ThSettingsRangePlaceholder, ThSettingsRangeVariant, ThSheetHeaderVariant, ThSheetTypes, ThSpacingPresetKeys, ThSpacingSettingsKeys, ThTextAlignOptions, ThTextSettingsKeys, ThThemeKeys, buildThemeObject, contrast1Theme, contrast2Theme, contrast3Theme, createDefinitionFromStaticFonts, createDefinitionsFromBunnyFonts, createDefinitionsFromGoogleFonts, createPreferences, darkTheme, defaultActionKeysObject, defaultContentProtectionConfig, defaultFontCollection, defaultFullscreenAction, defaultJumpToPositionAction, defaultLetterSpacing, defaultLineHeights, defaultParagraphIndent, defaultParagraphSpacing, defaultPreferences, defaultPreferencesContextValue, defaultSettingsAction, defaultSpacingPresets, defaultSpacingPresetsOrder, defaultSpacingSettingsMain, defaultSpacingSettingsSubpanel, defaultTextSettingsMain, defaultTextSettingsSubpanel, defaultTocAction, defaultWordSpacing, defaultZoom, devContentProtectionConfig, lightTheme, paperTheme, prefixString, readiumCSSFontCollection, resolveContentProtectionConfig, sepiaTheme, tamilCollection, usePreferenceKeys, usePreferences, useTheming };
|
|
1985
|
-
//# sourceMappingURL=chunk-
|
|
1986
|
-
//# sourceMappingURL=chunk-
|
|
1985
|
+
//# sourceMappingURL=chunk-7NEQAW7J.mjs.map
|
|
1986
|
+
//# sourceMappingURL=chunk-7NEQAW7J.mjs.map
|