@prose-reader/core 1.164.0 → 1.166.0
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/enhancers/navigation/report.d.ts +1 -1
- package/dist/enhancers/theme.d.ts +9 -11
- package/dist/enhancers/types/enhancer.d.ts +1 -3
- package/dist/hooks/types.d.ts +1 -1
- package/dist/index.js +188 -205
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +188 -205
- package/dist/index.umd.cjs.map +1 -1
- package/dist/report.d.ts +2 -2
- package/dist/spine/locator/SpineLocator.d.ts +1 -1
- package/package.json +6 -5
package/dist/index.umd.cjs
CHANGED
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
return new Promise((resolve) => {
|
|
168
168
|
reader.addEventListener(
|
|
169
169
|
`load`,
|
|
170
|
-
|
|
170
|
+
() => {
|
|
171
171
|
resolve(reader.result);
|
|
172
172
|
},
|
|
173
173
|
false
|
|
@@ -196,13 +196,14 @@
|
|
|
196
196
|
}
|
|
197
197
|
};
|
|
198
198
|
const getAttributeValueFromString = (string, key) => {
|
|
199
|
-
const regExp = new RegExp(key
|
|
199
|
+
const regExp = new RegExp(`${key}\\s*=\\s*([0-9.]+)`, `i`);
|
|
200
200
|
const match = string.match(regExp) || [];
|
|
201
201
|
const firstMatch = match[1] || `0`;
|
|
202
|
-
return match && parseFloat(firstMatch) || 0;
|
|
202
|
+
return match && Number.parseFloat(firstMatch) || 0;
|
|
203
203
|
};
|
|
204
204
|
const injectCSS = (frameElement, id, style, prepend) => {
|
|
205
|
-
|
|
205
|
+
var _a;
|
|
206
|
+
if ((_a = frameElement == null ? void 0 : frameElement.contentDocument) == null ? void 0 : _a.head) {
|
|
206
207
|
const userStyle = frameElement.contentDocument.createElement(`style`);
|
|
207
208
|
userStyle.id = id;
|
|
208
209
|
userStyle.innerHTML = style;
|
|
@@ -214,7 +215,8 @@
|
|
|
214
215
|
}
|
|
215
216
|
};
|
|
216
217
|
const removeCSS = (frameElement, id) => {
|
|
217
|
-
|
|
218
|
+
var _a;
|
|
219
|
+
if ((_a = frameElement == null ? void 0 : frameElement.contentDocument) == null ? void 0 : _a.head) {
|
|
218
220
|
const styleElement = frameElement.contentDocument.getElementById(id);
|
|
219
221
|
if (styleElement) {
|
|
220
222
|
styleElement.remove();
|
|
@@ -227,7 +229,7 @@
|
|
|
227
229
|
injectCSS(frameElement, id, style, prepend);
|
|
228
230
|
};
|
|
229
231
|
const getFrameViewportInfo = (frame) => {
|
|
230
|
-
if (frame
|
|
232
|
+
if (frame == null ? void 0 : frame.contentDocument) {
|
|
231
233
|
const doc = frame.contentDocument;
|
|
232
234
|
const viewportMetaElement = doc.querySelector(`meta[name='viewport']`);
|
|
233
235
|
if (viewportMetaElement) {
|
|
@@ -241,9 +243,8 @@
|
|
|
241
243
|
width,
|
|
242
244
|
height
|
|
243
245
|
};
|
|
244
|
-
} else {
|
|
245
|
-
return { hasViewport: true };
|
|
246
246
|
}
|
|
247
|
+
return { hasViewport: true };
|
|
247
248
|
}
|
|
248
249
|
}
|
|
249
250
|
}
|
|
@@ -427,9 +428,9 @@
|
|
|
427
428
|
);
|
|
428
429
|
})
|
|
429
430
|
);
|
|
430
|
-
const resetLockViewportFree$ = createResetLock$(
|
|
431
|
-
|
|
432
|
-
)
|
|
431
|
+
const resetLockViewportFree$ = createResetLock$(reader.viewportFree$).pipe(
|
|
432
|
+
operators.take(1)
|
|
433
|
+
);
|
|
433
434
|
const pageTurnMode$ = reader.settings.values$.pipe(
|
|
434
435
|
operators.map(() => reader.settings.values.computedPageTurnMode),
|
|
435
436
|
operators.distinctUntilChanged()
|
|
@@ -478,13 +479,9 @@
|
|
|
478
479
|
}
|
|
479
480
|
getCleanedParentInputSettings(settings) {
|
|
480
481
|
const {
|
|
481
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
482
482
|
layoutAutoResize,
|
|
483
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
484
483
|
pageHorizontalMargin,
|
|
485
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
486
484
|
pageVerticalMargin,
|
|
487
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
488
485
|
layoutLayerTransition,
|
|
489
486
|
...rest
|
|
490
487
|
} = settings;
|
|
@@ -668,7 +665,7 @@
|
|
|
668
665
|
};
|
|
669
666
|
};
|
|
670
667
|
const createReport = (namespace) => ({
|
|
671
|
-
//
|
|
668
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
672
669
|
log: (...data) => {
|
|
673
670
|
var _a;
|
|
674
671
|
if ((_a = getWindow()) == null ? void 0 : _a.__PROSE_READER_DEBUG) {
|
|
@@ -676,7 +673,7 @@
|
|
|
676
673
|
else console.log(wrap(ROOT_NAMESPACE), ...data);
|
|
677
674
|
}
|
|
678
675
|
},
|
|
679
|
-
//
|
|
676
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
680
677
|
warn: (...data) => {
|
|
681
678
|
var _a;
|
|
682
679
|
if ((_a = getWindow()) == null ? void 0 : _a.__PROSE_READER_DEBUG) {
|
|
@@ -685,6 +682,7 @@
|
|
|
685
682
|
else console.warn(wrap(ROOT_NAMESPACE), ...data);
|
|
686
683
|
}
|
|
687
684
|
},
|
|
685
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
688
686
|
info: (...data) => {
|
|
689
687
|
var _a;
|
|
690
688
|
if ((_a = getWindow()) == null ? void 0 : _a.__PROSE_READER_DEBUG) {
|
|
@@ -703,7 +701,7 @@
|
|
|
703
701
|
console,
|
|
704
702
|
wrap(`${ROOT_NAMESPACE}`)
|
|
705
703
|
),
|
|
706
|
-
//
|
|
704
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
707
705
|
error: (...data) => {
|
|
708
706
|
console.error(...data);
|
|
709
707
|
},
|
|
@@ -720,14 +718,14 @@
|
|
|
720
718
|
}
|
|
721
719
|
}
|
|
722
720
|
},
|
|
723
|
-
//
|
|
724
|
-
measurePerformance: (name, targetDuration
|
|
721
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
722
|
+
measurePerformance: (name, targetDuration, functionToMeasure, { disable } = {}) => {
|
|
725
723
|
var _a;
|
|
726
724
|
if (disable || !((_a = getWindow()) == null ? void 0 : _a.__PROSE_READER_DEBUG)) return functionToMeasure;
|
|
727
725
|
return (...args) => {
|
|
728
726
|
const t0 = performance.now();
|
|
729
727
|
const response = functionToMeasure(...args);
|
|
730
|
-
if (response
|
|
728
|
+
if (response == null ? void 0 : response.then) {
|
|
731
729
|
return response.then((res) => {
|
|
732
730
|
const t12 = performance.now();
|
|
733
731
|
Report.logMetric({ name, duration: t12 - t0 }, targetDuration);
|
|
@@ -846,13 +844,12 @@
|
|
|
846
844
|
return navigationResolver.getAdjustedPositionWithSafeEdge(
|
|
847
845
|
pageTurnDirection === `horizontal` ? { x: position.x + context.getPageSize().width, y: 0 } : { y: position.y + context.getPageSize().height, x: 0 }
|
|
848
846
|
);
|
|
849
|
-
} else {
|
|
850
|
-
const readingOrderPosition = spineLocator.getSpinePositionFromSpineItemPosition({
|
|
851
|
-
spineItemPosition: spineItemNavigationForRightPage,
|
|
852
|
-
spineItem
|
|
853
|
-
});
|
|
854
|
-
return readingOrderPosition;
|
|
855
847
|
}
|
|
848
|
+
const readingOrderPosition = spineLocator.getSpinePositionFromSpineItemPosition({
|
|
849
|
+
spineItemPosition: spineItemNavigationForRightPage,
|
|
850
|
+
spineItem
|
|
851
|
+
});
|
|
852
|
+
return readingOrderPosition;
|
|
856
853
|
};
|
|
857
854
|
const getNavigationForRightOrBottomPage = ({
|
|
858
855
|
position,
|
|
@@ -959,13 +956,12 @@
|
|
|
959
956
|
return navigationResolver.getAdjustedPositionWithSafeEdge(
|
|
960
957
|
pageTurnDirection === `horizontal` ? { x: position.x - context.getPageSize().width, y: 0 } : { y: position.y - context.getPageSize().height, x: 0 }
|
|
961
958
|
);
|
|
962
|
-
} else {
|
|
963
|
-
const readingOrderPosition = spineLocator.getSpinePositionFromSpineItemPosition({
|
|
964
|
-
spineItemPosition: spineItemNavigation,
|
|
965
|
-
spineItem
|
|
966
|
-
});
|
|
967
|
-
return readingOrderPosition;
|
|
968
959
|
}
|
|
960
|
+
const readingOrderPosition = spineLocator.getSpinePositionFromSpineItemPosition({
|
|
961
|
+
spineItemPosition: spineItemNavigation,
|
|
962
|
+
spineItem
|
|
963
|
+
});
|
|
964
|
+
return readingOrderPosition;
|
|
969
965
|
};
|
|
970
966
|
const getNavigationForLeftOrTopPage = ({
|
|
971
967
|
position,
|
|
@@ -1402,10 +1398,8 @@
|
|
|
1402
1398
|
if (!manifest) return {};
|
|
1403
1399
|
return items.reduce(
|
|
1404
1400
|
(acc, { item }) => {
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
[item.id]: buildChapterInfoFromSpineItem(manifest, item)
|
|
1408
|
-
};
|
|
1401
|
+
acc[item.id] = buildChapterInfoFromSpineItem(manifest, item);
|
|
1402
|
+
return acc;
|
|
1409
1403
|
},
|
|
1410
1404
|
{}
|
|
1411
1405
|
);
|
|
@@ -2122,13 +2116,14 @@
|
|
|
2122
2116
|
// `touchend` as const,
|
|
2123
2117
|
];
|
|
2124
2118
|
const isHtmlElement = (element) => {
|
|
2125
|
-
return typeof element ===
|
|
2119
|
+
return typeof element === "object" && !!element && `nodeType` in element && (element == null ? void 0 : element.nodeType) === Node.ELEMENT_NODE;
|
|
2126
2120
|
};
|
|
2127
2121
|
function createRangeOrCaretFromPoint(doc, startX, startY) {
|
|
2128
2122
|
if (`caretPositionFromPoint` in doc) {
|
|
2129
2123
|
return doc.caretPositionFromPoint(startX, startY);
|
|
2130
|
-
}
|
|
2131
|
-
|
|
2124
|
+
}
|
|
2125
|
+
if ("caretRangeFromPoint" in doc && // @ts-expect-error limited availability
|
|
2126
|
+
typeof doc.caretRangeFromPoint !== "undefined") {
|
|
2132
2127
|
return doc.caretRangeFromPoint(startX, startY);
|
|
2133
2128
|
}
|
|
2134
2129
|
}
|
|
@@ -2231,7 +2226,7 @@
|
|
|
2231
2226
|
return true;
|
|
2232
2227
|
}
|
|
2233
2228
|
}
|
|
2234
|
-
if ((
|
|
2229
|
+
if ((_e = event == null ? void 0 : event.view) == null ? void 0 : _e.window) {
|
|
2235
2230
|
const eventView = event == null ? void 0 : event.view;
|
|
2236
2231
|
if (eventView.PointerEvent && event instanceof eventView.PointerEvent) {
|
|
2237
2232
|
return true;
|
|
@@ -2251,7 +2246,7 @@
|
|
|
2251
2246
|
return event instanceof eventView.MouseEvent;
|
|
2252
2247
|
}
|
|
2253
2248
|
}
|
|
2254
|
-
if ((
|
|
2249
|
+
if ((_e = event == null ? void 0 : event.view) == null ? void 0 : _e.window) {
|
|
2255
2250
|
const eventView = event == null ? void 0 : event.view;
|
|
2256
2251
|
if (eventView.MouseEvent) {
|
|
2257
2252
|
return event instanceof eventView.MouseEvent;
|
|
@@ -2267,7 +2262,7 @@
|
|
|
2267
2262
|
return event instanceof eventView.TouchEvent;
|
|
2268
2263
|
}
|
|
2269
2264
|
}
|
|
2270
|
-
if ((
|
|
2265
|
+
if ((_e = event == null ? void 0 : event.view) == null ? void 0 : _e.window) {
|
|
2271
2266
|
const eventView = event == null ? void 0 : event.view;
|
|
2272
2267
|
if (eventView.TouchEvent) {
|
|
2273
2268
|
return event instanceof eventView.TouchEvent;
|
|
@@ -2401,10 +2396,9 @@
|
|
|
2401
2396
|
});
|
|
2402
2397
|
if (isUsingVerticalWriting) {
|
|
2403
2398
|
return getPageFromOffset(position.y, pageHeight, numberOfPages);
|
|
2404
|
-
} else {
|
|
2405
|
-
const pageIndex = getPageFromOffset(offset, pageWidth, numberOfPages);
|
|
2406
|
-
return pageIndex;
|
|
2407
2399
|
}
|
|
2400
|
+
const pageIndex = getPageFromOffset(offset, pageWidth, numberOfPages);
|
|
2401
|
+
return pageIndex;
|
|
2408
2402
|
};
|
|
2409
2403
|
const getSpineItemPositionFromNode = (node, offset, spineItem) => {
|
|
2410
2404
|
var _a;
|
|
@@ -2795,7 +2789,8 @@
|
|
|
2795
2789
|
function closest(a, n) {
|
|
2796
2790
|
let minDiff;
|
|
2797
2791
|
let closest2;
|
|
2798
|
-
let i
|
|
2792
|
+
let i;
|
|
2793
|
+
let diff;
|
|
2799
2794
|
for (i = 0; i < a.length; i++) {
|
|
2800
2795
|
diff = Math.abs(a[i] - n);
|
|
2801
2796
|
if (!i || diff < minDiff) {
|
|
@@ -2810,7 +2805,8 @@
|
|
|
2810
2805
|
let lastWasElement;
|
|
2811
2806
|
let prevOffset = 0;
|
|
2812
2807
|
let firstNode = true;
|
|
2813
|
-
let i
|
|
2808
|
+
let i;
|
|
2809
|
+
let node;
|
|
2814
2810
|
for (i = 0; i < nodes.length; i++) {
|
|
2815
2811
|
node = nodes[i];
|
|
2816
2812
|
if (node.nodeType === ELEMENT_NODE) {
|
|
@@ -2823,9 +2819,8 @@
|
|
|
2823
2819
|
if (n === node) {
|
|
2824
2820
|
if (node.tagName.toLowerCase() === `img`) {
|
|
2825
2821
|
return { count, offset };
|
|
2826
|
-
} else {
|
|
2827
|
-
return { count };
|
|
2828
2822
|
}
|
|
2823
|
+
return { count };
|
|
2829
2824
|
}
|
|
2830
2825
|
prevOffset = 0;
|
|
2831
2826
|
lastWasElement = true;
|
|
@@ -2846,8 +2841,8 @@
|
|
|
2846
2841
|
throw new Error(`The specified node was not found in the array of siblings`);
|
|
2847
2842
|
}
|
|
2848
2843
|
function compareTemporal(a, b) {
|
|
2849
|
-
const isA = typeof a ===
|
|
2850
|
-
const isB = typeof b ===
|
|
2844
|
+
const isA = typeof a === "number";
|
|
2845
|
+
const isB = typeof b === "number";
|
|
2851
2846
|
if (!isA && !isB) return 0;
|
|
2852
2847
|
if (!isA && isB) return -1;
|
|
2853
2848
|
if (isA && !isB) return 1;
|
|
@@ -2883,7 +2878,9 @@
|
|
|
2883
2878
|
if (!m) throw new Error(`Not a valid CFI`);
|
|
2884
2879
|
if (m.length < 2) return;
|
|
2885
2880
|
str = m[1] || ``;
|
|
2886
|
-
let parsed
|
|
2881
|
+
let parsed;
|
|
2882
|
+
let offset;
|
|
2883
|
+
let newDoc;
|
|
2887
2884
|
let subParts = [];
|
|
2888
2885
|
let sawComma = 0;
|
|
2889
2886
|
while (str.length) {
|
|
@@ -2954,7 +2951,10 @@
|
|
|
2954
2951
|
parts = this.parts;
|
|
2955
2952
|
}
|
|
2956
2953
|
}
|
|
2957
|
-
let i
|
|
2954
|
+
let i;
|
|
2955
|
+
let j;
|
|
2956
|
+
let part;
|
|
2957
|
+
let subpart;
|
|
2958
2958
|
for (i = 0; i < parts.length; i++) {
|
|
2959
2959
|
part = parts[i];
|
|
2960
2960
|
for (j = 0; j < part.length - 1; j++) {
|
|
@@ -2971,7 +2971,7 @@
|
|
|
2971
2971
|
let o;
|
|
2972
2972
|
while (node.parentNode) {
|
|
2973
2973
|
o = calcSiblingCount(node.parentNode.childNodes, node, offset);
|
|
2974
|
-
if (!cfi && o.offset) cfi =
|
|
2974
|
+
if (!cfi && o.offset) cfi = `:${o.offset}`;
|
|
2975
2975
|
cfi = // @ts-ignore
|
|
2976
2976
|
`/` + o.count + (node.id ? `[` + cfiEscape(node.id) + `]` : ``) + cfi;
|
|
2977
2977
|
node = node.parentNode;
|
|
@@ -2990,19 +2990,21 @@
|
|
|
2990
2990
|
cfi = this.generatePart(node, offset, extra);
|
|
2991
2991
|
}
|
|
2992
2992
|
if (extra) cfi += extra;
|
|
2993
|
-
return `epubcfi(
|
|
2993
|
+
return `epubcfi(${cfi})`;
|
|
2994
2994
|
}
|
|
2995
2995
|
static toParsed(cfi) {
|
|
2996
2996
|
if (cfi.isRange) {
|
|
2997
2997
|
return cfi.getFrom();
|
|
2998
|
-
} else {
|
|
2999
|
-
return cfi.get();
|
|
3000
2998
|
}
|
|
2999
|
+
return cfi.get();
|
|
3001
3000
|
}
|
|
3002
3001
|
// Takes two CFI paths and compares them
|
|
3003
3002
|
static comparePath(a, b) {
|
|
3004
3003
|
const max = Math.max(a.length, b.length);
|
|
3005
|
-
let i
|
|
3004
|
+
let i;
|
|
3005
|
+
let cA;
|
|
3006
|
+
let cB;
|
|
3007
|
+
let diff;
|
|
3006
3008
|
for (i = 0; i < max; i++) {
|
|
3007
3009
|
cA = a[i];
|
|
3008
3010
|
cB = b[i];
|
|
@@ -3039,7 +3041,10 @@
|
|
|
3039
3041
|
// Takes two parsed path parts (assuming path is split on '!') and compares them.
|
|
3040
3042
|
static compareParts(a, b) {
|
|
3041
3043
|
const max = Math.max(a.length, b.length);
|
|
3042
|
-
let i
|
|
3044
|
+
let i;
|
|
3045
|
+
let cA;
|
|
3046
|
+
let cB;
|
|
3047
|
+
let diff;
|
|
3043
3048
|
for (i = 0; i < max; i++) {
|
|
3044
3049
|
cA = a[i];
|
|
3045
3050
|
cB = b[i];
|
|
@@ -3111,7 +3116,7 @@
|
|
|
3111
3116
|
if (!loc) return;
|
|
3112
3117
|
const m = loc.trim().match(/^(.*);s=([ba])$/);
|
|
3113
3118
|
if (!m || m.length < 3) {
|
|
3114
|
-
if (typeof o.textLocationAssertion ===
|
|
3119
|
+
if (typeof o.textLocationAssertion === "object") {
|
|
3115
3120
|
o.textLocationAssertion.post = loc;
|
|
3116
3121
|
} else {
|
|
3117
3122
|
o.textLocationAssertion = loc;
|
|
@@ -3119,7 +3124,7 @@
|
|
|
3119
3124
|
return;
|
|
3120
3125
|
}
|
|
3121
3126
|
if (m[1]) {
|
|
3122
|
-
if (typeof o.textLocationAssertion ===
|
|
3127
|
+
if (typeof o.textLocationAssertion === "object") {
|
|
3123
3128
|
o.textLocationAssertion.post = m[1];
|
|
3124
3129
|
} else {
|
|
3125
3130
|
o.textLocationAssertion = m[1];
|
|
@@ -3136,10 +3141,10 @@
|
|
|
3136
3141
|
const m = range.trim().match(/^([\d\.]+):([\d\.]+)$/);
|
|
3137
3142
|
if (!m || m.length < 3) return void 0;
|
|
3138
3143
|
const o = {
|
|
3139
|
-
x: parseInt(m[1]),
|
|
3140
|
-
y: parseInt(m[2])
|
|
3144
|
+
x: Number.parseInt(m[1]),
|
|
3145
|
+
y: Number.parseInt(m[2])
|
|
3141
3146
|
};
|
|
3142
|
-
if (typeof o.x !==
|
|
3147
|
+
if (typeof o.x !== "number" || typeof o.y !== "number") {
|
|
3143
3148
|
return void 0;
|
|
3144
3149
|
}
|
|
3145
3150
|
return o;
|
|
@@ -3150,7 +3155,8 @@
|
|
|
3150
3155
|
let f;
|
|
3151
3156
|
let state;
|
|
3152
3157
|
let prevState;
|
|
3153
|
-
let cur
|
|
3158
|
+
let cur;
|
|
3159
|
+
let escape;
|
|
3154
3160
|
let seenColon = false;
|
|
3155
3161
|
let seenSlash = false;
|
|
3156
3162
|
let i;
|
|
@@ -3221,12 +3227,11 @@
|
|
|
3221
3227
|
}
|
|
3222
3228
|
escape = false;
|
|
3223
3229
|
continue;
|
|
3224
|
-
} else {
|
|
3225
|
-
prevState = state;
|
|
3226
|
-
state = null;
|
|
3227
|
-
if (f && seenColon) o.spatial = this.parseSpatialRange(f);
|
|
3228
|
-
f = null;
|
|
3229
3230
|
}
|
|
3231
|
+
prevState = state;
|
|
3232
|
+
state = null;
|
|
3233
|
+
if (f && seenColon) o.spatial = this.parseSpatialRange(f);
|
|
3234
|
+
f = null;
|
|
3230
3235
|
}
|
|
3231
3236
|
if (state === `~`) {
|
|
3232
3237
|
if (cur.match(isNumber) || cur === `.`) {
|
|
@@ -3258,23 +3263,22 @@
|
|
|
3258
3263
|
if (cur === `/`) {
|
|
3259
3264
|
if (seenSlash) {
|
|
3260
3265
|
break;
|
|
3261
|
-
} else {
|
|
3262
|
-
seenSlash = true;
|
|
3263
|
-
prevState = state;
|
|
3264
|
-
state = cur;
|
|
3265
|
-
escape = false;
|
|
3266
|
-
continue;
|
|
3267
3266
|
}
|
|
3267
|
+
seenSlash = true;
|
|
3268
|
+
prevState = state;
|
|
3269
|
+
state = cur;
|
|
3270
|
+
escape = false;
|
|
3271
|
+
continue;
|
|
3268
3272
|
}
|
|
3269
3273
|
if (cur === `:` || cur === `~` || cur === `@`) {
|
|
3270
3274
|
if (this.opts.stricter) {
|
|
3271
3275
|
if (cur === `:` && // @ts-ignore
|
|
3272
|
-
(typeof o.temporal !==
|
|
3273
|
-
typeof o.spatial !==
|
|
3276
|
+
(typeof o.temporal !== "undefined" || // @ts-ignore
|
|
3277
|
+
typeof o.spatial !== "undefined")) {
|
|
3274
3278
|
break;
|
|
3275
3279
|
}
|
|
3276
3280
|
if ((cur === `~` || cur === `@`) && // @ts-ignore
|
|
3277
|
-
typeof o.offset !==
|
|
3281
|
+
typeof o.offset !== "undefined") {
|
|
3278
3282
|
break;
|
|
3279
3283
|
}
|
|
3280
3284
|
}
|
|
@@ -3352,7 +3356,8 @@
|
|
|
3352
3356
|
}
|
|
3353
3357
|
let cfiCount = 0;
|
|
3354
3358
|
let lastChild;
|
|
3355
|
-
let i
|
|
3359
|
+
let i;
|
|
3360
|
+
let child;
|
|
3356
3361
|
for (i = 0; i < children.length; i++) {
|
|
3357
3362
|
child = children[i];
|
|
3358
3363
|
switch (child == null ? void 0 : child.nodeType) {
|
|
@@ -3431,12 +3436,12 @@
|
|
|
3431
3436
|
correctOffset(dom, node, offset, assertion) {
|
|
3432
3437
|
let curNode = node;
|
|
3433
3438
|
let matchStr;
|
|
3434
|
-
if (typeof assertion ===
|
|
3439
|
+
if (typeof assertion === "string") {
|
|
3435
3440
|
matchStr = this.decodeEntities(dom, assertion);
|
|
3436
3441
|
} else {
|
|
3437
3442
|
assertion.pre = this.decodeEntities(dom, assertion.pre);
|
|
3438
3443
|
assertion.post = this.decodeEntities(dom, assertion.post);
|
|
3439
|
-
matchStr = assertion.pre
|
|
3444
|
+
matchStr = `${assertion.pre}.${assertion.post}`;
|
|
3440
3445
|
}
|
|
3441
3446
|
if (!this.isTextNode(node)) {
|
|
3442
3447
|
return { node, offset: 0 };
|
|
@@ -3553,7 +3558,7 @@
|
|
|
3553
3558
|
throw new Error(`index is out of bounds`);
|
|
3554
3559
|
}
|
|
3555
3560
|
const subparts = this.parts[index];
|
|
3556
|
-
if (!subparts) throw new Error(`Missing CFI part for index: `
|
|
3561
|
+
if (!subparts) throw new Error(`Missing CFI part for index: ${index}`);
|
|
3557
3562
|
const o = this.resolveNode(index, subparts, dom, opts);
|
|
3558
3563
|
let node = o.node;
|
|
3559
3564
|
const tagName = node.tagName.toLowerCase();
|
|
@@ -3569,19 +3574,19 @@
|
|
|
3569
3574
|
}
|
|
3570
3575
|
if (tagName === `iframe` || tagName === `embed`) {
|
|
3571
3576
|
const src = node.getAttribute(`src`);
|
|
3572
|
-
if (!src) throw new Error(tagName
|
|
3577
|
+
if (!src) throw new Error(`${tagName} element is missing 'src' attribute`);
|
|
3573
3578
|
return src;
|
|
3574
3579
|
}
|
|
3575
|
-
if (tagName ===
|
|
3580
|
+
if (tagName === "object") {
|
|
3576
3581
|
const data = node.getAttribute(`data`);
|
|
3577
3582
|
if (!data)
|
|
3578
|
-
throw new Error(tagName
|
|
3583
|
+
throw new Error(`${tagName} element is missing 'data' attribute`);
|
|
3579
3584
|
return data;
|
|
3580
3585
|
}
|
|
3581
3586
|
if (tagName === `image` || tagName === `use`) {
|
|
3582
3587
|
const href = node.getAttribute(`xlink:href`);
|
|
3583
3588
|
if (!href)
|
|
3584
|
-
throw new Error(tagName
|
|
3589
|
+
throw new Error(`${tagName} element is missing 'xlink:href' attribute`);
|
|
3585
3590
|
return href;
|
|
3586
3591
|
}
|
|
3587
3592
|
throw new Error(`No URI found`);
|
|
@@ -3592,7 +3597,7 @@
|
|
|
3592
3597
|
resolveLocation(dom, parts) {
|
|
3593
3598
|
const index = parts.length - 1;
|
|
3594
3599
|
const subparts = parts[index];
|
|
3595
|
-
if (!subparts) throw new Error(`Missing CFI part for index: `
|
|
3600
|
+
if (!subparts) throw new Error(`Missing CFI part for index: ${index}`);
|
|
3596
3601
|
const o = this.resolveNode(index, subparts, dom);
|
|
3597
3602
|
const lastPart = this.deepClone(subparts[subparts.length - 1]);
|
|
3598
3603
|
delete lastPart.nodeIndex;
|
|
@@ -3650,12 +3655,12 @@
|
|
|
3650
3655
|
const [itemIndex] = ((_a = cfi.match(/\|(\[prose\~anchor[^\]]*\])+/gi)) == null ? void 0 : _a.map((s) => s.replace(/\|\[prose\~anchor\~/, ``).replace(/\]/, ``))) || [];
|
|
3651
3656
|
const [offset] = ((_b = cfi.match(/\|(\[prose\~offset[^\]]*\])+/gi)) == null ? void 0 : _b.map((s) => s.replace(/\|\[prose\~offset\~/, ``).replace(/\]/, ``))) || [];
|
|
3652
3657
|
const cleanedCfi = cfi.replace(/\|(\[prose\~[^\]]*\~[^\]]*\])+/gi, ``);
|
|
3653
|
-
const foundOffset = parseInt(offset || ``);
|
|
3654
|
-
const foundItemIndex = parseInt(itemIndex || ``);
|
|
3658
|
+
const foundOffset = Number.parseInt(offset || ``);
|
|
3659
|
+
const foundItemIndex = Number.parseInt(itemIndex || ``);
|
|
3655
3660
|
return {
|
|
3656
3661
|
cleanedCfi,
|
|
3657
|
-
itemIndex: isNaN(foundItemIndex) ? void 0 : foundItemIndex,
|
|
3658
|
-
offset: isNaN(foundOffset) ? void 0 : foundOffset
|
|
3662
|
+
itemIndex: Number.isNaN(foundItemIndex) ? void 0 : foundItemIndex,
|
|
3663
|
+
offset: Number.isNaN(foundOffset) ? void 0 : foundOffset
|
|
3659
3664
|
};
|
|
3660
3665
|
};
|
|
3661
3666
|
const resolveCfi = ({
|
|
@@ -3711,19 +3716,18 @@
|
|
|
3711
3716
|
}) || {};
|
|
3712
3717
|
if (!spineItem) {
|
|
3713
3718
|
Report.warn(NAMESPACE$4, `unable to detect item id from cfi ${cfi}`);
|
|
3714
|
-
|
|
3715
|
-
const spineItemNavigation = node ? spineItemNavigator.getNavigationFromNode(spineItem, node, offset) : { x: 0, y: 0 };
|
|
3716
|
-
const readingPosition = locator.getSpinePositionFromSpineItemPosition({
|
|
3717
|
-
spineItemPosition: spineItemNavigation,
|
|
3718
|
-
spineItem
|
|
3719
|
-
});
|
|
3720
|
-
return getAdjustedPositionForSpread({
|
|
3721
|
-
position: readingPosition,
|
|
3722
|
-
pageSizeWidth: context.getPageSize().width,
|
|
3723
|
-
visibleAreaRectWidth: context.state.visibleAreaRect.width
|
|
3724
|
-
});
|
|
3719
|
+
return void 0;
|
|
3725
3720
|
}
|
|
3726
|
-
|
|
3721
|
+
const spineItemNavigation = node ? spineItemNavigator.getNavigationFromNode(spineItem, node, offset) : { x: 0, y: 0 };
|
|
3722
|
+
const readingPosition = locator.getSpinePositionFromSpineItemPosition({
|
|
3723
|
+
spineItemPosition: spineItemNavigation,
|
|
3724
|
+
spineItem
|
|
3725
|
+
});
|
|
3726
|
+
return getAdjustedPositionForSpread({
|
|
3727
|
+
position: readingPosition,
|
|
3728
|
+
pageSizeWidth: context.getPageSize().width,
|
|
3729
|
+
visibleAreaRectWidth: context.state.visibleAreaRect.width
|
|
3730
|
+
});
|
|
3727
3731
|
};
|
|
3728
3732
|
const getNavigationForLastPage = (spineItem) => {
|
|
3729
3733
|
const spineItemNavigation = spineItemNavigator.getNavigationForLastPage(spineItem);
|
|
@@ -3934,8 +3938,7 @@
|
|
|
3934
3938
|
currentEvent.shouldAnimate ? rxjs.delay(1, rxjs.animationFrameScheduler) : rxjs.identity,
|
|
3935
3939
|
rxjs.tap((data) => {
|
|
3936
3940
|
const element2 = this.viewportElement$.getValue();
|
|
3937
|
-
|
|
3938
|
-
if (data.shouldAnimate && !noAdjustmentNeeded) {
|
|
3941
|
+
if (data.shouldAnimate && true) {
|
|
3939
3942
|
if (pageTurnAnimation === `fade`) {
|
|
3940
3943
|
element2.style.setProperty(
|
|
3941
3944
|
`transition`,
|
|
@@ -4369,21 +4372,19 @@
|
|
|
4369
4372
|
if (settings.values.computedPageTurnDirection === "vertical") {
|
|
4370
4373
|
if (navigation.position.y > previousNavigation.position.y) {
|
|
4371
4374
|
return "forward";
|
|
4372
|
-
} else {
|
|
4373
|
-
if (navigation.position.y === previousNavigation.position.y && previousNavigation.directionFromLastNavigation !== "backward") {
|
|
4374
|
-
return "forward";
|
|
4375
|
-
}
|
|
4376
|
-
return "backward";
|
|
4377
4375
|
}
|
|
4378
|
-
|
|
4379
|
-
if (Math.abs(navigation.position.x) > Math.abs(previousNavigation.position.x)) {
|
|
4380
|
-
return "forward";
|
|
4381
|
-
} else {
|
|
4382
|
-
if (navigation.position.x === previousNavigation.position.x && previousNavigation.directionFromLastNavigation !== "backward") {
|
|
4376
|
+
if (navigation.position.y === previousNavigation.position.y && previousNavigation.directionFromLastNavigation !== "backward") {
|
|
4383
4377
|
return "forward";
|
|
4384
4378
|
}
|
|
4385
4379
|
return "backward";
|
|
4386
4380
|
}
|
|
4381
|
+
if (Math.abs(navigation.position.x) > Math.abs(previousNavigation.position.x)) {
|
|
4382
|
+
return "forward";
|
|
4383
|
+
}
|
|
4384
|
+
if (navigation.position.x === previousNavigation.position.x && previousNavigation.directionFromLastNavigation !== "backward") {
|
|
4385
|
+
return "forward";
|
|
4386
|
+
}
|
|
4387
|
+
return "backward";
|
|
4387
4388
|
};
|
|
4388
4389
|
const withDirection = ({
|
|
4389
4390
|
context,
|
|
@@ -5210,6 +5211,7 @@
|
|
|
5210
5211
|
return result ?? rxjs.of(void 0);
|
|
5211
5212
|
};
|
|
5212
5213
|
const fnResult = hook.runFn({
|
|
5214
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
5213
5215
|
...params,
|
|
5214
5216
|
destroy$: destroySubject.asObservable(),
|
|
5215
5217
|
destroy
|
|
@@ -5831,10 +5833,10 @@
|
|
|
5831
5833
|
this.items$ = this.orderedSpineItemsSubject.asObservable();
|
|
5832
5834
|
}
|
|
5833
5835
|
get(indexOrId) {
|
|
5834
|
-
if (typeof indexOrId ===
|
|
5836
|
+
if (typeof indexOrId === "number") {
|
|
5835
5837
|
return this.orderedSpineItemsSubject.value[indexOrId];
|
|
5836
5838
|
}
|
|
5837
|
-
if (typeof indexOrId ===
|
|
5839
|
+
if (typeof indexOrId === "string") {
|
|
5838
5840
|
return this.orderedSpineItemsSubject.value.find(
|
|
5839
5841
|
({ item }) => item.id === indexOrId
|
|
5840
5842
|
);
|
|
@@ -5887,9 +5889,8 @@
|
|
|
5887
5889
|
const isWithinXAxis = position.x >= left && position.x < right;
|
|
5888
5890
|
if (settings.values.computedPageTurnDirection === `horizontal`) {
|
|
5889
5891
|
return isWithinXAxis;
|
|
5890
|
-
} else {
|
|
5891
|
-
return isWithinXAxis && position.y >= top && position.y < bottom;
|
|
5892
5892
|
}
|
|
5893
|
+
return isWithinXAxis && position.y >= top && position.y < bottom;
|
|
5893
5894
|
});
|
|
5894
5895
|
if (position.x === 0 && !spineItem) {
|
|
5895
5896
|
return spineItemsManager.items[0];
|
|
@@ -6144,7 +6145,7 @@
|
|
|
6144
6145
|
});
|
|
6145
6146
|
};
|
|
6146
6147
|
const getSpineItemPageIndexFromNode = (node, offset, spineItemOrIndex) => {
|
|
6147
|
-
if (typeof spineItemOrIndex ===
|
|
6148
|
+
if (typeof spineItemOrIndex === "number") {
|
|
6148
6149
|
const spineItem = spineItemsManager.get(spineItemOrIndex);
|
|
6149
6150
|
return spineItem ? spineItemLocator.getSpineItemPageIndexFromNode(
|
|
6150
6151
|
node,
|
|
@@ -6967,10 +6968,10 @@
|
|
|
6967
6968
|
const put = (key, data) => {
|
|
6968
6969
|
return new Promise((resolve, reject) => {
|
|
6969
6970
|
const transaction = db.transaction([`store`], `readwrite`);
|
|
6970
|
-
transaction.onerror =
|
|
6971
|
+
transaction.onerror = (event) => {
|
|
6971
6972
|
reject(event);
|
|
6972
6973
|
};
|
|
6973
|
-
transaction.oncomplete =
|
|
6974
|
+
transaction.oncomplete = () => {
|
|
6974
6975
|
resolve();
|
|
6975
6976
|
};
|
|
6976
6977
|
const objectStore = transaction.objectStore(`store`);
|
|
@@ -6995,7 +6996,7 @@
|
|
|
6995
6996
|
}
|
|
6996
6997
|
resolve(value);
|
|
6997
6998
|
};
|
|
6998
|
-
transaction.onerror =
|
|
6999
|
+
transaction.onerror = () => {
|
|
6999
7000
|
reject(request.error);
|
|
7000
7001
|
};
|
|
7001
7002
|
});
|
|
@@ -7005,13 +7006,13 @@
|
|
|
7005
7006
|
const transaction = db.transaction([`store`], `readwrite`);
|
|
7006
7007
|
const objectStore = transaction.objectStore(`store`);
|
|
7007
7008
|
const request = objectStore.delete(key);
|
|
7008
|
-
transaction.onerror =
|
|
7009
|
+
transaction.onerror = () => {
|
|
7009
7010
|
reject(request.error);
|
|
7010
7011
|
};
|
|
7011
|
-
transaction.oncomplete =
|
|
7012
|
+
transaction.oncomplete = () => {
|
|
7012
7013
|
resolve();
|
|
7013
7014
|
};
|
|
7014
|
-
transaction.onabort =
|
|
7015
|
+
transaction.onabort = () => {
|
|
7015
7016
|
var _a;
|
|
7016
7017
|
const err = request.error ? request.error : (_a = request.transaction) == null ? void 0 : _a.error;
|
|
7017
7018
|
reject(err);
|
|
@@ -7021,7 +7022,7 @@
|
|
|
7021
7022
|
const keys = () => {
|
|
7022
7023
|
return new Promise((resolve, reject) => {
|
|
7023
7024
|
const transaction = db.transaction([`store`], `readonly`);
|
|
7024
|
-
transaction.onerror =
|
|
7025
|
+
transaction.onerror = (event) => {
|
|
7025
7026
|
reject(event);
|
|
7026
7027
|
};
|
|
7027
7028
|
const objectStore = transaction.objectStore(`store`);
|
|
@@ -7051,10 +7052,10 @@
|
|
|
7051
7052
|
const openDatabase = async (name) => {
|
|
7052
7053
|
return new Promise((resolve, reject) => {
|
|
7053
7054
|
const request = window.indexedDB.open(name);
|
|
7054
|
-
request.onerror =
|
|
7055
|
+
request.onerror = (event) => {
|
|
7055
7056
|
reject(event);
|
|
7056
7057
|
};
|
|
7057
|
-
request.onsuccess =
|
|
7058
|
+
request.onsuccess = () => {
|
|
7058
7059
|
resolve(createDatabase(request.result));
|
|
7059
7060
|
};
|
|
7060
7061
|
request.onupgradeneeded = () => {
|
|
@@ -7067,12 +7068,11 @@
|
|
|
7067
7068
|
const cache$ = new rxjs.Subject();
|
|
7068
7069
|
const retrieveItem = (itemIndexOrId) => {
|
|
7069
7070
|
var _a, _b;
|
|
7070
|
-
if (typeof itemIndexOrId ===
|
|
7071
|
-
const id = typeof itemIndexOrId ===
|
|
7071
|
+
if (typeof itemIndexOrId === "string" || typeof itemIndexOrId === "object") {
|
|
7072
|
+
const id = typeof itemIndexOrId === "object" ? itemIndexOrId.id : itemIndexOrId;
|
|
7072
7073
|
return (_a = context.manifest) == null ? void 0 : _a.spineItems.find((entry) => entry.id === id);
|
|
7073
|
-
} else {
|
|
7074
|
-
return (_b = context.manifest) == null ? void 0 : _b.spineItems[itemIndexOrId];
|
|
7075
7074
|
}
|
|
7075
|
+
return (_b = context.manifest) == null ? void 0 : _b.spineItems[itemIndexOrId];
|
|
7076
7076
|
};
|
|
7077
7077
|
const get = async (itemIndexOrId, fetchResource) => {
|
|
7078
7078
|
const item = retrieveItem(itemIndexOrId);
|
|
@@ -7176,7 +7176,8 @@
|
|
|
7176
7176
|
imgElement.style.userSelect = `none`;
|
|
7177
7177
|
if (responseOrUrl instanceof URL) {
|
|
7178
7178
|
return rxjs.of(responseOrUrl.href);
|
|
7179
|
-
}
|
|
7179
|
+
}
|
|
7180
|
+
if (responseOrUrl instanceof Response) {
|
|
7180
7181
|
return rxjs.from(responseOrUrl.blob()).pipe(
|
|
7181
7182
|
rxjs.map((blob) => {
|
|
7182
7183
|
return URL.createObjectURL(blob);
|
|
@@ -7382,15 +7383,14 @@
|
|
|
7382
7383
|
(currentPosition.y - top + context.state.visibleAreaRect.height) / height
|
|
7383
7384
|
)
|
|
7384
7385
|
);
|
|
7385
|
-
} else {
|
|
7386
|
-
return Math.max(
|
|
7387
|
-
0,
|
|
7388
|
-
Math.min(
|
|
7389
|
-
1,
|
|
7390
|
-
(currentPosition.x - left + context.state.visibleAreaRect.width) / width
|
|
7391
|
-
)
|
|
7392
|
-
);
|
|
7393
7386
|
}
|
|
7387
|
+
return Math.max(
|
|
7388
|
+
0,
|
|
7389
|
+
Math.min(
|
|
7390
|
+
1,
|
|
7391
|
+
(currentPosition.x - left + context.state.visibleAreaRect.width) / width
|
|
7392
|
+
)
|
|
7393
|
+
);
|
|
7394
7394
|
};
|
|
7395
7395
|
return {
|
|
7396
7396
|
...reader,
|
|
@@ -7508,20 +7508,17 @@
|
|
|
7508
7508
|
const alreadyExistingElement = element.querySelector(
|
|
7509
7509
|
`.${CONTAINER_HTML_PREFIX}`
|
|
7510
7510
|
);
|
|
7511
|
-
if (alreadyExistingElement instanceof HTMLElement)
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
};
|
|
7511
|
+
if (alreadyExistingElement instanceof HTMLElement) {
|
|
7512
|
+
acc[item.id] = alreadyExistingElement;
|
|
7513
|
+
return acc;
|
|
7514
|
+
}
|
|
7516
7515
|
const loadingElementContainer = loadingElementCreate({
|
|
7517
7516
|
container: createLoadingElementContainer(element, reader.context),
|
|
7518
7517
|
item
|
|
7519
7518
|
});
|
|
7520
7519
|
element.appendChild(loadingElementContainer);
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
[item.id]: loadingElementContainer
|
|
7524
|
-
};
|
|
7520
|
+
acc[item.id] = loadingElementContainer;
|
|
7521
|
+
return acc;
|
|
7525
7522
|
}, {})
|
|
7526
7523
|
);
|
|
7527
7524
|
const updateEntriesLayout$ = (entries) => rxjs.combineLatest([reader.layout$, reader.theme.$.theme$]).pipe(
|
|
@@ -7761,7 +7758,7 @@
|
|
|
7761
7758
|
image.onerror = reject;
|
|
7762
7759
|
});
|
|
7763
7760
|
const createHtmlPageFromResource = async (resourceResponse, item) => {
|
|
7764
|
-
if (typeof resourceResponse ===
|
|
7761
|
+
if (typeof resourceResponse === "string") return resourceResponse;
|
|
7765
7762
|
const contentType = shared.parseContentType(resourceResponse.headers.get(`Content-Type`) || ``) || shared.detectMimeTypeFromName(item.href);
|
|
7766
7763
|
if ([`image/jpg`, `image/jpeg`, `image/png`, `image/webp`].some(
|
|
7767
7764
|
(mime) => mime === contentType
|
|
@@ -7826,28 +7823,27 @@
|
|
|
7826
7823
|
))) {
|
|
7827
7824
|
frameElement == null ? void 0 : frameElement.setAttribute(`src`, item.href);
|
|
7828
7825
|
return rxjs.of(frameElement);
|
|
7829
|
-
} else {
|
|
7830
|
-
const resourceResponse$ = resource instanceof URL ? rxjs.from(resourcesHandler.fetchResource()) : resource instanceof Response ? rxjs.of(resource) : rxjs.EMPTY;
|
|
7831
|
-
return resourceResponse$.pipe(
|
|
7832
|
-
rxjs.filter((response) => response instanceof Response),
|
|
7833
|
-
rxjs.switchMap((response) => rxjs.from(getHtmlFromResource(response))),
|
|
7834
|
-
rxjs.tap((htmlDoc) => {
|
|
7835
|
-
if (htmlDoc) {
|
|
7836
|
-
const blob = new Blob([htmlDoc], { type: "text/html" });
|
|
7837
|
-
const blobURL = URL.createObjectURL(blob);
|
|
7838
|
-
frameElement == null ? void 0 : frameElement.setAttribute(`src`, blobURL);
|
|
7839
|
-
}
|
|
7840
|
-
}),
|
|
7841
|
-
rxjs.map(() => frameElement),
|
|
7842
|
-
rxjs.catchError((e) => {
|
|
7843
|
-
Report.error(
|
|
7844
|
-
`Error while trying to fetch or load resource for item ${item.id}`
|
|
7845
|
-
);
|
|
7846
|
-
console.error(e);
|
|
7847
|
-
return rxjs.of(frameElement);
|
|
7848
|
-
})
|
|
7849
|
-
);
|
|
7850
7826
|
}
|
|
7827
|
+
const resourceResponse$ = resource instanceof URL ? rxjs.from(resourcesHandler.fetchResource()) : resource instanceof Response ? rxjs.of(resource) : rxjs.EMPTY;
|
|
7828
|
+
return resourceResponse$.pipe(
|
|
7829
|
+
rxjs.filter((response) => response instanceof Response),
|
|
7830
|
+
rxjs.switchMap((response) => rxjs.from(getHtmlFromResource(response))),
|
|
7831
|
+
rxjs.tap((htmlDoc) => {
|
|
7832
|
+
if (htmlDoc) {
|
|
7833
|
+
const blob = new Blob([htmlDoc], { type: "text/html" });
|
|
7834
|
+
const blobURL = URL.createObjectURL(blob);
|
|
7835
|
+
frameElement == null ? void 0 : frameElement.setAttribute(`src`, blobURL);
|
|
7836
|
+
}
|
|
7837
|
+
}),
|
|
7838
|
+
rxjs.map(() => frameElement),
|
|
7839
|
+
rxjs.catchError((e) => {
|
|
7840
|
+
Report.error(
|
|
7841
|
+
`Error while trying to fetch or load resource for item ${item.id}`
|
|
7842
|
+
);
|
|
7843
|
+
console.error(e);
|
|
7844
|
+
return rxjs.of(frameElement);
|
|
7845
|
+
})
|
|
7846
|
+
);
|
|
7851
7847
|
})
|
|
7852
7848
|
);
|
|
7853
7849
|
})
|
|
@@ -8268,13 +8264,10 @@
|
|
|
8268
8264
|
`prose-reader-html-renderer-framce-css`,
|
|
8269
8265
|
buildStyleForViewportFrame()
|
|
8270
8266
|
);
|
|
8271
|
-
staticLayout(
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
height: viewportDimensions.height ?? 1
|
|
8276
|
-
}
|
|
8277
|
-
);
|
|
8267
|
+
staticLayout(frameElement, {
|
|
8268
|
+
width: viewportDimensions.width ?? 1,
|
|
8269
|
+
height: viewportDimensions.height ?? 1
|
|
8270
|
+
});
|
|
8278
8271
|
frameElement == null ? void 0 : frameElement.style.setProperty(`position`, `absolute`);
|
|
8279
8272
|
frameElement == null ? void 0 : frameElement.style.setProperty(`top`, `50%`);
|
|
8280
8273
|
frameElement == null ? void 0 : frameElement.style.setProperty(
|
|
@@ -8304,23 +8297,17 @@
|
|
|
8304
8297
|
frameElement.contentDocument.documentElement.scrollHeight / pageHeight
|
|
8305
8298
|
);
|
|
8306
8299
|
contentHeight = pages * pageHeight;
|
|
8307
|
-
staticLayout(
|
|
8308
|
-
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
height: contentHeight
|
|
8312
|
-
}
|
|
8313
|
-
);
|
|
8300
|
+
staticLayout(frameElement, {
|
|
8301
|
+
width: minimumWidth,
|
|
8302
|
+
height: contentHeight
|
|
8303
|
+
});
|
|
8314
8304
|
} else if ((manifest == null ? void 0 : manifest.renditionFlow) === `scrolled-continuous`) {
|
|
8315
8305
|
contentHeight = frameElement.contentDocument.body.scrollHeight;
|
|
8316
8306
|
newLatestContentHeightWhenLoaded = contentHeight;
|
|
8317
|
-
staticLayout(
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
height: contentHeight
|
|
8322
|
-
}
|
|
8323
|
-
);
|
|
8307
|
+
staticLayout(frameElement, {
|
|
8308
|
+
width: minimumWidth,
|
|
8309
|
+
height: contentHeight
|
|
8310
|
+
});
|
|
8324
8311
|
} else {
|
|
8325
8312
|
const pages = Math.ceil(
|
|
8326
8313
|
frameElement.contentDocument.documentElement.scrollWidth / pageWidth
|
|
@@ -8330,13 +8317,10 @@
|
|
|
8330
8317
|
} else {
|
|
8331
8318
|
contentWidth = pages * pageWidth;
|
|
8332
8319
|
}
|
|
8333
|
-
staticLayout(
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
height: contentHeight
|
|
8338
|
-
}
|
|
8339
|
-
);
|
|
8320
|
+
staticLayout(frameElement, {
|
|
8321
|
+
width: contentWidth,
|
|
8322
|
+
height: contentHeight
|
|
8323
|
+
});
|
|
8340
8324
|
}
|
|
8341
8325
|
}
|
|
8342
8326
|
const isFillingAllScreen = contentWidth % minimumWidth === 0;
|
|
@@ -8717,9 +8701,8 @@
|
|
|
8717
8701
|
type: "change",
|
|
8718
8702
|
selection
|
|
8719
8703
|
};
|
|
8720
|
-
} else {
|
|
8721
|
-
return void 0;
|
|
8722
8704
|
}
|
|
8705
|
+
return void 0;
|
|
8723
8706
|
})
|
|
8724
8707
|
),
|
|
8725
8708
|
selectionTracker.selectionOver$.pipe(
|