@readium/navigator 1.3.4 → 2.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3974 -2928
- package/dist/index.umd.cjs +16 -16
- package/package.json +10 -9
- package/src/Navigator.ts +11 -0
- package/src/epub/EpubNavigator.ts +250 -24
- package/src/epub/css/Properties.ts +396 -0
- package/src/epub/css/ReadiumCSS.ts +339 -0
- package/src/epub/css/index.ts +2 -0
- package/src/epub/frame/FrameBlobBuilder.ts +59 -9
- package/src/epub/frame/FrameManager.ts +23 -1
- package/src/epub/frame/FramePoolManager.ts +62 -4
- package/src/epub/fxl/FXLFramePoolManager.ts +23 -16
- package/src/epub/index.ts +3 -1
- package/src/epub/preferences/EpubDefaults.ts +165 -0
- package/src/epub/preferences/EpubPreferences.ts +192 -0
- package/src/epub/preferences/EpubPreferencesEditor.ts +534 -0
- package/src/epub/preferences/EpubSettings.ts +239 -0
- package/src/epub/preferences/guards.ts +86 -0
- package/src/epub/preferences/index.ts +4 -0
- package/src/helpers/dimensions.ts +13 -0
- package/src/helpers/index.ts +1 -0
- package/src/helpers/lineLength.ts +241 -0
- package/src/helpers/sML.ts +25 -3
- package/src/index.ts +2 -1
- package/src/preferences/Configurable.ts +16 -0
- package/src/preferences/Preference.ts +272 -0
- package/src/preferences/PreferencesEditor.ts +6 -0
- package/src/preferences/Types.ts +38 -0
- package/src/preferences/index.ts +4 -0
- package/types/src/Navigator.d.ts +9 -0
- package/types/src/epub/EpubNavigator.d.ts +34 -4
- package/types/src/epub/css/Properties.d.ts +183 -0
- package/types/src/epub/css/ReadiumCSS.d.ts +31 -0
- package/types/src/epub/css/index.d.ts +2 -0
- package/types/src/epub/frame/FrameBlobBuilder.d.ts +5 -1
- package/types/src/epub/frame/FrameManager.d.ts +4 -0
- package/types/src/epub/frame/FramePoolManager.d.ts +8 -1
- package/types/src/epub/fxl/FXLFramePoolManager.d.ts +4 -4
- package/types/src/epub/index.d.ts +2 -0
- package/types/src/epub/preferences/EpubDefaults.d.ts +86 -0
- package/types/src/epub/preferences/EpubPreferences.d.ts +90 -0
- package/types/src/epub/preferences/EpubPreferencesEditor.d.ts +55 -0
- package/types/src/epub/preferences/EpubSettings.d.ts +89 -0
- package/types/src/epub/preferences/guards.d.ts +9 -0
- package/types/src/epub/preferences/index.d.ts +4 -0
- package/types/src/helpers/dimensions.d.ts +7 -0
- package/types/src/helpers/index.d.ts +1 -0
- package/types/src/helpers/lineLength.d.ts +54 -0
- package/types/src/helpers/sML.d.ts +6 -1
- package/types/src/index.d.ts +1 -0
- package/types/src/preferences/Configurable.d.ts +13 -0
- package/types/src/preferences/Preference.d.ts +117 -0
- package/types/src/preferences/PreferencesEditor.d.ts +5 -0
- package/types/src/preferences/PreferencesSerializer.d.ts +5 -0
- package/types/src/preferences/Types.d.ts +23 -0
- package/types/src/preferences/index.d.ts +4 -0
- package/LICENSE +0 -28
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { TextAlignment, Theme } from "../../preferences/Types";
|
|
2
|
+
|
|
3
|
+
export type BodyHyphens = "auto" | "none";
|
|
4
|
+
export type BoxSizing = "content-box" | "border-box";
|
|
5
|
+
export type FontOpticalSizing = "auto" | "none";
|
|
6
|
+
export type FontWidth = "ultra-condensed" | "extra-condensed" | "condensed" | "semi-condensed" | "normal" | "semi-expanded" | "expanded" | "extra-expanded" | "ultra-expanded" | number;
|
|
7
|
+
export type Ligatures = "common-ligatures" | "none";
|
|
8
|
+
export type TypeScale = 1 | 1.067 | 1.125 | 1.2 | 1.25 | 1.333 | 1.414 | 1.5 | 1.618;
|
|
9
|
+
export type View = "paged" | "scroll";
|
|
10
|
+
|
|
11
|
+
abstract class Properties {
|
|
12
|
+
constructor() {}
|
|
13
|
+
|
|
14
|
+
protected toFlag(name: string) {
|
|
15
|
+
return `readium-${ name }-on`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
protected toUnitless(value: number) {
|
|
19
|
+
return value.toString();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
protected toPercentage(value: number, ratio: boolean = false) {
|
|
23
|
+
if (ratio || value > 0 && value <= 1) {
|
|
24
|
+
return `${ Math.round(value * 100) }%`;
|
|
25
|
+
} else {
|
|
26
|
+
return `${ value }%`;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
protected toVw(value: number) {
|
|
31
|
+
const percentage = Math.round(value * 100);
|
|
32
|
+
return `${ Math.min(percentage, 100) }vw`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
protected toVh(value: number) {
|
|
36
|
+
const percentage = Math.round(value * 100);
|
|
37
|
+
return `${ Math.min(percentage, 100) }vh`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
protected toPx(value: number) {
|
|
41
|
+
return `${ value }px`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
protected toRem(value: number) {
|
|
45
|
+
return `${ value }rem`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
abstract toCSSProperties(): { [key: string]: string };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface IUserProperties {
|
|
52
|
+
advancedSettings?: boolean | null;
|
|
53
|
+
a11yNormalize?: boolean | null;
|
|
54
|
+
appearance?: Theme | null;
|
|
55
|
+
backgroundColor?: string | null;
|
|
56
|
+
blendFilter?: boolean | null;
|
|
57
|
+
bodyHyphens?: BodyHyphens | null;
|
|
58
|
+
colCount?: number | null;
|
|
59
|
+
darkenFilter?: boolean | number | null;
|
|
60
|
+
deprecatedFontSize?: boolean | null;
|
|
61
|
+
fontFamily?: string | null;
|
|
62
|
+
fontOpticalSizing?: FontOpticalSizing | null;
|
|
63
|
+
fontSize?: number | null;
|
|
64
|
+
fontSizeNormalize?: boolean | null;
|
|
65
|
+
fontWeight?: number | null;
|
|
66
|
+
fontWidth?: FontWidth | null;
|
|
67
|
+
invertFilter?: boolean | number | null;
|
|
68
|
+
invertGaijiFilter?: boolean | number | null;
|
|
69
|
+
iOSPatch?: boolean | null;
|
|
70
|
+
iPadOSPatch?: boolean | null;
|
|
71
|
+
letterSpacing?: number | null;
|
|
72
|
+
ligatures?: Ligatures | null;
|
|
73
|
+
lineHeight?: number | null;
|
|
74
|
+
lineLength?: number | null;
|
|
75
|
+
linkColor?: string | null;
|
|
76
|
+
noRuby?: boolean | null;
|
|
77
|
+
paraIndent?: number | null;
|
|
78
|
+
paraSpacing?: number | null;
|
|
79
|
+
selectionBackgroundColor?: string | null;
|
|
80
|
+
selectionTextColor?: string | null;
|
|
81
|
+
textAlign?: TextAlignment | null;
|
|
82
|
+
textColor?: string | null;
|
|
83
|
+
view?: View | null;
|
|
84
|
+
visitedColor?: string | null;
|
|
85
|
+
wordSpacing?: number | null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export class UserProperties extends Properties {
|
|
89
|
+
a11yNormalize: boolean | null;
|
|
90
|
+
appearance: Theme | null;
|
|
91
|
+
backgroundColor: string | null;
|
|
92
|
+
blendFilter: boolean | null;
|
|
93
|
+
bodyHyphens: BodyHyphens | null;
|
|
94
|
+
colCount: number | null | undefined;
|
|
95
|
+
darkenFilter: boolean | number | null;
|
|
96
|
+
deprecatedFontSize: boolean | null;
|
|
97
|
+
fontFamily: string | null;
|
|
98
|
+
fontOpticalSizing: FontOpticalSizing | null;
|
|
99
|
+
fontSize: number | null;
|
|
100
|
+
fontSizeNormalize: boolean | null;
|
|
101
|
+
fontWeight: number | null;
|
|
102
|
+
fontWidth: FontWidth | null;
|
|
103
|
+
invertFilter: boolean | number | null;
|
|
104
|
+
invertGaijiFilter: boolean | number | null;
|
|
105
|
+
iOSPatch: boolean | null;
|
|
106
|
+
iPadOSPatch: boolean | null;
|
|
107
|
+
letterSpacing: number | null;
|
|
108
|
+
ligatures: Ligatures | null;
|
|
109
|
+
lineHeight: number | null;
|
|
110
|
+
lineLength: number | null;
|
|
111
|
+
linkColor: string | null;
|
|
112
|
+
noRuby: boolean | null;
|
|
113
|
+
paraIndent: number | null;
|
|
114
|
+
paraSpacing: number | null;
|
|
115
|
+
selectionBackgroundColor?: string | null;
|
|
116
|
+
selectionTextColor?: string | null;
|
|
117
|
+
textAlign: TextAlignment | null;
|
|
118
|
+
textColor: string | null;
|
|
119
|
+
view: View | null;
|
|
120
|
+
visitedColor: string | null;
|
|
121
|
+
wordSpacing: number | null;
|
|
122
|
+
|
|
123
|
+
constructor(props: IUserProperties) {
|
|
124
|
+
super();
|
|
125
|
+
this.a11yNormalize = props.a11yNormalize ?? null;
|
|
126
|
+
this.appearance = props.appearance ?? null;
|
|
127
|
+
this.backgroundColor = props.backgroundColor ?? null;
|
|
128
|
+
this.blendFilter = props.blendFilter ?? null;
|
|
129
|
+
this.bodyHyphens = props.bodyHyphens ?? null;
|
|
130
|
+
this.colCount = props.colCount ?? null;
|
|
131
|
+
this.darkenFilter = props.darkenFilter ?? null;
|
|
132
|
+
this.deprecatedFontSize = props.deprecatedFontSize ?? null;
|
|
133
|
+
this.fontFamily = props.fontFamily ?? null;
|
|
134
|
+
this.fontOpticalSizing = props.fontOpticalSizing ?? null;
|
|
135
|
+
this.fontSize = props.fontSize ?? null;
|
|
136
|
+
this.fontSizeNormalize = props.fontSizeNormalize ?? null;
|
|
137
|
+
this.fontWeight = props.fontWeight ?? null;
|
|
138
|
+
this.fontWidth = props.fontWidth ?? null;
|
|
139
|
+
this.invertFilter = props.invertFilter ?? null;
|
|
140
|
+
this.invertGaijiFilter = props.invertGaijiFilter ?? null;
|
|
141
|
+
this.iOSPatch = props.iOSPatch ?? null;
|
|
142
|
+
this.iPadOSPatch = props.iPadOSPatch ?? null;
|
|
143
|
+
this.letterSpacing = props.letterSpacing ?? null;
|
|
144
|
+
this.ligatures = props.ligatures ?? null;
|
|
145
|
+
this.lineHeight = props.lineHeight ?? null;
|
|
146
|
+
this.lineLength = props.lineLength ?? null;
|
|
147
|
+
this.linkColor = props.linkColor ?? null;
|
|
148
|
+
this.noRuby = props.noRuby ?? null;
|
|
149
|
+
this.paraIndent = props.paraIndent ?? null;
|
|
150
|
+
this.paraSpacing = props.paraSpacing ?? null;
|
|
151
|
+
this.selectionBackgroundColor = props.selectionBackgroundColor ?? null;
|
|
152
|
+
this.selectionTextColor = props.selectionTextColor ?? null;
|
|
153
|
+
this.textAlign = props.textAlign ?? null;
|
|
154
|
+
this.textColor = props.textColor ?? null;
|
|
155
|
+
this.view = props.view ?? null;
|
|
156
|
+
this.visitedColor = props.visitedColor ?? null;
|
|
157
|
+
this.wordSpacing = props.wordSpacing ?? null;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
toCSSProperties() {
|
|
161
|
+
const cssProperties: { [key: string]: string } = {};
|
|
162
|
+
|
|
163
|
+
if (this.a11yNormalize) cssProperties["--USER__a11yNormalize"] = this.toFlag("a11y");
|
|
164
|
+
if (this.appearance) cssProperties["--USER__appearance"] = this.toFlag(this.appearance);
|
|
165
|
+
if (this.backgroundColor) cssProperties["--USER__backgroundColor"] = this.backgroundColor;
|
|
166
|
+
if (this.blendFilter) cssProperties["--USER__blendFilter"] = this.toFlag("blend");
|
|
167
|
+
if (this.bodyHyphens) cssProperties["--USER__bodyHyphens"] = this.bodyHyphens;
|
|
168
|
+
if (this.colCount) cssProperties["--USER__colCount"] = this.toUnitless(this.colCount);
|
|
169
|
+
if (this.darkenFilter === true) {
|
|
170
|
+
cssProperties["--USER__darkenFilter"] = this.toFlag("darken");
|
|
171
|
+
} else if (typeof this.darkenFilter === "number") {
|
|
172
|
+
cssProperties["--USER__darkenFilter"] = this.toPercentage(this.darkenFilter);
|
|
173
|
+
}
|
|
174
|
+
if (this.deprecatedFontSize) cssProperties["--USER__fontSizeImplementation"] = this.toFlag("deprecatedFontSize");
|
|
175
|
+
if (this.fontFamily) cssProperties["--USER__fontFamily"] = this.fontFamily;
|
|
176
|
+
if (this.fontOpticalSizing != null) cssProperties["--USER__fontOpticalSizing"] = this.fontOpticalSizing;
|
|
177
|
+
if (this.fontSize != null) cssProperties["--USER__fontSize"] = this.toPercentage(this.fontSize, true);
|
|
178
|
+
if (this.fontSizeNormalize) cssProperties["--USER__fontSizeNormalize"] = this.toFlag("normalize");
|
|
179
|
+
if (this.fontWeight != null) cssProperties["--USER__fontWeight"] = this.toUnitless(this.fontWeight);
|
|
180
|
+
if (this.fontWidth != null) {
|
|
181
|
+
cssProperties["--USER__fontWidth"] = typeof this.fontWidth === "string"
|
|
182
|
+
? this.fontWidth
|
|
183
|
+
: this.toUnitless(this.fontWidth);
|
|
184
|
+
}
|
|
185
|
+
if (this.invertFilter === true) {
|
|
186
|
+
cssProperties["--USER__invertFilter"] = this.toFlag("invert");
|
|
187
|
+
} else if (typeof this.invertFilter === "number") {
|
|
188
|
+
cssProperties["--USER__invertFilter"] = this.toPercentage(this.invertFilter);
|
|
189
|
+
}
|
|
190
|
+
if (this.invertGaijiFilter === true) {
|
|
191
|
+
cssProperties["--USER__invertGaiji"] = this.toFlag("invertGaiji");
|
|
192
|
+
} else if (typeof this.invertGaijiFilter === "number") {
|
|
193
|
+
cssProperties["--USER__invertGaiji"] = this.toPercentage(this.invertGaijiFilter);
|
|
194
|
+
}
|
|
195
|
+
if (this.iOSPatch) cssProperties["--USER__iOSPatch"] = this.toFlag("iOSPatch");
|
|
196
|
+
if (this.iPadOSPatch) cssProperties["--USER__iPadOSPatch"] = this.toFlag("iPadOSPatch");
|
|
197
|
+
if (this.letterSpacing != null) cssProperties["--USER__letterSpacing"] = this.toRem(this.letterSpacing);
|
|
198
|
+
if (this.ligatures) cssProperties["--USER__ligatures"] = this.ligatures;
|
|
199
|
+
if (this.lineHeight != null) cssProperties["--USER__lineHeight"] = this.toUnitless(this.lineHeight);
|
|
200
|
+
if (this.lineLength != null) cssProperties["--USER__lineLength"] = this.toPx(this.lineLength);
|
|
201
|
+
if (this.linkColor) cssProperties["--USER__linkColor"] = this.linkColor;
|
|
202
|
+
if (this.noRuby) cssProperties["--USER__noRuby"] = this.toFlag("noRuby");
|
|
203
|
+
if (this.paraIndent != null) cssProperties["--USER__paraIndent"] = this.toRem(this.paraIndent);
|
|
204
|
+
if (this.paraSpacing != null) cssProperties["--USER__paraSpacing"] = this.toRem(this.paraSpacing);
|
|
205
|
+
if (this.selectionBackgroundColor) cssProperties["--USER__selectionBackgroundColor"] = this.selectionBackgroundColor;
|
|
206
|
+
if (this.selectionTextColor) cssProperties["--USER__selectionTextColor"] = this.selectionTextColor;
|
|
207
|
+
if (this.textAlign) cssProperties["--USER__textAlign"] = this.textAlign;
|
|
208
|
+
if (this.textColor) cssProperties["--USER__textColor"] = this.textColor;
|
|
209
|
+
if (this.view) cssProperties["--USER__view"] = this.toFlag(this.view);
|
|
210
|
+
if (this.visitedColor) cssProperties["--USER__visitedColor"] = this.visitedColor;
|
|
211
|
+
if (this.wordSpacing != null) cssProperties["--USER__wordSpacing"] = this.toRem(this.wordSpacing);
|
|
212
|
+
|
|
213
|
+
return cssProperties;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface IRSProperties {
|
|
218
|
+
backgroundColor?: string | null;
|
|
219
|
+
baseFontFamily?: string | null;
|
|
220
|
+
baseFontSize?: number | null;
|
|
221
|
+
baseLineHeight?: number | null;
|
|
222
|
+
boxSizingMedia?: BoxSizing | null;
|
|
223
|
+
boxSizingTable?: BoxSizing | null;
|
|
224
|
+
colWidth?: string | null;
|
|
225
|
+
colCount?: number | null;
|
|
226
|
+
colGap?: number | null;
|
|
227
|
+
codeFontFamily?: string | null;
|
|
228
|
+
compFontFamily?: string | null;
|
|
229
|
+
defaultLineLength?: number | null;
|
|
230
|
+
flowSpacing?: number | null;
|
|
231
|
+
humanistTf?: string | null;
|
|
232
|
+
linkColor?: string | null;
|
|
233
|
+
maxMediaWidth?: number | null;
|
|
234
|
+
maxMediaHeight?: number | null;
|
|
235
|
+
modernTf?: string | null;
|
|
236
|
+
monospaceTf?: string | null;
|
|
237
|
+
noOverflow?: boolean | null;
|
|
238
|
+
noVerticalPagination?: boolean | null;
|
|
239
|
+
oldStyleTf?: string | null;
|
|
240
|
+
pageGutter?: number | null;
|
|
241
|
+
paraIndent?: number | null;
|
|
242
|
+
paraSpacing?: number | null;
|
|
243
|
+
primaryColor?: string | null;
|
|
244
|
+
sansSerifJa?: string | null;
|
|
245
|
+
sansSerifJaV?: string | null;
|
|
246
|
+
sansTf?: string | null;
|
|
247
|
+
scrollPaddingBottom?: number | null;
|
|
248
|
+
// scrollPaddingLeft?: number | null;
|
|
249
|
+
// scrollPaddingRight?: number | null;
|
|
250
|
+
scrollPaddingTop?: number | null;
|
|
251
|
+
secondaryColor?: string | null;
|
|
252
|
+
selectionBackgroundColor?: string | null;
|
|
253
|
+
selectionTextColor?: string | null;
|
|
254
|
+
serifJa?: string | null;
|
|
255
|
+
serifJaV?: string | null;
|
|
256
|
+
textColor?: string | null;
|
|
257
|
+
typeScale?: TypeScale | null;
|
|
258
|
+
visitedColor?: string | null;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export class RSProperties extends Properties {
|
|
262
|
+
backgroundColor: string | null;
|
|
263
|
+
baseFontFamily: string | null;
|
|
264
|
+
baseFontSize: number | null;
|
|
265
|
+
baseLineHeight: number | null;
|
|
266
|
+
boxSizingMedia: BoxSizing | null;
|
|
267
|
+
boxSizingTable: BoxSizing | null;
|
|
268
|
+
colWidth: string | null;
|
|
269
|
+
colCount: number | null;
|
|
270
|
+
colGap: number | null;
|
|
271
|
+
codeFontFamily: string | null;
|
|
272
|
+
compFontFamily: string | null;
|
|
273
|
+
defaultLineLength: number | null;
|
|
274
|
+
flowSpacing: number | null;
|
|
275
|
+
humanistTf: string | null;
|
|
276
|
+
linkColor: string | null;
|
|
277
|
+
maxMediaWidth: number | null;
|
|
278
|
+
maxMediaHeight: number | null;
|
|
279
|
+
modernTf: string | null;
|
|
280
|
+
monospaceTf: string | null;
|
|
281
|
+
noOverflow: boolean | null;
|
|
282
|
+
noVerticalPagination: boolean | null;
|
|
283
|
+
oldStyleTf: string | null;
|
|
284
|
+
pageGutter: number | null;
|
|
285
|
+
paraIndent: number | null;
|
|
286
|
+
paraSpacing: number | null;
|
|
287
|
+
primaryColor: string | null;
|
|
288
|
+
sansSerifJa: string | null;
|
|
289
|
+
sansSerifJaV: string | null;
|
|
290
|
+
sansTf: string | null;
|
|
291
|
+
scrollPaddingBottom: number | null;
|
|
292
|
+
// scrollPaddingLeft: number | null;
|
|
293
|
+
// scrollPaddingRight: number | null;
|
|
294
|
+
scrollPaddingTop: number | null;
|
|
295
|
+
secondaryColor: string | null;
|
|
296
|
+
selectionBackgroundColor: string | null;
|
|
297
|
+
selectionTextColor: string | null;
|
|
298
|
+
serifJa: string | null;
|
|
299
|
+
serifJaV: string | null;
|
|
300
|
+
textColor: string | null;
|
|
301
|
+
typeScale: TypeScale | null;
|
|
302
|
+
visitedColor: string | null;
|
|
303
|
+
|
|
304
|
+
constructor(props: IRSProperties) {
|
|
305
|
+
super();
|
|
306
|
+
this.backgroundColor = props.backgroundColor ?? null;
|
|
307
|
+
this.baseFontFamily = props.baseFontFamily ?? null;
|
|
308
|
+
this.baseFontSize = props.baseFontSize ?? null;
|
|
309
|
+
this.baseLineHeight = props.baseLineHeight ?? null;
|
|
310
|
+
this.boxSizingMedia = props.boxSizingMedia ?? null;
|
|
311
|
+
this.boxSizingTable = props.boxSizingTable ?? null;
|
|
312
|
+
this.colWidth = props.colWidth ?? null;
|
|
313
|
+
this.colCount = props.colCount ?? null;
|
|
314
|
+
this.colGap = props.colGap ?? null;
|
|
315
|
+
this.codeFontFamily = props.codeFontFamily ?? null;
|
|
316
|
+
this.compFontFamily = props.compFontFamily ?? null;
|
|
317
|
+
this.defaultLineLength = props.defaultLineLength ?? null;
|
|
318
|
+
this.flowSpacing = props.flowSpacing ?? null;
|
|
319
|
+
this.humanistTf = props.humanistTf ?? null;
|
|
320
|
+
this.linkColor = props.linkColor ?? null;
|
|
321
|
+
this.maxMediaWidth = props.maxMediaWidth ?? null;
|
|
322
|
+
this.maxMediaHeight = props.maxMediaHeight ?? null;
|
|
323
|
+
this.modernTf = props.modernTf ?? null;
|
|
324
|
+
this.monospaceTf = props.monospaceTf ?? null;
|
|
325
|
+
this.noOverflow = props.noOverflow ?? null;
|
|
326
|
+
this.noVerticalPagination = props.noVerticalPagination ?? null;
|
|
327
|
+
this.oldStyleTf = props.oldStyleTf ?? null;
|
|
328
|
+
this.pageGutter = props.pageGutter ?? null;
|
|
329
|
+
this.paraIndent = props.paraIndent ?? null;
|
|
330
|
+
this.paraSpacing = props.paraSpacing ?? null;
|
|
331
|
+
this.primaryColor = props.primaryColor ?? null;
|
|
332
|
+
this.scrollPaddingBottom = props.scrollPaddingBottom ?? null;
|
|
333
|
+
// this.scrollPaddingLeft = props.scrollPaddingLeft ?? null;
|
|
334
|
+
// this.scrollPaddingRight = props.scrollPaddingRight ?? null;
|
|
335
|
+
this.scrollPaddingTop = props.scrollPaddingTop ?? null;
|
|
336
|
+
this.sansSerifJa = props.sansSerifJa ?? null;
|
|
337
|
+
this.sansSerifJaV = props.sansSerifJaV ?? null;
|
|
338
|
+
this.sansTf = props.sansTf ?? null;
|
|
339
|
+
this.secondaryColor = props.secondaryColor ?? null;
|
|
340
|
+
this.selectionBackgroundColor = props.selectionBackgroundColor ?? null;
|
|
341
|
+
this.selectionTextColor = props.selectionTextColor ?? null;
|
|
342
|
+
this.serifJa = props.serifJa ?? null;
|
|
343
|
+
this.serifJaV = props.serifJaV ?? null;
|
|
344
|
+
this.textColor = props.textColor ?? null;
|
|
345
|
+
this.typeScale = props.typeScale ?? null;
|
|
346
|
+
this.visitedColor = props.visitedColor ?? null;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
toCSSProperties(): { [key: string]: string; } {
|
|
350
|
+
const cssProperties: { [key: string]: string } = {};
|
|
351
|
+
|
|
352
|
+
if (this.backgroundColor) cssProperties["--RS__backgroundColor"] = this.backgroundColor;
|
|
353
|
+
if (this.baseFontFamily) cssProperties["--RS__baseFontFamily"] = this.baseFontFamily;
|
|
354
|
+
if (this.baseFontSize != null) cssProperties["--RS__baseFontSize"] = this.toRem(this.baseFontSize);
|
|
355
|
+
if (this.baseLineHeight != null) cssProperties["--RS__baseLineHeight"] = this.toUnitless(this.baseLineHeight);
|
|
356
|
+
if (this.boxSizingMedia) cssProperties["--RS__boxSizingMedia"] = this.boxSizingMedia;
|
|
357
|
+
if (this.boxSizingTable) cssProperties["--RS__boxSizingTable"] = this.boxSizingTable;
|
|
358
|
+
if (this.colWidth != null) cssProperties["--RS__colWidth"] = this.colWidth;
|
|
359
|
+
if (this.colCount != null) cssProperties["--RS__colCount"] = this.toUnitless(this.colCount);
|
|
360
|
+
if (this.colGap != null) cssProperties["--RS__colGap"] = this.toPx(this.colGap);
|
|
361
|
+
if (this.codeFontFamily) cssProperties["--RS__codeFontFamily"] = this.codeFontFamily;
|
|
362
|
+
if (this.compFontFamily) cssProperties["--RS__compFontFamily"] = this.compFontFamily;
|
|
363
|
+
if (this.defaultLineLength != null) cssProperties["--RS__defaultLineLength"] = this.toPx(this.defaultLineLength);
|
|
364
|
+
if (this.flowSpacing != null) cssProperties["--RS__flowSpacing"] = this.toRem(this.flowSpacing);
|
|
365
|
+
if (this.humanistTf) cssProperties["--RS__humanistTf"] = this.humanistTf;
|
|
366
|
+
if (this.linkColor) cssProperties["--RS__linkColor"] = this.linkColor;
|
|
367
|
+
if (this.maxMediaWidth) cssProperties["--RS__maxMediaWidth"] = this.toVw(this.maxMediaWidth);
|
|
368
|
+
if (this.maxMediaHeight) cssProperties["--RS__maxMediaHeight"] = this.toVh(this.maxMediaHeight);
|
|
369
|
+
if (this.modernTf) cssProperties["--RS__modernTf"] = this.modernTf;
|
|
370
|
+
if (this.monospaceTf) cssProperties["--RS__monospaceTf"] = this.monospaceTf;
|
|
371
|
+
if (this.noOverflow) cssProperties["--RS__disableOverflow"] = this.toFlag("noOverflow");
|
|
372
|
+
if (this.noVerticalPagination) cssProperties["--RS__disablePagination"] = this.toFlag("noVerticalPagination");
|
|
373
|
+
if (this.oldStyleTf) cssProperties["--RS__oldStyleTf"] = this.oldStyleTf;
|
|
374
|
+
if (this.pageGutter != null) cssProperties["--RS__pageGutter"] = this.toPx(this.pageGutter);
|
|
375
|
+
if (this.paraIndent != null) cssProperties["--RS__paraIndent"] = this.toRem(this.paraIndent);
|
|
376
|
+
if (this.paraSpacing != null) cssProperties["--RS__paraSpacing"] = this.toRem(this.paraSpacing);
|
|
377
|
+
if (this.primaryColor) cssProperties["--RS__primaryColor"] = this.primaryColor;
|
|
378
|
+
if (this.sansSerifJa) cssProperties["--RS__sans-serif-ja"] = this.sansSerifJa;
|
|
379
|
+
if (this.sansSerifJaV) cssProperties["--RS__sans-serif-ja-v"] = this.sansSerifJaV;
|
|
380
|
+
if (this.sansTf) cssProperties["--RS__sansTf"] = this.sansTf;
|
|
381
|
+
if (this.scrollPaddingBottom != null) cssProperties["--RS__scrollPaddingBottom"] = this.toPx(this.scrollPaddingBottom);
|
|
382
|
+
// if (this.scrollPaddingLeft != null) cssProperties["--RS__scrollPaddingLeft"] = this.toPx(this.scrollPaddingLeft);
|
|
383
|
+
// if (this.scrollPaddingRight != null) cssProperties["--RS__scrollPaddingRight"] = this.toPx(this.scrollPaddingRight);
|
|
384
|
+
if (this.scrollPaddingTop != null) cssProperties["--RS__scrollPaddingTop"] = this.toPx(this.scrollPaddingTop);
|
|
385
|
+
if (this.secondaryColor) cssProperties["--RS__secondaryColor"] = this.secondaryColor;
|
|
386
|
+
if (this.selectionBackgroundColor) cssProperties["--RS__selectionBackgroundColor"] = this.selectionBackgroundColor;
|
|
387
|
+
if (this.selectionTextColor) cssProperties["--RS__selectionTextColor"] = this.selectionTextColor;
|
|
388
|
+
if (this.serifJa) cssProperties["--RS__serif-ja"] = this.serifJa;
|
|
389
|
+
if (this.serifJaV) cssProperties["--RS__serif-ja-v"] = this.serifJaV;
|
|
390
|
+
if (this.textColor) cssProperties["--RS__textColor"] = this.textColor;
|
|
391
|
+
if (this.typeScale) cssProperties["--RS__typeScale"] = this.toUnitless(this.typeScale);
|
|
392
|
+
if (this.visitedColor) cssProperties["--RS__visitedColor"] = this.visitedColor;
|
|
393
|
+
|
|
394
|
+
return cssProperties;
|
|
395
|
+
}
|
|
396
|
+
}
|