@readium/navigator 1.3.3 → 2.0.0-beta.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 (55) hide show
  1. package/dist/index.js +3744 -2819
  2. package/dist/index.umd.cjs +16 -16
  3. package/package.json +9 -9
  4. package/src/epub/EpubNavigator.ts +184 -7
  5. package/src/epub/css/Properties.ts +376 -0
  6. package/src/epub/css/ReadiumCSS.ts +348 -0
  7. package/src/epub/css/index.ts +2 -0
  8. package/src/epub/frame/FrameBlobBuilder.ts +59 -9
  9. package/src/epub/frame/FrameManager.ts +25 -6
  10. package/src/epub/frame/FramePoolManager.ts +61 -2
  11. package/src/epub/fxl/FXLFramePoolManager.ts +3 -15
  12. package/src/epub/index.ts +3 -1
  13. package/src/epub/preferences/EpubDefaults.ts +154 -0
  14. package/src/epub/preferences/EpubPreferences.ts +183 -0
  15. package/src/epub/preferences/EpubPreferencesEditor.ts +501 -0
  16. package/src/epub/preferences/EpubSettings.ts +212 -0
  17. package/src/epub/preferences/guards.ts +86 -0
  18. package/src/epub/preferences/index.ts +4 -0
  19. package/src/helpers/dimensions.ts +13 -0
  20. package/src/helpers/index.ts +1 -0
  21. package/src/helpers/lineLength.ts +293 -0
  22. package/src/helpers/sML.ts +18 -1
  23. package/src/index.ts +2 -1
  24. package/src/preferences/Configurable.ts +16 -0
  25. package/src/preferences/Preference.ts +272 -0
  26. package/src/preferences/PreferencesEditor.ts +6 -0
  27. package/src/preferences/Types.ts +39 -0
  28. package/src/preferences/index.ts +4 -0
  29. package/types/src/epub/EpubNavigator.d.ts +27 -3
  30. package/types/src/epub/css/Properties.d.ts +177 -0
  31. package/types/src/epub/css/ReadiumCSS.d.ts +32 -0
  32. package/types/src/epub/css/index.d.ts +2 -0
  33. package/types/src/epub/frame/FrameBlobBuilder.d.ts +5 -1
  34. package/types/src/epub/frame/FrameManager.d.ts +5 -0
  35. package/types/src/epub/frame/FramePoolManager.d.ts +8 -1
  36. package/types/src/epub/fxl/FXLFramePoolManager.d.ts +1 -3
  37. package/types/src/epub/index.d.ts +2 -0
  38. package/types/src/epub/preferences/EpubDefaults.d.ts +82 -0
  39. package/types/src/epub/preferences/EpubPreferences.d.ts +86 -0
  40. package/types/src/epub/preferences/EpubPreferencesEditor.d.ts +53 -0
  41. package/types/src/epub/preferences/EpubSettings.d.ts +85 -0
  42. package/types/src/epub/preferences/guards.d.ts +9 -0
  43. package/types/src/epub/preferences/index.d.ts +4 -0
  44. package/types/src/helpers/dimensions.d.ts +7 -0
  45. package/types/src/helpers/index.d.ts +1 -0
  46. package/types/src/helpers/lineLength.d.ts +68 -0
  47. package/types/src/helpers/sML.d.ts +6 -1
  48. package/types/src/index.d.ts +1 -0
  49. package/types/src/preferences/Configurable.d.ts +13 -0
  50. package/types/src/preferences/Preference.d.ts +117 -0
  51. package/types/src/preferences/PreferencesEditor.d.ts +5 -0
  52. package/types/src/preferences/PreferencesSerializer.d.ts +5 -0
  53. package/types/src/preferences/Types.d.ts +24 -0
  54. package/types/src/preferences/index.d.ts +4 -0
  55. package/LICENSE +0 -28
@@ -0,0 +1,272 @@
1
+ export interface IPreference<T> {
2
+ /**
3
+ * The current value of the preference.
4
+ */
5
+ value: T | null | undefined;
6
+
7
+ /**
8
+ * The value that will be effectively used by the Configurable object if preferences are submitted as they are.
9
+ */
10
+ effectiveValue: T | null | undefined;
11
+
12
+ /**
13
+ * Indicates if this preference will be effectively used by the Configurable object if preferences are submitted as they are.
14
+ */
15
+ isEffective: boolean;
16
+
17
+ /**
18
+ * Unset the preference.
19
+ * Equivalent to set(null).
20
+ */
21
+ clear(): void;
22
+ }
23
+
24
+ export interface IBooleanPreference extends IPreference<boolean> {
25
+ /**
26
+ * Toggle the preference to its opposite value.
27
+ */
28
+ toggle(): void;
29
+ }
30
+
31
+ export interface IEnumPreference<T> extends IPreference<T> {
32
+ /**
33
+ * The possible values for this preference.
34
+ */
35
+ supportedValues: T[];
36
+ }
37
+
38
+ export interface IRangePreference<T> extends IPreference<T> {
39
+ /**
40
+ * The supported range [min, max] for this preference.
41
+ */
42
+ supportedRange: [T, T];
43
+
44
+ /**
45
+ * The step value for the incrementing/decrementing into the range.
46
+ */
47
+ step: number;
48
+
49
+ /**
50
+ * Increase the preference value.
51
+ */
52
+ increment(): void;
53
+
54
+ /**
55
+ * Decrease the preference value.
56
+ */
57
+ decrement(): void;
58
+
59
+ /**
60
+ * Format the preference value as a string.
61
+ */
62
+ format(value: T): string;
63
+ }
64
+
65
+ export class Preference<T> implements Preference<T> {
66
+ protected _value?: T | null;
67
+ protected readonly _effectiveValue?: T | null;
68
+ protected readonly _isEffective: boolean;
69
+
70
+ protected _onChange: (newValue: T | null | undefined) => void;
71
+
72
+ constructor({
73
+ initialValue = null,
74
+ effectiveValue,
75
+ isEffective,
76
+ onChange
77
+ } : {
78
+ initialValue?: T | null,
79
+ effectiveValue?: T | null,
80
+ isEffective: boolean,
81
+ onChange: (newValue: T | null | undefined) => void
82
+ }) {
83
+ this._value = initialValue;
84
+ this._effectiveValue = effectiveValue;
85
+ this._isEffective = isEffective;
86
+ this._onChange = onChange;
87
+ }
88
+
89
+ set value(value: T | null | undefined) {
90
+ this._value = value;
91
+ this._onChange(this._value);
92
+ }
93
+
94
+ get value(): T | null | undefined {
95
+ return this._value;
96
+ }
97
+
98
+ get effectiveValue(): T | null | undefined {
99
+ return this._effectiveValue;
100
+ }
101
+
102
+ get isEffective(): boolean {
103
+ return this._isEffective;
104
+ }
105
+
106
+ clear(): void {
107
+ this._value = null;
108
+ }
109
+ }
110
+
111
+ export class BooleanPreference extends Preference<boolean> implements IBooleanPreference {
112
+ set value(value: boolean | null | undefined) {
113
+ this._value = value;
114
+ this._onChange(this._value);
115
+ }
116
+
117
+ get value(): boolean | null | undefined {
118
+ return this._value;
119
+ }
120
+
121
+ get effectiveValue(): boolean | null | undefined {
122
+ return this._effectiveValue;
123
+ }
124
+
125
+ get isEffective(): boolean {
126
+ return this._isEffective;
127
+ }
128
+
129
+ clear(): void {
130
+ this._value = null;
131
+ }
132
+
133
+ toggle(): void {
134
+ this._value = !this._value;
135
+ this._onChange(this._value);
136
+ }
137
+ }
138
+
139
+ export class EnumPreference<T extends string | number | symbol> extends Preference<T> implements IEnumPreference<T> {
140
+ private readonly _supportedValues: T[];
141
+
142
+ constructor({
143
+ initialValue = null,
144
+ effectiveValue,
145
+ isEffective,
146
+ onChange,
147
+ supportedValues
148
+ } : {
149
+ initialValue?: T | null,
150
+ effectiveValue?: T | null,
151
+ isEffective: boolean,
152
+ onChange: (newValue: T | null | undefined) => void,
153
+ supportedValues: T[]
154
+ }) {
155
+ super({ initialValue, effectiveValue, isEffective, onChange });
156
+ this._supportedValues = supportedValues;
157
+ }
158
+
159
+ set value(value: T | null | undefined) {
160
+ if (value && !this._supportedValues.includes(value)) {
161
+ throw new Error(`Value '${ String(value) }' is not in the supported values for this preference.`);
162
+ }
163
+ this._value = value;
164
+ this._onChange(this._value);
165
+ }
166
+
167
+ get value(): T | null | undefined {
168
+ return this._value;
169
+ }
170
+
171
+ get effectiveValue(): T | null | undefined {
172
+ return this._effectiveValue;
173
+ }
174
+
175
+ get isEffective(): boolean {
176
+ return this._isEffective;
177
+ }
178
+
179
+ get supportedValues(): T[] {
180
+ return this._supportedValues;
181
+ }
182
+
183
+ clear(): void {
184
+ this._value = null;
185
+ }
186
+ }
187
+
188
+ export class RangePreference<T extends number> extends Preference<T> implements IRangePreference<T> {
189
+ private readonly _supportedRange: [T, T];
190
+ private readonly _step: number;
191
+ private readonly _decimals: number;
192
+
193
+ constructor({
194
+ initialValue = null,
195
+ effectiveValue,
196
+ isEffective,
197
+ onChange,
198
+ supportedRange,
199
+ step
200
+ } : {
201
+ initialValue?: T | null,
202
+ effectiveValue?: T | null,
203
+ isEffective: boolean,
204
+ onChange: (newValue: T | null | undefined) => void,
205
+ supportedRange: [T, T],
206
+ step: number
207
+ }
208
+ ) {
209
+ super({ initialValue, effectiveValue, isEffective, onChange });
210
+ this._supportedRange = supportedRange;
211
+ this._step = step;
212
+ this._decimals = this._step.toString().includes('.')
213
+ ? this._step.toString().split('.')[1].length
214
+ : 0;
215
+ }
216
+
217
+ set value(value: T | null | undefined) {
218
+ if (value && (value < this._supportedRange[0] || value > this._supportedRange[1])) {
219
+ throw new Error(`Value '${ String(value) }' is out of the supported range for this preference.`);
220
+ }
221
+ this._value = value;
222
+ this._onChange(this._value);
223
+ }
224
+
225
+ get value(): T | null | undefined {
226
+ return this._value;
227
+ }
228
+
229
+ get effectiveValue(): T | null | undefined {
230
+ return this._effectiveValue;
231
+ }
232
+
233
+ get isEffective(): boolean {
234
+ return this._isEffective;
235
+ }
236
+
237
+ get supportedRange(): [T, T] {
238
+ return this._supportedRange;
239
+ }
240
+
241
+ get step(): number {
242
+ return this._step;
243
+ }
244
+
245
+ increment(): void {
246
+ if (this._value && this._value < this._supportedRange[1]) {
247
+ this._value = Math.min(
248
+ Math.round((this._value + this._step) * 10 ** this._decimals) / 10 ** this._decimals,
249
+ this._supportedRange[1]
250
+ ) as T;
251
+ this._onChange(this._value);
252
+ }
253
+ }
254
+
255
+ decrement(): void {
256
+ if (this._value && this._value > this._supportedRange[0]) {
257
+ this._value = Math.max(
258
+ Math.round((this._value - this._step) * 10 ** this._decimals) / 10 ** this._decimals,
259
+ this._supportedRange[0]
260
+ ) as T;
261
+ this._onChange(this._value);
262
+ }
263
+ }
264
+
265
+ format(value: T): string {
266
+ return value.toString();
267
+ }
268
+
269
+ clear(): void {
270
+ this._value = null;
271
+ }
272
+ }
@@ -0,0 +1,6 @@
1
+ import { ConfigurablePreferences } from "./Configurable";
2
+
3
+ export interface IPreferencesEditor {
4
+ preferences: ConfigurablePreferences;
5
+ clear(): void;
6
+ }
@@ -0,0 +1,39 @@
1
+ export enum TextAlignment {
2
+ start = "start",
3
+ left = "left",
4
+ right = "right",
5
+ justify = "justify"
6
+ };
7
+
8
+ export enum Theme {
9
+ day = "day",
10
+ sepia = "sepia",
11
+ night = "night",
12
+ custom = "custom"
13
+ }
14
+
15
+ export enum LayoutStrategy {
16
+ margin = "margin",
17
+ lineLength = "lineLength",
18
+ columns = "columns"
19
+ }
20
+
21
+ export type RangeConfig = {
22
+ range: [number, number],
23
+ step: number
24
+ }
25
+
26
+ export const fontSizeRangeConfig: RangeConfig = {
27
+ range: [0.7, 4],
28
+ step: 0.05
29
+ }
30
+
31
+ export const fontWeightRangeConfig: RangeConfig = {
32
+ range: [100, 1000],
33
+ step: 100
34
+ }
35
+
36
+ export const fontWidthRangeConfig: RangeConfig = {
37
+ range: [50, 250],
38
+ step: 10
39
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./Configurable";
2
+ export * from "./Preference";
3
+ export * from "./PreferencesEditor";
4
+ export * from "./Types";
@@ -1,12 +1,20 @@
1
1
  import { EPUBLayout, Link, Locator, Publication, ReadingProgression } from "@readium/shared";
2
- import { VisualNavigator } from "../";
2
+ import { Configurable, ConfigurablePreferences, ConfigurableSettings, VisualNavigator } from "../";
3
3
  import { FramePoolManager } from "./frame/FramePoolManager";
4
4
  import { FXLFramePoolManager } from "./fxl/FXLFramePoolManager";
5
5
  import { CommsEventKey } from "@readium/navigator-html-injectables";
6
6
  import { BasicTextSelection, FrameClickEvent } from "@readium/navigator-html-injectables";
7
7
  import { FXLFrameManager } from "./fxl/FXLFrameManager";
8
8
  import { FrameManager } from "./frame/FrameManager";
9
+ import { IEpubPreferences, EpubPreferences } from "./preferences/EpubPreferences";
10
+ import { IEpubDefaults } from "./preferences/EpubDefaults";
11
+ import { EpubSettings } from "./preferences";
12
+ import { EpubPreferencesEditor } from "./preferences/EpubPreferencesEditor";
9
13
  export type ManagerEventKey = "zoom";
14
+ export interface EpubNavigatorConfiguration {
15
+ preferences: IEpubPreferences;
16
+ defaults: IEpubDefaults;
17
+ }
10
18
  export interface EpubNavigatorListeners {
11
19
  frameLoaded: (wnd: Window) => void;
12
20
  positionChanged: (locator: Locator) => void;
@@ -18,7 +26,7 @@ export interface EpubNavigatorListeners {
18
26
  handleLocator: (locator: Locator) => boolean;
19
27
  textSelected: (selection: BasicTextSelection) => void;
20
28
  }
21
- export declare class EpubNavigator extends VisualNavigator {
29
+ export declare class EpubNavigator extends VisualNavigator implements Configurable<ConfigurableSettings, ConfigurablePreferences> {
22
30
  private readonly pub;
23
31
  private readonly container;
24
32
  private readonly listeners;
@@ -28,9 +36,25 @@ export declare class EpubNavigator extends VisualNavigator {
28
36
  private lastLocationInView;
29
37
  private currentProgression;
30
38
  readonly layout: EPUBLayout;
31
- constructor(container: HTMLElement, pub: Publication, listeners: EpubNavigatorListeners, positions?: Locator[], initialPosition?: Locator | undefined);
39
+ private _preferences;
40
+ private _defaults;
41
+ private _settings;
42
+ private _css;
43
+ private _preferencesEditor;
44
+ private resizeObserver;
45
+ constructor(container: HTMLElement, pub: Publication, listeners: EpubNavigatorListeners, positions?: Locator[], initialPosition?: Locator | undefined, configuration?: EpubNavigatorConfiguration);
32
46
  static determineLayout(pub: Publication): EPUBLayout;
33
47
  load(): Promise<void>;
48
+ get settings(): Readonly<EpubSettings>;
49
+ get preferencesEditor(): EpubPreferencesEditor;
50
+ submitPreferences(preferences: EpubPreferences): Promise<void>;
51
+ private applyPreferences;
52
+ private handleFXLPrefs;
53
+ private updateCSS;
54
+ private compileCSSProperties;
55
+ private commitCSS;
56
+ resizeHandler(): Promise<void>;
57
+ get ownerWindow(): Window & typeof globalThis;
34
58
  /**
35
59
  * Exposed to the public to compensate for lack of implemented readium conveniences
36
60
  * TODO remove when settings management is incorporated
@@ -0,0 +1,177 @@
1
+ import { TextAlignment, Theme } from "../../preferences/Types";
2
+ export type BodyHyphens = "auto" | "none";
3
+ export type BoxSizing = "content-box" | "border-box";
4
+ export type FontOpticalSizing = "auto" | "none";
5
+ export type FontWidth = "ultra-condensed" | "extra-condensed" | "condensed" | "semi-condensed" | "normal" | "semi-expanded" | "expanded" | "extra-expanded" | "ultra-expanded" | number;
6
+ export type Ligatures = "common-ligatures" | "none";
7
+ export type TypeScale = 1 | 1.067 | 1.125 | 1.2 | 1.25 | 1.333 | 1.414 | 1.5 | 1.618;
8
+ export type View = "paged" | "scroll";
9
+ declare abstract class Properties {
10
+ constructor();
11
+ protected toFlag(name: string): string;
12
+ protected toUnitless(value: number): string;
13
+ protected toPercentage(value: number, ratio?: boolean): string;
14
+ protected toVw(value: number): string;
15
+ protected toVh(value: number): string;
16
+ protected toPx(value: number): string;
17
+ protected toRem(value: number): string;
18
+ abstract toCSSProperties(): {
19
+ [key: string]: string;
20
+ };
21
+ }
22
+ export interface IUserProperties {
23
+ advancedSettings?: boolean | null;
24
+ a11yNormalize?: boolean | null;
25
+ appearance?: Theme | null;
26
+ backgroundColor?: string | null;
27
+ blendFilter?: boolean | null;
28
+ bodyHyphens?: BodyHyphens | null;
29
+ colCount?: number | null;
30
+ darkenFilter?: boolean | number | null;
31
+ deprecatedFontSize?: boolean | null;
32
+ fontFamily?: string | null;
33
+ fontOpticalSizing?: FontOpticalSizing | null;
34
+ fontOverride?: boolean | null;
35
+ fontSize?: number | null;
36
+ fontSizeNormalize?: boolean | null;
37
+ fontWeight?: number | null;
38
+ fontWidth?: FontWidth | null;
39
+ invertFilter?: boolean | number | null;
40
+ invertGaijiFilter?: boolean | number | null;
41
+ iPadOSPatch?: boolean | null;
42
+ letterSpacing?: number | null;
43
+ ligatures?: Ligatures | null;
44
+ lineHeight?: number | null;
45
+ lineLength?: number | null;
46
+ linkColor?: string | null;
47
+ noRuby?: boolean | null;
48
+ paraIndent?: number | null;
49
+ paraSpacing?: number | null;
50
+ selectionBackgroundColor?: string | null;
51
+ selectionTextColor?: string | null;
52
+ textAlign?: TextAlignment | null;
53
+ textColor?: string | null;
54
+ view?: View | null;
55
+ visitedColor?: string | null;
56
+ wordSpacing?: number | null;
57
+ }
58
+ export declare class UserProperties extends Properties {
59
+ a11yNormalize: boolean | null;
60
+ appearance: Theme | null;
61
+ backgroundColor: string | null;
62
+ blendFilter: boolean | null;
63
+ bodyHyphens: BodyHyphens | null;
64
+ colCount: number | null | undefined;
65
+ darkenFilter: boolean | number | null;
66
+ deprecatedFontSize: boolean | null;
67
+ fontFamily: string | null;
68
+ fontOpticalSizing: FontOpticalSizing | null;
69
+ fontOverride: boolean | null;
70
+ fontSize: number | null;
71
+ fontSizeNormalize: boolean | null;
72
+ fontWeight: number | null;
73
+ fontWidth: FontWidth | null;
74
+ invertFilter: boolean | number | null;
75
+ invertGaijiFilter: boolean | number | null;
76
+ iPadOSPatch: boolean | null;
77
+ letterSpacing: number | null;
78
+ ligatures: Ligatures | null;
79
+ lineHeight: number | null;
80
+ lineLength: number | null;
81
+ linkColor: string | null;
82
+ noRuby: boolean | null;
83
+ paraIndent: number | null;
84
+ paraSpacing: number | null;
85
+ selectionBackgroundColor?: string | null;
86
+ selectionTextColor?: string | null;
87
+ textAlign: TextAlignment | null;
88
+ textColor: string | null;
89
+ view: View | null;
90
+ visitedColor: string | null;
91
+ wordSpacing: number | null;
92
+ constructor(props: IUserProperties);
93
+ toCSSProperties(): {
94
+ [key: string]: string;
95
+ };
96
+ }
97
+ export interface IRSProperties {
98
+ backgroundColor?: string | null;
99
+ baseFontFamily?: string | null;
100
+ baseFontSize?: number | null;
101
+ baseLineHeight?: number | null;
102
+ boxSizingMedia?: BoxSizing | null;
103
+ boxSizingTable?: BoxSizing | null;
104
+ colWidth?: string | null;
105
+ colCount?: number | null;
106
+ colGap?: number | null;
107
+ codeFontFamily?: string | null;
108
+ compFontFamily?: string | null;
109
+ defaultLineLength?: number | null;
110
+ flowSpacing?: number | null;
111
+ humanistTf?: string | null;
112
+ linkColor?: string | null;
113
+ maxMediaWidth?: number | null;
114
+ maxMediaHeight?: number | null;
115
+ modernTf?: string | null;
116
+ monospaceTf?: string | null;
117
+ noVerticalPagination?: boolean | null;
118
+ oldStyleTf?: string | null;
119
+ pageGutter?: number | null;
120
+ paraIndent?: number | null;
121
+ paraSpacing?: number | null;
122
+ primaryColor?: string | null;
123
+ sansSerifJa?: string | null;
124
+ sansSerifJaV?: string | null;
125
+ sansTf?: string | null;
126
+ secondaryColor?: string | null;
127
+ selectionBackgroundColor?: string | null;
128
+ selectionTextColor?: string | null;
129
+ serifJa?: string | null;
130
+ serifJaV?: string | null;
131
+ textColor?: string | null;
132
+ typeScale?: TypeScale | null;
133
+ visitedColor?: string | null;
134
+ }
135
+ export declare class RSProperties extends Properties {
136
+ backgroundColor: string | null;
137
+ baseFontFamily: string | null;
138
+ baseFontSize: number | null;
139
+ baseLineHeight: number | null;
140
+ boxSizingMedia: BoxSizing | null;
141
+ boxSizingTable: BoxSizing | null;
142
+ colWidth: string | null;
143
+ colCount: number | null;
144
+ colGap: number | null;
145
+ codeFontFamily: string | null;
146
+ compFontFamily: string | null;
147
+ defaultLineLength: number | null;
148
+ flowSpacing: number | null;
149
+ humanistTf: string | null;
150
+ linkColor: string | null;
151
+ maxMediaWidth: number | null;
152
+ maxMediaHeight: number | null;
153
+ modernTf: string | null;
154
+ monospaceTf: string | null;
155
+ noVerticalPagination: boolean | null;
156
+ oldStyleTf: string | null;
157
+ pageGutter: number | null;
158
+ paraIndent: number | null;
159
+ paraSpacing: number | null;
160
+ primaryColor: string | null;
161
+ sansSerifJa: string | null;
162
+ sansSerifJaV: string | null;
163
+ sansTf: string | null;
164
+ secondaryColor: string | null;
165
+ selectionBackgroundColor: string | null;
166
+ selectionTextColor: string | null;
167
+ serifJa: string | null;
168
+ serifJaV: string | null;
169
+ textColor: string | null;
170
+ typeScale: TypeScale | null;
171
+ visitedColor: string | null;
172
+ constructor(props: IRSProperties);
173
+ toCSSProperties(): {
174
+ [key: string]: string;
175
+ };
176
+ }
177
+ export {};
@@ -0,0 +1,32 @@
1
+ import { LineLengths } from "../../helpers";
2
+ import { LayoutStrategy } from "../../preferences";
3
+ import { EpubSettings } from "../preferences/EpubSettings";
4
+ import { RSProperties, UserProperties } from "./Properties";
5
+ export interface IReadiumCSS {
6
+ rsProperties: RSProperties;
7
+ userProperties: UserProperties;
8
+ lineLengths: LineLengths;
9
+ container: HTMLElement;
10
+ constraint: number;
11
+ layoutStrategy?: LayoutStrategy | null;
12
+ }
13
+ export declare class ReadiumCSS {
14
+ rsProperties: RSProperties;
15
+ userProperties: UserProperties;
16
+ lineLengths: LineLengths;
17
+ container: HTMLElement;
18
+ containerParent: HTMLElement;
19
+ constraint: number;
20
+ layoutStrategy: LayoutStrategy;
21
+ private cachedColCount;
22
+ private effectiveContainerWidth;
23
+ constructor(props: IReadiumCSS);
24
+ update(settings: EpubSettings): void;
25
+ private updateLineLengths;
26
+ private updateLayout;
27
+ private getCompensatedMetrics;
28
+ private paginate;
29
+ private computeScrollLength;
30
+ setContainerWidth(): void;
31
+ resizeHandler(): void;
32
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./Properties";
2
+ export * from "./ReadiumCSS";
@@ -3,11 +3,15 @@ export default class FrameBlobBuider {
3
3
  private readonly item;
4
4
  private readonly burl;
5
5
  private readonly pub;
6
- constructor(pub: Publication, baseURL: string, item: Link);
6
+ private readonly cssProperties?;
7
+ constructor(pub: Publication, baseURL: string, item: Link, cssProperties?: {
8
+ [key: string]: string;
9
+ });
7
10
  build(fxl?: boolean): Promise<string>;
8
11
  private buildHtmlFrame;
9
12
  private buildImageFrame;
10
13
  private hasExecutable;
11
14
  private hasStyle;
15
+ private setProperties;
12
16
  private finalizeDOM;
13
17
  }
@@ -5,12 +5,17 @@ export declare class FrameManager {
5
5
  private loader;
6
6
  readonly source: string;
7
7
  private comms;
8
+ private hidden;
9
+ private destroyed;
8
10
  private currModules;
9
11
  constructor(source: string);
10
12
  load(modules: ModuleName[]): Promise<Window>;
11
13
  destroy(): Promise<void>;
12
14
  hide(): Promise<void>;
13
15
  show(atProgress?: number): Promise<void>;
16
+ setCSSProperties(properties: {
17
+ [key: string]: string;
18
+ }): void;
14
19
  get iframe(): HTMLIFrameElement;
15
20
  get realSize(): DOMRect;
16
21
  get window(): Window;
@@ -5,13 +5,20 @@ export declare class FramePoolManager {
5
5
  private readonly container;
6
6
  private readonly positions;
7
7
  private _currentFrame;
8
+ private currentCssProperties;
8
9
  private readonly pool;
9
10
  private readonly blobs;
10
11
  private readonly inprogress;
12
+ private pendingUpdates;
11
13
  private currentBaseURL;
12
- constructor(container: HTMLElement, positions: Locator[]);
14
+ constructor(container: HTMLElement, positions: Locator[], cssProperties?: {
15
+ [key: string]: string;
16
+ });
13
17
  destroy(): Promise<void>;
14
18
  update(pub: Publication, locator: Locator, modules: ModuleName[], force?: boolean): Promise<void>;
19
+ setCSSProperties(properties: {
20
+ [key: string]: string;
21
+ }): void;
15
22
  get currentFrames(): (FrameManager | undefined)[];
16
23
  get currentBounds(): DOMRect;
17
24
  }
@@ -25,7 +25,6 @@ export declare class FXLFramePoolManager {
25
25
  private readonly spreadPresentation;
26
26
  private orientationInternal;
27
27
  private containerHeightCached;
28
- private readonly resizeBoundHandler;
29
28
  private resizeTimeout;
30
29
  readonly peripherals: FXLPeripherals;
31
30
  constructor(container: HTMLElement, positions: Locator[], pub: Publication);
@@ -33,7 +32,6 @@ export declare class FXLFramePoolManager {
33
32
  set listener(listener: FrameCommsListener);
34
33
  get listener(): FrameCommsListener;
35
34
  get doNotDisturb(): boolean;
36
- private nativeResizeHandler;
37
35
  /**
38
36
  * When window resizes, resize slider components as well
39
37
  */
@@ -60,7 +58,7 @@ export declare class FXLFramePoolManager {
60
58
  get slength(): number;
61
59
  get shift(): boolean;
62
60
  private get nLandscape();
63
- setPerPage(perPage: number): void;
61
+ setPerPage(perPage: number | null): void;
64
62
  /**
65
63
  * Moves sliders frame to position of currently active slide
66
64
  */
@@ -1,3 +1,5 @@
1
1
  export * from "./EpubNavigator";
2
2
  export * from "./frame";
3
3
  export * from "./fxl";
4
+ export * from "./preferences";
5
+ export * from "./css";