@edrlab/thorium-web 1.0.3 → 1.0.4

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 (54) hide show
  1. package/dist/{const-CWJ3Tl-E.d.mts → ThPreferencesAdapter-B-B6s1uq.d.mts} +94 -52
  2. package/dist/{ThSettingsWrapper-CA2_0nQz.d.mts → ThSettingsWrapper-ClWdPKgy.d.mts} +1 -1
  3. package/dist/{actionsReducer-CpRAplzM.d.mts → actionsReducer-cHyAjkb4.d.mts} +1 -1
  4. package/dist/{chunk-CJJU5JM3.mjs → chunk-BFIVOUNT.mjs} +266 -117
  5. package/dist/chunk-BFIVOUNT.mjs.map +1 -0
  6. package/dist/{chunk-DSQWBBAX.mjs → chunk-DVIJIY3N.mjs} +18 -8
  7. package/dist/chunk-DVIJIY3N.mjs.map +1 -0
  8. package/dist/{chunk-6YAFGWN6.mjs → chunk-EN7EPZ3D.mjs} +73 -33
  9. package/dist/chunk-EN7EPZ3D.mjs.map +1 -0
  10. package/dist/{chunk-HGAUPPFP.mjs → chunk-KKNQT27A.mjs} +8 -8
  11. package/dist/chunk-KKNQT27A.mjs.map +1 -0
  12. package/dist/{chunk-R5KZTO4S.mjs → chunk-TEOOAY4V.mjs} +221 -19
  13. package/dist/chunk-TEOOAY4V.mjs.map +1 -0
  14. package/dist/{chunk-5EHYPUUW.mjs → chunk-XSKHMCQO.mjs} +73 -56
  15. package/dist/chunk-XSKHMCQO.mjs.map +1 -0
  16. package/dist/{chunk-KJMXTNYK.mjs → chunk-YOI34PRM.mjs} +34 -8
  17. package/dist/chunk-YOI34PRM.mjs.map +1 -0
  18. package/dist/components/Epub/index.d.mts +20 -14
  19. package/dist/components/Epub/index.mjs +494 -273
  20. package/dist/components/Epub/index.mjs.map +1 -1
  21. package/dist/core/Components/index.d.mts +10 -8
  22. package/dist/core/Components/index.mjs +2 -2
  23. package/dist/core/Helpers/index.d.mts +4 -3
  24. package/dist/core/Helpers/index.mjs +2 -2
  25. package/dist/core/Hooks/index.d.mts +6 -4
  26. package/dist/core/Hooks/index.mjs +2 -2
  27. package/dist/{enums-C9lRPPoF.d.mts → enums-DVxemDRe.d.mts} +27 -4
  28. package/dist/i18n/index.mjs +3 -3
  29. package/dist/lib/index.d.mts +82 -31
  30. package/dist/lib/index.mjs +2 -2
  31. package/dist/locales/en/thorium-web.json +1 -1
  32. package/dist/locales/fr/thorium-web.json +1 -1
  33. package/dist/locales/lt/thorium-web.json +0 -1
  34. package/dist/locales/pl/thorium-web.json +0 -1
  35. package/dist/locales/pt-BR/thorium-web.json +0 -1
  36. package/dist/locales/pt-PT/thorium-web.json +1 -2
  37. package/dist/locales/ta/thorium-web.json +0 -1
  38. package/dist/preferences/index.d.mts +37 -35
  39. package/dist/preferences/index.mjs +2 -2
  40. package/dist/{settings.module-ECROCLEF.module.css → settings.module-IAKLMPEY.module.css} +64 -6
  41. package/dist/{sheets.module-WEBQWGKW.module.css → sheets.module-LJOLY4MK.module.css} +1 -2
  42. package/dist/{useBreakpoints-cngn8st0.d.mts → useBreakpoints-D4DXuKJw.d.mts} +1 -1
  43. package/dist/{useCollapsibility-BmWuCzU4.d.mts → useCollapsibility-CM1I24Ol.d.mts} +1 -1
  44. package/dist/usePreferences-DXfugdw3.d.mts +16 -0
  45. package/dist/{useTimeline-Bid5B7AQ.d.mts → useTimeline-Ba3SQ3QB.d.mts} +15 -1
  46. package/package.json +35 -35
  47. package/dist/chunk-5EHYPUUW.mjs.map +0 -1
  48. package/dist/chunk-6YAFGWN6.mjs.map +0 -1
  49. package/dist/chunk-CJJU5JM3.mjs.map +0 -1
  50. package/dist/chunk-DSQWBBAX.mjs.map +0 -1
  51. package/dist/chunk-HGAUPPFP.mjs.map +0 -1
  52. package/dist/chunk-KJMXTNYK.mjs.map +0 -1
  53. package/dist/chunk-R5KZTO4S.mjs.map +0 -1
  54. package/dist/usePreferences-D81fL5N6.d.mts +0 -11
@@ -1,8 +1,8 @@
1
- import { T as ThBreakpoints, g as ThBackLinkVariant, i as ThDockingTypes, l as ThSheetTypes, m as ThSheetHeaderVariant, k as ThSettingsRangeVariant, d as ThSettingsKeys, q as ThLineHeightOptions, b as ThActionsKeys, c as ThThemeKeys, e as ThTextSettingsKeys, f as ThSpacingSettingsKeys, n as ThLayoutDirection, h as ThLayoutUI, a as ThDockingKeys } from './enums-C9lRPPoF.mjs';
1
+ import { T as ThBreakpoints, q as ThLayoutDirection, i as ThDocumentTitleFormat, h as ThBackLinkVariant, j as ThRunningHeadFormat, k as ThProgressionFormat, g as ThLayoutUI, o as ThSheetTypes, c as ThThemeKeys, b as ThActionsKeys, l as ThDockingTypes, a as ThDockingKeys, d as ThSettingsKeys, n as ThSettingsRangeVariant, t as ThLineHeightOptions, p as ThSheetHeaderVariant, e as ThTextSettingsKeys, f as ThSpacingSettingsKeys } from './enums-DVxemDRe.mjs';
2
2
  import { U as UnstableShortcutRepresentation } from './keyboardUtilities-CoTR9LKx.mjs';
3
- import { B as BreakpointsMap, T as ThBreakpointsObject } from './useBreakpoints-cngn8st0.mjs';
3
+ import { B as BreakpointsMap, T as ThBreakpointsObject } from './useBreakpoints-D4DXuKJw.mjs';
4
4
  import { T as ThColorScheme, a as ThContrast } from './useContrast-Cgsrl7GS.mjs';
5
- import { T as ThCollapsibilityVisibility, a as ThCollapsibility } from './useCollapsibility-BmWuCzU4.mjs';
5
+ import { T as ThCollapsibility, a as ThCollapsibilityVisibility } from './useCollapsibility-CM1I24Ol.mjs';
6
6
 
7
7
  type CSSColor = string | `#${string}` | `rgb(${string})` | `rgba(${string})` | `hsl(${string})` | `hsla(${string})` | `hwb(${string})` | `lab(${string})` | `lch(${string})` | `oklab(${string})` | `oklch(${string})` | `color(${string})` | `color-mix(${string})` | `light-dark(${string})`;
8
8
 
@@ -91,13 +91,33 @@ interface ThActionsTokens {
91
91
  docked?: ThActionsDockedPref;
92
92
  snapped?: ThActionsSnappedPref;
93
93
  }
94
- interface ThActionsPref<T extends string> {
95
- reflowOrder: T[];
96
- fxlOrder: T[];
94
+ type CustomizableKeys = {
95
+ action?: string;
96
+ theme?: string;
97
+ settings?: string;
98
+ text?: string;
99
+ spacing?: string;
100
+ };
101
+ type ActionKey<K extends CustomizableKeys> = K extends {
102
+ action: infer A;
103
+ } ? A extends string ? ThActionsKeys | A : ThActionsKeys : ThActionsKeys;
104
+ type ThemeKey<K extends CustomizableKeys> = K extends {
105
+ theme: infer T;
106
+ } ? T extends string ? ThThemeKeys | T : ThThemeKeys : ThThemeKeys;
107
+ type SettingsKey<K extends CustomizableKeys> = K extends {
108
+ settings: infer S;
109
+ } ? S extends string ? ThSettingsKeys | S : ThSettingsKeys : ThSettingsKeys;
110
+ type TextSettingsKey<K extends CustomizableKeys> = K extends {
111
+ text: infer T;
112
+ } ? T extends string ? ThTextSettingsKeys | T : ThTextSettingsKeys : ThTextSettingsKeys;
113
+ type SpacingSettingsKey<K extends CustomizableKeys> = K extends {
114
+ spacing: infer S;
115
+ } ? S extends string ? ThSpacingSettingsKeys | S : ThSpacingSettingsKeys : ThSpacingSettingsKeys;
116
+ interface ThActionsPref<K extends CustomizableKeys> {
117
+ reflowOrder: Array<ActionKey<K>>;
118
+ fxlOrder: Array<ActionKey<K>>;
97
119
  collapse: ThCollapsibility;
98
- keys: {
99
- [key in T]: ThActionsTokens;
100
- };
120
+ keys: Record<ActionKey<K>, ThActionsTokens>;
101
121
  }
102
122
  interface ThDockingPref<T extends string> {
103
123
  displayOrder: T[];
@@ -128,29 +148,27 @@ type ThSettingsKeyTypes = {
128
148
  [ThSettingsKeys.zoom]?: ThSettingsRangePref;
129
149
  };
130
150
  type ThConstraintKeys = Extract<ThSheetTypes, ThSheetTypes.bottomSheet | ThSheetTypes.popover> | "pagination";
131
- type CustomKeyType = string;
132
- interface CustomizableKeys {
133
- actionKeys: CustomKeyType;
134
- themeKeys: CustomKeyType;
135
- settingsKeys: CustomKeyType;
136
- textSettingsKeys: CustomKeyType;
137
- spacingSettingsKeys: CustomKeyType;
138
- constraintsKeys: CustomKeyType;
139
- customSettingsKeyTypes: Record<string, unknown>;
151
+ interface ThFormatPrefValue<T extends string | Array<string>> {
152
+ variants: T;
153
+ displayInImmersive?: boolean;
154
+ displayInFullscreen?: boolean;
140
155
  }
141
- interface DefaultKeys {
142
- actionKeys: ThActionsKeys;
143
- themeKeys: ThThemeKeys;
144
- settingsKeys: ThSettingsKeys;
145
- textSettingsKeys: ThTextSettingsKeys;
146
- spacingSettingsKeys: ThSpacingSettingsKeys;
147
- constraintsKeys: ThConstraintKeys;
148
- customSettingsKeyTypes: ThSettingsKeyTypes;
156
+ interface ThFormatPref<T extends string | Array<string>> {
157
+ default: ThFormatPrefValue<T>;
158
+ breakpoints?: {
159
+ [key in ThBreakpoints]?: ThFormatPrefValue<T>;
160
+ };
149
161
  }
150
- type KeysOf<T, D> = T extends CustomKeyType ? T : D;
151
- interface ThPreferences<T extends Partial<CustomizableKeys> = {}> {
162
+ interface ThPreferences<K extends CustomizableKeys = {}> {
152
163
  direction?: ThLayoutDirection;
153
164
  locale?: string;
165
+ metadata?: {
166
+ documentTitle?: {
167
+ format: ThDocumentTitleFormat | {
168
+ custom: string;
169
+ };
170
+ };
171
+ };
154
172
  typography: {
155
173
  minimalLineLength?: number | null;
156
174
  maximalLineLength?: number | null;
@@ -158,6 +176,21 @@ interface ThPreferences<T extends Partial<CustomizableKeys> = {}> {
158
176
  pageGutter: number;
159
177
  };
160
178
  theming: {
179
+ header?: {
180
+ backLink?: ThBackLinkPref | null;
181
+ runningHead?: {
182
+ format?: {
183
+ reflow?: ThFormatPref<ThRunningHeadFormat>;
184
+ fxl?: ThFormatPref<ThRunningHeadFormat>;
185
+ };
186
+ };
187
+ };
188
+ progression?: {
189
+ format?: {
190
+ reflow?: ThFormatPref<ThProgressionFormat | Array<ThProgressionFormat>>;
191
+ fxl?: ThFormatPref<ThProgressionFormat | Array<ThProgressionFormat>>;
192
+ };
193
+ };
161
194
  arrow: {
162
195
  size: number;
163
196
  offset: number;
@@ -180,20 +213,18 @@ interface ThPreferences<T extends Partial<CustomizableKeys> = {}> {
180
213
  scrim: string;
181
214
  };
182
215
  constraints?: {
183
- [key in KeysOf<T["constraintsKeys"], ThConstraintKeys>]?: number | null;
216
+ [key in ThConstraintKeys]?: number | null;
184
217
  };
185
218
  };
186
219
  breakpoints: BreakpointsMap<number | null>;
187
220
  themes: {
188
- reflowOrder: Array<KeysOf<T["themeKeys"], ThThemeKeys> | "auto">;
189
- fxlOrder: Array<KeysOf<T["themeKeys"], ThThemeKeys> | "auto">;
221
+ reflowOrder: Array<ThemeKey<K> | "auto">;
222
+ fxlOrder: Array<ThemeKey<K> | "auto">;
190
223
  systemThemes?: {
191
- light: KeysOf<T["themeKeys"], ThThemeKeys>;
192
- dark: KeysOf<T["themeKeys"], ThThemeKeys>;
193
- };
194
- keys: {
195
- [key in KeysOf<T["themeKeys"], ThThemeKeys>]: ThemeTokens;
224
+ light: ThemeKey<K>;
225
+ dark: ThemeKey<K>;
196
226
  };
227
+ keys: Record<Exclude<ThemeKey<K>, "auto"> & string, ThemeTokens>;
197
228
  };
198
229
  };
199
230
  affordances: {
@@ -204,21 +235,18 @@ interface ThPreferences<T extends Partial<CustomizableKeys> = {}> {
204
235
  showOnBackwardScroll: boolean;
205
236
  };
206
237
  };
207
- header: {
208
- backLink?: ThBackLinkPref | null;
209
- };
210
- actions: ThActionsPref<KeysOf<T["actionKeys"], ThActionsKeys>>;
238
+ actions: ThActionsPref<K>;
211
239
  shortcuts: {
212
240
  representation: UnstableShortcutRepresentation;
213
241
  joiner?: string;
214
242
  };
215
243
  docking: ThDockingPref<ThDockingKeys>;
216
244
  settings: {
217
- reflowOrder: Array<KeysOf<T["settingsKeys"], ThSettingsKeys>>;
218
- fxlOrder: Array<KeysOf<T["settingsKeys"], ThSettingsKeys>>;
219
- keys?: T["customSettingsKeyTypes"] | ThSettingsKeyTypes;
220
- text?: ThSettingsGroupPref<KeysOf<T["textSettingsKeys"], ThTextSettingsKeys>>;
221
- spacing?: ThSettingsGroupPref<KeysOf<T["spacingSettingsKeys"], ThSpacingSettingsKeys>>;
245
+ reflowOrder: Array<SettingsKey<K>>;
246
+ fxlOrder: Array<SettingsKey<K>>;
247
+ keys?: ThSettingsKeyTypes;
248
+ text?: ThSettingsGroupPref<TextSettingsKey<K>>;
249
+ spacing?: ThSettingsGroupPref<SpacingSettingsKey<K>>;
222
250
  };
223
251
  }
224
252
  /**
@@ -226,12 +254,19 @@ interface ThPreferences<T extends Partial<CustomizableKeys> = {}> {
226
254
  * @param params The preferences object to create
227
255
  * @returns A new preferences object
228
256
  */
229
- declare const createPreferences: <T extends Partial<CustomizableKeys>>(params: ThPreferences<T>) => ThPreferences<T>;
230
- type ActionKeyType = ThActionsKeys | CustomKeyType;
231
- type ThemeKeyType = ThThemeKeys | CustomKeyType;
232
- type SettingsKeyType = ThSettingsKeys | CustomKeyType;
233
- type TextSettingsKeyType = ThTextSettingsKeys | CustomKeyType;
234
- type SpacingSettingsKeyType = ThSpacingSettingsKeys | CustomKeyType;
257
+ declare const createPreferences: <K extends CustomizableKeys = {}>(params: ThPreferences<K>) => ThPreferences<K>;
258
+ type DefaultKeys = {
259
+ action: ThActionsKeys;
260
+ theme: ThThemeKeys;
261
+ settings: ThSettingsKeys;
262
+ text: ThTextSettingsKeys;
263
+ spacing: ThSpacingSettingsKeys;
264
+ };
265
+ type ActionKeyType<K extends CustomizableKeys = DefaultKeys> = K["action"] extends string ? K["action"] : ThActionsKeys;
266
+ type ThemeKeyType<K extends CustomizableKeys = DefaultKeys> = K["theme"] extends string ? K["theme"] : ThThemeKeys;
267
+ type SettingsKeyType<K extends CustomizableKeys = DefaultKeys> = K["settings"] extends string ? K["settings"] : ThSettingsKeys;
268
+ type TextSettingsKeyType<K extends CustomizableKeys = DefaultKeys> = K["text"] extends string ? K["text"] : ThTextSettingsKeys;
269
+ type SpacingSettingsKeyType<K extends CustomizableKeys = DefaultKeys> = K["spacing"] extends string ? K["spacing"] : ThSpacingSettingsKeys;
235
270
 
236
271
  declare const defaultActionKeysObject: ThActionsTokens;
237
272
  declare const defaultTextSettingsMain: ThTextSettingsKeys[];
@@ -257,4 +292,11 @@ declare const defaultLineHeights: {
257
292
  large: number;
258
293
  };
259
294
 
260
- export { type ActionKeyType as A, defaultFontSize as B, type CustomizableKeys as C, type DefaultKeys as D, defaultParagraphSpacing as E, defaultParagraphIndent as F, defaultWordSpacing as G, defaultLetterSpacing as H, defaultLineHeights as I, type KeysOf as K, type SettingsKeyType as S, type ThPreferences as T, type ThemeTokens as a, type CustomKeyType as b, type ThBackLinkContent as c, type ThBackLinkPref as d, type ThBottomSheetDetent as e, type ThActionsSnappedPref as f, type ThActionsDockedPref as g, type ThActionsTokens as h, type ThActionsPref as i, type ThDockingPref as j, type ThSettingsGroupPref as k, type ThSettingsRangePref as l, type ThSettingsKeyTypes as m, type ThConstraintKeys as n, createPreferences as o, type ThemeKeyType as p, type TextSettingsKeyType as q, type SpacingSettingsKeyType as r, useTheming as s, defaultActionKeysObject as t, type useThemingProps as u, defaultTextSettingsMain as v, defaultTextSettingsSubpanel as w, defaultSpacingSettingsMain as x, defaultSpacingSettingsSubpanel as y, defaultFontFamilyOptions as z };
295
+ interface ThPreferencesAdapter<T extends CustomizableKeys = CustomizableKeys> {
296
+ getPreferences(): ThPreferences<T>;
297
+ setPreferences(prefs: ThPreferences<T>): void;
298
+ subscribe(callback: (prefs: ThPreferences<T>) => void): void;
299
+ unsubscribe(callback: (prefs: ThPreferences<T>) => void): void;
300
+ }
301
+
302
+ export { type ActionKey as A, useTheming as B, type CustomizableKeys as C, type DefaultKeys as D, defaultActionKeysObject as E, defaultTextSettingsMain as F, defaultTextSettingsSubpanel as G, defaultSpacingSettingsMain as H, defaultSpacingSettingsSubpanel as I, defaultFontFamilyOptions as J, defaultFontSize as K, defaultParagraphSpacing as L, defaultParagraphIndent as M, defaultWordSpacing as N, defaultLetterSpacing as O, defaultLineHeights as P, type SettingsKey as S, type ThPreferencesAdapter as T, type ThPreferences as a, type ThemeTokens as b, type ThBackLinkContent as c, type ThBackLinkPref as d, type ThBottomSheetDetent as e, type ThActionsSnappedPref as f, type ThActionsDockedPref as g, type ThActionsTokens as h, type ThemeKey as i, type TextSettingsKey as j, type SpacingSettingsKey as k, type ThActionsPref as l, type ThDockingPref as m, type ThSettingsGroupPref as n, type ThSettingsRangePref as o, type ThSettingsKeyTypes as p, type ThConstraintKeys as q, type ThFormatPrefValue as r, type ThFormatPref as s, createPreferences as t, type ActionKeyType as u, type ThemeKeyType as v, type SettingsKeyType as w, type TextSettingsKeyType as x, type SpacingSettingsKeyType as y, type useThemingProps as z };
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React__default, { ComponentType, SVGProps } from 'react';
3
- import { b as ThActionEntry, c as ThActionsBarProps, C as CollapsiblePref } from './useCollapsibility-BmWuCzU4.mjs';
3
+ import { b as ThActionEntry, c as ThActionsBarProps, C as CollapsiblePref } from './useCollapsibility-CM1I24Ol.mjs';
4
4
  import { ButtonProps, TooltipProps, MenuProps, MenuTriggerProps, PopoverProps, MenuItemProps, LabelProps, NumberFieldProps, GroupProps, InputProps, RadioGroupProps, RadioProps, SliderProps, SliderOutputProps, SliderTrackProps, SliderThumbProps, SwitchProps, HeadingProps } from 'react-aria-components';
5
5
  import { TooltipTriggerProps, KeyboardProps } from 'react-aria';
6
6
 
@@ -1,5 +1,5 @@
1
1
  import * as _reduxjs_toolkit from '@reduxjs/toolkit';
2
- import { a as ThDockingKeys } from './enums-C9lRPPoF.mjs';
2
+ import { a as ThDockingKeys } from './enums-DVxemDRe.mjs';
3
3
 
4
4
  type PrimitiveType = number | string | boolean;
5
5
  /** Object types that should never be mapped */