@caipira/vue-reader 0.0.2 → 0.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.
- package/README.md +38 -24
- package/dist/src/composables/useEpubReader.d.ts +5 -27786
- package/dist/src/composables/useEpubReader.js +218 -4
- package/dist/src/composables/useEpubReaderLogging.d.ts +5 -0
- package/dist/src/composables/useEpubReaderLogging.js +27 -0
- package/dist/src/composables/useEpubReaderNavigation.d.ts +3 -3
- package/dist/src/composables/useEpubReaderNavigation.js +8 -15
- package/dist/src/composables/useEpubReaderState.d.ts +27794 -20
- package/dist/src/composables/useEpubReaderState.js +31 -21
- package/dist/{composables → src/composables}/useEpubReaderStrategy.d.ts +1 -1
- package/dist/src/composables/useEpubReaderWasm.d.ts +2 -0
- package/dist/{composables → src/composables}/useEpubReaderWasm.js +5 -5
- package/dist/src/composables/useEpubReaderZipFetcher.d.ts +2 -0
- package/dist/{composables → src/composables}/useEpubReaderZipFetcher.js +5 -5
- package/dist/src/composables/useReaderColors.d.ts +10 -0
- package/dist/src/composables/useReaderColors.js +38 -0
- package/dist/src/composables/useReaderSettings.d.ts +24 -13
- package/dist/src/composables/useReaderSettings.js +97 -38
- package/dist/src/index.d.ts +6 -9
- package/dist/src/index.js +5 -8
- package/dist/{services → src/services}/browser/epub.d.ts +1 -1
- package/dist/{services → src/services}/browser/manifest.d.ts +1 -1
- package/dist/{services → src/services}/browser/manifest.js +1 -1
- package/dist/{services → src/services}/browser/url-rewrite.d.ts +1 -1
- package/dist/{services → src/services}/browser/url-rewrite.js +1 -1
- package/dist/{services → src/services}/browser/zip-fetcher.d.ts +1 -1
- package/dist/{services → src/services}/browser/zip-fetcher.js +2 -2
- package/dist/{services → src/services}/common/progression.d.ts +3 -11
- package/dist/{services → src/services}/common/progression.js +1 -32
- package/dist/src/{core → services/common}/storage.d.ts +1 -1
- package/dist/src/{core → services/common}/storage.js +1 -2
- package/dist/{services → src/services}/common/title.d.ts +1 -1
- package/dist/{services → src/services}/common/word-decorations.d.ts +1 -1
- package/dist/{services → src/services}/common/word-decorations.js +2 -2
- package/dist/{services → src/services}/common/word-lookup.js +1 -1
- package/dist/{types → src/types}/common.d.ts +36 -1
- package/package.json +1 -1
- package/dist/composables/useEpubReaderWasm.d.ts +0 -2
- package/dist/composables/useEpubReaderZipFetcher.d.ts +0 -2
- package/dist/src/composables/useEpubReaderController.d.ts +0 -27787
- package/dist/src/composables/useEpubReaderController.js +0 -23
- package/dist/src/composables/useEpubReaderSettings.d.ts +0 -15
- package/dist/src/composables/useEpubReaderSettings.js +0 -8
- package/dist/src/composables/utils.d.ts +0 -2
- package/dist/src/composables/utils.js +0 -1
- package/dist/src/core/controller.d.ts +0 -27789
- package/dist/src/core/controller.js +0 -262
- package/dist/src/core/settings-store.d.ts +0 -16
- package/dist/src/core/settings-store.js +0 -58
- package/dist/src/settings/options.d.ts +0 -20
- package/dist/src/settings/options.js +0 -27
- package/dist/src/types.d.ts +0 -40
- package/dist/src/types.js +0 -1
- /package/dist/{composables → src/composables}/useEpubReaderStrategy.js +0 -0
- /package/dist/{services → src/services}/browser/epub.js +0 -0
- /package/dist/{services → src/services}/browser/url.d.ts +0 -0
- /package/dist/{services → src/services}/browser/url.js +0 -0
- /package/dist/src/{core → services/common}/fonts.d.ts +0 -0
- /package/dist/src/{core → services/common}/fonts.js +0 -0
- /package/dist/{services → src/services}/common/title.js +0 -0
- /package/dist/{services → src/services}/common/word-lookup.d.ts +0 -0
- /package/dist/{services → src/services}/wasm/frame-document-bridge.d.ts +0 -0
- /package/dist/{services → src/services}/wasm/frame-document-bridge.js +0 -0
- /package/dist/{services → src/services}/wasm/wasm-streamer.d.ts +0 -0
- /package/dist/{services → src/services}/wasm/wasm-streamer.js +0 -0
- /package/dist/{types → src/types}/browser.d.ts +0 -0
- /package/dist/{types → src/types}/browser.js +0 -0
- /package/dist/{types → src/types}/common.js +0 -0
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import { ref, computed, toRaw } from 'vue';
|
|
2
|
-
import { Publication as RPublication } from '@readium/shared';
|
|
3
|
-
import { EpubDefaults, EpubNavigator, EpubPreferences } from '@readium/navigator';
|
|
4
|
-
import { getCurrentTitle } from '../../services/common/title';
|
|
5
|
-
import { useEpubReaderWasm } from '../../composables/useEpubReaderWasm';
|
|
6
|
-
import { generatePositions } from '../../services/common/progression';
|
|
7
|
-
import { hasReaderDictionary } from '../../src/composables/useReaderDictionary';
|
|
8
|
-
import { onReaderColorsChange } from '../../src/composables/useReaderSettings';
|
|
9
|
-
import { setWasmStreamerConfig } from '../../services/wasm/wasm-streamer';
|
|
10
|
-
import { useEpubReaderZipFetcher } from '../../composables/useEpubReaderZipFetcher';
|
|
11
|
-
import { createReaderSettingsStore } from '../../src/core/settings-store';
|
|
12
|
-
import { createSessionStorageAdapter } from '../../src/core/storage';
|
|
13
|
-
import { injectCurrentFontIntoIframe } from '../../src/core/fonts';
|
|
14
|
-
import { createReadiumWordLookupController } from '../../services/common/word-lookup';
|
|
15
|
-
import { createReadiumWordDecorationsController } from '../../services/common/word-decorations';
|
|
16
|
-
const ENABLE_EDGE_TAP_PAGE_TURN = false;
|
|
17
|
-
export const createEpubReaderController = (src, containerRef, options) => {
|
|
18
|
-
const error = ref(null);
|
|
19
|
-
const loading = ref(false);
|
|
20
|
-
const tocLinks = ref([]);
|
|
21
|
-
const navigator = ref(null);
|
|
22
|
-
const publication = ref(null);
|
|
23
|
-
const currentPosition = ref(0);
|
|
24
|
-
const totalPositions = ref(0);
|
|
25
|
-
const currentChapterTitle = ref('');
|
|
26
|
-
const progressPercent = computed(() => Math.min(100, Math.max(0, currentPosition.value)));
|
|
27
|
-
const storage = options?.storage ?? createSessionStorageAdapter();
|
|
28
|
-
const settingsStore = createReaderSettingsStore(options?.settings, options?.preferences);
|
|
29
|
-
const settings = settingsStore.settings;
|
|
30
|
-
const fontBaseUrl = options?.assets?.fontBaseUrl ?? '/fonts';
|
|
31
|
-
let stopSettingsWatcher = null;
|
|
32
|
-
let activeChapterHref = '';
|
|
33
|
-
let chapterProgressions = new Map();
|
|
34
|
-
let activeSource = null;
|
|
35
|
-
let strategyFrameLoaded = null;
|
|
36
|
-
let stopReaderColorsWatcher = onReaderColorsChange((colors) => {
|
|
37
|
-
settings.backgroundColor = colors.background;
|
|
38
|
-
settings.textColor = colors.text;
|
|
39
|
-
});
|
|
40
|
-
let getProgress = (_idx, rawProg) => ({
|
|
41
|
-
progress: rawProg ?? 0,
|
|
42
|
-
resourceProgression: rawProg ?? 0,
|
|
43
|
-
});
|
|
44
|
-
const wordDecorations = hasReaderDictionary()
|
|
45
|
-
? createReadiumWordDecorationsController(navigator, () => publication.value?.metadata?.languages?.[0])
|
|
46
|
-
: null;
|
|
47
|
-
const wordLookup = hasReaderDictionary()
|
|
48
|
-
? createReadiumWordLookupController(() => publication.value?.metadata?.languages?.[0])
|
|
49
|
-
: null;
|
|
50
|
-
const applyPreferences = async () => {
|
|
51
|
-
if (!navigator.value)
|
|
52
|
-
return;
|
|
53
|
-
await toRaw(navigator.value).submitPreferences(new EpubPreferences({
|
|
54
|
-
backgroundColor: settings.backgroundColor,
|
|
55
|
-
columnCount: settings.columnCount,
|
|
56
|
-
fontFamily: settings.fontFamily,
|
|
57
|
-
fontSize: settings.fontSize,
|
|
58
|
-
lineHeight: settings.lineHeight,
|
|
59
|
-
scroll: settings.scroll,
|
|
60
|
-
textAlign: settings.textAlign,
|
|
61
|
-
textColor: settings.textColor,
|
|
62
|
-
}));
|
|
63
|
-
await injectCurrentFontIntoIframe(containerRef.value, settings.fontFamily, fontBaseUrl);
|
|
64
|
-
};
|
|
65
|
-
const destroyNavigator = () => {
|
|
66
|
-
toRaw(navigator.value)?.destroy();
|
|
67
|
-
navigator.value = null;
|
|
68
|
-
};
|
|
69
|
-
const destroy = () => {
|
|
70
|
-
destroyNavigator();
|
|
71
|
-
publication.value = null;
|
|
72
|
-
tocLinks.value = [];
|
|
73
|
-
currentPosition.value = 0;
|
|
74
|
-
totalPositions.value = 0;
|
|
75
|
-
currentChapterTitle.value = '';
|
|
76
|
-
strategyFrameLoaded = null;
|
|
77
|
-
chapterProgressions = new Map();
|
|
78
|
-
activeChapterHref = '';
|
|
79
|
-
activeSource?.destroy();
|
|
80
|
-
activeSource = null;
|
|
81
|
-
wordDecorations?.destroy();
|
|
82
|
-
wordLookup?.destroy();
|
|
83
|
-
stopSettingsWatcher?.();
|
|
84
|
-
stopSettingsWatcher = null;
|
|
85
|
-
stopReaderColorsWatcher?.();
|
|
86
|
-
stopReaderColorsWatcher = null;
|
|
87
|
-
};
|
|
88
|
-
const selectStrategy = () => {
|
|
89
|
-
const strategy = options?.strategy ?? 'zip-fetcher';
|
|
90
|
-
if (strategy === 'wasm') {
|
|
91
|
-
setWasmStreamerConfig({
|
|
92
|
-
swUrl: options?.assets?.swUrl,
|
|
93
|
-
swScope: options?.assets?.swScope,
|
|
94
|
-
wasmUrl: options?.assets?.wasmUrl,
|
|
95
|
-
});
|
|
96
|
-
return useEpubReaderWasm();
|
|
97
|
-
}
|
|
98
|
-
return useEpubReaderZipFetcher();
|
|
99
|
-
};
|
|
100
|
-
const init = async () => {
|
|
101
|
-
if (!containerRef.value)
|
|
102
|
-
return;
|
|
103
|
-
await settingsStore.hydrate();
|
|
104
|
-
loading.value = true;
|
|
105
|
-
error.value = null;
|
|
106
|
-
try {
|
|
107
|
-
const url = src.value;
|
|
108
|
-
const strategySource = selectStrategy();
|
|
109
|
-
const source = await strategySource.load(url);
|
|
110
|
-
activeSource = strategySource;
|
|
111
|
-
let pub;
|
|
112
|
-
let positions = [];
|
|
113
|
-
if (source.publication) {
|
|
114
|
-
pub = source.publication;
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
pub = new RPublication({
|
|
118
|
-
manifest: source.manifest,
|
|
119
|
-
fetcher: source.fetcher,
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
getProgress = source.createProgressCalculator(pub);
|
|
123
|
-
chapterProgressions = source.chapterProgressions;
|
|
124
|
-
strategyFrameLoaded = source.onFrameLoaded ?? null;
|
|
125
|
-
positions = source.createPositions
|
|
126
|
-
? (await source.createPositions(pub))
|
|
127
|
-
: generatePositions(pub);
|
|
128
|
-
publication.value = pub;
|
|
129
|
-
if (pub.toc) {
|
|
130
|
-
tocLinks.value = pub.toc.items.map((link) => ({
|
|
131
|
-
title: link.title || link.href,
|
|
132
|
-
link,
|
|
133
|
-
}));
|
|
134
|
-
}
|
|
135
|
-
if (positions.length === 0) {
|
|
136
|
-
positions = generatePositions(pub);
|
|
137
|
-
}
|
|
138
|
-
totalPositions.value = positions.length;
|
|
139
|
-
const initialLocator = storage.restorePosition(url, pub) ?? positions[0];
|
|
140
|
-
const listeners = {
|
|
141
|
-
positionChanged: (locator) => {
|
|
142
|
-
if (!locator) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
activeChapterHref = locator.href.split('#')[0] ?? locator.href;
|
|
146
|
-
wordDecorations?.onPositionChanged(activeChapterHref);
|
|
147
|
-
const idx = publication.value
|
|
148
|
-
? publication.value.readingOrder.findIndexWithHref(locator.href)
|
|
149
|
-
: -1;
|
|
150
|
-
if (idx < 0) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
const { progress, resourceProgression } = getProgress(idx, locator.locations?.progression);
|
|
154
|
-
currentPosition.value = Math.round(Math.min(1, Math.max(0, progress)) * 100);
|
|
155
|
-
currentChapterTitle.value = getCurrentTitle(locator, chapterProgressions, tocLinks.value);
|
|
156
|
-
const persisted = locator.copyWithLocations({
|
|
157
|
-
position: idx + 1,
|
|
158
|
-
progression: resourceProgression,
|
|
159
|
-
});
|
|
160
|
-
storage.savePosition(url, persisted);
|
|
161
|
-
},
|
|
162
|
-
frameLoaded: async (wnd) => {
|
|
163
|
-
const nav = toRaw(navigator.value);
|
|
164
|
-
const currentHref = nav?.currentLocator?.href ?? activeChapterHref;
|
|
165
|
-
const chapterHref = (currentHref ?? '').split('#')[0] ?? '';
|
|
166
|
-
if (chapterHref) {
|
|
167
|
-
wordDecorations?.onFrameLoaded(wnd, chapterHref);
|
|
168
|
-
wordLookup?.onFrameLoaded(wnd);
|
|
169
|
-
}
|
|
170
|
-
if (chapterHref && strategyFrameLoaded) {
|
|
171
|
-
strategyFrameLoaded(wnd, chapterHref);
|
|
172
|
-
}
|
|
173
|
-
await injectCurrentFontIntoIframe(containerRef.value, settings.fontFamily, fontBaseUrl);
|
|
174
|
-
},
|
|
175
|
-
tap: () => !ENABLE_EDGE_TAP_PAGE_TURN,
|
|
176
|
-
click: () => !ENABLE_EDGE_TAP_PAGE_TURN,
|
|
177
|
-
zoom: () => { },
|
|
178
|
-
miscPointer: () => { },
|
|
179
|
-
scroll: () => { },
|
|
180
|
-
customEvent: () => { },
|
|
181
|
-
handleLocator: () => true,
|
|
182
|
-
textSelected: () => { },
|
|
183
|
-
contentProtection: () => { },
|
|
184
|
-
contextMenu: () => { },
|
|
185
|
-
peripheral: () => { },
|
|
186
|
-
};
|
|
187
|
-
navigator.value = new EpubNavigator(containerRef.value, pub, listeners, positions, initialLocator, {
|
|
188
|
-
preferences: new EpubPreferences(settings),
|
|
189
|
-
defaults: new EpubDefaults({}),
|
|
190
|
-
injectables: {
|
|
191
|
-
rules: [],
|
|
192
|
-
allowedDomains: [window.location.origin],
|
|
193
|
-
},
|
|
194
|
-
});
|
|
195
|
-
await toRaw(navigator.value).load();
|
|
196
|
-
await toRaw(navigator.value).submitPreferences(new EpubPreferences(settings));
|
|
197
|
-
stopSettingsWatcher = settingsStore.onSettingsChange(applyPreferences);
|
|
198
|
-
loading.value = false;
|
|
199
|
-
}
|
|
200
|
-
catch (e) {
|
|
201
|
-
error.value = e instanceof Error ? e.message : 'Unknown error loading EPUB';
|
|
202
|
-
loading.value = false;
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
const reload = async () => {
|
|
206
|
-
destroy();
|
|
207
|
-
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
208
|
-
await init();
|
|
209
|
-
};
|
|
210
|
-
const goForward = () => {
|
|
211
|
-
toRaw(navigator.value)?.goForward(false, () => { });
|
|
212
|
-
};
|
|
213
|
-
const goBackward = () => {
|
|
214
|
-
toRaw(navigator.value)?.goBackward(false, () => { });
|
|
215
|
-
};
|
|
216
|
-
const goToLink = (link) => {
|
|
217
|
-
toRaw(navigator.value)?.goLink(link, false, () => { });
|
|
218
|
-
};
|
|
219
|
-
const toggleFullscreen = () => {
|
|
220
|
-
const el = containerRef.value?.parentElement;
|
|
221
|
-
if (!el) {
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
if (!document.fullscreenElement) {
|
|
225
|
-
el.requestFullscreen()
|
|
226
|
-
.then(() => {
|
|
227
|
-
settings.isFullscreen = true;
|
|
228
|
-
})
|
|
229
|
-
.catch(() => { });
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
document
|
|
233
|
-
.exitFullscreen()
|
|
234
|
-
.then(() => {
|
|
235
|
-
settings.isFullscreen = false;
|
|
236
|
-
})
|
|
237
|
-
.catch(() => { });
|
|
238
|
-
};
|
|
239
|
-
return {
|
|
240
|
-
state: {
|
|
241
|
-
error,
|
|
242
|
-
loading,
|
|
243
|
-
tocLinks,
|
|
244
|
-
navigator,
|
|
245
|
-
publication,
|
|
246
|
-
currentPosition,
|
|
247
|
-
totalPositions,
|
|
248
|
-
progressPercent,
|
|
249
|
-
currentChapterTitle,
|
|
250
|
-
settings,
|
|
251
|
-
},
|
|
252
|
-
actions: {
|
|
253
|
-
init,
|
|
254
|
-
destroy,
|
|
255
|
-
reload,
|
|
256
|
-
goForward,
|
|
257
|
-
goBackward,
|
|
258
|
-
goToLink,
|
|
259
|
-
toggleFullscreen,
|
|
260
|
-
},
|
|
261
|
-
};
|
|
262
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ReaderPreferencesAdapter, ReaderSettings } from '../../src/types';
|
|
2
|
-
export declare const createReaderSettingsStore: (initialSettings?: Partial<ReaderSettings>, preferences?: ReaderPreferencesAdapter) => {
|
|
3
|
-
settings: {
|
|
4
|
-
backgroundColor: string | null;
|
|
5
|
-
columnCount: number | null;
|
|
6
|
-
fontFamily: string | null;
|
|
7
|
-
fontSize: number | null;
|
|
8
|
-
isFullscreen: boolean;
|
|
9
|
-
lineHeight: number | null;
|
|
10
|
-
scroll: boolean | null;
|
|
11
|
-
textAlign: import("@readium/navigator").TextAlignment | null;
|
|
12
|
-
textColor: string | null;
|
|
13
|
-
};
|
|
14
|
-
hydrate: () => Promise<void>;
|
|
15
|
-
onSettingsChange: (handler: (settings: Readonly<ReaderSettings>) => void) => () => boolean;
|
|
16
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { reactive, watch } from 'vue';
|
|
2
|
-
import { getReaderColors } from '../../src/composables/useReaderSettings';
|
|
3
|
-
const defaultSettings = () => ({
|
|
4
|
-
...(() => {
|
|
5
|
-
const colors = getReaderColors();
|
|
6
|
-
return {
|
|
7
|
-
backgroundColor: colors.background,
|
|
8
|
-
textColor: colors.text,
|
|
9
|
-
};
|
|
10
|
-
})(),
|
|
11
|
-
fontFamily: 'DEFAULT',
|
|
12
|
-
fontSize: 1,
|
|
13
|
-
lineHeight: null,
|
|
14
|
-
textAlign: null,
|
|
15
|
-
columnCount: null,
|
|
16
|
-
scroll: null,
|
|
17
|
-
isFullscreen: false,
|
|
18
|
-
});
|
|
19
|
-
export const createReaderSettingsStore = (initialSettings, preferences) => {
|
|
20
|
-
const settings = reactive({
|
|
21
|
-
...defaultSettings(),
|
|
22
|
-
...(initialSettings ?? {}),
|
|
23
|
-
});
|
|
24
|
-
const listeners = new Set();
|
|
25
|
-
let hydrated = false;
|
|
26
|
-
const hydrate = async () => {
|
|
27
|
-
if (hydrated || !preferences?.load) {
|
|
28
|
-
hydrated = true;
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const loaded = await preferences.load();
|
|
32
|
-
Object.assign(settings, loaded ?? {});
|
|
33
|
-
hydrated = true;
|
|
34
|
-
};
|
|
35
|
-
const onSettingsChange = (handler) => {
|
|
36
|
-
listeners.add(handler);
|
|
37
|
-
return () => listeners.delete(handler);
|
|
38
|
-
};
|
|
39
|
-
watch(() => [
|
|
40
|
-
settings.fontFamily,
|
|
41
|
-
settings.fontSize,
|
|
42
|
-
settings.lineHeight,
|
|
43
|
-
settings.textAlign,
|
|
44
|
-
settings.columnCount,
|
|
45
|
-
settings.scroll,
|
|
46
|
-
settings.backgroundColor,
|
|
47
|
-
settings.textColor,
|
|
48
|
-
settings.isFullscreen,
|
|
49
|
-
], () => {
|
|
50
|
-
listeners.forEach((handler) => handler(settings));
|
|
51
|
-
void preferences?.save?.(settings);
|
|
52
|
-
});
|
|
53
|
-
return {
|
|
54
|
-
settings,
|
|
55
|
-
hydrate,
|
|
56
|
-
onSettingsChange,
|
|
57
|
-
};
|
|
58
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { TextAlignment } from '@readium/navigator';
|
|
2
|
-
export declare const EPUB_FONT_SIZE_OPTIONS: {
|
|
3
|
-
value: number;
|
|
4
|
-
label: string;
|
|
5
|
-
}[];
|
|
6
|
-
export declare const PX_FONT_SIZE_OPTIONS: {
|
|
7
|
-
value: number;
|
|
8
|
-
label: string;
|
|
9
|
-
}[];
|
|
10
|
-
export declare const COLUMN_OPTIONS: {
|
|
11
|
-
value: number;
|
|
12
|
-
label: string;
|
|
13
|
-
}[];
|
|
14
|
-
export declare const ALIGN_OPTIONS: ({
|
|
15
|
-
key: null;
|
|
16
|
-
label: string;
|
|
17
|
-
} | {
|
|
18
|
-
key: TextAlignment;
|
|
19
|
-
label: string;
|
|
20
|
-
})[];
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { TextAlignment } from '@readium/navigator';
|
|
2
|
-
export const EPUB_FONT_SIZE_OPTIONS = [
|
|
3
|
-
{ value: 0.8, label: '80%' },
|
|
4
|
-
{ value: 1, label: '100% (Default)' },
|
|
5
|
-
{ value: 1.2, label: '120%' },
|
|
6
|
-
{ value: 1.4, label: '140%' },
|
|
7
|
-
{ value: 1.6, label: '160%' },
|
|
8
|
-
];
|
|
9
|
-
export const PX_FONT_SIZE_OPTIONS = [
|
|
10
|
-
{ value: 16, label: '16 (Default)' },
|
|
11
|
-
{ value: 20, label: '20' },
|
|
12
|
-
{ value: 24, label: '24' },
|
|
13
|
-
{ value: 28, label: '28' },
|
|
14
|
-
{ value: 32, label: '32' },
|
|
15
|
-
];
|
|
16
|
-
export const COLUMN_OPTIONS = [
|
|
17
|
-
{ value: 0, label: 'Auto' },
|
|
18
|
-
{ value: 1, label: '1' },
|
|
19
|
-
{ value: 2, label: '2' },
|
|
20
|
-
];
|
|
21
|
-
export const ALIGN_OPTIONS = [
|
|
22
|
-
{ key: null, label: 'Auto' },
|
|
23
|
-
{ key: TextAlignment.start, label: 'Start' },
|
|
24
|
-
{ key: TextAlignment.left, label: 'Left' },
|
|
25
|
-
{ key: TextAlignment.right, label: 'Right' },
|
|
26
|
-
{ key: TextAlignment.justify, label: 'Justify' },
|
|
27
|
-
];
|
package/dist/src/types.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { Link, Locator, Publication } from '@readium/shared';
|
|
2
|
-
import type { TextAlignment } from '@readium/navigator';
|
|
3
|
-
export type EpubReaderStrategy = 'wasm' | 'zip-fetcher';
|
|
4
|
-
export type TocEntry = {
|
|
5
|
-
title: string;
|
|
6
|
-
link: Link;
|
|
7
|
-
};
|
|
8
|
-
export type ReaderSettings = {
|
|
9
|
-
backgroundColor: string | null;
|
|
10
|
-
columnCount: number | null;
|
|
11
|
-
fontFamily: string | null;
|
|
12
|
-
fontSize: number | null;
|
|
13
|
-
isFullscreen: boolean;
|
|
14
|
-
lineHeight: number | null;
|
|
15
|
-
scroll: boolean | null;
|
|
16
|
-
textAlign: TextAlignment | null;
|
|
17
|
-
textColor: string | null;
|
|
18
|
-
};
|
|
19
|
-
export type ReaderStorageAdapter = {
|
|
20
|
-
savePosition: (key: string, locator: Locator) => void;
|
|
21
|
-
restorePosition: (key: string, publication: Publication) => Locator | undefined;
|
|
22
|
-
};
|
|
23
|
-
export type ReaderPreferencesAdapter = {
|
|
24
|
-
load: () => Partial<ReaderSettings> | Promise<Partial<ReaderSettings>>;
|
|
25
|
-
save?: (settings: Readonly<ReaderSettings>) => void | Promise<void>;
|
|
26
|
-
};
|
|
27
|
-
export type ReaderAssetConfig = {
|
|
28
|
-
swUrl?: string;
|
|
29
|
-
swScope?: string;
|
|
30
|
-
wasmUrl?: string;
|
|
31
|
-
fontBaseUrl?: string;
|
|
32
|
-
};
|
|
33
|
-
export type EpubReaderControllerOptions = {
|
|
34
|
-
strategy?: EpubReaderStrategy;
|
|
35
|
-
settings?: Partial<ReaderSettings>;
|
|
36
|
-
storage?: ReaderStorageAdapter;
|
|
37
|
-
preferences?: ReaderPreferencesAdapter;
|
|
38
|
-
assets?: ReaderAssetConfig;
|
|
39
|
-
logNamespace?: string;
|
|
40
|
-
};
|
package/dist/src/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|