@edrlab/thorium-web 1.3.1 → 1.4.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.
Files changed (124) hide show
  1. package/dist/{ThPreferencesAdapter-D0rzsGRl.d.mts → ThPreferencesAdapter-_5AePKHa.d.mts} +26 -7
  2. package/dist/{ThSettingsWrapper-BXuRgdqp.d.mts → ThSettingsWrapper-B_9klYXH.d.mts} +1 -1
  3. package/dist/{actions-BLAr0oaM.d.mts → actions-CuRRM3rp.d.mts} +5 -2
  4. package/dist/{actionsReducer-XWTGGNUd.d.mts → actionsReducer-VFR42qgL.d.mts} +1 -1
  5. package/dist/{chunk-6EHFW43Y.mjs → chunk-2NCN2AG2.mjs} +5 -4
  6. package/dist/chunk-2NCN2AG2.mjs.map +1 -0
  7. package/dist/{chunk-L4XGZAZ5.mjs → chunk-2YRT7RNW.mjs} +20 -3
  8. package/dist/chunk-2YRT7RNW.mjs.map +1 -0
  9. package/dist/{chunk-5LUMM7FW.mjs → chunk-44PEO3DS.mjs} +2 -2
  10. package/dist/{chunk-5LUMM7FW.mjs.map → chunk-44PEO3DS.mjs.map} +1 -1
  11. package/dist/chunk-A575ZW4A.mjs +10 -0
  12. package/dist/chunk-A575ZW4A.mjs.map +1 -0
  13. package/dist/chunk-AE6P4KJB.mjs +13 -0
  14. package/dist/chunk-AE6P4KJB.mjs.map +1 -0
  15. package/dist/chunk-AQSJDL63.mjs +193 -0
  16. package/dist/chunk-AQSJDL63.mjs.map +1 -0
  17. package/dist/{chunk-NKO3K3QS.mjs → chunk-DQDOOTCE.mjs} +5 -5
  18. package/dist/chunk-DQDOOTCE.mjs.map +1 -0
  19. package/dist/{chunk-SAUOY37Q.mjs → chunk-E2JEGVVE.mjs} +15 -15
  20. package/dist/chunk-E2JEGVVE.mjs.map +1 -0
  21. package/dist/{chunk-DETZMFZ7.mjs → chunk-ETLIGONP.mjs} +39 -33
  22. package/dist/chunk-ETLIGONP.mjs.map +1 -0
  23. package/dist/chunk-GNROODJB.mjs +9 -0
  24. package/dist/chunk-GNROODJB.mjs.map +1 -0
  25. package/dist/{chunk-6BUN7DEA.mjs → chunk-KGSFTRCH.mjs} +69 -84
  26. package/dist/chunk-KGSFTRCH.mjs.map +1 -0
  27. package/dist/{chunk-LP3JFZ4A.mjs → chunk-MSHUPSBI.mjs} +718 -466
  28. package/dist/chunk-MSHUPSBI.mjs.map +1 -0
  29. package/dist/chunk-OD75GC5N.mjs +3953 -0
  30. package/dist/chunk-OD75GC5N.mjs.map +1 -0
  31. package/dist/{chunk-I4BKU5NN.mjs → chunk-RBEPH5E5.mjs} +100 -30
  32. package/dist/chunk-RBEPH5E5.mjs.map +1 -0
  33. package/dist/{chunk-DMZFSOHK.mjs → chunk-SI4FBFHM.mjs} +135 -46
  34. package/dist/chunk-SI4FBFHM.mjs.map +1 -0
  35. package/dist/{chunk-A3FZBEUL.mjs → chunk-SZAVAQ6S.mjs} +30 -6
  36. package/dist/chunk-SZAVAQ6S.mjs.map +1 -0
  37. package/dist/{chunk-ITDBOMY5.mjs → chunk-VENFFPK2.mjs} +3 -3
  38. package/dist/{chunk-ITDBOMY5.mjs.map → chunk-VENFFPK2.mjs.map} +1 -1
  39. package/dist/{chunk-2ORXUOH3.mjs → chunk-WF2UOYO7.mjs} +4 -4
  40. package/dist/{chunk-2ORXUOH3.mjs.map → chunk-WF2UOYO7.mjs.map} +1 -1
  41. package/dist/{chunk-EZG6SBSO.mjs → chunk-YEVLT3AV.mjs} +104 -29
  42. package/dist/chunk-YEVLT3AV.mjs.map +1 -0
  43. package/dist/components/Audio/index.css +2 -1
  44. package/dist/components/Audio/index.css.map +1 -1
  45. package/dist/components/Audio/index.d.mts +16 -15
  46. package/dist/components/Audio/index.mjs +16 -16
  47. package/dist/components/Epub/index.css +5 -4
  48. package/dist/components/Epub/index.css.map +1 -1
  49. package/dist/components/Epub/index.d.mts +13 -13
  50. package/dist/components/Epub/index.mjs +17 -17
  51. package/dist/components/Misc/index.mjs +5 -5
  52. package/dist/components/Reader/index.css +5 -4
  53. package/dist/components/Reader/index.css.map +1 -1
  54. package/dist/components/Reader/index.d.mts +11 -11
  55. package/dist/components/Reader/index.mjs +34 -30
  56. package/dist/components/Reader/index.mjs.map +1 -1
  57. package/dist/components/WebPub/index.css +5 -4
  58. package/dist/components/WebPub/index.css.map +1 -1
  59. package/dist/components/WebPub/index.d.mts +13 -13
  60. package/dist/components/WebPub/index.mjs +17 -17
  61. package/dist/core/Components/index.d.mts +12 -22
  62. package/dist/core/Components/index.mjs +2 -2
  63. package/dist/core/Helpers/index.d.mts +1 -1
  64. package/dist/core/Helpers/index.mjs +3 -4
  65. package/dist/core/Hooks/index.d.mts +12 -8
  66. package/dist/core/Hooks/index.mjs +1 -1
  67. package/dist/i18n/index.mjs +4 -7
  68. package/dist/lib/index.d.mts +56 -20
  69. package/dist/lib/index.mjs +3 -2
  70. package/dist/locales/da/thorium-shared.json +3 -0
  71. package/dist/locales/da/thorium-web.json +37 -2
  72. package/dist/locales/en/thorium-shared.json +24 -2
  73. package/dist/locales/en/thorium-web.json +2 -2
  74. package/dist/locales/es/thorium-shared.json +364 -0
  75. package/dist/locales/es/thorium-web.json +130 -0
  76. package/dist/locales/et/thorium-shared.json +121 -9
  77. package/dist/locales/et/thorium-web.json +32 -1
  78. package/dist/locales/fi/thorium-shared.json +42 -4
  79. package/dist/locales/fi/thorium-web.json +36 -2
  80. package/dist/locales/fr/thorium-shared.json +108 -1
  81. package/dist/locales/fr/thorium-web.json +121 -86
  82. package/dist/locales/it/thorium-shared.json +108 -1
  83. package/dist/locales/it/thorium-web.json +15 -2
  84. package/dist/locales/lt/thorium-web.json +36 -2
  85. package/dist/locales/pl/thorium-web.json +1 -1
  86. package/dist/locales/pt-BR/thorium-shared.json +6 -0
  87. package/dist/locales/pt-BR/thorium-web.json +88 -88
  88. package/dist/locales/pt-PT/thorium-shared.json +91 -0
  89. package/dist/locales/pt-PT/thorium-web.json +15 -3
  90. package/dist/locales/sv/thorium-shared.json +108 -2
  91. package/dist/locales/sv/thorium-web.json +15 -3
  92. package/dist/locales/tr/thorium-shared.json +42 -0
  93. package/dist/next-lib/index.mjs +1 -1
  94. package/dist/next-lib/index.mjs.map +1 -1
  95. package/dist/preferences/index.d.mts +59 -13
  96. package/dist/preferences/index.mjs +7 -7
  97. package/dist/{settingsReducer-Bu1zeveu.d.mts → settingsReducer-VqBhLq50.d.mts} +14 -2
  98. package/dist/{ui-nBv8gfr0.d.mts → ui-DnZZhozX.d.mts} +1 -1
  99. package/dist/{useAudioNavigator-C5aW4-eT.d.mts → useAudioNavigator-CWXyNWq1.d.mts} +3 -1
  100. package/dist/{useContrast-2t429O9O.d.mts → useContrast-Cbso7N1l.d.mts} +5 -1
  101. package/dist/{usePreferences-VaBf46eP.d.mts → usePreferences-9ZvbcbLW.d.mts} +6 -8
  102. package/dist/{useReaderTransitions-IBGdE7qi.d.mts → useReaderTransitions-0hKGCvMm.d.mts} +64 -12
  103. package/package.json +10 -9
  104. package/dist/chunk-6BUN7DEA.mjs.map +0 -1
  105. package/dist/chunk-6EHFW43Y.mjs.map +0 -1
  106. package/dist/chunk-7CGMWOZN.mjs +0 -20
  107. package/dist/chunk-7CGMWOZN.mjs.map +0 -1
  108. package/dist/chunk-A3FZBEUL.mjs.map +0 -1
  109. package/dist/chunk-B3WDMWCT.mjs +0 -9
  110. package/dist/chunk-B3WDMWCT.mjs.map +0 -1
  111. package/dist/chunk-DETZMFZ7.mjs.map +0 -1
  112. package/dist/chunk-DMZFSOHK.mjs.map +0 -1
  113. package/dist/chunk-DTPO3J2C.mjs +0 -1732
  114. package/dist/chunk-DTPO3J2C.mjs.map +0 -1
  115. package/dist/chunk-EZG6SBSO.mjs.map +0 -1
  116. package/dist/chunk-GPWW5OML.mjs +0 -1955
  117. package/dist/chunk-GPWW5OML.mjs.map +0 -1
  118. package/dist/chunk-I4BKU5NN.mjs.map +0 -1
  119. package/dist/chunk-L4XGZAZ5.mjs.map +0 -1
  120. package/dist/chunk-LP3JFZ4A.mjs.map +0 -1
  121. package/dist/chunk-MLEYTQGK.mjs +0 -60
  122. package/dist/chunk-MLEYTQGK.mjs.map +0 -1
  123. package/dist/chunk-NKO3K3QS.mjs.map +0 -1
  124. package/dist/chunk-SAUOY37Q.mjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { e as UnstableShortcutRepresentation } from './keyboardUtilities-BWAyLS_D.mjs';
2
- import { B as BreakpointsMap, e as ThBreakpoints, f as ThBreakpointsObject, T as ThLayoutDirection, g as ThDocumentTitleFormat, a as ThBackLinkPref, h as ThFormatPref, i as ThRunningHeadFormat, j as ThProgressionFormat, k as ThLayoutUI, l as ThPaginatedAffordancePref } from './ui-nBv8gfr0.mjs';
3
- import { I as I18nValue, e as ThColorScheme, f as ThContrast, g as ThSettingsKeys, h as ThTextSettingsKeys, b as ThSpacingSettingsKeys, d as ThSettingsRangePrefRequired, i as ThSettingsRadioPref, T as ThLineHeightOptions, j as ThSettingsGroupPref, a as ThSpacingPresetKeys } from './useContrast-2t429O9O.mjs';
4
- import { e as ThSheetTypes, g as ThActionsKeys, d as ThCollapsibility, c as ThActionsTokens, f as ThDockingPref, T as ThDockingKeys } from './actions-BLAr0oaM.mjs';
2
+ import { B as BreakpointsMap, d as ThBreakpoints, e as ThBreakpointsObject, f as ThDocumentTitleFormat, T as ThBackLinkPref, g as ThFormatPref, h as ThRunningHeadFormat, i as ThProgressionFormat, j as ThLayoutUI, k as ThPaginatedAffordancePref } from './ui-DnZZhozX.mjs';
3
+ import { I as I18nValue, e as ThColorScheme, f as ThContrast, g as ThSettingsKeys, h as ThTextSettingsKeys, b as ThSpacingSettingsKeys, d as ThSettingsRangePrefRequired, i as ThSettingsRadioPref, T as ThLineHeightOptions, j as ThSettingsGroupPref, a as ThSpacingPresetKeys } from './useContrast-Cbso7N1l.mjs';
4
+ import { e as ThSheetTypes, g as ThActionsKeys, d as ThCollapsibility, c as ThActionsTokens, f as ThDockingPref, T as ThDockingKeys } from './actions-CuRRM3rp.mjs';
5
5
  import { IContentProtectionConfig, IAudioContentProtectionConfig, ExperimentKey } from '@readium/navigator';
6
6
 
7
7
  type CSSValueUnitless = `${number}`;
@@ -97,6 +97,13 @@ declare const defaultFontCollection: FontCollection;
97
97
  declare const tamilCollection: {
98
98
  [x: string]: FontDefinition;
99
99
  };
100
+ declare const arabicFarsiCollection: FontCollection;
101
+ declare const hebrewCollection: FontCollection;
102
+ declare const chineseSimplifiedCollection: FontCollection;
103
+ declare const chineseTraditionalCollection: FontCollection;
104
+ declare const japaneseCollection: FontCollection;
105
+ declare const japaneseVerticalCollection: FontCollection;
106
+ declare const koreanCollection: FontCollection;
100
107
 
101
108
  interface CopyProtectionConfig {
102
109
  /** Maximum percentage of content that can be selected (0-1) */
@@ -343,8 +350,9 @@ interface useThemingProps<T extends string> {
343
350
  onMonochromeChange?: (isMonochrome: boolean) => void;
344
351
  onReducedMotionChange?: (reducedMotion: boolean) => void;
345
352
  onReducedTransparencyChange?: (reducedTransparency: boolean) => void;
353
+ onContainerBreakpointChange?: (breakpoint: ThBreakpoints | null) => void;
346
354
  }
347
- declare const useTheming: <T extends string>({ theme, systemKeys, themeKeys, breakpointsMap, initProps, coverUrl, autoThemeSource, onBreakpointChange, onColorSchemeChange, onContrastChange, onForcedColorsChange, onMonochromeChange, onReducedMotionChange, onReducedTransparencyChange, onCoverThemeGenerated, }: useThemingProps<T>) => {
355
+ declare const useTheming: <T extends string>({ theme, systemKeys, themeKeys, breakpointsMap, initProps, coverUrl, autoThemeSource, onBreakpointChange, onColorSchemeChange, onContrastChange, onForcedColorsChange, onMonochromeChange, onReducedMotionChange, onReducedTransparencyChange, onCoverThemeGenerated, onContainerBreakpointChange, }: useThemingProps<T>) => {
348
356
  inferThemeAuto: () => T | undefined;
349
357
  theme: string | undefined;
350
358
  breakpoints: ThBreakpointsObject;
@@ -356,8 +364,21 @@ declare const useTheming: <T extends string>({ theme, systemKeys, themeKeys, bre
356
364
  reducedTransparency: boolean;
357
365
  coverThemeTokens: ThemeTokens | null;
358
366
  themeResolved: boolean;
367
+ setContainerRef: (el: Element | null) => void;
359
368
  };
360
369
 
370
+ interface ThGlobalPreferences {
371
+ locale?: string;
372
+ }
373
+ declare const createGlobalPreferences: (params: ThGlobalPreferences) => ThGlobalPreferences;
374
+
375
+ interface ThGlobalPreferencesAdapter {
376
+ getPreferences(): ThGlobalPreferences;
377
+ setPreferences(prefs: ThGlobalPreferences): void;
378
+ subscribe(callback: (prefs: ThGlobalPreferences) => void): void;
379
+ unsubscribe(callback: (prefs: ThGlobalPreferences) => void): void;
380
+ }
381
+
361
382
  type CustomizableKeys = {
362
383
  action?: string;
363
384
  theme?: string;
@@ -427,8 +448,6 @@ type ThSettingsKeyTypes<K extends CustomizableKeys = DefaultKeys> = {
427
448
  } : {} : {});
428
449
  type ThConstraintKeys = Extract<ThSheetTypes, ThSheetTypes.bottomSheet | ThSheetTypes.popover | ThSheetTypes.modal> | "pagination" | "dropdown";
429
450
  interface ThPreferences<K extends CustomizableKeys = {}> {
430
- direction?: ThLayoutDirection;
431
- locale?: string;
432
451
  experiments?: {
433
452
  reflow?: Array<ExperimentKey>;
434
453
  webPub?: Array<ExperimentKey>;
@@ -548,4 +567,4 @@ interface ThPreferencesAdapter<T extends CustomizableKeys = CustomizableKeys> {
548
567
  unsubscribe(callback: (prefs: ThPreferences<T>) => void): void;
549
568
  }
550
569
 
551
- export { type LocalFontSource as $, type ActionKey as A, type CSSDynamicViewport as B, type CustomizableKeys as C, type DefaultKeys as D, type CSSFrequency as E, type FontCollection as F, type CSSFontRelativeLength as G, type CSSLargeViewport as H, type CSSPhysicalLength as I, type CSSRelativeLength as J, type CSSResolution as K, type LocalStaticFontFile as L, type CSSRootFontRelativeLength as M, type CSSSmallViewport as N, type CSSTime as O, type CSSViewport as P, type CSSColor as Q, type SystemFontSource as R, type SettingsKey as S, ThThemeKeys as T, type BunnyFontSource as U, type VariableFontRangeConfig as V, type WeightConfig as W, type GoogleFontSource as X, type LocalVariableFontFile as Y, type LocalStaticFontSource as Z, type LocalVariableFontSource as _, type ThemeTokens as a, type FontSource as a0, type FontSpec as a1, type ValidatedLanguageCollection as a2, type ThFontFamilyPref as a3, readiumCSSFontCollection as a4, defaultFontCollection as a5, tamilCollection as a6, type CopyProtectionConfig as a7, type PrintProtectionConfig as a8, type ContentProtectionConfig as a9, resolveContentProtectionConfig as aa, resolveAudioContentProtectionConfig as ab, defaultContentProtectionConfig as ac, defaultAudioContentProtectionConfig as ad, devContentProtectionConfig as ae, lightTheme as af, darkTheme as ag, paperTheme as ah, sepiaTheme as ai, contrast1Theme as aj, contrast2Theme as ak, contrast3Theme as al, type AudioContentProtectionConfig as b, type ThPreferencesAdapter as c, type ThPreferences as d, type FontDefinition as e, type ThemeKey as f, type TextSettingsKey as g, type SpacingSettingsKey as h, type ThSettingsSpacingPresets as i, type ThSpacingPreset as j, type ThActionsPref as k, type ThSettingsKeyTypes as l, type ThConstraintKeys as m, createPreferences as n, type ActionKeyType as o, type ThemeKeyType as p, type SettingsKeyType as q, type TextSettingsKeyType as r, type SpacingSettingsKeyType as s, type useThemingProps as t, useTheming as u, type CSSValueUnitless as v, type CSSValueWithUnit as w, type CSSAbsoluteLength as x, type CSSAngle as y, type CSSDefaultViewport as z };
570
+ export { type LocalVariableFontFile as $, type ActionKey as A, type CSSAbsoluteLength as B, type CustomizableKeys as C, type DefaultKeys as D, type CSSAngle as E, type FontCollection as F, type CSSDefaultViewport as G, type CSSDynamicViewport as H, type CSSFrequency as I, type CSSFontRelativeLength as J, type CSSLargeViewport as K, type LocalStaticFontFile as L, type CSSPhysicalLength as M, type CSSRelativeLength as N, type CSSResolution as O, type CSSRootFontRelativeLength as P, type CSSSmallViewport as Q, type CSSTime as R, type SettingsKey as S, ThThemeKeys as T, type CSSViewport as U, type VariableFontRangeConfig as V, type WeightConfig as W, type CSSColor as X, type SystemFontSource as Y, type BunnyFontSource as Z, type GoogleFontSource as _, type ThemeTokens as a, type LocalStaticFontSource as a0, type LocalVariableFontSource as a1, type LocalFontSource as a2, type FontSource as a3, type FontSpec as a4, type ValidatedLanguageCollection as a5, type ThFontFamilyPref as a6, readiumCSSFontCollection as a7, defaultFontCollection as a8, tamilCollection as a9, arabicFarsiCollection as aa, hebrewCollection as ab, chineseSimplifiedCollection as ac, chineseTraditionalCollection as ad, japaneseCollection as ae, japaneseVerticalCollection as af, koreanCollection as ag, type CopyProtectionConfig as ah, type PrintProtectionConfig as ai, type ContentProtectionConfig as aj, resolveContentProtectionConfig as ak, resolveAudioContentProtectionConfig as al, defaultContentProtectionConfig as am, defaultAudioContentProtectionConfig as an, devContentProtectionConfig as ao, lightTheme as ap, darkTheme as aq, paperTheme as ar, sepiaTheme as as, contrast1Theme as at, contrast2Theme as au, contrast3Theme as av, type AudioContentProtectionConfig as b, type ThPreferencesAdapter as c, type ThPreferences as d, type ThGlobalPreferences as e, type ThGlobalPreferencesAdapter as f, type FontDefinition as g, createGlobalPreferences as h, type ThemeKey as i, type TextSettingsKey as j, type SpacingSettingsKey as k, type ThSettingsSpacingPresets as l, type ThSpacingPreset as m, type ThActionsPref as n, type ThSettingsKeyTypes as o, type ThConstraintKeys as p, createPreferences as q, type ActionKeyType as r, type ThemeKeyType as s, type SettingsKeyType as t, useTheming as u, type TextSettingsKeyType as v, type SpacingSettingsKeyType as w, type useThemingProps as x, type CSSValueUnitless as y, type CSSValueWithUnit 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 { h as ThActionEntry, i as ThActionsBarProps, C as CollapsiblePref } from './actions-BLAr0oaM.mjs';
5
+ import { h as ThActionEntry, i as ThActionsBarProps, C as CollapsiblePref } from './actions-CuRRM3rp.mjs';
6
6
 
7
7
  interface HTMLAttributesWithRef<T> extends React.HTMLAttributes<T> {
8
8
  ref?: React.ForwardedRef<T>;
@@ -1,6 +1,7 @@
1
+ import { RefObject } from 'react';
1
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
3
  import { ToolbarProps } from 'react-aria-components';
3
- import { B as BreakpointsMap } from './ui-nBv8gfr0.mjs';
4
+ import { B as BreakpointsMap } from './ui-DnZZhozX.mjs';
4
5
 
5
6
  declare enum ThActionsTriggerVariant {
6
7
  button = "iconButton",
@@ -33,9 +34,11 @@ interface CollapsiblePref {
33
34
  };
34
35
  };
35
36
  }
36
- declare const useCollapsibility: (items: ThActionEntry<string>[], prefs: CollapsiblePref, breakpoint?: string) => {
37
+ declare const useCollapsibility: (items: ThActionEntry<string>[], prefs: CollapsiblePref, breakpoint?: string, containerRef?: RefObject<HTMLElement | null>) => {
37
38
  ActionIcons: ThActionEntry<string>[];
38
39
  MenuItems: ThActionEntry<string>[];
40
+ getItemRef: (key: string) => (el: HTMLElement | null) => void;
41
+ getGhostRef: (el: HTMLDivElement | null) => void;
39
42
  };
40
43
 
41
44
  type ThBottomSheetDetent = "content-height" | "full-height";
@@ -1,6 +1,6 @@
1
1
  import * as _reduxjs_toolkit from '@reduxjs/toolkit';
2
2
  import { W as WritableDraft } from './immer.d-CoRThNOF.mjs';
3
- import { T as ThDockingKeys } from './actions-BLAr0oaM.mjs';
3
+ import { T as ThDockingKeys } from './actions-CuRRM3rp.mjs';
4
4
 
5
5
  type ActionsStateKeys = string;
6
6
  type OverflowStateKeys = string;
@@ -1,4 +1,4 @@
1
- import { supportedLocales } from './chunk-B3WDMWCT.mjs';
1
+ import { supportedLocales } from './chunk-GNROODJB.mjs';
2
2
  import i18n from 'i18next';
3
3
  export { default as i18n } from 'i18next';
4
4
  import { initReactI18next, useTranslation } from 'react-i18next';
@@ -22,7 +22,8 @@ var DEFAULT_CONFIG = {
22
22
  loadPath: "/locales/{{lng}}/{{ns}}.json"
23
23
  },
24
24
  ns: ["thorium-shared", "thorium-web"],
25
- defaultNS: ["thorium-web", "thorium-shared"]
25
+ defaultNS: ["thorium-web", "thorium-shared"],
26
+ returnEmptyString: false
26
27
  };
27
28
  var initI18n = async (options = {}) => {
28
29
  if (i18n.isInitialized) {
@@ -66,5 +67,5 @@ var useI18n = (ns) => {
66
67
  };
67
68
 
68
69
  export { DEFAULT_CONFIG, initI18n, useI18n };
69
- //# sourceMappingURL=chunk-6EHFW43Y.mjs.map
70
- //# sourceMappingURL=chunk-6EHFW43Y.mjs.map
70
+ //# sourceMappingURL=chunk-2NCN2AG2.mjs.map
71
+ //# sourceMappingURL=chunk-2NCN2AG2.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,CAAA;AAAA,EAC3C,iBAAA,EAAmB;AACrB;AAEO,IAAM,QAAA,GAAW,OAAO,OAAA,GAAgC,EAAC,KAAM;AACpE,EAAA,IAAI,KAAK,aAAA,EAAe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EhB;AAAA,GACF;AACF","file":"chunk-2NCN2AG2.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 returnEmptyString: false\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 { useCallback } from \"react\";\nimport { 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 = useCallback((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 }, [ns, tRaw]);\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"]}
@@ -76,6 +76,23 @@ var ThAudioPublicationMetadataComponent = /* @__PURE__ */ ((ThAudioPublicationMe
76
76
  return ThAudioPublicationMetadataComponent2;
77
77
  })(ThAudioPublicationMetadataComponent || {});
78
78
 
79
- export { ThArrowVariant, ThAudioPlayerComponent, ThAudioProgressBarVariant, ThAudioPublicationMetadataComponent, ThBackLinkVariant, ThBreakpoints, ThDocumentTitleFormat, ThLayoutDirection, ThLayoutUI, ThProgressionFormat, ThRunningHeadFormat };
80
- //# sourceMappingURL=chunk-L4XGZAZ5.mjs.map
81
- //# sourceMappingURL=chunk-L4XGZAZ5.mjs.map
79
+ // src/core/Helpers/propsToCSSVars.ts
80
+ var propsToCSSVars = (props, { prefix, exclude = [] } = {}) => {
81
+ return Object.entries(props).reduce((acc, [key, value]) => {
82
+ if (exclude.includes(key)) {
83
+ return acc;
84
+ }
85
+ const cssVar = prefix ? `--${prefix}-${key}` : `--${key}`;
86
+ if (typeof value === "object" && value !== null) {
87
+ Object.assign(acc, propsToCSSVars(value, { prefix: prefix ? `${prefix}-${key}` : key }));
88
+ } else if (value != null) {
89
+ const cssValue = typeof value === "number" ? `${value}px` : value;
90
+ acc[cssVar] = cssValue;
91
+ }
92
+ return acc;
93
+ }, {});
94
+ };
95
+
96
+ export { ThArrowVariant, ThAudioPlayerComponent, ThAudioProgressBarVariant, ThAudioPublicationMetadataComponent, ThBackLinkVariant, ThBreakpoints, ThDocumentTitleFormat, ThLayoutDirection, ThLayoutUI, ThProgressionFormat, ThRunningHeadFormat, propsToCSSVars };
97
+ //# sourceMappingURL=chunk-2YRT7RNW.mjs.map
98
+ //# sourceMappingURL=chunk-2YRT7RNW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/preferences/models/ui.ts","../src/core/Helpers/propsToCSSVars.ts"],"names":["ThArrowVariant","ThBreakpoints","ThBackLinkVariant","ThDocumentTitleFormat","ThLayoutDirection","ThLayoutUI","ThProgressionFormat","ThRunningHeadFormat","ThAudioPlayerComponent","ThAudioProgressBarVariant","ThAudioPublicationMetadataComponent"],"mappings":";AA4CO,IAAK,cAAA,qBAAAA,eAAAA,KAAL;AACL,EAAAA,gBAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,gBAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,gBAAA,SAAA,CAAA,GAAU,SAAA;AAHA,EAAA,OAAAA,eAAAA;AAAA,CAAA,EAAA,cAAA,IAAA,EAAA;AAML,IAAK,aAAA,qBAAAC,cAAAA,KAAL;AACL,EAAAA,eAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,eAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,eAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,eAAA,OAAA,CAAA,GAAQ,OAAA;AACR,EAAAA,eAAA,QAAA,CAAA,GAAS,QAAA;AALC,EAAA,OAAAA,cAAAA;AAAA,CAAA,EAAA,aAAA,IAAA,EAAA;AAQL,IAAK,iBAAA,qBAAAC,kBAAAA,KAAL;AACL,EAAAA,mBAAA,OAAA,CAAA,GAAQ,OAAA;AACR,EAAAA,mBAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,mBAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,mBAAA,QAAA,CAAA,GAAS,QAAA;AAJC,EAAA,OAAAA,kBAAAA;AAAA,CAAA,EAAA,iBAAA,IAAA,EAAA;AAOL,IAAK,qBAAA,qBAAAC,sBAAAA,KAAL;AACL,EAAAA,uBAAA,OAAA,CAAA,GAAQ,OAAA;AACR,EAAAA,uBAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,uBAAA,iBAAA,CAAA,GAAkB,iBAAA;AACl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AAG,CAAA,CAAA,GAAK,KAAK,GAAG,CAAA,CAAA;AACvD,IAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA,EAAM;AAE/C,MAAA,MAAA,CAAO,MAAA,CAAO,GAAA,EAAK,cAAA,CAAe,KAAA,EAAO,EAAE,MAAA,EAAQ,MAAA,GAAS,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,GAAG,CAAA,CAAA,GAAK,GAAA,EAAK,CAAC,CAAA;AAAA,IACzF,CAAA,MAAA,IAAW,SAAS,IAAA,EAAM;AACxB,MAAA,MAAM,WAAW,OAAO,KAAA,KAAU,QAAA,GAAW,CAAA,EAAG,KAAK,CAAA,EAAA,CAAA,GAAO,KAAA;AAC5D,MAAA,GAAA,CAAI,MAAM,CAAA,GAAI,QAAA;AAAA,IAChB;AACA,IAAA,OAAO,GAAA;AAAA,EACT,CAAA,EAAG,EAAE,CAAA;AACf","file":"chunk-2YRT7RNW.mjs","sourcesContent":["export type ThBackLinkContent = \n | { \n type: \"img\";\n src: string;\n alt?: string;\n }\n | {\n type: \"svg\";\n content: string; // Raw SVG string\n };\n\nexport interface ThBackLinkPref {\n href: string;\n variant?: ThBackLinkVariant;\n visibility?: \"always\" | \"partially\";\n content?: ThBackLinkContent;\n}\n\nexport interface ThFormatPrefValue<T extends string | Array<string>> {\n variants: T;\n displayInImmersive?: boolean;\n displayInFullscreen?: boolean;\n}\n\nexport interface ThFormatPref<T extends string | Array<string>> {\n default: ThFormatPrefValue<T>;\n breakpoints?: { \n [key in ThBreakpoints]?: ThFormatPrefValue<T>;\n };\n}\n\nexport interface ThPaginatedAffordancePrefValue {\n variant: ThArrowVariant;\n discard?: Array<\"navigation\" | \"immersive\" | \"fullscreen\"> | \"none\";\n hint?: Array<\"immersiveChange\" | \"fullscreenChange\" | \"layoutChange\"> | \"none\";\n}\n\nexport interface ThPaginatedAffordancePref {\n default: Required<ThPaginatedAffordancePrefValue>;\n breakpoints?: {\n [key in ThBreakpoints]?: ThPaginatedAffordancePrefValue;\n };\n}\n\nexport enum ThArrowVariant {\n none = \"none\",\n stacked = \"stacked\",\n layered = \"layered\"\n}\n\nexport enum ThBreakpoints {\n compact = \"compact\",\n medium = \"medium\",\n expanded = \"expanded\",\n large = \"large\",\n xLarge = \"xLarge\"\n}\n\nexport enum ThBackLinkVariant {\n arrow = \"arrow\",\n home = \"home\",\n library = \"library\",\n custom = \"custom\"\n}\n\nexport enum ThDocumentTitleFormat {\n title = \"title\",\n chapter = \"chapter\",\n titleAndChapter = \"titleAndChapter\",\n none = \"none\"\n}\n\nexport enum ThLayoutDirection {\n rtl = \"rtl\",\n ltr = \"ltr\"\n}\n\nexport enum ThLayoutUI {\n stacked = \"stacked-ui\",\n layered = \"layered-ui\"\n}\n\nexport enum ThProgressionFormat {\n positionsPercentOfTotal = \"positionsPercentOfTotal\", // x-y of z (%)\n positionsOfTotal = \"positionsOfTotal\", // x-y of z\n positions = \"positions\", // x-y\n overallProgression = \"overallProgression\", // x%\n positionsLeft = \"positionsLeft\", // x left in chapter\n readingOrderIndex = \"readingOrderIndex\", // x of y\n resourceProgression = \"resourceProgression\", // x%\n progressionOfResource = \"progressionOfResource\", // x% of y\n none = \"none\" // nothing displayed\n}\n\nexport enum ThRunningHeadFormat {\n title = \"title\",\n chapter = \"chapter\",\n // titleAndChapter = \"titleAndChapter\",\n none = \"none\"\n}\n\nexport enum ThAudioPlayerComponent {\n cover = \"cover\",\n metadata = \"metadata\",\n playbackControls = \"playbackControls\",\n progressBar = \"progressBar\",\n mediaActions = \"mediaActions\"\n}\n\nexport enum ThAudioProgressBarVariant {\n normal = \"normal\",\n segmented = \"segmented\"\n}\n\nexport enum ThAudioPublicationMetadataComponent {\n title = \"title\",\n titleWithSubtitle = \"titleWithSubtitle\",\n subtitleWithTitle = \"subtitleWithTitle\",\n authors = \"authors\"\n}\n\ntype TitleVariant = ThAudioPublicationMetadataComponent.title | ThAudioPublicationMetadataComponent.titleWithSubtitle | ThAudioPublicationMetadataComponent.subtitleWithTitle;\n\nexport type ThPublicationMetadataOrder = [TitleVariant] | [TitleVariant, ThAudioPublicationMetadataComponent.authors] | [ThAudioPublicationMetadataComponent.authors, TitleVariant];","\"use client\";\n\ninterface PropsToCSSVarsOptions {\n prefix?: string;\n exclude?: string[];\n}\n\n/** \n * Converts Object properties to CSS custom properties, recursively.\n * @param props - The object containing CSS property values\n * @param options - Configuration options\n * @param options.prefix - Optional prefix for CSS variable names (applies to all levels)\n * @param options.exclude - Array of property names to exclude\n */\nexport const propsToCSSVars = (props: { [x: string]: any; }, { prefix, exclude = [] }: PropsToCSSVarsOptions = {}) => {\n return Object.entries(props)\n .reduce((acc: { [key: string]: any }, [key, value]) => {\n if (exclude.includes(key)) {\n return acc;\n }\n const cssVar = prefix ? `--${prefix}-${key}` : `--${key}`;\n if (typeof value === \"object\" && value !== null) {\n // Keep the same prefix for nested objects\n Object.assign(acc, propsToCSSVars(value, { prefix: prefix ? `${prefix}-${key}` : key }));\n } else if (value != null) {\n const cssValue = typeof value === \"number\" ? `${value}px` : value;\n acc[cssVar] = cssValue;\n } \n return acc;\n }, {});\n}"]}
@@ -117,5 +117,5 @@ var buildShortcut = (str) => {
117
117
  };
118
118
 
119
119
  export { UnstableShortcutMetaKeywords, UnstableShortcutRepresentation, buildShortcut, defaultPlatformModifier, getPlatform, getPlatformModifier, isIOSish, isIpadOS, isMacish, metaKeys };
120
- //# sourceMappingURL=chunk-5LUMM7FW.mjs.map
121
- //# sourceMappingURL=chunk-5LUMM7FW.mjs.map
120
+ //# sourceMappingURL=chunk-44PEO3DS.mjs.map
121
+ //# sourceMappingURL=chunk-44PEO3DS.mjs.map
@@ -1 +1 @@
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;A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// 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
+ {"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,WAAW,MAAM;AAC5B,EAAA,MAAM,YAAA,GAAe,uBAAA;AACrB,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,OAAO,YAAA,CAAa,KAAK,QAAQ,CAAA;AACnC;AAG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A;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-44PEO3DS.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// Covers all iOS/iPadOS: iPhone/iPod/iPad by platform string + desktop-class iPadOS by UA sniff\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}"]}
@@ -0,0 +1,10 @@
1
+ import { useDispatch, useSelector, useStore } from 'react-redux';
2
+
3
+ // src/lib/hooks.ts
4
+ var useAppDispatch = useDispatch;
5
+ var useAppSelector = useSelector;
6
+ var useAppStore = useStore;
7
+
8
+ export { useAppDispatch, useAppSelector, useAppStore };
9
+ //# sourceMappingURL=chunk-A575ZW4A.mjs.map
10
+ //# sourceMappingURL=chunk-A575ZW4A.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/hooks.ts"],"names":[],"mappings":";;;AAIO,IAAM,cAAA,GAAoC;AAC1C,IAAM,cAAA,GAAkD;AACxD,IAAM,WAAA,GAA8B","file":"chunk-A575ZW4A.mjs","sourcesContent":["import { TypedUseSelectorHook, useDispatch, useSelector, useStore } from \"react-redux\";\nimport type { AppDispatch, AppStore, RootState } from \"./store\";\n\n// Use throughout your app instead of plain `useDispatch` and `useSelector`\nexport const useAppDispatch: () => AppDispatch = useDispatch;\nexport const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;\nexport const useAppStore: () => AppStore = useStore;"]}
@@ -0,0 +1,13 @@
1
+ import { createContext, useContext } from 'react';
2
+
3
+ // src/preferences/ThGlobalPreferencesContext.ts
4
+ var ThGlobalPreferencesContext = createContext(null);
5
+ var useGlobalPreferences = () => {
6
+ const context = useContext(ThGlobalPreferencesContext);
7
+ if (!context) throw new Error("useGlobalPreferences must be used within a ThGlobalPreferencesProvider");
8
+ return context;
9
+ };
10
+
11
+ export { ThGlobalPreferencesContext, useGlobalPreferences };
12
+ //# sourceMappingURL=chunk-AE6P4KJB.mjs.map
13
+ //# sourceMappingURL=chunk-AE6P4KJB.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/preferences/ThGlobalPreferencesContext.ts","../src/preferences/hooks/useGlobalPreferences.ts"],"names":[],"mappings":";;;AAUO,IAAM,0BAAA,GAA6B,cAAoD,IAAI;ACL3F,IAAM,uBAAuB,MAAM;AACxC,EAAA,MAAM,OAAA,GAAU,WAAW,0BAA0B,CAAA;AACrD,EAAA,IAAI,CAAC,OAAA,EAAS,MAAM,IAAI,MAAM,wEAAwE,CAAA;AACtG,EAAA,OAAO,OAAA;AACT","file":"chunk-AE6P4KJB.mjs","sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ThGlobalPreferences } from \"./globalPreferences\";\n\nexport interface GlobalPreferencesContextValue {\n preferences: ThGlobalPreferences;\n updatePreferences: (prefs: ThGlobalPreferences) => void;\n}\n\nexport const ThGlobalPreferencesContext = createContext<GlobalPreferencesContextValue | null>(null);\n","\"use client\";\n\nimport { useContext } from \"react\";\nimport { ThGlobalPreferencesContext } from \"../ThGlobalPreferencesContext\";\n\nexport const useGlobalPreferences = () => {\n const context = useContext(ThGlobalPreferencesContext);\n if (!context) throw new Error(\"useGlobalPreferences must be used within a ThGlobalPreferencesProvider\");\n return context;\n};\n"]}
@@ -0,0 +1,193 @@
1
+ import { useState, useRef, useCallback, useLayoutEffect, useEffect, 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, containerRef) => {
11
+ const isSpaceFit = prefs.collapse === true;
12
+ const [partialInBar, setPartialInBar] = useState(Number.MAX_SAFE_INTEGER);
13
+ const lastCountRef = useRef(Number.MAX_SAFE_INTEGER);
14
+ const keyToElement = useRef(/* @__PURE__ */ new Map());
15
+ const itemWidthsRef = useRef(/* @__PURE__ */ new Map());
16
+ const alwaysKeysRef = useRef([]);
17
+ const orderedPartialKeysRef = useRef([]);
18
+ const hasOverflowRef = useRef(false);
19
+ const columnGapRef = useRef(0);
20
+ const rafIdRef = useRef(null);
21
+ const specRef = useRef("");
22
+ const computeLayout = useCallback((containerWidth) => {
23
+ if (!containerWidth) return;
24
+ const widths = itemWidthsRef.current;
25
+ const alwaysKeys = alwaysKeysRef.current;
26
+ const partialKeys = orderedPartialKeysRef.current;
27
+ const gap = columnGapRef.current;
28
+ const N_a = alwaysKeys.length;
29
+ const alwaysTotal = alwaysKeys.reduce((s, k) => s + (widths.get(k) ?? 0), 0);
30
+ const partialWidths = partialKeys.map((k) => widths.get(k) ?? 0);
31
+ const partialTotal = partialWidths.reduce((s, w) => s + w, 0);
32
+ let newCount;
33
+ const noMenuTotal = alwaysTotal + partialTotal + gap * Math.max(0, N_a + partialKeys.length - 1);
34
+ if (!hasOverflowRef.current && noMenuTotal <= containerWidth) {
35
+ newCount = partialKeys.length;
36
+ } else {
37
+ const menuW = widths.values().next().value ?? 0;
38
+ if (!menuW) return;
39
+ let count = 0, usedPartial = 0;
40
+ for (const w of partialWidths) {
41
+ const totalGap = gap * Math.max(0, N_a + count + 1);
42
+ if (alwaysTotal + usedPartial + w + menuW + totalGap <= containerWidth) {
43
+ usedPartial += w;
44
+ count++;
45
+ } else {
46
+ break;
47
+ }
48
+ }
49
+ newCount = count;
50
+ }
51
+ if (newCount !== lastCountRef.current) {
52
+ lastCountRef.current = newCount;
53
+ setPartialInBar(newCount);
54
+ }
55
+ }, []);
56
+ const remeasureAndCompute = useCallback((containerWidth) => {
57
+ if (!containerRef?.current) return;
58
+ for (const [key, el] of keyToElement.current) {
59
+ itemWidthsRef.current.set(key, el.getBoundingClientRect().width);
60
+ }
61
+ columnGapRef.current = parseFloat(getComputedStyle(containerRef.current).columnGap) || 0;
62
+ computeLayout(containerWidth ?? containerRef.current.getBoundingClientRect().width);
63
+ }, [containerRef, computeLayout]);
64
+ const remeasureAndComputeRef = useRef(remeasureAndCompute);
65
+ useLayoutEffect(() => {
66
+ remeasureAndComputeRef.current = remeasureAndCompute;
67
+ }, [remeasureAndCompute]);
68
+ useLayoutEffect(() => {
69
+ if (!isSpaceFit || !containerRef?.current) return;
70
+ const spec = items.map((i) => `${i.key}:${prefs.keys[i.key]?.visibility ?? ""}`).join(",");
71
+ const widthsMissing = items.some((i) => !(itemWidthsRef.current.get(i.key) ?? 0));
72
+ if (spec === specRef.current && !widthsMissing) return;
73
+ specRef.current = spec;
74
+ const always = [], partial = [];
75
+ let hasOverflow = false;
76
+ for (const item of items) {
77
+ const v = prefs.keys[item.key]?.visibility;
78
+ if (v === "overflow" /* overflow */) hasOverflow = true;
79
+ else if (v === "always" /* always */) always.push(item.key);
80
+ else partial.push(item.key);
81
+ }
82
+ alwaysKeysRef.current = always;
83
+ orderedPartialKeysRef.current = partial;
84
+ hasOverflowRef.current = hasOverflow;
85
+ remeasureAndCompute(containerRef.current.getBoundingClientRect().width);
86
+ }, [isSpaceFit, items, prefs, containerRef, remeasureAndCompute]);
87
+ useEffect(() => {
88
+ if (!isSpaceFit || !containerRef?.current) return;
89
+ const observer = new ResizeObserver((entries) => {
90
+ const w = entries[0]?.contentRect.width;
91
+ if (w === void 0) return;
92
+ if (rafIdRef.current !== null) cancelAnimationFrame(rafIdRef.current);
93
+ rafIdRef.current = requestAnimationFrame(() => {
94
+ rafIdRef.current = null;
95
+ remeasureAndCompute(w);
96
+ });
97
+ });
98
+ observer.observe(containerRef.current);
99
+ return () => {
100
+ observer.disconnect();
101
+ if (rafIdRef.current !== null) cancelAnimationFrame(rafIdRef.current);
102
+ };
103
+ }, [isSpaceFit, containerRef, remeasureAndCompute]);
104
+ const ghostObserverRef = useRef(null);
105
+ const getGhostRef = useCallback((el) => {
106
+ ghostObserverRef.current?.disconnect();
107
+ ghostObserverRef.current = null;
108
+ if (el && isSpaceFit) {
109
+ const observer = new ResizeObserver(() => {
110
+ if (rafIdRef.current !== null) cancelAnimationFrame(rafIdRef.current);
111
+ rafIdRef.current = requestAnimationFrame(() => {
112
+ rafIdRef.current = null;
113
+ remeasureAndComputeRef.current();
114
+ });
115
+ });
116
+ observer.observe(el);
117
+ ghostObserverRef.current = observer;
118
+ }
119
+ }, [isSpaceFit]);
120
+ const getItemRef = useCallback((key) => (el) => {
121
+ if (el) {
122
+ keyToElement.current.set(key, el);
123
+ } else {
124
+ keyToElement.current.delete(key);
125
+ itemWidthsRef.current.delete(key);
126
+ }
127
+ }, []);
128
+ const [actionIcons, menuItems] = useMemo(() => {
129
+ const actionIcons2 = [];
130
+ const menuItems2 = [];
131
+ if (!prefs.collapse) {
132
+ items.forEach((item) => actionIcons2.push(item));
133
+ return [actionIcons2, menuItems2];
134
+ }
135
+ if (prefs.collapse === true) {
136
+ const barPartialSet = /* @__PURE__ */ new Set();
137
+ let partialCount = 0;
138
+ for (const item of items) {
139
+ if (prefs.keys[item.key]?.visibility === "partially" /* partially */) {
140
+ if (partialCount < partialInBar) {
141
+ barPartialSet.add(item.key);
142
+ partialCount++;
143
+ }
144
+ }
145
+ }
146
+ for (const item of items) {
147
+ const v = prefs.keys[item.key]?.visibility;
148
+ if (v === "overflow" /* overflow */ || v === "partially" /* partially */ && !barPartialSet.has(item.key)) {
149
+ menuItems2.push(item);
150
+ } else {
151
+ actionIcons2.push(item);
152
+ }
153
+ }
154
+ return [actionIcons2, menuItems2];
155
+ }
156
+ let countdown = 0;
157
+ if (breakpoint) {
158
+ const prefForBreakpoint = prefs.collapse[breakpoint];
159
+ if (prefForBreakpoint) {
160
+ const partialCount = items.filter((i) => prefs.keys[i.key]?.visibility === "partially" /* partially */).length;
161
+ const overflowCount = items.filter((i) => prefs.keys[i.key]?.visibility === "overflow" /* overflow */).length;
162
+ const collapsibleCount = partialCount + overflowCount;
163
+ if (prefForBreakpoint === "all") {
164
+ countdown = overflowCount;
165
+ } else if (!isNaN(prefForBreakpoint)) {
166
+ countdown = Math.max(0, collapsibleCount - (prefForBreakpoint - 1));
167
+ }
168
+ }
169
+ }
170
+ [...items].reverse().forEach((item) => {
171
+ const actionPref = prefs.keys[item.key];
172
+ if (actionPref.visibility === "overflow" /* overflow */) {
173
+ menuItems2.unshift(item);
174
+ --countdown;
175
+ } else if (actionPref.visibility === "partially" /* partially */) {
176
+ if (countdown > 0) {
177
+ menuItems2.unshift(item);
178
+ --countdown;
179
+ } else {
180
+ actionIcons2.unshift(item);
181
+ }
182
+ } else {
183
+ actionIcons2.unshift(item);
184
+ }
185
+ });
186
+ return [actionIcons2, menuItems2];
187
+ }, [items, prefs, breakpoint, partialInBar]);
188
+ return { ActionIcons: actionIcons, MenuItems: menuItems, getItemRef, getGhostRef };
189
+ };
190
+
191
+ export { ThCollapsibilityVisibility, useCollapsibility };
192
+ //# sourceMappingURL=chunk-AQSJDL63.mjs.map
193
+ //# sourceMappingURL=chunk-AQSJDL63.mjs.map
@@ -0,0 +1 @@
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,CAC/B,KAAA,EACA,KAAA,EACA,YACA,YAAA,KACG;AACH,EAAA,MAAM,UAAA,GAAa,MAAM,QAAA,KAAa,IAAA;AAKtC,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,QAAA,CAAiB,OAAO,gBAAgB,CAAA;AAChF,EAAA,MAAM,YAAA,GAAe,MAAA,CAAe,MAAA,CAAO,gBAAgB,CAAA;AAI3D,EAAA,MAAM,YAAA,GAAe,MAAA,iBAAO,IAAI,GAAA,EAA0B,CAAA;AAC1D,EAAA,MAAM,aAAA,GAAgB,MAAA,iBAAO,IAAI,GAAA,EAAqB,CAAA;AAGtD,EAAA,MAAM,aAAA,GAAgB,MAAA,CAAiB,EAAE,CAAA;AACzC,EAAA,MAAM,qBAAA,GAAwB,MAAA,CAAiB,EAAE,CAAA;AACjD,EAAA,MAAM,cAAA,GAAiB,OAAgB,KAAK,CAAA;AAC5C,EAAA,MAAM,YAAA,GAAe,OAAe,CAAC,CAAA;AAGrC,EAAA,M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EAAa,WAAA,EAAa,SAAA,EAAW,SAAA,EAAW,YAAY,WAAA,EAAY;AACnF","file":"chunk-AQSJDL63.mjs","sourcesContent":["\"use client\";\n\nimport { RefObject, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\n\nimport { ThActionEntry } from \"../ThActionsBar\";\n\nexport type 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 = (\n items: ThActionEntry<string>[],\n prefs: CollapsiblePref,\n breakpoint?: string,\n containerRef?: RefObject<HTMLElement | null>\n) => {\n const isSpaceFit = prefs.collapse === true;\n\n // --- Space-fit mode (collapse: true) ---\n // How many `partially` items currently fit in the bar.\n // MAX_SAFE_INTEGER = \"assume all fit\" — corrected by useLayoutEffect before first paint.\n const [partialInBar, setPartialInBar] = useState<number>(Number.MAX_SAFE_INTEGER);\n const lastCountRef = useRef<number>(Number.MAX_SAFE_INTEGER);\n\n // Ghost element tracking — spans wrapping each item in the hidden measurement clone.\n // The ghost always renders all items, so widths are stable regardless of bar state.\n const keyToElement = useRef(new Map<string, HTMLElement>());\n const itemWidthsRef = useRef(new Map<string, number>());\n\n // Inputs for computeLayout, kept in refs so the function is stable\n const alwaysKeysRef = useRef<string[]>([]);\n const orderedPartialKeysRef = useRef<string[]>([]);\n const hasOverflowRef = useRef<boolean>(false);\n const columnGapRef = useRef<number>(0);\n\n // Shared rAF handle — both ResizeObservers dequeue into the same frame slot.\n const rafIdRef = useRef<number | null>(null);\n\n // Tracks the last spec so categorization is skipped when nothing meaningful changed.\n const specRef = useRef<string>(\"\");\n\n // computeLayout reads only refs — no closure over props, truly stable.\n // Called from remeasureAndCompute after fresh DOM reads.\n const computeLayout = useCallback((containerWidth: number) => {\n if (!containerWidth) return;\n\n const widths = itemWidthsRef.current;\n const alwaysKeys = alwaysKeysRef.current;\n const partialKeys = orderedPartialKeysRef.current;\n const gap = columnGapRef.current;\n\n const N_a = alwaysKeys.length;\n const alwaysTotal = alwaysKeys.reduce((s, k) => s + (widths.get(k) ?? 0), 0);\n const partialWidths = partialKeys.map(k => widths.get(k) ?? 0);\n const partialTotal = partialWidths.reduce((s, w) => s + w, 0);\n\n let newCount: number;\n\n // Check if everything fits without an overflow menu trigger\n const noMenuTotal = alwaysTotal + partialTotal + gap * Math.max(0, N_a + partialKeys.length - 1);\n if (!hasOverflowRef.current && noMenuTotal <= containerWidth) {\n newCount = partialKeys.length;\n } else {\n // Need the overflow menu trigger — use first measured width as proxy\n // (all icon buttons are the same size)\n const menuW = widths.values().next().value ?? 0;\n if (!menuW) return;\n\n let count = 0, usedPartial = 0;\n for (const w of partialWidths) {\n // Items in bar at this step: N_a always + count partial + 1 new partial + 1 menu trigger\n const totalGap = gap * Math.max(0, N_a + count + 1);\n if (alwaysTotal + usedPartial + w + menuW + totalGap <= containerWidth) {\n usedPartial += w;\n count++;\n } else {\n break;\n }\n }\n newCount = count;\n }\n\n if (newCount !== lastCountRef.current) {\n lastCountRef.current = newCount;\n setPartialInBar(newCount);\n }\n }, []);\n\n // Re-measures all ghost item widths and the container gap, then calls computeLayout.\n // getBoundingClientRect and getComputedStyle are cheap when called from a rAF callback\n // or useLayoutEffect (layout is already computed by the browser at those points).\n // Passing containerWidth avoids a second getBoundingClientRect on the container when\n // the caller already has it (e.g. from ResizeObserver contentRect).\n const remeasureAndCompute = useCallback((containerWidth?: number) => {\n if (!containerRef?.current) return;\n for (const [key, el] of keyToElement.current) {\n itemWidthsRef.current.set(key, el.getBoundingClientRect().width);\n }\n columnGapRef.current = parseFloat(getComputedStyle(containerRef.current).columnGap) || 0;\n computeLayout(containerWidth ?? containerRef.current.getBoundingClientRect().width);\n }, [containerRef, computeLayout]);\n\n // Kept in a ref so the ghost observer's rAF closure is always current\n // without the observer needing to re-subscribe when the function identity changes.\n const remeasureAndComputeRef = useRef(remeasureAndCompute);\n useLayoutEffect(() => { remeasureAndComputeRef.current = remeasureAndCompute; }, [remeasureAndCompute]);\n\n // Categorize items by visibility and do initial measurement before first paint.\n // useLayoutEffect runs synchronously after DOM mutations — so the initial\n // correction happens before the user sees anything.\n // The spec guard skips the effect when items/prefs object references are unstable\n // but nothing meaningful changed, UNLESS widths haven't been populated yet\n // (ghost elements not yet measured on first mount).\n useLayoutEffect(() => {\n if (!isSpaceFit || !containerRef?.current) return;\n\n const spec = items.map(i => `${i.key}:${prefs.keys[i.key]?.visibility ?? \"\"}`).join(\",\");\n const widthsMissing = items.some(i => !(itemWidthsRef.current.get(i.key) ?? 0));\n if (spec === specRef.current && !widthsMissing) return;\n specRef.current = spec;\n\n const always: string[] = [], partial: string[] = [];\n let hasOverflow = false;\n\n for (const item of items) {\n const v = prefs.keys[item.key]?.visibility;\n if (v === ThCollapsibilityVisibility.overflow) hasOverflow = true;\n else if (v === ThCollapsibilityVisibility.always) always.push(item.key);\n else partial.push(item.key);\n }\n\n alwaysKeysRef.current = always;\n orderedPartialKeysRef.current = partial;\n hasOverflowRef.current = hasOverflow;\n\n remeasureAndCompute(containerRef.current.getBoundingClientRect().width);\n }, [isSpaceFit, items, prefs, containerRef, remeasureAndCompute]);\n\n // Container ResizeObserver — fires when the container width changes.\n // Batched via rAF so we compute at most once per frame, not once per pixel.\n // Re-measures item widths each time so icon size changes (e.g. zoom) that also\n // cause a container reflow are picked up automatically.\n useEffect(() => {\n if (!isSpaceFit || !containerRef?.current) return;\n\n const observer = new ResizeObserver(entries => {\n const w = entries[0]?.contentRect.width;\n if (w === undefined) return;\n\n if (rafIdRef.current !== null) cancelAnimationFrame(rafIdRef.current);\n rafIdRef.current = requestAnimationFrame(() => {\n rafIdRef.current = null;\n remeasureAndCompute(w);\n });\n });\n\n observer.observe(containerRef.current);\n return () => {\n observer.disconnect();\n if (rafIdRef.current !== null) cancelAnimationFrame(rafIdRef.current);\n };\n }, [isSpaceFit, containerRef, remeasureAndCompute]);\n\n // Ghost wrapper ResizeObserver — fires when icon sizes change independently of\n // container width (e.g. app-level zoom on a fixed-width container).\n // Implemented as a callback ref so the observer is set up directly on mount\n // without a separate state variable or useEffect dependency on a mutable ref.\n const ghostObserverRef = useRef<ResizeObserver | null>(null);\n const getGhostRef = useCallback((el: HTMLDivElement | null) => {\n ghostObserverRef.current?.disconnect();\n ghostObserverRef.current = null;\n if (el && isSpaceFit) {\n const observer = new ResizeObserver(() => {\n if (rafIdRef.current !== null) cancelAnimationFrame(rafIdRef.current);\n rafIdRef.current = requestAnimationFrame(() => {\n rafIdRef.current = null;\n remeasureAndComputeRef.current();\n });\n });\n observer.observe(el);\n ghostObserverRef.current = observer;\n }\n }, [isSpaceFit]);\n\n // Ref callback factory — attaches to ghost spans for width measurement.\n // Harmless noop in other modes.\n const getItemRef = useCallback((key: string) => (el: HTMLElement | null) => {\n if (el) {\n keyToElement.current.set(key, el);\n } else {\n keyToElement.current.delete(key);\n itemWidthsRef.current.delete(key);\n }\n }, []);\n\n // --- Triage ---\n\n const [actionIcons, menuItems] = useMemo(() => {\n const actionIcons: ThActionEntry<string>[] = [];\n const menuItems: ThActionEntry<string>[] = [];\n\n if (!prefs.collapse) {\n items.forEach((item) => actionIcons.push(item));\n return [actionIcons, menuItems];\n }\n\n if (prefs.collapse === true) {\n // Build the set of partial keys that fit in the bar (first N in displayOrder)\n const barPartialSet = new Set<string>();\n let partialCount = 0;\n for (const item of items) {\n if (prefs.keys[item.key]?.visibility === ThCollapsibilityVisibility.partially) {\n if (partialCount < partialInBar) {\n barPartialSet.add(item.key);\n partialCount++;\n }\n }\n }\n\n for (const item of items) {\n const v = prefs.keys[item.key]?.visibility;\n if (v === ThCollapsibilityVisibility.overflow || (v === ThCollapsibilityVisibility.partially && !barPartialSet.has(item.key))) {\n menuItems.push(item);\n } else {\n actionIcons.push(item);\n }\n }\n\n return [actionIcons, menuItems];\n }\n\n // collapse: Record — breakpoint-based triage (existing logic)\n let countdown: number = 0;\n\n if (breakpoint) {\n const prefForBreakpoint = prefs.collapse[breakpoint];\n if (prefForBreakpoint) {\n // `always` items are never collapsed, so count only partially + overflow items\n const partialCount = items.filter(i => prefs.keys[i.key]?.visibility === ThCollapsibilityVisibility.partially).length;\n const overflowCount = items.filter(i => prefs.keys[i.key]?.visibility === ThCollapsibilityVisibility.overflow).length;\n const collapsibleCount = partialCount + overflowCount;\n\n if (prefForBreakpoint === \"all\") {\n countdown = overflowCount;\n } else if (!isNaN(prefForBreakpoint)) {\n countdown = Math.max(0, collapsibleCount - (prefForBreakpoint - 1));\n }\n }\n }\n\n // Creating a shallow copy so that actionsOrder doesn't mutate between rerenders\n [...items].reverse().forEach((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\n return [actionIcons, menuItems];\n }, [items, prefs, breakpoint, partialInBar]);\n\n return { ActionIcons: actionIcons, MenuItems: menuItems, getItemRef, getGhostRef };\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { i18n, initI18n } from './chunk-6EHFW43Y.mjs';
2
- import { useSharedPreferences } from './chunk-DTPO3J2C.mjs';
1
+ import { useGlobalPreferences } from './chunk-AE6P4KJB.mjs';
2
+ import { i18n, initI18n } from './chunk-2NCN2AG2.mjs';
3
3
  import { I18nextProvider } from 'react-i18next';
4
4
  export { Trans } from 'react-i18next';
5
5
  import { useState, useEffect } from 'react';
@@ -9,7 +9,7 @@ var ThI18nProvider = ({
9
9
  children,
10
10
  ...options
11
11
  }) => {
12
- const { locale } = useSharedPreferences();
12
+ const { preferences: { locale } } = useGlobalPreferences();
13
13
  const [isInitialized, setIsInitialized] = useState(i18n.isInitialized);
14
14
  useEffect(() => {
15
15
  if (!i18n.isInitialized) {
@@ -36,5 +36,5 @@ var ThI18nProvider = ({
36
36
  };
37
37
 
38
38
  export { ThI18nProvider };
39
- //# sourceMappingURL=chunk-NKO3K3QS.mjs.map
40
- //# sourceMappingURL=chunk-NKO3K3QS.mjs.map
39
+ //# sourceMappingURL=chunk-DQDOOTCE.mjs.map
40
+ //# sourceMappingURL=chunk-DQDOOTCE.mjs.map
@@ -0,0 +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,EAAa,EAAE,MAAA,EAAO,KAAM,oBAAA,EAAqB;AACzD,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,UAAU,OAAA,CAAQ;AAAA,OACxB,CAAA,CAAE,IAAA,CAAK,MAAM,gBAAA,CAAiB,IAAI,CAAC,CAAA;AAAA,IACtC;AAAA,EACF,CAAC,CAAA;AAED,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,iBAAiB,MAAA,EAAQ;AAC3B,MAAA,IAAA,CAAK,eAAe,MAAM,CAAA;AAAA,IAC5B;AAAA,EACF,CAAA,EAAG,CAAC,MAAA,EAAQ,aAAa,CAAC,CAAA;AAE1B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,aAAA,EAAe;AACpB,IAAA,MAAM,IAAA,GAAO,MAAA,IAAU,IAAA,CAAK,gBAAA,IAAoB,KAAK,QAAA,IAAY,IAAA;AACjE,IAAA,QAAA,CAAS,gBAAgB,IAAA,GAAO,IAAA;AAAA,EAClC,CAAA,EAAG,CAAC,MAAA,EAAQ,aAAa,CAAC,CAAA;AAE1B,EAAA,IAAI,CAAC,aAAA,EAAe;AAClB,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,uBAAO,GAAA,CAAC,eAAA,EAAA,EAAgB,IAAA,EAAgB,QAAA,EAAU,CAAA;AACpD","file":"chunk-DQDOOTCE.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 { useGlobalPreferences } from \"@/preferences/hooks/useGlobalPreferences\";\n\nexport type ThI18nProviderProps = {\n children: ReactNode;\n} & Partial<InitOptions>;\n\nexport const ThI18nProvider = ({\n children,\n ...options\n}: ThI18nProviderProps) => {\n const { preferences: { locale } } = useGlobalPreferences();\n const [isInitialized, setIsInitialized] = useState(i18n.isInitialized);\n \n useEffect(() => {\n if (!i18n.isInitialized) { \n initI18n({\n ...options,\n lng: locale || options.lng,\n }).then(() => setIsInitialized(true));\n }\n });\n\n useEffect(() => {\n if (isInitialized && locale) {\n i18n.changeLanguage(locale);\n }\n }, [locale, isInitialized]);\n\n useEffect(() => {\n if (!isInitialized) return;\n const lang = locale || i18n.resolvedLanguage || i18n.language || \"en\";\n document.documentElement.lang = lang;\n }, [locale, isInitialized]);\n\n if (!isInitialized) {\n return null;\n }\n\n return <I18nextProvider i18n={ i18n }>{ children }</I18nextProvider>;\n};\n\nexport default ThI18nProvider;\n"]}