@franzzemen/brokenstock-shell 0.9.4 → 0.9.5
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.
|
@@ -2606,21 +2606,59 @@ const WINDOW_KEY = 'shell.commandTerminalVisible.window';
|
|
|
2606
2606
|
* caller could `set()` it — and whether that got remembered depended on an
|
|
2607
2607
|
* effect firing somewhere else. Persisting inside the one mutator makes it
|
|
2608
2608
|
* impossible to change this without persisting it.
|
|
2609
|
+
*
|
|
2610
|
+
* ⚠ A SCREEN CAN HIDE IT WITHOUT TOUCHING THE CHOICE (projects review-defects-2026-10.prd.md E21;
|
|
2611
|
+
* live-trading OT-19). The Trading screen hides the terminal on a phone. It used to do that with
|
|
2612
|
+
* `toggle()`, which saved "hidden" as the default for every new window, and put it back when the
|
|
2613
|
+
* screen closed. Closing the TAB never closes the screen, so the put-back never ran and the next
|
|
2614
|
+
* window started hidden. `hideForScreen()` hides it in this window's memory only — nothing is
|
|
2615
|
+
* written, so nothing outlives the tab — and returns the release. The person's ☰ still wins:
|
|
2616
|
+
* a toggle while a screen has it hidden shows it again, and saves nothing, because the saved
|
|
2617
|
+
* choice was "visible" all along.
|
|
2609
2618
|
*/
|
|
2610
2619
|
class TerminalVisibilityService {
|
|
2611
2620
|
constructor() {
|
|
2612
|
-
|
|
2613
|
-
|
|
2621
|
+
/** The person's choice — the one that is saved. */
|
|
2622
|
+
this.#choice = signal(this.#readInitial(), /* @ts-ignore */
|
|
2623
|
+
...(ngDevMode ? [{ debugName: "#choice" }] : /* istanbul ignore next */ []));
|
|
2624
|
+
/** Screens currently hiding the terminal. Memory only, never saved. */
|
|
2625
|
+
this.#screenHides = signal(new Set(), /* @ts-ignore */
|
|
2626
|
+
...(ngDevMode ? [{ debugName: "#screenHides" }] : /* istanbul ignore next */ []));
|
|
2614
2627
|
/** Read-only on purpose — see the header. */
|
|
2615
|
-
this.visible = this.#
|
|
2628
|
+
this.visible = computed(() => this.#choice() && this.#screenHides().size === 0, /* @ts-ignore */
|
|
2629
|
+
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
2616
2630
|
}
|
|
2617
|
-
|
|
2631
|
+
/** The person's choice — the one that is saved. */
|
|
2632
|
+
#choice;
|
|
2633
|
+
/** Screens currently hiding the terminal. Memory only, never saved. */
|
|
2634
|
+
#screenHides;
|
|
2618
2635
|
toggle() {
|
|
2619
|
-
|
|
2620
|
-
|
|
2636
|
+
if (this.#choice() && this.#screenHides().size > 0) {
|
|
2637
|
+
// Hidden by a screen, not by the person: ☰ shows it, and the saved choice stays "visible".
|
|
2638
|
+
this.#screenHides.set(new Set());
|
|
2639
|
+
return;
|
|
2640
|
+
}
|
|
2641
|
+
const next = !this.#choice();
|
|
2642
|
+
this.#choice.set(next);
|
|
2621
2643
|
this.#write(sessionStorage, WINDOW_KEY, next);
|
|
2622
2644
|
this.#write(localStorage, DEFAULT_KEY, next);
|
|
2623
2645
|
}
|
|
2646
|
+
/**
|
|
2647
|
+
* Hides the terminal while a screen needs the room, without changing what is saved. Returns the
|
|
2648
|
+
* release; call it when the screen no longer needs it hidden (and on destroy). Releasing twice,
|
|
2649
|
+
* or after ☰ already showed it, does nothing.
|
|
2650
|
+
*/
|
|
2651
|
+
hideForScreen() {
|
|
2652
|
+
const token = Symbol('screen-hide');
|
|
2653
|
+
this.#screenHides.update(s => new Set(s).add(token));
|
|
2654
|
+
return () => this.#screenHides.update(s => {
|
|
2655
|
+
if (!s.has(token))
|
|
2656
|
+
return s;
|
|
2657
|
+
const next = new Set(s);
|
|
2658
|
+
next.delete(token);
|
|
2659
|
+
return next;
|
|
2660
|
+
});
|
|
2661
|
+
}
|
|
2624
2662
|
/**
|
|
2625
2663
|
* This window's own choice wins; otherwise the last choice made anywhere;
|
|
2626
2664
|
* otherwise visible.
|