@prose-reader/core 1.68.0 → 1.69.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/index.umd.cjs
CHANGED
|
@@ -5537,73 +5537,88 @@
|
|
|
5537
5537
|
const loadSubject = new rxjs.Subject();
|
|
5538
5538
|
const unloadSubject = new rxjs.Subject();
|
|
5539
5539
|
const frameElementSubject = new rxjs.BehaviorSubject(void 0);
|
|
5540
|
-
const
|
|
5541
|
-
const unload$ = unloadSubject.asObservable();
|
|
5542
|
-
const stateIdle$ = stateSubject.pipe(operators.filter((state) => state === "idle"));
|
|
5543
|
-
const stateIsReady$ = stateSubject.pipe(
|
|
5544
|
-
operators.map((state) => state === "ready"),
|
|
5545
|
-
operators.distinctUntilChanged()
|
|
5546
|
-
);
|
|
5547
|
-
const unloaded$ = unload$.pipe(
|
|
5540
|
+
const unloadFrame$ = unloadSubject.pipe(
|
|
5548
5541
|
operators.withLatestFrom(stateSubject),
|
|
5549
5542
|
operators.filter(([, state]) => state !== "unloading" && state !== "idle"),
|
|
5550
|
-
operators.exhaustMap(() => {
|
|
5551
|
-
stateSubject.next("unloading");
|
|
5552
|
-
return unloadFrame({
|
|
5553
|
-
hookManager,
|
|
5554
|
-
item,
|
|
5555
|
-
frameElement: frameElementSubject.getValue(),
|
|
5556
|
-
context
|
|
5557
|
-
}).pipe(
|
|
5558
|
-
operators.tap(() => {
|
|
5559
|
-
frameElementSubject.next(void 0);
|
|
5560
|
-
stateSubject.next("idle");
|
|
5561
|
-
})
|
|
5562
|
-
);
|
|
5563
|
-
}),
|
|
5564
|
-
operators.share()
|
|
5565
|
-
);
|
|
5566
|
-
const loaded$ = load$.pipe(
|
|
5567
5543
|
operators.exhaustMap(
|
|
5568
|
-
() =>
|
|
5544
|
+
() => context.bridgeEvent.viewportFree$.pipe(
|
|
5569
5545
|
operators.first(),
|
|
5570
|
-
operators.tap(() => {
|
|
5571
|
-
stateSubject.next("loading");
|
|
5572
|
-
}),
|
|
5573
|
-
waitForSwitch(context.bridgeEvent.viewportFree$),
|
|
5574
5546
|
operators.switchMap(
|
|
5575
|
-
() =>
|
|
5576
|
-
element: parent,
|
|
5547
|
+
() => unloadFrame({
|
|
5577
5548
|
hookManager,
|
|
5578
5549
|
item,
|
|
5579
|
-
|
|
5580
|
-
frameElementSubject.next(element);
|
|
5581
|
-
},
|
|
5582
|
-
settings,
|
|
5550
|
+
frameElement: frameElementSubject.getValue(),
|
|
5583
5551
|
context
|
|
5584
5552
|
})
|
|
5585
5553
|
),
|
|
5586
5554
|
operators.tap(() => {
|
|
5587
|
-
|
|
5555
|
+
frameElementSubject.next(void 0);
|
|
5588
5556
|
}),
|
|
5589
|
-
operators.
|
|
5557
|
+
operators.ignoreElements(),
|
|
5558
|
+
operators.startWith("loading"),
|
|
5559
|
+
operators.endWith("success"),
|
|
5560
|
+
operators.defaultIfEmpty("idle")
|
|
5590
5561
|
)
|
|
5591
5562
|
),
|
|
5563
|
+
operators.startWith("idle"),
|
|
5564
|
+
operators.distinctUntilChanged(),
|
|
5565
|
+
operators.share()
|
|
5566
|
+
);
|
|
5567
|
+
const unloaded$ = unloadFrame$.pipe(operators.filter((state) => state === "success"));
|
|
5568
|
+
const unloading$ = unloadFrame$.pipe(operators.filter((state) => state === "loading"));
|
|
5569
|
+
const loadFrame$ = loadSubject.pipe(
|
|
5570
|
+
operators.exhaustMap(() => {
|
|
5571
|
+
const preventFurtherLoad$ = rxjs.NEVER;
|
|
5572
|
+
return rxjs.merge(
|
|
5573
|
+
preventFurtherLoad$,
|
|
5574
|
+
context.bridgeEvent.viewportFree$.pipe(
|
|
5575
|
+
operators.first(),
|
|
5576
|
+
operators.switchMap(
|
|
5577
|
+
() => loadFrame({
|
|
5578
|
+
element: parent,
|
|
5579
|
+
hookManager,
|
|
5580
|
+
item,
|
|
5581
|
+
onFrameElement: (element) => {
|
|
5582
|
+
frameElementSubject.next(element);
|
|
5583
|
+
},
|
|
5584
|
+
settings,
|
|
5585
|
+
context
|
|
5586
|
+
})
|
|
5587
|
+
),
|
|
5588
|
+
operators.map((frame) => ({ state: "success", frame })),
|
|
5589
|
+
operators.startWith({ state: "loading" }),
|
|
5590
|
+
operators.defaultIfEmpty({ state: "idle" })
|
|
5591
|
+
)
|
|
5592
|
+
).pipe(operators.takeUntil(unloaded$));
|
|
5593
|
+
}),
|
|
5594
|
+
operators.startWith({ state: "idle" }),
|
|
5592
5595
|
operators.share()
|
|
5593
5596
|
);
|
|
5594
|
-
const
|
|
5597
|
+
const loading$ = loadFrame$.pipe(operators.filter(({ state }) => state === "loading"));
|
|
5598
|
+
const loaded$ = loadFrame$.pipe(
|
|
5599
|
+
operators.filter((state) => state.state === "success"),
|
|
5600
|
+
operators.map(({ frame }) => frame)
|
|
5601
|
+
);
|
|
5602
|
+
const frameIsReady$ = loaded$.pipe(
|
|
5595
5603
|
operators.switchMap(
|
|
5596
|
-
(frame) => rxjs.of(frame).pipe(
|
|
5597
|
-
waitForFrameReady,
|
|
5598
|
-
operators.tap(() => {
|
|
5599
|
-
stateSubject.next("ready");
|
|
5600
|
-
}),
|
|
5601
|
-
operators.takeUntil(unload$)
|
|
5602
|
-
)
|
|
5604
|
+
(frame) => rxjs.of(frame).pipe(waitForFrameReady, operators.takeUntil(unloadSubject))
|
|
5603
5605
|
),
|
|
5604
5606
|
operators.share()
|
|
5605
5607
|
);
|
|
5606
|
-
|
|
5608
|
+
const ready$ = frameIsReady$;
|
|
5609
|
+
const state$ = rxjs.merge(
|
|
5610
|
+
unloaded$.pipe(operators.map(() => "idle")),
|
|
5611
|
+
unloading$.pipe(operators.map(() => "unloading")),
|
|
5612
|
+
loaded$.pipe(operators.map(() => "loaded")),
|
|
5613
|
+
loading$.pipe(operators.map(() => "loading")),
|
|
5614
|
+
ready$.pipe(operators.map(() => "ready"))
|
|
5615
|
+
).pipe(
|
|
5616
|
+
operators.startWith("idle"),
|
|
5617
|
+
operators.tap((state) => stateSubject.next(state)),
|
|
5618
|
+
operators.shareReplay(1)
|
|
5619
|
+
);
|
|
5620
|
+
const isReady$ = state$.pipe(operators.map((state) => state === "ready"));
|
|
5621
|
+
state$.pipe(operators.takeUntil(destroySubject$)).subscribe();
|
|
5607
5622
|
return {
|
|
5608
5623
|
load: () => loadSubject.next(),
|
|
5609
5624
|
unload: () => unloadSubject.next(),
|
|
@@ -5614,6 +5629,7 @@
|
|
|
5614
5629
|
frameElementSubject.complete();
|
|
5615
5630
|
destroySubject$.next();
|
|
5616
5631
|
destroySubject$.complete();
|
|
5632
|
+
stateSubject.complete();
|
|
5617
5633
|
},
|
|
5618
5634
|
get state() {
|
|
5619
5635
|
return stateSubject.getValue();
|
|
@@ -5621,7 +5637,7 @@
|
|
|
5621
5637
|
get element() {
|
|
5622
5638
|
return frameElementSubject.getValue();
|
|
5623
5639
|
},
|
|
5624
|
-
isReady
|
|
5640
|
+
isReady$,
|
|
5625
5641
|
ready$,
|
|
5626
5642
|
loaded$,
|
|
5627
5643
|
unloaded$,
|