@narumitw/pi-btw 0.56.0 → 0.56.2
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.ts +27 -6
- package/dist/index.ts.map +2 -2
- package/package.json +1 -1
- package/src/fullscreen-ui.ts +32 -6
package/dist/index.ts
CHANGED
|
@@ -693,9 +693,11 @@ var BtwFullscreenHost = class {
|
|
|
693
693
|
disposed = false;
|
|
694
694
|
finished = false;
|
|
695
695
|
parentStopped = false;
|
|
696
|
-
|
|
696
|
+
parentRestoreAttempted = false;
|
|
697
697
|
fullscreenCreated = false;
|
|
698
698
|
fullscreenStopped = false;
|
|
699
|
+
parentRestoreQueued = false;
|
|
700
|
+
parentRestorePromise;
|
|
699
701
|
cleanupError;
|
|
700
702
|
setParentOverlay(overlay) {
|
|
701
703
|
this.parentOverlay = overlay;
|
|
@@ -728,7 +730,7 @@ var BtwFullscreenHost = class {
|
|
|
728
730
|
try {
|
|
729
731
|
this.hardCancelActiveCustom?.();
|
|
730
732
|
} finally {
|
|
731
|
-
this.
|
|
733
|
+
this.queueParentRestore();
|
|
732
734
|
}
|
|
733
735
|
return { consume: true };
|
|
734
736
|
});
|
|
@@ -741,14 +743,33 @@ var BtwFullscreenHost = class {
|
|
|
741
743
|
} catch (error) {
|
|
742
744
|
this.cleanupError ??= error;
|
|
743
745
|
}
|
|
744
|
-
this.
|
|
746
|
+
if (this.parentRestorePromise) await this.parentRestorePromise;
|
|
747
|
+
else this.restoreParent();
|
|
745
748
|
if (this.cleanupError !== void 0) outcome = { kind: "failed", error: this.cleanupError };
|
|
746
749
|
this.finished = true;
|
|
747
750
|
this.done(outcome);
|
|
748
751
|
}
|
|
752
|
+
queueParentRestore() {
|
|
753
|
+
if (this.parentRestoreQueued || this.parentRestoreAttempted) return;
|
|
754
|
+
this.parentRestoreQueued = true;
|
|
755
|
+
this.parentRestorePromise = Promise.resolve().then(async () => {
|
|
756
|
+
try {
|
|
757
|
+
await this.fullscreen?.terminal.drainInput?.();
|
|
758
|
+
} catch (error) {
|
|
759
|
+
this.cleanupError ??= error;
|
|
760
|
+
}
|
|
761
|
+
this.parentRestoreQueued = false;
|
|
762
|
+
this.restoreParent();
|
|
763
|
+
});
|
|
764
|
+
}
|
|
749
765
|
restoreParent() {
|
|
750
|
-
this.removeHardCancelListener
|
|
766
|
+
const removeHardCancelListener = this.removeHardCancelListener;
|
|
751
767
|
this.removeHardCancelListener = void 0;
|
|
768
|
+
try {
|
|
769
|
+
removeHardCancelListener?.();
|
|
770
|
+
} catch (error) {
|
|
771
|
+
this.cleanupError ??= error;
|
|
772
|
+
}
|
|
752
773
|
if (this.fullscreenCreated && !this.fullscreenStopped) {
|
|
753
774
|
this.fullscreenStopped = true;
|
|
754
775
|
try {
|
|
@@ -757,7 +778,7 @@ var BtwFullscreenHost = class {
|
|
|
757
778
|
this.cleanupError ??= error;
|
|
758
779
|
}
|
|
759
780
|
}
|
|
760
|
-
if (!this.parentStopped || this.
|
|
781
|
+
if (!this.parentStopped || this.parentRestoreAttempted) return;
|
|
761
782
|
const parentOverlay = this.parentOverlay;
|
|
762
783
|
this.parentOverlay = void 0;
|
|
763
784
|
try {
|
|
@@ -766,8 +787,8 @@ var BtwFullscreenHost = class {
|
|
|
766
787
|
this.cleanupError ??= error;
|
|
767
788
|
}
|
|
768
789
|
try {
|
|
790
|
+
this.parentRestoreAttempted = true;
|
|
769
791
|
this.parent.start();
|
|
770
|
-
this.parentRestarted = true;
|
|
771
792
|
this.parent.renderNow(false);
|
|
772
793
|
} catch (error) {
|
|
773
794
|
this.cleanupError ??= error;
|