@prose-reader/core 1.281.0 → 1.283.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.js CHANGED
@@ -669,7 +669,7 @@ const ri = (t) => (e) => {
669
669
  );
670
670
  class ee extends se {
671
671
  constructor(e) {
672
- super((n) => this.stateSubject.pipe(T(this._destroy$)).subscribe(n)), this._destroy$ = new R(), this.destroy$ = this._destroy$.asObservable(), this.stateSubject = new Y(e);
672
+ super((n) => this.stateSubject.pipe(T(this._destroy$)).subscribe(n)), this._destroy$ = new R(), this.destroy$ = this._destroy$.asObservable(), this.stateSubject = new Y(e), this.state$ = this.stateSubject.asObservable();
673
673
  }
674
674
  next(e) {
675
675
  this.stateSubject.next(e);
@@ -698,7 +698,8 @@ const Ae = class Ae extends ee {
698
698
  constructor(e) {
699
699
  super({
700
700
  state: "idle",
701
- error: void 0
701
+ error: void 0,
702
+ documentContainer: void 0
702
703
  }), this.triggerSubject = new R(), this.context = e.context, this.settings = e.settings, this.hookManager = e.hookManager, this.item = e.item, this.containerElement = e.containerElement, this.resourcesHandler = e.resourcesHandler, this.viewport = e.viewport;
703
704
  const n = this.triggerSubject.pipe(
704
705
  M((o) => o.type === "unload")
@@ -706,7 +707,7 @@ const Ae = class Ae extends ee {
706
707
  M((o) => o.type === "load")
707
708
  );
708
709
  this.loaded$ = i.pipe(
709
- fe(() => this.value.state === "loaded" || this.value.state === "loading" ? X : (this.next({ state: "loading", error: void 0 }), this.onCreateDocument().pipe(j()).pipe(
710
+ fe(() => this.value.state === "loaded" || this.value.state === "loading" ? X : (this.mergeCompare({ state: "loading", error: void 0 }), this.onCreateDocument().pipe(j()).pipe(
710
711
  fe((s) => (this.hookManager.execute("item.onDocumentCreated", this.item.id, {
711
712
  itemId: this.item.id,
712
713
  documentContainer: s
@@ -726,13 +727,13 @@ const Ae = class Ae extends ee {
726
727
  })
727
728
  ))),
728
729
  y(() => {
729
- this.next({ state: "loaded", error: void 0 });
730
+ this.mergeCompare({ state: "loaded", error: void 0 });
730
731
  }),
731
732
  T(n)
732
733
  ))),
733
734
  A()
734
735
  ), this.unloaded$ = n.pipe(
735
- fe(() => this.value.state === "unloading" || this.value.state === "idle" ? X : (this.next({ state: "unloading", error: void 0 }), this.context.bridgeEvent.viewportFree$.pipe(
736
+ fe(() => this.value.state === "unloading" || this.value.state === "idle" ? X : (this.mergeCompare({ state: "unloading", error: void 0 }), this.context.bridgeEvent.viewportFree$.pipe(
736
737
  j(),
737
738
  P(() => (this.hookManager.destroy("item.onDocumentLoad", this.item.id), He(() => this.onUnload()).pipe(
738
739
  Ie(null),
@@ -740,29 +741,24 @@ const Ae = class Ae extends ee {
740
741
  Te((s) => (E.error("Error unloading document", s), v(null)))
741
742
  ))),
742
743
  y(() => {
743
- this.next({ state: "idle", error: void 0 });
744
+ this.mergeCompare({ state: "idle", error: void 0 });
744
745
  }),
745
746
  T(i)
746
747
  ))),
747
748
  A()
748
749
  ), w(this.loaded$, this.unloaded$).pipe(
749
- Te((o) => (this.next({ state: "error", error: o }), X)),
750
+ Te((o) => (this.mergeCompare({ state: "error", error: o }), X)),
750
751
  T(this.destroy$)
751
752
  ).subscribe();
752
753
  }
753
754
  setDocumentContainer(e) {
754
- this._documentContainer = e, this._documentContainer.classList.add(
755
- Ae.DOCUMENT_CONTAINER_CLASS_NAME
756
- );
755
+ e.classList.add(Ae.DOCUMENT_CONTAINER_CLASS_NAME), this.mergeCompare({ documentContainer: e });
757
756
  }
758
757
  attach() {
759
758
  this.documentContainer && this.containerElement.appendChild(this.documentContainer);
760
759
  }
761
760
  detach() {
762
- this._documentContainer?.remove(), this._documentContainer = void 0;
763
- }
764
- get state$() {
765
- return this.stateSubject;
761
+ this.documentContainer?.remove(), this.mergeCompare({ documentContainer: void 0 });
766
762
  }
767
763
  get isLoaded$() {
768
764
  return this.state$.pipe(y((e) => e.state === "loaded"));
@@ -803,7 +799,7 @@ const Ae = class Ae extends ee {
803
799
  this.unload(), this.stateSubject.complete(), super.destroy();
804
800
  }
805
801
  get documentContainer() {
806
- return this._documentContainer;
802
+ return this.value.documentContainer;
807
803
  }
808
804
  get writingMode() {
809
805
  }
@@ -5996,7 +5992,7 @@ class sn extends ee {
5996
5992
  k(() => {
5997
5993
  this.mergeCompare({
5998
5994
  isDirty: !1,
5999
- isReady: this.renderer.state$.value.state === "loaded"
5995
+ isReady: this.renderer.value.state === "loaded"
6000
5996
  });
6001
5997
  }),
6002
5998
  En()