@prose-reader/core 1.141.0 → 1.143.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 +44 -72
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +44 -72
- 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,14 @@
|
|
|
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 (((_a = frame.contentDocument) == null ? void 0 : _a.readyState) === "complete") return rxjs.of(frame);
|
|
256
|
+
return rxjs.fromEvent(frame, `load`).pipe(
|
|
255
257
|
rxjs.take(1),
|
|
256
258
|
rxjs.map(() => frame)
|
|
257
|
-
)
|
|
258
|
-
)
|
|
259
|
+
);
|
|
260
|
+
})
|
|
259
261
|
);
|
|
260
262
|
const waitForFrameReady = (stream) => stream.pipe(
|
|
261
263
|
rxjs.switchMap(
|
|
@@ -1936,7 +1938,6 @@
|
|
|
1936
1938
|
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
1939
|
};
|
|
1938
1940
|
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
1941
|
class BridgeEvent {
|
|
1941
1942
|
constructor() {
|
|
1942
1943
|
this.navigationSubject = new rxjs.ReplaySubject(1);
|
|
@@ -2021,7 +2022,6 @@
|
|
|
2021
2022
|
height: newState.visibleAreaRect.height - marginTop - marginBottom
|
|
2022
2023
|
},
|
|
2023
2024
|
...newState.manifest && {
|
|
2024
|
-
areAllItemsPrePaginated: areAllItemsPrePaginated(manifest),
|
|
2025
2025
|
isFullyPrePaginated: isFullyPrePaginated(manifest)
|
|
2026
2026
|
},
|
|
2027
2027
|
isUsingSpreadMode: isUsingSpreadMode({
|
|
@@ -4076,28 +4076,21 @@
|
|
|
4076
4076
|
this.navigation$ = this.navigationSubject.asObservable();
|
|
4077
4077
|
const userScroll$ = element$.pipe(
|
|
4078
4078
|
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(
|
|
4079
|
+
(element) => settings.watch(["computedPageTurnMode"]).pipe(
|
|
4080
|
+
rxjs.switchMap(
|
|
4081
|
+
({ computedPageTurnMode }) => computedPageTurnMode === "controlled" ? rxjs.NEVER : rxjs.fromEvent(element, `scroll`).pipe(
|
|
4087
4082
|
rxjs.withLatestFrom(scrollHappeningFromBrowser$),
|
|
4088
|
-
rxjs.filter(
|
|
4083
|
+
rxjs.filter(
|
|
4084
|
+
([, shouldAvoidScrollEvent]) => !shouldAvoidScrollEvent
|
|
4085
|
+
),
|
|
4089
4086
|
rxjs.map(([event]) => event)
|
|
4090
|
-
)
|
|
4091
|
-
|
|
4087
|
+
)
|
|
4088
|
+
)
|
|
4092
4089
|
)
|
|
4093
4090
|
),
|
|
4094
4091
|
rxjs.share()
|
|
4095
4092
|
);
|
|
4096
|
-
const navigateOnScroll$ =
|
|
4097
|
-
rxjs.map(({ computedPageTurnMode }) => computedPageTurnMode),
|
|
4098
|
-
rxjs.distinctUntilChanged(),
|
|
4099
|
-
rxjs.filter((computedPageTurnMode) => computedPageTurnMode === "scrollable"),
|
|
4100
|
-
rxjs.switchMap(() => userScroll$),
|
|
4093
|
+
const navigateOnScroll$ = userScroll$.pipe(
|
|
4101
4094
|
rxjs.exhaustMap((event) => {
|
|
4102
4095
|
const unlock = this.locker.lock();
|
|
4103
4096
|
return rxjs.merge(userScroll$, rxjs.of(event)).pipe(
|
|
@@ -4264,20 +4257,8 @@
|
|
|
4264
4257
|
});
|
|
4265
4258
|
}
|
|
4266
4259
|
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") {
|
|
4260
|
+
const positionIsBeforeItem = navigation.position.y < top;
|
|
4261
|
+
if (!positionIsBeforeItem) {
|
|
4281
4262
|
const positionInItem = {
|
|
4282
4263
|
y: height - positionYfromBottomPreviousNavigation,
|
|
4283
4264
|
x: navigation.position.x
|
|
@@ -4973,11 +4954,17 @@
|
|
|
4973
4954
|
spine
|
|
4974
4955
|
);
|
|
4975
4956
|
const isSpineScrolling$ = rxjs.merge(
|
|
4976
|
-
spine.
|
|
4957
|
+
spine.element$.pipe(operators.switchMap((element) => observeResize(element))),
|
|
4977
4958
|
spine.element$.pipe(operators.switchMap((element) => rxjs.fromEvent(element, "scroll"))),
|
|
4978
4959
|
spine.spineItemsObserver.itemResize$
|
|
4979
4960
|
).pipe(
|
|
4980
|
-
operators.switchMap(
|
|
4961
|
+
operators.switchMap(
|
|
4962
|
+
() => rxjs.timer(10).pipe(
|
|
4963
|
+
operators.map(() => false),
|
|
4964
|
+
operators.startWith(true)
|
|
4965
|
+
)
|
|
4966
|
+
),
|
|
4967
|
+
operators.distinctUntilChanged(),
|
|
4981
4968
|
operators.startWith(false)
|
|
4982
4969
|
);
|
|
4983
4970
|
const scrollHappeningFromBrowser$ = rxjs.combineLatest([
|
|
@@ -5135,20 +5122,13 @@
|
|
|
5135
5122
|
const computedSettings = {
|
|
5136
5123
|
computedPageTurnDirection: settings.pageTurnDirection,
|
|
5137
5124
|
computedPageTurnAnimation: settings.pageTurnAnimation,
|
|
5138
|
-
computedPageTurnMode:
|
|
5125
|
+
computedPageTurnMode: settings.pageTurnMode,
|
|
5139
5126
|
computedPageTurnAnimationDuration: 0
|
|
5140
5127
|
};
|
|
5141
5128
|
if ((manifest == null ? void 0 : manifest.renditionFlow) === `scrolled-continuous`) {
|
|
5142
5129
|
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`;
|
|
5130
|
+
}
|
|
5131
|
+
if (computedSettings.computedPageTurnMode === "scrollable") {
|
|
5152
5132
|
computedSettings.computedPageTurnDirection = `vertical`;
|
|
5153
5133
|
}
|
|
5154
5134
|
if (hasVerticalWriting && computedSettings.computedPageTurnAnimation === `slide`) {
|
|
@@ -6670,10 +6650,6 @@
|
|
|
6670
6650
|
this.settings = settings;
|
|
6671
6651
|
this.hookManager = hookManager;
|
|
6672
6652
|
this.elementSubject = new rxjs.BehaviorSubject(noopElement());
|
|
6673
|
-
this.elementResize$ = this.elementSubject.pipe(
|
|
6674
|
-
operators.switchMap((element) => observeResize(element)),
|
|
6675
|
-
operators.share()
|
|
6676
|
-
);
|
|
6677
6653
|
this.element$ = this.elementSubject.asObservable();
|
|
6678
6654
|
this.spineLayout = new SpineLayout(spineItemsManager, context, settings);
|
|
6679
6655
|
this.locator = createSpineLocator({
|
|
@@ -6867,7 +6843,7 @@
|
|
|
6867
6843
|
}) => {
|
|
6868
6844
|
return {
|
|
6869
6845
|
...stateSubject$.value,
|
|
6870
|
-
supportedPageTurnMode: renditionFlow === `scrolled-continuous` ? [`scrollable`] :
|
|
6846
|
+
supportedPageTurnMode: renditionFlow === `scrolled-continuous` ? [`scrollable`] : [`controlled`, `scrollable`],
|
|
6871
6847
|
supportedPageTurnAnimation: renditionFlow === `scrolled-continuous` || computedPageTurnMode === `scrollable` ? [`none`] : hasVerticalWriting ? [`fade`, `none`] : [`fade`, `none`, `slide`],
|
|
6872
6848
|
supportedPageTurnDirection: computedPageTurnMode === `scrollable` ? [`vertical`] : renditionLayout === `reflowable` ? [`horizontal`] : [`horizontal`, `vertical`]
|
|
6873
6849
|
};
|
|
@@ -7218,23 +7194,20 @@
|
|
|
7218
7194
|
onLayout({
|
|
7219
7195
|
spreadPosition
|
|
7220
7196
|
}) {
|
|
7221
|
-
var _a, _b;
|
|
7222
7197
|
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
7198
|
const { height: pageHeight, width: pageWidth } = this.context.getPageSize();
|
|
7225
7199
|
let height = pageHeight;
|
|
7226
7200
|
const width = pageWidth;
|
|
7227
|
-
if (element)
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
}
|
|
7201
|
+
if (!element) return rxjs.of(void 0);
|
|
7202
|
+
const naturalWidth = element.naturalWidth || 1;
|
|
7203
|
+
const naturalHeight = element.naturalHeight || 1;
|
|
7204
|
+
const ratio = naturalWidth / naturalHeight;
|
|
7205
|
+
if (this.settings.values.computedPageTurnDirection === "vertical" && this.settings.values.computedPageTurnMode === "scrollable" && !this.context.state.isUsingSpreadMode) {
|
|
7206
|
+
height = Math.ceil(pageWidth / ratio);
|
|
7207
|
+
}
|
|
7208
|
+
element.style.height = `${height}px`;
|
|
7209
|
+
element.style.width = `${width}px`;
|
|
7210
|
+
element.style.objectPosition = spreadPosition === "left" ? `right` : spreadPosition === `right` ? `left` : `center`;
|
|
7238
7211
|
return rxjs.of({
|
|
7239
7212
|
width,
|
|
7240
7213
|
height
|
|
@@ -7512,6 +7485,7 @@
|
|
|
7512
7485
|
const reader = next(options);
|
|
7513
7486
|
const createEntries$ = (items) => rxjs.of(
|
|
7514
7487
|
items.reduce((acc, { item, element }) => {
|
|
7488
|
+
element.style.zIndex = `0`;
|
|
7515
7489
|
const alreadyExistingElement = element.querySelector(
|
|
7516
7490
|
`.${CONTAINER_HTML_PREFIX}`
|
|
7517
7491
|
);
|
|
@@ -8740,16 +8714,14 @@
|
|
|
8740
8714
|
});
|
|
8741
8715
|
return rxjs.merge(...instances);
|
|
8742
8716
|
}),
|
|
8717
|
+
rxjs.startWith(void 0),
|
|
8743
8718
|
rxjs.distinctUntilChanged(),
|
|
8744
8719
|
rxjs.tap((value) => {
|
|
8745
8720
|
lasSelection = value;
|
|
8746
8721
|
}),
|
|
8747
8722
|
rxjs.shareReplay({ refCount: true, bufferSize: 1 })
|
|
8748
8723
|
);
|
|
8749
|
-
const selection$ = trackedSelection
|
|
8750
|
-
rxjs.filter((selection) => (selection == null ? void 0 : selection.type) === "change" || !selection),
|
|
8751
|
-
rxjs.share()
|
|
8752
|
-
);
|
|
8724
|
+
const selection$ = trackedSelection$;
|
|
8753
8725
|
const selectionStart$ = trackedSelection$.pipe(
|
|
8754
8726
|
rxjs.map((selection) => !!selection),
|
|
8755
8727
|
rxjs.distinctUntilChanged(),
|
|
@@ -8771,9 +8743,9 @@
|
|
|
8771
8743
|
rxjs.withLatestFrom(selection$),
|
|
8772
8744
|
rxjs.map(([, selection]) => selection),
|
|
8773
8745
|
rxjs.startWith(void 0),
|
|
8774
|
-
rxjs.shareReplay(1)
|
|
8746
|
+
rxjs.shareReplay({ refCount: true, bufferSize: 1 })
|
|
8775
8747
|
);
|
|
8776
|
-
selection
|
|
8748
|
+
rxjs.merge(selection$, lastSelectionOnPointerdown$).pipe(rxjs.takeUntil(reader.$.destroy$)).subscribe();
|
|
8777
8749
|
return {
|
|
8778
8750
|
...reader,
|
|
8779
8751
|
selection: {
|