@edrlab/thorium-web 1.1.1 → 1.1.3

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 (97) hide show
  1. package/README.md +2 -0
  2. package/dist/{StatefulReader-BU_EpfhE.d.mts → StatefulReader-lpxHxgKK.d.mts} +8 -6
  3. package/dist/{ThPreferencesAdapter-CYSE2wnE.d.mts → ThPreferencesAdapter-CcJgE3zC.d.mts} +78 -57
  4. package/dist/{actionsReducer-BKoeohBu.d.mts → actionsReducer-6UNIgifE.d.mts} +1 -1
  5. package/dist/chunk-B3WDMWCT.mjs +9 -0
  6. package/dist/chunk-B3WDMWCT.mjs.map +1 -0
  7. package/dist/{chunk-RNED2SPT.mjs → chunk-IYAFKTPL.mjs} +3 -3
  8. package/dist/chunk-IYAFKTPL.mjs.map +1 -0
  9. package/dist/{chunk-6JMWZYOA.mjs → chunk-JDMFK3LV.mjs} +348 -50
  10. package/dist/chunk-JDMFK3LV.mjs.map +1 -0
  11. package/dist/{chunk-OWJCESNF.mjs → chunk-KKMH2EPS.mjs} +26 -19
  12. package/dist/chunk-KKMH2EPS.mjs.map +1 -0
  13. package/dist/{chunk-HE3WFPGE.mjs → chunk-KTZPAJ4S.mjs} +34 -19
  14. package/dist/chunk-KTZPAJ4S.mjs.map +1 -0
  15. package/dist/{chunk-NHUVBN7S.mjs → chunk-MW7LXDWC.mjs} +4 -4
  16. package/dist/{chunk-NHUVBN7S.mjs.map → chunk-MW7LXDWC.mjs.map} +1 -1
  17. package/dist/chunk-VN44OJDD.mjs +1777 -0
  18. package/dist/chunk-VN44OJDD.mjs.map +1 -0
  19. package/dist/components/Epub/index.css +1 -0
  20. package/dist/components/Epub/index.css.map +1 -1
  21. package/dist/components/Epub/index.d.mts +8 -8
  22. package/dist/components/Epub/index.mjs +58 -21
  23. package/dist/components/Epub/index.mjs.map +1 -1
  24. package/dist/components/Misc/index.mjs +2 -2
  25. package/dist/components/WebPub/index.css +1 -0
  26. package/dist/components/WebPub/index.css.map +1 -1
  27. package/dist/components/WebPub/index.d.mts +12 -12
  28. package/dist/components/WebPub/index.mjs +42 -19
  29. package/dist/components/WebPub/index.mjs.map +1 -1
  30. package/dist/core/Components/index.d.mts +2 -2
  31. package/dist/core/Helpers/index.d.mts +2 -2
  32. package/dist/core/Hooks/index.d.mts +4 -4
  33. package/dist/core/Hooks/index.mjs +1 -1
  34. package/dist/{enums-CBaXSsr9.d.mts → enums-Bhwwdfx5.d.mts} +1 -1
  35. package/dist/fonts/AccessibleDfA/AccessibleDfA-Bold.woff2 +0 -0
  36. package/dist/fonts/AccessibleDfA/AccessibleDfA-Italic.woff2 +0 -0
  37. package/dist/fonts/AccessibleDfA/AccessibleDfA-Regular.woff2 +0 -0
  38. package/dist/fonts/AccessibleDfA/LICENSE-AccessibleDfa +95 -0
  39. package/dist/fonts/AndroidPatch/sans-serif/GNU General Public License.txt +340 -0
  40. package/dist/fonts/AndroidPatch/sans-serif/NimbusSans-Bold.woff +0 -0
  41. package/dist/fonts/AndroidPatch/sans-serif/NimbusSans-BoldItalic.woff +0 -0
  42. package/dist/fonts/AndroidPatch/sans-serif/NimbusSans-Italic.woff +0 -0
  43. package/dist/fonts/AndroidPatch/sans-serif/NimbusSans.woff +0 -0
  44. package/dist/fonts/AndroidPatch/serif/GNU General Public License.txt +340 -0
  45. package/dist/fonts/AndroidPatch/serif/NimbusRoman-Bold.woff +0 -0
  46. package/dist/fonts/AndroidPatch/serif/NimbusRoman-BoldItalic.woff +0 -0
  47. package/dist/fonts/AndroidPatch/serif/NimbusRoman-Italic.woff +0 -0
  48. package/dist/fonts/AndroidPatch/serif/NimbusRoman.woff +0 -0
  49. package/dist/fonts/Luciole/Luciole-Bold.woff2 +0 -0
  50. package/dist/fonts/Luciole/Luciole-BoldItalic.woff2 +0 -0
  51. package/dist/fonts/Luciole/Luciole-Italic.woff2 +0 -0
  52. package/dist/fonts/Luciole/Luciole-Regular.woff2 +0 -0
  53. package/dist/fonts/Luciole/Read Me.txt +14 -0
  54. package/dist/fonts/OpenDyslexic/OpenDyslexic-Bold.otf +0 -0
  55. package/dist/fonts/OpenDyslexic/OpenDyslexic-BoldItalic.otf +0 -0
  56. package/dist/fonts/OpenDyslexic/OpenDyslexic-Italic.otf +0 -0
  57. package/dist/fonts/OpenDyslexic/OpenDyslexic-Regular.otf +0 -0
  58. package/dist/fonts/iAWriterDuo/README.md +13 -0
  59. package/dist/fonts/iAWriterDuo/iAWriterDuoS-Bold.woff2 +0 -0
  60. package/dist/fonts/iAWriterDuo/iAWriterDuoS-BoldItalic.woff2 +0 -0
  61. package/dist/fonts/iAWriterDuo/iAWriterDuoS-Italic.woff2 +0 -0
  62. package/dist/fonts/iAWriterDuo/iAWriterDuoS-Regular.woff2 +0 -0
  63. package/dist/i18n/index.mjs +4 -4
  64. package/dist/lib/index.d.mts +35 -18
  65. package/dist/lib/index.mjs +1 -1
  66. package/dist/locales/ar/thorium-shared.json +258 -2
  67. package/dist/locales/ar/thorium-web.json +59 -1
  68. package/dist/locales/da/thorium-shared.json +3 -3
  69. package/dist/locales/el/thorium-web.json +64 -0
  70. package/dist/locales/en/thorium-shared.json +68 -12
  71. package/dist/locales/et/thorium-shared.json +103 -6
  72. package/dist/locales/et/thorium-web.json +95 -1
  73. package/dist/locales/fi/thorium-shared.json +111 -7
  74. package/dist/locales/fr/thorium-shared.json +12 -7
  75. package/dist/locales/it/thorium-shared.json +73 -15
  76. package/dist/locales/it/thorium-web.json +95 -1
  77. package/dist/locales/lt/thorium-shared.json +68 -12
  78. package/dist/locales/pt-BR/thorium-shared.json +12 -12
  79. package/dist/locales/pt-PT/thorium-shared.json +12 -12
  80. package/dist/locales/sv/thorium-shared.json +12 -12
  81. package/dist/locales/tr/thorium-shared.json +14 -12
  82. package/dist/preferences/index.d.mts +104 -7
  83. package/dist/preferences/index.mjs +2 -2
  84. package/dist/{useBreakpoints-BtHd3571.d.mts → useBreakpoints-LTrHif3E.d.mts} +1 -1
  85. package/dist/{useEpubNavigator-DpvqVgNu.d.mts → useEpubNavigator-DQq5VlY0.d.mts} +2 -1
  86. package/dist/usePreferences-CM_Y2jpZ.d.mts +42 -0
  87. package/dist/{useWebPubNavigator-DBRj8KyC.d.mts → useWebPubNavigator-XFUVekhV.d.mts} +2 -1
  88. package/package.json +24 -21
  89. package/dist/chunk-6JMWZYOA.mjs.map +0 -1
  90. package/dist/chunk-DCW6H2DC.mjs +0 -900
  91. package/dist/chunk-DCW6H2DC.mjs.map +0 -1
  92. package/dist/chunk-HE3WFPGE.mjs.map +0 -1
  93. package/dist/chunk-J5NR3FTV.mjs +0 -106
  94. package/dist/chunk-J5NR3FTV.mjs.map +0 -1
  95. package/dist/chunk-OWJCESNF.mjs.map +0 -1
  96. package/dist/chunk-RNED2SPT.mjs.map +0 -1
  97. package/dist/usePreferences-aGLrGdNR.d.mts +0 -16
package/README.md CHANGED
@@ -102,6 +102,8 @@ More details in [the @cloudflare/next-on-pages repo](https://github.com/cloudfla
102
102
 
103
103
  We welcome contributions to Thorium web! If you're interested in helping out, please fork this repository and submit a pull request with your changes.
104
104
 
105
+ The only exception to this rule is localization files, which are managed through a separate process. Please see the [Localization](./docs/Localization.md) documentation for more details.
106
+
105
107
  ## License
106
108
 
107
109
  Thorium Web is licensed under the [BSD-3-Clause license](https://opensource.org/licenses/BSD-3-Clause).
@@ -2,14 +2,14 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { TooltipProps, Heading, HeadingProps, PopoverProps } from 'react-aria-components';
3
3
  import { d as ThActionsTriggerVariant, a as ThCollapsibilityVisibility, b as ThActionEntry } from './useCollapsibility-CM1I24Ol.mjs';
4
4
  import { T as ThActionButtonProps, f as ThMenuItemProps, a as ThCollapsibleActionsBarProps, t as ThSettingsEntry, W as WithRef, r as ThDropdownProps, h as ThNumberFieldProps, k as ThRadioGroupProps, m as ThSliderProps, o as ThSwitchProps } from './ThSettingsWrapper-CMLegiqy.mjs';
5
- import { d as ThActionsKeys, c as ThDockingKeys, t as ThSheetTypes, g as ThTextSettingsKeys, h as ThSpacingSettingsKeys, i as ThSpacingPresetKeys, T as ThLineHeightOptions, u as ThSheetHeaderVariant, a as ThTextAlignOptions, j as ThLayoutUI } from './enums-CBaXSsr9.mjs';
5
+ import { m as ThActionsKeys, c as ThDockingKeys, k as ThSheetTypes, p as ThTextSettingsKeys, q as ThSpacingSettingsKeys, u as ThSpacingPresetKeys, T as ThLineHeightOptions, t as ThSheetHeaderVariant, a as ThTextAlignOptions, j as ThLayoutUI } from './enums-Bhwwdfx5.mjs';
6
6
  import React__default, { RefObject, ReactNode } from 'react';
7
- import { q as ThSettingsGroupPref, a as ThPreferences, D as DefaultKeys, d as defaultFontFamilyOptions } from './ThPreferencesAdapter-CYSE2wnE.mjs';
7
+ import { H as ThSettingsGroupPref, a as ThPreferences, D as DefaultKeys } from './ThPreferencesAdapter-CcJgE3zC.mjs';
8
8
  import { PressEvent } from 'react-aria';
9
- import { A as ActionsStateKeys } from './actionsReducer-BKoeohBu.mjs';
9
+ import { A as ActionsStateKeys } from './actionsReducer-6UNIgifE.mjs';
10
10
  import { T as ThColorScheme } from './useContrast-Cgsrl7GS.mjs';
11
11
  import { Locator } from '@readium/shared';
12
- import { LineLengthStateObject } from './lib/index.mjs';
12
+ import { FontFamilyStateObject, LineLengthStateObject } from './lib/index.mjs';
13
13
 
14
14
  interface StatefulActionsMapObject {
15
15
  Trigger: React.ComponentType<StatefulActionTriggerProps>;
@@ -225,7 +225,9 @@ declare const useSpacingPresets: () => {
225
225
  setPublisherStyles: (value: boolean) => void;
226
226
  };
227
227
 
228
- declare const StatefulFontFamily: ({ standalone }: StatefulSettingsItemProps) => react_jsx_runtime.JSX.Element;
228
+ declare const StatefulFontFamily: ({ standalone }: StatefulSettingsItemProps & {
229
+ publicationLanguage?: string;
230
+ }) => react_jsx_runtime.JSX.Element;
229
231
 
230
232
  declare const UnstableStatefulFontWeight: ({ standalone }: StatefulSettingsItemProps) => react_jsx_runtime.JSX.Element;
231
233
 
@@ -327,7 +329,7 @@ declare const useReaderTransitions: () => ReaderTransitions;
327
329
 
328
330
  interface ReadiumCSSSettings {
329
331
  columnCount: string;
330
- fontFamily: keyof typeof defaultFontFamilyOptions | null;
332
+ fontFamily: FontFamilyStateObject;
331
333
  fontSize: number;
332
334
  fontWeight: number;
333
335
  hyphens: boolean | null;
@@ -1,6 +1,6 @@
1
- import { b as ThBreakpoints, l as ThArrowVariant, v as ThLayoutDirection, m as ThDocumentTitleFormat, k as ThBackLinkVariant, n as ThRunningHeadFormat, o as ThProgressionFormat, j as ThLayoutUI, t as ThSheetTypes, e as ThThemeKeys, d as ThActionsKeys, p as ThDockingTypes, c as ThDockingKeys, f as ThSettingsKeys, g as ThTextSettingsKeys, h as ThSpacingSettingsKeys, r as ThSettingsRangeVariant, s as ThSettingsRangePlaceholder, T as ThLineHeightOptions, u as ThSheetHeaderVariant, i as ThSpacingPresetKeys } from './enums-CBaXSsr9.mjs';
2
1
  import { e as UnstableShortcutRepresentation } from './keyboardUtilities-BWAyLS_D.mjs';
3
- import { B as BreakpointsMap, T as ThBreakpointsObject } from './useBreakpoints-BtHd3571.mjs';
2
+ import { B as BreakpointsMap, T as ThBreakpointsObject } from './useBreakpoints-LTrHif3E.mjs';
3
+ import { b as ThBreakpoints, d as ThArrowVariant, e as ThLayoutDirection, f as ThDocumentTitleFormat, g as ThBackLinkVariant, h as ThRunningHeadFormat, i as ThProgressionFormat, j as ThLayoutUI, k as ThSheetTypes, l as ThThemeKeys, m as ThActionsKeys, n as ThDockingTypes, c as ThDockingKeys, o as ThSettingsKeys, p as ThTextSettingsKeys, q as ThSpacingSettingsKeys, r as ThSettingsRangeVariant, s as ThSettingsRangePlaceholder, T as ThLineHeightOptions, t as ThSheetHeaderVariant, u as ThSpacingPresetKeys } from './enums-Bhwwdfx5.mjs';
4
4
  import { T as ThColorScheme, a as ThContrast } from './useContrast-Cgsrl7GS.mjs';
5
5
  import { ExperimentKey } from '@readium/navigator';
6
6
  import { T as ThCollapsibility, a as ThCollapsibilityVisibility } from './useCollapsibility-CM1I24Ol.mjs';
@@ -57,6 +57,76 @@ type I18nValue<T> = T | string | {
57
57
  key: string;
58
58
  fallback?: string;
59
59
  };
60
+ interface SystemFontSource {
61
+ type: "system";
62
+ }
63
+ interface BunnyFontSource {
64
+ type: "custom";
65
+ provider: "bunny";
66
+ }
67
+ interface GoogleFontSource {
68
+ type: "custom";
69
+ provider: "google";
70
+ }
71
+ interface LocalStaticFontFile {
72
+ path: string;
73
+ weight: number;
74
+ style: "normal" | "italic";
75
+ }
76
+ interface LocalVariableFontFile {
77
+ path: string;
78
+ style?: "normal" | "italic";
79
+ }
80
+ interface LocalStaticFontSource {
81
+ type: "custom";
82
+ provider: "local";
83
+ variant: "static";
84
+ files: LocalStaticFontFile[];
85
+ }
86
+ interface LocalVariableFontSource {
87
+ type: "custom";
88
+ provider: "local";
89
+ variant: "variable";
90
+ files: LocalVariableFontFile[];
91
+ }
92
+ type LocalFontSource = LocalStaticFontSource | LocalVariableFontSource;
93
+ type FontSource = SystemFontSource | BunnyFontSource | GoogleFontSource | LocalFontSource;
94
+ type VariableFontRangeConfig = {
95
+ min: number;
96
+ max: number;
97
+ step?: number;
98
+ };
99
+ type WeightConfig = {
100
+ type: "static";
101
+ values: number[];
102
+ } | {
103
+ type: "variable";
104
+ } & VariableFontRangeConfig;
105
+ interface FontSpec {
106
+ family: string;
107
+ fallbacks: string[];
108
+ weights: WeightConfig;
109
+ styles?: ("normal" | "italic")[];
110
+ widths?: VariableFontRangeConfig;
111
+ display?: "swap" | "block" | "fallback" | "optional";
112
+ }
113
+ interface FontDefinition {
114
+ id: string;
115
+ name: string;
116
+ label?: I18nValue<string>;
117
+ source: FontSource;
118
+ spec: FontSpec;
119
+ }
120
+ type FontCollection = Record<string, FontDefinition>;
121
+ type ValidatedLanguageCollection = {
122
+ fonts: FontCollection;
123
+ supportedLanguages: string[];
124
+ };
125
+ type ThFontFamilyPref = {
126
+ default: FontCollection;
127
+ } | {
128
+ [K in Exclude<string, "default">]: ValidatedLanguageCollection;
129
+ };
60
130
  type ThBackLinkContent = {
61
131
  type: "img";
62
132
  src: string;
@@ -152,8 +222,8 @@ interface ThDockingPref<T extends string> {
152
222
  };
153
223
  }
154
224
  interface ThSettingsGroupPref<T> {
155
- main?: T[];
156
- subPanel?: T[] | null;
225
+ main: T[];
226
+ subPanel: T[] | null;
157
227
  header?: ThSheetHeaderVariant;
158
228
  }
159
229
  interface ThSettingsRangePref {
@@ -169,6 +239,7 @@ interface ThSettingsRadioPref<T extends string> {
169
239
  };
170
240
  }
171
241
  type ThSettingsKeyTypes<K extends CustomizableKeys = DefaultKeys> = {
242
+ [ThSettingsKeys.fontFamily]: ThFontFamilyPref;
172
243
  [ThSettingsKeys.letterSpacing]: ThSettingsRangePref;
173
244
  [ThSettingsKeys.lineHeight]: ThSettingsRadioPref<Exclude<ThLineHeightOptions, ThLineHeightOptions.publisher>>;
174
245
  [ThSettingsKeys.paragraphIndent]: ThSettingsRangePref;
@@ -299,8 +370,8 @@ interface ThPreferences<K extends CustomizableKeys = {}> {
299
370
  fxlOrder: Array<SettingsKey<K>>;
300
371
  webPubOrder: Array<SettingsKey<K>>;
301
372
  keys: ThSettingsKeyTypes<K>;
302
- text?: ThSettingsGroupPref<TextSettingsKey<K>>;
303
- spacing?: ThSettingsGroupPref<SpacingSettingsKey<K>> & {
373
+ text: ThSettingsGroupPref<TextSettingsKey<K>>;
374
+ spacing: ThSettingsGroupPref<SpacingSettingsKey<K>> & {
304
375
  presets?: ThSettingsSpacingPresets<K>;
305
376
  };
306
377
  };
@@ -324,56 +395,6 @@ type SettingsKeyType<K extends CustomizableKeys = DefaultKeys> = K["settings"] e
324
395
  type TextSettingsKeyType<K extends CustomizableKeys = DefaultKeys> = K["text"] extends string ? K["text"] : ThTextSettingsKeys;
325
396
  type SpacingSettingsKeyType<K extends CustomizableKeys = DefaultKeys> = K["spacing"] extends string ? K["spacing"] : ThSpacingSettingsKeys;
326
397
 
327
- declare const supportedLocales: string[];
328
- declare const defaultActionKeysObject: ThActionsTokens;
329
- declare const defaultTextSettingsMain: ThTextSettingsKeys[];
330
- declare const defaultTextSettingsSubpanel: ThTextSettingsKeys[];
331
- declare const defaultSpacingSettingsMain: ThSpacingSettingsKeys[];
332
- declare const defaultSpacingSettingsSubpanel: ThSpacingSettingsKeys[];
333
- declare const defaultSpacingPresetsOrder: ThSpacingPresetKeys[];
334
- declare const defaultFontFamilyOptions: {
335
- publisher: null;
336
- oldStyle: string;
337
- modern: string;
338
- sans: string;
339
- humanist: string;
340
- monospace: string;
341
- };
342
- declare const defaultParagraphSpacing: Required<ThSettingsRangePref>;
343
- declare const defaultParagraphIndent: Required<ThSettingsRangePref>;
344
- declare const defaultWordSpacing: Required<ThSettingsRangePref>;
345
- declare const defaultLetterSpacing: Required<ThSettingsRangePref>;
346
- declare const defaultLineHeights: {
347
- small: number;
348
- medium: number;
349
- large: number;
350
- };
351
- declare const defaultZoom: Required<ThSettingsRangePref>;
352
- declare const defaultSpacingPresets: {
353
- tight: {
354
- lineHeight: ThLineHeightOptions;
355
- paragraphSpacing: number;
356
- paragraphIndent: number;
357
- };
358
- balanced: {
359
- lineHeight: ThLineHeightOptions;
360
- paragraphSpacing: number;
361
- paragraphIndent: number;
362
- };
363
- loose: {
364
- lineHeight: ThLineHeightOptions;
365
- paragraphSpacing: number;
366
- paragraphIndent: number;
367
- };
368
- accessible: {
369
- lineHeight: ThLineHeightOptions;
370
- paragraphSpacing: number;
371
- paragraphIndent: number;
372
- letterSpacing: number;
373
- wordSpacing: number;
374
- };
375
- };
376
-
377
398
  interface ThPreferencesAdapter<T extends CustomizableKeys = CustomizableKeys> {
378
399
  getPreferences(): ThPreferences<T>;
379
400
  setPreferences(prefs: ThPreferences<T>): void;
@@ -381,4 +402,4 @@ interface ThPreferencesAdapter<T extends CustomizableKeys = CustomizableKeys> {
381
402
  unsubscribe(callback: (prefs: ThPreferences<T>) => void): void;
382
403
  }
383
404
 
384
- export { type ActionKey as A, createPreferences as B, type CustomizableKeys as C, type DefaultKeys as D, type ActionKeyType as E, type ThemeKeyType as F, type SettingsKeyType as G, type TextSettingsKeyType as H, type I18nValue as I, type SpacingSettingsKeyType as J, type useThemingProps as K, supportedLocales as L, defaultActionKeysObject as M, defaultTextSettingsMain as N, defaultTextSettingsSubpanel as O, defaultSpacingSettingsMain as P, defaultSpacingSettingsSubpanel as Q, defaultSpacingPresetsOrder as R, type SettingsKey as S, type ThPreferencesAdapter as T, defaultParagraphSpacing as U, defaultParagraphIndent as V, defaultWordSpacing as W, defaultLetterSpacing as X, defaultLineHeights as Y, defaultZoom as Z, defaultSpacingPresets as _, type ThPreferences as a, type ThemeTokens as b, type ThBackLinkContent as c, defaultFontFamilyOptions as d, type ThBackLinkPref as e, type ThBottomSheetDetent as f, type ThActionsSnappedPref as g, type ThActionsDockedPref as h, type ThActionsTokens as i, type ThSettingsSpacingPresets as j, type ThSpacingPreset as k, type ThemeKey as l, type TextSettingsKey as m, type SpacingSettingsKey as n, type ThActionsPref as o, type ThDockingPref as p, type ThSettingsGroupPref as q, type ThSettingsRangePref as r, type ThSettingsRadioPref as s, type ThSettingsKeyTypes as t, useTheming as u, type ThConstraintKeys as v, type ThFormatPrefValue as w, type ThFormatPref as x, type ThPaginatedAffordancePrefValue as y, type ThPaginatedAffordancePref as z };
405
+ export { type useThemingProps as $, type ActionKey as A, type BunnyFontSource as B, type CustomizableKeys as C, type DefaultKeys as D, type ThDockingPref as E, type FontCollection as F, type GoogleFontSource as G, type ThSettingsGroupPref as H, type I18nValue as I, type ThSettingsRadioPref as J, type ThSettingsKeyTypes as K, type LocalStaticFontFile as L, type ThConstraintKeys as M, type ThFormatPrefValue as N, type ThFormatPref as O, type ThPaginatedAffordancePrefValue as P, type ThPaginatedAffordancePref as Q, createPreferences as R, type SystemFontSource as S, type ThPreferencesAdapter as T, type ActionKeyType as U, type VariableFontRangeConfig as V, type WeightConfig as W, type ThemeKeyType as X, type SettingsKeyType as Y, type TextSettingsKeyType as Z, type SpacingSettingsKeyType as _, type ThPreferences as a, type ThemeTokens as b, type FontDefinition as c, type ThActionsTokens as d, type ThSettingsRangePref as e, type LocalVariableFontFile as f, type LocalStaticFontSource as g, type LocalVariableFontSource as h, type LocalFontSource as i, type FontSource as j, type FontSpec as k, type ValidatedLanguageCollection as l, type ThFontFamilyPref as m, type ThBackLinkContent as n, type ThBackLinkPref as o, type ThBottomSheetDetent as p, type ThActionsSnappedPref as q, type ThActionsDockedPref as r, type ThSettingsSpacingPresets as s, type ThSpacingPreset as t, useTheming as u, type ThemeKey as v, type SettingsKey as w, type TextSettingsKey as x, type SpacingSettingsKey as y, type ThActionsPref as z };
@@ -1,5 +1,5 @@
1
1
  import * as _reduxjs_toolkit from '@reduxjs/toolkit';
2
- import { c as ThDockingKeys } from './enums-CBaXSsr9.mjs';
2
+ import { c as ThDockingKeys } from './enums-Bhwwdfx5.mjs';
3
3
 
4
4
  type PrimitiveType = number | string | boolean;
5
5
  /** Object types that should never be mapped */
@@ -0,0 +1,9 @@
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
@@ -0,0 +1 @@
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,4 +1,4 @@
1
- import { supportedLocales } from './chunk-J5NR3FTV.mjs';
1
+ import { supportedLocales } from './chunk-B3WDMWCT.mjs';
2
2
  import i18n from 'i18next';
3
3
  export { default as i18n } from 'i18next';
4
4
  import { initReactI18next, useTranslation } from 'react-i18next';
@@ -65,5 +65,5 @@ var useI18n = (ns) => {
65
65
  };
66
66
 
67
67
  export { DEFAULT_CONFIG, initI18n, useI18n };
68
- //# sourceMappingURL=chunk-RNED2SPT.mjs.map
69
- //# sourceMappingURL=chunk-RNED2SPT.mjs.map
68
+ //# sourceMappingURL=chunk-IYAFKTPL.mjs.map
69
+ //# sourceMappingURL=chunk-IYAFKTPL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/i18n/config.ts","../src/i18n/useI18n.ts"],"names":["i18n"],"mappings":";;;;;;;AAOO,IAAM,cAAA,GAA8B;AAAA,EACzC,WAAA,EAAa,IAAA;AAAA,EACb,IAAA,EAAM,KAAA;AAAA,EACN,wBAAA,EAA0B,IAAA;AAAA,EAC1B,aAAA,EAAe,gBAAA;AAAA,EACf,SAAA,EAAW;AAAA,IACT,KAAA,EAAO,CAAC,WAAW,CAAA;AAAA,IACnB,QAAQ;AAAC,GACX;AAAA,EACA,aAAA,EAAe;AAAA,IACb,WAAA,EAAa;AAAA,GACf;AAAA,EACA,OAAA,EAAS;AAAA,IACP,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,EAAA,EAAI,CAAC,gBAAA,EAAkB,aAAa,CAAA;AAAA,EACpC,SAAA,EAAW,CAAC,aAAA,EAAe,gBAAgB;AAC7C;AAEO,IAAM,QAAA,GAAW,OAAO,OAAA,GAAgC,EAAC,KAAM;AACpE,EAAA,IAAI,KAAK,aAAA,EAAe;AACtB,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,IAAA,CACJ,GAAA,CAAI,OAAO,CAAA,CACX,GAAA,CAAI,gBAAgB,CAAA,CACpB,GAAA,CAAI,gBAAgB,CAAA,CACpB,IAAA,CAAK;AAAA,IACJ,GAAG,cAAA;AAAA,IACH,GAAG;AAAA,GACJ,CAAA;AACL;AC/BO,IAAM,OAAA,GAAU,CAAC,EAAA,KAA2B;AAGjD,EAAA,MAAM,EAAE,CAAA,EAAG,IAAA,EAAM,IAAA,EAAAA,KAAAA,EAAM,OAAM,GAAI,cAAA,CAAe,EAAA,IAAM,cAAA,CAAe,EAAc,CAAA;AAGnF,EAAA,MAAM,cAAA,GAAiB,CAAC,GAAA,KAAgB;AACtC,IAAA,OAAOA,KAAAA,CAAK,eAAe,GAAG,CAAA;AAAA,EAChC,CAAA;AAGA,EAAA,MAAM,CAAA,GAAI,CAAC,GAAA,EAAa,OAAA,KAA0B;AAChD,IAAA,IAAI,EAAA,EAAI;AAEN,MAAA,OAAO,IAAA,CAAK,KAAK,OAAO,CAAA;AAAA,IAC1B,CAAA,MAAO;AAEL,MAAA,KAAA,MAAW,SAAA,IAAa,eAAe,EAAA,EAAgB;AACrD,QAAA,MAAM,MAAA,GAAS,KAAK,GAAA,EAAK,EAAE,GAAG,OAAA,EAAS,EAAA,EAAI,WAAW,CAAA;AACtD,QAAA,IAAI,MAAA,KAAW,KAAK,OAAO,MAAA;AAAA,MAC7B;AACA,MAAA,OAAO,GAAA;AAAA,IACT;AAAA,EACF,CAAA;AAEA,EAAA,OAAO;AAAA;AAAA,IAEL,CAAA;AAAA;AAAA,IAEA,IAAA,EAAAA,KAAAA;AAAA;AAAA,IAEA,KAAA;AAAA;AAAA,IAEA,iBAAiBA,KAAAA,CAAK,QAAA;AAAA;AAAA,IAEtB,WAAWA,KAAAA,CAAK,SAAA;AAAA;AAAA,IAEhB;AAAA,GACF;AACF","file":"chunk-IYAFKTPL.mjs","sourcesContent":["import i18n from \"i18next\";\nimport { initReactI18next } from \"react-i18next\";\nimport LanguageDetector from \"i18next-browser-languagedetector\";\nimport Backend from \"i18next-http-backend\";\nimport { InitOptions } from \"i18next\";\nimport { supportedLocales } from \"./supported-locales\";\n\nexport const DEFAULT_CONFIG: InitOptions = {\n fallbackLng: \"en\",\n load: \"all\",\n nonExplicitSupportedLngs: true,\n supportedLngs: supportedLocales,\n detection: {\n order: [\"navigator\"],\n caches: []\n },\n interpolation: {\n escapeValue: false\n },\n backend: {\n loadPath: \"/locales/{{lng}}/{{ns}}.json\"\n },\n ns: [\"thorium-shared\", \"thorium-web\"],\n defaultNS: [\"thorium-web\", \"thorium-shared\"]\n};\n\nexport const initI18n = async (options: Partial<InitOptions> = {}) => {\n if (i18n.isInitialized) {\n return i18n;\n }\n\n return i18n\n .use(Backend)\n .use(LanguageDetector)\n .use(initReactI18next)\n .init({\n ...DEFAULT_CONFIG,\n ...options\n });\n};\n\nexport { i18n };","import { useTranslation } from \"react-i18next\";\nimport { DEFAULT_CONFIG } from \"./config\";\n\n/**\n * Hook to access the i18n instance and translation functions\n * @param ns Optional additional namespace(s) to include alongside the default namespaces\n * @returns Translation functions and i18n instance\n */\nexport const useI18n = (ns?: string | string[]) => {\n // If no namespace provided, use both defaults with fallback\n // If namespace provided, use only that (override behavior)\n const { t: tRaw, i18n, ready } = useTranslation(ns || DEFAULT_CONFIG.ns as string[]);\n \n // Helper function to change language\n const changeLanguage = (lng: string) => {\n return i18n.changeLanguage(lng);\n };\n\n // Enhanced t function that searches both namespaces only when using defaults\n const t = (key: string, options?: any): string => {\n if (ns) {\n // If custom namespace provided, use it directly (no fallback)\n return tRaw(key, options) as string;\n } else {\n // If no namespace provided, search all default namespaces\n for (const namespace of DEFAULT_CONFIG.ns as string[]) {\n const result = tRaw(key, { ...options, ns: namespace });\n if (result !== key) return result as string;\n }\n return key;\n }\n };\n\n return {\n // Translation function\n t,\n // i18n instance\n i18n,\n // Whether translations are loaded\n ready,\n // Current language\n currentLanguage: i18n.language,\n // List of available languages\n languages: i18n.languages,\n // Function to change language\n changeLanguage\n };\n};\n"]}