@prose-reader/core 1.142.0 → 1.144.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/context/Context.d.ts +0 -1
- package/dist/enhancers/media/ImageRenderer.d.ts +1 -1
- package/dist/index.js +45 -71
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +45 -71
- package/dist/index.umd.cjs.map +1 -1
- package/dist/spine/Spine.d.ts +0 -1
- package/package.json +3 -3
- package/dist/manifest/areAllItemsPrePaginated.d.ts +0 -2
package/dist/index.umd.cjs
CHANGED
|
@@ -250,12 +250,16 @@
|
|
|
250
250
|
return { hasViewport: false };
|
|
251
251
|
};
|
|
252
252
|
const waitForFrameLoad = (stream) => stream.pipe(
|
|
253
|
-
rxjs.switchMap(
|
|
254
|
-
|
|
253
|
+
rxjs.switchMap((frame) => {
|
|
254
|
+
var _a;
|
|
255
|
+
if (frame.src === "about:blank" && ((_a = frame.contentDocument) == null ? void 0 : _a.readyState) === "complete" && frame.contentDocument.body) {
|
|
256
|
+
return rxjs.of(frame);
|
|
257
|
+
}
|
|
258
|
+
return rxjs.fromEvent(frame, `load`).pipe(
|
|
255
259
|
rxjs.take(1),
|
|
256
260
|
rxjs.map(() => frame)
|
|
257
|
-
)
|
|
258
|
-
)
|
|
261
|
+
);
|
|
262
|
+
})
|
|
259
263
|
);
|
|
260
264
|
const waitForFrameReady = (stream) => stream.pipe(
|
|
261
265
|
rxjs.switchMap(
|
|
@@ -1936,7 +1940,6 @@
|
|
|
1936
1940
|
return isLandscape && ((manifest == null ? void 0 : manifest.renditionSpread) === void 0 || (manifest == null ? void 0 : manifest.renditionSpread) === `auto` || (manifest == null ? void 0 : manifest.renditionSpread) === `landscape` || (manifest == null ? void 0 : manifest.renditionSpread) === `both`);
|
|
1937
1941
|
};
|
|
1938
1942
|
const isFullyPrePaginated = (manifest) => (manifest == null ? void 0 : manifest.renditionLayout) === "pre-paginated" || (manifest == null ? void 0 : manifest.spineItems.every((item) => item.renditionLayout === "pre-paginated"));
|
|
1939
|
-
const areAllItemsPrePaginated = (manifest) => !(manifest == null ? void 0 : manifest.spineItems.some((item) => item.renditionLayout === `reflowable`));
|
|
1940
1943
|
class BridgeEvent {
|
|
1941
1944
|
constructor() {
|
|
1942
1945
|
this.navigationSubject = new rxjs.ReplaySubject(1);
|
|
@@ -2021,7 +2024,6 @@
|
|
|
2021
2024
|
height: newState.visibleAreaRect.height - marginTop - marginBottom
|
|
2022
2025
|
},
|
|
2023
2026
|
...newState.manifest && {
|
|
2024
|
-
areAllItemsPrePaginated: areAllItemsPrePaginated(manifest),
|
|
2025
2027
|
isFullyPrePaginated: isFullyPrePaginated(manifest)
|
|
2026
2028
|
},
|
|
2027
2029
|
isUsingSpreadMode: isUsingSpreadMode({
|
|
@@ -4076,28 +4078,21 @@
|
|
|
4076
4078
|
this.navigation$ = this.navigationSubject.asObservable();
|
|
4077
4079
|
const userScroll$ = element$.pipe(
|
|
4078
4080
|
rxjs.switchMap(
|
|
4079
|
-
(element) => settings.
|
|
4080
|
-
rxjs.
|
|
4081
|
-
|
|
4082
|
-
rxjs.filter(
|
|
4083
|
-
(computedPageTurnMode) => computedPageTurnMode === "scrollable"
|
|
4084
|
-
),
|
|
4085
|
-
rxjs.switchMap(() => {
|
|
4086
|
-
return rxjs.fromEvent(element, `scroll`).pipe(
|
|
4081
|
+
(element) => settings.watch(["computedPageTurnMode"]).pipe(
|
|
4082
|
+
rxjs.switchMap(
|
|
4083
|
+
({ computedPageTurnMode }) => computedPageTurnMode === "controlled" ? rxjs.NEVER : rxjs.fromEvent(element, `scroll`).pipe(
|
|
4087
4084
|
rxjs.withLatestFrom(scrollHappeningFromBrowser$),
|
|
4088
|
-
rxjs.filter(
|
|
4085
|
+
rxjs.filter(
|
|
4086
|
+
([, shouldAvoidScrollEvent]) => !shouldAvoidScrollEvent
|
|
4087
|
+
),
|
|
4089
4088
|
rxjs.map(([event]) => event)
|
|
4090
|
-
)
|
|
4091
|
-
|
|
4089
|
+
)
|
|
4090
|
+
)
|
|
4092
4091
|
)
|
|
4093
4092
|
),
|
|
4094
4093
|
rxjs.share()
|
|
4095
4094
|
);
|
|
4096
|
-
const navigateOnScroll$ =
|
|
4097
|
-
rxjs.map(({ computedPageTurnMode }) => computedPageTurnMode),
|
|
4098
|
-
rxjs.distinctUntilChanged(),
|
|
4099
|
-
rxjs.filter((computedPageTurnMode) => computedPageTurnMode === "scrollable"),
|
|
4100
|
-
rxjs.switchMap(() => userScroll$),
|
|
4095
|
+
const navigateOnScroll$ = userScroll$.pipe(
|
|
4101
4096
|
rxjs.exhaustMap((event) => {
|
|
4102
4097
|
const unlock = this.locker.lock();
|
|
4103
4098
|
return rxjs.merge(userScroll$, rxjs.of(event)).pipe(
|
|
@@ -4264,20 +4259,8 @@
|
|
|
4264
4259
|
});
|
|
4265
4260
|
}
|
|
4266
4261
|
if (!isPositionWithinSpineItem) {
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
y: height - positionYfromBottomPreviousNavigation,
|
|
4270
|
-
x: navigation.position.x
|
|
4271
|
-
};
|
|
4272
|
-
return spineLocator.getSpinePositionFromSpineItemPosition({
|
|
4273
|
-
spineItemPosition: spineLocator.getSafeSpineItemPositionFromUnsafeSpineItemPosition(
|
|
4274
|
-
positionInItem,
|
|
4275
|
-
foundSpineItem
|
|
4276
|
-
),
|
|
4277
|
-
spineItem: foundSpineItem
|
|
4278
|
-
});
|
|
4279
|
-
}
|
|
4280
|
-
if (navigation.directionFromLastNavigation === "forward" || navigation.directionFromLastNavigation === "anchor") {
|
|
4262
|
+
const positionIsBeforeItem = navigation.position.y < top;
|
|
4263
|
+
if (!positionIsBeforeItem) {
|
|
4281
4264
|
const positionInItem = {
|
|
4282
4265
|
y: height - positionYfromBottomPreviousNavigation,
|
|
4283
4266
|
x: navigation.position.x
|
|
@@ -4973,11 +4956,17 @@
|
|
|
4973
4956
|
spine
|
|
4974
4957
|
);
|
|
4975
4958
|
const isSpineScrolling$ = rxjs.merge(
|
|
4976
|
-
spine.
|
|
4959
|
+
spine.element$.pipe(operators.switchMap((element) => observeResize(element))),
|
|
4977
4960
|
spine.element$.pipe(operators.switchMap((element) => rxjs.fromEvent(element, "scroll"))),
|
|
4978
4961
|
spine.spineItemsObserver.itemResize$
|
|
4979
4962
|
).pipe(
|
|
4980
|
-
operators.switchMap(
|
|
4963
|
+
operators.switchMap(
|
|
4964
|
+
() => rxjs.timer(10).pipe(
|
|
4965
|
+
operators.map(() => false),
|
|
4966
|
+
operators.startWith(true)
|
|
4967
|
+
)
|
|
4968
|
+
),
|
|
4969
|
+
operators.distinctUntilChanged(),
|
|
4981
4970
|
operators.startWith(false)
|
|
4982
4971
|
);
|
|
4983
4972
|
const scrollHappeningFromBrowser$ = rxjs.combineLatest([
|
|
@@ -5135,20 +5124,13 @@
|
|
|
5135
5124
|
const computedSettings = {
|
|
5136
5125
|
computedPageTurnDirection: settings.pageTurnDirection,
|
|
5137
5126
|
computedPageTurnAnimation: settings.pageTurnAnimation,
|
|
5138
|
-
computedPageTurnMode:
|
|
5127
|
+
computedPageTurnMode: settings.pageTurnMode,
|
|
5139
5128
|
computedPageTurnAnimationDuration: 0
|
|
5140
5129
|
};
|
|
5141
5130
|
if ((manifest == null ? void 0 : manifest.renditionFlow) === `scrolled-continuous`) {
|
|
5142
5131
|
computedSettings.computedPageTurnMode = `scrollable`;
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
Report.warn(
|
|
5146
|
-
`pageTurnMode ${settings.pageTurnMode} incompatible with current book, switching back to default`
|
|
5147
|
-
);
|
|
5148
|
-
computedSettings.computedPageTurnAnimation = `none`;
|
|
5149
|
-
computedSettings.computedPageTurnMode = `controlled`;
|
|
5150
|
-
} else if (settings.pageTurnMode === `scrollable`) {
|
|
5151
|
-
computedSettings.computedPageTurnMode = `scrollable`;
|
|
5132
|
+
}
|
|
5133
|
+
if (computedSettings.computedPageTurnMode === "scrollable") {
|
|
5152
5134
|
computedSettings.computedPageTurnDirection = `vertical`;
|
|
5153
5135
|
}
|
|
5154
5136
|
if (hasVerticalWriting && computedSettings.computedPageTurnAnimation === `slide`) {
|
|
@@ -5814,7 +5796,7 @@
|
|
|
5814
5796
|
const createContainerElement = (containerElement, item, hookManager) => {
|
|
5815
5797
|
const element = containerElement.ownerDocument.createElement(`div`);
|
|
5816
5798
|
element.classList.add(`spineItem`);
|
|
5817
|
-
element.classList.add(`spineItem-${item.renditionLayout}`);
|
|
5799
|
+
element.classList.add(`spineItem-${item.renditionLayout ?? "reflowable"}`);
|
|
5818
5800
|
element.style.cssText = `
|
|
5819
5801
|
position: absolute;
|
|
5820
5802
|
overflow: hidden;
|
|
@@ -6670,10 +6652,6 @@
|
|
|
6670
6652
|
this.settings = settings;
|
|
6671
6653
|
this.hookManager = hookManager;
|
|
6672
6654
|
this.elementSubject = new rxjs.BehaviorSubject(noopElement());
|
|
6673
|
-
this.elementResize$ = this.elementSubject.pipe(
|
|
6674
|
-
operators.switchMap((element) => observeResize(element)),
|
|
6675
|
-
operators.share()
|
|
6676
|
-
);
|
|
6677
6655
|
this.element$ = this.elementSubject.asObservable();
|
|
6678
6656
|
this.spineLayout = new SpineLayout(spineItemsManager, context, settings);
|
|
6679
6657
|
this.locator = createSpineLocator({
|
|
@@ -6867,7 +6845,7 @@
|
|
|
6867
6845
|
}) => {
|
|
6868
6846
|
return {
|
|
6869
6847
|
...stateSubject$.value,
|
|
6870
|
-
supportedPageTurnMode: renditionFlow === `scrolled-continuous` ? [`scrollable`] :
|
|
6848
|
+
supportedPageTurnMode: renditionFlow === `scrolled-continuous` ? [`scrollable`] : [`controlled`, `scrollable`],
|
|
6871
6849
|
supportedPageTurnAnimation: renditionFlow === `scrolled-continuous` || computedPageTurnMode === `scrollable` ? [`none`] : hasVerticalWriting ? [`fade`, `none`] : [`fade`, `none`, `slide`],
|
|
6872
6850
|
supportedPageTurnDirection: computedPageTurnMode === `scrollable` ? [`vertical`] : renditionLayout === `reflowable` ? [`horizontal`] : [`horizontal`, `vertical`]
|
|
6873
6851
|
};
|
|
@@ -7218,23 +7196,20 @@
|
|
|
7218
7196
|
onLayout({
|
|
7219
7197
|
spreadPosition
|
|
7220
7198
|
}) {
|
|
7221
|
-
var _a, _b;
|
|
7222
7199
|
const element = this.getImageElement();
|
|
7223
|
-
const continuousScrollableReflowableItem = ((_a = this.context.manifest) == null ? void 0 : _a.renditionLayout) === "reflowable" && ((_b = this.context.manifest) == null ? void 0 : _b.renditionFlow) === "scrolled-continuous";
|
|
7224
7200
|
const { height: pageHeight, width: pageWidth } = this.context.getPageSize();
|
|
7225
7201
|
let height = pageHeight;
|
|
7226
7202
|
const width = pageWidth;
|
|
7227
|
-
if (element)
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
}
|
|
7203
|
+
if (!element) return rxjs.of(void 0);
|
|
7204
|
+
const naturalWidth = element.naturalWidth || 1;
|
|
7205
|
+
const naturalHeight = element.naturalHeight || 1;
|
|
7206
|
+
const ratio = naturalWidth / naturalHeight;
|
|
7207
|
+
if (this.settings.values.computedPageTurnDirection === "vertical" && this.settings.values.computedPageTurnMode === "scrollable" && !this.context.state.isUsingSpreadMode) {
|
|
7208
|
+
height = Math.ceil(pageWidth / ratio);
|
|
7209
|
+
}
|
|
7210
|
+
element.style.height = `${height}px`;
|
|
7211
|
+
element.style.width = `${width}px`;
|
|
7212
|
+
element.style.objectPosition = spreadPosition === "left" ? `right` : spreadPosition === `right` ? `left` : `center`;
|
|
7238
7213
|
return rxjs.of({
|
|
7239
7214
|
width,
|
|
7240
7215
|
height
|
|
@@ -7512,6 +7487,7 @@
|
|
|
7512
7487
|
const reader = next(options);
|
|
7513
7488
|
const createEntries$ = (items) => rxjs.of(
|
|
7514
7489
|
items.reduce((acc, { item, element }) => {
|
|
7490
|
+
element.style.zIndex = `0`;
|
|
7515
7491
|
const alreadyExistingElement = element.querySelector(
|
|
7516
7492
|
`.${CONTAINER_HTML_PREFIX}`
|
|
7517
7493
|
);
|
|
@@ -8740,16 +8716,14 @@
|
|
|
8740
8716
|
});
|
|
8741
8717
|
return rxjs.merge(...instances);
|
|
8742
8718
|
}),
|
|
8719
|
+
rxjs.startWith(void 0),
|
|
8743
8720
|
rxjs.distinctUntilChanged(),
|
|
8744
8721
|
rxjs.tap((value) => {
|
|
8745
8722
|
lasSelection = value;
|
|
8746
8723
|
}),
|
|
8747
8724
|
rxjs.shareReplay({ refCount: true, bufferSize: 1 })
|
|
8748
8725
|
);
|
|
8749
|
-
const selection$ = trackedSelection
|
|
8750
|
-
rxjs.filter((selection) => (selection == null ? void 0 : selection.type) === "change" || !selection),
|
|
8751
|
-
rxjs.share()
|
|
8752
|
-
);
|
|
8726
|
+
const selection$ = trackedSelection$;
|
|
8753
8727
|
const selectionStart$ = trackedSelection$.pipe(
|
|
8754
8728
|
rxjs.map((selection) => !!selection),
|
|
8755
8729
|
rxjs.distinctUntilChanged(),
|